feat(workflow): 优化作业信息查询和流程处理功能
parent
606b4a6459
commit
a441f76b53
|
|
@ -177,6 +177,7 @@ public class TaskLogUpdateExe {
|
|||
handleReject(cmd);
|
||||
log.info("打回到申请步骤,结束处理步骤流转: workId={}, stepId={}, status={}",
|
||||
cmd.getWorkId(), cmd.getStepId(), cmd.getStatus());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -679,7 +680,7 @@ public class TaskLogUpdateExe {
|
|||
// 发送待办通知
|
||||
sendTodoAddEvent(workId, next, currentLog.getWorkType());
|
||||
|
||||
messageNotice(next.getActUser(),next, currentLog);
|
||||
messageNotice(next, currentLog);
|
||||
log.info("已激活下一步:workId={},步骤={}",workId, next.getStepName());
|
||||
|
||||
|
||||
|
|
@ -715,6 +716,13 @@ public class TaskLogUpdateExe {
|
|||
"已归档",
|
||||
TaskLogStatus.ARCHIVED.getCode()
|
||||
);
|
||||
sendTodoCompleteEvent(currentLog.getId());
|
||||
TaskLogE branchStep = new TaskLogE();
|
||||
EightworkInfoDO eightworkInfoDO = getEightworkInfoDO(currentLog.getWorkId());
|
||||
branchStep.setActUser(eightworkInfoDO.getCreateId());
|
||||
branchStep.setStatus(TaskLogStatus.ARCHIVED.getCode());
|
||||
branchStep.setStepName("申请人");
|
||||
messageNotice(branchStep, currentLog);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -901,12 +909,23 @@ public class TaskLogUpdateExe {
|
|||
// createNewApplyTaskLog(cmd.getWorkId());
|
||||
|
||||
// 6. 更新主表状态为打回,添加打回信息
|
||||
updateMainInfoForReject(cmd.getWorkId(), currentLog, cmd.getOthers());
|
||||
EightworkInfoDO infoDO = eightworkInfoRepository.getOne(
|
||||
new LambdaQueryWrapper<EightworkInfoDO>()
|
||||
.eq(EightworkInfoDO::getWorkId, cmd.getWorkId())
|
||||
);
|
||||
if (infoDO == null) {
|
||||
log.warn("未找到作业信息: workId={}", cmd.getWorkId());
|
||||
return;
|
||||
}
|
||||
updateMainInfoForReject(infoDO, currentLog, cmd.getOthers());
|
||||
|
||||
// 7. 发送待办完成事件
|
||||
sendTodoCompleteEvent(currentLog.getId());
|
||||
|
||||
|
||||
TaskLogE branchStep = new TaskLogE();
|
||||
branchStep.setActUser(infoDO.getCreateId());
|
||||
branchStep.setStatus(TaskLogStatus.REJECTED.getCode());
|
||||
branchStep.setStepName("申请人");
|
||||
messageNotice(branchStep, currentLog);
|
||||
log.info("工作流已打回到申请步骤: workId={}", cmd.getWorkId());
|
||||
}
|
||||
|
||||
|
|
@ -1043,9 +1062,9 @@ public class TaskLogUpdateExe {
|
|||
/**
|
||||
* 更新主表信息(打回后)
|
||||
*/
|
||||
private void updateMainInfoForReject(String workId, TaskLogE currentLog, com.alibaba.fastjson.JSONObject others) {
|
||||
private void updateMainInfoForReject(EightworkInfoDO infoDO , TaskLogE currentLog, com.alibaba.fastjson.JSONObject others) {
|
||||
// 获取主表记录
|
||||
EightworkInfoDO infoDO = eightworkInfoRepository.getOne(
|
||||
/*EightworkInfoDO infoDO = eightworkInfoRepository.getOne(
|
||||
new LambdaQueryWrapper<EightworkInfoDO>()
|
||||
.eq(EightworkInfoDO::getWorkId, workId)
|
||||
);
|
||||
|
|
@ -1053,7 +1072,7 @@ public class TaskLogUpdateExe {
|
|||
if (infoDO == null) {
|
||||
log.warn("未找到作业信息: workId={}", workId);
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
// 解析现有 info
|
||||
JSONObject infoJson;
|
||||
|
|
@ -1061,7 +1080,7 @@ public class TaskLogUpdateExe {
|
|||
try {
|
||||
infoJson = JSONObject.parseObject(infoDO.getInfo());
|
||||
} catch (Exception e) {
|
||||
log.warn("解析 info 失败,使用空对象: workId={}", workId, e);
|
||||
log.warn("解析 info 失败,使用空对象: workId={}", infoDO.getWorkId(), e);
|
||||
infoJson = new JSONObject();
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1090,7 +1109,7 @@ public class TaskLogUpdateExe {
|
|||
infoDO.setInfo(infoJson.toJSONString());
|
||||
eightworkInfoRepository.updateById(infoDO);
|
||||
|
||||
log.info("主表已更新为打回状态并添加打回信息: workId={}", workId);
|
||||
log.info("主表已更新为打回状态并添加打回信息: workId={}", infoDO.getWorkId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1100,25 +1119,25 @@ public class TaskLogUpdateExe {
|
|||
private void handleBranchIfNeeded(TaskLogE currentLog, List<TaskLogDO> actionLogs, List<TaskLogE> allLogs) {
|
||||
StepType stepType = StepType.getByCode(currentLog.getStepType());
|
||||
BranchFlag branchFlag = BranchFlag.getByCode(currentLog.getBranchFlag());
|
||||
|
||||
log.info("开始处理分支流程: stepName={}, branchFlag={}", currentLog.getStepName(), branchFlag);
|
||||
// 只处理:主流程步骤完成,且为分支开始节点 → 激活分支步骤
|
||||
if (stepType != null && stepType.isNormalStep() && branchFlag.isBranchStart()) {
|
||||
TaskLogE branchStep = allLogs.stream()
|
||||
.filter(log -> log.getStepId().equals(currentLog.getBranchStep()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
log.info("找到处理分支流程: stepName={}, branchStep={}", currentLog.getStepName(), branchStep);
|
||||
if (branchStep != null) {
|
||||
// 如果分支步骤已标记为跳过,则不激活
|
||||
if (TaskLogStatus.SKIPPED.equalsCode(branchStep.getStatus())) {
|
||||
log.info("分支步骤已跳过,不激活: stepName={}", branchStep.getStepName());
|
||||
return;
|
||||
}
|
||||
|
||||
log.info("激活分支步骤: stepName={},checkNo={}", branchStep.getStepName(),branchStep.getCheckNo());
|
||||
branchStep.setStatus(TaskLogStatus.IN_PROGRESS.getCode());
|
||||
addActionLog(actionLogs, branchStep);
|
||||
sendTodoAddEvent(getWorkId(currentLog.getWorkId()), branchStep, currentLog.getWorkType());
|
||||
messageNotice(getWorkId(currentLog.getWorkId()),branchStep, currentLog);
|
||||
messageNotice(branchStep, currentLog);
|
||||
log.info("已激活分支步骤: stepName={}, mergeTo={}", branchStep.getStepName(), branchStep.getBranchMergeStep());
|
||||
}
|
||||
}
|
||||
|
|
@ -1136,6 +1155,7 @@ public class TaskLogUpdateExe {
|
|||
log.info("未设置签字人,跳过设置签字人: workId={}", currentLog.getWorkId());
|
||||
return;
|
||||
}
|
||||
log.info("开始设置签字人:signLogs={}",JSONUtil.toJsonStr(signLogs));
|
||||
|
||||
// 按 stepId 分组,处理多人签字步骤
|
||||
Map<Long, List<TaskSignStepInfoCmd>> signLogsByStepId = signLogs.stream()
|
||||
|
|
@ -1305,7 +1325,7 @@ public class TaskLogUpdateExe {
|
|||
try {
|
||||
TodoListAddEvent event = new TodoListAddEvent();
|
||||
event.setTitle("您有一条【" + WorkCodeEnum.getNameByWorkType(workType) + "】流程待处理");
|
||||
event.setContent(nextStep.getNextStepName());
|
||||
event.setContent(nextStep.getStepName());
|
||||
event.setForeignKey(workId);
|
||||
event.setForeignSubsidiaryKey(nextStep.getId());
|
||||
event.setReceiveUser(nextStep.getActUser());
|
||||
|
|
@ -1317,13 +1337,13 @@ public class TaskLogUpdateExe {
|
|||
log.error("发送待办新增事件失败: stepId={}", nextStep.getId(), e);
|
||||
}
|
||||
}
|
||||
private void messageNotice(Long userId,TaskLogE nextStep, TaskLogE currentLog) {
|
||||
private void messageNotice(TaskLogE nextStep, TaskLogE currentLog) {
|
||||
//消息通知
|
||||
try{
|
||||
MessageSendCmd messageSendCmd = new MessageSendCmd();
|
||||
messageSendCmd.setBusinessId(UuidUtil.get32UUID());
|
||||
MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
||||
messageTargetCmd.setUserId(userId);
|
||||
messageTargetCmd.setUserId(nextStep.getActUser());
|
||||
messageSendCmd.setTargetCmd(messageTargetCmd);
|
||||
messageSendCmd.setSourceCode(messageConfig.getTaskLogTemplate());
|
||||
messageSendCmd.setNeedTokenEnum(false);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.zcloud.eightwork.command.query;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.eightwork.command.convertor.EightworkInfoCoConvertor;
|
||||
import com.zcloud.eightwork.dto.EightworkInfoPageQry;
|
||||
import com.zcloud.eightwork.dto.clientobject.EightworkInfoCO;
|
||||
|
|
@ -47,6 +48,9 @@ public class EightworkInfoQueryExe {
|
|||
* @return
|
||||
*/
|
||||
public PageResponse<EightworkInfoCO> execute(EightworkInfoPageQry eightworkInfoPageQry) {
|
||||
if(eightworkInfoPageQry.getCorpinfoId()==null){
|
||||
eightworkInfoPageQry.setCorpinfoId(AuthContext.getTenantId());
|
||||
}
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(eightworkInfoPageQry);
|
||||
PageResponse<EightworkInfoDO> pageResponse = eightworkInfoRepository.listPage(params);
|
||||
List<EightworkInfoCO> examCenterCOS = eightworkInfoCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ public class TaskFlowQueryExe {
|
|||
TaskWorkInitCO taskWorkInitCO = new TaskWorkInitCO();
|
||||
taskWorkInitCO.setApplyUser(AuthContext.getCurrentUser().getName());
|
||||
taskWorkInitCO.setApplyUnit(AuthContext.getCurrentUser().getTenantName());
|
||||
taskWorkInitCO.setApplyDepartment(AuthContext.getCurrentUser().getOrgName());
|
||||
taskWorkInitCO.setTaskWorkLevels(eightworkTaskCoConvertor.converDOsToCOs(
|
||||
eightworkTaskRepository.list(new LambdaQueryWrapper<EightworkTaskDO>()
|
||||
.eq(EightworkTaskDO::getWorkType, qry.getWorkType())
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public class EightworkInfoPageQry extends PageQuery {
|
|||
private String menuPath;
|
||||
private String eqWorkType;
|
||||
private List<Long> inCorpInfoId;
|
||||
private Long corpinfoId;
|
||||
private String eqCheckNo;
|
||||
private Integer eqStatus;
|
||||
private String eqWorkLevel;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.zcloud.eightwork.dto;
|
||||
|
||||
import com.alibaba.cola.dto.PageQuery;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
|
|
@ -25,5 +26,7 @@ public class EightworkSupplementaryInfoPageQry extends PageQuery {
|
|||
*/
|
||||
private String eqWorkId;
|
||||
private String eqType;
|
||||
@ApiModelProperty(value = "气体分析-分析点名称")
|
||||
private String analysisPointName;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ public class TaskWorkInitCO extends ClientObject {
|
|||
private String applyUnit;
|
||||
@ApiModelProperty(value = "申请人")
|
||||
private String applyUser;
|
||||
@ApiModelProperty(value = "申请部门")
|
||||
private String applyDepartment;
|
||||
@ApiModelProperty(value = "票号")
|
||||
private String checkNo;
|
||||
@ApiModelProperty(value = "任务级别列表")
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
package com.zcloud.eightwork.persistence.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zcloud.eightwork.persistence.dataobject.EightworkSupplementaryInfoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
*
|
||||
|
|
@ -21,5 +25,7 @@ public interface EightworkSupplementaryInfoMapper extends BaseMapper<EightworkSu
|
|||
* @return 删除的记录数
|
||||
*/
|
||||
int physicalDeleteByWorkId(@Param("workId") String workId);
|
||||
|
||||
IPage<EightworkSupplementaryInfoDO> listPage(IPage<EightworkSupplementaryInfoDO> iPage, Map<String, Object> params);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ public class EightworkSupplementaryInfoRepositoryImpl extends BaseRepositoryImpl
|
|||
@Override
|
||||
public PageResponse<EightworkSupplementaryInfoDO> listPage(Map<String, Object> params) {
|
||||
IPage<EightworkSupplementaryInfoDO> iPage = new Query<EightworkSupplementaryInfoDO>().getPage(params);
|
||||
QueryWrapper<EightworkSupplementaryInfoDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
IPage<EightworkSupplementaryInfoDO> result = eightworkSupplementaryInfoMapper.selectPage(iPage, queryWrapper);
|
||||
// QueryWrapper<EightworkSupplementaryInfoDO> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
||||
// queryWrapper.orderByDesc("create_time");
|
||||
IPage<EightworkSupplementaryInfoDO> result = eightworkSupplementaryInfoMapper.listPage(iPage, params);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
and t.work_type = #{params.eqWorkType}
|
||||
</if>
|
||||
<if test="params.eqCheckNo != null and params.eqCheckNo != ''">
|
||||
and t.check_no = #{params.eqCheckNo}
|
||||
and t.check_no like concat('%', #{params.eqCheckNo}, '%')
|
||||
</if>
|
||||
<if test="params.eqStatus != null">
|
||||
and t.status = #{params.eqStatus}
|
||||
|
|
@ -51,11 +51,12 @@
|
|||
</foreach>
|
||||
</if>
|
||||
<if test="params.geCreateTime != null and params.geCreateTime != ''">
|
||||
and t.create_time >= #{params.geCreateTime}
|
||||
AND t.create_time >= DATE_FORMAT(CONCAT(#{params.geCreateTime}, ' 00:00:00'), '%Y-%m-%d %H:%i:%s')
|
||||
</if>
|
||||
<if test="params.leCreateTime != null and params.leCreateTime != ''">
|
||||
and t.create_time <= #{params.leCreateTime}
|
||||
AND t.create_time < DATE_FORMAT(DATE_ADD(#{params.leCreateTime}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%s')
|
||||
</if>
|
||||
|
||||
<if test="params.eqIsInnerWork != null and params.eqIsInnerWork != ''">
|
||||
and t.info->>'$.isInnerWork' = #{params.eqIsInnerWork}
|
||||
</if>
|
||||
|
|
@ -69,10 +70,10 @@
|
|||
and t.info->>'$.blindboardWorkType' = #{params.eqBlindboardWorkType}
|
||||
</if>
|
||||
<if test="params.geWorkStartTime != null and params.geWorkStartTime != ''">
|
||||
and t.info->>'$.workStartTime' >= #{params.geWorkStartTime}
|
||||
and t.info->>'$.workStartTime' >= DATE_FORMAT(CONCAT(#{params.geWorkStartTime}, ' 00:00:00'), '%Y-%m-%d %H:%i:%s')
|
||||
</if>
|
||||
<if test="params.leWorkStartTime != null and params.leWorkStartTime != ''">
|
||||
and t.info->>'$.workStartTime' <= #{params.leWorkStartTime}
|
||||
and t.info->>'$.workStartTime' < DATE_FORMAT(DATE_ADD(#{params.leWorkStartTime}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%s')
|
||||
</if>
|
||||
<if test="params.likeLimitedSpaceNameAndCode != null and params.likeLimitedSpaceNameAndCode != ''">
|
||||
and t.info->>'$.limitedSpaceNameAndCode' like concat('%', #{params.likeLimitedSpaceNameAndCode}, '%')
|
||||
|
|
@ -84,7 +85,18 @@
|
|||
and log.status = 0
|
||||
and log.step_id = #{params.eqCurrentStepId})
|
||||
</if>
|
||||
order by t.create_time desc
|
||||
<if test="params.inCorpInfoId != null and params.inCorpInfoId.size() > 0">
|
||||
and t.corpinfo_id in
|
||||
<foreach collection="params.inCorpInfoId" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="params.corpinfoId != null">
|
||||
and t.corpinfo_id = #{params.corpinfoId}
|
||||
</if>
|
||||
ORDER BY
|
||||
CASE WHEN t.status = 0 THEN 0 ELSE 1 END ASC,
|
||||
t.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="statisticsByWorkType" resultType="com.zcloud.eightwork.persistence.dataobject.dto.StatisticsByWorkTypeDTO">
|
||||
|
|
|
|||
|
|
@ -8,5 +8,21 @@
|
|||
DELETE FROM eightwork_supplementary_info WHERE work_id = #{workId}
|
||||
</delete>
|
||||
|
||||
<select id="listPage" resultType="com.zcloud.eightwork.persistence.dataobject.EightworkSupplementaryInfoDO">
|
||||
SELECT info.*
|
||||
FROM eightwork_supplementary_info info
|
||||
WHERE info.delete_enum = 'FALSE'
|
||||
<if test="params.eqType != null and params.eqType != ''">
|
||||
AND info.type = #{params.eqType}
|
||||
</if>
|
||||
<if test="params.eqWorkId != null and params.eqWorkId != ''">
|
||||
AND info.work_id = #{params.eqWorkId}
|
||||
</if>
|
||||
<if test="params.analysisPointName != null and params.analysisPointName != ''">
|
||||
AND info.details ->> '$.analysisPointName' LIKE CONCAT('%', #{params.analysisPointName}, '%')
|
||||
</if>
|
||||
ORDER BY info.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue