From dfc1f756dcc5274e699c878f32e94189abff2169 Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期四, 20 十月 2022 15:21:50 +0800
Subject: [PATCH] lack of  table field

---
 ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java
index ace3776..560c2c5 100644
--- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java
+++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java
@@ -1,5 +1,6 @@
 package com.ycl.service.caseHandler.impl;
 
+import com.alibaba.druid.util.StringUtils;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -36,6 +37,7 @@
 import javax.annotation.Resource;
 import java.time.Duration;
 import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -153,6 +155,7 @@
     public Page listViolationsPage(Page page, Integer state, Integer resource) {
         Integer type = 01;
         Integer hours = 60;
+        Integer day = 24;
         Page<CasePoolViolationDO> violationsPage = baseCaseMapper.listViolationsPage(page, state, type, resource);
         List<CasePoolViolationVO> violationVOList = violationsPage
                 .getRecords()
@@ -162,13 +165,15 @@
                     BeanUtils.copyProperties(item, casePoolViolationVO);
                     if (item.getCloseTime() == null) {
                         Duration duration = Duration.between(item.getAlarmTime(), LocalDateTime.now());
+                        long continueHours = duration.toHours() - (duration.toDays() * day);
                         long minutes = duration.toMinutes() - (duration.toHours() * hours);
-                        String continueTime = duration.toHours() + "鏃�" + minutes + "鍒嗛挓";
+                        String continueTime = duration.toDays() + "澶�" + continueHours + "鏃�" + minutes + "鍒嗛挓";
                         casePoolViolationVO.setContinueTime(continueTime);
                     } else {
                         Duration duration = Duration.between(item.getAlarmTime(), item.getCloseTime());
+                        long continueHours = duration.toHours() - (duration.toDays() * day);
                         long minutes = duration.toMinutes() - (duration.toHours() * hours);
-                        String continueTime = duration.toHours() + "鏃�" + minutes + "鍒嗛挓";
+                        String continueTime = duration.toDays() + "澶�" + continueHours + "鏃�" + minutes + "鍒嗛挓";
                         casePoolViolationVO.setContinueTime(continueTime);
                     }
                     casePoolViolationVO.setCategory(dataDictionaryMapper.selectById(item.getCategoryId()).getName());
@@ -210,15 +215,15 @@
         BeanUtils.copyProperties(violationParam, violations);
         Integer value = 1;
         violations.setId(id);
-        setDisposeRecord(id);
+        setDisposeRecord(id, violationParam.getLimitTime());
         return violationsMapper.insert(violations) == value ? true : false;
     }
 
-    private void setDisposeRecord(Long id) {
+    private void setDisposeRecord(Long id, String limitTime) {
         String stepName = StepName.DISPATCH.getName();
-        QueryWrapper<WorkflowConfigStep> stepqurey = new QueryWrapper<>();
-        stepqurey.eq("name", stepName);
-        WorkflowConfigStep workflowConfigStep = workflowConfigStepMapper.selectOne(stepqurey);
+        QueryWrapper<WorkflowConfigStep> stepQuery = new QueryWrapper<>();
+        stepQuery.eq("name", stepName);
+        WorkflowConfigStep workflowConfigStep = workflowConfigStepMapper.selectOne(stepQuery);
 
         Integer state = 0;
         DisposeRecord disposeRecord = new DisposeRecord();
@@ -231,6 +236,9 @@
         disposeRecord.setCreateUser(userDetails.getUserId());
         disposeRecord.setStartTime(LocalDateTime.now());
         disposeRecord.setStepName(stepName);
+        if(!StringUtils.isEmpty(limitTime)) {
+            disposeRecord.setLimitTime(LocalDateTime.parse(limitTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+        }
         disposeRecordMapper.insert(disposeRecord);
     }
 
@@ -238,7 +246,7 @@
     public Boolean saveIllegalBuildingCase(IllegalBuildingParam illegalBuildingParam, Long id) {
         IllegalBuilding illegalBuilding = new IllegalBuilding();
         BeanUtils.copyProperties(illegalBuildingParam, illegalBuilding);
-        setDisposeRecord(id);
+        setDisposeRecord(id, illegalBuildingParam.getLimitTime());
         Integer value = 1;
         illegalBuilding.setBaseCaseId(id);
         return illegalBuildingMapper.insert(illegalBuilding) == value ? true : false;
@@ -266,7 +274,7 @@
         }
         //鑾峰彇璋冨害淇℃伅
         Map mapD = new HashMap();
-        mapD.put("baseCaseId",baseCase.getId());
+        mapD.put("baseCaseId", baseCase.getId());
         DispatchInfo dispatchInfo = dispatchInfoMapper.selectCondMap(mapD);
         baseCase.setDispatchInfo(dispatchInfo);
         bcd.setBaseCase(baseCase);
@@ -367,7 +375,7 @@
     }
 
     @Override
-    public void endCase(Long caseId, String result,String opinion) {
+    public void endCase(Long caseId, String result, String opinion) {
         //鑾峰彇褰撳墠鐧婚檰鐢ㄦ埛淇℃伅
         AdminUserDetails user = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
         String endCaseName = StepName.CLOSING_REGISTER.getName();
@@ -384,14 +392,15 @@
             throw new ApiException("鏈煡璇㈠埌璇ユ祦绋嬬幆鑺�");
         }
         UpdateWrapper<DisposeRecord> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("base_case_id", baseCase.getId()).eq("workflow_config_step_id",workflowConfigStep.getId());
+        updateWrapper.eq("base_case_id", baseCase.getId()).eq("workflow_config_step_id", workflowConfigStep.getId());
 
         //淇敼缁撴璁板綍
         DisposeRecord disposeRecord = new DisposeRecord();
-        disposeRecord.setHandlerId(user.getUserId().longValue());
+        disposeRecord.setHandlerId(user.getUserId());
         //缁撴宸茬粨鏉�
         disposeRecord.setState(1);
         disposeRecord.setEndTime(LocalDateTime.now());
+        disposeRecord.setHandlerId(user.getUserId());
         disposeRecordMapper.update(disposeRecord, updateWrapper);
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0