From 96fdf159f9128cfa3ecfd5cd32313302373e35e5 Mon Sep 17 00:00:00 2001
From: xusd <330628789@qq.com>
Date: Mon, 16 Jun 2025 17:43:41 +0800
Subject: [PATCH] fix:办理反馈优化

---
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseAssistApplyService.java |  167 +++++++++++++++++++++++++++++++++----------------------
 1 files changed, 99 insertions(+), 68 deletions(-)

diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseAssistApplyService.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseAssistApplyService.java
index b3dc29e..e6cfb7a 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseAssistApplyService.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseAssistApplyService.java
@@ -26,6 +26,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.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import lombok.extern.slf4j.Slf4j;
@@ -40,17 +41,17 @@
 import java.util.Map;
 
 /**
+ * @author wangwh
+ * @version 1.0.0
  * @title: 联合处置申请信息表业务逻辑处理
  * @Description 联合处置申请信息表业务逻辑处理
  * @company hugeinfo
- * @author wangwh
  * @Time 2024-09-05 17:25:04
- * @version 1.0.0
  */
 @Slf4j
 @Service
 @Transactional(rollbackFor = Exception.class)
-public class CaseAssistApplyService extends ServiceImpl<CaseAssistApplyMapper, CaseAssistApply>{
+public class CaseAssistApplyService extends ServiceImpl<CaseAssistApplyMapper, CaseAssistApply> {
 
     @Autowired
     private CaseAssistApplyMapper mapper;
@@ -75,101 +76,109 @@
     private SyHolidayService syHolidayService;
 
     /**
-    * 更新对象
-    * @param entity 对象
-    */
-    public void updateCaseAssistApply(CaseAssistApply entity){
-        try{
+     * 更新对象
+     *
+     * @param entity 对象
+     */
+    public void updateCaseAssistApply(CaseAssistApply entity) {
+        try {
             mapper.updateCaseAssistApply(entity);
-        }catch (Exception e){
-            log.error("[CaseAssistApplyService.updateCaseAssistApply]调用失败,异常信息:"+e, e);
+        } catch (Exception e) {
+            log.error("[CaseAssistApplyService.updateCaseAssistApply]调用失败,异常信息:" + e, e);
             throw new ServiceException("CaseAssistApplyService.updateCaseAssistApply", e);
         }
     }
 
     /**
-    * 条件更新对象
-    * @param entity 对象
-    * @param terms 条件
-    */
-    public void updateCaseAssistApplyTerms(CaseAssistApply entity, Map<String, Object> terms){
-        try{
+     * 条件更新对象
+     *
+     * @param entity 对象
+     * @param terms  条件
+     */
+    public void updateCaseAssistApplyTerms(CaseAssistApply entity, Map<String, Object> terms) {
+        try {
             mapper.updateCaseAssistApplyTerms(entity, terms);
-        }catch (Exception e){
-            log.error("[CaseAssistApplyService.updateCaseAssistApplyTerms]调用失败,异常信息:"+e, e);
+        } catch (Exception e) {
+            log.error("[CaseAssistApplyService.updateCaseAssistApplyTerms]调用失败,异常信息:" + e, e);
             throw new ServiceException("CaseAssistApplyService.updateCaseAssistApplyTerms", e);
         }
     }
 
     /**
-    * 根据编号物理删除
-    * @param id 查询条件集合
-    */
-    public void deleteCaseAssistApply(String id){
-        try{
+     * 根据编号物理删除
+     *
+     * @param id 查询条件集合
+     */
+    public void deleteCaseAssistApply(String id) {
+        try {
             mapper.deleteCaseAssistApply(id);
-        }catch (Exception e){
-            log.error("[CaseAssistApplyService.deleteCaseAssistApply]调用失败,异常信息:"+e, e);
+        } catch (Exception e) {
+            log.error("[CaseAssistApplyService.deleteCaseAssistApply]调用失败,异常信息:" + e, e);
             throw new ServiceException("CaseAssistApplyService.deleteCaseAssistApply", e);
         }
     }
 
     /**
-    * 按条件查询
-    * @param terms 条件
-    * @return List
-    */
-    public List<CaseAssistApply> listTerms(Map<String, Object> terms){
+     * 按条件查询
+     *
+     * @param terms 条件
+     * @return List
+     */
+    public List<CaseAssistApply> listTerms(Map<String, Object> terms) {
         return mapper.listTerms(terms);
     }
 
     /**
-    * 按条件统计
-    * @param terms 条件
-    * @return long
-    */
-    public long countTerms(Map<String, Object> terms){
+     * 按条件统计
+     *
+     * @param terms 条件
+     * @return long
+     */
+    public long countTerms(Map<String, Object> terms) {
         return mapper.countTerms(terms);
     }
 
     /**
-    * 按条件分页查询
-    * @param page 分页对象
-    * @param terms 条件
-    * @return Page
-    */
-    public Page<CaseAssistApply> pageQuery(PageRequest page, Map<String, Object> terms){
+     * 按条件分页查询
+     *
+     * @param page  分页对象
+     * @param terms 条件
+     * @return Page
+     */
+    public Page<CaseAssistApply> pageQuery(PageRequest page, Map<String, Object> terms) {
         long total = mapper.countTerms(terms);
         List<CaseAssistApply> content = mapper.pageTerms(page, terms);
         return new PageImpl<CaseAssistApply>(content, page, total);
     }
 
     /**
-    * 新增或更新对象
-    * @param caseAssistApply 实体对象
-    */
-    public void saveCaseAssistApply(CaseAssistApply caseAssistApply){
-        try{
+     * 新增或更新对象
+     *
+     * @param caseAssistApply 实体对象
+     */
+    public void saveCaseAssistApply(CaseAssistApply caseAssistApply) {
+        try {
             Date nowDate = DateUtils.getNowDate();
             // 判断是否新增
-            if (IdUtils.checkNewId(caseAssistApply.getId())){
+            if (IdUtils.checkNewId(caseAssistApply.getId())) {
                 caseAssistApply.setId(utilsClient.getNewTimeId());
                 caseAssistApply.setCreateTime(nowDate);
             }
             caseAssistApply.setUpdateTime(nowDate);
             this.saveOrUpdate(caseAssistApply);
-        }catch (Exception e){
-            log.error("[CaseAssistApplyService.saveCaseAssistApply]调用失败,异常信息:"+e, e);
+        } catch (Exception e) {
+            log.error("[CaseAssistApplyService.saveCaseAssistApply]调用失败,异常信息:" + e, e);
             throw new ServiceException("CaseAssistApplyService.saveCaseAssistApply", e);
         }
     }
 
     /**
      * 添加联合处置申请
+     *
      * @param caseAssistApply 实体对象
      */
-    public void addCaseAssistApply(CaseAssistApply caseAssistApply, String userId){
-        try{
+    public void addCaseAssistApply(CaseAssistApply caseAssistApply, String userId) {
+        try {
             // 获取当前登录用户
             CtUserDTO loginUser = custClient.clientGetUserAll(userId);
             Date now = DateUtils.getNowDate();
@@ -183,8 +192,25 @@
             caseAssistApply.setApplyTime(now);
             caseAssistApply.setCreateTime(now);
             caseAssistApply.setUpdateTime(now);
+            //如果申请联合处置的机构是区级机构,由区综治中心审核
+            boolean isQu = false;
+            String quUnitId = "";
+            if (StringUtils.isNotEmpty(caseAssistApply.getApplyAssistUnitId())) {
+                String[] unitIdList = caseAssistApply.getApplyAssistUnitId().split(BaseConsts.COMMA);
+                for (String unitId : unitIdList) {
+                    CtUnitDTO unitById = custClient.getUnitById(unitId);
+                    if (unitById.getUnitGrade() == 2) {
+                        isQu = true;
+                        quUnitId = unitById.getId();
+                        break;
+                    }
+                }
+            }
             // 上级综治中心审核
             CtUnitDTO ctUnitDTO = custClient.getParentZzzxUnit(loginUser.getUnitId());
+            if (isQu) {
+                ctUnitDTO=custClient.getParentZzzxUnit(quUnitId);
+            }
             caseAssistApply.setAuditUnitId(ctUnitDTO.getId());
             caseAssistApply.setAuditUnitName(ctUnitDTO.getUnitName());
             mapper.insert(caseAssistApply);
@@ -194,18 +220,19 @@
             caseTask.setCandeUnitId(caseAssistApply.getAuditUnitId());
             caseTask.setExpireTime(sysClient.getExpireTime(caseAssistApply.getApplyTime(), SyTimeEnum.SY_TIME_2.getIndex()));
             caseTaskService.createGridToDo(caseInfo, caseTask, GridEnum.GRID_OBJECT_TYPE_4.getIndex(), GridBaseConsts.GRID_TYPE_4);
-        }catch (Exception e){
-            log.error("[CaseAssistApplyService.addCaseAssistApply]调用失败,异常信息:"+e, e);
+        } catch (Exception e) {
+            log.error("[CaseAssistApplyService.addCaseAssistApply]调用失败,异常信息:" + e, e);
             throw new ServiceException("CaseAssistApplyService.addCaseAssistApply", e);
         }
     }
 
     /**
      * 审核联合处置审核
+     *
      * @param caseAssistApply 实体对象
      */
-    public void reviewCaseAssistApply(CaseAssistApply caseAssistApply, String userId){
-        try{
+    public void reviewCaseAssistApply(CaseAssistApply caseAssistApply, String userId) {
+        try {
             // 获取当前登录用户
             CtUserDTO loginUser = custClient.clientGetUserAll(userId);
             Date now = DateUtils.getNowDate();
@@ -223,7 +250,7 @@
             if (AuditBaseConstsEnum.AUDIT_RESULT_1.getIndex().equals(caseAssistApplyPO.getAuditResult())) {
                 String[] unitIdList = caseAssistApplyPO.getApplyAssistUnitId().split(BaseConsts.COMMA);
                 String[] unitNameList = caseAssistApplyPO.getApplyAssistUnitName().split(BaseConsts.COMMA);
-                for (int i=0; i<unitIdList.length; i++){
+                for (int i = 0; i < unitIdList.length; i++) {
                     String unitId = unitIdList[i];
                     String unitName = unitNameList[i];
                     // 启动联合处置工作流
@@ -255,7 +282,7 @@
                     dfpCaseTask.setHandleUserName(loginUser.getTrueName());
                     dfpCaseTask.setHandleResult(CaseTaskConsts.HANDLE_RESULT_1);
                     dfpCaseTask.setHandleContent(caseAssistApplyPO.getAuditContent());
-                    dfpCaseTask.setHandleIllust("交办至:"+caseAssistApplyPO.getApplyAssistUnitName());
+                    dfpCaseTask.setHandleIllust("交办至:" + caseAssistApplyPO.getApplyAssistUnitName());
                     // 任务处理时限
                     if (dfpFlowNode.getExpire() != 0) {
                         dfpCaseTask.setExpireTime(syHolidayService.getExpiryDay(now, dfpFlowNode.getExpire()));
@@ -319,29 +346,30 @@
                 caseInfoUnfoldPO.setAssistUnitId(caseAssistApplyPO.getApplyAssistUnitId());
                 caseInfoUnfoldPO.setAssistUnitName(caseAssistApplyPO.getApplyAssistUnitName());
                 caseInfoUnfoldService.updateCaseInfoUnfold(caseInfoUnfoldPO);
-            }else{
+            } else {
                 CaseTask caseTask = new CaseTask();
                 caseTask.setCaseId(caseAssistApplyPO.getCaseId());
                 caseTask.setId(caseAssistApplyPO.getCaseId());
                 caseTaskService.deleteGridTodo(caseTask);
             }
-        }catch (Exception e){
-            log.error("[CaseAssistApplyService.reviewCaseAssistApply]调用失败,异常信息:"+e, e);
+        } catch (Exception e) {
+            log.error("[CaseAssistApplyService.reviewCaseAssistApply]调用失败,异常信息:" + e, e);
             throw new ServiceException("CaseAssistApplyService.reviewCaseAssistApply", e);
         }
     }
 
     /**
      * 根据案件编号查询联合处置申请
+     *
      * @param id 主键编号
      * @return long
      */
-    public CaseAssistApply caseAssistApplyById(String id){
+    public CaseAssistApply caseAssistApplyById(String id) {
         try {
             QueryWrapper<CaseAssistApply> caseAssistApplyQueryWrapper = new QueryWrapper<>();
             caseAssistApplyQueryWrapper.eq("id", id);
             CaseAssistApply caseAssistApply = mapper.selectOne(caseAssistApplyQueryWrapper);
-            if(ObjectUtils.isNotEmpty(caseAssistApply)){
+            if (ObjectUtils.isNotEmpty(caseAssistApply)) {
                 Map<String, Object> terms = new HashMap<>();
                 terms.put("mainId", caseAssistApply.getCaseId());
                 terms.put("ownerIds", "'" + caseAssistApply.getId() + "'");
@@ -351,37 +379,40 @@
                 }
             }
             return caseAssistApply;
-        }catch(Exception e ){
-            log.error("[CaseAssistApplyService.caseAssistApplyById]调用失败,异常信息:"+e, e);
+        } catch (Exception e) {
+            log.error("[CaseAssistApplyService.caseAssistApplyById]调用失败,异常信息:" + e, e);
             throw new ServiceException("CaseAssistApplyService.caseAssistApplyById", e);
         }
     }
 
     /**
      * 首页查询
+     *
      * @param auditUnitId 审核组织编号
      * @return long
      */
-    public long countAssistReview(String auditUnitId){
+    public long countAssistReview(String auditUnitId) {
         return mapper.countAssistReview(auditUnitId);
     }
 
     /**
      * 首页-待审核条件统计
+     *
      * @param terms 条件
      * @return long
      */
-    public long countMyTaskAssistReview(Map<String, Object> terms){
+    public long countMyTaskAssistReview(Map<String, Object> terms) {
         return mapper.countMyTaskAssistReview(terms);
     }
 
     /**
      * 按条件查询
-     * @param page 分页对象
+     *
+     * @param page  分页对象
      * @param terms 条件
      * @return List
      */
-    public List<FrontPageListDTO> pageMyTaskAssistReview(PageRequest page, Map<String, Object> terms){
+    public List<FrontPageListDTO> pageMyTaskAssistReview(PageRequest page, Map<String, Object> terms) {
         return mapper.pageMyTaskAssistReview(page, terms);
     }
 

--
Gitblit v1.8.0