mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-10-14 14:10:24 +00:00
add 增加 催办接口 调整消息发送
This commit is contained in:
@@ -209,4 +209,15 @@ public class FlwTaskController extends BaseController {
|
||||
return R.ok(flwTaskService.currentTaskAllUser(List.of(taskId)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 催办任务
|
||||
*
|
||||
* @param bo 参数
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/urgeTask")
|
||||
public R<Void> urgeTask(@RequestBody FlowUrgeTaskBo bo) {
|
||||
return toAjax(flwTaskService.urgeTask(bo));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,38 @@
|
||||
package org.dromara.workflow.domain.bo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程变量参数
|
||||
*
|
||||
* @author may
|
||||
*/
|
||||
@Data
|
||||
public class FlowUrgeTaskBo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 任务id
|
||||
*/
|
||||
@NotNull(message = "任务id为空", groups = AddGroup.class)
|
||||
private List<Long> taskIdList;
|
||||
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
private List<String> messageType;
|
||||
|
||||
/**
|
||||
* 催办内容
|
||||
*/
|
||||
@NotNull(message = "催办内容为空", groups = AddGroup.class)
|
||||
private String message;
|
||||
}
|
@@ -1,5 +1,7 @@
|
||||
package org.dromara.workflow.service;
|
||||
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -18,6 +20,16 @@ public interface IFlwCommonService {
|
||||
*/
|
||||
void sendMessage(String flowName, Long instId, List<String> messageType, String message);
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
* @param messageType 消息类型
|
||||
* @param message 消息内容
|
||||
* @param subject 邮件标题
|
||||
* @param userList 接收用户
|
||||
*/
|
||||
void sendMessage(List<String> messageType, String message, String subject, List<RemoteUserVo> userList);
|
||||
|
||||
/**
|
||||
* 申请人节点编码
|
||||
*
|
||||
|
@@ -199,4 +199,11 @@ public interface IFlwTaskService {
|
||||
*/
|
||||
FlowNode getByNodeCode(String nodeCode, Long definitionId);
|
||||
|
||||
/**
|
||||
* 催办任务
|
||||
*
|
||||
* @param bo 参数
|
||||
* @return 结果
|
||||
*/
|
||||
boolean urgeTask(FlowUrgeTaskBo bo);
|
||||
}
|
||||
|
@@ -61,6 +61,19 @@ public class FlwCommonServiceImpl implements IFlwCommonService {
|
||||
if (CollUtil.isEmpty(userList)) {
|
||||
return;
|
||||
}
|
||||
sendMessage(messageType, message, "单据审批提醒", userList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
* @param messageType 消息类型
|
||||
* @param message 消息内容
|
||||
* @param subject 邮件标题
|
||||
* @param userList 接收用户
|
||||
*/
|
||||
@Override
|
||||
public void sendMessage(List<String> messageType, String message, String subject, List<RemoteUserVo> userList) {
|
||||
for (String code : messageType) {
|
||||
MessageTypeEnum messageTypeEnum = MessageTypeEnum.getByCode(code);
|
||||
if (ObjectUtil.isEmpty(messageTypeEnum)) {
|
||||
@@ -80,7 +93,6 @@ public class FlwCommonServiceImpl implements IFlwCommonService {
|
||||
default -> throw new IllegalStateException("Unexpected value: " + messageTypeEnum);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -725,4 +725,29 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
.eq(FlowNode::getDefinitionId, definitionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 催办任务
|
||||
*
|
||||
* @param bo 参数
|
||||
*/
|
||||
@Override
|
||||
public boolean urgeTask(FlowUrgeTaskBo bo) {
|
||||
try {
|
||||
if (CollUtil.isEmpty(bo.getTaskIdList())) {
|
||||
return false;
|
||||
}
|
||||
List<RemoteUserVo> userList = this.currentTaskAllUser(bo.getTaskIdList());
|
||||
if (CollUtil.isEmpty(userList)) {
|
||||
return false;
|
||||
}
|
||||
List<String> messageType = bo.getMessageType();
|
||||
String message = bo.getMessage();
|
||||
flwCommonService.sendMessage(messageType, message, "单据审批提醒", userList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user