| | |
| | | hiddenDangerDataVO.setCateList(cateGeneralDataList); |
| | | } |
| | | //全部隐患区域部门数据 |
| | | |
| | | List<HiddenDangerCompanyVO> hiddenDangerCompanyVOList = hiddenDangerAllList.stream(). |
| | | filter(i->DateUtil.formatDate(i.getCreateDate(),"yyyy-MM").equals(nowDate.substring(0,7))) |
| | | .map(i->new HiddenDangerCompanyVO(i.getAreaName(),i.getAreaCompanyId())).collect(Collectors.toList()); |
| | |
| | | if(optionalCompany.isPresent()){ |
| | | GeneralDataVO generalDataVO = new GeneralDataVO(); |
| | | Company company = optionalCompany.get(); |
| | | Integer total = hiddenDangerAllList.stream().filter(i->DateUtil.formatDate(i.getCreateDate(),"yyyy-MM").equals(nowDate.substring(0,7))&&Constants.equalsInteger(i.getAreaCompanyId(),company.getId())).collect(Collectors.toList()).size(); |
| | | Integer total = hiddenDangerAllList.stream().filter(i->DateUtil.formatDate(i.getCreateDate(),"yyyy-MM"). |
| | | equals(nowDate.substring(0,7))&&Constants.equalsInteger(i.getAreaCompanyId(),company.getId())).collect(Collectors.toList()).size(); |
| | | generalDataVO.setName(company.getName()); |
| | | generalDataVO.setTotal(total); |
| | | generalDataVO.setCategoryName(hiddenDangerCompanyVO.getCategoryName()); |
| | |
| | | } |
| | | hiddenDangerDataVO.setDepartmentList(companyGeneralDataList); |
| | | } |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(hiddenDangerDataVO.getDepartmentList())){ |
| | | List<GeneralDataVO> topList = hiddenDangerDataVO.getDepartmentList(); |
| | | Collections.sort(topList, new Comparator<GeneralDataVO>() { |
| | | @Override |
| | | public int compare(GeneralDataVO o1, GeneralDataVO o2) { |
| | | // 返回值为int类型,大于0表示正序,小于0表示逆序 |
| | | return o2.getTotal() - o1.getTotal(); |
| | | // if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(hiddenDangerDataVO.getDepartmentList())){ |
| | | // List<GeneralDataVO> topList = hiddenDangerDataVO.getDepartmentList(); |
| | | // Collections.sort(topList, new Comparator<GeneralDataVO>() { |
| | | // @Override |
| | | // public int compare(GeneralDataVO o1, GeneralDataVO o2) { |
| | | // // 返回值为int类型,大于0表示正序,小于0表示逆序 |
| | | // return o2.getTotal() - o1.getTotal(); |
| | | // } |
| | | // }); |
| | | // hiddenDangerDataVO.setDepartmentSortList(topList); |
| | | // } |
| | | |
| | | } |
| | | }); |
| | | |
| | | |
| | | List<Map<String,Object>> mapList = hiddenDangerMapper.selectJoinMaps(new MPJLambdaWrapper<HiddenDanger>() |
| | | .select(" t1.name as cateName,t2.name as companyName , count(1) total ") |
| | | .leftJoin(HiddenDangerParam.class,HiddenDangerParam::getId,HiddenDanger::getCateId) |
| | | .leftJoin(Company.class,Company::getId,HiddenDangerParam::getCompanyId) |
| | | .eq(HiddenDanger::getIsdeleted,Constants.ZERO) |
| | | .apply(" DATE_FORMAT(t.CREATE_DATE, '%Y%M') = DATE_FORMAT(now(), '%Y%M') ") |
| | | .groupBy("t1.name , t2.name") |
| | | .orderByDesc(" count(1) ") |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(mapList)){ |
| | | List<GeneralDataVO> topList = new ArrayList<>(); |
| | | for (Map<String,Object> map:mapList) { |
| | | GeneralDataVO generalDataVO = new GeneralDataVO(); |
| | | generalDataVO.setTotal(Integer.valueOf(map.get("total").toString())); |
| | | generalDataVO.setName(map.get("companyName").toString()); |
| | | generalDataVO.setCategoryName(map.get("cateName").toString()); |
| | | topList.add(generalDataVO); |
| | | } |
| | | hiddenDangerDataVO.setDepartmentSortList(topList); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | return hiddenDangerDataVO; |
| | | } |