diff --git a/src/main/java/com/zcloud/controller/check/StopListManagerController.java b/src/main/java/com/zcloud/controller/check/StopListManagerController.java index 7cdfeae..aaabd7e 100644 --- a/src/main/java/com/zcloud/controller/check/StopListManagerController.java +++ b/src/main/java/com/zcloud/controller/check/StopListManagerController.java @@ -381,6 +381,7 @@ public class StopListManagerController extends BaseController { pd = this.getPageData(); pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("LISTMANAGER_ID",pd.getString("ID")); listmanagerService.enable(pd); map.put("result", errInfo); //返回结果 return map; diff --git a/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomController.java b/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomController.java index a05102c..0e0cfbe 100644 --- a/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomController.java +++ b/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomController.java @@ -593,7 +593,7 @@ public class CustomController extends BaseController { * @throws Exception */ @RequestMapping(value = "/deleteAll") - @RequiresPermissions("listmanager:del") +// @RequiresPermissions("listmanager:del") @ResponseBody @LogAnno(menuType = "双重预防", menuServer = "隐患排查", instructionsOperate = "清单管理", instructionsType = "批量删除") public Object deleteAll() throws Exception { diff --git a/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomStopController.java b/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomStopController.java new file mode 100644 index 0000000..a25f15c --- /dev/null +++ b/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomStopController.java @@ -0,0 +1,1526 @@ +package com.zcloud.controller.hiddenDangerCheckStandard; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.zcloud.controller.base.BaseController; +import com.zcloud.entity.Page; +import com.zcloud.entity.PageData; +import com.zcloud.logs.LogAnno; +import com.zcloud.service.check.*; +import com.zcloud.service.risk.IdentificationPartsService; +import com.zcloud.service.hiddenDangerCheckStandard.*; +import com.zcloud.service.risk.RiskPointService; +import com.zcloud.service.statistics.ListStatisticsService; +import com.zcloud.service.system.DepartmentService; +import com.zcloud.service.system.UsersService; +import com.zcloud.util.DateUtil; +import com.zcloud.util.Jurisdiction; +import com.zcloud.util.ObjectExcelView; +import com.zcloud.util.Tools; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import java.util.*; + +/** + * 说明:删除清单管理 + * 作者:luoxiaobao + * 时间:2020-12-30 + * 官网:www.zcloudchina.com + */ +@Controller +@RequestMapping("/customStop") +public class CustomStopController extends BaseController { + + @Autowired + private CustomService customService; + @Autowired + private ListCheckItemService listcheckitemService; + @Autowired + private DepartmentService departmentService; + @Autowired + private CheckRecordService checkrecordService; + @Autowired + private RecordItemService recordItemService; + @Autowired + private RiskPointService riskpointService; + @Autowired + private ListStatisticsService listStatisticsService; + @Autowired + private IdentificationPartsService identificationPartsService; + @Autowired + private ListDisableTimeService listdisabletimeService; + @Autowired + private CheckRouteService checkRouteService; + @Autowired + private UsersService usersService; + /**新增] + * @param + * @throws Exception + */ + @RequestMapping(value="/add") + // @RequiresPermissions("customstop:add") + @ResponseBody + @Transactional + @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单管理",instructionsType = "新增") + public Object add() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 + pd.put("ISDELETE", "0"); //是否删除 + pd.put("CREATOR", Jurisdiction.getUsername()); //添加人 + pd.put("CREATTIME", DateUtil.date2Str(new Date())); //创建时间 + pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + String listPeriod = pd.getString("PERIOD"); + if(pd.get("USER_IDS") != null && Tools.notEmpty(pd.get("USER_IDS").toString())) { + String[] userIds = pd.get("USER_IDS").toString().split(","); + for(int i = 0; i < userIds.length; i++) { + pd.put("CUSTOM_ID", this.get32UUID()); //主键 + pd.put("USER_ID", userIds[i]); + if(pd.get("LISTITEM")!=null && !pd.get("LISTITEM").equals("")) { + Set set = new HashSet();//记录所有风险点 + int acount=0;//重大风险数 + int bcount=0;//较大风险数 + int ccount=0;//一般风险数 + int dcount=0;//低风险数 + List list = (List) JSON.parse(pd.get("LISTITEM").toString()); + System.out.println(list); + for (JSONObject json : list) { + if(json.get("RISKCHECKITEM_ID")!=null && json.get("RISKCHECKITEM_ID")!="" && json.get("RISKPOINT_ID")!=null && json.get("RISKPOINT_ID")!="") { + PageData itme = new PageData(); + itme.put("LISTCHECKITEM_ID", this.get32UUID()); //主键 + itme.put("RISKCHECKITEM_ID", json.get("RISKCHECKITEM_ID")); + itme.put("RISKPOINT_ID",json.get("RISKPOINT_ID")); + itme.put("CUSTOM_ID",pd.get("CUSTOM_ID")); + itme.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 + itme.put("ISDELETE", "0"); //是否删除 + itme.put("CREATOR", Jurisdiction.getUsername()); //添加人 + itme.put("CREATTIME", DateUtil.date2Str(new Date())); //创建时间 + itme.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + itme.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + listcheckitemService.save(itme); + set.add(json.get("RISKPOINT_ID").toString()); + } + } + for (String str : set) { + PageData rpd= new PageData(); + rpd.put("RISKPOINT_ID", str); + rpd=this.riskpointService.findById(rpd); + if(rpd.getString("LEVELID").equals("levelA")) { + acount++; + }else if(rpd.getString("LEVELID").equals("levelB")) { + bcount++; + }else if(rpd.getString("LEVELID").equals("levelC")) { + ccount++; + }else if(rpd.getString("LEVELID").equals("levelD")) { + dcount++; + } + } + pd.put("ACOUNT", acount); + pd.put("BCOUNT", bcount); + pd.put("CCOUNT", ccount); + pd.put("DCOUNT", dcount); + } + //巡检路线 + List routes = (List) JSON.parse(pd.get("ROUTE").toString()); + for (int j = 0; j < routes.size() ; j++) { + JSONObject json = routes.get(j); + if(json.get("ID")!=null && json.get("ID")!="") { + PageData route = new PageData(); + route.put("CHECKROUTE_ID", this.get32UUID()); //主键 + route.put("CUSTOM_ID",pd.get("CUSTOM_ID")); + route.put("IDENTIFICATIONPARTS_ID", json.get("ID")); + route.put("ORDERBY",j); + checkRouteService.save(route); + } + } + + pd.put("PERIOD", listPeriod); + customService.save(pd); + // 修改清单统计 + if(pd.get("TYPE") != null && Tools.notEmpty(pd.get("TYPE").toString())) { + pd.put("LISTSTATISTICS_ID", this.get32UUID()); //主键 + if("listType0005".equals(pd.get("TYPE").toString())) { + pd.put("STARTTIME", pd.get("START_DATE").toString()+" 00:00:00"); + pd.put("ENDTIME", pd.get("END_DATE").toString()+" 23:59:59"); + pd.put("PERIOD", null); + PageData statistics = listStatisticsService.findByCondition(pd); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())+2); + listStatisticsService.edit(statistics); + } else { + pd.put("NOTEXAMINEDNUM", 2); + listStatisticsService.save(pd); + } + } else { + if(pd.get("PERIOD") != null && Tools.notEmpty(pd.get("PERIOD").toString())) { + String period = pd.get("PERIOD").toString(); + switch (period) { + case "checkPeriod0001"://每日 + pd.put("STARTTIME", DateUtil.getDay()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getDay()+" 23:59:59"); + break; + + case "checkPeriod0002"://每周 + pd.put("STARTTIME", DateUtil.getWeekStart()); + pd.put("ENDTIME", DateUtil.getWeekEnd()); + break; + + case "checkPeriod0003"://每旬 + String year = DateUtil.getYear().toString(); + String month = DateUtil.getMonth().toString(); + Integer day = Integer.parseInt(DateUtil.getOnlyDay().toString()); + 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 "checkPeriod0004"://每月 + pd.put("STARTTIME", DateUtil.getMonthFirstDay()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getMonthEndDay()+" 23:59:59"); + break; + + case "checkPeriod0005"://每季 + pd.put("STARTTIME", DateUtil.quarterStart()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.quarterEnd()+" 23:59:59"); + break; + + case "checkPeriod0006"://每年 + pd.put("STARTTIME", DateUtil.getCurrYearFirst()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getCurrYearLast()+" 23:59:59"); + break; + + case "checkPeriod0007"://半年 + String byear = DateUtil.getYear().toString(); + Integer bmonth = Integer.parseInt(DateUtil.getMonth().toString()); + 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; + } + } + PageData statistics = listStatisticsService.findByCondition(pd); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())+1); + listStatisticsService.edit(statistics); + } else { + pd.put("NOTEXAMINEDNUM", 1); + listStatisticsService.save(pd); + } + } + } + } + } + map.put("result", errInfo); + return map; + } + + /**禁用 + * @param out + * @throws Exception + */ + @RequestMapping(value="/delete") + // @RequiresPermissions("customstop:del") + @ResponseBody + @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单管理",instructionsType = "禁用") + public Object delete() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + customService.delete(pd); + pd = customService.findById(pd); + // 记录清单禁用开始时间 + + PageData disPd = new PageData(); + disPd = this.getPageData(); + disPd.put("LISTDISABLETIME_ID", this.get32UUID()); //主键 + disPd.put("CUSTOM_ID", pd.get("CUSTOM_ID")); + disPd.put("CORPINFO_ID", pd.get("CORPINFO_ID")); + disPd.put("STARTTIME", DateUtil.date2Str(new Date())); //开始时间 + disPd.put("ISDELETE", "0"); //是否删除 0 未删除 1已删除 + disPd.put("OPERATOR", Jurisdiction.getUsername()); //操作人 + disPd.put("OPERATTIME", DateUtil.date2Str(new Date())); //操作时间 + disPd.put("CREATOR", Jurisdiction.getUsername()); //创建人 + disPd.put("CREATTIME", DateUtil.date2Str(new Date())); //创建时间 + listdisabletimeService.save(disPd); + // 修改清单统计 + if(pd.get("TYPE") != null && Tools.notEmpty(pd.get("TYPE").toString())) { + if("listType0005".equals(pd.get("TYPE").toString())) { + pd.put("LISTSTATISTICS_ID", this.get32UUID()); //主键 + pd.put("STARTTIME", pd.get("START_DATE").toString()+" 00:00:00"); + pd.put("ENDTIME", pd.get("END_DATE").toString()+" 23:59:59"); + pd.put("PERIOD", null); + PageData statistics = listStatisticsService.findByCondition(pd); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-2); + listStatisticsService.edit(statistics); + } + pd.put("ISSTATISTICS", '0'); + // 本期已检查的不计入统计 + checkrecordService.editStatistics(pd); + } else { + if(pd.get("PERIOD") != null && Tools.notEmpty(pd.get("PERIOD").toString())) { + String period = pd.get("PERIOD").toString(); + switch (period) { + case "checkPeriod0001"://每日 + pd.put("STARTTIME", DateUtil.getDay()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getDay()+" 23:59:59"); + break; + + case "checkPeriod0002"://每周 + pd.put("STARTTIME", DateUtil.getWeekStart()); + pd.put("ENDTIME", DateUtil.getWeekEnd()); + break; + + case "checkPeriod0003"://每旬 + String year = DateUtil.getYear().toString(); + String month = DateUtil.getMonth().toString(); + Integer day = Integer.parseInt(DateUtil.getOnlyDay().toString()); + 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 "checkPeriod0004"://每月 + pd.put("STARTTIME", DateUtil.getMonthFirstDay()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getMonthEndDay()+" 23:59:59"); + break; + + case "checkPeriod0005"://每季 + pd.put("STARTTIME", DateUtil.quarterStart()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.quarterEnd()+" 23:59:59"); + break; + + case "checkPeriod0006"://每年 + pd.put("STARTTIME", DateUtil.getCurrYearFirst()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getCurrYearLast()+" 23:59:59"); + break; + + case "checkPeriod0007"://半年 + String byear = DateUtil.getYear().toString(); + Integer bmonth = Integer.parseInt(DateUtil.getMonth().toString()); + 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; + } + } + PageData statistics = listStatisticsService.findByCondition(pd); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-1); + listStatisticsService.edit(statistics); + } + + pd.put("ISSTATISTICS", '0'); + // 本期已检查的不计入统计 + checkrecordService.editStatistics(pd); + } + } + // 将本频率内已检查的记录,改为不计入 + map.put("result", errInfo); //返回结果 + return map; + } + /**恢复 + * @param out + * @throws Exception + */ + @RequestMapping(value="/restore") + // @RequiresPermissions("customstop:del") + @ResponseBody + @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单管理",instructionsType = "启用") + public Object restore() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("CUSTOM_ID",pd.getString("ID")); + customService.enable(pd); + map.put("result", errInfo); //返回结果 + return map; + } + /**启用 + * @param out + * @throws Exception + */ + @RequestMapping(value="/enable") + // @RequiresPermissions("customstop:del") + @ResponseBody + @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单管理",instructionsType = "启用") + public Object enable() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + customService.enable(pd); + pd = customService.findById(pd); + // 启用清单时,修改禁用清单时间段的结束时间 + PageData disPd = new PageData(); + disPd.put("CUSTOM_ID", pd.get("CUSTOM_ID")); + disPd.put("CORPINFO_ID", pd.get("CORPINFO_ID")); + disPd = listdisabletimeService.findByList(pd); + disPd.put("ENDTIME", DateUtil.date2Str(new Date())); + disPd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + disPd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + listdisabletimeService.editEndTime(disPd); + // 修改清单统计 + if(pd.get("TYPE") != null && Tools.notEmpty(pd.get("TYPE").toString())) { + if("listType0005".equals(pd.get("TYPE").toString())) { + pd.put("LISTSTATISTICS_ID", this.get32UUID()); //主键 + pd.put("STARTTIME", pd.get("START_DATE").toString()+" 00:00:00"); + pd.put("ENDTIME", pd.get("END_DATE").toString()+" 23:59:59"); + pd.put("PERIOD", null); + PageData statistics = listStatisticsService.findByCondition(pd); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())+2); + listStatisticsService.edit(statistics); + } + pd.put("ISSTATISTICS", '1'); + // 本期已检查的不计入统计 + checkrecordService.editStatistics(pd); + } else { + if(pd.get("PERIOD") != null && Tools.notEmpty(pd.get("PERIOD").toString())) { + String period = pd.get("PERIOD").toString(); + switch (period) { + case "checkPeriod0001"://每日 + pd.put("STARTTIME", DateUtil.getDay()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getDay()+" 23:59:59"); + break; + + case "checkPeriod0002"://每周 + pd.put("STARTTIME", DateUtil.getWeekStart()); + pd.put("ENDTIME", DateUtil.getWeekEnd()); + break; + + case "checkPeriod0003"://每旬 + String year = DateUtil.getYear().toString(); + String month = DateUtil.getMonth().toString(); + Integer day = Integer.parseInt(DateUtil.getOnlyDay().toString()); + 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 "checkPeriod0004"://每月 + pd.put("STARTTIME", DateUtil.getMonthFirstDay()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getMonthEndDay()+" 23:59:59"); + break; + + case "checkPeriod0005"://每季 + pd.put("STARTTIME", DateUtil.quarterStart()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.quarterEnd()+" 23:59:59"); + break; + + case "checkPeriod0006"://每年 + pd.put("STARTTIME", DateUtil.getCurrYearFirst()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getCurrYearLast()+" 23:59:59"); + break; + + case "checkPeriod0007"://半年 + String byear = DateUtil.getYear().toString(); + Integer bmonth = Integer.parseInt(DateUtil.getMonth().toString()); + 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; + } + } + PageData statistics = listStatisticsService.findByCondition(pd); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())+1); + listStatisticsService.edit(statistics); + } + + pd.put("ISSTATISTICS", '1'); + // 本期已检查的不计入统计 + checkrecordService.editStatistics(pd); + } + } + // 将本频率内已检查的记录,改为不计入 + map.put("result", errInfo); //返回结果 + return map; + } + + /**修改 + * @param + * @throws Exception + */ + @RequestMapping(value="/edit") + // @RequiresPermissions("customstop:edit") + @ResponseBody + @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单管理",instructionsType = "修改") + public Object edit() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + // 查询原数据 + PageData oldPd = customService.findById(pd); + + PageData pd2 = new PageData(); //删除原有内容 + pd2.put("CUSTOM_ID", pd.getString("CUSTOM_ID")); + List varList = listcheckitemService.listAll(pd2); // + for (PageData pageData : varList) { + PageData citem = new PageData(); + citem.put("LISTCHECKITEM_ID", pageData.getString("LISTCHECKITEM_ID")); + listcheckitemService.delete(citem); + } + + + + if(pd.get("LISTITEM")!=null && !pd.get("LISTITEM").equals("")) { + Set set = new HashSet();//记录所有风险点 + int acount=0;//重大风险数 + int bcount=0;//较大风险数 + int ccount=0;//一般风险数 + int dcount=0;//低风险数 + List list = (List) JSON.parse(pd.get("LISTITEM").toString()); + for (JSONObject json : list) { + if(json.get("RISKCHECKITEM_ID")!=null && json.get("RISKCHECKITEM_ID")!="" && json.get("RISKPOINT_ID")!=null && json.get("RISKPOINT_ID")!="") { + PageData itme = new PageData(); + itme.put("LISTCHECKITEM_ID", this.get32UUID()); //主键 + itme.put("RISKCHECKITEM_ID", json.get("RISKCHECKITEM_ID")); + itme.put("RISKPOINT_ID",json.get("RISKPOINT_ID")); + itme.put("CUSTOM_ID",pd.get("CUSTOM_ID")); + itme.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 + itme.put("ISDELETE", "0"); //是否删除 + itme.put("CREATOR", Jurisdiction.getUsername()); //添加人 + itme.put("CREATTIME", DateUtil.date2Str(new Date())); //创建时间 + itme.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + itme.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + listcheckitemService.save(itme); + set.add(json.get("RISKPOINT_ID").toString()); + } + } + for (String str : set) { + PageData rpd= new PageData(); + rpd.put("RISKPOINT_ID", str); + rpd=this.riskpointService.findById(rpd); + if(rpd.getString("LEVELID").equals("levelA")) { + acount++; + }else if(rpd.getString("LEVELID").equals("levelB")) { + bcount++; + }else if(rpd.getString("LEVELID").equals("levelC")) { + ccount++; + }else if(rpd.getString("LEVELID").equals("levelD")) { + dcount++; + } + } + pd.put("ACOUNT", acount); + pd.put("BCOUNT", bcount); + pd.put("CCOUNT", ccount); + pd.put("DCOUNT", dcount); + } + + //巡检路线 + checkRouteService.delete(pd2); + List routes = (List) JSON.parse(pd.get("ROUTE").toString()); + for (int j = 0; j < routes.size() ; j++) { + JSONObject json = routes.get(j); + if(json.get("ID")!=null && json.get("ID")!="") { + PageData route = new PageData(); + route.put("CHECKROUTE_ID", this.get32UUID()); //主键 + route.put("CUSTOM_ID",pd.get("CUSTOM_ID")); + route.put("IDENTIFICATIONPARTS_ID", json.get("ID")); + route.put("ORDERBY",j); + checkRouteService.save(route); + } + } + customService.edit(pd); // 修改清单管理的内容 + oldPd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + // 修改清单统计 + if(oldPd.get("TYPE") != null && Tools.notEmpty(oldPd.get("TYPE").toString())) { + oldPd.put("LISTSTATISTICS_ID", this.get32UUID()); //主键 + if("listType0005".equals(oldPd.get("TYPE").toString())) { + oldPd.put("STARTTIME", oldPd.get("START_DATE").toString()+" 00:00:00"); + oldPd.put("ENDTIME", oldPd.get("END_DATE").toString()+" 23:59:59"); + oldPd.put("PERIOD", null); + PageData statistics = listStatisticsService.findByCondition(oldPd); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + if(Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-2 <=0) { + listStatisticsService.deletewl(statistics); + } else { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-2); + listStatisticsService.edit(statistics); + } + } + } else { + if(oldPd.get("PERIOD") != null && Tools.notEmpty(oldPd.get("PERIOD").toString())) { + String period = oldPd.get("PERIOD").toString(); + switch (period) { + case "checkPeriod0001"://每日 + oldPd.put("STARTTIME", DateUtil.getDay()+" 00:00:00"); + oldPd.put("ENDTIME", DateUtil.getDay()+" 23:59:59"); + break; + + case "checkPeriod0002"://每周 + oldPd.put("STARTTIME", DateUtil.getWeekStart()); + oldPd.put("ENDTIME", DateUtil.getWeekEnd()); + break; + + case "checkPeriod0003"://每旬 + String year = DateUtil.getYear().toString(); + String month = DateUtil.getMonth().toString(); + Integer day = Integer.parseInt(DateUtil.getOnlyDay().toString()); + 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"; + } + oldPd.put("STARTTIME", startTime); + oldPd.put("ENDTIME", endTime); + break; + + case "checkPeriod0004"://每月 + oldPd.put("STARTTIME", DateUtil.getMonthFirstDay()+" 00:00:00"); + oldPd.put("ENDTIME", DateUtil.getMonthEndDay()+" 23:59:59"); + break; + + case "checkPeriod0005"://每季 + oldPd.put("STARTTIME", DateUtil.quarterStart()+" 00:00:00"); + oldPd.put("ENDTIME", DateUtil.quarterEnd()+" 23:59:59"); + break; + + case "checkPeriod0006"://每年 + oldPd.put("STARTTIME", DateUtil.getCurrYearFirst()+" 00:00:00"); + oldPd.put("ENDTIME", DateUtil.getCurrYearLast()+" 23:59:59"); + break; + + case "checkPeriod0007"://半年 + String byear = DateUtil.getYear().toString(); + Integer bmonth = Integer.parseInt(DateUtil.getMonth().toString()); + if(bmonth <= 6) { + oldPd.put("STARTTIME", byear+"-01-01 00:00:00"); + oldPd.put("ENDTIME", byear+"-06-30 23:59:59"); + } else if(bmonth > 6) { + oldPd.put("STARTTIME", byear+"-07-01 00:00:00"); + oldPd.put("ENDTIME", byear+"-12-31 23:59:59"); + } + break; + + default: + break; + } + } + PageData statistics = listStatisticsService.findByCondition(oldPd); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + if(Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-1 <=0) { + listStatisticsService.deletewl(statistics); + } else { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-1); + listStatisticsService.edit(statistics); + } + } + } + } + + + if(pd.get("TYPE") != null && Tools.notEmpty(pd.get("TYPE").toString())) { + + pd.put("LISTSTATISTICS_ID", this.get32UUID()); //主键 + if("listType0005".equals(pd.get("TYPE").toString())) { + pd.put("STARTTIME", pd.get("START_DATE").toString()+" 00:00:00"); + pd.put("ENDTIME", pd.get("END_DATE").toString()+" 23:59:59"); + pd.put("PERIOD", null); + PageData statistics = listStatisticsService.findByCondition(pd); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())+2); + listStatisticsService.edit(statistics); + } else { + pd.put("NOTEXAMINEDNUM", 2); + listStatisticsService.save(pd); + } + } else { + if(pd.get("PERIOD") != null && Tools.notEmpty(pd.get("PERIOD").toString())) { + String period = pd.get("PERIOD").toString(); + switch (period) { + case "checkPeriod0001"://每日 + pd.put("STARTTIME", DateUtil.getDay()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getDay()+" 23:59:59"); + break; + + case "checkPeriod0002"://每周 + pd.put("STARTTIME", DateUtil.getWeekStart()); + pd.put("ENDTIME", DateUtil.getWeekEnd()); + break; + + case "checkPeriod0003"://每旬 + String year = DateUtil.getYear().toString(); + String month = DateUtil.getMonth().toString(); + Integer day = Integer.parseInt(DateUtil.getOnlyDay().toString()); + 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 "checkPeriod0004"://每月 + pd.put("STARTTIME", DateUtil.getMonthFirstDay()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getMonthEndDay()+" 23:59:59"); + break; + + case "checkPeriod0005"://每季 + pd.put("STARTTIME", DateUtil.quarterStart()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.quarterEnd()+" 23:59:59"); + break; + + case "checkPeriod0006"://每年 + pd.put("STARTTIME", DateUtil.getCurrYearFirst()+" 00:00:00"); + pd.put("ENDTIME", DateUtil.getCurrYearLast()+" 23:59:59"); + break; + + case "checkPeriod0007"://半年 + String byear = DateUtil.getYear().toString(); + Integer bmonth = Integer.parseInt(DateUtil.getMonth().toString()); + 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; + } + } + PageData statistics = listStatisticsService.findByCondition(pd); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())+1); + listStatisticsService.edit(statistics); + } else { + pd.put("NOTEXAMINEDNUM", 1); + listStatisticsService.save(pd); + } + } + } + + + + map.put("result", errInfo); + return map; + } + + /**列表 + * @param page + * @throws Exception + */ + @RequestMapping(value="/list") + @ResponseBody + @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单管理",instructionsType = "列表") + public Object list(Page page) throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + pd.put("ISMAIN", Jurisdiction.getIS_MAIN()); + pd.put("ISSUPERVISE", Jurisdiction.getISSUPERVISE()); + pd.put("DEPARTMENT_ID", Jurisdiction.getDEPARTMENT_ID()); + pd.put("USER_ID",Jurisdiction.getUSER_ID()); + PageData cpd = new PageData(); + cpd = usersService.findById(pd); + pd.put("ISLEADER", cpd.getString("ISLEADER")); + if(cpd.getString("ISLEADER") != null && cpd.getString("ISLEADER").equals("1")){ + String DEPARTMENT_ID = pd.getString("DEPARTMENT_ID"); + String ids = departmentService.getDEPARTMENT_IDS(DEPARTMENT_ID); + ids=pd.getString("DEPARTMENT_ID")+","+ids; //把自己部门插入进去 + if(ids!=null && Tools.notEmpty(ids)&& ids.lastIndexOf(",")>-1) { + ids = ids.substring(0,ids.lastIndexOf(",")); + pd.put("DEPARTMENT_IDS", ids.split(",")); + }else { + pd.put("DEPARTMENT_IDS", DEPARTMENT_ID); + } + } + + String DEPTIDS = pd.getString("DEPTIDS"); + if(Tools.notEmpty(DEPTIDS)) { + String DEPT_IDS[] = DEPTIDS.split(","); + pd.put("DEPT_IDS", DEPT_IDS); + } + pd.put("HIDFORBIDDEN", "no"); //企业 + String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 + if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); + String USERNAME = pd.getString("USERNAME"); //关键词检索条件 + if(Tools.notEmpty(USERNAME))pd.put("USERNAME", USERNAME.trim()); + page.setPd(pd); + List varList = customService.stoplist(page); //列出ListManager列表 + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } + + /**列表 + * @param page + * @throws Exception + */ + @RequestMapping(value="/checkList") + @ResponseBody + @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单排查",instructionsType = "列表") + public Object checkList(Page page) throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 +// pd.put("POST_ID", Jurisdiction.getPOST_ID()); //岗位 + pd.put("USER_ID", Jurisdiction.getUSER_ID()); + String indexType = pd.getString("indexType"); //关键词检索条件 + if(Tools.notEmpty(indexType))pd.put("indexType", indexType.trim()); + if("1".equals(indexType)) { + pd.put("STATUS", "0"); + String DEPARTMENT_ID = Jurisdiction.getDEPARTMENT_ID(); + pd.put("DEPARTMENT_ID", DEPARTMENT_ID); + } else if("2".equals(indexType)) { + + pd.put("STATUS", "1"); + String DEPARTMENT_ID = Jurisdiction.getDEPARTMENT_ID(); + pd.put("DEPARTMENT_ID", DEPARTMENT_ID); + } else { + String DEPARTMENT_ID = Jurisdiction.getDEPARTMENT_ID(); + String ids = departmentService.getDEPARTMENT_IDS(DEPARTMENT_ID); + if(Jurisdiction.getIS_MAIN().equals("0")) { + if(ids!=null && Tools.notEmpty(ids) && ids.lastIndexOf(",")>-1 ) { + ids = ids.substring(0,ids.lastIndexOf(",")); + pd.put("DEPARTMENT_IDS", ids.split(",")); + }else { + pd.put("DEPARTMENT_ID", DEPARTMENT_ID); + } + } + } + + pd.put("orderUserId", Jurisdiction.getUSER_ID()); + String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 + if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); + String USERNAME = pd.getString("USERNAME"); //关键词检索条件 + if(Tools.notEmpty(USERNAME))pd.put("USERNAME", USERNAME.trim()); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + pd.put("ISMAIN", Jurisdiction.getIS_MAIN()); + pd.put("ISSUPERVISE", Jurisdiction.getISSUPERVISE()); + pd.put("DEPARTMENT_ID", Jurisdiction.getDEPARTMENT_ID()); + String DEPTIDS = pd.getString("DEPTIDS"); + if(Tools.notEmpty(DEPTIDS)) { + String DEPT_IDS[] = DEPTIDS.split(","); + pd.put("DEPT_IDS", DEPT_IDS); + } + page.setPd(pd); + List varList = customService.checklistPage(page); //列出ListManager列表 + for (PageData list : varList) { + String userId= list.getString("USER_ID"); + if(userId.equals(Jurisdiction.getUSER_ID())) { + list.put("stateMy", "0"); + }else { + list.put("stateMy", "1"); + } + + } + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } + + /**列表 + * @param page + * @throws Exception + */ + @RequestMapping(value="/recordList") + @ResponseBody + @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单检查情况",instructionsType = "列表") + public Object recordList(Page page) throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 +// pd.put("POST_ID", Jurisdiction.getPOST_ID()); //岗位 + pd.put("USER_ID", Jurisdiction.getUSER_ID()); + pd.put("ISMAIN", Jurisdiction.getIS_MAIN()); + pd.put("ISSUPERVISE", Jurisdiction.getISSUPERVISE()); + pd.put("DEPARTMENT_ID", Jurisdiction.getDEPARTMENT_ID()); + String DEPTIDS = pd.getString("DEPTIDS"); + if(Tools.notEmpty(DEPTIDS)) { + String DEPT_IDS[] = DEPTIDS.split(","); + pd.put("DEPT_IDS", DEPT_IDS); + } + String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 + if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); + String STARTTIME = pd.getString("STARTTIME"); //关键词检索条件 + if(Tools.notEmpty(STARTTIME))pd.put("STARTTIME", STARTTIME.trim() + " 00:00:00"); + String ENDTIME = pd.getString("ENDTIME"); //关键词检索条件 + if(Tools.notEmpty(ENDTIME))pd.put("ENDTIME", ENDTIME.trim() + " 23:59:59"); + page.setPd(pd); + List varList = customService.recordList(page); //列出ListManager列表 + for (PageData list : varList) { + String userId= list.getString("USER_ID"); + if(userId.equals(Jurisdiction.getUSER_ID())) { + list.put("stateMy", "0"); + }else { + list.put("stateMy", "1"); + } + } + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } + + /**去修改页面获取数据 + * @param + * @throws Exception + */ + @RequestMapping(value="/goEdit") + @ResponseBody + @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单管理",instructionsType = "去修改页面获取数据") + public Object goEdit() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + String KEYWORDS = pd.getString("KEYWORDS"); // 关键词检索条件 + if (Tools.notEmpty(KEYWORDS)) + pd.put("KEYWORDS", KEYWORDS.trim()); + + System.out.println(pd.getString("KEYWORDS")); + List varList = listcheckitemService.listAll(pd); + pd = customService.findById(pd); //根据ID读取 + + for (PageData item : varList) { + item.put("RECORDITEM_ID", this.get32UUID()); //主键 + } + List ideList = identificationPartsService.listAllByList(pd); + + map.put("varList", varList); + map.put("ideList", ideList); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } + + /**批量删除 + * @param + * @throws Exception + */ + @RequestMapping(value="/deleteAll") + // @RequiresPermissions("customstop:del") + @ResponseBody + @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单管理",instructionsType = "批量删除") + public Object deleteAll() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + String DATA_IDS = pd.getString("DATA_IDS"); + if(Tools.notEmpty(DATA_IDS)){ + String ArrayDATA_IDS[] = DATA_IDS.split(","); + for(int i = 0; i < ArrayDATA_IDS.length; i++) { + PageData pd1 = new PageData(); + pd1.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + pd1.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd1.put("CUSTOM_ID", ArrayDATA_IDS[i]); + customService.deleted(pd1); + pd1 = customService.findById(pd1); + if(pd1.get("TYPE") != null && Tools.notEmpty(pd1.get("TYPE").toString())) { + if("listType0005".equals(pd1.get("TYPE").toString())) { + pd1.put("LISTSTATISTICS_ID", this.get32UUID()); //主键 + pd1.put("STARTTIME", pd1.get("START_DATE").toString()+" 00:00:00"); + pd1.put("ENDTIME", pd1.get("END_DATE").toString()+" 23:59:59"); + pd1.put("PERIOD", null); + PageData statistics = listStatisticsService.findByCondition(pd1); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-2); + listStatisticsService.edit(statistics); + } + pd1.put("ISSTATISTICS", '0'); + // 本期已检查的不计入统计 + checkrecordService.editStatistics(pd1); + } else { + if(pd1.get("PERIOD") != null && Tools.notEmpty(pd1.get("PERIOD").toString())) { + String period = pd1.get("PERIOD").toString(); + switch (period) { + case "checkPeriod0001"://每日 + pd1.put("STARTTIME", DateUtil.getDay()+" 00:00:00"); + pd1.put("ENDTIME", DateUtil.getDay()+" 23:59:59"); + break; + + case "checkPeriod0002"://每周 + pd1.put("STARTTIME", DateUtil.getWeekStart()); + pd1.put("ENDTIME", DateUtil.getWeekEnd()); + break; + + case "checkPeriod0003"://每旬 + String year = DateUtil.getYear().toString(); + String month = DateUtil.getMonth().toString(); + Integer day = Integer.parseInt(DateUtil.getOnlyDay().toString()); + 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"; + } + pd1.put("STARTTIME", startTime); + pd1.put("ENDTIME", endTime); + break; + + case "checkPeriod0004"://每月 + pd1.put("STARTTIME", DateUtil.getMonthFirstDay()+" 00:00:00"); + pd1.put("ENDTIME", DateUtil.getMonthEndDay()+" 23:59:59"); + break; + + case "checkPeriod0005"://每季 + pd1.put("STARTTIME", DateUtil.quarterStart()+" 00:00:00"); + pd1.put("ENDTIME", DateUtil.quarterEnd()+" 23:59:59"); + break; + + case "checkPeriod0006"://每年 + pd1.put("STARTTIME", DateUtil.getCurrYearFirst()+" 00:00:00"); + pd1.put("ENDTIME", DateUtil.getCurrYearLast()+" 23:59:59"); + break; + + case "checkPeriod0007"://半年 + String byear = DateUtil.getYear().toString(); + Integer bmonth = Integer.parseInt(DateUtil.getMonth().toString()); + if(bmonth <= 6) { + pd1.put("STARTTIME", byear+"-01-01 00:00:00"); + pd1.put("ENDTIME", byear+"-06-30 23:59:59"); + } else if(bmonth > 6) { + pd1.put("STARTTIME", byear+"-07-01 00:00:00"); + pd1.put("ENDTIME", byear+"-12-31 23:59:59"); + } + break; + + default: + break; + } + } + PageData statistics = listStatisticsService.findByCondition(pd1); + if(statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-1); + listStatisticsService.edit(statistics); + } + + pd1.put("ISSTATISTICS", '0'); + // 本期已检查的不计入统计 + checkrecordService.editStatistics(pd1); + } + } + } + errInfo = "success"; + }else{ + errInfo = "error"; + } + map.put("result", errInfo); //返回结果 + return map; + } + + /**导出到excel + * @param + * @throws Exception + */ + @RequestMapping(value="/excel") + public ModelAndView exportExcel() throws Exception{ + ModelAndView mv = new ModelAndView(); + PageData pd = new PageData(); + pd = this.getPageData(); + Map dataMap = new HashMap(); + List titles = new ArrayList(); + titles.add("清单名称"); //1 + titles.add("排查周期"); //2 + titles.add("清单类型"); //3 + titles.add("企业id"); //4 + titles.add("添加人"); //5 + titles.add("添加时间"); //6 + titles.add("修改人"); //7 + titles.add("修改时间"); //8 + titles.add("是否删除 1-是 0-否"); //9 + dataMap.put("titles", titles); + List varOList = customService.listAll(pd); + List varList = new ArrayList(); + for(int i=0;i map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 +// pd.put("POST_ID", Jurisdiction.getPOST_ID()); //岗位 + pd.put("USER_ID", Jurisdiction.getUSER_ID()); + pd.put("orderUserId", Jurisdiction.getUSER_ID()); + pd.put("DEPARTMENT_ID", Jurisdiction.getDEPARTMENT_ID()); +// String ids = departmentService.getDEPARTMENT_IDS(DEPARTMENT_ID); +// if(Jurisdiction.getIS_MAIN().equals("0")) { +// if(ids!=null && Tools.notEmpty(ids) && ids.lastIndexOf(",")>-1 ) { +// ids = ids.substring(0,ids.lastIndexOf(",")); +// pd.put("DEPARTMENT_IDS", ids.split(",")); +// }else { +// pd.put("DEPARTMENT_ID", DEPARTMENT_ID); +// } +// } + List varList = customService.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) { + yjcNum++; + } else { + wjcNum++; + } + continue; + } + if(Integer.parseInt(list.get("checkCount").toString()) > 0) { + yjcNum++; + } else { + wjcNum++; + } + } + map.put("yjcNum", yjcNum); + map.put("wjcNum", wjcNum); + map.put("varList", varList); + map.put("result", errInfo); + return map; + } + + +// /**列表 +// * @param page +// * @throws Exception +// */ +// @RequestMapping(value="/listAllByCorpMsm") +// @ResponseBody +// public Object listAllByCorpMsm() throws Exception{ +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = new PageData(); +// pd = this.getPageData(); +// List varList = customService.listAllByCorpMsm(pd); //列出ListManager列表 +// if(varList != null && varList.size() > 0) { +// // 用户合集 +// Map varMap = new HashMap(); +// for(int i = 0;i msmList = new ArrayList(varMap.values()); +// map.put("msmList", msmList); +// +// } +// +// map.put("result", errInfo); +// return map; +// } +// /**根据分类统计清单 +// * @param page +// * @throws Exception +// */ +// @RequestMapping(value="/countListByType") +// @ResponseBody +// public Object countListByType() throws Exception{ +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = new PageData(); +// pd = this.getPageData(); +// pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 +// List varList = customService.countListByType(pd); //列出ListManager列表 +// List datas = new ArrayList(); +// +// /*DecimalFormat df = new DecimalFormat("#.00"); +// Double sum = 0d; +// for(PageData list:varList) { +// sum += Double.parseDouble(list.get("NUM").toString()); +// } +// for(PageData list: varList) { +// PageData data = new PageData(); +// Double num = Double.parseDouble(list.get("NUM").toString()); +// data.put("value", Double.parseDouble(df.format(num/sum))); +// data.put("name", list.getString("NAME")); +// datas.add(data); +// }*/ +// for(PageData list: varList) { +// PageData data = new PageData(); +// data.put("value", Integer.parseInt(list.get("NUM").toString())); +// data.put("name", list.getString("NAME")); +// datas.add(data); +// } +// map.put("datas", datas); +// map.put("result", errInfo); +// return map; +// } + +// /**首页 获取折线图 +// * @param page +// * @throws Exception +// */ +// @RequestMapping(value="/goIndexCount") +// @ResponseBody +// @LogAnno(menuType= "首页",menuServer= "首页",instructionsOperate = "首页",instructionsType = "首页 获取折线图") +// public Object goIndexCount() throws Exception{ +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = new PageData(); +// pd = this.getPageData(); +// pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 +// List dates = DateUtil.getHalfYearMonth(true); +// pd.put("TIME", dates.get(0)); +// List varList = customService.goIndexCount(pd); +// List xcqd = new ArrayList(); +// List jcqd = new ArrayList(); +// List zhqd = new ArrayList(); +// for(int i = 0; i < dates.size(); i++) { +// xcqd.add("0"); +// jcqd.add("0"); +// zhqd.add("0"); +// } +// Map listMap = new HashMap<>(); +// if(varList != null && varList.size() > 0) { +// for(PageData list : varList) { +// int index = dates.indexOf(list.getString("TIME")); +// switch (list.getString("SCREENTYPE")) { +// case "riskChecklistType0001": +// xcqd.set(index, list.get("COUNT").toString()); +// break; +// case "riskChecklistType0002": +// +// jcqd.set(index, list.get("COUNT").toString()); +// break; +// case "zhqd03": +// +// zhqd.set(index, list.get("COUNT").toString()); +// break; +// +// default: +// break; +// } +// } +// } +// +// map.put("xcqd", xcqd); +// map.put("jcqd", jcqd); +// map.put("zhqd", zhqd); +// map.put("dates", dates); +// map.put("result", errInfo); +// return map; +// } + +// /**根据分类统计清单 +// * @param page +// * @throws Exception +// */ +// @RequestMapping(value="/checkPlan") +// @ResponseBody +// @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "排查计划",instructionsType = "根据分类统计清单") +// public Object checkPlan() throws Exception { +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = new PageData(); +// pd = this.getPageData(); +// pd.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID()); +// List planList = customService.listAllPlan(null); +// Map planMap = new HashMap(); +// for (PageData pageData : planList) { +// pageData.put("dept_str", ""); +// planMap.put(pageData.getString("type_bianma") + "," + pageData.getString("level_bianma") + "," + pageData.getString("period_bianma"),pageData); +// } +// //企业所有应查数 +// List staList = listStatisticsService.listAllForPlan(pd); +// for (PageData pageData : staList) { +// String rowName = pageData.getString("TYPE") + "," + pageData.getString("level_bianma") + "," + pageData.getString("PERIOD"); +// PageData row = planMap.get(rowName); +// if(row!=null){ +// row.put("check_count",Integer.parseInt(row.get("check_count").toString()) + Integer.parseInt(pageData.get("NOTEXAMINEDNUM").toString())); +// } +// } +// //企业所有清单数 +// List liList = customService.listAllForPlan(pd); +// for (PageData pageData : liList) { +// String rowName = pageData.getString("TYPE") + "," + pageData.getString("level_bianma") + "," + pageData.getString("PERIOD"); +// PageData row = planMap.get(rowName); +// if(row!=null){ +// row.put("list_count",Integer.parseInt(row.get("list_count").toString()) + 1 ); +// row.put("dept_str",row.get("dept_str").toString() + pageData.getString("DEPARTMENT_ID") + ","); +// } +// } +// +// for (PageData pageData : planList) { +// if(pageData.get("dept_str")!=null && pageData.get("dept_str").toString()!="") +// pageData.put("dept_count", new HashSet(Arrays.asList(pageData.get("dept_str").toString().substring(0,pageData.get("dept_str").toString().length()-1).split(","))).size()); +// } +// +// map.put("planList",planList); +// map.put("result", errInfo); +// return map; +// } + + +// /**根据分类统计清单 +// * @param page +// * @throws Exception +// */ +// @RequestMapping(value="/checkPlan") +// @ResponseBody +// public Object checkPlan() throws Exception{ +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = new PageData(); +// pd = this.getPageData(); +// if(pd.get("USER_ID") == null || "".equals(pd.get("USER_ID").toString())) { +// pd.put("USER_ID", Jurisdiction.getUSER_ID()); +// } +// pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 +// List varList = customService.listAll(pd); //列出ListManager列表 +// Map typeMap = new HashMap(); +// +// for(PageData list: varList) { +// if(list.get("TYPE").equals("listType0001")) { +// if(!typeMap.containsKey("日常清单")){ +// typeMap.put("日常清单",new HashMap()); +// } +// +// Map levelMap = (Map)typeMap.get("日常清单"); +// if(list.get("DEPARTMENT_LEVEL").equals("departmentLevel0001")) { +// if (!levelMap.containsKey("厂级")) { +// levelMap.put("厂级", new HashMap()); +// } +// +// Map periodMap = (Map)levelMap.get("厂级"); +// if(list.get("PERIOD").equals("checkPeriod0001")) { +// if (!periodMap.containsKey("每日")) { +// periodMap.put("每日", new HashMap()); +// } +// } +// } else if(list.get("DEPARTMENT_LEVEL").equals("departmentLevel0002")) { +// if (!levelMap.containsKey("车间级")) { +// levelMap.put("车间级", new HashMap()); +// } +// +// Map periodMap = (Map)levelMap.get("车间级"); +// if(list.get("PERIOD").equals("checkPeriod0001")) { +// if (!periodMap.containsKey("每日")) { +// periodMap.put("每日", new HashMap()); +// } +// } +// } else if(list.get("DEPARTMENT_LEVEL").equals("departmentLevel0003")) { +// if (!levelMap.containsKey("班组级")) { +// levelMap.put("班组级", new HashMap()); +// } +// +// Map periodMap = (Map)levelMap.get("班组级"); +// if(list.get("PERIOD").equals("checkPeriod0001")) { +// if (!periodMap.containsKey("每日")) { +// periodMap.put("每日", new HashMap()); +// } +// } +// } +// } +// } +// map.put("result", errInfo); +// return map; +// } +// +// /**获取巡检路线 +// * @param +// * @throws Exception +// */ +// @RequestMapping(value="/getRoute") +// @ResponseBody +// @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单管理",instructionsType = "获取巡检路线") +// public Object getRisk() throws Exception { +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = new PageData(); +// pd = this.getPageData(); +// List varList = customService.listAllRisk(pd); +// map.put("varList", varList); +// map.put("result", errInfo); +// return map; +// } + + /**设置巡检路线 + * @param + * @throws Exception + */ + @RequestMapping(value="/setRout") + @ResponseBody + @LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单管理",instructionsType = "设置巡检路线") + public Object setRout() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + //巡检路线 + checkRouteService.delete(pd); + List routes = (List) JSON.parse(pd.get("ROUTE").toString()); + for (int j = 0; j < routes.size() ; j++) { + JSONObject json = routes.get(j); + if(json.get("IDENTIFICATIONPARTS_ID")!=null && json.get("IDENTIFICATIONPARTS_ID")!="") { + PageData route = new PageData(); + route.put("CHECKROUTE_ID", this.get32UUID()); //主键 + route.put("CUSTOM_ID",pd.get("CUSTOM_ID")); + route.put("IDENTIFICATIONPARTS_ID", json.get("IDENTIFICATIONPARTS_ID")); + route.put("ORDERBY",j); + checkRouteService.save(route); + } + } + map.put("result", errInfo); + return map; + } +// +// /** +// * BI页清单排查类型统计 +// * +// * @param +// * @throws Exception +// */ +// @RequestMapping(value = "/countNumBi") +// @ResponseBody +// public Object countNumBi() throws Exception { +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = new PageData(); +// pd = this.getPageData(); +// pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 企业 +//// pd.put("YEAR",new Date().getYear()+1900); +// List typeList = customService.getCountNumBi(pd); +// map.put("typeList", typeList); +// map.put("result", errInfo); +// return map; +// } +} diff --git a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CustomService.java b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CustomService.java index dafe2c8..a321476 100644 --- a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CustomService.java +++ b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CustomService.java @@ -55,6 +55,19 @@ public interface CustomService { */ void enable(PageData pd)throws Exception; + /**修改 + * @param pd + * @throws Exception + */ + public void edit(PageData pd)throws Exception; + public List stoplist(Page page)throws Exception; + + /**部门清单列表 + * * @param pd + * @throws Exception + */ + public List recordList(Page page)throws Exception; + /**通过id获取数据 * @param pd * @throws Exception @@ -93,10 +106,6 @@ public interface CustomService { */ List getListByCorplistPage(Page page)throws Exception; - /**部门清单列表 - * * @param pd - * @throws Exception - */ - List recordList(Page page)throws Exception; + } diff --git a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/CustomServiceImpl.java b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/CustomServiceImpl.java index 8267c35..2cb20f7 100644 --- a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/CustomServiceImpl.java +++ b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/CustomServiceImpl.java @@ -80,6 +80,27 @@ public class CustomServiceImpl implements CustomService { customMapper.enable(pd); } + /**修改 + * @param pd + * @throws Exception + */ + public void edit(PageData pd)throws Exception{ + customMapper.edit(pd); + } + + public List stoplist(Page page)throws Exception{ + return customMapper.stopdatalistPage(page); + } + + /**部门清单列表 + * * @param pd + * @throws Exception + */ + public List recordList(Page page)throws Exception{ + return customMapper.recordlistPage(page); + } + + /**通过id获取数据 * @param pd * @throws Exception @@ -126,13 +147,7 @@ public class CustomServiceImpl implements CustomService { return customMapper.getListByCorplistPage(page); } - /**部门清单列表 - * * @param pd - * @throws Exception - */ - public List recordList(Page page)throws Exception{ - return customMapper.recordlistPage(page); - } + } diff --git a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomCheckRecordMapper.xml b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomCheckRecordMapper.xml index e2da625..5ccdb01 100644 --- a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomCheckRecordMapper.xml +++ b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomCheckRecordMapper.xml @@ -1293,7 +1293,7 @@ set ISSTATISTICS= #{ISSTATISTICS} where - LISTMANAGER_ID = #{LISTMANAGER_ID} + CUSTOM_ID = #{CUSTOM_ID} AND DATE_FORMAT( CHECK_TIME, '%Y-%m-%d ' ) between DATE_FORMAT( #{STARTTIME}, '%Y-%m-%d' ) AND DATE_FORMAT( #{ENDTIME}, '%Y-%m-%d' ) AND diff --git a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomMapper.xml b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomMapper.xml index e59da6a..0052f3f 100644 --- a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomMapper.xml +++ b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomMapper.xml @@ -159,6 +159,142 @@ order by f.ISDELETE,f.OPERATTIME desc + + + +