package com.sercurityControl.proteam.dutyTask.service; import com.alibaba.nacos.common.utils.CollectionUtils; import com.github.pagehelper.PageInfo; import com.securityControl.common.core.utils.StringUtils; import com.securityControl.common.core.utils.aes.StringHelper; import com.securityControl.common.core.web.domain.AjaxResult; import com.sercurityControl.proteam.dutyTask.domain.*; import com.sercurityControl.proteam.dutyTask.mapper.SuperStatisticsMapper; import com.sercurityControl.proteam.dutyTask.mapper.TodayTaskMapper; import com.sercurityControl.proteam.util.DateTimeHelper; import com.sercurityControl.proteam.util.OssUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; import javax.annotation.Resource; import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; /** * 值班任务-违章统计业务逻辑层 */ @Service(value = "SuperStatisticsService") @Slf4j public class SuperStatisticsServiceImpl implements SuperStatisticsService { @Resource(name = "SuperStatisticsMapper") private SuperStatisticsMapper mapper; @Resource(name = "TodayTaskMapper") private TodayTaskMapper todayTaskMapper; @Autowired private OssUtil ossUtil; @Override public PageInfo getSuperStatisticsList(NoticeVioEntity noticeVioEntity) { if (StringUtils.isNotBlank(noticeVioEntity.getOrg())) { String[] orgArr = noticeVioEntity.getOrg().split(","); List orgList = Arrays.asList(orgArr); noticeVioEntity.setOrgList(orgList); } if (StringUtils.isNotBlank(noticeVioEntity.getLevelId())) { String[] levelIdArr = noticeVioEntity.getLevelId().split(","); List levelIdList = Arrays.asList(levelIdArr); noticeVioEntity.setLevelIdList(levelIdList); } if (StringUtils.isNotBlank(noticeVioEntity.getProName())) { String[] proNameArr = noticeVioEntity.getProName().split(","); List proNameList = Arrays.asList(proNameArr); noticeVioEntity.setProNameList(proNameList); } if (StringUtils.isNotBlank(noticeVioEntity.getRiskLevel())) { String[] riskLevelArr = noticeVioEntity.getRiskLevel().split(","); List riskLevelList = Arrays.asList(riskLevelArr); noticeVioEntity.setRiskLevelList(riskLevelList); } if (StringUtils.isNotBlank(noticeVioEntity.getStatus())) { String[] statusArr = noticeVioEntity.getStatus().split(","); List statusList = Arrays.asList(statusArr); noticeVioEntity.setStatusList(statusList); } List list = mapper.getSuperStatisticsList(noticeVioEntity); list.forEach(item -> { String teamLeader = null; if (StringUtils.isNotBlank(item.getTeamId())) { teamLeader = mapper.getTeamLeader(item.getTeamId(), 1); } else { teamLeader = mapper.getTeamLeader(item.getClassId(), 2); } item.setTeamLeader(teamLeader); // String imgPath = item.getImgPath(); // if (StringUtils.isNotBlank(imgPath)) { // String[] imgArr = imgPath.split(","); // item.setImgNum(imgArr.length); // } else { // item.setImgNum(0); // } }); PageInfo pageInfo = new PageInfo<>(list); return pageInfo; } @Override public PageInfo getHandViolationList(NoticeVioEntity entity) { List list = mapper.getHandViolationList(entity); PageInfo pageInfo = new PageInfo<>(list); return pageInfo; } @Override public NoticeVioEntity getNoticeVoiById(String id) { return mapper.getNoticeVoiById(id); } @Override @Transactional(rollbackFor = Exception.class) public void editNoticeVioAndImg(NoticeVioEntity entity, List list) { mapper.editNoticeVio(entity); if (CollectionUtils.isNotEmpty(list)) { list.forEach(item -> { item.setNotiId(entity.getId()); }); todayTaskMapper.addNoticeVioImg(list); } if (StringUtils.isNotBlank(entity.getDelImgIdList())) { String[] delImgIdArr = entity.getDelImgIdList().split(","); List delImgIdList = Arrays.asList(delImgIdArr); mapper.delNoticeVioImg(delImgIdList, entity.getId()); } String[] vioUsersArr = entity.getVioUsers().split(","); String[] idNumberArr = entity.getIdNumber().split(","); String[] scoreArr = entity.getScore().split(","); String[] oldIdNumberArr = entity.getOldIdNumber().split(","); String[] oldScoreArr = entity.getOldScore().split(","); List newNoticePeoList = new ArrayList<>(); List oldNoticePeoList = new ArrayList<>(); // 修改的违章人员 for (int i = 0; i < idNumberArr.length; i++) { for (int j = 0; j < oldIdNumberArr.length; j++) { if (Objects.equals(idNumberArr[i], oldIdNumberArr[j]) && !Objects.equals(scoreArr[i], oldScoreArr[j])) { NoticePeoEntity noticePeoEntity = new NoticePeoEntity(); noticePeoEntity.setName(vioUsersArr[i]); noticePeoEntity.setIdNumber(idNumberArr[i]); noticePeoEntity.setScore(scoreArr[i]); noticePeoEntity.setClassId(entity.getClassId()); noticePeoEntity.setNotiId(entity.getId()); oldNoticePeoList.add(noticePeoEntity); } } } if (CollectionUtils.isNotEmpty(oldNoticePeoList)) { mapper.editNoticePeo(oldNoticePeoList, entity.getId()); } // 删除的违章人员 List delPeo = getDelOrAdd(Arrays.asList(oldIdNumberArr), Arrays.asList(idNumberArr)); if (CollectionUtils.isNotEmpty(delPeo)) { mapper.delNoticePeo(delPeo, entity.getId()); } // 新增的违章人员 List addPeo = getDelOrAdd(Arrays.asList(idNumberArr), Arrays.asList(oldIdNumberArr)); if (CollectionUtils.isNotEmpty(addPeo)) { for (int i = 0; i < idNumberArr.length; i++) { for (int j = 0; j < addPeo.size(); j++) { if (idNumberArr[i] == addPeo.get(j)) { NoticePeoEntity noticePeoEntity = new NoticePeoEntity(); noticePeoEntity.setName(vioUsersArr[i]); noticePeoEntity.setIdNumber(idNumberArr[i]); noticePeoEntity.setScore(scoreArr[i]); noticePeoEntity.setClassId(entity.getClassId()); noticePeoEntity.setNotiId(entity.getId()); newNoticePeoList.add(noticePeoEntity); } } } todayTaskMapper.insertTeamBlack(newNoticePeoList); todayTaskMapper.addNoticePeo(newNoticePeoList); } } /** * @return java.util.List * @Author ccw * @Description 方法主要用于返回list1中有的数据,而list2没有的;当list1和list2数据相同时返回空的list * @Date 16:45 2022/5/11 * @Param [list1, list2] */ public static List getDelOrAdd(List list1, List list2) { //空间换时间 降低时间复杂度 Map tempMap = new HashMap<>(16); for (String str : list2) { tempMap.put(str, str); } //LinkedList 频繁添加删除 也可以ArrayList容量初始化为List1.size(),防止数据量过大时频繁扩容以及数组复制 List resList = new LinkedList<>(); for (String str : list1) { if (!tempMap.containsKey(str)) { resList.add(str); } } return resList; } @Override public void delNoticeVoiById(String id, String type) { //删除违章单、人员信息、图片 mapper.delNoticeVoiById(id, 1); mapper.delNoticeVoiById(id, 2); mapper.delNoticeVoiById(id, 3); if (Objects.equals("2", type)) { // 删除整改信息 mapper.delNoticeVoiById(id, 4); } } @Override public PageInfo getVoiTypeList(VoiTypeEntity voiTypeEntity) { if (StringUtils.isNotBlank(voiTypeEntity.getCode())) { String[] codeArr = voiTypeEntity.getCode().split(","); List codeList = Arrays.asList(codeArr); voiTypeEntity.setCodeList(codeList); } List list = mapper.getVoiTypeList(voiTypeEntity); PageInfo pageInfo = new PageInfo<>(list); return pageInfo; } @Override public int voiTypeIsExist(String code) { return mapper.voiTypeIsExist(code); } @Override public int getVoiTypePid() { return mapper.getVoiTypePid(); } @Override @Transactional(rollbackFor = Exception.class) public void addVoiType(VoiTypeEntity voiTypeEntity) { mapper.addVoiType(voiTypeEntity); } @Override @Transactional(rollbackFor = Exception.class) public void updateVoiType(VoiTypeEntity voiTypeEntity) { mapper.updateVoiType(voiTypeEntity); } @Override public VoiTypeEntity getVoiTypeById(String param) { return mapper.getVoiTypeById(param); } @Override @Transactional(rollbackFor = Exception.class) public void delVoiTypeById(String param) { mapper.delVoiTypeById(param); } @Override public PageInfo getVoiInfoList(VoiInfoEntity voiInfoEntity) { List list = mapper.getVoiInfoList(voiInfoEntity); PageInfo pageInfo = new PageInfo<>(list); return pageInfo; } @Override public int voiInfoIsExist(VoiInfoEntity voiInfoEntity) { return mapper.voiInfoIsExist(voiInfoEntity); } @Override public void addVoiInfo(VoiInfoEntity voiInfoEntity) { String[] notiInfoArr = voiInfoEntity.getNotiInfo().split(";"); List list = new ArrayList<>(); for (String notiInfo : notiInfoArr) { VoiInfoEntity entity = new VoiInfoEntity(); entity.setNotiInfo(notiInfo); entity.setVoiTypeId(voiInfoEntity.getVoiTypeId()); list.add(entity); } mapper.addVoiInfo(list); } @Override public void updateVoiInfo(VoiInfoEntity voiInfoEntity) { mapper.updateVoiInfo(voiInfoEntity); } @Override public VoiInfoEntity getVoiInfoById(String param) { return mapper.getVoiInfoById(param); } @Override @Transactional(rollbackFor = Exception.class) public void delVoiInfoById(String param) { mapper.delVoiInfoById(param); } @Override public int isHasVoiInfo(String param) { return mapper.isHasVoiInfo(param); } @Override @Transactional(rollbackFor = Exception.class) public void addImportVoiInfo(List list) { mapper.addVoiInfo(list); } @Override public List> getTicketNo(String param, String currentUserId, String isSup) { return mapper.getTicketNo(param, currentUserId, isSup); } @Override public NoticeVioEntity getNoticeVoiRectById(String id) { NoticeVioEntity entity = mapper.getNoticeVoiRectById(id); try { List userList = mapper.getNoticeVoPeople(id); entity.setUserList(userList); // entity.setBase64List(ossUtil.getBase64List(entity.getImgPath(),1)); List list = mapper.getVoiRectList(id, "1"); // list.forEach(item->{ // item.setBase64List(ossUtil.getBase64List(item.getImagePath(),1)); // }); entity.setList(list); } catch (Exception e) { log.error(e.toString(), e); } return entity; } @Override @Transactional(rollbackFor = Exception.class) public void addNoticeVioRectAndImg(NoticeVoiRectEntity entity, NoticeVioEntity vioEntity, List list) { if (StringHelper.isNotEmpty(entity.getUsersParam())) { updateUser(entity); } int num = mapper.updateNoticeVio(vioEntity); mapper.addNoticeVioRect(entity); list.forEach(item -> { item.setId(entity.getId()); }); mapper.addNoticeVioRectImg(list); } /** * 修改用户 * * @param vo */ public void updateUser(NoticeVoiRectEntity vo) { try { String[] idNumbers = vo.getUsersParam().split(","); String[] userNames = vo.getNamesParam().split(","); int num = mapper.delNoticePeos(vo.getClassParam(), vo.getNotiId()); if (num > 0) { List list = new ArrayList<>(); for (int i = 0; i < idNumbers.length; i++) { NoticePeoEntity entity = new NoticePeoEntity(); entity.setNotiId(vo.getNotiId()); entity.setScore(vo.getScoreParam()); entity.setIdNumber(idNumbers[i]); entity.setName(userNames[i]); entity.setClassId(vo.getClassParam()); list.add(entity); } todayTaskMapper.addNoticePeo(list); } } catch (Exception e) { log.error(e.toString(), e); } } @Override @Transactional(rollbackFor = Exception.class) public void rectCheck(NoticeVoiRectEntity entity) { if (Objects.equals("3", entity.getStatus())) { // 申诉被驳回/整改被驳回 重置地市整改状态 entity.setIsAppeal(null); } else if (Objects.equals("5", entity.getStatus())) { entity.setCreateTime(DateTimeHelper.getNowTime()); } mapper.rectCheck(entity, 1); mapper.rectCheck(entity, 2); } @Override public Map getNoticeSheet(NoticeVioEntity entity) throws ParseException { Map map = new HashMap<>(16); NoticeVioEntity noticeVioEntity = mapper.getVoiNotice(entity); noticeVioEntity.setProName(noticeVioEntity.getProName() + setTeamValue(noticeVioEntity.getTeamName())); String serNo = noticeVioEntity.getSerNo(); if (Integer.parseInt(noticeVioEntity.getSerNo()) < 10) { serNo = "0" + noticeVioEntity.getSerNo(); } String createTime = ""; Date date = new SimpleDateFormat("yyyy-MM-dd").parse(noticeVioEntity.getCreateTime()); createTime = new SimpleDateFormat("yyyy年MM月dd日").format(date); noticeVioEntity.setSerNo(noticeVioEntity.getCreateTime().replaceAll("-", "") + "-" + serNo); noticeVioEntity.setCreateTime(createTime); // noticeVioEntity.setBase64List(ossUtil.getBase64List(noticeVioEntity.getImgPath(),1)); if (Objects.equals("5", noticeVioEntity.getStatus())) { String createTime2 = ""; NoticeVoiRectEntity noticeVoiRectEntity = mapper.getVoiNoticeRect(entity); Date date2 = new SimpleDateFormat("yyyy-MM-dd").parse(noticeVoiRectEntity.getRectFinshTime()); createTime2 = new SimpleDateFormat("yyyy.MM.dd").format(date2); noticeVoiRectEntity.setRectFinshTime(createTime2); noticeVoiRectEntity.setStatus("已整改"); // noticeVoiRectEntity.setBase64List(ossUtil.getBase64List(noticeVoiRectEntity.getImagePath(),1)); map.put("noticeVoiRectEntity", noticeVoiRectEntity); } NoticeVioEntity noticeVioEntity2 = mapper.getNoticeSheet2(entity); if (Objects.nonNull(noticeVioEntity2)) { noticeVioEntity.setWorkContent(noticeVioEntity2.getWorkContent()); noticeVioEntity.setSgUnit(noticeVioEntity2.getSgUnit()); noticeVioEntity.setJlUnit(noticeVioEntity2.getJlUnit()); } map.put("noticeVioEntity", noticeVioEntity); return map; } @Override public List> getOrgNumAndRate(NoticeVioEntity noticeVioEntity) { if (StringUtils.isNotBlank(noticeVioEntity.getOrg())) { String[] orgArr = noticeVioEntity.getOrg().split(","); List orgList = Arrays.asList(orgArr); noticeVioEntity.setOrgList(orgList); } if (StringUtils.isNotBlank(noticeVioEntity.getLevelId())) { String[] levelIdArr = noticeVioEntity.getLevelId().split(","); List levelIdList = Arrays.asList(levelIdArr); noticeVioEntity.setLevelIdList(levelIdList); } if (StringUtils.isNotBlank(noticeVioEntity.getProName())) { String[] proNameArr = noticeVioEntity.getProName().split(","); List proNameList = Arrays.asList(proNameArr); noticeVioEntity.setProNameList(proNameList); } if (StringUtils.isNotBlank(noticeVioEntity.getRiskLevel())) { String[] riskLevelArr = noticeVioEntity.getRiskLevel().split(","); List riskLevelList = Arrays.asList(riskLevelArr); noticeVioEntity.setRiskLevelList(riskLevelList); } if (StringUtils.isNotBlank(noticeVioEntity.getStatus())) { String[] statusArr = noticeVioEntity.getStatus().split(","); List statusList = Arrays.asList(statusArr); noticeVioEntity.setStatusList(statusList); } List> list = mapper.getOrgNumAndRate(noticeVioEntity); int totalNum = 0; for (Map map : list) { totalNum += Integer.parseInt(String.valueOf(map.get("num"))); } DecimalFormat decimalFormat = new DecimalFormat("0.00%"); for (Map map : list) { if (totalNum == 0 || Integer.parseInt(String.valueOf(map.get("num"))) == 0) { map.put("rate", "0.00%"); } else { map.put("rate", decimalFormat.format(Integer.parseInt(String.valueOf(map.get("num"))) * 1.0 / totalNum * 1.0)); } } return list; } @Override public PageInfo getVoiRecordList(NoticeVioEntity noticeVioEntity) { List list = mapper.getVoiRecordList(noticeVioEntity); PageInfo pageInfo = new PageInfo<>(list); return pageInfo; } /** * @return java.lang.String * @author cw chen * @description 设置班组名称 * @Param value * @date 2023-06-12 10:41 */ public static String setTeamValue(String value) { if (StringUtils.isNotBlank(value)) { return "(" + value + ")"; } return ""; } @Override @Transactional(rollbackFor = Exception.class) public void refreshNoticeVoiData() { List list = mapper.getNoticeVoiData(); if (CollectionUtils.isNotEmpty(list)) { list.forEach(item -> { mapper.updateNoticeVoiInfo(item); }); } } @Override public Map getViolationTypeList(NoticeVioEntity noticeVioEntity) { if (StringUtils.isNotBlank(noticeVioEntity.getOrg())) { String[] orgArr = noticeVioEntity.getOrg().split(","); List orgList = Arrays.asList(orgArr); noticeVioEntity.setOrgList(orgList); } if (StringUtils.isNotBlank(noticeVioEntity.getLevelId())) { String[] levelIdArr = noticeVioEntity.getLevelId().split(","); List levelIdList = Arrays.asList(levelIdArr); noticeVioEntity.setLevelIdList(levelIdList); } if (StringUtils.isNotBlank(noticeVioEntity.getProName())) { String[] proNameArr = noticeVioEntity.getProName().split(","); List proNameList = Arrays.asList(proNameArr); noticeVioEntity.setProNameList(proNameList); } if (StringUtils.isNotBlank(noticeVioEntity.getRiskLevel())) { String[] riskLevelArr = noticeVioEntity.getRiskLevel().split(","); List riskLevelList = Arrays.asList(riskLevelArr); noticeVioEntity.setRiskLevelList(riskLevelList); } if (StringUtils.isNotBlank(noticeVioEntity.getStatus())) { String[] statusArr = noticeVioEntity.getStatus().split(","); List statusList = Arrays.asList(statusArr); noticeVioEntity.setStatusList(statusList); } Map map = new HashMap<>(16); List> typeList = new ArrayList<>(); List> levelIdList = new ArrayList<>(); String[] strArr = {"建议整改", "一般违章", "严重违章", "装置违章", "管理违章", "行为违章"}; for (int i = 0; i < strArr.length; i++) { Map map1 = new HashMap<>(16); noticeVioEntity.setStatisticsType(strArr[i]); noticeVioEntity.setType("2"); if (i < 3) { noticeVioEntity.setType("1"); } List> list = mapper.getViolationTypeList(noticeVioEntity); map1.put("name", strArr[i]); map1.put("value", Integer.parseInt(list.get(0).get("num").toString())); if (i < 3) { typeList.add(map1); } else { levelIdList.add(map1); } } map.put("typeList", typeList); map.put("levelIdList", levelIdList); return map; } @Override public PageInfo getProVoiRecordList(NoticeVioEntity noticeVioEntity) { List list = mapper.getProVoiRecordList(noticeVioEntity); PageInfo pageInfo = new PageInfo<>(list); return pageInfo; } @Override public List> getBasicInfo(String classId) { List> list = null; try { list = mapper.getBasicInfo(classId); } catch (Exception e) { log.error("获取 施工单位、监理单位、班组负责人及电话", e); } return list; } @Override public List getVoiImgs(String id) { List list = new ArrayList<>(); try { list = mapper.getVoiImgs(id); } catch (Exception e) { log.error("获取违章照片", e); } return list; } @Override public NoticeVioEntity getNoticeSheet2(NoticeVioEntity entity) { return mapper.getNoticeSheet2(entity); } @Override @Transactional(rollbackFor = Exception.class) public AjaxResult checkVoiStatus(NoticeVioEntity dto) { try { if (Objects.equals("8", dto.getStatus())) { dto.setRemark(DateTimeHelper.getNowTime() + "@" + dto.getRemark()); }else if(Objects.equals("11", dto.getStatus())){ dto.setStatus("1"); dto.setResource("1"); } mapper.checkVoiStatus(dto); } catch (Exception e) { log.error("值长审核 违章单", e); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return AjaxResult.error(); } return AjaxResult.success(); } @Override @Transactional(rollbackFor = Exception.class) public AjaxResult rebackVoiStatus(NoticeVioEntity dto) { try { mapper.rebackVoiStatus(dto); } catch (Exception e) { log.error("违章单回撤", e); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return AjaxResult.error(); } return AjaxResult.success(); } @Override public List getVoiCheckLists(NoticeVioEntity vo) { List list = new ArrayList<>(); try { if (StringUtils.isNotEmpty(vo.getCreateTime())) { String[] dateArr = vo.getCreateTime().split(" - "); vo.setCreateTime(dateArr[0]); vo.setEndTime(dateArr[1]); } else { vo.setCreateTime(DateTimeHelper.getNowDate()); vo.setEndTime(DateTimeHelper.getNowDate()); } list = mapper.getVoiCheckLists(vo); return list; } catch (Exception e) { log.error("违章审核记录列表", e); } return list; } @Override public AjaxResult getTypeChildList(String typeId) { List> list = new ArrayList<>(); list = mapper.getTypeChildList(typeId); return AjaxResult.success(list); } @Override public AjaxResult getTeamVoiNum(String classId, String teamLeaderNumber,String teamId) { Map map = new HashMap<>(); try { if (StringUtils.isEmpty(teamId)) { teamId = mapper.getTeamLeaderNumber(classId); } List> list = mapper.getTeamVoiNum(teamId, 1); // 违章类型、违章等级 List voiLevelList = mapper.getVoiDist("voi_level"); List voiTypeList = mapper.getVoiDist("voi_type"); for (String voiType : voiTypeList) { List> typeChildList = mapper.getTypeChildList(voiType); List> childTypeListMap = totalVoiNum2(list, typeChildList); if(Objects.equals(voiType,"管理违章")){ map.put("manage_voi",childTypeListMap); }else if(Objects.equals(voiType,"行为违章")){ map.put("active_voi",childTypeListMap); }else if(Objects.equals(voiType,"装置违章")){ map.put("device_voi",childTypeListMap); } } List> levelNumList = totalVoiNum(list, voiLevelList, "level"); List> typeNumList = totalVoiNum(list, voiTypeList, "type"); map.put("levelNumList",levelNumList); map.put("typeNumList",typeNumList); } catch (Exception e) { log.error("查询班组历史违章记录违章类型数量/违章等级数量"); } return AjaxResult.success(map); } public List> totalVoiNum(List> list, List voiList, String voiType) { List> dataList = new ArrayList<>(); for (String voi : voiList) { Map map = new HashMap<>(); map.put("name", voi); int num = 0; if (CollectionUtils.isNotEmpty(list)) { for (Map stringMap : list) { String voiStr = String.valueOf(stringMap.get(voiType)); if (Objects.equals(voiStr, voi)) { num++; } } } map.put("value", num); dataList.add(map); } return dataList; } public List> totalVoiNum2(List> list, List> voiList) { List> dataList = new ArrayList<>(); for (Map map : voiList) { Map dataMap = new HashMap<>(); String childTypeName = String.valueOf(map.get("name")); dataMap.put("name", childTypeName); int num = 0; if (CollectionUtils.isNotEmpty(list)) { for (Map stringMap : list) { String voiStr = String.valueOf(stringMap.get("childType")); if (Objects.equals(voiStr, childTypeName)) { num++; } } } dataMap.put("value", num); dataList.add(dataMap); } return dataList; } @Override public PageInfo getTeamVoiHistory(NoticeVioEntity noticeVioEntity) { if (StringUtils.isEmpty(noticeVioEntity.getTeamLeaderNumber())) { String teamLeaderNumber = mapper.getTeamLeaderNumber(noticeVioEntity.getClassId()); noticeVioEntity.setTeamLeaderNumber(teamLeaderNumber); } List list = mapper.getTeamVoiHistory(noticeVioEntity); PageInfo pageInfo = new PageInfo<>(list); return pageInfo; } @Override public AjaxResult getChildTypeList(NoticeVioEntity noticeVioEntity) { Map map = new HashMap<>(); try { if (StringUtils.isNotBlank(noticeVioEntity.getOrg())) { String[] orgArr = noticeVioEntity.getOrg().split(","); List orgList = Arrays.asList(orgArr); noticeVioEntity.setOrgList(orgList); } if (StringUtils.isNotBlank(noticeVioEntity.getLevelId())) { String[] levelIdArr = noticeVioEntity.getLevelId().split(","); List levelIdList = Arrays.asList(levelIdArr); noticeVioEntity.setLevelIdList(levelIdList); } if (StringUtils.isNotBlank(noticeVioEntity.getProName())) { String[] proNameArr = noticeVioEntity.getProName().split(","); List proNameList = Arrays.asList(proNameArr); noticeVioEntity.setProNameList(proNameList); } if (StringUtils.isNotBlank(noticeVioEntity.getRiskLevel())) { String[] riskLevelArr = noticeVioEntity.getRiskLevel().split(","); List riskLevelList = Arrays.asList(riskLevelArr); noticeVioEntity.setRiskLevelList(riskLevelList); } if (StringUtils.isNotBlank(noticeVioEntity.getStatus())) { String[] statusArr = noticeVioEntity.getStatus().split(","); List statusList = Arrays.asList(statusArr); noticeVioEntity.setStatusList(statusList); } List> list = mapper.getChildTypeList(noticeVioEntity); // 违章类型、违章等级 List voiLevelList = mapper.getVoiDist("voi_level"); List voiTypeList = mapper.getVoiDist("voi_type"); for (String voiType : voiTypeList) { List> typeChildList = mapper.getTypeChildList(voiType); List> childTypeListMap = totalVoiNum2(list, typeChildList); if(Objects.equals(voiType,"管理违章")){ map.put("manage_voi",childTypeListMap); }else if(Objects.equals(voiType,"行为违章")){ map.put("active_voi",childTypeListMap); }else if(Objects.equals(voiType,"装置违章")){ map.put("device_voi",childTypeListMap); } } List> levelNumList = totalVoiNum(list, voiLevelList, "level"); List> typeNumList = totalVoiNum(list, voiTypeList, "type"); map.put("levelNumList",levelNumList); map.put("typeNumList",typeNumList); } catch (Exception e) { log.error("",e); } return AjaxResult.success(map); } @Override public PageInfo getVioNoticeByDirector(NoticeVioEntity noticeVioEntity) { List list = mapper.getVioNoticeByDirector(noticeVioEntity); PageInfo pageInfo = new PageInfo<>(list); return pageInfo; } }