From 9d27d3439ea42d34a9cf9602f1a2c0b5e9bb75a2 Mon Sep 17 00:00:00 2001
From: wangwh <2397901735@qq.com>
Date: Mon, 23 Sep 2024 20:29:43 +0800
Subject: [PATCH] 全部签收接口优化、首页-统计数量添加返回字段、首页督办修复、查询案件督办信息接口添加字段

---
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseSuperviseService.java |   53 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseSuperviseService.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseSuperviseService.java
index 4e37cc7..2d305e2 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseSuperviseService.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseSuperviseService.java
@@ -3,8 +3,12 @@
 import cn.huge.base.common.exception.ServiceException;
 import cn.huge.base.common.utils.DateUtils;
 import cn.huge.base.common.utils.IdUtils;
+import cn.huge.base.common.utils.ObjectUtils;
 import cn.huge.module.cases.domain.dto.FileRelateDTO;
+import cn.huge.module.cases.domain.dto.FrontPageListDTO;
 import cn.huge.module.cases.domain.dto.QuiltUnitDTO;
+import cn.huge.module.cases.domain.po.CaseInfo;
+import cn.huge.module.cases.domain.po.CaseInfoUnfold;
 import cn.huge.module.client.api.impl.CustClientImpl;
 import cn.huge.module.client.api.impl.SysClientImpl;
 import cn.huge.module.client.api.impl.UtilsClientImpl;
@@ -19,6 +23,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -57,6 +62,9 @@
 
     @Autowired
     private SysClientImpl sysClient;
+
+    @Autowired
+    private CaseInfoService caseInfoService;
 
     /**
     * 条件更新对象
@@ -142,7 +150,7 @@
     public void addCaseSupervise(CaseSupervise caseSupervise, String userId){
         try{
             List<QuiltUnitDTO> quiltUnitDTOList = caseSupervise.getQuiltUnitDTOList();
-            Integer timeTerm = sysClient.getTimeLimit("dyh_case_supervise", SyTimeEnum.SY_TIME_5.getIndex());
+            Integer timeTerm = sysClient.getTimeLimitHour(SyTimeEnum.SY_TIME_5.getIndex());
             List<CaseSupervise> caseSuperviseList = new ArrayList<>();
             List<FileRelateDTO> fileRelateDTOList = sysClient.listFileRelateByOwnerId(caseSupervise.getId());
             int count = 0;
@@ -228,16 +236,33 @@
             }
             long countSuperviseList = mapper.countCaseSupervise(terms);
             List<CaseSupervise> caseSuperviseList = mapper.pageCaseSupervise(terms, page);
+            CaseInfo caseInfo = new CaseInfo();
+            if(CollectionUtils.isNotEmpty(caseSuperviseList)){
+                if(1 != type){
 
-            Map<String, Object>map = new HashMap<>();
-            map.put("mainId", caseId);
-            map.put("ownerIds", "'" + caseSuperviseList.stream().map(CaseSupervise::getId).collect(Collectors.joining("','"))+ "'");
-            map.put("types", "'"+ FileOwnerTypeBaseEnum.OWNER_TYPE_506.getIndex()+ "','" +FileOwnerTypeBaseEnum.OWNER_TYPE_507.getIndex()+"'");
-            List<FileIdTypeInfoBaseDTO> fileIdTypeInfoBaseDTOList = sysClient.listIdTypeInfoByOwnerIdList(map);
-            for(CaseSupervise caseSupervise: caseSuperviseList){
-                for(FileIdTypeInfoBaseDTO fileIdTypeInfoBaseDTO: fileIdTypeInfoBaseDTOList){
-                    if(caseSupervise.getId().equals(fileIdTypeInfoBaseDTO.getOwnerId())){
-                        caseSupervise.setFileInfoList(fileIdTypeInfoBaseDTO.getFileList());
+                    QueryWrapper<CaseInfo>caseInfoQueryWrapper = new QueryWrapper<>();
+                    caseInfoQueryWrapper.eq("id", caseId);
+                    caseInfo = caseInfoService.getOne(caseInfoQueryWrapper);
+                    for(CaseSupervise caseSupervise: caseSuperviseList){
+                        if(ObjectUtils.isNotEmpty(caseSupervise.getSupTime()) && ObjectUtils.isNotEmpty(caseSupervise.getReplyTerm())){
+                            caseSupervise.setTimeLimit(DateUtils.addDay(caseSupervise.getSupTime(), caseSupervise.getReplyTerm()));
+                        }
+                        if(ObjectUtils.isNotEmpty(caseInfo)){
+                            caseSupervise.setCaseGrade(caseInfo.getCaseLevel());
+                        }
+                    }
+                }else{
+                    Map<String, Object>map = new HashMap<>();
+                    map.put("mainId", caseId);
+                    map.put("ownerIds", "'" + caseSuperviseList.stream().map(CaseSupervise::getId).collect(Collectors.joining("','"))+ "'");
+                    map.put("types", "'"+ FileOwnerTypeBaseEnum.OWNER_TYPE_506.getIndex()+ "','" +FileOwnerTypeBaseEnum.OWNER_TYPE_507.getIndex()+"'");
+                    List<FileIdTypeInfoBaseDTO> fileIdTypeInfoBaseDTOList = sysClient.listIdTypeInfoByOwnerIdList(map);
+                    for(CaseSupervise caseSupervise: caseSuperviseList){
+                        for(FileIdTypeInfoBaseDTO fileIdTypeInfoBaseDTO: fileIdTypeInfoBaseDTOList){
+                            if(caseSupervise.getId().equals(fileIdTypeInfoBaseDTO.getOwnerId())){
+                                caseSupervise.setFileInfoList(fileIdTypeInfoBaseDTO.getFileList());
+                            }
+                        }
                     }
                 }
             }
@@ -253,11 +278,11 @@
      * @param page
      * @param terms
      */
-    public Page<CaseSupervise> pageMyTaskDb(PageRequest page, Map<String, Object> terms){
+    public Page<FrontPageListDTO> pageMyTaskDb(PageRequest page, Map<String, Object> terms){
         try{
             long countSuperviseList = mapper.countMyTaskDb(terms);
-            List<CaseSupervise> caseSuperviseList = mapper.pageMyTaskDb(page, terms);
-            return new PageImpl<CaseSupervise>(caseSuperviseList, page, countSuperviseList);
+            List<FrontPageListDTO> caseSuperviseList = mapper.pageMyTaskDb(page, terms);
+            return new PageImpl<FrontPageListDTO>(caseSuperviseList, page, countSuperviseList);
         }catch (Exception e){
             log.error("[CaseSuperviseService.pageReplied]调用失败,异常信息:"+e, e);
             throw new ServiceException("CaseSuperviseService.pageReplied", e);
@@ -283,7 +308,7 @@
         try {
             CaseSupervise caseSupervise = mapper.selectById(id);
             Map<String, Object> terms = new HashMap<>();
-            terms.put("mainId", "'" + caseSupervise.getCaseId() + "'");
+            terms.put("mainId", caseSupervise.getCaseId());
             terms.put("ownerIds", "'" + id + "'");
             List<FileIdTypeInfoBaseDTO> fileIdTypeInfoBaseDTOList = sysClient.listIdTypeInfoByOwnerIdList(terms);
             if(CollectionUtils.isNotEmpty(fileIdTypeInfoBaseDTOList)){

--
Gitblit v1.8.0