Merge remote-tracking branch 'origin/dev' into dev

pull/4/head
fangjiakai 2024-02-05 17:08:52 +08:00
commit 226bdcf489
1 changed files with 31 additions and 182 deletions

View File

@ -39,7 +39,7 @@ public class CustomStopController extends BaseController {
@Autowired
private CustomService customService;
@Autowired
private ListCheckItemService listcheckitemService;
private CustomItemService customItemService;
@Autowired
private DepartmentService departmentService;
@Autowired
@ -105,7 +105,7 @@ public class CustomStopController extends BaseController {
itme.put("CREATTIME", DateUtil.date2Str(new Date())); //创建时间
itme.put("OPERATOR", Jurisdiction.getUsername()); //修改人
itme.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
listcheckitemService.save(itme);
customItemService.save(itme);
set.add(json.get("RISKPOINT_ID").toString());
}
}
@ -385,127 +385,6 @@ public class CustomStopController extends BaseController {
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<String,String> map = new HashMap<String,String>();
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
@ -527,71 +406,44 @@ public class CustomStopController extends BaseController {
PageData pd2 = new PageData(); //删除原有内容
pd2.put("CUSTOM_ID", pd.getString("CUSTOM_ID"));
List<PageData> varList = listcheckitemService.listAll(pd2); //
List<PageData> varList = customItemService.listAll(pd2); //
for (PageData pageData : varList) {
PageData citem = new PageData();
citem.put("LISTCHECKITEM_ID", pageData.getString("LISTCHECKITEM_ID"));
listcheckitemService.delete(citem);
citem.put("CUSTOM_ITEM_ID", pageData.getString("CUSTOM_ITEM_ID"));
customItemService.delete(citem);
}
if(pd.get("LISTITEM")!=null && !pd.get("LISTITEM").equals("")) {
Set<String> set = new HashSet<String>();//记录所有风险点
int acount=0;//重大风险数
int bcount=0;//较大风险数
int ccount=0;//一般风险数
int dcount=0;//低风险数
List<JSONObject> list = (List<JSONObject>) 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_ITEM_ID", this.get32UUID()); //主键
itme.put("CHECK_CATEGORY", json.get("CHECK_CATEGORY"));
itme.put("CHECK_ITEM",json.get("CHECK_ITEM"));
itme.put("CHECK_CONTENT",json.get("CHECK_CONTENT"));
itme.put("CHECK_STANDARD",json.get("CHECK_STANDARD"));
itme.put("REFERENCE_BASIS",json.get("REFERENCE_BASIS"));
itme.put("CHECK_QUALIFIED",json.get("CHECK_QUALIFIED"));
itme.put("CHECK_UNQUALIFIED",json.get("CHECK_UNQUALIFIED"));
itme.put("OPERATION_TYPE",json.get("OPERATION_TYPE"));
itme.put("CUSTOM_ID",pd.get("CUSTOM_ID"));
itme.put("COMMON_ITEM_SORT", 1);
itme.put("COMMON_ID", json.get("COMMON_ID") == null ? "" : json.get("COMMON_ID"));
itme.put("COMMON_ITEM_ID", json.get("COMMON_ITEM_ID") == null ? "" : json.get("COMMON_ITEM_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<JSONObject> routes = (List<JSONObject>) 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);
itme.put("CREATOR_ID", Jurisdiction.getUSER_ID()); //添加人id
itme.put("CREATOR_NAME", Jurisdiction.getUsername()); //添加人
itme.put("CREATE_TIME", DateUtil.date2Str(new Date())); //创建时间
itme.put("OPERATOR_ID", Jurisdiction.getUSER_ID()); //修改人
itme.put("OPERATOR_NAME", Jurisdiction.getUsername()); //修改时间
itme.put("OPERATE_TIME", DateUtil.date2Str(new Date())); //修改时间
itme.put("DELETEOR_ID", Jurisdiction.getUSER_ID()); //添加人id
itme.put("DELETEOR_NAME", Jurisdiction.getUsername()); //添加人
itme.put("DELETE_TIME", DateUtil.date2Str(new Date())); //删除时间
customItemService.save(itme);
}
}
customService.edit(pd); // 修改清单管理的内容
@ -971,17 +823,14 @@ public class CustomStopController extends BaseController {
if (Tools.notEmpty(KEYWORDS))
pd.put("KEYWORDS", KEYWORDS.trim());
System.out.println(pd.getString("KEYWORDS"));
List<PageData> varList = listcheckitemService.listAll(pd);
List<PageData> varList = customItemService.listAll(pd);
pd = customService.findById(pd); //根据ID读取
for (PageData item : varList) {
item.put("RECORDITEM_ID", this.get32UUID()); //主键
}
List<PageData> ideList = identificationPartsService.listAllByList(pd);
map.put("varList", varList);
map.put("ideList", ideList);
map.put("pd", pd);
map.put("result", errInfo);
return map;
@ -1152,7 +1001,7 @@ public class CustomStopController extends BaseController {
}
/**
* @param page
* @param
* @throws Exception
*/
@RequestMapping(value="/checkListIndex")