diff --git a/src/main/java/com/zcloud/controller/statisticsdata/StatisticsDataController.java b/src/main/java/com/zcloud/controller/statisticsdata/StatisticsDataController.java index 5d046d49..6647e3c9 100644 --- a/src/main/java/com/zcloud/controller/statisticsdata/StatisticsDataController.java +++ b/src/main/java/com/zcloud/controller/statisticsdata/StatisticsDataController.java @@ -92,16 +92,16 @@ public class StatisticsDataController extends BaseController { Map corp = new HashMap<>(); //部门 List userCount = usersService.statisticsByCorp(pd); - corp.put("USERCOUNT", userCount.get(0).get("COUNT")); //人员总数 - corp.put("USERCHECKCOUNT", userCount.get(1).get("COUNT")); //人员总数 + corp.put("USERCOUNT", userCount.get(0).get("COUNT")); //人员总数 + corp.put("USERCHECKCOUNT", userCount.get(1).get("COUNT")); //人员总数 //部门 - List deptCount = departmentService.statisticsByCorp(pd); - corp.put("DEPTCOUNT", deptCount.get(0).get("COUNT")); //人员总数 - corp.put("DEPTCHECKCOUNT", deptCount.get(1).get("COUNT")); //人员总数 + List deptCount = departmentService.statisticsByCorp(pd); + corp.put("DEPTCOUNT", deptCount.get(0).get("COUNT")); //人员总数 + corp.put("DEPTCHECKCOUNT", deptCount.get(1).get("COUNT")); //人员总数 //清单 - List listCount = listmanagerService.statisticsByCorp(pd); //列出ListManager列表 - corp.put("LISTCOUNT", listCount.get(0).get("COUNT")); //人员总数 - corp.put("LISTCHECKCOUNT", listCount.get(1).get("COUNT")); //人员总数 + List listCount = listmanagerService.statisticsByCorp(pd); //列出ListManager列表 + corp.put("LISTCOUNT", listCount.get(0).get("COUNT")); //人员总数 + corp.put("LISTCHECKCOUNT", listCount.get(1).get("COUNT")); //人员总数 map.put("corp", corp); map.put("result", errInfo); @@ -120,7 +120,7 @@ public class StatisticsDataController extends BaseController { Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); - pd.put("CORPINFO_ID",CORPINFO_ID); + pd.put("CORPINFO_ID", CORPINFO_ID); //清单类型占比统计 List chartData = listmanagerService.statisticsGroupType(pd); @@ -151,9 +151,9 @@ public class StatisticsDataController extends BaseController { for (int i = 0; i < legendData.size(); i++) { PageData pd = new PageData(); pd.put("CORPINFO_ID", CORPINFO_ID); - pd.put("STATENAME",legendData.get(i)); + pd.put("STATENAME", legendData.get(i)); List data = new ArrayList(); - List hdRecChart = hiddenService.statisticsGroupMonthByState(pd); //根据状态按时间分组统计隐患数据 + List hdRecChart = hiddenService.statisticsGroupMonthByState(pd); //根据状态按时间分组统计隐患数据 for (int j = 0; j < halfYearMonth.size(); j++) { boolean flag = true; for (int k = 0; k < hdRecChart.size(); k++) { @@ -191,18 +191,18 @@ public class StatisticsDataController extends BaseController { PageData pd = this.getPageData(); pd.put("CORPINFO_ID", CORPINFO_ID); Map chartData = new HashMap(); - List deptList = riskpointService.listDeptByPoint(pd); + List deptList = riskpointService.listDeptByPoint(pd); List yAxisData = new ArrayList(); - for(PageData d :deptList){ + for (PageData d : deptList) { PageData pdf = new PageData(); yAxisData.add(d.getString("DEPT_NAME")); } chartData.put("yAxisData", yAxisData); - List varList = dictionariesService.listSubDictByParentId("5a81e63ec0e94d919b3138bc01dbef6b"); + List varList = dictionariesService.listSubDictByParentId("5a81e63ec0e94d919b3138bc01dbef6b"); List legendData = new ArrayList(); List seriesData = new ArrayList(); - for(Dictionaries d :varList){ + for (Dictionaries d : varList) { PageData pdf = new PageData(); legendData.add(d.getNAME()); seriesData.add(new ArrayList()); @@ -211,8 +211,8 @@ public class StatisticsDataController extends BaseController { //隐患整改趋势(近半年) for (int i = 0; i < deptList.size(); i++) { PageData dept = new PageData(); - dept.put("DEPARTMENT_ID",deptList.get(i).getString("DEPARTMENT_ID")); - List dataChart = riskpointService.statisticsGroupLevelByDept(dept); //按照级别分类统计各部门风险管控数据 + dept.put("DEPARTMENT_ID", deptList.get(i).getString("DEPARTMENT_ID")); + List dataChart = riskpointService.statisticsGroupLevelByDept(dept); //按照级别分类统计各部门风险管控数据 for (int j = 0; j < varList.size(); j++) { List secondList = (List) seriesData.get(j); secondList.add(i, dataChart.get(j).getString("COUNT")); @@ -294,7 +294,7 @@ public class StatisticsDataController extends BaseController { List seriesData2 = new ArrayList(); List seriesData3 = new ArrayList(); - List disposalChart = majordangersourceDisposalService.statisticsGroupMajordangersource(pd); //根据重大危险源分组统计报警处置情况 + List disposalChart = majordangersourceDisposalService.statisticsGroupMajordangersource(pd); //根据重大危险源分组统计报警处置情况 List seriesData = new ArrayList(); for (PageData data : disposalChart) { xAxisData.add(data.getString("MAJORDANGERSOURCE_NAME")); @@ -330,7 +330,7 @@ public class StatisticsDataController extends BaseController { Map chartData = new HashMap(); List legendData = Arrays.asList(new String[]{"动火作业", "临时用电作业", "盲板作业", "高处作业", "有限空间作业", "吊装作业"}); - List workChart = highworkService.statisticsAllHighRiskWork(pd); //统计高危作业里各作业数 + List workChart = highworkService.statisticsAllHighRiskWork(pd); //统计高危作业里各作业数 List seriesData = new ArrayList(); for (int i = 0; i < legendData.size(); i++) { PageData pie = new PageData(); @@ -345,27 +345,29 @@ public class StatisticsDataController extends BaseController { return map; } - /**数据可视化平台首页获取 + /** + * 数据可视化平台首页获取 * 1.获取企业的置顶视频 * 2.获取管理的置顶视频 * 3.没有视频或者没有置顶视频 + * * @param * @throws Exception */ - @RequestMapping(value="/getObjectForBiLogin") + @RequestMapping(value = "/getObjectForBiLogin") @ResponseBody - public Object getObjectForBiLogin() throws Exception{ - Map map = new HashMap(); + public Object getObjectForBiLogin() throws Exception { + Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd.put("TYPE", "1"); pd.put("CORPINFO_TYPE", "1"); pd.put("CORPINFO_ID", CORPINFO_ID); - List cpvarList = videoService.listAll(pd); //企业视频 + List cpvarList = videoService.listAll(pd); //企业视频 pd = new PageData(); pd.put("CORPINFO_TYPE", "2"); pd.put("TYPE", "1"); - List ptVarList = videoService.listAll(pd); //平台视频 + List ptVarList = videoService.listAll(pd); //平台视频 map.put("ptVarList", ptVarList); map.put("cpvarList", cpvarList); @@ -373,17 +375,19 @@ public class StatisticsDataController extends BaseController { return map; } - /**获取重大危险源数据 + /** + * 获取重大危险源数据 + * * @param * @throws Exception */ - @RequestMapping(value="/findValidateData") + @RequestMapping(value = "/findValidateData") @ResponseBody - public Object findValidateData() throws Exception{ - Map map = new HashMap(); + public Object findValidateData() throws Exception { + Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); - List varList = majordangersourcedisposalService.listAll(pd); //根据ID读取 + List varList = majordangersourcedisposalService.listAll(pd); //根据ID读取 map.put("varList", varList); map.put("result", errInfo); return map; @@ -654,17 +658,19 @@ public class StatisticsDataController extends BaseController { return lastDayOfMonth; } - /**首页 获取折线图 + /** + * 首页 获取折线图 + * * @param * @throws Exception */ - @RequestMapping(value="/listmanagerIndexCount") + @RequestMapping(value = "/listmanagerIndexCount") @ResponseBody - public Object listmanagerIndexCount() throws Exception{ - Map map = new HashMap(); + public Object listmanagerIndexCount() throws Exception { + Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); - pd.put("CORPINFO_ID", CORPINFO_ID); //企业 + pd.put("CORPINFO_ID", CORPINFO_ID); //企业 List valList = listmanagerService.goIndexCount(pd); List valList1 = new ArrayList(); @@ -672,30 +678,30 @@ public class StatisticsDataController extends BaseController { // {months: "2022-06", count: 0, screenType: "riskChecklistType0001"} // 6 * 3 近6個月 ,3 三种类型 - Map monSCrMap = new HashMap<>(); - for (PageData pageData : valList){ - String key = pageData.getString("months")+"*"+pageData.getString("screenType"); - monSCrMap.put(key,pageData.getString("count")); + Map monSCrMap = new HashMap<>(); + for (PageData pageData : valList) { + String key = pageData.getString("months") + "*" + pageData.getString("screenType"); + monSCrMap.put(key, pageData.getString("count")); } List halfYearMonth = DateUtil.getHalfYearMonth(true); - String [] typeAll = new String[]{"riskChecklistType0001","riskChecklistType0002","zhqd03"}; + String[] typeAll = new String[]{"riskChecklistType0001", "riskChecklistType0002", "zhqd03"}; - List> list = new ArrayList<>(); // 整理完成的数据 size 6 * 3 - for(String month : halfYearMonth){ - for (String type : typeAll){ + List> list = new ArrayList<>(); // 整理完成的数据 size 6 * 3 + for (String month : halfYearMonth) { + for (String type : typeAll) { String count = "0"; - String key = month +"*" + type; - if (monSCrMap.containsKey(key)){ + String key = month + "*" + type; + if (monSCrMap.containsKey(key)) { count = monSCrMap.get(key); } - Map monAndType = new HashMap<>(); - monAndType.put("months",month); - monAndType.put("screenType",type); - monAndType.put("count",count); + Map monAndType = new HashMap<>(); + monAndType.put("months", month); + monAndType.put("screenType", type); + monAndType.put("count", count); list.add(monAndType); } } @@ -867,20 +873,22 @@ public class StatisticsDataController extends BaseController { return map; } - /**平台公告 + /** + * 平台公告 + * * @param page * @throws Exception */ - @RequestMapping(value="/listByIndex") + @RequestMapping(value = "/listByIndex") @ResponseBody - public Object listByIndex(Page page) throws Exception{ - Map map = new HashMap(); + public Object listByIndex(Page page) throws Exception { + Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); //获取发布给这个企业的信息 pd.put("CORP_INFO_ID", CORPINFO_ID); page.setPd(pd); - List varList = noticeService.getNotAndCorpByCorpId(page); + List varList = noticeService.getNotAndCorpByCorpId(page); map.put("varList", varList); map.put("page", page); @@ -888,21 +896,23 @@ public class StatisticsDataController extends BaseController { return map; } - /**企业公告 + /** + * 企业公告 + * * @param page * @throws Exception */ - @RequestMapping(value="/enterpriseListByIndex") + @RequestMapping(value = "/enterpriseListByIndex") @ResponseBody - public Object enterpriseListByIndex(Page page) throws Exception{ - Map map = new HashMap(); + public Object enterpriseListByIndex(Page page) throws Exception { + Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); - String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 - if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); + String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 + if (Tools.notEmpty(KEYWORDS)) pd.put("KEYWORDS", KEYWORDS.trim()); pd.put("USER_ID", USER_ID); page.setPd(pd); - List varList = noticecorpService.listByIndex(page); //列出NOTICECORP列表 + List varList = noticecorpService.listByIndex(page); //列出NOTICECORP列表 map.put("varList", varList); map.put("page", page); map.put("result", errInfo); @@ -910,35 +920,37 @@ public class StatisticsDataController extends BaseController { } - /**清單列表 + /** + * 清單列表 + * * @param * @throws Exception */ - @RequestMapping(value="/checkListIndex") + @RequestMapping(value = "/checkListIndex") @ResponseBody - public Object checkListIndex() throws Exception{ - Map map = new HashMap(); + public Object checkListIndex() throws Exception { + Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); - pd.put("CORPINFO_ID", CORPINFO_ID); //企业 - pd.put("USER_ID",USER_ID); + pd.put("CORPINFO_ID", CORPINFO_ID); //企业 + pd.put("USER_ID", USER_ID); pd.put("DEPARTMENT_ID", DEPT_ID); - pd.put("USER_ID",""); - List varList = listmanagerService.listAll(pd); //列出ListManager列表 + pd.put("USER_ID", ""); + List varList = listmanagerService.listAll(pd); //列出ListManager列表 int wjcNum = 0; int yjcNum = 0; for (PageData list : varList) { - if(list.getString("TYPE").equals("listType0005")) { - if(Integer.parseInt(list.get("checkCount").toString()) > 0) { + if (list.getString("TYPE").equals("listType0005")) { + if (Integer.parseInt(list.get("checkCount").toString()) > 0) { yjcNum++; } else { wjcNum++; } continue; } - if(Integer.parseInt(list.get("checkCount").toString()) > 0) { + if (Integer.parseInt(list.get("checkCount").toString()) > 0) { yjcNum++; } else { wjcNum++; @@ -951,5 +963,278 @@ public class StatisticsDataController extends BaseController { return map; } + /** + *

隐患处理

+ * + *

+ * 数据可视化/任务处理情况/隐患处理 + *

+ * + * @Data 2024年9月30日 + */ + @RequestMapping(value = "/getBICount") + @ResponseBody + public Object getBICount() throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + PageData pd = this.getPageData(); + pd.put("CORPINFO_ID", CORPINFO_ID); + // 旬 + if (pd.get("IS_XUN") != null && Tools.notEmpty(pd.get("IS_XUN").toString())) { + // 1-10 + if (DateUtil.timeCalendar(new Date(), + DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "01 00:00:00"), + DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "10 23:59:59"))) { + pd.put("STARTTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "01 00:00:00"); + pd.put("ENDTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "10 23:59:59"); + } + // 10-20 + if (DateUtil.timeCalendar(new Date(), + DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "11 00:00:00"), + DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "20 23:59:59"))) { + pd.put("STARTTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "11 00:00:00"); + pd.put("ENDTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "20 23:59:59"); + } + // 20-月底 + if (DateUtil.timeCalendar(new Date(), + DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "21 00:00:00"), + DateUtil.fomatDateTime(DateUtil.getMonthEndDay() + " 23:59:59"))) { + pd.put("STARTTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "21 00:00:00"); + pd.put("ENDTIME", DateUtil.getMonthEndDay() + " 23:59:59"); + } + } + // 季度 + if (pd.get("IS_QUARTER") != null && Tools.notEmpty(pd.get("IS_QUARTER").toString())) { + pd.put("STARTTIME", DateUtil.quarterStart() + " 00:00:00"); + pd.put("ENDTIME", DateUtil.quarterEnd() + " 23:59:59"); + } + List varList = hiddenService.getBICount(pd); + if (varList != null && !varList.isEmpty()) { + map.put("total", varList.size()); + int checked = 0; + int uncheck = 0; + for (PageData hidden : varList) { + if (hidden.get("STATE").toString().equals("4") || hidden.get("STATE").toString().equals("15") || hidden.get("STATE").toString().equals("5") || hidden.get("STATE").toString().equals("6")) { + checked++; + } else { + uncheck++; + } + + } + map.put("checked", checked); + map.put("uncheck", uncheck); + } else { + map.put("total", 0); + map.put("checked", 0); + map.put("uncheck", 0); + } + + map.put("result", errInfo); + return map; + } + + /** + *

日常检查

+ * + *

数据可视化/任务处理情况/日常检查

+ */ + @RequestMapping(value = "/goBiListCount") + @ResponseBody + public Object goBiListCount() throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + PageData pd = this.getPageData(); + pd.put("CORPINFO_ID", CORPINFO_ID); // 企业 + + switch (pd.get("COUNTTYPE").toString()) { + case "day":// 每日 + pd.put("STARTTIME", DateUtil.getDay() + " 00:00:00"); + pd.put("ENDTIME", DateUtil.getDay() + " 23:59:59"); + break; + + case "week":// 每周 + pd.put("STARTTIME", DateUtil.getWeekStart()); + pd.put("ENDTIME", DateUtil.getWeekEnd()); + break; + + case "xun":// 每旬 + String year = DateUtil.getYear(); + String month = DateUtil.getMonth(); + Integer day = Integer.parseInt(DateUtil.getOnlyDay()); + String startTime = year + "-" + month + "-"; + String endTime = year + "-" + month + "-"; + if (day <= 10) { + startTime = startTime + "01 00:00:00"; + endTime = endTime + "10 23:59:59"; + } else if (day > 10 && day <= 20) { + startTime = startTime + "11 00:00:00"; + endTime = endTime + "20 23:59:59"; + } else { + startTime = startTime + "21 00:00:00"; + endTime = DateUtil.getMonthEndDay() + " 23:59:59"; + } + pd.put("STARTTIME", startTime); + pd.put("ENDTIME", endTime); + break; + + case "month":// 每月 + pd.put("STARTTIME", DateUtil.getMonthFirstDay() + " 00:00:00"); + pd.put("ENDTIME", DateUtil.getMonthEndDay() + " 23:59:59"); + break; + + case "quarter":// 每季 + pd.put("STARTTIME", DateUtil.quarterStart() + " 00:00:00"); + pd.put("ENDTIME", DateUtil.quarterEnd() + " 23:59:59"); + break; + + case "year":// 每年 + pd.put("STARTTIME", DateUtil.getCurrYearFirst() + " 00:00:00"); + pd.put("ENDTIME", DateUtil.getCurrYearLast() + " 23:59:59"); + break; + + case "halfyear":// 半年 + String byear = DateUtil.getYear(); + Integer bmonth = Integer.parseInt(DateUtil.getMonth()); + if (bmonth <= 6) { + pd.put("STARTTIME", byear + "-01-01 00:00:00"); + pd.put("ENDTIME", byear + "-06-30 23:59:59"); + } else if (bmonth > 6) { + pd.put("STARTTIME", byear + "-07-01 00:00:00"); + pd.put("ENDTIME", byear + "-12-31 23:59:59"); + } + break; + + default: + break; + } + + String STARTTIME = pd.getString("STARTTIME"); + String ENDTIME = pd.getString("ENDTIME"); + + PageData all = new PageData(); + all.put("type", "all"); + all.put("name", "合计"); + all.put("molecule", 0); + all.put("denominator", 0); + all.put("percentage", 0d); + + List countList = listStatisticsService.getCountList(pd);// 统计分母 + + if (countList != null && !countList.isEmpty()) { + int sum = 0; + List dayList = checkrecordService.listCountDay(pd); // 统计--日 + if (dayList != null && !dayList.isEmpty()) { + for (PageData count : dayList) { + sum += Integer.parseInt(count.get("NUM").toString()); + } + } + List weekList = checkrecordService.listCountWeek(pd); // 统计--周 + if (weekList != null && !weekList.isEmpty()) { + for (PageData count : weekList) { + sum += Integer.parseInt(count.get("NUM").toString()); + } + } + List monthList = checkrecordService.listCountMonth(pd); // 统计--月 + + if (monthList != null && !monthList.isEmpty()) { + for (PageData count : monthList) { + sum += Integer.parseInt(count.get("NUM").toString()); + } + } + List quarterList = checkrecordService.listCountQuarter(pd); // 统计--季 + + if (quarterList != null && !quarterList.isEmpty()) { + for (PageData count : quarterList) { + sum += Integer.parseInt(count.get("NUM").toString()); + } + } + List halfYearList = checkrecordService.listCountHalfYear(pd); // 统计--半年 + + if (halfYearList != null && !halfYearList.isEmpty()) { + for (PageData count : halfYearList) { + sum += Integer.parseInt(count.get("NUM").toString()); + } + } + List yearList = checkrecordService.listCountYear(pd); // 统计--年 + if (yearList != null && !yearList.isEmpty()) { + for (PageData count : yearList) { + sum += Integer.parseInt(count.get("NUM").toString()); + } + } + // 处理旬时间 + StringBuilder stt = new StringBuilder(); + stt.append(pd.getString("STARTTIME")); + stt.setCharAt(9, '1'); + pd.put("STARTTIME", stt.toString()); + + String endDay = ENDTIME.substring(8, 10); + Integer endTime = Integer.parseInt(endDay); + StringBuffer et = new StringBuffer(); + et.append(pd.getString("ENDTIME")); + + if (endTime <= 10) { + stt.setCharAt(8, '1'); + stt.setCharAt(9, '0'); + pd.put("ENDTIME", et.toString()); + } else if (endTime <= 20) { + stt.setCharAt(8, '2'); + stt.setCharAt(9, '0'); + pd.put("ENDTIME", et.toString()); + } else { + Integer endMonth = Integer.parseInt(ENDTIME.substring(5, 7)); + Integer endYear = Integer.parseInt(ENDTIME.substring(0, 4)); + pd.put("ENDTIME", getLastDayOfMonth(endYear, endMonth) + " 23:59:59"); + } + List tenDaysList = checkrecordService.listCountTenDays(pd); // 统计--旬 + if (tenDaysList != null && !tenDaysList.isEmpty()) { + for (PageData count : tenDaysList) { + sum += Integer.parseInt(count.get("NUM").toString()); + } + } + // 分母 + for (PageData count : countList) { + + Integer allDenominator = Integer.parseInt(count.get("NOTEXAMINEDNUM").toString()) + + Integer.parseInt(all.get("denominator").toString()); + all.put("denominator", allDenominator); + } + + Integer jjr = checkrecordService.listCountJjr(pd) == null ? 0 : checkrecordService.listCountJjr(pd); + all.put("molecule", sum + jjr); + } + + if (!all.get("denominator").toString().equals("0")) { + if (all.get("molecule").toString().equals("0")) { + all.put("percentage", 0d); + } else { + Double denominator = Double.parseDouble(all.get("denominator").toString()); + Double molecule = Double.parseDouble(all.get("molecule").toString()); + Double percentage = molecule / denominator * 100; + DecimalFormat df = new DecimalFormat("#.00"); + all.put("percentage", df.format(percentage)); + } + } + + map.put("all", all); + map.put("result", errInfo); + return map; + } + + /** + *

排查信息

+ *

辨识部位检查记录(排查信息)

+ */ + @RequestMapping(value = "/listLogByIde") + @ResponseBody + public Object listLogByIde() throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + PageData pd = this.getPageData(); + pd.put("CORPINFO_ID", CORPINFO_ID); // 企业 + List varList = checkrecordService.listLogByIde(pd); + map.put("varList", varList); + map.put("result", errInfo); + return map; + } }