| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | import javax.print.DocFlavor; |
| | | import java.util.*; |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private CaseMediatorService caseMediatorService; |
| | | |
| | | @Autowired |
| | | private CaseInfoService caseInfoService; |
| | | |
| | | /** |
| | | * 更新对象 |
| | |
| | | } |
| | | 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; |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | 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); |