lmx 3 weken geleden
bovenliggende
commit
7f6ef3692c

+ 7 - 6
fs-service/src/main/java/com/fs/company/domain/CompanyAiWorkflowExec.java

@@ -1,5 +1,6 @@
 package com.fs.company.domain;
 
+import java.time.LocalDateTime;
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -56,14 +57,14 @@ public class CompanyAiWorkflowExec {
     private String variables;
 
     /** 开始时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date startTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime startTime;
 
     /** 最后更新时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date lastUpdateTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime lastUpdateTime;
 
     /** 业务键值 */
     @Excel(name = "业务键值")

+ 10 - 9
fs-service/src/main/java/com/fs/company/service/impl/CompanyWorkflowEngineImpl.java

@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDateTime;
 import java.util.*;
 
 /**
@@ -173,7 +174,7 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
             CompanyAiWorkflowExec update = new CompanyAiWorkflowExec();
             update.setWorkflowInstanceId(workflowInstanceId);
             update.setStatus(ExecutionStatusEnum.PAUSED.getValue());
-            update.setLastUpdateTime(new Date());
+            update.setLastUpdateTime(LocalDateTime.now());
 
             int rows = currentExecutionMapper.updateById(update);
 
@@ -203,7 +204,7 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
             CompanyAiWorkflowExec update = new CompanyAiWorkflowExec();
             update.setWorkflowInstanceId(workflowInstanceId);
             update.setStatus(ExecutionStatusEnum.SUCCESS.getValue());
-            update.setLastUpdateTime(new Date());
+            update.setLastUpdateTime(LocalDateTime.now());
 
             int rows = currentExecutionMapper.updateById(update);
 
@@ -288,7 +289,7 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
             currentExec.setCurrentNodeKey(startNodeKey);
             currentExec.setCurrentNodeType(NodeTypeEnum.START.getValue());
             currentExec.setStatus(ExecutionStatusEnum.RUNNING.getValue());
-            currentExec.setStartTime(new Date());
+            currentExec.setStartTime(LocalDateTime.now());
             currentExec.setVariables(objectMapper.writeValueAsString(context.getVariables()));
             // 如果有业务键
             currentExec.setBusinessKey(context.getBusinessId());
@@ -310,7 +311,7 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
             update.setCurrentNodeKey(currentNodeKey);
 
             update.setVariables(objectMapper.writeValueAsString(context.getVariables()));
-            update.setLastUpdateTime(new Date());
+            update.setLastUpdateTime(LocalDateTime.now());
 
             currentExecutionMapper.updateById(update);
         } catch (JsonProcessingException e) {
@@ -326,7 +327,7 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
         CompanyAiWorkflowExec update = new CompanyAiWorkflowExec();
         update.setWorkflowInstanceId(workflowInstanceId);
         update.setCurrentNodeKey(nextNodeKey);
-        update.setLastUpdateTime(new Date());
+        update.setLastUpdateTime(LocalDateTime.now());
         currentExecutionMapper.updateCompanyAiWorkflowExec(update);
     }
 
@@ -337,7 +338,7 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
         CompanyAiWorkflowExec update = new CompanyAiWorkflowExec();
         update.setWorkflowInstanceId(workflowInstanceId);
         update.setStatus(status.getValue());
-        update.setLastUpdateTime(new Date());
+        update.setLastUpdateTime(LocalDateTime.now());
 
         currentExecutionMapper.updateById(update);
     }
@@ -373,8 +374,8 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
         ExecutionContext context = new ExecutionContext();
         context.setWorkflowInstanceId(workflowInstanceId);
         context.setVariables(inputVariables != null ? inputVariables : new HashMap<>());
-        context.setStartTime(new Date());
-        context.setCurrentTime(new Date());
+        context.setStartTime(LocalDateTime.now());
+        context.setCurrentTime(LocalDateTime.now());
         context.setBusinessId(inputVariables.containsKey("businessId")?inputVariables.get("businessId").toString():null);
 
         return context;
@@ -388,7 +389,7 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
         context.setWorkflowInstanceId(record.getWorkflowInstanceId());
         context.setCurrentNodeKey(record.getCurrentNodeKey());
         context.setStartTime(record.getStartTime());
-        context.setCurrentTime(new Date());
+        context.setCurrentTime(LocalDateTime.now());
 
         try {
             if (StringUtils.isNotBlank(record.getVariables())) {