广州市综治平台后端
文锦钊
7 days ago 77f20090b25e6f168e3eccf4c47ea8dd695450a7
feature:对接纠纷办理反馈信息
2 files added
6 files modified
460 ■■■■■ changed files
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/vo/SaveEventFeedBackVo.java 74 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseFeedbackService.java 85 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/SysClient.java 11 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/impl/SysClientImpl.java 24 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/grid/controller/web/GridEventWebController.java 10 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/grid/domain/vo/SaveEventFeedBackVo.java 79 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/grid/service/GridEventService.java 175 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/resources/config/application.yml 2 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/vo/SaveEventFeedBackVo.java
New file
@@ -0,0 +1,74 @@
package cn.huge.module.cases.domain.vo;
import cn.huge.module.sys.dto.FileInfoBaseDTO;
import lombok.Data;
import java.util.List;
/**
 * @ClassName SaveEventFeedBackVo
 * @Description 同步办理反馈接口入参
 * @Author 文锦钊
 * @Date 2025/7/3 10:48
 **/
@Data
public class SaveEventFeedBackVo {
    /**
     * 反馈记录id,36位,建议用uuid (必填)
     */
    private String id;
    /**
     * 事件工单id (必填)
     */
    private String evtId;
    /**
     * 反馈用户部门名称 (必填)
     */
    private String appOrgName;
    /**
     * 反馈用户名称 (必填)
     */
    private String appUserName;
    /**
     * 反馈用户部门id (必填)
     */
    private String appOrgId;
    /**
     * 反馈用户id (必填)
     */
    private String appUserId;
    /**
     * 反馈时间,格式yyyy-MM-dd HH:mm:ss (必填)
     * 示例:2022-05-20 15:11:21
     */
    private String appTime;
    /**
     * 反馈意见 (必填)
     */
    private String approveContent;
    /**
     * 环节处理期限,格式yyyy-MM-dd HH:mm:ss (必填)
     * 示例:2022-05-20 15:11:21
     */
    private String processingTime;
    /**
     * 环节处理类型 (选填)
     */
    private String handleType;
    /**
     * 附件文件列表
     */
    private List<FileInfoBaseDTO> fileInfoList;
}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseFeedbackService.java
@@ -1,12 +1,15 @@
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.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 +17,18 @@
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.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 +38,7 @@
import javax.print.DocFlavor;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
@@ -73,6 +80,9 @@
    @Autowired
    private CaseMediatorService caseMediatorService;
    @Autowired
    private CaseInfoService caseInfoService;
    /**
     * 更新对象
@@ -165,10 +175,83 @@
            }
            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) {
        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 ;
        }
        //  使用单例设计的线程池来异步同步
        ThreadPoolUtils.submit(()->{
            log.info("异步保存办理反馈信息开始");
            //  保存办理反馈信息后需要同步到大平台中
            String evtId = 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(caseId);
            saveEventFeedBackVo.setEvtId(evtId);
            //  先传递当前子系统的用户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<FileInfoBaseDTO> fileInfoList = caseFeedback.getFileInfoList();
            saveEventFeedBackVo.setFileInfoList(fileInfoList);
            //  发起同步
            sysClient.saveEventFeedback(saveEventFeedBackVo);
            log.info("异步保存办理反馈信息成功!!");
            return null;
        });
    }
    /**
@@ -333,6 +416,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);
dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/SysClient.java
@@ -4,6 +4,7 @@
import cn.huge.base.common.bo.ReturnBO;
import cn.huge.module.cases.domain.dto.GridApprovalRecordDTO;
import cn.huge.module.cases.domain.vo.GenerateQrCodeRequestVo;
import cn.huge.module.cases.domain.vo.SaveEventFeedBackVo;
import cn.huge.module.sys.vo.*;
import cn.huge.module.sys.dto.*;
import cn.huge.module.cases.domain.dto.FileRelateDTO;
@@ -205,4 +206,14 @@
     */
    @GetMapping("/api/citizen/event/getCaseRefByGenerateQrCode")
    ReturnBO getCaseRefByGenerateQrCode(@RequestBody GenerateQrCodeRequestVo generateQrCodeRequestVo);
    /**
     * 获取大平台事项编号
     *
     * @param saveEventFeedBackVo
     * @return Object
     * @url {ctx}/api/web/gridEvent/saveEventFeedback
     */
    @PostMapping("/api/web/gridEvent/saveEventFeedback")
    ReturnBO saveEventFeedback(@RequestBody SaveEventFeedBackVo saveEventFeedBackVo);
}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/impl/SysClientImpl.java
@@ -10,6 +10,7 @@
import cn.huge.module.cases.domain.dto.GridApprovalRecordDTO;
import cn.huge.module.cases.domain.dto.GridEventDTO;
import cn.huge.module.cases.domain.vo.GenerateQrCodeRequestVo;
import cn.huge.module.cases.domain.vo.SaveEventFeedBackVo;
import cn.huge.module.sy.service.SyHolidayService;
import cn.huge.module.syncbydyh.domain.po.SyCause;
import cn.huge.module.sys.vo.*;
@@ -569,4 +570,27 @@
            throw new ServiceException("SysClientImpl.getCaseRefByGenerateQrCode", e);
        }
    }
    /**
     * 办理反馈信息
     *
     * @param vo           同步办理反馈信息的入参
     * @return
     * @url {ctx}/api/client/event/generateQrCode
     */
    public String saveEventFeedback(SaveEventFeedBackVo vo){
        try{
            ReturnBO returnBo = sysClient.saveEventFeedback(vo);
            if (ReturnConsts.OK == returnBo.getCode()){
                String id = (String) returnBo.getData();
                return id;
            }else{
                log.error("Client外服务接口[SysClientImpl.saveEventFeedback]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("SysClientImpl.saveEventFeedback", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[SysClientImpl.saveEventFeedback]请求成功,处理异常:"+e, e);
            throw new ServiceException("SysClientImpl.saveEventFeedback", e);
        }
    }
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/grid/controller/web/GridEventWebController.java
@@ -508,4 +508,14 @@
        }
        return ReturnSucUtils.getRepInfo();
    }
    /**
     * 同步办理反馈接口信息
     * @param saveEventFeedBackVo
     * @return
     */
    @PostMapping("/saveEventFeedback")
    public R<Object> saveEventFeedback(@RequestBody SaveEventFeedBackVo saveEventFeedBackVo) {
        return service.saveEventFeedback(saveEventFeedBackVo);
    }
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/grid/domain/vo/SaveEventFeedBackVo.java
New file
@@ -0,0 +1,79 @@
package cn.huge.module.grid.domain.vo;
import cn.huge.module.sys.dto.FileInfoBaseDTO;
import lombok.Data;
import java.util.List;
/**
 * @ClassName SaveEventFeedBackVo
 * @Description 同步办理反馈接口入参
 * @Author 文锦钊
 * @Date 2025/7/3 10:48
 **/
