| | |
| | | |
| | | import cn.huge.base.common.exception.ServiceException; |
| | | import cn.huge.base.common.utils.*; |
| | | import cn.huge.module.cases.domain.bo.CaseAgentBO; |
| | | import cn.huge.module.cases.domain.bo.CasePersonBO; |
| | | import cn.huge.module.cases.domain.dto.*; |
| | | |
| | | import cn.huge.module.cases.domain.dto.CaseAreaDTO; |
| | |
| | | import cn.huge.module.mediate.dto.WechatBindCaseDTO; |
| | | import cn.huge.module.sys.dto.FileIdTypeInfoBaseDTO; |
| | | import cn.huge.module.sys.dto.QueAddrBaseDTO; |
| | | import cn.huge.module.sys.dto.QueAreaDTO; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | |
| | | @Autowired |
| | | private CaseEvaluateService caseEvaluateService; |
| | | |
| | | @Autowired |
| | | private CaseAreaService caseAreaService; |
| | | |
| | | |
| | | /** |
| | |
| | | caseInfo.setDefendants(defendants.toString()); |
| | | caseInfo.setDagents(dagents.toString()); |
| | | caseInfo.setCaseRef(utilsClient.createCaseRef()); |
| | | caseInfo.setCanal(CaseBaseConstsEnum.CASE_CANAL_1.getIndex()); |
| | | caseInfo.setCanalName(CaseBaseConstsEnum.CASE_CANAL_1.getDes()); |
| | | caseInfo.setVisitWay(CaseBaseConstsEnum.VISIT_WAY_1.getIndex()); |
| | | caseInfo.setVisitWayName(CaseBaseConstsEnum.VISIT_WAY_1.getDes()); |
| | | //todo case_title生成、经纬度转换 |
| | |
| | | // 临时加上一级纠纷类型 |
| | | caseInfo.setCaseTypeFirst("24_01-2"); |
| | | caseInfo.setCaseTypeFirstName("劳动社保"); |
| | | //小程序是否查看 |
| | | caseInfo.setPartyShow(1); |
| | | |
| | | this.saveOrUpdate(caseInfo); |
| | | |
| | | caseInfoUnfoldService.saveOrUpdate(caseInfoUnfold); |
| | |
| | | int peopleNum = 0; |
| | | // 保存申请人 |
| | | List<CasePerson> personList = registerSaveDTO.getPersonList(); |
| | | Map<String,String> personIdMap = new HashMap<>(); |
| | | if (CollectionUtils.isNotEmpty(personList)) { |
| | | for (CasePerson casePerson : personList) { |
| | | casePerson.setId(utilsClient.getNewTimeCaseId()); |
| | | String newTimeCaseId = utilsClient.getNewTimeCaseId(); |
| | | personIdMap.put(casePerson.getAgentCode(), newTimeCaseId); |
| | | casePerson.setId(newTimeCaseId); |
| | | casePerson.setCaseId(registerSaveDTO.getId()); |
| | | casePerson.setPartyUserId(loginUser.getId()); |
| | | casePerson.setCustId(registerSaveDTO.getCustId()); |
| | |
| | | if (CollectionUtils.isNotEmpty(agentList)) { |
| | | for (CaseAgent caseAgent : agentList) { |
| | | caseAgent.setId(utilsClient.getNewTimeCaseId()); |
| | | caseAgent.setPersonId(personIdMap.get(caseAgent.getAgentCode())); |
| | | caseAgent.setPartyUserId(loginUser.getId()); |
| | | caseAgent.setCaseId(registerSaveDTO.getId()); |
| | | caseAgent.setAgentTypeName(CaseBaseConstsEnum.getDes(caseAgent.getAgentType())); |
| | |
| | | QueryWrapper<CasePerson> casePersonQueryWrapper = new QueryWrapper<>(); |
| | | casePersonQueryWrapper.eq("case_id", registerSaveDTO.getId()); |
| | | List<CasePerson> personList = personService.list(casePersonQueryWrapper); |
| | | Map<String,String> personNameMap = new HashMap<>(); |
| | | if(ObjectUtils.isNotEmpty(personList)){ |
| | | for (CasePerson casePerson : personList) { |
| | | personNameMap.put(casePerson.getId(),casePerson.getTrueName()); |
| | | } |
| | | } |
| | | registerSaveDTO.setPersonList(personList); |
| | | |
| | | QueryWrapper<CaseAgent> caseAgentQueryWrapper = new QueryWrapper<>(); |
| | | caseAgentQueryWrapper.eq("case_id", registerSaveDTO.getId()); |
| | | List<CaseAgent> agentList = agentService.list(caseAgentQueryWrapper); |
| | | if(ObjectUtils.isNotEmpty(agentList)){ |
| | | for (CaseAgent caseAgent : agentList) { |
| | | caseAgent.setAgentPersonName(personNameMap.get(caseAgent.getPersonId())); |
| | | } |
| | | } |
| | | registerSaveDTO.setAgentList(agentList); |
| | | |
| | | return registerSaveDTO; |
| | |
| | | } |
| | | List<String> ids = casePersonList.stream().map(CasePerson::getCaseId).collect(Collectors.toList()); |
| | | terms.put("ids", ids); |
| | | terms.put("partyShow",1); |
| | | long total = mapper.countTerms(terms); |
| | | List<CaseInfo> content = mapper.pageTerms(page, terms); |
| | | if (ObjectUtils.isNotEmpty(content)) { |
| | |
| | | List<CasePageDTO> content = mapper.pageTermsAll(page, terms); |
| | | if (ObjectUtils.isNotEmpty(content)) { |
| | | for (CasePageDTO casePageDTO : content) { |
| | | if(ObjectUtils.isNotEmpty(casePageDTO.getQueRoadName())){ |
| | | casePageDTO.setAreaName(casePageDTO.getQueRoadName()); |
| | | }else if(ObjectUtils.isNotEmpty(casePageDTO.getAreaName())){ |
| | | casePageDTO.setAreaName(casePageDTO.getAreaName()); |
| | | }else if(ObjectUtils.isNotEmpty(casePageDTO.getQueCityName())){ |
| | | casePageDTO.setAreaName(casePageDTO.getQueCityName()); |
| | | } |
| | | if(ObjectUtils.isNotEmpty(casePageDTO.getCaseLevel())){ |
| | | switch (casePageDTO.getCaseLevel()){ |
| | | case "1": |
| | | casePageDTO.setCaseLevel("一级"); |
| | | break; |
| | | case "2": |
| | | casePageDTO.setCaseLevel("二级"); |
| | | break; |
| | | case "3": |
| | | casePageDTO.setCaseLevel("三级"); |
| | | break; |
| | | } |
| | | } |
| | | QueryWrapper<CasePerson> personWrapper1 = new QueryWrapper<>(); |
| | | personWrapper1.eq("case_id", casePageDTO.getId()); |
| | | List<CasePerson> casePersonList1 = personService.list(personWrapper1); |
| | |
| | | } |
| | | |
| | | public CaseStatisticsBaseDTO statistics(Map<String, Object> terms) throws IOException { |
| | | Object canal = null; |
| | | if(ObjectUtils.isNotEmpty(terms.get("canal"))){ |
| | | canal = terms.get("canal"); |
| | | } |
| | | //基础数据统计 |
| | | CaseStatisticsBaseDTO caseStatisticsBaseDTO = mapper.statisticsBase(terms); |
| | | Integer baseTotalNum = dellNull(caseStatisticsBaseDTO.getResolveNum()) + dellNull(caseStatisticsBaseDTO.getUnResolveNum()) + dellNull(caseStatisticsBaseDTO.getResolveingNum()); |
| | |
| | | areaCodeList.add(caseStatisticsAreaDTO.getAreaCode()); |
| | | } |
| | | caseStatisticsAreaDTOS.add(allArea); |
| | | List<CaseArea> queArea = listAreaByType(terms.get("areaType"), terms.get("queArea")); |
| | | List<QueAreaDTO> queArea = listAreaByType(terms.get("queArea")); |
| | | log.info("listAreaByType {}", JSON.toJSONString(queArea)); |
| | | for (CaseArea caseAreaDTO : queArea) { |
| | | for (QueAreaDTO caseAreaDTO : queArea) { |
| | | if (!areaCodeList.contains(caseAreaDTO.getAreaCode())) { |
| | | CaseStatisticsAreaDTO areaChild = new CaseStatisticsAreaDTO(); |
| | | areaChild.setAreaCode(caseAreaDTO.getAreaCode()); |
| | |
| | | } |
| | | twoSource.setCanalName(CaseBaseConstsEnum.CASE_CANAL_2.getDes()); |
| | | |
| | | Integer sourceTotalNum = dellNull(oneSource.getCaseNum()) + dellNull(oneSource.getCaseNum()); |
| | | terms.put("canal", CaseBaseConstsEnum.CASE_CANAL_3.getIndex()); |
| | | CaseStatisticsSourceDTO threeSource = mapper.statisticsSource(terms); |
| | | if(ObjectUtils.isEmpty(threeSource)){ |
| | | threeSource = new CaseStatisticsSourceDTO(); |
| | | } |
| | | |
| | | terms.put("canal", CaseBaseConstsEnum.CASE_CANAL_4.getIndex()); |
| | | CaseStatisticsSourceDTO fourSource = mapper.statisticsSource(terms); |
| | | if(ObjectUtils.isEmpty(fourSource)){ |
| | | fourSource = new CaseStatisticsSourceDTO(); |
| | | } |
| | | |
| | | Integer sourceTotalNum = dellNull(oneSource.getCaseNum()) + dellNull(twoSource.getCaseNum()) + dellNull(threeSource.getCaseNum()) + dellNull(fourSource.getCaseNum()); |
| | | oneSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(oneSource.getCaseNum() * 100, sourceTotalNum, 1)); |
| | | oneSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(oneSource.getResolveNum() * 100, oneSource.getCaseNum(), 1)); |
| | | twoSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(twoSource.getCaseNum() * 100, sourceTotalNum, 1)); |
| | | twoSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(twoSource.getResolveNum() * 100, twoSource.getCaseNum(), 1)); |
| | | |
| | | CaseStatisticsSourceDTO threeSource = new CaseStatisticsSourceDTO(); |
| | | threeSource.setCanalName("自行排查"); |
| | | threeSource.setResolveRate("0"); |
| | | threeSource.setCaseRate("0"); |
| | | CaseStatisticsSourceDTO fourSource = new CaseStatisticsSourceDTO(); |
| | | fourSource.setCanalName("协同推送"); |
| | | fourSource.setResolveRate("0"); |
| | | fourSource.setCaseRate("0"); |
| | | |
| | | threeSource.setCanalName(CaseBaseConstsEnum.CASE_CANAL_3.getDes()); |
| | | threeSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(threeSource.getCaseNum() * 100, sourceTotalNum, 1)); |
| | | threeSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(threeSource.getResolveNum() * 100, threeSource.getCaseNum(), 1)); |
| | | |
| | | fourSource.setCanalName(CaseBaseConstsEnum.CASE_CANAL_4.getDes()); |
| | | fourSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(fourSource.getCaseNum() * 100, sourceTotalNum, 1)); |
| | | fourSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(fourSource.getResolveNum() * 100, fourSource.getCaseNum(), 1)); |
| | | |
| | | caseStatisticsBaseDTO.setOneSource(oneSource); |
| | | caseStatisticsBaseDTO.setTwoSource(twoSource); |
| | | caseStatisticsBaseDTO.setThreeSource(threeSource); |
| | | caseStatisticsBaseDTO.setFourSource(fourSource); |
| | | |
| | | //案件集合 |
| | | if(ObjectUtils.isEmpty(canal)){ |
| | | terms.remove("canal"); |
| | | }else{ |
| | | terms.put("canal", canal); |
| | | } |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "a.create_time"); |
| | | PageRequest pageRequest = PageRequest.of(0, 5, sort); |
| | | Page<CasePageDTO> casePageDTOS = pageQueryAll(pageRequest, terms); |
| | |
| | | } |
| | | |
| | | public List<CaseStatisticsAreaDTO> sortArea(List<CaseStatisticsAreaDTO> caseStatisticsAreaDTOS) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("越秀区","2"); |
| | | map.put("海珠区","3"); |
| | | map.put("荔湾区","4"); |
| | | map.put("天河区","5"); |
| | | map.put("白云区","6"); |
| | | map.put("黄埔区","7"); |
| | | map.put("花都区","8"); |
| | | map.put("番禺区","9"); |
| | | map.put("南沙区","10"); |
| | | map.put("从化区","11"); |
| | | map.put("增城区","12"); |
| | | for (CaseStatisticsAreaDTO caseStatisticsAreaDTO : caseStatisticsAreaDTOS) { |
| | | if(map.containsKey(caseStatisticsAreaDTO.getAreaName())){ |
| | | caseStatisticsAreaDTO.setAreaCode(map.get(caseStatisticsAreaDTO.getAreaName())); |
| | | } |
| | | } |
| | | caseStatisticsAreaDTOS.sort((o1, o2) -> { |
| | | log.info("xsd:{},{}",o1,o2); |
| | | Integer totalScore1 = Integer.valueOf(o1.getAreaCode()); |
| | | Integer totalScore2 = Integer.valueOf(o2.getAreaCode()); |
| | | if (totalScore1 > totalScore2) { |
| | |
| | | |
| | | /** |
| | | * 根据不同的等级获取不同区域子集合 |
| | | * |
| | | * @param areaType 1-市级 2-区 |
| | | */ |
| | | public List<CaseArea> listAreaByType(Object areaType, Object areaCode) throws IOException { |
| | | log.info("listAreaByType {},{}", areaType, areaCode); |
| | | if (ObjectUtils.isEmpty(areaType) || areaType.equals("") || areaType.equals("1")) { |
| | | QueryWrapper<CaseArea> caseAreaWrapper = new QueryWrapper<>(); |
| | | caseAreaWrapper.eq("parent_code","1601"); |
| | | List<CaseArea> list = caseAreaService.list(caseAreaWrapper); |
| | | return list; |
| | | public List<QueAreaDTO> listAreaByType(Object areaCode) { |
| | | log.info("listAreaByType {},{}", areaCode); |
| | | String parentId = "1601"; |
| | | if (ObjectUtils.isNotEmpty(areaCode)) { |
| | | parentId = String.valueOf(areaCode); |
| | | } |
| | | if (areaType.equals("2")) { |
| | | |
| | | QueryWrapper<CaseArea> caseAreaWrapper = new QueryWrapper<>(); |
| | | caseAreaWrapper.eq("parent_code",areaCode); |
| | | List<CaseArea> list = caseAreaService.list(caseAreaWrapper); |
| | | return list; |
| | | } |
| | | return new ArrayList<>(); |
| | | List<QueAreaDTO> queAreaDTOS = sysClient.listByParentId(parentId); |
| | | return queAreaDTOS; |
| | | } |
| | | } |