feat(workflow): 完善工作流程审批功能

- 在TaskLogNextCmd中添加remarks字段用于备注信息存储
- 添加rejectedStepFlag字段控制步骤是否可被打回
- 实现打回功能逻辑,包括设置当前步骤为打回状态和申请步骤为进行中
- 优化任务日志分页查询功能,使用统一的列表页面接口
- 修复CUTROAD_WORK枚举值描述错误,从"短路作业"改为"断路路作业"
- 在打回操作中注释掉归档和删除逻辑,避免数据重复处理
master
fangjiakai 2026-04-02 17:37:23 +08:00
parent c514ef8b1e
commit 295646f330
15 changed files with 97 additions and 19 deletions

View File

@ -2,6 +2,7 @@ package com.zcloud.eightwork.command;
import com.alibaba.cola.exception.BizException; import com.alibaba.cola.exception.BizException;
import com.zcloud.eightwork.domain.gateway.EightworkInfoGateway; import com.zcloud.eightwork.domain.gateway.EightworkInfoGateway;
import com.zcloud.eightwork.persistence.dataobject.EightworkInfoDO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;

View File

@ -231,6 +231,7 @@ public class TaskLogUpdateExe {
log.info("完成当前步骤: stepName={}, status={}", currentLog.getStepName(), cmd.getStatus()); log.info("完成当前步骤: stepName={}, status={}", currentLog.getStepName(), cmd.getStatus());
currentLog.setStatus(cmd.getStatus()); currentLog.setStatus(cmd.getStatus());
currentLog.setRemarks(cmd.getRemarks());
// 签字步骤,保存签字图片 // 签字步骤,保存签字图片
if (SIGN_STEP_FLAG.equals(currentLog.getSignStepFlag())) { if (SIGN_STEP_FLAG.equals(currentLog.getSignStepFlag())) {
@ -773,22 +774,43 @@ public class TaskLogUpdateExe {
throw new BizException("未找到对应的步骤记录"); throw new BizException("未找到对应的步骤记录");
} }
// 设置当前步骤为打回状态
List<TaskLogDO> actionLogs = new ArrayList<>();
currentLog.setStatus(TaskLogStatus.REJECTED.getCode());
addActionLog(actionLogs, currentLog);
// 设置申请步骤为进行中
TaskLogE applyFlow = allLogs.stream()
.filter(f -> FIRST_STEP_ID.equals(f.getStepId()))
.findFirst()
.orElseThrow(() -> new BizException("未找到申请步骤配置"));
applyFlow.setStatus(TaskLogStatus.IN_PROGRESS.getCode());
addActionLog(actionLogs, applyFlow);
// 更新本次步骤变化
taskLogRepository.updateBatchById(actionLogs);
/*
*
*/
// 1. 归档当前的 task_log 记录(除了申请步骤) // 1. 归档当前的 task_log 记录(除了申请步骤)
archiveTaskLogs(allLogs); // archiveTaskLogs(allLogs);
// 2. 归档辅助数据delay、gas、measures // 2. 归档辅助数据delay、gas、measures
archiveSupplementaryInfo(cmd.getWorkId()); // archiveSupplementaryInfo(cmd.getWorkId());
// 3. 删除除申请步骤外的所有 task_log // 3. 删除除申请步骤外的所有 task_log
deleteTaskLogsExceptFirst(cmd.getWorkId()); // deleteTaskLogsExceptFirst(cmd.getWorkId());
// 4. 删除辅助数据delay、gas、measures // 4. 删除辅助数据delay、gas、measures
deleteSupplementaryInfo(cmd.getWorkId()); // deleteSupplementaryInfo(cmd.getWorkId());
//
// 5. 新建一条新的申请记录status=0暂存状态 // 5. 新建一条新的申请记录status=0暂存状态
createNewApplyTaskLog(cmd.getWorkId()); // createNewApplyTaskLog(cmd.getWorkId());
// 6. 更新主表状态为暂存,添加打回信息 // 6. 更新主表状态为打回,添加打回信息
updateMainInfoForReject(cmd.getWorkId(), currentLog, cmd.getOthers()); updateMainInfoForReject(cmd.getWorkId(), currentLog, cmd.getOthers());
// 7. 发送待办完成事件 // 7. 发送待办完成事件

View File

@ -62,7 +62,7 @@ public class TaskLogServiceImpl implements TaskLogServiceI {
TaskLogNextCmd taskLogNextCmd = new TaskLogNextCmd(commitTaskLogDO.getId(), TaskLogNextCmd taskLogNextCmd = new TaskLogNextCmd(commitTaskLogDO.getId(),
commitTaskLogDO.getWorkId(), commitTaskLogDO.getWorkId(),
commitTaskLogDO.getStepId(), commitTaskLogDO.getStepId(),
TaskLogStatus.APPROVED.getCode(),null,null,null,cmd.getOthers(),null,null,null); TaskLogStatus.APPROVED.getCode(),cmd.getOthers());
taskLogUpdateExe.nextStep(taskLogNextCmd); taskLogUpdateExe.nextStep(taskLogNextCmd);
return SingleResponse.buildSuccess(); return SingleResponse.buildSuccess();

View File

@ -81,6 +81,8 @@ public class TaskFlowAddCmd extends Command {
@NotNull(message = "是否可以添加安全措施") @NotNull(message = "是否可以添加安全措施")
private Integer measuresStepFlag; private Integer measuresStepFlag;
@ApiModelProperty(value = "是否可以打回1是2否", name = "rejectedStepFlag")
private Integer rejectedStepFlag;
@ApiModelProperty(value = "0无分支1有分支开始2有分支结束", name = "branchFlag", required = true) @ApiModelProperty(value = "0无分支1有分支开始2有分支结束", name = "branchFlag", required = true)

View File

@ -53,5 +53,15 @@ public class TaskLogNextCmd extends Command {
//附件 //附件
@ApiModelProperty(value = "附件") @ApiModelProperty(value = "附件")
private String filePath; private String filePath;
@ApiModelProperty(value = "备注")
private String remarks;
public TaskLogNextCmd(Long id, String workId, Long stepId, Integer status, JSONObject others) {
this.id = id;
this.workId = workId;
this.stepId = stepId;
this.status = status;
this.others = others;
}
} }

View File

@ -59,6 +59,9 @@ public class TaskFlowCO extends ClientObject {
private Integer selectSignStep; private Integer selectSignStep;
@ApiModelProperty(value = "是否可以添加安全措施") @ApiModelProperty(value = "是否可以添加安全措施")
private Integer measuresStepFlag; private Integer measuresStepFlag;
//是否可以打回1是2否
@ApiModelProperty(value = "是否可以打回1是2否")
private Integer rejectedStepFlag;
//0无分支1有分支开始2有分支结束 //0无分支1有分支开始2有分支结束
@ApiModelProperty(value = "0无分支1有分支开始2有分支结束") @ApiModelProperty(value = "0无分支1有分支开始2有分支结束")
private Integer branchFlag; private Integer branchFlag;

View File

@ -100,6 +100,9 @@ public class TaskLogCO extends ClientObject {
private Integer selectSignStep; private Integer selectSignStep;
@ApiModelProperty(value = "是否可以添加安全措施") @ApiModelProperty(value = "是否可以添加安全措施")
private Integer measuresStepFlag; private Integer measuresStepFlag;
//是否可以打回1是2否
@ApiModelProperty(value = "是否可以打回1是2否")
private Integer rejectedStepFlag;
//0无分支1有分支开始2有分支结束 //0无分支1有分支开始2有分支结束
@ApiModelProperty(value = "0无分支1有分支开始2有分支结束") @ApiModelProperty(value = "0无分支1有分支开始2有分支结束")
private Integer branchFlag; private Integer branchFlag;

View File

@ -46,6 +46,8 @@ public class TaskFlowE extends BaseE {
private Integer selectSignStep; private Integer selectSignStep;
//是否可以添加安全措施 //是否可以添加安全措施
private Integer measuresStepFlag; private Integer measuresStepFlag;
//是否可以打回1是2否
private Integer rejectedStepFlag;
//0无分支1有分支开始2有分支结束 //0无分支1有分支开始2有分支结束
private Integer branchFlag; private Integer branchFlag;
//branch_flag == 1 分支节点ID //branch_flag == 1 分支节点ID

View File

@ -69,6 +69,8 @@ public class TaskLogE extends BaseE {
private Integer selectSignStep; private Integer selectSignStep;
//是否可以添加安全措施 //是否可以添加安全措施
private Integer measuresStepFlag; private Integer measuresStepFlag;
//是否可以打回1是2否
private Integer rejectedStepFlag;
//0无分支1有分支开始2有分支结束 //0无分支1有分支开始2有分支结束
private Integer branchFlag; private Integer branchFlag;
//branch_flag == 1 分支节点ID //branch_flag == 1 分支节点ID
@ -123,6 +125,7 @@ public class TaskLogE extends BaseE {
this.specialStepCode = log.getSpecialStepCode(); this.specialStepCode = log.getSpecialStepCode();
this.selectSignStep = log.getSelectSignStep(); this.selectSignStep = log.getSelectSignStep();
this.measuresStepFlag = log.getMeasuresStepFlag(); this.measuresStepFlag = log.getMeasuresStepFlag();
this.rejectedStepFlag = log.getRejectedStepFlag();
this.branchFlag = log.getBranchFlag(); this.branchFlag = log.getBranchFlag();
this.branchStep = log.getBranchStep(); this.branchStep = log.getBranchStep();
this.branchMergeStep = log.getBranchMergeStep(); this.branchMergeStep = log.getBranchMergeStep();

View File

@ -17,7 +17,7 @@ public enum WorkCodeEnum {
BLINDBOARD_WORK("blindboard_work", "MBCD","盲板抽堵作业"), BLINDBOARD_WORK("blindboard_work", "MBCD","盲板抽堵作业"),
BREAKGROUND_WORK("breakground_work", "DT","动土作业"), BREAKGROUND_WORK("breakground_work", "DT","动土作业"),
CONFINEDSPACE_WORK("confinedspace_work", "SXKJ","受限空间作业"), CONFINEDSPACE_WORK("confinedspace_work", "SXKJ","受限空间作业"),
CUTROAD_WORK("cutroad_work", "DL","路作业"), CUTROAD_WORK("cutroad_work", "DL","断路路作业"),
ELECTRICITY_WORK("electricity_work", "LSYD","临时用电作业"), ELECTRICITY_WORK("electricity_work", "LSYD","临时用电作业"),
HIGH_WORK("high_work", "GC","高处作业"), HIGH_WORK("high_work", "GC","高处作业"),
HOISTING("hoisting_work", "DZ","吊装作业"); HOISTING("hoisting_work", "DZ","吊装作业");

View File

@ -62,6 +62,9 @@ public class TaskFlowDO extends BaseDO {
private Integer selectSignStep; private Integer selectSignStep;
@ApiModelProperty(value = "是否可以添加安全措施") @ApiModelProperty(value = "是否可以添加安全措施")
private Integer measuresStepFlag; private Integer measuresStepFlag;
//是否可以打回1是2否
@ApiModelProperty(value = "是否可以打回1是2否")
private Integer rejectedStepFlag;
//0无分支1有分支开始2有分支结束 //0无分支1有分支开始2有分支结束
@ApiModelProperty(value = "0无分支1有分支开始2有分支结束") @ApiModelProperty(value = "0无分支1有分支开始2有分支结束")
private Integer branchFlag; private Integer branchFlag;

View File

@ -98,6 +98,9 @@ public class TaskLogDO extends BaseDO {
private Integer selectSignStep; private Integer selectSignStep;
@ApiModelProperty(value = "是否可以添加安全措施") @ApiModelProperty(value = "是否可以添加安全措施")
private Integer measuresStepFlag; private Integer measuresStepFlag;
//是否可以打回1是2否
@ApiModelProperty(value = "是否可以打回1是2否")
private Integer rejectedStepFlag;
//0无分支1有分支开始2有分支结束 //0无分支1有分支开始2有分支结束
@ApiModelProperty(value = "0无分支1有分支开始2有分支结束") @ApiModelProperty(value = "0无分支1有分支开始2有分支结束")
private Integer branchFlag; private Integer branchFlag;

View File

@ -1,12 +1,16 @@
package com.zcloud.eightwork.persistence.mapper; package com.zcloud.eightwork.persistence.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zcloud.eightwork.domain.model.TodoCountE; import com.zcloud.eightwork.domain.model.TodoCountE;
import com.zcloud.eightwork.persistence.dataobject.EightworkInfoDO;
import com.zcloud.eightwork.persistence.dataobject.TaskLogDO; import com.zcloud.eightwork.persistence.dataobject.TaskLogDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* web-infrastructure * web-infrastructure
@ -17,6 +21,7 @@ import java.util.List;
@Mapper @Mapper
public interface TaskLogMapper extends BaseMapper<TaskLogDO> { public interface TaskLogMapper extends BaseMapper<TaskLogDO> {
IPage<EightworkInfoDO> listPage(Page<Map<String, Object>> page, @Param("params") Map<String, Object> parmas, String menuPerms);
List<TodoCountE> getTodoCount(@Param("orgId") Long orgId,@Param("userId") Long userId); List<TodoCountE> getTodoCount(@Param("orgId") Long orgId,@Param("userId") Long userId);
List<TodoCountE> getTodoCountForWork(@Param("orgId") Long orgId,@Param("userId") Long userId,@Param("workType") String workType); List<TodoCountE> getTodoCountForWork(@Param("orgId") Long orgId,@Param("userId") Long userId,@Param("workType") String workType);

View File

@ -4,9 +4,12 @@ import com.alibaba.cola.dto.PageResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jjb.saas.framework.repository.common.PageHelper; import com.jjb.saas.framework.repository.common.PageHelper;
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl; import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
import com.zcloud.eightwork.domain.model.TodoCountE; import com.zcloud.eightwork.domain.model.TodoCountE;
import com.zcloud.eightwork.domain.model.enums.MenuEnum;
import com.zcloud.eightwork.persistence.dataobject.EightworkInfoDO;
import com.zcloud.eightwork.persistence.dataobject.TaskLogDO; import com.zcloud.eightwork.persistence.dataobject.TaskLogDO;
import com.zcloud.eightwork.persistence.mapper.TaskLogMapper; import com.zcloud.eightwork.persistence.mapper.TaskLogMapper;
import com.zcloud.eightwork.persistence.repository.TaskLogRepository; import com.zcloud.eightwork.persistence.repository.TaskLogRepository;
@ -31,14 +34,10 @@ public class TaskLogRepositoryImpl extends BaseRepositoryImpl<TaskLogMapper, Tas
@Override @Override
public PageResponse<TaskLogDO> listPage(Map<String, Object> params) { public PageResponse<TaskLogDO> listPage(Map<String, Object> params) {
IPage<TaskLogDO> iPage = new Query<TaskLogDO>().getPage(params); Page<Map<String,Object>> page = new Page<>(Integer.parseInt(params.get("pageIndex").toString()),Integer.parseInt(params.get("pageSize").toString()));
QueryWrapper<TaskLogDO> queryWrapper = new QueryWrapper<>(); String menuPerms = "";
PageQueryHelper.createPageQueryWrapper(queryWrapper, params); IPage<EightworkInfoDO> iPage = taskLogMapper.listPage(page, params,menuPerms);
queryWrapper.and(wrapper -> wrapper.eq("act_user", params.get("userId")) return PageHelper.pageToResponse(iPage, iPage.getRecords());
.or(wrapper1 -> wrapper1.isNull("act_user").eq("act_user_department", params.get("departmentId"))));
queryWrapper.orderByDesc("create_time");
IPage<TaskLogDO> result = taskLogMapper.selectPage(iPage, queryWrapper);
return PageHelper.pageToResponse(result, result.getRecords());
} }
@Override @Override

View File

@ -3,6 +3,25 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.eightwork.persistence.mapper.TaskLogMapper"> <mapper namespace="com.zcloud.eightwork.persistence.mapper.TaskLogMapper">
<select id="listPage" resultType="com.zcloud.eightwork.persistence.dataobject.TaskLogDO">
select task_log.*
from task_log
left join eightwork_info on task_log.work_id = eightwork_info.work_id
where eightwork_info.delete_enum = 'FALSE'
<if test="params.eqWorkType != null">
and task_log.work_type = #{params.eqWorkType}
</if>
<if test="params.eqStatus != null">
and task_log.status = #{params.eqStatus}
</if>
<if test="params.eqStepId != null">
and task_log.step_id = #{params.eqStepId}
</if>
and (task_log.act_user = #{params.userId}
or (task_log.act_user_department = #{params.departmentId}
and task_log.act_user is null))
order by task_log.create_time desc
</select>
<select id="getTodoCount" resultType="com.zcloud.eightwork.domain.model.TodoCountE"> <select id="getTodoCount" resultType="com.zcloud.eightwork.domain.model.TodoCountE">
select task_log.work_type, select task_log.work_type,
@ -11,8 +30,10 @@
left join eightwork_info on task_log.work_id = eightwork_info.work_id left join eightwork_info on task_log.work_id = eightwork_info.work_id
where task_log.status = 0 where task_log.status = 0
and eightwork_info.status != 0 and eightwork_info.status != 0
and eightwork_info.delete_enum = 'FALSE'
and (task_log.act_user = #{userId} and (task_log.act_user = #{userId}
or (task_log.act_user_department = #{orgId} and task_log.act_user is null)) or (task_log.act_user_department = #{orgId}
and task_log.act_user is null))
group by task_log.work_type group by task_log.work_type
</select> </select>
@ -25,6 +46,7 @@
where task_log.status = 0 where task_log.status = 0
and task_log.work_type = #{workType} and task_log.work_type = #{workType}
and eightwork_info.status != 0 and eightwork_info.status != 0
and eightwork_info.delete_enum = 'FALSE'
and (task_log.act_user = #{userId} and (task_log.act_user = #{userId}
or (task_log.act_user_department = #{orgId} or (task_log.act_user_department = #{orgId}
and task_log.act_user is null)) and task_log.act_user is null))