package com.zcloud.service.bus.impl; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.mapper.datasource.bus.HiddenExamineMapper; import com.zcloud.mapper.datasource.bus.HiddenMapper; import com.zcloud.service.bus.HiddenRegionService; import com.zcloud.service.bus.HiddenService; import com.zcloud.service.bus.ImgFilesService; import com.zcloud.service.system.UsersService; import com.zcloud.util.*; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * 说明:隐患 * 作者:luoxiaobao * 时间:2021-01-04 * 官网:www.zcloudchina.com */ @Service @Transactional //开启事物 public class HiddenServiceImpl implements HiddenService{ @Resource private HiddenMapper hiddenMapper; @Resource private HiddenExamineMapper hiddenexamineMapper; @Autowired private ImgFilesService imgFilesService; @Autowired private UsersService usersService; @Autowired private HiddenRegionService hiddenRegionService; // 隐患区域维护 /**新增 * @param pd * @throws Exception */ public void save(PageData pd)throws Exception{ hiddenMapper.save(pd); } /**删除 * @param pd * @throws Exception */ public void delete(PageData pd)throws Exception{ hiddenMapper.delete(pd); } /**修改 * @param pd * @throws Exception */ public void edit(PageData pd)throws Exception{ hiddenMapper.edit(pd); } /**修改信息 * @param pd * @throws Exception */ public void editInfo(PageData pd)throws Exception{ hiddenMapper.editInfo(pd); } /**修改位置描述信息 * @param pd * @throws Exception */ public void editInformation(PageData pd)throws Exception{ hiddenMapper.editInformation(pd); } /**修改安全环保检查隐患信息 * @param pd * @throws Exception */ public void editSafetyInfo(PageData pd)throws Exception{ hiddenMapper.editSafetyInfo(pd); } public void editISCONFIRM(PageData pd)throws Exception{ hiddenMapper.editISCONFIRM(pd); } public void editHIDDENLEVEL(PageData pd)throws Exception{ hiddenMapper.editHIDDENLEVEL(pd); } /**提交隐患 * @param ArrayDATA_IDS * @throws Exception */ public void submit(PageData pd)throws Exception{ hiddenMapper.submit(pd); } /**修改 * @param pd * @throws Exception */ public void changeState(PageData pd)throws Exception{ hiddenMapper.changeState(pd); } /**定时修改过期隐患 * @param pd * @throws Exception */ public void editDeadline(PageData pd)throws Exception{ hiddenMapper.editDeadline(pd); } /**修改延期隐患为未整改 * @param pd * @throws Exception */ public void editDeferredDeadline(PageData pd)throws Exception{ hiddenMapper.editDeferredDeadline(pd); } /**验收 * @param pd * @throws Exception */ public void check(PageData pd)throws Exception{ hiddenMapper.check(pd); } /**安全环保检查验收 * @param pd * @throws Exception */ public void finalcheck(PageData pd)throws Exception{ hiddenMapper.finalcheck(pd); } /**复查 * @param pd * @throws Exception */ public void review(PageData pd)throws Exception{ hiddenMapper.review(pd); } /**整改 * @param pd * @throws Exception */ public void rectify(PageData pd)throws Exception{ hiddenMapper.rectify(pd); } /**列表 * @param page * @throws Exception */ public List list(Page page)throws Exception{ return hiddenMapper.datalistPage(page); } /**列表(全部) * @param pd * @throws Exception */ public List listAll(PageData pd)throws Exception{ return hiddenMapper.listAll(pd); } /**列表(全部,打印使用) * @param pd * @throws Exception */ public List listAllToPrint(PageData pd)throws Exception{ return hiddenMapper.listAllToPrint(pd); } public List listHiddenAll(PageData pd)throws Exception{ return hiddenMapper.listHiddenAll(pd); } /**通过id获取数据 * @param pd * @throws Exception */ public PageData findById(PageData pd)throws Exception{ return hiddenMapper.findById(pd); } /**通过id获取数据 * @param pd * @throws Exception */ public PageData findByEmisId(PageData pd)throws Exception{ return hiddenMapper.findByEmisId(pd); } /**批量删除 * @param ArrayDATA_IDS * @throws Exception */ public void deleteAll(String[] ArrayDATA_IDS)throws Exception{ hiddenMapper.deleteAll(ArrayDATA_IDS); } @Override public void deleteArray(PageData pd) throws Exception { hiddenMapper.deleteArray(pd); } /**批量修改 * @param ArrayDATA_IDS * @throws Exception */ public void updateAll(PageData hiddens)throws Exception{ hiddenMapper.updateAll(hiddens); } /**按日统计 * @param ArrayDATA_IDS * @throws Exception */ public List hiddenStatisticsByDay(PageData pd)throws Exception{ return hiddenMapper.hiddenStatisticsByDay(pd); } /**总数统计 * @param ArrayDATA_IDS * @throws Exception */ public List hiddenStatisticsAll(PageData pd)throws Exception{ return hiddenMapper.hiddenStatisticsAll(pd); } /** *app首页 根据用户ID获取发现隐患信息 * @param pd CREATOR * @return * @throws Exception */ public List getCountByCreatorId(PageData pd) throws Exception{ return hiddenMapper.getCountByCreatorId(pd); } /** * app首页 根据用户ID获取整改隐患信息 * @param pd CREATOR * @return * @throws Exception */ public List getCountByRectifiCationorId(PageData pd) throws Exception{ return hiddenMapper.getCountByRectifiCationorId(pd); } /** * app首页根据用户ID获取待验收隐患 * @param pd * @return * @throws Exception */ public List getCountByCheckorId(PageData pd) throws Exception{ return hiddenMapper.getCountByCheckorId(pd); } /** * app应用页面根据用户ID获取待确认隐患 * @param pd * @return * @throws Exception */ public List getCountByConfirmId(PageData pd) throws Exception{ return hiddenMapper.getCountByConfirmId(pd); } /** * app应用页面根据用户ID获取特殊处置隐患 * @param pd * @return * @throws Exception */ public List getCountSpecialByhId(PageData pd) throws Exception{ return hiddenMapper.getCountSpecialByhId(pd); } /** *根据企业ID获取驾驶舱隐患统计信息 * @return * @throws Exception */ public List getBICount(PageData pd) throws Exception{ return hiddenMapper.getBICount(pd); } /** * 清单其他隐患 * @return * @throws Exception */ @Override public List getOtherHidden(PageData pd) throws Exception { return hiddenMapper.getOtherHidden(pd); } /** * 提交清单(其他)隐患 */ @Override public void submitList(PageData pd) throws Exception { hiddenMapper.submitList(pd); } public List getCountByHiddenType(PageData pd) throws Exception{ return hiddenMapper.getCountByHiddenType(pd); } /**按日统计 * @param ArrayDATA_IDS * @throws Exception */ public List getHiddenNum(PageData pd)throws Exception{ return hiddenMapper.getHiddenNum(pd); } /** * 确认隐患,修改隐患状态 * @param pd * @throws Exception */ public void confirmHidden (PageData pd) throws Exception{ hiddenMapper.confirmHidden(pd); } /** * 修改隐患信息,隐患级别 ,整改负责人 , 整改期限 * @param pd * @throws Exception */ public void confirmUpdate(PageData pd) throws Exception{ hiddenMapper.confirmUpdate(pd); } /** * 修改隐患状态,进入隐患特殊处理审核 */ public void updteStateBySpecialExamine(PageData pageData)throws Exception{ PageData pd = new PageData(); pd.put("HIDDENEXAMINE_ID", UuidUtil.get32UUID()); pd.put("CREATOR", Jurisdiction.getUSER_ID()); pd.put("CREATTIME", DateUtil.date2Str(new Date())); pd.put("OPERATOR",Jurisdiction.getUSER_ID()); pd.put("OPERATTIME",DateUtil.date2Str(new Date())); pd.put("TYPE","1"); pd.put("STATE","-1"); pd.put("EXAMINE",pageData.get("EXAMINE")); // 无法整改原因 pd.put("HIDDEN_ID",pageData.get("HIDDEN_ID"));// 隐患id hiddenexamineMapper.save(pd); this.updateStateByHidden("7",pageData.get("HIDDEN_ID").toString()); //修改隐患状态 } /** * 隐患列表 -- 港务局 * @param page * @return * @throws Exception */ public List listGwj(Page page) throws Exception{ return hiddenMapper.listGwjdatalistPage(page); } /** * 忽略隐患列表 -- 港务局 * @param page * @return * @throws Exception */ public List listIgnore(Page page) throws Exception{ return hiddenMapper.listIgnoredatalistPage(page); } /** * 重大隐患列表 -- 港务局 * @param page * @return * @throws Exception */ public List majorlist(Page page) throws Exception{ return hiddenMapper.majordatalistPage(page); } /** * 修改隐患整改期限 * @param pd * @throws Exception */ public void updateHiddenRectificationDeadline (PageData hiddenExa) throws Exception{ PageData updatePd = new PageData(); updatePd.put("RECTIFICATIONDEADLINE",hiddenExa.get("DELAY_TIME")); // updatePd.put("HIDDEN_ID",hiddenExa.get("HIDDEN_ID")); hiddenMapper.updateRectificationDeadline(updatePd); } @Override public List statisticsGroupMonthByState(PageData pd) throws Exception { return hiddenMapper.statisticsGroupMonthByState(pd); } public void updateStateByHidden(String type,String hiddenId) throws Exception{ PageData pd = new PageData(); pd.put("STATE",type); pd.put("HIDDEN_ID",hiddenId); hiddenMapper.updateStateByHidden(pd); } /** * 修改隐患整改人 * @param userId * @param deptId * @throws Exception */ public void updateRectificationUserId (String userId,String deptId ,String hiddenId ,String rectificationDeadline) throws Exception{ PageData pd = new PageData(); pd.put("RECTIFICATIONOR",userId); pd.put("RECTIFICATIONDEPT",deptId); pd.put("HIDDEN_ID",hiddenId); pd.put("STATE",1); pd.put("RECTIFICATIONDEADLINE",rectificationDeadline); hiddenMapper.updateRectificationUserId(pd); } @Override public PageData statisticsHiddenByState(PageData pd) throws Exception { return hiddenMapper.statisticsHiddenByState(pd); } @Override public List statisticsGroupLevelByRegion(PageData pd) throws Exception { return hiddenMapper.statisticsGroupLevelByRegion(pd); } @Override public List statisticsGroupTypeByLevel(PageData pd) throws Exception { return hiddenMapper.statisticsGroupTypeByLevel(pd); } @Override public List statisticsGroupType2(PageData pd) throws Exception { return hiddenMapper.statisticsGroupType2(pd); } @Override public List findHiddenSourceChartData(PageData pd) throws Exception { return hiddenMapper.findHiddenSourceChartData(pd); } @Override public List listAllHiddenLocation(PageData pd) throws Exception { return hiddenMapper.listAllHiddenLocation(pd); } @Override public void editstate(PageData hiddenExa) { hiddenMapper.editstate(hiddenExa); } /** * 重大隐患核实列表 -- 港务局 * @param page * @return * @throws Exception */ public List verifylist(Page page) throws Exception{ return hiddenMapper.verifydatalistPage(page); } /** * 重大隐患列表 -- 港务局 * @param page * @return * @throws Exception */ public List majormanage(Page page) throws Exception{ return hiddenMapper.majormanagelistPage(page); } @Override public List listAllInspection(PageData pd) throws Exception { List hiddenList = hiddenMapper.listAllInspection(pd); for (PageData hd : hiddenList) { PageData pd2 = new PageData(); pd2.put("FOREIGN_KEY",hd.getString("HIDDEN_ID")); pd2.put("TYPE",3); //隐患图片 hd.put("hiddenImgs", imgFilesService.listAll(pd2)); pd2.put("TYPE",102); //隐患视频 hd.put("hiddenVideos", imgFilesService.listAll(pd2));//整改图片 } return hiddenList; } @Override public void editStateInspection(PageData pd) throws Exception { hiddenMapper.editStateInspection(pd); } @Override public List listForSafetyEnvironmental(Page page) throws Exception { return hiddenMapper.hiddenInspectionlistPage(page); } @Override public void assign(PageData pd) throws Exception { hiddenMapper.assign(pd); } @Override public List listOtherNotAssign(PageData pd) throws Exception { return hiddenMapper.listOtherNotAssign(pd); } @Override public List listOtherNotAccept(PageData pd) throws Exception { return hiddenMapper.listOtherNotAccept(pd); } @Override public List listOtherNotAccept4pc(PageData pd) throws Exception { return hiddenMapper.listOtherNotAccept4pc(pd); } /** * 获取检查记录的隐患 * @param pd * @return * @throws Exception */ @Override public List checkRecordList(PageData pd) throws Exception { return hiddenMapper.checkRecordList(pd); } /** * 通过安全检查ID获取隐患 * @param pd * @return * @throws Exception */ @Override public List findByInspectionId(PageData pd) throws Exception { return hiddenMapper.findByInspectionId(pd); } @Override public void deleteByKey(PageData pd) throws Exception { hiddenMapper.deleteByKey(pd); } @Override public List findByKey(PageData condition) throws Exception { return hiddenMapper.findByKey(condition); } @Override public List findByQue(PageData condition) throws Exception { return hiddenMapper.findByQue(condition); } @Override public List findByTs(PageData condition) throws Exception { return hiddenMapper.findByTs(condition); } @Override public List findByYin(PageData condition) throws Exception { return hiddenMapper.findByYin(condition); } @Override public List statisticsHiddenCountByLevel(PageData pd) throws Exception { return hiddenMapper.statisticsHiddenCountByLevel(pd); } /**列表 * @param page * @throws Exception */ public List getListForTianzhang(Page page)throws Exception{ return hiddenMapper.getListForTianzhangdatalistPage(page); } /**列表 * @param page * @throws Exception */ public List getListForemis(Page page)throws Exception{ return hiddenMapper.getListForemisdatalistPage(page); } public void saveForEmis(String hiddenId,String resXML)throws Exception{ PageData pd = new PageData(); pd.put("HIDDEN_ID",hiddenId); pd.put("resXML",resXML); hiddenMapper.saveForEmis(pd); } /**删除 * @param * @throws Exception */ public void deleteForEmis(String hiddenId)throws Exception{ PageData pd = new PageData(); pd.put("HIDDEN_ID",hiddenId); hiddenMapper.deleteForEmis(pd); } public String goEmis (PageData pd) throws Exception{ String result = ""; // 1.整理数据 PageData hiddenPd = this.findById(pd); /** 确认之前,记录现在的隐患信息 */ // 隐患确认人 PageData dianjianUserPd = new PageData(); dianjianUserPd.put("USER_ID",hiddenPd.getString("CONFIRM_USER")); PageData dianjianUser = usersService.findByIdForEmis(dianjianUserPd); if(Tools.isEmpty(dianjianUser)){ return "未找到隐患确认人!"; } if(Tools.isEmpty(dianjianUser.get("DJBM"))){ result += "隐患确认人部门没有维护对接编码!"; } if(Tools.isEmpty(dianjianUser.get("JCR"))){ result += "隐患确认人没有维护对接编码!"; } PageData hiddenRegion= hiddenRegionService.findById(hiddenPd.getString("CORPINFO_ID"),hiddenPd.getString("HIDDENPART")); PageData hiddenRegionPar = new PageData(); if(null != hiddenRegion){ if(!hiddenRegion.getString("PARENT_ID").equals("0")){ hiddenRegionPar = hiddenRegionService.findById(hiddenPd.getString("CORPINFO_ID"),hiddenRegion.getString("PARENT_ID")); if(!"0".equals(hiddenRegionPar.getString("PARENT_ID"))){ return "隐患区域等级维护错误!"; } } }else{ return "隐患区域等级维护错误!"; } List imgList = imgFilesService.getListByKeyAndType(hiddenPd.getString("HIDDEN_ID"),"3"); String imgStr = ""; for (PageData pageData:imgList){ imgStr += "192.168.192.201/file" + pageData.getString("FILEPATH")+";"; } if (result != ""){ return result; } String DJSJ = DateUtil.date2Str(new Date()); // 点检时间 String BC = ""; // 班次,自动算 String DJBM = dianjianUser.get("DJBM").toString(); // 点检部门t_b_bm String DJBC = pd.getString("DJBC"); // 点检班次 String JCR = dianjianUser.get("JCR").toString(); // 检查人 String JCLX = pd.getString("JCLX"); // 检查类型t_b_jclx--fid String SBDL = hiddenRegionPar.getString("SBDL"); // 设备大类t_b_sbdlxx--sbdlxxdm String SBMC = hiddenRegion.getString("SBMC");; // 设备名称t_b_shebeixx--shebeidm String DJWT = hiddenPd.getString("HIDDENDESCR"); // 点检问题 String CJR = dianjianUser.get("JCR").toString(); // 创建人 String CJSJ = DateUtil.date2Str(new Date()); // 创建时间 String GZFL = pd.getString("GZFL"); // 故障分类 t_b_kclx String SBZJGID = ""; // 子机构v_b_bujian_zjg String BUJIANID = ""; // 部件v_b_bujian_bj String PICTURE = imgStr; // 图片 StringBuffer strUrl = new StringBuffer(); strUrl.append("strDjsj=" + DJSJ); strUrl.append("&strBc=" + ""); strUrl.append("&strDjbm=" + DJBM); strUrl.append("&strDjbc=" + DJBC); strUrl.append("&strJcr=" + JCR); strUrl.append("&strJclx=" + JCLX); strUrl.append("&strSbdl=" + SBDL); strUrl.append("&strSbmc=" + SBMC); strUrl.append("&strDjwt=" + DJWT); strUrl.append("&strCjr=" + CJR); strUrl.append("&strCjsj=" + CJSJ); strUrl.append("&strGzfl=" + GZFL); strUrl.append("&strSbzjgId=" + SBZJGID); strUrl.append("&strBuJianId=" + BUJIANID); strUrl.append("&strPicture=" + PICTURE); String resXML = HttpEmisDuijieUtil.sendPostNoAccept(strUrl.toString()); StringBuffer strUrl2 = new StringBuffer(); strUrl2.append("djsj:" + DJSJ); strUrl2.append(",bc:" + ""); strUrl2.append(",djbm:" + DJBM); strUrl2.append(",djbc:" + DJBC); strUrl2.append(",jcr:" + JCR); strUrl2.append(",jclx:" + JCLX); strUrl2.append(",sbdl:" + SBDL); strUrl2.append(",sbmc:" + SBMC); strUrl2.append(",djwt:" + DJWT); strUrl2.append(",cjr:" + CJR); strUrl2.append(",cjsj:" + CJSJ); strUrl2.append(",gzfl:" + GZFL); strUrl2.append(",sbzjgID:" + SBZJGID); strUrl2.append(",bujianid:" + BUJIANID); strUrl2.append(",pic:" + PICTURE); if(strUrl2.toString().equals(resXML)){ /** * 成功 * 1.删除现在的隐患内容 * 2.存储这次的隐患内容 */ this.saveForEmis(hiddenPd.getString("HIDDEN_ID"),resXML); this.deleteForEmis(hiddenPd.getString("HIDDEN_ID")); return "success"; }else{ //失败 return resXML; } } public void updateGoConfirm(PageData hiddens)throws Exception{ hiddenMapper.updateGoConfirm(hiddens); } @Override public List findBySource(Integer sourceNumber) { return hiddenMapper.findBySource(sourceNumber); } @Override public Map getExcelMap(PageData pageData) { Map map = new HashMap<>(); //部门自查数据 List zcPageDataList = hiddenMapper.getExcelZc(pageData); //stream分组 Map> groupByTypeList = zcPageDataList.stream().collect(Collectors.groupingBy(item->item.getString("type"))); //装船部自查数据 List zcbZc = groupByTypeList.get("zcbzc"); if(!Tools.isEmpty(zcbZc)){ map.put("zcbZcZs",zcbZc.size()); //总数 List zcbZcWc = zcbZc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList()); int zijin = zcbZc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum(); if(!Tools.isEmpty(zcbZcWc)){ map.put("zcbZcZg",zcbZcWc.size()); map.put("zcbZcWwcZg",zcbZc.size()-zcbZcWc.size()); BigDecimal result = new BigDecimal(zcbZcWc.size()).divide(new BigDecimal(zcbZc.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); map.put("zcbZcZgl",result.intValue()+"%"); //整改率 }else { map.put("zcbZcZg","0"); map.put("zcbZcWwcZg",zcbZcWc.size()); map.put("zcbZcZgl","0%"); //整改率 } map.put("zcbZcZgZj",zijin); //资金 }else { map.put("zcbZcZs","0"); //总数 map.put("zcbZcZg","0"); //整改数 map.put("zcbZcWwcZg","0"); //整改未完成数 map.put("zcbZcZgl","0%"); //整改率 map.put("zcbZcZgZj","0"); //资金 } //卸车部自查数据 List xcbZc = groupByTypeList.get("xcbzc"); if(!Tools.isEmpty(xcbZc)){ map.put("xcbZcZs",xcbZc.size()); //总数 List xcbZcWc = xcbZc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList()); int zijin = xcbZc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum(); if(!Tools.isEmpty(xcbZcWc)){ map.put("xcbZcZg",xcbZcWc.size()); map.put("xcbZcWwcZg",xcbZc.size()-xcbZcWc.size()); BigDecimal result = new BigDecimal(xcbZcWc.size()).divide(new BigDecimal(xcbZc.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); map.put("xcbZcZgl",result.intValue()+"%"); //整改率 }else { map.put("xcbZcZg","0"); map.put("xcbZcWwcZg",xcbZcWc.size()); map.put("xcbZcZgl","0%"); //整改率 } map.put("xcbZcZgZj",zijin); //资金 }else { map.put("xcbZcZs","0"); //总数 map.put("xcbZcZg","0"); //整改数 map.put("xcbZcWwcZg","0"); //整改未完成数 map.put("xcbZcZgl","0%"); //整改率 map.put("xcbZcZgZj","0"); //资金 } //保障部自查数据 List bzbZc = groupByTypeList.get("bzbzc"); if(!Tools.isEmpty(bzbZc)){ map.put("bzbZcZs",bzbZc.size()); //总数 List bzbZcWc = bzbZc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList()); int zijin = bzbZc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum(); if(!Tools.isEmpty(bzbZcWc)){ map.put("bzbZcZg",bzbZcWc.size()); map.put("bzbZcWwcZg",bzbZc.size()-bzbZcWc.size()); BigDecimal result = new BigDecimal(bzbZcWc.size()).divide(new BigDecimal(bzbZc.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); map.put("bzbZcZgl",result.intValue()+"%"); //整改率 }else { map.put("bzbZcZg","0"); map.put("bzbZcWwcZg",bzbZcWc.size()); map.put("bzbZcZgl","0%"); //整改率 } map.put("bzbZcZgZj",zijin); //资金 }else { map.put("bzbZcZs","0"); //总数 map.put("bzbZcZg","0"); //整改数 map.put("bzbZcWwcZg","0"); //整改未完成数 map.put("bzbZcZgl","0%"); //整改率 map.put("bzbZcZgZj","0"); //资金 } //公司查数据 List gscPageDataList = hiddenMapper.getExcelGsc(pageData); //stream分组 Map> groupByTypeGscList = gscPageDataList.stream().collect(Collectors.groupingBy(item->item.getString("type"))); //装船部公司查数据 List zcbGsc = groupByTypeGscList.get("zcbgsc"); if(!Tools.isEmpty(zcbGsc)){ map.put("zcbGscZs",zcbGsc.size()); //总数 List zcbGscWc = zcbGsc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList()); int zijin = zcbGsc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum(); if(!Tools.isEmpty(zcbGscWc)){ map.put("zcbGscZg",zcbGscWc.size()); map.put("zcbGscWwcZg",zcbGsc.size()-zcbGscWc.size()); BigDecimal result = new BigDecimal(zcbGscWc.size()).divide(new BigDecimal(zcbGsc.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); map.put("zcbGscZgl",result.intValue()+"%"); //整改率 }else { map.put("zcbGscZg","0"); map.put("zcbGscWwcZg",zcbGscWc.size()); map.put("zcbGscZgl","0%"); //整改率 } map.put("zcbGscZgZj",zijin); //资金 }else { map.put("zcbGscZs","0"); //总数 map.put("zcbGscZg","0"); //整改数 map.put("zcbGscWwcZg","0"); //整改未完成数 map.put("zcbGscZgl","0%"); //整改率 map.put("zcbGscZgZj","0"); //资金 } //卸车部自查数据 List xcbGsc = groupByTypeGscList.get("xcbgsc"); if(!Tools.isEmpty(xcbGsc)){ map.put("xcbGscZs",xcbGsc.size()); //总数 List xcbGscWc = xcbGsc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList()); int zijin = xcbGsc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum(); if(!Tools.isEmpty(xcbGscWc)){ map.put("xcbGscZg",xcbGscWc.size()); map.put("xcbGscWwcZg",xcbGsc.size()-xcbGscWc.size()); BigDecimal result = new BigDecimal(xcbGscWc.size()).divide(new BigDecimal(xcbGsc.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); map.put("xcbGscZgl",result.intValue()+"%"); //整改率 }else { map.put("xcbGscZg","0"); map.put("xcbGscWwcZg",xcbGscWc.size()); map.put("xcbGscZgl","0%"); //整改率 } map.put("xcbGscZgZj",zijin); //资金 }else { map.put("xcbGscZs","0"); //总数 map.put("xcbGscZg","0"); //整改数 map.put("xcbGscWwcZg","0"); //整改未完成数 map.put("xcbGscZgl","0%"); //整改率 map.put("xcbGscZgZj","0"); //资金 } //保障部自查数据 List bzbGsc = groupByTypeGscList.get("bzbgsc"); if(!Tools.isEmpty(bzbGsc)){ map.put("bzbGscZs",bzbGsc.size()); //总数 List bzbGscWc = bzbGsc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList()); int zijin = bzbGsc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum(); if(!Tools.isEmpty(bzbGscWc)){ map.put("bzbGscZg",bzbGscWc.size()); map.put("bzbGscWwcZg",bzbGsc.size()-bzbGscWc.size()); BigDecimal result = new BigDecimal(bzbGscWc.size()).divide(new BigDecimal(bzbGsc.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); map.put("bzbGscZgl",result.intValue()+"%"); //整改率 }else { map.put("bzbGscZg","0"); map.put("bzbGscWwcZg",bzbGscWc.size()); map.put("bzbGscZgl","0%"); //整改率 } map.put("bzbGscZgZj",zijin); //资金 }else { map.put("bzbGscZs","0"); //总数 map.put("bzbGscZg","0"); //整改数 map.put("bzbGscWwcZg","0"); //整改未完成数 map.put("bzbGscZgl","0%"); //整改率 map.put("bzbGscZgZj","0"); //资金 } // 处理汇总数据 //装船部合计 int zcbHjZs = Integer.parseInt(map.get("zcbZcZs").toString())+Integer.parseInt(map.get("zcbGscZs").toString()); map.put("zcbHjZs",zcbHjZs); //总数 int zcbHjZg = Integer.parseInt(map.get("zcbZcZg").toString())+Integer.parseInt(map.get("zcbGscZg").toString()); map.put("zcbHjZg",zcbHjZg); //整改数 map.put("zcbHjWwcZg",zcbHjZs-zcbHjZg); //整改未完成数 if(BigDecimal.ZERO.compareTo(new BigDecimal(zcbHjZs))<0 && BigDecimal.ZERO.compareTo(new BigDecimal(zcbHjZg))<0){ BigDecimal zcbResult = new BigDecimal(zcbHjZg).divide(new BigDecimal(zcbHjZs), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); map.put("zcbHjZgl",zcbResult.intValue()+"%"); //整改率 }else { map.put("zcbHjZgl","0%"); //整改率 } int zcbHjZgZj = Integer.parseInt(map.get("zcbZcZgZj").toString())+Integer.parseInt(map.get("zcbGscZgZj").toString()); map.put("zcbHjZgZj",zcbHjZgZj); //资金 //卸车部合计 int xcbHjZs = Integer.parseInt(map.get("xcbZcZs").toString())+Integer.parseInt(map.get("xcbGscZs").toString()); map.put("xcbHjZs",xcbHjZs); //总数 int xcbHjZg = Integer.parseInt(map.get("xcbZcZg").toString())+Integer.parseInt(map.get("xcbGscZg").toString()); map.put("xcbHjZg",xcbHjZg); //整改数 map.put("xcbHjWwcZg",xcbHjZs-xcbHjZg); //整改未完成数 if(BigDecimal.ZERO.compareTo(new BigDecimal(xcbHjZg))<0 && BigDecimal.ZERO.compareTo(new BigDecimal(xcbHjZs))<0){ BigDecimal xcbResult = new BigDecimal(xcbHjZg).divide(new BigDecimal(xcbHjZs), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); map.put("xcbHjZgl",xcbResult.intValue()+"%"); //整改率 }else { map.put("xcbHjZgl","0%"); //整改率 } int xcbHjZgZj = Integer.parseInt(map.get("xcbZcZgZj").toString())+Integer.parseInt(map.get("xcbGscZgZj").toString()); map.put("xcbHjZgZj",xcbHjZgZj); //资金 //保障部合计 int bzbHjZs = Integer.parseInt(map.get("bzbZcZs").toString())+Integer.parseInt(map.get("bzbGscZs").toString()); map.put("bzbHjZs",bzbHjZs); //总数 int bzbHjZg = Integer.parseInt(map.get("bzbZcZg").toString())+Integer.parseInt(map.get("bzbGscZg").toString()); map.put("bzbHjZg",bzbHjZg); //整改数 map.put("bzbHjWwcZg",bzbHjZs-bzbHjZg); //整改未完成数 if(BigDecimal.ZERO.compareTo(new BigDecimal(bzbHjZg))<0 && BigDecimal.ZERO.compareTo(new BigDecimal(bzbHjZs))<0){ BigDecimal bzbResult = new BigDecimal(bzbHjZg).divide(new BigDecimal(bzbHjZs), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); map.put("bzbHjZgl",bzbResult.intValue()+"%"); //整改率 }else { map.put("bzbHjZgl","0%"); //整改率 } int bzbHjZgZj = Integer.parseInt(map.get("bzbZcZgZj").toString())+Integer.parseInt(map.get("bzbGscZgZj").toString()); map.put("bzbHjZgZj",bzbHjZgZj); //资金 //安监部合计 int ajbHjZs = Integer.parseInt(map.get("zcbGscZs").toString())+Integer.parseInt(map.get("xcbGscZs").toString())+Integer.parseInt(map.get("bzbGscZs").toString()); int ajbHjZg = Integer.parseInt(map.get("zcbGscZg").toString())+Integer.parseInt(map.get("xcbGscZg").toString())+Integer.parseInt(map.get("bzbGscZg").toString()); map.put("ajbHjZs","本月共检查出安全隐患"+ajbHjZs+"项,已完成整改"+ajbHjZg+"项"); //装船 map.put("ajbZcbGsc","装船部公司检查"+map.get("zcbGscZs").toString()+"项"); map.put("ajbZcbZc","自查"+map.get("zcbZcZs").toString()+"项"); //卸车 map.put("ajbXcbGsc","卸车部公司检查"+map.get("xcbGscZs").toString()+"项"); map.put("ajbXcbZc","自查"+map.get("xcbZcZs").toString()+"项"); //保障 map.put("ajbBzbGsc","保障部公司检查"+map.get("bzbGscZs").toString()+"项"); map.put("ajbBzbZc","自查"+map.get("bzbZcZs").toString()+"项"); return map; } }