|
|
@ -307,7 +307,7 @@ public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceS
|
|
|
|
throw new ServiceException("工单当前状态不允许审批");
|
|
|
|
throw new ServiceException("工单当前状态不允许审批");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 更新审批状态
|
|
|
|
// 更新审批状态和工单状态
|
|
|
|
workOrder.setApproveStatus(approveStatus);
|
|
|
|
workOrder.setApproveStatus(approveStatus);
|
|
|
|
|
|
|
|
|
|
|
|
if (DmsConstants.DMS_BILLS_FAULT_INSTANCE_APPROVE_STATUS_APPROVED.equals(approveStatus)) {
|
|
|
|
if (DmsConstants.DMS_BILLS_FAULT_INSTANCE_APPROVE_STATUS_APPROVED.equals(approveStatus)) {
|
|
|
@ -318,16 +318,24 @@ public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceS
|
|
|
|
workOrder.setBillsStatus(DmsConstants.DMS_BILLS_FAULT_INSTANCE_STATUS_FINISH);
|
|
|
|
workOrder.setBillsStatus(DmsConstants.DMS_BILLS_FAULT_INSTANCE_STATUS_FINISH);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 更新工单状态
|
|
|
|
// 先更新工单状态,确保业务数据一致性
|
|
|
|
boolean updateResult = baseMapper.updateById(workOrder) > 0;
|
|
|
|
boolean updateResult = baseMapper.updateById(workOrder) > 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (updateResult && workOrder.getWfDefinitionId() != null) {
|
|
|
|
if (!updateResult) {
|
|
|
|
// 推进工作流
|
|
|
|
throw new ServiceException("工单状态更新失败");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 业务状态更新成功后,再推进工作流
|
|
|
|
|
|
|
|
if (workOrder.getWfDefinitionId() != null) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
// 获取当前任务ID
|
|
|
|
Long currentTaskId = remoteWorkflowService.getCurrentTaskIdByInstanceId(workOrder.getWfDefinitionId());
|
|
|
|
Long currentTaskId = remoteWorkflowService.getCurrentTaskIdByInstanceId(workOrder.getWfDefinitionId());
|
|
|
|
if (currentTaskId != null) {
|
|
|
|
if (currentTaskId != null) {
|
|
|
|
RemoteCompleteTask remoteCompleteTask = new RemoteCompleteTask();
|
|
|
|
RemoteCompleteTask remoteCompleteTask = new RemoteCompleteTask();
|
|
|
|
remoteCompleteTask.setTaskId(currentTaskId);
|
|
|
|
remoteCompleteTask.setTaskId(currentTaskId);
|
|
|
|
remoteCompleteTask.setMessage(message);
|
|
|
|
remoteCompleteTask.setMessage(message != null ? message : "审批完成");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置消息类型
|
|
|
|
List<String> messageTypes = new ArrayList<>();
|
|
|
|
List<String> messageTypes = new ArrayList<>();
|
|
|
|
messageTypes.add("system");
|
|
|
|
messageTypes.add("system");
|
|
|
|
remoteCompleteTask.setMessageType(messageTypes);
|
|
|
|
remoteCompleteTask.setMessageType(messageTypes);
|
|
|
@ -335,9 +343,25 @@ public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceS
|
|
|
|
// 设置工作流变量 - approveStatus用于互斥网关判断
|
|
|
|
// 设置工作流变量 - approveStatus用于互斥网关判断
|
|
|
|
Map<String, Object> variables = new HashMap<>();
|
|
|
|
Map<String, Object> variables = new HashMap<>();
|
|
|
|
variables.put("approveStatus", approveStatus);
|
|
|
|
variables.put("approveStatus", approveStatus);
|
|
|
|
|
|
|
|
variables.put("businessId", repairInstanceId.toString());
|
|
|
|
|
|
|
|
|
|
|
|
remoteCompleteTask.setVariables(variables);
|
|
|
|
remoteCompleteTask.setVariables(variables);
|
|
|
|
remoteWorkflowService.completeTask(remoteCompleteTask);
|
|
|
|
|
|
|
|
|
|
|
|
// 推进工作流
|
|
|
|
|
|
|
|
boolean workflowResult = remoteWorkflowService.completeTask(remoteCompleteTask);
|
|
|
|
|
|
|
|
if (!workflowResult) {
|
|
|
|
|
|
|
|
log.warn("工作流推进失败,但业务状态已更新成功,repairInstanceId: {}, approveStatus: {}",
|
|
|
|
|
|
|
|
repairInstanceId, approveStatus);
|
|
|
|
|
|
|
|
// 工作流推进失败不影响业务操作的成功
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
log.info("审批工单成功,repairInstanceId: {}, approveStatus: {}", repairInstanceId, approveStatus);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
log.warn("未找到当前活跃任务,跳过工作流推进,repairInstanceId: {}", repairInstanceId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error("工作流推进异常,repairInstanceId: {}, approveStatus: {}", repairInstanceId, approveStatus, e);
|
|
|
|
|
|
|
|
// 工作流推进失败不影响业务操作的成功,但需要记录日志
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|