补充 机设部 业务部 综合办公室 隐患统计增加统计的内容 导出

0927cmt
dearLin 2024-07-17 15:16:39 +08:00
parent b3ec07ece1
commit e4c1452d25
4 changed files with 225 additions and 38 deletions

View File

@ -1508,13 +1508,13 @@ public class HiddenApiController extends BaseController {
} }
//0716 新加 机设部 业务部 综合办公室 //0716 新加 机设部 业务部 综合办公室
if (StringUtils.equals("599d9bfcf6c44cb0bc553b1b766aebc5", department.getDEPARTMENT_ID())) { if (StringUtils.equals("599d9bfcf6c44cb0bc553b1b766aebc5", department.getDEPARTMENT_ID())) {
businessDepartmentIds = getIdsList(department, ajbdepartmentIds); businessDepartmentIds = getIdsList(department, businessDepartmentIds);
} }
if (StringUtils.equals("31e47797873d4dd3abdbeb0d99a1f138", department.getDEPARTMENT_ID())) { if (StringUtils.equals("31e47797873d4dd3abdbeb0d99a1f138", department.getDEPARTMENT_ID())) {
generalOfficeDepartmentIds = getIdsList(department, ajbdepartmentIds); generalOfficeDepartmentIds = getIdsList(department, generalOfficeDepartmentIds);
} }
if (StringUtils.equals("298b9a63ea704485913c5185545b4c66", department.getDEPARTMENT_ID())) { 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<String> xcbdepartmentIds = new ArrayList<>(); List<String> xcbdepartmentIds = new ArrayList<>();
//安监部 ajb id集合 4c4b7bc93e3347978f5a3e1f0c4a0b56 //安监部 ajb id集合 4c4b7bc93e3347978f5a3e1f0c4a0b56
List<String> ajbdepartmentIds = new ArrayList<>(); List<String> ajbdepartmentIds = new ArrayList<>();
//0716 新加 机设部298b9a63ea704485913c5185545b4c66
List<String> mechanicalDepartmentIds = new ArrayList<>();
// 业务部599d9bfcf6c44cb0bc553b1b766aebc5
List<String> businessDepartmentIds = new ArrayList<>();
// 综合办公室31e47797873d4dd3abdbeb0d99a1f138
List<String> generalOfficeDepartmentIds = new ArrayList<>();
//开始处理数据 扔进对应结合中 //开始处理数据 扔进对应结合中
for (Department department : departments) { for (Department department : departments) {
if (StringUtils.equals("89f3d30c4031432da53b75bed442ced8", department.getDEPARTMENT_ID())) { if (StringUtils.equals("89f3d30c4031432da53b75bed442ced8", department.getDEPARTMENT_ID())) {
@ -1639,6 +1647,16 @@ public class HiddenApiController extends BaseController {
if (StringUtils.equals("4c4b7bc93e3347978f5a3e1f0c4a0b56", department.getDEPARTMENT_ID())) { if (StringUtils.equals("4c4b7bc93e3347978f5a3e1f0c4a0b56", department.getDEPARTMENT_ID())) {
ajbdepartmentIds = getIdsList(department, ajbdepartmentIds); 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"); String type = pd.getString("type");
@ -1693,6 +1711,10 @@ public class HiddenApiController extends BaseController {
pd.put("bzbdepartmentIds", bzbdepartmentIds); pd.put("bzbdepartmentIds", bzbdepartmentIds);
pd.put("xcbdepartmentIds", xcbdepartmentIds); pd.put("xcbdepartmentIds", xcbdepartmentIds);
pd.put("ajbdepartmentIds", ajbdepartmentIds); pd.put("ajbdepartmentIds", ajbdepartmentIds);
pd.put("mechanicalDepartmentIds", mechanicalDepartmentIds);
pd.put("businessDepartmentIds", businessDepartmentIds);
pd.put("generalOfficeDepartmentIds", generalOfficeDepartmentIds);
pd.put("startTime", startTime); pd.put("startTime", startTime);
pd.put("endTime", endTime); pd.put("endTime", endTime);
//这里获取数据 获取指定日期范围内和指定部门集合创建的隐患总数 //这里获取数据 获取指定日期范围内和指定部门集合创建的隐患总数
@ -1718,6 +1740,7 @@ public class HiddenApiController extends BaseController {
map.put("date", "填表日期:" + date); map.put("date", "填表日期:" + date);
//开始执行模板填充数据 //开始执行模板填充数据
String excelFilePath = hiddenCountExcel; // 替换为你的Excel文件路径 String excelFilePath = hiddenCountExcel; // 替换为你的Excel文件路径
//正则 //正则
String regex = "\\{\\{.*?\\}\\}"; String regex = "\\{\\{.*?\\}\\}";
Pattern pattern = Pattern.compile(regex); Pattern pattern = Pattern.compile(regex);

View File

@ -973,6 +973,78 @@ public class HiddenServiceImpl implements HiddenService {
List<PageData> gscPageDataList = hiddenMapper.getExcelGsc(pageData); List<PageData> gscPageDataList = hiddenMapper.getExcelGsc(pageData);
//stream分组 //stream分组
Map<String, List<PageData>> groupByTypeGscList = gscPageDataList.stream().collect(Collectors.groupingBy(item -> item.getString("type"))); Map<String, List<PageData>> groupByTypeGscList = gscPageDataList.stream().collect(Collectors.groupingBy(item -> item.getString("type")));
//机设部
List<PageData> mechanicalzc = groupByTypeGscList.get("mechanical");
if (!Tools.isEmpty(mechanicalzc)) {
map.put("mechanicalzcGscZs", mechanicalzc.size()); //总数
List<PageData> 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<PageData> businesszc = groupByTypeGscList.get("business");
if (!Tools.isEmpty(businesszc)) {
map.put("businesszcGscZs", businesszc.size()); //总数
List<PageData> 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<PageData> generalOfficezc = groupByTypeGscList.get("generalOffice");
if (!Tools.isEmpty(generalOfficezc)) {
map.put("generalOfficezcGscZs", generalOfficezc.size()); //总数
List<PageData> 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<PageData> zcbGsc = groupByTypeGscList.get("zcbgsc"); List<PageData> zcbGsc = groupByTypeGscList.get("zcbgsc");
if (!Tools.isEmpty(zcbGsc)) { if (!Tools.isEmpty(zcbGsc)) {
@ -1090,8 +1162,19 @@ public class HiddenServiceImpl implements HiddenService {
map.put("bzbHjZgZj", bzbHjZgZj); //资金 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 ajbHjZs = Integer.parseInt(map.get("zcbGscZs").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("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("ajbHjZs", "本月共检查出安全隐患" + ajbHjZs + "项,已完成整改" + ajbHjZg + "项");
//装船 //装船
map.put("ajbZcbGsc", "装船部公司检查" + map.get("zcbGscZs").toString() + "项,已完成" + map.get("zcbGscZg").toString() + "项"); 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("ajbBzbGsc", "保障部公司检查" + map.get("bzbGscZs").toString() + "项,已完成" + map.get("bzbGscZg").toString() + "项");
map.put("ajbBzbZc", "自查" + map.get("bzbZcZs").toString() + "项,已完成" + map.get("bzbZcZg").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 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()); 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("ajbHjZsTable", ajbHjZs);
map.put("ajbHjZgTable", ajbHjZg); map.put("ajbHjZgTable", ajbHjZg);
map.put("allBuMenZs", allBuMenZs); map.put("allBuMenZs", allBuMenZs);

View File

@ -3067,7 +3067,7 @@
h.HIDDEN_ID, h.HIDDEN_ID,
h.STATE, h.STATE,
IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS, IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS,
'mechanical' type 'generalOffice' type
FROM FROM
bus_hidden h bus_hidden h
LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID
@ -3076,11 +3076,11 @@
h.SOURCE != '4' h.SOURCE != '4'
AND h.ISDELETE = '0' AND h.ISDELETE = '0'
AND uu.DEPARTMENT_ID IN AND uu.DEPARTMENT_ID IN
<foreach item="item" index="index" collection="mechanicalDepartmentIds" open="(" separator="," close=")"> <foreach item="item" index="index" collection="generalOfficeDepartmentIds" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
AND u.DEPARTMENT_ID IN AND u.DEPARTMENT_ID IN
<foreach item="item" index="index" collection="mechanicalDepartmentIds" open="(" separator="," close=")"> <foreach item="item" index="index" collection="generalOfficeDepartmentIds" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
and h.CREATTIME <![CDATA[ >= ]]> #{startTime} and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
@ -3113,7 +3113,7 @@
h.HIDDEN_ID, h.HIDDEN_ID,
h.STATE, h.STATE,
IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS, IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS,
'generalOffice' type 'mechanical' type
FROM FROM
bus_hidden h bus_hidden h
LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID
@ -3122,11 +3122,11 @@
h.SOURCE != '4' h.SOURCE != '4'
AND h.ISDELETE = '0' AND h.ISDELETE = '0'
AND uu.DEPARTMENT_ID IN AND uu.DEPARTMENT_ID IN
<foreach item="item" index="index" collection="generalOfficeDepartmentIds" open="(" separator="," close=")"> <foreach item="item" index="index" collection="mechanicalDepartmentIds" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
AND u.DEPARTMENT_ID IN AND u.DEPARTMENT_ID IN
<foreach item="item" index="index" collection="generalOfficeDepartmentIds" open="(" separator="," close=")"> <foreach item="item" index="index" collection="mechanicalDepartmentIds" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
and h.CREATTIME <![CDATA[ >= ]]> #{startTime} and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
@ -3203,6 +3203,75 @@
</foreach> </foreach>
and h.CREATTIME <![CDATA[ >= ]]> #{startTime} and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
and h.CREATTIME <![CDATA[ <= ]]> #{endTime} and h.CREATTIME <![CDATA[ <= ]]> #{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
<foreach item="item" index="index" collection="generalOfficeDepartmentIds" open="(" separator="," close=")">
#{item}
</foreach>
AND u.DEPARTMENT_ID IN
<foreach item="item" index="index" collection="ajbdepartmentIds" open="(" separator="," close=")">
#{item}
</foreach>
and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
and h.CREATTIME <![CDATA[ <= ]]> #{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
<foreach item="item" index="index" collection="businessDepartmentIds" open="(" separator="," close=")">
#{item}
</foreach>
AND u.DEPARTMENT_ID IN
<foreach item="item" index="index" collection="ajbdepartmentIds" open="(" separator="," close=")">
#{item}
</foreach>
and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
and h.CREATTIME <![CDATA[ <= ]]> #{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
<foreach item="item" index="index" collection="mechanicalDepartmentIds" open="(" separator="," close=")">
#{item}
</foreach>
AND u.DEPARTMENT_ID IN
<foreach item="item" index="index" collection="ajbdepartmentIds" open="(" separator="," close=")">
#{item}
</foreach>
and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
and h.CREATTIME <![CDATA[ <= ]]> #{endTime}
</select> </select>
<select id="findForBi" parameterType="pd" resultType="pd"> <select id="findForBi" parameterType="pd" resultType="pd">