add 增加 催办接口 调整消息发送

This commit is contained in:
疯狂的狮子Li
2025-07-22 18:15:26 +08:00
parent 7ab62a89be
commit f5729d040d
6 changed files with 106 additions and 1 deletions

View File

@@ -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));
}
}

View File

@@ -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;
}

View File

@@ -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);
/**
* 申请人节点编码
*

View File

@@ -199,4 +199,11 @@ public interface IFlwTaskService {
*/
FlowNode getByNodeCode(String nodeCode, Long definitionId);
/**
* 催办任务
*
* @param bo 参数
* @return 结果
*/
boolean urgeTask(FlowUrgeTaskBo bo);
}

View File

@@ -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);
}
}
}
/**

View File

@@ -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;
}
}