| | |
| | | import cn.huge.module.client.api.impl.UtilsClientImpl; |
| | | import cn.huge.module.cases.dao.mapper.CaseInfoMapper; |
| | | import cn.huge.module.constant.BaseConsts; |
| | | import cn.huge.module.cust.dto.CtUnitDTO; |
| | | import cn.huge.module.cust.dto.PaUserDTO; |
| | | import cn.huge.module.mediate.constant.*; |
| | | import cn.huge.module.cust.dto.CtUserDTO; |
| | |
| | | return new PageImpl<CasePageDTO>(content, page, total); |
| | | } |
| | | |
| | | |
| | | public CaseStatisticsBaseDTO statistics(Map<String, Object> terms) throws IOException { |
| | | /** |
| | | * 纠纷态势 |
| | | * 筛选范围:如果已经有承办部门,就按承办部门的区域筛选。如果没有承办部门按问题归属区域筛选 |
| | | * */ |
| | | public CaseStatisticsBaseDTO statistics(Map<String, Object> terms,String userId) throws IOException { |
| | | Object canal = null; |
| | | if(ObjectUtils.isNotEmpty(terms.get("canal"))){ |
| | | canal = terms.get("canal"); |
| | | } |
| | | //根据用户筛选区域范围 |
| | | CtUnitDTO ctUnitDTO = custClient.getUnitByUserId(userId); |
| | | if(ctUnitDTO.getUnitGrade().equals(2)){ |
| | | terms.put("queArea", ctUnitDTO.getArea()); |
| | | }else if(ctUnitDTO.getUnitGrade().equals(3) || ctUnitDTO.getUnitGrade().equals(4)){ |
| | | terms.put("queRoad", ctUnitDTO.getRoad()); |
| | | } |
| | | //基础数据统计 |
| | | CaseStatisticsBaseDTO caseStatisticsBaseDTO = mapper.statisticsBase(terms); |
| | |
| | | caseStatisticsBaseDTO.setAreaList(caseStatisticsAreaDTOS); |
| | | terms.remove("isArea"); |
| | | //纠纷类型统计 |
| | | List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsType(terms); |
| | | List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsTypeFirst(terms); |
| | | if (ObjectUtils.isNotEmpty(caseStatisticsTypeDTOS)) { |
| | | sortType(caseStatisticsTypeDTOS); |
| | | } |
| | |
| | | terms.put("canal", canal); |
| | | } |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "a.create_time"); |
| | | PageRequest pageRequest = PageRequest.of(0, 5, sort); |
| | | PageRequest pageRequest = PageRequest.of(0, 30, sort); |
| | | Page<CasePageDTO> casePageDTOS = pageQueryAll(pageRequest, terms); |
| | | if (ObjectUtils.isNotEmpty(casePageDTOS.getContent())) { |
| | | caseStatisticsBaseDTO.setCaseList(casePageDTOS.getContent()); |
| | |
| | | return casePersonCountBO; |
| | | } |
| | | |
| | | public List<CaseStatisticsTypeDTO> statisticsCaseType(Map<String, Object> terms,String userId){ |
| | | //根据用户筛选区域范围 |
| | | CtUnitDTO ctUnitDTO = custClient.getUnitByUserId(userId); |
| | | if(ctUnitDTO.getUnitGrade().equals(2)){ |
| | | terms.put("queArea", ctUnitDTO.getArea()); |
| | | }else if(ctUnitDTO.getUnitGrade().equals(3) || ctUnitDTO.getUnitGrade().equals(4)){ |
| | | terms.put("queRoad", ctUnitDTO.getRoad()); |
| | | } |
| | | if(ObjectUtils.isEmpty(terms.get("caseTypeFirst"))){ |
| | | //筛选一级为其他的纠纷类型 |
| | | List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsTypeFirst(terms); |
| | | if (ObjectUtils.isNotEmpty(caseStatisticsTypeDTOS)) { |
| | | sortType(caseStatisticsTypeDTOS); |
| | | } |
| | | int i = 1; |
| | | List<String> caseTypeList = new ArrayList<>(); |
| | | for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) { |
| | | if (i > 5) { |
| | | caseTypeList.add(caseStatisticsTypeDTO.getCaseType()); |
| | | } |
| | | i++; |
| | | } |
| | | if(ObjectUtils.isEmpty(caseTypeList)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | terms.put("caseTypeFirstList", caseTypeList); |
| | | } |
| | | List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsType(terms); |
| | | if (ObjectUtils.isNotEmpty(caseStatisticsTypeDTOS)) { |
| | | sortType(caseStatisticsTypeDTOS); |
| | | } |
| | | Integer typeTotalNum = 0; |
| | | for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) { |
| | | typeTotalNum = typeTotalNum + dellNull(caseStatisticsTypeDTO.getCaseNum()); |
| | | } |
| | | for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) { |
| | | caseStatisticsTypeDTO.setCaseRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsTypeDTO.getCaseNum() * 100, typeTotalNum, 1)); |
| | | } |
| | | return caseStatisticsTypeDTOS; |
| | | } |
| | | } |