Compare commits

..

No commits in common. "83c6e2bf430129a6d695f76532fc785e9534f918" and "b1e94239d757c91066e6641d1835196691607838" have entirely different histories.

8 changed files with 7 additions and 122 deletions

View File

@ -99,20 +99,11 @@ public class TaskLogUpdateExe {
*
* @param cmd
*/
/** 强制终止状态码 */
private static final Integer FORCE_TERMINATE_STATUS = 998;
@Transactional(rollbackFor = Exception.class)
public void nextStep(TaskLogNextCmd cmd) {
log.info("开始处理步骤流转: workId={}, stepId={}, status={}",
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<TaskLogDO> actionLogs = new ArrayList<>();
@ -210,7 +201,7 @@ public class TaskLogUpdateExe {
* -
*/
private boolean canProceedToNext(TaskLogE currentLog, List<TaskLogE> logs, TaskLogNextCmd cmd) {
// 多人签字步骤:需要所有人都签字
// 1. 多人签字步骤:需要所有人都签字
if (MULTIPLE_FLAG.equals(currentLog.getMultipleFlag())) {
long pendingSigns = logs.stream()
.filter(log -> log.getStepId().equals(currentLog.getStepId())
@ -224,6 +215,11 @@ public class TaskLogUpdateExe {
}
}
// 2. 检查是否为特殊步骤
if (StringUtils.isNotBlank(currentLog.getSpecialStepCode())) {
// 特殊步骤的流转判断在 handleSpecialStepIfNeeded 中处理
}
return true;
}
@ -232,7 +228,6 @@ public class TaskLogUpdateExe {
* - delay:
* - measures:
* - gas:
* - other:
*
* @return
*/
@ -252,8 +247,6 @@ public class TaskLogUpdateExe {
return handleMeasuresStep(currentLog, cmd, actionLogs);
case "gas":
return handleGasDetectionStep(currentLog, cmd, actionLogs);
case "other":
return handleOtherStep(currentLog, cmd, actionLogs);
default:
log.warn("未知的特殊步骤类型: {}", specialStepCode);
return true;
@ -351,23 +344,6 @@ public class TaskLogUpdateExe {
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
@ -570,51 +546,6 @@ public class TaskLogUpdateExe {
);
}
/**
*
* status998998
*/
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) {
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);
}
// 其他自定义步骤,添加 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);
}

View File

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

View File

@ -86,7 +86,4 @@ public class TaskFlowCO extends ClientObject {
//持续步骤阻塞的步骤ID必须填写足够次数后才能激活的步骤
@ApiModelProperty(value = "持续步骤阻塞的步骤ID必须填写足够次数后才能激活的步骤")
private Long blockingStepId;
//手机端组件名称special_step_code==other 时使用)
@ApiModelProperty(value = "手机端组件名称")
private String componentName;
}

View File

@ -136,12 +136,6 @@ public class TaskLogCO extends ClientObject {
//经度
@ApiModelProperty(value = "经度")
private String longitude;
//其他参数special_step_code==other 时使用)
@ApiModelProperty(value = "其他参数")
private String otherParams;
//手机端组件名称special_step_code==other 时使用)
@ApiModelProperty(value = "手机端组件名称")
private String componentName;
@ApiModelProperty(value = "当前步骤需设置的签字人")
List<TaskLogCO> settingSignSteps;

View File

@ -64,7 +64,5 @@ public class TaskFlowE extends BaseE {
private Integer minFillTimes;
//持续步骤阻塞的步骤ID必须填写足够次数后才能激活的步骤
private Long blockingStepId;
//手机端组件名称special_step_code==other 时使用)
private String componentName;
}

View File

@ -93,10 +93,6 @@ public class TaskLogE extends BaseE {
private String latitude;
//经度
private String longitude;
//其他参数special_step_code==other 时使用)
private String otherParams;
//手机端组件名称special_step_code==other 时使用)
private String componentName;
public TaskLogE(TaskLogE log) {
this.taskLogId = log.getTaskLogId();
@ -132,8 +128,6 @@ public class TaskLogE extends BaseE {
this.currentFillTimes = log.getCurrentFillTimes();
this.latitude = log.getLatitude();
this.longitude = log.getLongitude();
this.otherParams = log.getOtherParams();
this.componentName = log.getComponentName();
}

View File

@ -89,9 +89,6 @@ public class TaskFlowDO extends BaseDO {
//持续步骤阻塞的步骤ID必须填写足够次数后才能激活的步骤
@ApiModelProperty(value = "持续步骤阻塞的步骤ID必须填写足够次数后才能激活的步骤")
private Long blockingStepId;
//手机端组件名称special_step_code==other 时使用)
@ApiModelProperty(value = "手机端组件名称")
private String componentName;
}

View File

@ -134,12 +134,6 @@ public class TaskLogDO extends BaseDO {
//经度
@ApiModelProperty(value = "经度")
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) {
this.taskLogId = taskLogId;