From 8f66aa7785d8cc0bf1e642f638a7f1d8c67a5f69 Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期五, 18 十一月 2022 17:16:54 +0800
Subject: [PATCH] 上传处置驳回

---
 ycl-platform/src/main/java/com/ycl/dto/dispatch/UploadDisposingResultParam.java           |   20 +++++-
 ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/DisposeRecordServiceImpl.java |   93 +++++++++++++++++++++++++-----
 ycl-platform/src/main/java/com/ycl/service/caseHandler/IDisposeRecordService.java         |    2 
 ycl-platform/src/main/java/com/ycl/entity/caseHandler/PartyInfo.java                      |    2 
 ycl-platform/src/main/java/com/ycl/controller/caseHandler/DispatchHandleController.java   |    6 -
 ycl-platform/src/main/java/com/ycl/entity/caseHandler/Investigation.java                  |    2 
 6 files changed, 98 insertions(+), 27 deletions(-)

diff --git a/ycl-platform/src/main/java/com/ycl/controller/caseHandler/DispatchHandleController.java b/ycl-platform/src/main/java/com/ycl/controller/caseHandler/DispatchHandleController.java
index 78057fc..74db768 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/caseHandler/DispatchHandleController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/caseHandler/DispatchHandleController.java
@@ -60,10 +60,8 @@
     @ApiOperation(value = "涓婁紶杩濊/杩濆缓澶勭疆缁撴灉")
     @PostMapping("/addition_dispose_result")
     @LogSave(operationType = "浜嬮」澶勭疆绠$悊", contain = "妗堜欢涓婁紶澶勭疆缁撴灉")
-    public CommonResult searchDisposeList(@RequestParam Long caseId,
-                                          @RequestParam Integer type,
-                                          @RequestBody UploadDisposingResultParam uploadDisposingResultParam) {
-        iDisposeRecordService.saveUpload(caseId, type, uploadDisposingResultParam);
+    public CommonResult searchDisposeList(@RequestBody UploadDisposingResultParam uploadDisposingResultParam) {
+        iDisposeRecordService.saveOrUpdateUpload(uploadDisposingResultParam);
         return CommonResult.success("add success");
     }
 }
