diff --git a/src/main/java/com/zcloud/controller/hiddenApi/HiddenApiController.java b/src/main/java/com/zcloud/controller/hiddenApi/HiddenApiController.java index 35167dbd..069ad5a6 100644 --- a/src/main/java/com/zcloud/controller/hiddenApi/HiddenApiController.java +++ b/src/main/java/com/zcloud/controller/hiddenApi/HiddenApiController.java @@ -1508,13 +1508,13 @@ public class HiddenApiController extends BaseController { } //0716 新加 机设部 业务部 综合办公室 if (StringUtils.equals("599d9bfcf6c44cb0bc553b1b766aebc5", department.getDEPARTMENT_ID())) { - businessDepartmentIds = getIdsList(department, ajbdepartmentIds); + businessDepartmentIds = getIdsList(department, businessDepartmentIds); } if (StringUtils.equals("31e47797873d4dd3abdbeb0d99a1f138", department.getDEPARTMENT_ID())) { - generalOfficeDepartmentIds = getIdsList(department, ajbdepartmentIds); + generalOfficeDepartmentIds = getIdsList(department, generalOfficeDepartmentIds); } if (StringUtils.equals("298b9a63ea704485913c5185545b4c66", department.getDEPARTMENT_ID())) { - generalOfficeDepartmentIds = getIdsList(department, ajbdepartmentIds); + mechanicalDepartmentIds = getIdsList(department, mechanicalDepartmentIds); } } //处理日期 类型 年 季度 月 @@ -1625,6 +1625,14 @@ public class HiddenApiController extends BaseController { List xcbdepartmentIds = new ArrayList<>(); //安监部 ajb id集合 4c4b7bc93e3347978f5a3e1f0c4a0b56 List ajbdepartmentIds = new ArrayList<>(); + //0716 新加 机设部298b9a63ea704485913c5185545b4c66 + List mechanicalDepartmentIds = new ArrayList<>(); + // 业务部599d9bfcf6c44cb0bc553b1b766aebc5 + List businessDepartmentIds = new ArrayList<>(); + // 综合办公室31e47797873d4dd3abdbeb0d99a1f138 + List generalOfficeDepartmentIds = new ArrayList<>(); + + //开始处理数据 扔进对应结合中 for (Department department : departments) { if (StringUtils.equals("89f3d30c4031432da53b75bed442ced8", department.getDEPARTMENT_ID())) { @@ -1639,6 +1647,16 @@ public class HiddenApiController extends BaseController { if (StringUtils.equals("4c4b7bc93e3347978f5a3e1f0c4a0b56", department.getDEPARTMENT_ID())) { ajbdepartmentIds = getIdsList(department, ajbdepartmentIds); } + //0716 新加 机设部 业务部 综合办公室 + if (StringUtils.equals("599d9bfcf6c44cb0bc553b1b766aebc5", department.getDEPARTMENT_ID())) { + businessDepartmentIds = getIdsList(department, businessDepartmentIds); + } + if (StringUtils.equals("31e47797873d4dd3abdbeb0d99a1f138", department.getDEPARTMENT_ID())) { + generalOfficeDepartmentIds = getIdsList(department, generalOfficeDepartmentIds); + } + if (StringUtils.equals("298b9a63ea704485913c5185545b4c66", department.getDEPARTMENT_ID())) { + mechanicalDepartmentIds = getIdsList(department, mechanicalDepartmentIds); + } } //处理日期 类型 年 季度 月 String type = pd.getString("type"); @@ -1693,6 +1711,10 @@ public class HiddenApiController extends BaseController { pd.put("bzbdepartmentIds", bzbdepartmentIds); pd.put("xcbdepartmentIds", xcbdepartmentIds); pd.put("ajbdepartmentIds", ajbdepartmentIds); + + pd.put("mechanicalDepartmentIds", mechanicalDepartmentIds); + pd.put("businessDepartmentIds", businessDepartmentIds); + pd.put("generalOfficeDepartmentIds", generalOfficeDepartmentIds); pd.put("startTime", startTime); pd.put("endTime", endTime); //这里获取数据 获取指定日期范围内和指定部门集合创建的隐患总数 @@ -1718,6 +1740,7 @@ public class HiddenApiController extends BaseController { map.put("date", "填表日期:" + date); //开始执行模板填充数据 String excelFilePath = hiddenCountExcel; // 替换为你的Excel文件路径 + //正则 String regex = "\\{\\{.*?\\}\\}"; Pattern pattern = Pattern.compile(regex); diff --git a/src/main/java/com/zcloud/service/bus/impl/HiddenServiceImpl.java b/src/main/java/com/zcloud/service/bus/impl/HiddenServiceImpl.java index c0774071..4de3a250 100644 --- a/src/main/java/com/zcloud/service/bus/impl/HiddenServiceImpl.java +++ b/src/main/java/com/zcloud/service/bus/impl/HiddenServiceImpl.java @@ -822,31 +822,31 @@ public class HiddenServiceImpl implements HiddenService { //businessDepartmentIds //generalOfficeDepartmentIds // ---------------------- - // 综合办公室 - List generalOffice = groupByTypeList.get("generalOffice"); - if (!Tools.isEmpty(generalOffice)) { - map.put("generalOfficeZcZs", generalOffice.size()); //总数 - List zcbZcWc = generalOffice.stream().filter(item -> StringUtils.equals("4", item.getString("STATE"))).collect(Collectors.toList()); - int zijin = generalOffice.stream().filter(item -> item.getString("INVESTMENT_FUNDS").matches("\\d+")).mapToInt(item -> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum(); - if (!Tools.isEmpty(zcbZcWc)) { - map.put("generalOfficeZcZg", zcbZcWc.size()); - map.put("generalOfficeZcWwcZg", generalOffice.size() - zcbZcWc.size()); - BigDecimal result = new BigDecimal(zcbZcWc.size()).divide(new BigDecimal(generalOffice.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); - map.put("generalOfficeZcZgl", result.intValue() + "%"); //整改率 - } else { - map.put("generalOfficeZcZg", "0"); - map.put("generalOfficeWwcZg", zcbZcWc.size()); - map.put("generalOfficeZcZgl", "0%"); //整改率 - } - map.put("generalOfficeZcZgZj", zijin); //资金 - } else { - map.put("generalOfficeZcZs", "0"); //总数 - map.put("generalOfficeZcZg", "0"); //整改数 - map.put("generalOfficeZcWwcZg", "0"); //整改未完成数 - map.put("generalOfficeZcZgl", "0%"); //整改率 - map.put("generalOfficeZcZgZj", "0"); //资金 - } - // 业务部 + // 综合办公室 + List generalOffice = groupByTypeList.get("generalOffice"); + if (!Tools.isEmpty(generalOffice)) { + map.put("generalOfficeZcZs", generalOffice.size()); //总数 + List zcbZcWc = generalOffice.stream().filter(item -> StringUtils.equals("4", item.getString("STATE"))).collect(Collectors.toList()); + int zijin = generalOffice.stream().filter(item -> item.getString("INVESTMENT_FUNDS").matches("\\d+")).mapToInt(item -> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum(); + if (!Tools.isEmpty(zcbZcWc)) { + map.put("generalOfficeZcZg", zcbZcWc.size()); + map.put("generalOfficeZcWwcZg", generalOffice.size() - zcbZcWc.size()); + BigDecimal result = new BigDecimal(zcbZcWc.size()).divide(new BigDecimal(generalOffice.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); + map.put("generalOfficeZcZgl", result.intValue() + "%"); //整改率 + } else { + map.put("generalOfficeZcZg", "0"); + map.put("generalOfficeWwcZg", zcbZcWc.size()); + map.put("generalOfficeZcZgl", "0%"); //整改率 + } + map.put("generalOfficeZcZgZj", zijin); //资金 + } else { + map.put("generalOfficeZcZs", "0"); //总数 + map.put("generalOfficeZcZg", "0"); //整改数 + map.put("generalOfficeZcWwcZg", "0"); //整改未完成数 + map.put("generalOfficeZcZgl", "0%"); //整改率 + map.put("generalOfficeZcZgZj", "0"); //资金 + } + // 业务部 List business = groupByTypeList.get("business"); if (!Tools.isEmpty(business)) { map.put("businessZcZs", business.size()); //总数 @@ -973,6 +973,78 @@ public class HiddenServiceImpl implements HiddenService { List gscPageDataList = hiddenMapper.getExcelGsc(pageData); //stream分组 Map> groupByTypeGscList = gscPageDataList.stream().collect(Collectors.groupingBy(item -> item.getString("type"))); + //机设部 + List mechanicalzc = groupByTypeGscList.get("mechanical"); + if (!Tools.isEmpty(mechanicalzc)) { + map.put("mechanicalzcGscZs", mechanicalzc.size()); //总数 + List zcbGscWc = mechanicalzc.stream().filter(item -> StringUtils.equals("4", item.getString("STATE"))).collect(Collectors.toList()); + int zijin = mechanicalzc.stream().filter(item -> item.getString("INVESTMENT_FUNDS").matches("\\d+")).mapToInt(item -> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum(); + if (!Tools.isEmpty(zcbGscWc)) { + map.put("mechanicalzcGscZg", zcbGscWc.size()); + map.put("mechanicalzcGscWwcZg", mechanicalzc.size() - zcbGscWc.size()); + BigDecimal result = new BigDecimal(zcbGscWc.size()).divide(new BigDecimal(mechanicalzc.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); + map.put("mechanicalzcZgl", result.intValue() + "%"); //整改率 + } else { + map.put("mechanicalzcGscZg", "0"); + map.put("mechanicalzcGscWwcZg", zcbGscWc.size()); + map.put("mechanicalzcGscZgl", "0%"); //整改率 + } + map.put("mechanicalzcGscZgZj", zijin); //资金 + } else { + map.put("mechanicalzcGscZs", "0"); //总数 + map.put("mechanicalzcGscZg", "0"); //整改数 + map.put("mechanicalzcGscWwcZg", "0"); //整改未完成数 + map.put("mechanicalzcGscZgl", "0%"); //整改率 + map.put("mechanicalzcGscZgZj", "0"); //资金 + } + //业务部 + List businesszc = groupByTypeGscList.get("business"); + if (!Tools.isEmpty(businesszc)) { + map.put("businesszcGscZs", businesszc.size()); //总数 + List zcbGscWc = businesszc.stream().filter(item -> StringUtils.equals("4", item.getString("STATE"))).collect(Collectors.toList()); + int zijin = businesszc.stream().filter(item -> item.getString("INVESTMENT_FUNDS").matches("\\d+")).mapToInt(item -> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum(); + if (!Tools.isEmpty(zcbGscWc)) { + map.put("businesszcGscZg", zcbGscWc.size()); + map.put("businesszcGscWwcZg", businesszc.size() - zcbGscWc.size()); + BigDecimal result = new BigDecimal(zcbGscWc.size()).divide(new BigDecimal(businesszc.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); + map.put("businesszcZgl", result.intValue() + "%"); //整改率 + } else { + map.put("businesszcGscZg", "0"); + map.put("businesszcGscWwcZg", zcbGscWc.size()); + map.put("businesszcGscZgl", "0%"); //整改率 + } + map.put("businesszcGscZgZj", zijin); //资金 + } else { + map.put("businesszcGscZs", "0"); //总数 + map.put("businesszcGscZg", "0"); //整改数 + map.put("businesszcGscWwcZg", "0"); //整改未完成数 + map.put("businesszcGscZgl", "0%"); //整改率 + map.put("businesszcGscZgZj", "0"); //资金 + } + //综合办公室 + List generalOfficezc = groupByTypeGscList.get("generalOffice"); + if (!Tools.isEmpty(generalOfficezc)) { + map.put("generalOfficezcGscZs", generalOfficezc.size()); //总数 + List zcbGscWc = generalOfficezc.stream().filter(item -> StringUtils.equals("4", item.getString("STATE"))).collect(Collectors.toList()); + int zijin = generalOfficezc.stream().filter(item -> item.getString("INVESTMENT_FUNDS").matches("\\d+")).mapToInt(item -> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum(); + if (!Tools.isEmpty(zcbGscWc)) { + map.put("generalOfficezcGscZg", zcbGscWc.size()); + map.put("generalOfficezcGscWwcZg", generalOfficezc.size() - zcbGscWc.size()); + BigDecimal result = new BigDecimal(zcbGscWc.size()).divide(new BigDecimal(generalOfficezc.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); + map.put("generalOfficezcZgl", result.intValue() + "%"); //整改率 + } else { + map.put("generalOfficezcGscZg", "0"); + map.put("generalOfficezcGscWwcZg", zcbGscWc.size()); + map.put("generalOfficezcGscZgl", "0%"); //整改率 + } + map.put("generalOfficezcGscZgZj", zijin); //资金 + } else { + map.put("generalOfficezcGscZs", "0"); //总数 + map.put("generalOfficezcGscZg", "0"); //整改数 + map.put("generalOfficezcGscWwcZg", "0"); //整改未完成数 + map.put("generalOfficezcGscZgl", "0%"); //整改率 + map.put("generalOfficezcGscZgZj", "0"); //资金 + } //装船部公司查数据 List zcbGsc = groupByTypeGscList.get("zcbgsc"); if (!Tools.isEmpty(zcbGsc)) { @@ -1090,8 +1162,19 @@ public class HiddenServiceImpl implements HiddenService { 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()); + int ajbHjZs = Integer.parseInt(map.get("zcbGscZs").toString()) + + Integer.parseInt(map.get("xcbGscZs").toString()) + + Integer.parseInt(map.get("bzbGscZs").toString()) + + Integer.parseInt(map.get("businesszcGscZs").toString()) + + Integer.parseInt(map.get("mechanicalzcGscZs").toString()) + + Integer.parseInt(map.get("generalOfficezcGscZs").toString()) + ; + int ajbHjZg = Integer.parseInt(map.get("zcbGscZg").toString()) + Integer.parseInt(map.get("xcbGscZg").toString()) + + Integer.parseInt(map.get("bzbGscZg").toString()) + + Integer.parseInt(map.get("generalOfficezcGscZg").toString()) + + Integer.parseInt(map.get("businesszcGscZg").toString()) + + Integer.parseInt(map.get("mechanicalzcGscZg").toString()) + ; map.put("ajbHjZs", "本月共检查出安全隐患" + ajbHjZs + "项,已完成整改" + ajbHjZg + "项"); //装船 map.put("ajbZcbGsc", "装船部公司检查" + map.get("zcbGscZs").toString() + "项,已完成" + map.get("zcbGscZg").toString() + "项"); @@ -1102,9 +1185,21 @@ public class HiddenServiceImpl implements HiddenService { //保障 map.put("ajbBzbGsc", "保障部公司检查" + map.get("bzbGscZs").toString() + "项,已完成" + map.get("bzbGscZg").toString() + "项"); map.put("ajbBzbZc", "自查" + map.get("bzbZcZs").toString() + "项,已完成" + map.get("bzbZcZg").toString() + "项"); + // ---------------------- + // 业务 + map.put("businessGsc", "业务部公司检查" + map.get("businesszcGscZs").toString() + "项,已完成" + map.get("businesszcGscZg").toString() + "项"); + map.put("businessZc", "自查" + map.get("businessZcZs").toString() + "项,已完成" + map.get("businessZcZg").toString() + "项"); + // 机设 + map.put("mechanicalGsc", "技术设备部公司检查" + map.get("mechanicalzcGscZs").toString() + "项,已完成" + map.get("mechanicalzcGscZg").toString() + "项"); + map.put("mechanicalZc", "自查" + map.get("mechanicalZcZs").toString() + "项,已完成" + map.get("mechanicalZcZg").toString() + "项"); + // 办公室 + map.put("generalOfficeGsc", "综合办公室公司检查" + map.get("generalOfficezcGscZs").toString() + "项,已完成" + map.get("generalOfficezcGscZg").toString() + "项"); + map.put("generalOfficeZc", "自查" + map.get("generalOfficeZcZs").toString() + "项,已完成" + map.get("generalOfficeZcZg").toString() + "项"); + // ---------------------- + //各部门合计 - int allBuMenZs = Integer.parseInt(map.get("zcbZcZs").toString()) + Integer.parseInt(map.get("xcbZcZs").toString()) + Integer.parseInt(map.get("bzbZcZs").toString()); - int allBuMenHjZg = Integer.parseInt(map.get("zcbZcZg").toString()) + Integer.parseInt(map.get("xcbZcZg").toString()) + Integer.parseInt(map.get("bzbZcZg").toString()); + int allBuMenZs = Integer.parseInt(map.get("zcbZcZs").toString()) + Integer.parseInt(map.get("xcbZcZs").toString()) + Integer.parseInt(map.get("bzbZcZs").toString()) + Integer.parseInt(map.get("generalOfficeZcZs").toString()) + Integer.parseInt(map.get("businessZcZs").toString()) + Integer.parseInt(map.get("mechanicalZcZs").toString()); + int allBuMenHjZg = Integer.parseInt(map.get("zcbZcZg").toString()) + Integer.parseInt(map.get("xcbZcZg").toString()) + Integer.parseInt(map.get("bzbZcZg").toString()) + Integer.parseInt(map.get("generalOfficeZcZg").toString()) + Integer.parseInt(map.get("businessZcZg").toString()) + Integer.parseInt(map.get("mechanicalZcZg").toString()); map.put("ajbHjZsTable", ajbHjZs); map.put("ajbHjZgTable", ajbHjZg); map.put("allBuMenZs", allBuMenZs); diff --git a/src/main/resources/mybatis/datasource/bus/HiddenMapper.xml b/src/main/resources/mybatis/datasource/bus/HiddenMapper.xml index b45eb49a..db28fa9b 100644 --- a/src/main/resources/mybatis/datasource/bus/HiddenMapper.xml +++ b/src/main/resources/mybatis/datasource/bus/HiddenMapper.xml @@ -3067,7 +3067,7 @@ h.HIDDEN_ID, h.STATE, IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS, - 'mechanical' type + 'generalOffice' type FROM bus_hidden h LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID @@ -3076,11 +3076,11 @@ h.SOURCE != '4' AND h.ISDELETE = '0' AND uu.DEPARTMENT_ID IN - + #{item} AND u.DEPARTMENT_ID IN - + #{item} and h.CREATTIME = ]]> #{startTime} @@ -3113,7 +3113,7 @@ h.HIDDEN_ID, h.STATE, IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS, - 'generalOffice' type + 'mechanical' type FROM bus_hidden h LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID @@ -3122,11 +3122,11 @@ h.SOURCE != '4' AND h.ISDELETE = '0' AND uu.DEPARTMENT_ID IN - + #{item} AND u.DEPARTMENT_ID IN - + #{item} and h.CREATTIME = ]]> #{startTime} @@ -3203,6 +3203,75 @@ and h.CREATTIME = ]]> #{startTime} and h.CREATTIME #{endTime} + UNION ALL + SELECT + h.HIDDEN_ID, + h.STATE, + IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS, + 'generalOffice' type + FROM + bus_hidden h + LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID + LEFT JOIN sys_user uu ON h.RECTIFICATIONOR = uu.USER_ID + WHERE + h.SOURCE != '4' + AND h.ISDELETE = '0' + AND uu.DEPARTMENT_ID IN + + #{item} + + AND u.DEPARTMENT_ID IN + + #{item} + + and h.CREATTIME = ]]> #{startTime} + and h.CREATTIME #{endTime} + UNION ALL + SELECT + h.HIDDEN_ID, + h.STATE, + IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS, + 'business' type + FROM + bus_hidden h + LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID + LEFT JOIN sys_user uu ON h.RECTIFICATIONOR = uu.USER_ID + WHERE + h.SOURCE != '4' + AND h.ISDELETE = '0' + AND uu.DEPARTMENT_ID IN + + #{item} + + AND u.DEPARTMENT_ID IN + + #{item} + + and h.CREATTIME = ]]> #{startTime} + and h.CREATTIME #{endTime} + UNION ALL + SELECT + h.HIDDEN_ID, + h.STATE, + IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS, + 'mechanical' type + FROM + bus_hidden h + LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID + LEFT JOIN sys_user uu ON h.RECTIFICATIONOR = uu.USER_ID + WHERE + h.SOURCE != '4' + AND h.ISDELETE = '0' + AND uu.DEPARTMENT_ID IN + + #{item} + + AND u.DEPARTMENT_ID IN + + #{item} + + and h.CREATTIME = ]]> #{startTime} + and h.CREATTIME #{endTime}