From e608cd8a5c8f8e09041512ab5507eca125e7cbde Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期二, 06 十二月 2022 14:15:08 +0800
Subject: [PATCH] fix: 预警研判保存

---
 ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 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 a6cfbb2..b72158c 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
@@ -11,6 +11,8 @@
 import com.ycl.controller.video.common.constant.BaseCaseStatus;
 import com.ycl.controller.video.common.constant.StepName;
 import com.ycl.controller.video.common.util.DateUtil;
+import com.ycl.controller.video.common.util.UtilNumber;
+import com.ycl.dto.caseHandler.DispatchInfoParam;
 import com.ycl.dto.caseHandler.QueryForViolationParam;
 import com.ycl.dto.casePool.IllegalBuildingParam;
 import com.ycl.dto.casePool.ViolationParam;
@@ -25,6 +27,7 @@
 import com.ycl.remote.dto.*;
 import com.ycl.remote.service.CityPlatformService;
 import com.ycl.service.caseHandler.IBaseCaseService;
+import com.ycl.service.caseHandler.IDispatchHandleService;
 import com.ycl.service.caseHandler.IViolationsService;
 import com.ycl.service.video.IVideoAlarmReportService;
 import com.ycl.vo.casePool.*;
@@ -58,6 +61,7 @@
     private CityPlatformService cityPlatformService;
     private IViolationsService violationsService;
     private IVideoAlarmReportService videoAlarmReportService;
+
 
     @Value("${fdfs.fileUrl}")
     private String fileUrl;
@@ -106,9 +110,18 @@
     @Resource
     PartyInfoMapper partyInfoMapper;
 
+    @Resource
+    UtilNumber utilNumber;
+
+    @Resource
+    IDispatchHandleService iDispatchHandleService;
+
+    @Resource
+    IBaseCaseService baseCaseService;
+
 
     @Override
-    public String uploadEvent(Integer caseId) {
+    public String uploadEvent(Long caseId) {
         BaseCase baseCase = this.getById(caseId);
         Violations violations = violationsService.getById(caseId);
         String medias = "";
@@ -389,7 +402,7 @@
 
     @Override
     public List<QueryForViolationVO> selectViolationList(QueryForViolationParam queryForViolationParam) {
-        return  baseCaseMapper.selectViolationPage(queryForViolationParam);
+        return baseCaseMapper.selectViolationPage(queryForViolationParam);
     }
 
     @Override
@@ -411,10 +424,22 @@
         BaseCase baseCase = new BaseCase();
         BeanUtils.copyProperties(violationParam, baseCase);
         baseCase.setId(violationParam.getBaseId());
+        baseCase.setCode(utilNumber.createCaseCode());
         baseCaseMapper.updateById(baseCase);
         Violations violations = new Violations();
         BeanUtils.copyProperties(violationParam, violations);
         violations.setId(violations.getId());
-        return violationsMapper.updateById(violations) == 1 ? true : false;
+        if (violationParam.getState() == 6) {
+            AdminUserDetails user = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+            violationParam.setCreateUser(user.getUserId());
+            DispatchInfoParam dispatchInfoParam = new DispatchInfoParam();
+            BeanUtils.copyProperties(violationParam, dispatchInfoParam);
+            dispatchInfoParam.setBaseCaseId(violationParam.getBaseId());
+            iDispatchHandleService.dispatch(dispatchInfoParam);
+        }
+        if (violationParam.getState() == 2) {
+            baseCaseService.uploadEvent(violationParam.getBaseId());
+        }
+        return violationsMapper.insert(violations) == 1 ? true : false;
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0