@Data
public class SaveEventFeedBackVo {
    /**
     * 反馈记录id,36位,建议用uuid (必填)
     */
    private String id;
    /**
     * 事件工单id (必填)
     */
    private String evtId;
    /**
     * 反馈用户部门名称 (必填)
     */
    private String appOrgName;
    /**
     * 反馈用户名称 (必填)
     */
    private String appUserName;
    /**
     * 反馈用户部门id (必填)
     */
    private String appOrgId;
    /**
     * 反馈用户id (必填)
     */
    private String appUserId;
    /**
     * 反馈时间,格式yyyy-MM-dd HH:mm:ss (必填)
     * 示例:2022-05-20 15:11:21
     */
    private String appTime;
    /**
     * 反馈意见 (必填)
     */
    private String approveContent;
    /**
     * 环节处理期限,格式yyyy-MM-dd HH:mm:ss (必填)
     * 示例:2022-05-20 15:11:21
     */
    private String processingTime;
    /**
     * 环节处理类型 (选填)
     */
    private String handleType;
    /**
     * 反馈附件列表 (选填)
     */
    private List<GridFileRelatedVo> feedbackAttrInfos;
    /**
     * 原子系统的反馈附件列表 (选填)
     */
    private List<FileInfoBaseDTO> fileInfoList;
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/grid/service/GridEventService.java
@@ -1,26 +1,36 @@
package cn.huge.module.grid.service;
import cn.huge.base.common.bo.R;
import cn.huge.base.common.exception.ServiceException;
import cn.huge.base.common.utils.DateUtils;
import cn.huge.base.common.utils.HttpClientUtils;
import cn.huge.base.common.utils.IdUtils;
import cn.huge.base.common.utils.ObjectUtils;
import cn.huge.module.client.api.impl.CustClientImpl;
import cn.huge.module.client.api.impl.UtilsClientImpl;
import cn.huge.module.cust.dto.CtUserDTO;
import cn.huge.module.grid.dao.mapper.GridEventMapper;
import cn.huge.module.grid.domain.dto.GridFileUploadDTO;
import cn.huge.module.grid.domain.dto.GridOrgDTO;
import cn.huge.module.grid.domain.po.GridEvent;
import cn.huge.module.grid.domain.vo.*;
import cn.huge.module.sys.dto.FileInfoBaseDTO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * @author wangwh
@@ -40,6 +50,39 @@
    @Autowired
    private UtilsClientImpl utilsClient;
    @Autowired
    private GridCaseTaskService gridCaseTaskService;
    @Autowired
    private GridCaseDataService gridCaseDataService;
    @Autowired
    private GridUserService gridUserService;
    @Autowired
    private CustClientImpl custClient;
    @Value("${grid.url:http://219.137.166.84:8061}")
    private String gridUrl;
    @Value("${grid.username:mtxt0011}")
    private String userName;
    @Value("${grid.password}")
    private String passWord;
    @Value("${grid.secret:BZb2hLCx05}")
    private String secret;
    @Value("${grid.passid:b08c0ec0-772d-caf8-5c9b-1f7d86295a95}")
    private String passid;
    public HashMap<String,String> initHeadVo() {
        long timestamp = System.currentTimeMillis()/1000;
        HashMap<String,String> headVo = new HashMap<>();
        headVo.put("x-rio-paasid",passid);
        headVo.put("x-rio-timestamp",timestamp+"");
        headVo.put("x-rio-nonce","mt");
        headVo.put("x-rio-signature", DigestUtils.sha256Hex(timestamp+secret+"mt"+timestamp));
        return headVo;
    }
    /**
     * 更新对象
@@ -141,4 +184,124 @@
    public GridEvent getEventByCaseId(String caseId) {
        return mapper.getEventByCaseId(caseId);
    }
    /**
     * 同步矛纠工单的办理反馈信息
     *
     * @param saveEventFeedBackVo
     * @return
     */
    public R<Object> saveEventFeedback(SaveEventFeedBackVo saveEventFeedBackVo) {
        HashMap<String,String> headVo=  initHeadVo();
        try{
            //  传递过来的是子平台的id,需要转换为大平台的id
            String appOrgId = saveEventFeedBackVo.getAppOrgId();
            String appGridUnitId = null;
            if (StringUtils.isNotBlank(appOrgId)) {
                appGridUnitId = gridCaseTaskService.getGridUnitIdByUnitId(saveEventFeedBackVo.getAppOrgId());
                saveEventFeedBackVo.setAppOrgId(appGridUnitId);
                if (StringUtils.isBlank(appGridUnitId)) {
                    throw new Exception("矛纠工单的办理反馈信息的组织不存在");
                }
            }
//        else {
//            saveEventFeedBackVo.setAppOrgId(gridEvent.getSysOrgId());
//            saveEventFeedBackVo.setAppOrgName(gridEvent.getSysOrgName());
//        }
            log.info("当前环节组织:" + saveEventFeedBackVo.getAppOrgId());
            if (StringUtils.isNotBlank(saveEventFeedBackVo.getAppUserId())) {
                CtUserDTO ctUserDTO = custClient.clientGetUserAll(saveEventFeedBackVo.getAppUserId());
                if (ObjectUtils.isNotEmpty(ctUserDTO)) {
                    if (StringUtils.isNotBlank(ctUserDTO.getIdcard())) {
                        GridUserIdNumberVo gridUserIdNumberVo = new GridUserIdNumberVo();
                        gridUserIdNumberVo.setIdNumber(ctUserDTO.getIdcard());
                        R<GridUserVo> result = gridUserService.getUserByIdNumber(gridUserIdNumberVo);
                        if (R.SUCCESS == result.getCode()) {
                            saveEventFeedBackVo.setAppUserId(result.getData().getId());
                            log.info("当前环节审批用户为: " + saveEventFeedBackVo.getAppUserId());
                        } else {
                            saveEventFeedBackVo.setAppUserId("a9406a88c8234cda82452799bf6bd6cd");
                            log.info("当前环节审批用户为特殊用户,身份证找不到用户{},{}", ctUserDTO.getIdcard(), ctUserDTO.getTrueName());
                        }
                    } else {
                        saveEventFeedBackVo.setAppUserId("a9406a88c8234cda82452799bf6bd6cd");
                        log.info("当前环节审批用户为特殊用户,找不到用户{}", saveEventFeedBackVo.getAppUserId());
                    }
                } else {
                    saveEventFeedBackVo.setAppUserId("a9406a88c8234cda82452799bf6bd6cd");
                    log.info("当前环节审批用户为特殊用户,找不到用户{}", saveEventFeedBackVo.getAppUserId());
                }
            } else {
                saveEventFeedBackVo.setAppUserId("a9406a88c8234cda82452799bf6bd6cd");
                log.info("矛纠工单的办理反馈信息的用户为特殊用户");
            }
            //  判断附件不为空
            List<FileInfoBaseDTO> fileInfoList = saveEventFeedBackVo.getFileInfoList();
            if (!CollectionUtils.isEmpty(fileInfoList)){
                List<GridFileRelatedVo> feedbackAttrInfos = new ArrayList<>();
                log.info("获取到矛纠工单的办理反馈信息的附件上传:" + fileInfoList.size());
                for (FileInfoBaseDTO fileInfoBaseDTO : fileInfoList) {
                    try {
                        GridFileUploadVo gridFileUploadVo = new GridFileUploadVo();
                        gridFileUploadVo.setFileName(fileInfoBaseDTO.getFileName());
                        gridFileUploadVo.setFilePath(fileInfoBaseDTO.getFullPath());
                        gridFileUploadVo.setFileSize(fileInfoBaseDTO.getSize() != null ? fileInfoBaseDTO.getSize().longValue() : 0L);
                        gridFileUploadVo.setType(fileInfoBaseDTO.getSuffix());
                        R<GridFileUploadDTO> result = null;
                        //上传附件信息
                        result = gridCaseDataService.uploadFileInfo(gridFileUploadVo);
                        if (R.SUCCESS == result.getCode()) {
                            //获取上传结果,组成新的附件对象
                            GridFileUploadDTO gridFileUploadDTO = result.getData();
                            GridFileRelatedVo gridFileRelatedVo = new GridFileRelatedVo();
                            gridFileRelatedVo.setFileName(gridFileUploadDTO.getFileName());
                            gridFileRelatedVo.setFilePath(gridFileUploadDTO.getFilePath());
                            gridFileRelatedVo.setOriginalFileName(gridFileUploadDTO.getOriginalFileName());
                            gridFileRelatedVo.setFileSize(gridFileUploadDTO.getFileSize());
                            gridFileRelatedVo.setType("add");
                            gridFileRelatedVo.setFileType(gridFileUploadDTO.getFileType());
                            feedbackAttrInfos.add(gridFileRelatedVo);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        log.info("附件上传失败:" + fileInfoBaseDTO.getId());
                    }
                }
                //  上传完成后设置原附件列表为空
                saveEventFeedBackVo.setFileInfoList(null);
            }
            //  发起请求
            log.info("办理反馈信息-xsd:{}", JSON.toJSONString(saveEventFeedBackVo));
            log.info("办理反馈信息-xsd:{}", gridUrl + "/standard/eventform/saveFeedback");
            String s = null;
            try {
                s = HttpClientUtils.httpPostRaw(gridUrl + "/standard/eventform/saveFeedback", JSON.toJSONString(saveEventFeedBackVo), headVo, "utf-8");
            } catch (Exception e) {
                log.info("xsderror:{}", e);
                throw new RuntimeException(e);
            }
            log.info("xsd:{}", s);
            //
            JSONObject object = JSONObject.parseObject(s);
            if (object.getInteger("code") != null && object.getInteger("code") == 0) {
                log.info("同步矛纠工单的办理反馈信息成功!");
                Object data = object.get("data");
                return R.ok(data);
            } else {
                log.info("同步矛纠工单的办理反馈信息失败,错误原因:" + object.getString("message"));
                return R.fail("同步矛纠工单的办理反馈信息失败");
            }
        }catch (Exception e){
            log.error("同步矛纠工单的办理反馈信息报错",e);
        }
        return R.fail("同步矛纠工单的办理反馈信息失败");
    }
}
dyh-service/dyh-sys/src/main/resources/config/application.yml
@@ -16,6 +16,8 @@
  main:
    #可以重复命名配置
    allow-bean-definition-overriding: true
    # 处理循环引用
    allow-circular-references: true
#server配置
server: