Browse Source

middle消费日志保存修正

zhongwei
ty 12 months ago
parent
commit
c1c1e6bf0f
  1. 23
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java

23
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java

@ -45,7 +45,7 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
//记录操作日志 //记录操作日志
WorkflowOperationLog regularWorkflowOperationLog = new WorkflowOperationLog(); WorkflowOperationLog regularWorkflowOperationLog = new WorkflowOperationLog();
BeanUtils.copyProperties(response,regularWorkflowOperationLog); BeanUtils.copyProperties(response, regularWorkflowOperationLog);
if (ObjectUtils.isNotEmpty(regularWorkflowOperationLog)) { if (ObjectUtils.isNotEmpty(regularWorkflowOperationLog)) {
regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables())); regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables()));
regularWorkflowOperationLog.setTakeId(response.getTaskId()); regularWorkflowOperationLog.setTakeId(response.getTaskId());
@ -53,10 +53,8 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
regularWorkflowOperationLog.setIsOperationLog(true); regularWorkflowOperationLog.setIsOperationLog(true);
regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId()); regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId());
log.info("正在记录操作日志WorkflowOperationLog.... :{}", regularWorkflowOperationLog); log.info("正在记录操作日志WorkflowOperationLog.... :{}", regularWorkflowOperationLog);
workflowOperationLogService.save(regularWorkflowOperationLog);
} }
try {
WorkflowQueue ticker = new WorkflowQueue(); WorkflowQueue ticker = new WorkflowQueue();
ticker.setProcessDefinitionKey(taskDefinitionKey); ticker.setProcessDefinitionKey(taskDefinitionKey);
//判断执行具体的实现类 //判断执行具体的实现类
@ -71,22 +69,13 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
//todo 业务出错误 做补偿 //todo 业务出错误 做补偿
log.error("业务出错,StandardWorkTicketConsumer: {}", e.getMessage()); log.error("业务出错,StandardWorkTicketConsumer: {}", e.getMessage());
log.error("业务出错,StandardWorkTicketConsumer: {} ", response); log.error("业务出错,StandardWorkTicketConsumer: {} ", response);
WorkflowOperationLog workflowOperationLog = new WorkflowOperationLog(); regularWorkflowOperationLog.setIsOperationLog(false);//调用消费方抛出异常
BeanUtils.copyProperties(response,workflowOperationLog);
if (ObjectUtils.isNotEmpty(workflowOperationLog)) {
workflowOperationLog.setVariables(JSON.toJSONString(response.getVariables()));
workflowOperationLog.setTakeId(response.getTaskId());
workflowOperationLog.setTakeName(response.getTaskName());
workflowOperationLog.setIsOperationLog(false);//没保存成功
workflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId());
log.info("正在保存到hzims_workflow_operation_log.... :{}", workflowOperationLog);
workflowOperationLogService.save(workflowOperationLog);
}
} }
} }
} finally {
workflowOperationLogService.save(regularWorkflowOperationLog);
}
} }
} }

Loading…
Cancel
Save