Compare commits
No commits in common. "83c6e2bf430129a6d695f76532fc785e9534f918" and "b1e94239d757c91066e6641d1835196691607838" have entirely different histories.
83c6e2bf43
...
b1e94239d7
|
|
@ -99,20 +99,11 @@ public class TaskLogUpdateExe {
|
||||||
*
|
*
|
||||||
* @param cmd 步骤流转命令
|
* @param cmd 步骤流转命令
|
||||||
*/
|
*/
|
||||||
/** 强制终止状态码 */
|
|
||||||
private static final Integer FORCE_TERMINATE_STATUS = 998;
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void nextStep(TaskLogNextCmd cmd) {
|
public void nextStep(TaskLogNextCmd cmd) {
|
||||||
log.info("开始处理步骤流转: workId={}, stepId={}, status={}",
|
log.info("开始处理步骤流转: workId={}, stepId={}, status={}",
|
||||||
cmd.getWorkId(), cmd.getStepId(), cmd.getStatus());
|
cmd.getWorkId(), cmd.getStepId(), cmd.getStatus());
|
||||||
|
|
||||||
// 强制终止检查:status为998时强制结束工作流
|
|
||||||
if (FORCE_TERMINATE_STATUS.equals(cmd.getStatus())) {
|
|
||||||
handleForceTerminate(cmd);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<TaskLogE> logs = taskLogGateway.listAllByWorkId(cmd.getWorkId());
|
List<TaskLogE> logs = taskLogGateway.listAllByWorkId(cmd.getWorkId());
|
||||||
List<TaskLogDO> actionLogs = new ArrayList<>();
|
List<TaskLogDO> actionLogs = new ArrayList<>();
|
||||||
|
|
||||||
|
|
@ -210,7 +201,7 @@ public class TaskLogUpdateExe {
|
||||||
* - 检查特殊步骤是否允许流转
|
* - 检查特殊步骤是否允许流转
|
||||||
*/
|
*/
|
||||||
private boolean canProceedToNext(TaskLogE currentLog, List<TaskLogE> logs, TaskLogNextCmd cmd) {
|
private boolean canProceedToNext(TaskLogE currentLog, List<TaskLogE> logs, TaskLogNextCmd cmd) {
|
||||||
// 多人签字步骤:需要所有人都签字
|
// 1. 多人签字步骤:需要所有人都签字
|
||||||
if (MULTIPLE_FLAG.equals(currentLog.getMultipleFlag())) {
|
if (MULTIPLE_FLAG.equals(currentLog.getMultipleFlag())) {
|
||||||
long pendingSigns = logs.stream()
|
long pendingSigns = logs.stream()
|
||||||
.filter(log -> log.getStepId().equals(currentLog.getStepId())
|
.filter(log -> log.getStepId().equals(currentLog.getStepId())
|
||||||
|
|
@ -224,6 +215,11 @@ public class TaskLogUpdateExe {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2. 检查是否为特殊步骤
|
||||||
|
if (StringUtils.isNotBlank(currentLog.getSpecialStepCode())) {
|
||||||
|
// 特殊步骤的流转判断在 handleSpecialStepIfNeeded 中处理
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -232,7 +228,6 @@ public class TaskLogUpdateExe {
|
||||||
* - delay: 延时监火转交
|
* - delay: 延时监火转交
|
||||||
* - measures: 安全措施确认
|
* - measures: 安全措施确认
|
||||||
* - gas: 气体检测记录
|
* - gas: 气体检测记录
|
||||||
* - other: 其他自定义步骤
|
|
||||||
*
|
*
|
||||||
* @return 是否允许继续流转到下一步
|
* @return 是否允许继续流转到下一步
|
||||||
*/
|
*/
|
||||||
|
|
@ -252,8 +247,6 @@ public class TaskLogUpdateExe {
|
||||||
return handleMeasuresStep(currentLog, cmd, actionLogs);
|
return handleMeasuresStep(currentLog, cmd, actionLogs);
|
||||||
case "gas":
|
case "gas":
|
||||||
return handleGasDetectionStep(currentLog, cmd, actionLogs);
|
return handleGasDetectionStep(currentLog, cmd, actionLogs);
|
||||||
case "other":
|
|
||||||
return handleOtherStep(currentLog, cmd, actionLogs);
|
|
||||||
default:
|
default:
|
||||||
log.warn("未知的特殊步骤类型: {}", specialStepCode);
|
log.warn("未知的特殊步骤类型: {}", specialStepCode);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -351,23 +344,6 @@ public class TaskLogUpdateExe {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理其他自定义步骤
|
|
||||||
* 保存 otherParams 到 task_log 表和主表 info
|
|
||||||
*/
|
|
||||||
private boolean handleOtherStep(TaskLogE currentLog, TaskLogNextCmd cmd, List<TaskLogDO> actionLogs) {
|
|
||||||
log.info("处理其他自定义步骤");
|
|
||||||
|
|
||||||
if (cmd.getOthers() != null && cmd.getOthers().containsKey("otherParams")) {
|
|
||||||
String otherParams = cmd.getOthers().getString("otherParams");
|
|
||||||
currentLog.setOtherParams(otherParams);
|
|
||||||
addActionLog(actionLogs, currentLog);
|
|
||||||
log.info("自定义参数已保存: otherParams={}", otherParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理其他安全措施步骤
|
* 处理其他安全措施步骤
|
||||||
* 当 steps.measuresStepFlag == 1 时,允许添加其他安全措施
|
* 当 steps.measuresStepFlag == 1 时,允许添加其他安全措施
|
||||||
|
|
@ -570,51 +546,6 @@ public class TaskLogUpdateExe {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理强制终止工作流
|
|
||||||
* status为998时强制结束,设置主表为998,剩余流程设为跳过(不发送待办)
|
|
||||||
*/
|
|
||||||
private void handleForceTerminate(TaskLogNextCmd cmd) {
|
|
||||||
log.info("强制终止工作流: workId={}, stepId={}", cmd.getWorkId(), cmd.getStepId());
|
|
||||||
|
|
||||||
List<TaskLogE> allLogs = taskLogGateway.listAllByWorkId(cmd.getWorkId());
|
|
||||||
List<TaskLogDO> actionLogs = new ArrayList<>();
|
|
||||||
|
|
||||||
// 查找当前步骤并标记为已通过
|
|
||||||
TaskLogE currentLog = findCurrentLog(allLogs, cmd.getId());
|
|
||||||
if (currentLog != null) {
|
|
||||||
currentLog.setStatus(TaskLogStatus.APPROVED.getCode());
|
|
||||||
if (SIGN_STEP_FLAG.equals(currentLog.getSignStepFlag())) {
|
|
||||||
currentLog.setSignPath(cmd.getSignPath());
|
|
||||||
}
|
|
||||||
addActionLog(actionLogs, currentLog);
|
|
||||||
sendTodoCompleteEvent(currentLog.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 将所有未开始的步骤设置为跳过状态
|
|
||||||
for (TaskLogE log : allLogs) {
|
|
||||||
if (TaskLogStatus.NOT_STARTED.equalsCode(log.getStatus())) {
|
|
||||||
log.setStatus(TaskLogStatus.SKIPPED.getCode());
|
|
||||||
addActionLog(actionLogs, log);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 批量更新 task_log
|
|
||||||
taskLogRepository.updateBatchById(actionLogs);
|
|
||||||
|
|
||||||
// 更新 eightworkInfo.info(只更新本次变化的步骤)
|
|
||||||
updateEightworkInfo(cmd.getWorkId(), actionLogs);
|
|
||||||
|
|
||||||
// 更新主表状态为998
|
|
||||||
eightworkInfoRepository.updateWorkStatus(
|
|
||||||
cmd.getWorkId(),
|
|
||||||
"已强制终止",
|
|
||||||
FORCE_TERMINATE_STATUS
|
|
||||||
);
|
|
||||||
|
|
||||||
log.info("工作流已强制终止: workId={}, skippedSteps={}", cmd.getWorkId(), actionLogs.size() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理分支流程
|
* 处理分支流程
|
||||||
* 职责:当主流程步骤为分支开始节点时,激活对应的分支步骤
|
* 职责:当主流程步骤为分支开始节点时,激活对应的分支步骤
|
||||||
|
|
@ -786,15 +717,6 @@ public class TaskLogUpdateExe {
|
||||||
if (source.getCurrentFillTimes() != null) {
|
if (source.getCurrentFillTimes() != null) {
|
||||||
target.setCurrentFillTimes(source.getCurrentFillTimes());
|
target.setCurrentFillTimes(source.getCurrentFillTimes());
|
||||||
}
|
}
|
||||||
if (source.getOtherParams() != null) {
|
|
||||||
target.setOtherParams(source.getOtherParams());
|
|
||||||
}
|
|
||||||
if (source.getLatitude() != null) {
|
|
||||||
target.setLatitude(source.getLatitude());
|
|
||||||
}
|
|
||||||
if (source.getLongitude() != null) {
|
|
||||||
target.setLongitude(source.getLongitude());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -849,17 +771,6 @@ public class TaskLogUpdateExe {
|
||||||
stepInfo.put("location", location);
|
stepInfo.put("location", location);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 其他自定义步骤,添加 otherParams
|
|
||||||
if (StringUtils.isNotBlank(logDO.getOtherParams())) {
|
|
||||||
try {
|
|
||||||
JSONObject otherParams = JSONObject.parseObject(logDO.getOtherParams());
|
|
||||||
stepInfo.put("otherParams", otherParams);
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 如果不是JSON格式,直接存储字符串
|
|
||||||
stepInfo.put("otherParams", logDO.getOtherParams());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
infoJson.put("step_" + logDO.getStepId(), stepInfo);
|
infoJson.put("step_" + logDO.getStepId(), stepInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,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);
|
TaskLogStatus.APPROVED.getCode(),null,null,null,cmd.getOthers());
|
||||||
|
|
||||||
taskLogUpdateExe.nextStep(taskLogNextCmd);
|
taskLogUpdateExe.nextStep(taskLogNextCmd);
|
||||||
return SingleResponse.buildSuccess();
|
return SingleResponse.buildSuccess();
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,4 @@ public class TaskFlowCO extends ClientObject {
|
||||||
//持续步骤阻塞的步骤ID(必须填写足够次数后才能激活的步骤)
|
//持续步骤阻塞的步骤ID(必须填写足够次数后才能激活的步骤)
|
||||||
@ApiModelProperty(value = "持续步骤阻塞的步骤ID(必须填写足够次数后才能激活的步骤)")
|
@ApiModelProperty(value = "持续步骤阻塞的步骤ID(必须填写足够次数后才能激活的步骤)")
|
||||||
private Long blockingStepId;
|
private Long blockingStepId;
|
||||||
//手机端组件名称(special_step_code==other 时使用)
|
|
||||||
@ApiModelProperty(value = "手机端组件名称")
|
|
||||||
private String componentName;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,12 +136,6 @@ public class TaskLogCO extends ClientObject {
|
||||||
//经度
|
//经度
|
||||||
@ApiModelProperty(value = "经度")
|
@ApiModelProperty(value = "经度")
|
||||||
private String longitude;
|
private String longitude;
|
||||||
//其他参数(special_step_code==other 时使用)
|
|
||||||
@ApiModelProperty(value = "其他参数")
|
|
||||||
private String otherParams;
|
|
||||||
//手机端组件名称(special_step_code==other 时使用)
|
|
||||||
@ApiModelProperty(value = "手机端组件名称")
|
|
||||||
private String componentName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "当前步骤需设置的签字人")
|
@ApiModelProperty(value = "当前步骤需设置的签字人")
|
||||||
List<TaskLogCO> settingSignSteps;
|
List<TaskLogCO> settingSignSteps;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,5 @@ public class TaskFlowE extends BaseE {
|
||||||
private Integer minFillTimes;
|
private Integer minFillTimes;
|
||||||
//持续步骤阻塞的步骤ID(必须填写足够次数后才能激活的步骤)
|
//持续步骤阻塞的步骤ID(必须填写足够次数后才能激活的步骤)
|
||||||
private Long blockingStepId;
|
private Long blockingStepId;
|
||||||
//手机端组件名称(special_step_code==other 时使用)
|
|
||||||
private String componentName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,10 +93,6 @@ public class TaskLogE extends BaseE {
|
||||||
private String latitude;
|
private String latitude;
|
||||||
//经度
|
//经度
|
||||||
private String longitude;
|
private String longitude;
|
||||||
//其他参数(special_step_code==other 时使用)
|
|
||||||
private String otherParams;
|
|
||||||
//手机端组件名称(special_step_code==other 时使用)
|
|
||||||
private String componentName;
|
|
||||||
|
|
||||||
public TaskLogE(TaskLogE log) {
|
public TaskLogE(TaskLogE log) {
|
||||||
this.taskLogId = log.getTaskLogId();
|
this.taskLogId = log.getTaskLogId();
|
||||||
|
|
@ -132,8 +128,6 @@ public class TaskLogE extends BaseE {
|
||||||
this.currentFillTimes = log.getCurrentFillTimes();
|
this.currentFillTimes = log.getCurrentFillTimes();
|
||||||
this.latitude = log.getLatitude();
|
this.latitude = log.getLatitude();
|
||||||
this.longitude = log.getLongitude();
|
this.longitude = log.getLongitude();
|
||||||
this.otherParams = log.getOtherParams();
|
|
||||||
this.componentName = log.getComponentName();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,9 +89,6 @@ public class TaskFlowDO extends BaseDO {
|
||||||
//持续步骤阻塞的步骤ID(必须填写足够次数后才能激活的步骤)
|
//持续步骤阻塞的步骤ID(必须填写足够次数后才能激活的步骤)
|
||||||
@ApiModelProperty(value = "持续步骤阻塞的步骤ID(必须填写足够次数后才能激活的步骤)")
|
@ApiModelProperty(value = "持续步骤阻塞的步骤ID(必须填写足够次数后才能激活的步骤)")
|
||||||
private Long blockingStepId;
|
private Long blockingStepId;
|
||||||
//手机端组件名称(special_step_code==other 时使用)
|
|
||||||
@ApiModelProperty(value = "手机端组件名称")
|
|
||||||
private String componentName;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,12 +134,6 @@ public class TaskLogDO extends BaseDO {
|
||||||
//经度
|
//经度
|
||||||
@ApiModelProperty(value = "经度")
|
@ApiModelProperty(value = "经度")
|
||||||
private String longitude;
|
private String longitude;
|
||||||
//其他参数(special_step_code==other 时使用)
|
|
||||||
@ApiModelProperty(value = "其他参数")
|
|
||||||
private String otherParams;
|
|
||||||
//手机端组件名称(special_step_code==other 时使用)
|
|
||||||
@ApiModelProperty(value = "手机端组件名称")
|
|
||||||
private String componentName;
|
|
||||||
|
|
||||||
public TaskLogDO(String taskLogId) {
|
public TaskLogDO(String taskLogId) {
|
||||||
this.taskLogId = taskLogId;
|
this.taskLogId = taskLogId;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue