| | |
| | | package cn.huge.module.syncbydyh.service; |
| | | |
| | | import cn.huge.base.common.exception.ServiceException; |
| | | import cn.huge.module.cases.domain.po.CaseAgent; |
| | | import cn.huge.module.cases.domain.po.CaseInfo; |
| | | import cn.huge.module.cases.domain.po.CasePerson; |
| | | import cn.huge.module.cases.domain.po.CaseTask; |
| | | import cn.huge.base.common.utils.ObjectUtils; |
| | | import cn.huge.module.cases.domain.dto.AcceptTaskDTO; |
| | | import cn.huge.module.cases.domain.po.*; |
| | | import cn.huge.module.cases.service.*; |
| | | import cn.huge.module.client.api.impl.CustClientImpl; |
| | | import cn.huge.module.cust.constant.UserBaseConsts; |
| | | import cn.huge.module.cust.dto.CtUnitDTO; |
| | | import cn.huge.module.cust.dto.CtUserDTO; |
| | | import cn.huge.module.disp.dto.DispCaseBaseDTO; |
| | | import cn.huge.module.syncbydyh.client.api.impl.SyncBydyhClientImpl; |
| | | import cn.huge.module.syncbydyh.domain.dto.ByCaseTaskDTO; |
| | | import cn.huge.module.syncbydyh.domain.dto.GZCaseDTO; |
| | | import cn.huge.module.syncbydyh.domain.po.SyCause; |
| | | import cn.huge.module.syncbydyh.domain.po.ThirdCause; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @title: 白云数据割接为广州数据的业务逻辑处理 |
| | | * @Description 白云数据割接为广州数据的业务逻辑处理 |
| | | * @title: 白云区矛盾纠纷多元化解平台数据割接-公共逻辑处理 |
| | | * @Description 白云区矛盾纠纷多元化解平台数据割接-公共逻辑处理 |
| | | * @company hugeinfo |
| | | * @author liyj |
| | | * @Time 2024-08-19 20:04:19 |
| | |
| | | private CaseAgentService caseAgentService; |
| | | @Autowired |
| | | private CaseTaskService caseTaskService; |
| | | @Autowired |
| | | private ThirdCauseService thirdCauseService; |
| | | @Autowired |
| | | private SyCauseService syCauseService; |
| | | @Autowired |
| | | private CustClientImpl custClient; |
| | | @Autowired |
| | | private ByToGzCaseTaskService byToGzCaseTaskService; |
| | | |
| | | /** |
| | | * 白云区矛盾纠纷多元化解平台数据割接-已结束的纠纷案件信息 |
| | | */ |
| | | public void byToGzEndCase(){ |
| | | try{ |
| | | List<CaseInfo> errorCaseList = new ArrayList<>(); |
| | | int operSize = 100; |
| | | // int endCaseCount = 1000; |
| | | int endCaseCount = syncBydyhClient.countEndCase(); |
| | | if (endCaseCount > 0) { |
| | | int allPage = (endCaseCount/operSize); |
| | | // int allPage = 1; |
| | | // int allPage = (endCaseCount/operSize); |
| | | int allPage = 20; |
| | | for (int operPage=1; operPage<=allPage; operPage++) { |
| | | try{ |
| | | List<GZCaseDTO> byToGzDTOList = syncBydyhClient.byToGzEndCase(operPage, operSize); |
| | | for (GZCaseDTO byToGzDTO: byToGzDTOList){ |
| | | caseInfoService.saveOrUpdate(byToGzDTO.getGzCaseInfoDTO()); |
| | | |
| | | List<GZCaseDTO> byToGzDTOList = syncBydyhClient.byToGzEndCase(operPage, operSize); |
| | | for (GZCaseDTO byToGzDTO: byToGzDTOList){ |
| | | // 新增案件信息 |
| | | CaseInfo caseInfo = byToGzDTO.getGzCaseInfoDTO(); |
| | | try { |
| | | if (caseInfo.getCaseClaim().length() > 200) { |
| | | caseInfo.setCaseClaim("详见申请材料"); |
| | | } |
| | | if (caseInfo.getCaseDes().length() > 200) { |
| | | caseInfo.setCaseDes("详见申请材料"); |
| | | } |
| | | caseInfoService.saveOrUpdate(caseInfo); |
| | | // 新增案件扩展信息 |
| | | caseInfoUnfoldService.saveOrUpdate(byToGzDTO.getGzCaseInfoUnfoldDTO()); |
| | | |
| | | // 新增当事人信息 |
| | | List<CasePerson> casePersonList = byToGzDTO.getGzCasePersonDTOList(); |
| | | if (CollectionUtils.isNotEmpty(casePersonList)) { |
| | | for (CasePerson casePerson : casePersonList) { |
| | | casePersonService.saveOrUpdate(casePerson); |
| | | } |
| | | } |
| | | |
| | | // 新增当事人代理人信息 |
| | | List<CaseAgent> caseAgentList = byToGzDTO.getGzCaseAgentDTOList(); |
| | | if (CollectionUtils.isNotEmpty(caseAgentList)) { |
| | | for (CaseAgent caseAgent : caseAgentList) { |
| | | caseAgentService.saveOrUpdate(caseAgent); |
| | | } |
| | | } |
| | | |
| | | // 新增纠纷任务信息 |
| | | List<CaseTask> caseTaskList = byToGzDTO.getGzCaseTaskDTOList(); |
| | | if (CollectionUtils.isNotEmpty(caseTaskList)) { |
| | | for (CaseTask caseTask : caseTaskList) { |
| | | caseTaskService.saveOrUpdate(caseTask); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("[ByToGzService.byToGzEndCase]调用失败,异常信息:"+e, e); |
| | | errorCaseList.add(byToGzDTO.getGzCaseInfoDTO()); |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("[ByToGzService.byToGzEndCase]调用失败,异常信息:"+e, e); |
| | | } |
| | | } |
| | | } |
| | |
| | | throw new ServiceException("ByToGzService.byToGzEndCase", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 白云区矛盾纠纷多元化解平台数据割接-进行中的纠纷案件信息 |
| | | */ |
| | | public void byToGzTodoCase(){ |
| | | try{ |
| | | int operSize = 100; |
| | | int endCaseCount = syncBydyhClient.countTodoCase(); |
| | | if (endCaseCount > 0) { |
| | | int allPage = (endCaseCount/operSize); |
| | | for (int operPage=1; operPage<=allPage; operPage++) { |
| | | List<GZCaseDTO> byToGzDTOList = syncBydyhClient.byToGzTodoCase(operPage, operSize); |
| | | for (GZCaseDTO byToGzDTO: byToGzDTOList){ |
| | | try { |
| | | // 新增案件信息 |
| | | CaseInfo caseInfo = byToGzDTO.getGzCaseInfoDTO(); |
| | | if (caseInfo.getCaseClaim().length() > 200) { |
| | | caseInfo.setCaseClaim("详见申请材料"); |
| | | } |
| | | if (caseInfo.getCaseDes().length() > 200) { |
| | | caseInfo.setCaseDes("详见申请材料"); |
| | | } |
| | | caseInfoService.saveOrUpdate(caseInfo); |
| | | // 新增案件扩展信息 |
| | | CaseInfoUnfold caseInfoUnfold = byToGzDTO.getGzCaseInfoUnfoldDTO(); |
| | | caseInfoUnfoldService.saveOrUpdate(caseInfoUnfold); |
| | | // 新增当事人信息 |
| | | List<CasePerson> casePersonList = byToGzDTO.getGzCasePersonDTOList(); |
| | | if (CollectionUtils.isNotEmpty(casePersonList)) { |
| | | for (CasePerson casePerson : casePersonList) { |
| | | casePersonService.saveOrUpdate(casePerson); |
| | | } |
| | | } |
| | | // 新增当事人代理人信息 |
| | | List<CaseAgent> caseAgentList = byToGzDTO.getGzCaseAgentDTOList(); |
| | | if (CollectionUtils.isNotEmpty(caseAgentList)) { |
| | | for (CaseAgent caseAgent : caseAgentList) { |
| | | caseAgentService.saveOrUpdate(caseAgent); |
| | | } |
| | | } |
| | | // 启动流程 |
| | | caseTaskService.deleteByCaseId(caseInfo.getId()); |
| | | if (StringUtils.isNotEmpty(caseInfoUnfold.getMediateUnitId()) |
| | | && StringUtils.isNotEmpty(caseInfo.getWantUnitId()) |
| | | && caseInfo.getWantUnitId().equals(caseInfoUnfold.getMediateUnitId())) { |
| | | CtUserDTO ctUserDTO = custClient.clientGetUserAll(caseInfo.getInputUserId()); |
| | | byToGzCaseTaskService.webStartFlowZXSL(caseInfo, ctUserDTO); |
| | | } else { |
| | | DispCaseBaseDTO dispCaseBaseDTO = new DispCaseBaseDTO(); |
| | | BeanUtils.copyProperties(caseInfo, dispCaseBaseDTO); |
| | | dispCaseBaseDTO.setWantUserId(null); |
| | | dispCaseBaseDTO.setWantUserName(null); |
| | | if (StringUtils.isNotEmpty(caseInfoUnfold.getMediateUnitId())) { |
| | | dispCaseBaseDTO.setWantUnitId(caseInfoUnfold.getMediateUnitId()); |
| | | dispCaseBaseDTO.setWantUnitName(caseInfoUnfold.getMediateUnitName()); |
| | | String dslCaseTaskId = byToGzCaseTaskService.webStartFlowLFDJ(caseInfo, dispCaseBaseDTO); |
| | | |
| | | List<ByCaseTaskDTO> byCaseTaskDTOList = byToGzDTO.getByCaseTaskDTOList(); |
| | | if (CollectionUtils.isNotEmpty(byCaseTaskDTOList)) { |
| | | for (ByCaseTaskDTO byCaseTaskDTO : byCaseTaskDTOList) { |
| | | if ("F22_00019-2".equals(byCaseTaskDTO.getTaskNode())) { |
| | | AcceptTaskDTO acceptTaskDTO = new AcceptTaskDTO(); |
| | | acceptTaskDTO.setCaseTaskId(dslCaseTaskId); |
| | | try { |
| | | byToGzCaseTaskService.webAccept(acceptTaskDTO, byCaseTaskDTO.getHandlerUserId(), byCaseTaskDTO.getCreateTime()); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | byToGzCaseTaskService.webStartFlowLFDJ(caseInfo, dispCaseBaseDTO); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("[ByToGzService.byToGzEndCase]调用失败,异常信息:"+e, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("[ByToGzService.byToGzEndCase]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("ByToGzService.byToGzEndCase", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 白云区矛盾纠纷多元化解平台数据割接-更新纠纷类型 |
| | | */ |
| | | public void upThirdCause(){ |
| | | try{ |
| | | List<CaseInfo> caseInfoList = caseInfoService.list(); |
| | | QueryWrapper<ThirdCause> thirdCauseQueryWrapper = new QueryWrapper<>(); |
| | | for (CaseInfo caseInfo: caseInfoList){ |
| | | thirdCauseQueryWrapper.clear(); |
| | | thirdCauseQueryWrapper.eq("third_code", caseInfo.getCaseType()); |
| | | ThirdCause thirdCause = thirdCauseService.getOne(thirdCauseQueryWrapper); |
| | | if (ObjectUtils.isNotEmpty(thirdCause)){ |
| | | SyCause syCause = syCauseService.getById(thirdCause.getCauseCode()); |
| | | if (ObjectUtils.isNotEmpty(syCause)){ |
| | | // 查询父级 |
| | | SyCause syCausePanrent = syCauseService.getById(syCause.getParentId()); |
| | | if (ObjectUtils.isNotEmpty(syCausePanrent)){ |
| | | try{ |
| | | CaseInfo caseInfoPO = new CaseInfo(); |
| | | caseInfoPO.setId(caseInfo.getId()); |
| | | caseInfoPO.setCaseType(syCause.getId()); |
| | | caseInfoPO.setCaseTypeName(syCause.getName()); |
| | | caseInfoPO.setCaseTypeFirst(syCausePanrent.getId()); |
| | | caseInfoPO.setCaseTypeFirstName(syCausePanrent.getName()); |
| | | caseInfoService.updateCaseInfo(caseInfoPO); |
| | | }catch (Exception e){ |
| | | log.error("[ByToGzService.upThirdCause]调用失败,异常信息:"+e, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("[ByToGzService.byToGzEndCase]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("ByToGzService.byToGzEndCase", e); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 白云区矛盾纠纷多元化解平台数据割接-更新问题属地的村级社区 |
| | | */ |
| | | public void upQueAddr(){ |
| | | try{ |
| | | List<CaseInfoUnfold> caseInfoUnfoldList = caseInfoUnfoldService.list(); |
| | | for (CaseInfoUnfold caseInfoUnfold: caseInfoUnfoldList){ |
| | | if (StringUtils.isNotEmpty(caseInfoUnfold.getMediateUnitId())) { |
| | | CtUnitDTO ctUnitDTO = custClient.getUnitById(caseInfoUnfold.getMediateUnitId()); |
| | | if (ObjectUtils.isNotEmpty(ctUnitDTO)){ |
| | | if (StringUtils.isNotEmpty(ctUnitDTO.getVillage())) { |
| | | CaseInfo caseInfo = new CaseInfo(); |
| | | caseInfo.setId(caseInfoUnfold.getId()); |
| | | caseInfo.setQueVillage(ctUnitDTO.getVillage()); |
| | | caseInfo.setQueVillageName(ctUnitDTO.getVillageName()); |
| | | caseInfoService.updateCaseInfo(caseInfo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("[ByToGzService.upQueAddr]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("ByToGzService.upQueAddr", e); |
| | | } |
| | | |
| | | } |
| | | } |