!55 feat(dqinspecttask): 分页查询VO及Mapper XML补充completedStage字段

* feat(dqinspecttask): 分页查询VO及Mapper XML补充completedStage字段
* feat(dqinspecttask): 新增completedStage字段及流程结束阶段递增监听器
This commit is contained in:
wsm
2026-06-26 07:57:32 +00:00
parent accad4456e
commit c061d09935
5 changed files with 65 additions and 0 deletions
@@ -0,0 +1,52 @@
package org.jeecg.inspectimprove.listener;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.jeecg.inspectimprove.InspectImproveConfig;
import org.jeecg.modules.demo.dqinspecttask.entity.DqInspectTask;
import org.jeecg.modules.demo.dqinspecttask.service.IDqInspectTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 流程结束时将 DqInspectTask.completedStage 原子递增 1
*
* <p>配置方式:在 BPMN 流程定义的 end 事件上添加 ExecutionListener
* event="end"delegateExpression="${DqInspectTaskStageIncrementListener}"</p>
*/
@Slf4j
@Component("DqInspectTaskStageIncrementListener")
@RequiredArgsConstructor
public class DqInspectTaskStageIncrementListener implements ExecutionListener {
private static final long serialVersionUID = 1L;
private final InspectImproveConfig inspectImproveConfig;
private final IDqInspectTaskService dqInspectTaskService;
@Override
public void notify(DelegateExecution execution) {
Object businessKeyObj = execution.getVariable(inspectImproveConfig.getInspectImprove().getBusinessKey());
if (businessKeyObj == null || StringUtils.isBlank(businessKeyObj.toString())) {
log.warn("【巡视整改-阶段递增监听器】未获取到业务表单ID,跳过, processInstanceId: {}",
execution.getProcessInstanceId());
return;
}
String businessKey = businessKeyObj.toString();
boolean updated = dqInspectTaskService.lambdaUpdate()
.setSql("completed_stage = completed_stage + 1")
.eq(DqInspectTask::getId, businessKey)
.update();
if (updated) {
log.info("【巡视整改-阶段递增监听器】completedStage 已递增, businessKey: {}, processInstanceId: {}",
businessKey, execution.getProcessInstanceId());
} else {
log.warn("【巡视整改-阶段递增监听器】递增未影响任何行,可能记录已删除, businessKey: {}", businessKey);
}
}
}
@@ -146,6 +146,9 @@ public class DqInspectTask implements Serializable {
@Dict(dicCode = "super_status")
@Schema(description = "流程状态")
private java.lang.String bpmStatus;
/**已完成阶段数(初始0,每完成一个流程+1,第n个流程要求该字段为n-1才可发起)*/
@Schema(description = "已完成阶段数")
private java.lang.Integer completedStage = 0;
/**整改状态*/
@Excel(name = "整改状态", width = 15)
@ExcelColumn(name = "整改状态", width = 15)
@@ -29,6 +29,7 @@
t.bpm_process_id as bpmProcessId,
t.bpm_status as bpmStatus,
t.task_status as taskStatus,
t.completed_stage as completedStage,
t.supervise_count as superviseCount,
t.sort_no as sortNo,
t.create_time as createTime
@@ -57,6 +58,9 @@
<if test="task.problemId != null and task.problemId != ''">
and t.problem_id = #{task.problemId}
</if>
<if test="task.completedStage != null and task.completedStage != ''">
and t.completed_stage = #{task.completedStage}
</if>
</if>
order by
p_category.sort_no asc,
@@ -100,6 +100,9 @@ public class DqInspectTaskLedgerVo implements Serializable {
@Schema(description = "整改状态")
private String taskStatus;
@Schema(description = "已完成阶段数")
private Integer completedStage;
@Schema(description = "督办次数")
private String superviseCount;
@@ -130,6 +130,9 @@ public class DqInspectTaskPage {
@Excel(name = "整改状态", width = 15)
@Schema(description = "整改状态")
private java.lang.String taskStatus;
/**已完成阶段数*/
@Schema(description = "已完成阶段数")
private java.lang.Integer completedStage;
/**督办次数*/
@Excel(name = "督办次数", width = 15)
@Schema(description = "督办次数")