From e9de6064cc94d6bc63685c5e62046ff810b96dab Mon Sep 17 00:00:00 2001
From: xusd <330628789@qq.com>
Date: Sat, 05 Jul 2025 17:17:52 +0800
Subject: [PATCH] Merge branch 'gzdyh_prod'

---
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseFeedbackService.java |  101 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 101 insertions(+), 0 deletions(-)

diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseFeedbackService.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseFeedbackService.java
index 2d32d8e..9388a67 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseFeedbackService.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseFeedbackService.java
@@ -1,12 +1,16 @@
 package cn.huge.module.cases.service;
+import java.util.ArrayList;
 
 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.base.common.utils.ThreadPoolUtils;
 import cn.huge.module.cases.consts.CaseTaskConsts;
+import cn.huge.module.cases.domain.dto.FileRelateDTO;
 import cn.huge.module.cases.domain.dto.MediatorDTO;
 import cn.huge.module.cases.domain.po.*;
+import cn.huge.module.cases.domain.vo.SaveEventFeedBackVo;
 import cn.huge.module.client.api.impl.CustClientImpl;
 import cn.huge.module.client.api.impl.SysClientImpl;
 import cn.huge.module.client.api.impl.UtilsClientImpl;
@@ -14,15 +18,19 @@
 import cn.huge.module.cust.dto.CtUnitDTO;
 import cn.huge.module.cust.dto.CtUserDTO;
 import cn.huge.module.mediate.constant.CaseBaseConsts;
+import cn.huge.module.mediate.constant.CaseBaseConstsEnum;
+import cn.huge.module.sys.constant.FileOwnerTypeBaseEnum;
 import cn.huge.module.sys.dto.FileIdInfoBaseDTO;
 import cn.huge.module.sys.dto.FileInfoBaseDTO;
 import cn.huge.module.sys.dto.FileTypeInfoBaseDTO;
+import cn.huge.module.utils.TimeUtils;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Maps;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.data.domain.Page;
@@ -32,6 +40,8 @@
 
 import javax.print.DocFlavor;
 import java.util.*;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 
 /**
@@ -73,6 +83,10 @@
 
     @Autowired
     private CaseMediatorService caseMediatorService;
+
+    @Autowired
+    private CaseInfoService caseInfoService;
+
 
     /**
      * 更新对象
@@ -165,10 +179,95 @@
             }
             caseFeedback.setUpdateTime(nowDate);
             this.saveOrUpdate(caseFeedback);
+
+            //  异步同步纠纷办理反馈信息
+            asyncSaveEventFeedback(caseFeedback, userId);
+
         } catch (Exception e) {
             log.error("[caseFeedbackService.savecaseFeedback]调用失败,异常信息:" + e, e);
             throw new ServiceException("caseFeedbackService.savecaseFeedback", e);
         }
+    }
+
+    /**
+     * 异步保存办理反馈信息
+     *
+     * @param caseFeedback
+     * @param userId
+     */
+    private void asyncSaveEventFeedback(CaseFeedback caseFeedback, String userId) {
+        log.info("同步办理反馈信息开始!!");
+        String caseId = caseFeedback.getCaseId();
+        CaseInfo caseInfo = caseInfoService.getById(caseId);
+        String canalSecond = caseInfo.getCanalSecond();
+
+        //  需要同步的渠道类型
+        List<String> needSyncTypeList = new ArrayList<>();
+        needSyncTypeList.add(CaseBaseConstsEnum.CASE_CANAL_SECOND_1.getIndex());
+        needSyncTypeList.add(CaseBaseConstsEnum.CASE_CANAL_SECOND_2.getIndex());
+        needSyncTypeList.add(CaseBaseConstsEnum.CASE_CANAL_SECOND_7.getIndex());
+
+        if (!needSyncTypeList.contains(canalSecond)) {
+            log.info("当前来源的事项不需要同步,来源为:" + CaseBaseConstsEnum.getDes(canalSecond));
+            return ;
+        }
+
+        //  使用completableFuture进行异步处理,使用jdk8的forkjoinPool线程池
+        CompletableFuture<Object> future = CompletableFuture.supplyAsync(() -> {
+            log.info("异步保存办理反馈信息开始");
+            //  保存办理反馈信息后需要同步到大平台中
+            String code = caseInfo.getCaseRef();
+
+            //  反馈用户信息
+            CtUserDTO ctUserDTO = custClient.clientGetUser(userId);
+            CtUnitDTO ctUnitDTO = custClient.getUnitById(ctUserDTO.getUnitId());
+
+            //  反馈意见内容
+            String handleContent = caseFeedback.getHandleContent();
+
+            //  反馈时间
+            Date now = new Date();
+            String appTime = TimeUtils.format(now,TimeUtils.STANDARD_PATTERN);
+            String processingTime = TimeUtils.format(TimeUtils.after(now,14),TimeUtils.STANDARD_PATTERN);
+
+            //  构建参数
+            SaveEventFeedBackVo saveEventFeedBackVo = new SaveEventFeedBackVo();
+            saveEventFeedBackVo.setId(caseFeedback.getId());
+            saveEventFeedBackVo.setCode(code);
+
+            //  先传递当前子系统的用户id
+            saveEventFeedBackVo.setAppUserId(userId);
+            saveEventFeedBackVo.setAppUserName(ctUserDTO.getTrueName());
+            saveEventFeedBackVo.setAppOrgId(ctUnitDTO.getId());
+            saveEventFeedBackVo.setAppOrgName(ctUnitDTO.getUnitName());
+
+            saveEventFeedBackVo.setAppTime(appTime);
+            saveEventFeedBackVo.setApproveContent(handleContent);
+            saveEventFeedBackVo.setProcessingTime(processingTime);
+            saveEventFeedBackVo.setHandleType("");
+
+            //  附件信息
+            //  先获取文件关联表信息
+            List<FileRelateDTO> fileRelateDTOS = sysClient.listFileRelateByOwnerId(caseFeedback.getId());
+            List<FileInfoBaseDTO> fileInfoBaseDTOS = new ArrayList<>();
+            if (CollectionUtils.isNotEmpty(fileRelateDTOS)){
+                fileInfoBaseDTOS = fileRelateDTOS.stream()
+                        .map(o->{
+                            FileInfoBaseDTO fileInfoBaseDTO = new FileInfoBaseDTO();
+                            fileInfoBaseDTO.setId(o.getFileId());
+                            return fileInfoBaseDTO;
+                        }).collect(Collectors.toList());
+            }
+
+            saveEventFeedBackVo.setFileInfoList(fileInfoBaseDTOS);
+
+            //  发起同步
+            sysClient.saveEventFeedback(saveEventFeedBackVo);
+            log.info("异步保存办理反馈信息成功!!");
+            return null;
+        });
+
+
     }
 
     /**
@@ -333,6 +432,8 @@
                 caseFeedback.setHandleType(CaseTaskConsts.HANDLE_TYPE_2);
             }
             this.save(caseFeedback);
+            //  异步同步纠纷办理反馈信息
+            asyncSaveEventFeedback(caseFeedback, userId);
         } catch (Exception e) {
             log.error("[caseFeedbackService.savecaseFeedback]调用失败,异常信息:" + e, e);
             throw new ServiceException("caseFeedbackService.savecaseFeedback", e);

--
Gitblit v1.8.0