From 0c41504839cbf266a48faf332067e1fdd87edaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Mon, 10 Jul 2023 16:21:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E6=93=8D=E4=BD=9C=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processflow/consumer/StandardWorkTicketConsumer.java | 15 +++++++++++++++ .../middle/processflow/entity/WorkflowOperationLog.java | 8 +++++++- .../hzims-middle/src/main/resources/db/1.0.1.sql | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java index 2cddc09..ad38337 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java @@ -1,5 +1,6 @@ package com.hnac.hzims.middle.processflow.consumer; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; @@ -41,6 +42,18 @@ public class StandardWorkTicketConsumer implements IQueueConsume { log.info("监听到数据:{}", message); ProcessWorkFlowResponse response = JSONObject.parseObject(message, ProcessWorkFlowResponse.class); String taskDefinitionKey = response.getProcessDefinitionKey(); + + //记录操作日志 + WorkflowOperationLog regularWorkflowOperationLog = new WorkflowOperationLog(); + BeanUtils.copyProperties(response,regularWorkflowOperationLog); + if (ObjectUtils.isNotEmpty(regularWorkflowOperationLog)) { + regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables())); + regularWorkflowOperationLog.setIsOperationLog(true); + log.info("正在记录操作日志WorkflowOperationLog.... :{}", regularWorkflowOperationLog); + workflowOperationLogService.save(regularWorkflowOperationLog); + } + + WorkflowQueue ticker = new WorkflowQueue(); ticker.setProcessDefinitionKey(taskDefinitionKey); //判断执行具体的实现类 @@ -58,6 +71,8 @@ public class StandardWorkTicketConsumer implements IQueueConsume { WorkflowOperationLog workflowOperationLog = new WorkflowOperationLog(); BeanUtils.copyProperties(response,workflowOperationLog); if (ObjectUtils.isNotEmpty(workflowOperationLog)) { + regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables())); + regularWorkflowOperationLog.setIsOperationLog(false); log.info("正在保存到hzims_workflow_operation_log.... :{}", workflowOperationLog); workflowOperationLogService.save(workflowOperationLog); } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/entity/WorkflowOperationLog.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/entity/WorkflowOperationLog.java index ebfcf10..f819648 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/entity/WorkflowOperationLog.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/entity/WorkflowOperationLog.java @@ -68,7 +68,7 @@ public class WorkflowOperationLog implements Serializable { /** * 用户Id */ - @TableField("variables") + @TableField("user_id") private String userId; @@ -92,4 +92,10 @@ public class WorkflowOperationLog implements Serializable { private Boolean Deleted; + /** + * 记录正常日志 或错误日志 + */ + private Boolean isOperationLog; + + } diff --git a/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql b/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql new file mode 100644 index 0000000..3b40c96 --- /dev/null +++ b/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql @@ -0,0 +1 @@ +alter table hzims_workflow_operation_log add is_operation_log tinyint(1) comment '0 正常日志 1 错误日志'; \ No newline at end of file From 3b4613e988daf0442b12791a199b098383f33456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Mon, 10 Jul 2023 16:35:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../middle/processflow/consumer/StandardWorkTicketConsumer.java | 6 ++++++ hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java index ad38337..7f55a09 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java @@ -48,7 +48,10 @@ public class StandardWorkTicketConsumer implements IQueueConsume { BeanUtils.copyProperties(response,regularWorkflowOperationLog); if (ObjectUtils.isNotEmpty(regularWorkflowOperationLog)) { regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables())); + regularWorkflowOperationLog.setTakeId(response.getTaskId()); + regularWorkflowOperationLog.setTakeName(response.getTaskName()); regularWorkflowOperationLog.setIsOperationLog(true); + regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId()); log.info("正在记录操作日志WorkflowOperationLog.... :{}", regularWorkflowOperationLog); workflowOperationLogService.save(regularWorkflowOperationLog); } @@ -72,7 +75,10 @@ public class StandardWorkTicketConsumer implements IQueueConsume { BeanUtils.copyProperties(response,workflowOperationLog); if (ObjectUtils.isNotEmpty(workflowOperationLog)) { regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables())); + regularWorkflowOperationLog.setTakeId(response.getTaskId()); + regularWorkflowOperationLog.setTakeName(response.getTaskName()); regularWorkflowOperationLog.setIsOperationLog(false); + regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId()); log.info("正在保存到hzims_workflow_operation_log.... :{}", workflowOperationLog); workflowOperationLogService.save(workflowOperationLog); } diff --git a/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql b/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql index 3b40c96..a3478ce 100644 --- a/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql +++ b/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql @@ -1 +1 @@ -alter table hzims_workflow_operation_log add is_operation_log tinyint(1) comment '0 正常日志 1 错误日志'; \ No newline at end of file +alter table hzims_workflow_operation_log add is_operation_log tinyint(1) comment '1 正常日志 0 错误日志'; \ No newline at end of file