diff --git a/ycl-platform/src/main/java/com/ycl/dto/dispatch/UploadDisposingResultParam.java b/ycl-platform/src/main/java/com/ycl/dto/dispatch/UploadDisposingResultParam.java
index 4f0a43f..cb662cd 100644
--- a/ycl-platform/src/main/java/com/ycl/dto/dispatch/UploadDisposingResultParam.java
+++ b/ycl-platform/src/main/java/com/ycl/dto/dispatch/UploadDisposingResultParam.java
@@ -1,20 +1,32 @@
 package com.ycl.dto.dispatch;
 
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonProperty;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-
-import java.time.LocalDateTime;
 
 @Data
 @ApiModel("UploadDisposingResultParam")
 public class UploadDisposingResultParam {
 
+    @ApiModelProperty(value = "妗堜欢id")
+    private Long caseId;
     //鎵垮姙闃熷憳
 
+    @ApiModelProperty(value = "璋冩煡鍙栬瘉id")
+    private Long investigationId;
+
+    @ApiModelProperty(value = "鍒拌揪鐜板満id")
+    private Long arrivalSituationId;
+
+    @ApiModelProperty(value = "褰撲簨浜篿d")
+    private Long partyInfoId;
+
+    @ApiModelProperty(value = "鏂囦功id")
+    private Long writId;
+
+    @ApiModelProperty(value = "鍥剧墖id")
+    private Integer imageResourcesId;
     /**
      * 鎵垮姙闃熷憳
      */
diff --git a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Investigation.java b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Investigation.java
index 7b63f82..1fb4384 100644
--- a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Investigation.java
+++ b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Investigation.java
@@ -80,7 +80,7 @@
      */
     @TableField("party_id")
     @ApiModelProperty(value = "褰撲簨浜篿d")
-    private Integer partyId;
+    private Long partyId;
 
     /**
      * 鎯呭喌鎻忚堪
diff --git a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/PartyInfo.java b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/PartyInfo.java
index 66c236e..552d177 100644
--- a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/PartyInfo.java
+++ b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/PartyInfo.java
@@ -28,7 +28,7 @@
 
     @TableId(value = "id", type = IdType.AUTO)
     @ApiModelProperty(value = "id")
-    private Integer id;
+    private Long id;
 
     /**
      * 濮撳悕
diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/IDisposeRecordService.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/IDisposeRecordService.java
index a4bed84..7cfd02f 100644
--- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/IDisposeRecordService.java
+++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/IDisposeRecordService.java
@@ -19,5 +19,5 @@
 
     List<MyBacklogVO> listMyTask(String num, Long userId);
 
-    Boolean saveUpload(Long caseId, Integer type, UploadDisposingResultParam uploadDisposingResultParam);
+    Boolean saveOrUpdateUpload(UploadDisposingResultParam uploadDisposingResultParam);
 }
diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/DisposeRecordServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/DisposeRecordServiceImpl.java
index f032d78..deea175 100644
--- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/DisposeRecordServiceImpl.java
+++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/DisposeRecordServiceImpl.java
@@ -1,5 +1,6 @@
 package com.ycl.service.caseHandler.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -70,8 +71,71 @@
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Boolean saveUpload(Long caseId, Integer type, UploadDisposingResultParam uploadDisposingResultParam) {
+    public Boolean saveOrUpdateUpload(UploadDisposingResultParam uploadDisposingResultParam) {
         AdminUserDetails user = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+        ArrivalSituation arrivalSituationed = iArrivalSituationService.getOne(new LambdaQueryWrapper<ArrivalSituation>().eq(ArrivalSituation::getBaseCaseId, uploadDisposingResultParam.getCaseId()));
+        if (arrivalSituationed!=null || arrivalSituationed.getId()!=null){
+            //褰撲簨浜�
+            PartyInfo partyInfo = new PartyInfo();
+            if (StringUtils.isNotEmpty(uploadDisposingResultParam.getName())) {
+                BeanUtils.copyProperties(uploadDisposingResultParam, partyInfo);
+                partyInfo.setCreateUser(user.getUserId().intValue());
+                partyInfo.setCreateTime(LocalDateTime.now());
+                partyInfo.setId(uploadDisposingResultParam.getPartyInfoId());
+                iPartyInfoService.updateById(partyInfo);
+            }
+            //璋冩煡鍙栬瘉
+            Investigation investigation = new Investigation();
+            BeanUtils.copyProperties(uploadDisposingResultParam, investigation);
+            investigation.setBaseCaseId(uploadDisposingResultParam.getCaseId());
+            investigation.setCreateTime(LocalDateTime.now());
+            investigation.setCreateUser(user.getUserId());
+            investigation.setPartyId(partyInfo.getId());
+            investigation.setInvestigationTime(LocalDateTime.parse(uploadDisposingResultParam.getInvestigationTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+            investigation.setId(uploadDisposingResultParam.getInvestigationId());
+            iInvestigationService.updateById(investigation);
+            //鍒拌揪
+            ArrivalSituation arrivalSituation = new ArrivalSituation();
+            BeanUtils.copyProperties(uploadDisposingResultParam, arrivalSituation);
+            arrivalSituation.setBaseCaseId(uploadDisposingResultParam.getCaseId());
+            arrivalSituation.setCreateTime(LocalDateTime.now());
+            arrivalSituation.setCreateUser(user.getUserId());
+            arrivalSituation.setArrivalTime(LocalDateTime.parse(uploadDisposingResultParam.getArrivalTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+            arrivalSituation.setId(uploadDisposingResultParam.getArrivalSituationId());
+            iArrivalSituationService.updateById(arrivalSituation);
+            //鏂囦功
+            String handType = "02";
+            ImageResources imageResources = new ImageResources();
+            imageResources.setType(handType);
+            imageResources.setBelongToId(uploadDisposingResultParam.getCaseId());
+            imageResources.setCreateTime(LocalDateTime.now());
+            imageResources.setCreateUser(user.getUserId());
+            imageResources.setUrl(StringUtils.joinWith(",", uploadDisposingResultParam.getPic(), uploadDisposingResultParam.getSituationPic()));
+            imageResources.setId(uploadDisposingResultParam.getImageResourcesId());
+            iImageResourcesService.updateById(imageResources);
+            if (uploadDisposingResultParam.getWritCode() == null || uploadDisposingResultParam.getWritType() == null) {
+                Writ writ = new Writ();
+                BeanUtils.copyProperties(uploadDisposingResultParam, writ);
+                writ.setBaseCaseId(uploadDisposingResultParam.getCaseId());
+                writ.setIllegalBuildingId(uploadDisposingResultParam.getCaseId());
+                writ.setCreateTime(LocalDateTime.now());
+                writ.setCreateUser(user.getUserId());
+                writ.setLimitTime(LocalDateTime.parse(uploadDisposingResultParam.getLimitTime(), DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:ss")));
+                writ.setRectifyTime(LocalDateTime.parse(uploadDisposingResultParam.getRectifyTime(), DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:ss")));
+                writ.setSendTime(LocalDateTime.parse(uploadDisposingResultParam.getSendTime(), DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:ss")));
+                writ.setBaseCaseId(uploadDisposingResultParam.getCaseId());
+                iWritService.updateById(writ);
+                imageResources.setUrl(StringUtils
+                        .joinWith(",", uploadDisposingResultParam.getPic()
+                                , uploadDisposingResultParam.getSituationPic()
+                                , uploadDisposingResultParam.getOriginalPic()
+                                , uploadDisposingResultParam.getOtherPic()
+                                , uploadDisposingResultParam.getRectifiedPic()
+                                , uploadDisposingResultParam.getWritPic()));
+                iImageResourcesService.updateById(imageResources);
+            }
+        }
+
         //褰撲簨浜�
         PartyInfo partyInfo = new PartyInfo();
         if (StringUtils.isNotEmpty(uploadDisposingResultParam.getName())) {
@@ -83,7 +147,7 @@
         //璋冩煡鍙栬瘉
         Investigation investigation = new Investigation();
         BeanUtils.copyProperties(uploadDisposingResultParam, investigation);
-        investigation.setBaseCaseId(caseId);
+        investigation.setBaseCaseId(uploadDisposingResultParam.getCaseId());
         investigation.setCreateTime(LocalDateTime.now());
         investigation.setCreateUser(user.getUserId());
         investigation.setPartyId(partyInfo.getId());
@@ -92,29 +156,25 @@
         //鍒拌揪
         ArrivalSituation arrivalSituation = new ArrivalSituation();
         BeanUtils.copyProperties(uploadDisposingResultParam, arrivalSituation);
-        arrivalSituation.setBaseCaseId(caseId);
+        arrivalSituation.setBaseCaseId(uploadDisposingResultParam.getCaseId());
         arrivalSituation.setCreateTime(LocalDateTime.now());
         arrivalSituation.setCreateUser(user.getUserId());
         arrivalSituation.setArrivalTime(LocalDateTime.parse(uploadDisposingResultParam.getArrivalTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
         iArrivalSituationService.save(arrivalSituation);
         //鏂囦功
-        Integer illegalBuildingType = 2;
-        Integer violation = 1;
         String handType = "02";
         ImageResources imageResources = new ImageResources();
         imageResources.setType(handType);
-        imageResources.setBelongToId(caseId);
+        imageResources.setBelongToId(uploadDisposingResultParam.getCaseId());
         imageResources.setCreateTime(LocalDateTime.now());
         imageResources.setCreateUser(user.getUserId());
-        if (type == violation) {
-            imageResources.setUrl(StringUtils.joinWith(",", uploadDisposingResultParam.getPic(), uploadDisposingResultParam.getSituationPic()));
-            iImageResourcesService.save(imageResources);
-        }
-        if (type == illegalBuildingType) {
+        imageResources.setUrl(StringUtils.joinWith(",", uploadDisposingResultParam.getPic(), uploadDisposingResultParam.getSituationPic()));
+        iImageResourcesService.save(imageResources);
+        if (uploadDisposingResultParam.getWritCode() == null || uploadDisposingResultParam.getWritType() == null) {
             Writ writ = new Writ();
             BeanUtils.copyProperties(uploadDisposingResultParam, writ);
-            writ.setBaseCaseId(caseId);
-            writ.setIllegalBuildingId(caseId);
+            writ.setBaseCaseId(uploadDisposingResultParam.getCaseId());
+            writ.setIllegalBuildingId(uploadDisposingResultParam.getCaseId());
             writ.setCreateTime(LocalDateTime.now());
             writ.setCreateUser(user.getUserId());
             writ.setLimitTime(LocalDateTime.parse(uploadDisposingResultParam.getLimitTime(), DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:ss")));
@@ -128,12 +188,13 @@
                             , uploadDisposingResultParam.getOtherPic()
                             , uploadDisposingResultParam.getRectifiedPic()
                             , uploadDisposingResultParam.getWritPic()));
-            iImageResourcesService.save(imageResources);
+            iImageResourcesService.updateById(imageResources);
         }
-        baseCaseService.update(new LambdaUpdateWrapper<BaseCase>().eq(BaseCase::getId, caseId).set(BaseCase::getState, BaseCaseStatus.DISPOSE));
+
+        baseCaseService.update(new LambdaUpdateWrapper<BaseCase>().eq(BaseCase::getId, uploadDisposingResultParam.getCaseId()).set(BaseCase::getState, BaseCaseStatus.DISPOSE));
         String stepName = StepName.CHECK.getName();
         DisposeRecord disposeRecord = new DisposeRecord();
-        disposeRecord.setBaseCaseId(caseId);
+        disposeRecord.setBaseCaseId(uploadDisposingResultParam.getCaseId());
         disposeRecord.setState(0);
         disposeRecord.setCreateTime(LocalDateTime.now());
         disposeRecord.setCreateUser(user.getUserId());

--
Gitblit v1.8.0