From c9529bd19a8d61666b71824dd751682c1e9dc288 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期一, 15 八月 2022 10:39:31 +0800
Subject: [PATCH] Merge branches 'genchuang' and 'master' of https://sinanoaq.cn:8888/r/safePlatform-out into master

---
 incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java
index 66e1a45..c1e1c20 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java
@@ -4,6 +4,7 @@
 import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService;
 import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService;
 import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepInfoRPCRespDTO;
+import com.gkhy.safePlatform.commons.co.ContextCacheUser;
 import com.gkhy.safePlatform.commons.enums.ResultCodes;
 import com.gkhy.safePlatform.commons.query.PageQuery;
 import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
@@ -94,23 +95,29 @@
     }
 
     @Override
-    public ResultVO addAccidentExpress(Long uid, AccidentExpressReqDTO accidentExpressReqDTO) {
+    public ResultVO<AccidentExpressDetailRespDTO> addAccidentExpress(ContextCacheUser contextCacheUser, AccidentExpressReqDTO accidentExpressReqDTO) {
+        Long uid = contextCacheUser.getUid();
+        String uName = contextCacheUser.getRealName();
         //必填项验证
         checkRequired(accidentExpressReqDTO);
 
         Date nowDate = new Date();
-        //1.新增应急队伍
+        //1.新增事故快报
         AccidentExpressInfo accidentExpressInfo = new AccidentExpressInfo();
         BeanUtils.copyProperties(accidentExpressReqDTO, accidentExpressInfo);
         accidentExpressInfo.setDelFlag(false);
         accidentExpressInfo.setCreateUid(uid);
+        accidentExpressInfo.setCreateName(uName);
         accidentExpressInfo.setGmtCreate(nowDate);
         accidentExpressInfoService.addAccidentExpress(accidentExpressInfo);
-        //2.新增应急队伍附件
+        //2.新增事故快报附件
         if (!CollectionUtils.isEmpty(accidentExpressReqDTO.getFileList())){
             addAccidentExpressFile(accidentExpressInfo.getId(),uid,nowDate,accidentExpressReqDTO.getFileList());
         }
-        return new ResultVO(ResultCodes.OK);
+
+        AccidentExpressDetailRespDTO accidentExpressDetailRespDTO = new AccidentExpressDetailRespDTO();
+        BeanUtils.copyProperties(accidentExpressInfo,accidentExpressDetailRespDTO);
+        return new ResultVO<>(ResultCodes.OK,accidentExpressDetailRespDTO);
     }
 
     private void  addAccidentExpressFile(Long accidentExpressId ,Long uid , Date nowDate , List<AccidentExpressFileReqDTO> AccidentExpressFileReqDTOList){
@@ -158,7 +165,7 @@
             accidentExpressInfo.setUpdateUid(uid);
             accidentExpressInfo.setGmtModitify(nowDate);
             accidentExpressInfoService.updateAccidentExpress(accidentExpressInfo);
-            //修改应急队伍附件
+            //修改事故快报附件
             updateAccidentExpressFile(uid,accidentExpressReqDTO.getId(),nowDate,accidentExpressReqDTO.getFileList());
             return new ResultVO(ResultCodes.OK);
         }
@@ -207,13 +214,12 @@
 
 
     @Override
-    public ResultVO batchDeleteAccidentExpress(String ids) {
-        if (StringUtils.isBlank(ids)){
+    public ResultVO batchDeleteAccidentExpress(Long[] ids) {
+        if (ids == null ||  ids.length==0){
             throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NULL);
         }else{
-            String[] idArr = ids.split(",");
-            for (String id : idArr) {
-                deleteAccidentExpress(Long.valueOf(id));
+            for (Long id : ids){
+                deleteAccidentExpress(id);
             }
             return new ResultVO(ResultCodes.OK);
         }
@@ -228,6 +234,8 @@
             accidentExpressInfoService.deleteAccidentExpressById(id);
             //删除附件
             accidentExpressFileInfoService.deleteAccidentExpressFileByAccidentExpressId(id);
+            //删除伤亡
+            accidentExpressCasualtyInfoService.deleteAccidentExpressCasualtyByAccidentExpressId(id);
         }
     }
 

--
Gitblit v1.9.2