feat(task): 完善任务流程管理功能并集成待办推送
- 移除多余空行优化代码格式 - 集成TodoList消息推送功能支持任务完成和新增待办事件 - 添加WorkCodeEnum枚举的中文名称映射和获取方法 - 扩展EightworkInfoPageQry查询条件支持多字段筛选 - 实现分页查询的动态SQL映射配置 - 添加RocketMQ依赖支持消息队列功能 - 在任务日志更新时发送待办完成事件和新增待办事件 - 优化待办标题显示为具体流程类型名称master
parent
d99628f916
commit
040673973e
|
|
@ -4,17 +4,25 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zcloud.eightwork.domain.gateway.TaskLogGateway;
|
||||
import com.zcloud.eightwork.domain.model.MeasuresLogsE;
|
||||
import com.zcloud.eightwork.domain.model.TaskLogE;
|
||||
import com.zcloud.eightwork.domain.model.enums.MenuEnum;
|
||||
import com.zcloud.eightwork.domain.model.enums.WorkCodeEnum;
|
||||
import com.zcloud.eightwork.dto.TaskLogNextCmd;
|
||||
import com.zcloud.eightwork.dto.TaskLogUpdateCmd;
|
||||
import com.zcloud.eightwork.dto.TaskSignStepInfoCmd;
|
||||
import com.zcloud.eightwork.persistence.dataobject.EightworkInfoDO;
|
||||
import com.zcloud.eightwork.persistence.dataobject.MeasuresLogsDO;
|
||||
import com.zcloud.eightwork.persistence.dataobject.TaskLogDO;
|
||||
import com.zcloud.eightwork.persistence.repository.EightworkInfoRepository;
|
||||
import com.zcloud.eightwork.persistence.repository.MeasuresLogsRepository;
|
||||
import com.zcloud.eightwork.persistence.repository.TaskLogRepository;
|
||||
import com.zcloud.gbscommon.todolistmq.TodoListEventPusherUtil;
|
||||
import com.zcloud.gbscommon.todolistmq.event.TodoListAddEvent;
|
||||
import com.zcloud.gbscommon.todolistmq.event.TodoListCompleteEvent;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -39,6 +47,7 @@ public class TaskLogUpdateExe {
|
|||
private final TaskLogRepository taskLogRepository;
|
||||
private final MeasuresLogsRepository measuresLogsRepository;
|
||||
private final EightworkInfoRepository eightworkInfoRepository;
|
||||
private final TodoListEventPusherUtil todoListEventPusherUtil;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(TaskLogUpdateCmd taskLogUpdateCmd) {
|
||||
|
|
@ -62,6 +71,11 @@ public class TaskLogUpdateExe {
|
|||
if (log.getSignStepFlag() == 1) {
|
||||
log.setSignPath(cmd.getSignPath());
|
||||
}
|
||||
|
||||
TodoListCompleteEvent todoCompletedTaskEvent = new TodoListCompleteEvent();
|
||||
todoCompletedTaskEvent.setForeignSubsidiaryKey(log.getId());
|
||||
todoListEventPusherUtil.sendMessageCompleteEvent(todoCompletedTaskEvent);
|
||||
|
||||
TaskLogDO logDO = new TaskLogDO();
|
||||
BeanUtils.copyProperties(log, logDO);
|
||||
actionLogs.add(logDO);
|
||||
|
|
@ -147,12 +161,25 @@ public class TaskLogUpdateExe {
|
|||
if (nextStepTemp.getStatus() == -1) { // 步骤可跳过 并且未设置签字人 则判断为跳过步骤
|
||||
handleNextStep(nextStepTemp, actionLogs, logs);
|
||||
} else { // 非跳过时
|
||||
Long workId = eightworkInfoRepository.getOne(new LambdaQueryWrapper<EightworkInfoDO>().select(EightworkInfoDO::getId).eq(EightworkInfoDO::getWorkId, log.getWorkId())).getId();
|
||||
// 可能涉及多人签字
|
||||
nextStep.forEach(next -> {
|
||||
next.setStatus(0);
|
||||
TaskLogDO nextLogDO = new TaskLogDO();
|
||||
BeanUtils.copyProperties(next, nextLogDO);
|
||||
actionLogs.add(nextLogDO);
|
||||
|
||||
// 添加待办
|
||||
TodoListAddEvent event = new TodoListAddEvent();
|
||||
event.setTitle("您有一条"+ WorkCodeEnum.getNameByWorkType(log.getWorkType()) +"流程待处理");
|
||||
event.setContent(next.getNextStepName());
|
||||
event.setForeignKey(workId); // 业务表ID
|
||||
event.setForeignSubsidiaryKey(next.getId()); // 业务附表ID 没有附表时为foreignKey的值
|
||||
event.setReceiveUser(next.getActUser());// user表ID
|
||||
event.setPcFlag(1); // 是否PC端待办 1是 0否
|
||||
event.setAppFlag(1); // 是否APP端待办 1是 0否
|
||||
event.setOtherParams(new JSONObject());
|
||||
todoListEventPusherUtil.sendMessageAddEvent(event);
|
||||
});
|
||||
eightworkInfoRepository.updateWorkStatus(log.getWorkId(),nextStep.get(0).getStepName() , null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,5 @@ public class TaskFlowQueryExe {
|
|||
|
||||
return taskFlowInitCO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import com.zcloud.eightwork.dto.clientobject.TaskWorkInitCO;
|
|||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
|
|
|
|||
|
|
@ -46,5 +46,10 @@
|
|||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import com.alibaba.cola.dto.SingleResponse;
|
|||
import com.zcloud.eightwork.dto.clientobject.TaskFlowInitCO;
|
||||
import com.zcloud.eightwork.dto.clientobject.TaskWorkInitCO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
*
|
||||
|
|
@ -29,6 +31,5 @@ public interface TaskFlowServiceI {
|
|||
|
||||
|
||||
TaskFlowInitCO getFlowInit(TaskFlowQryCmd qry);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,14 @@ public class EightworkInfoPageQry extends PageQuery {
|
|||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||
*/
|
||||
private String eqWorkType;
|
||||
private String eqCheckNo;
|
||||
private Integer eqStatus;
|
||||
private Long eqDepartmentId;
|
||||
private Long eqCreateId;
|
||||
private Integer eqXgfFlag;
|
||||
private Integer eqInternalOperationFlag;
|
||||
private Long eqProjectId;
|
||||
private Long eqWorkDepartmentId;
|
||||
private Long eqWorkUserId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,24 +13,26 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
@Getter
|
||||
public enum WorkCodeEnum {
|
||||
HOT_WORK("hot_work", "DH"),
|
||||
BLINDBOARD_WORK("blindboard_work", "MBCD"),
|
||||
BREAKGROUND_WORK("breakground_work", "DT"),
|
||||
CONFINEDSPACE_WORK("confinedspace_work", "SXKJ"),
|
||||
CUTROAD_WORK("cutroad_work", "DL"),
|
||||
ELECTRICITY_WORK("electricity_work", "LSYD"),
|
||||
HIGH_WORK("high_work", "GC"),
|
||||
HOISTING("hoisting_work", "DZ");
|
||||
HOT_WORK("hot_work", "DH","动火作业"),
|
||||
BLINDBOARD_WORK("blindboard_work", "MBCD","盲板抽堵作业"),
|
||||
BREAKGROUND_WORK("breakground_work", "DT","动土作业"),
|
||||
CONFINEDSPACE_WORK("confinedspace_work", "SXKJ","受限空间作业"),
|
||||
CUTROAD_WORK("cutroad_work", "DL","短路作业"),
|
||||
ELECTRICITY_WORK("electricity_work", "LSYD","临时用电作业"),
|
||||
HIGH_WORK("high_work", "GC","高处作业"),
|
||||
HOISTING("hoisting_work", "DZ","吊装作业");
|
||||
private final String workType;
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
private static final Map<String, WorkCodeEnum> CODE_MAP =
|
||||
Arrays.stream(values())
|
||||
.collect(Collectors.toMap(WorkCodeEnum::getWorkType, Function.identity()));
|
||||
|
||||
WorkCodeEnum(String workType, String code) {
|
||||
WorkCodeEnum(String workType, String code, String name) {
|
||||
this.workType = workType;
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getWorkType() {
|
||||
|
|
@ -45,4 +47,9 @@ public enum WorkCodeEnum {
|
|||
WorkCodeEnum entry = CODE_MAP.get(workType);
|
||||
return entry != null ? entry.getCode() : null;
|
||||
}
|
||||
|
||||
public static String getNameByWorkType(String workType) {
|
||||
WorkCodeEnum entry = CODE_MAP.get(workType);
|
||||
return entry != null ? entry.getName() : null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,48 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zcloud.eightwork.persistence.mapper.EightworkInfoMapper">
|
||||
<select id="listPage" resultType="com.zcloud.eightwork.persistence.dataobject.EightworkInfoDO">
|
||||
select t.*
|
||||
from eightwork_info t
|
||||
where t.delete_enum = 'FALSE'
|
||||
<if test="params.eqWorkType != null and params.eqWorkType != ''">
|
||||
and t.work_type = #{params.eqWorkType}
|
||||
</if>
|
||||
<if test="params.eqCheckNo != null and params.eqCheckNo != ''">
|
||||
and t.check_no = #{params.eqCheckNo}
|
||||
</if>
|
||||
<if test="params.eqStatus != null">
|
||||
and t.status = #{params.eqStatus}
|
||||
</if>
|
||||
<if test="params.eqDepartmentId != null">
|
||||
and t.department_id = #{params.eqDepartmentId}
|
||||
</if>
|
||||
<if test="params.eqCreateId != null">
|
||||
and t.create_id = #{params.eqCreateId}
|
||||
</if>
|
||||
<if test="params.eqXgfFlag != null">
|
||||
and t.xgf_flag = #{params.eqXgfFlag}
|
||||
</if>
|
||||
<if test="params.eqInternalOperationFlag != null">
|
||||
and t.internal_operation_flag = #{params.eqInternalOperationFlag}
|
||||
</if>
|
||||
<if test="params.eqProjectId != null and params.eqProjectId != ''">
|
||||
and t.project_id = #{params.eqProjectId}
|
||||
</if>
|
||||
<if test="params.eqWorkDepartmentId != null">
|
||||
and exists (select 1
|
||||
from task_log log
|
||||
where log.work_id = t.work_id
|
||||
and log.act_user_department = #{params.eqWorkDepartmentId})
|
||||
</if>
|
||||
<if test="params.eqWorkUserId != null">
|
||||
and exists (select 1
|
||||
from task_log log
|
||||
where log.work_id = t.work_id
|
||||
and log.act_user = #{params.eqWorkUserId})
|
||||
</if>
|
||||
order by t.create_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue