diff --git a/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CommonController.java b/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CommonController.java index ab942e1..7618458 100644 --- a/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CommonController.java +++ b/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CommonController.java @@ -7,6 +7,8 @@ import com.zcloud.service.corp.CorpInfoService; import com.zcloud.service.hiddenDangerCheckStandard.CommonService; import com.zcloud.util.Jurisdiction; import com.zcloud.util.Tools; +import com.zcloud.util.Warden; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -54,5 +56,22 @@ public class CommonController extends BaseController { map.put("result", errInfo); return map; } - + /** + * 修改 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/edit") + @ResponseBody + public Object edit() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + Warden.updateDate(pd); + commonService.edit(pd); + map.put("result", errInfo); + return map; + } } diff --git a/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomCheckRecordController.java b/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomCheckRecordController.java index 61b8348..20f6604 100644 --- a/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomCheckRecordController.java +++ b/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomCheckRecordController.java @@ -173,7 +173,7 @@ public class CustomCheckRecordController extends BaseController { List itemsList = (List) JSON.parse(pd.get("ITEMS").toString()); for (JSONObject json : itemsList) { PageData item = new PageData(); - item.put("RECORDITEM_ID", json.get("RECORDITEM_ID")); // 主键 + item.put("RECORDITEM_ID", this.get32UUID()); // 主键 item.put("CUSTOM_ITEM_ID", json.get("CUSTOM_ITEM_ID")); PageData chei = customItemService.findById(item); item.put("ISNORMAL", json.get("ISNORMAL")); @@ -186,8 +186,7 @@ public class CustomCheckRecordController extends BaseController { item.put("CHECK_CONTENT", chei.get("CHECK_CONTENT")); item.put("CHECK_STANDARD", chei.get("CHECK_STANDARD")); item.put("REFERENCE_BASIS", chei.get("REFERENCE_BASIS")); - item.put("ISNORMAL", chei.get("ISNORMAL")); - item.put("CHECK_RESULT", chei.get("CHECK_RESULT")); + item.put("CHECK_RESULT", json.get("CHECK_RESULT")); item.put("COMMON_ITEM_SORT", chei.get("COMMON_ITEM_SORT")); item.put("LONGITUDE", pd.get("LONGITUDE")); item.put("LATITUDE", pd.get("LATITUDE")); @@ -195,7 +194,7 @@ public class CustomCheckRecordController extends BaseController { item.put("ISDELETE", "0"); item.put("CREATOR_ID", Jurisdiction.getUSER_ID()); item.put("CREATOR_NAME", Jurisdiction.getUsername()); - item.put("CREATOR_TIME", DateUtil.date2Str(new Date())); //删除时间 + item.put("CREATE_TIME", DateUtil.date2Str(new Date())); //删除时间 customCheckRecordItemService.save(item); } } diff --git a/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomController.java b/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomController.java index 0e0cfbe..64f2b14 100644 --- a/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomController.java +++ b/src/main/java/com/zcloud/controller/hiddenDangerCheckStandard/CustomController.java @@ -5,25 +5,32 @@ import com.alibaba.fastjson.JSONObject; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; +import com.zcloud.entity.system.Dictionaries; import com.zcloud.logs.LogAnno; import com.zcloud.service.check.*; import com.zcloud.service.hiddenDangerCheckStandard.*; +import com.zcloud.service.inspection.DictionaryService; import com.zcloud.service.offduty.OffDutyService; import com.zcloud.service.risk.IdentificationPartsService; import com.zcloud.service.system.DepartmentService; +import com.zcloud.service.system.PostService; import com.zcloud.service.system.UsersService; -import com.zcloud.util.DateUtil; -import com.zcloud.util.Jurisdiction; -import com.zcloud.util.Tools; -import com.zcloud.util.Warden; +import com.zcloud.util.*; +import org.apache.commons.io.FileUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; 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.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import java.io.File; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; /** * 说明:清单管理-隐患排查清单 @@ -59,6 +66,13 @@ public class CustomController extends BaseController { private UsersService usersService; @Autowired private OffDutyService offdutyService; + @Autowired + private StandardDictionaryService standardDictionaryService; + @Autowired + private DictionaryService dictionaryService; + @Autowired + private PostService postService; + /** * 新增 @@ -94,20 +108,92 @@ public class CustomController extends BaseController { if (pd.get("LISTITEM") != null && !pd.get("LISTITEM").equals("")) { List list = (List) JSON.parse(pd.get("LISTITEM").toString()); for (JSONObject json : list) { + int commonSort = 0; + String CHECK_CATEGORY_Temp = ""; + String CHECK_ITEM_Temp = ""; + if (Tools.isEmpty(json.get("CHECK_CATEGORY")) || Tools.isEmpty(json.get("CHECK_ITEM"))) { + PageData dict = new PageData(); + dict.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + List dictList = standardDictionaryService.list(dict); + int maxsortNum = 0; + Boolean existCategory = false; + for (int j = 0; j < dictList.size(); j++) { + if ("1".equals(dictList.get(j).get("DICTIONARY_LEVEL").toString())) { + if (!dictList.get(j).get("DICTIONARY_NAME").equals(json.get("CHECK_CATEGORY_NAME"))) { //如果不存在该字典,获取最大排序号 + if (maxsortNum < Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT"))) { + maxsortNum = Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT")); + } + } else { + CHECK_CATEGORY_Temp = dictList.get(j).get("DICTIONARY_ID").toString(); + existCategory = true; + } + } + } + if (!existCategory) { + dict.put("DICTIONARY_ID", this.get32UUID()); + dict.put("DICTIONARY_LEVEL", "1"); + dict.put("DICTIONARY_SORT", maxsortNum + 1); + dict.put("DICTIONARY_NAME", json.get("CHECK_CATEGORY_NAME")); + dict.put("PARENT_ID", "0"); + dict.put("PARENT_IDS", dict.get("DICTIONARY_ID")); + dict.put("DICTIONARY_NAMES", dict.get("DICTIONARY_NAME")); + dict.put("DICTIONARY_SOURCE", "2"); + dict.put("ISDELETE", "0"); + dict.put("CREATOR_ID", Jurisdiction.getUSER_ID()); + dict.put("CREATOR_NAME", Jurisdiction.getUsername()); + dict.put("CREATE_TIME", DateUtil.date2Str(new Date())); + dict.put("OPERATOR_ID", Jurisdiction.getUSER_ID()); + dict.put("OPERATOR_NAME", Jurisdiction.getUsername()); + dict.put("OPERATE_TIME", DateUtil.date2Str(new Date())); + dict.put("DELETEOR_ID", Jurisdiction.getUSER_ID()); + dict.put("DELETEOR_NAME", Jurisdiction.getUsername()); + dict.put("DELETE_TIME", DateUtil.date2Str(new Date())); + standardDictionaryService.save(dict); + CHECK_CATEGORY_Temp = dict.get("DICTIONARY_ID").toString(); + } + PageData dictItem = new PageData(); + dictItem.putAll(dict); + maxsortNum = 0; + Boolean existItem = false; + for (int j = 0; j < dictList.size(); j++) { + if ("2".equals(dictList.get(j).get("DICTIONARY_LEVEL").toString())) { + if (!dictList.get(j).get("DICTIONARY_NAME").equals(json.get("CHECK_ITEM_NAME"))) { //如果不存在该字典,获取最大排序号 + if (maxsortNum < Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT"))) { + maxsortNum = Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT")); + } + } else { + CHECK_ITEM_Temp = dictList.get(j).get("DICTIONARY_ID").toString(); + existItem = true; + } + } + } + commonSort = maxsortNum == 0 ? 1 : maxsortNum; + if (!existItem) { + dictItem.put("DICTIONARY_ID", this.get32UUID()); + dictItem.put("DICTIONARY_LEVEL", "2"); + dictItem.put("DICTIONARY_SORT", maxsortNum + 1); + dictItem.put("DICTIONARY_NAME", json.get("CHECK_ITEM_NAME")); + dictItem.put("PARENT_ID", dict.get("DICTIONARY_ID")); + dictItem.put("PARENT_IDS", dictItem.getString("DICTIONARY_ID") + ',' + dict.getString("DICTIONARY_ID")); + dictItem.put("DICTIONARY_NAMES", dictItem.getString("DICTIONARY_NAME") + ',' + dict.getString("DICTIONARY_NAME")); + standardDictionaryService.save(dictItem); + CHECK_ITEM_Temp = dictItem.get("DICTIONARY_ID").toString(); + } + } PageData itme = new PageData(); itme.put("CUSTOM_ITEM_ID", this.get32UUID()); //主键 itme.put("CUSTOM_ID", pd.get("CUSTOM_ID")); - itme.put("CHECK_CATEGORY", json.get("CHECK_CATEGORY")); - itme.put("CHECK_ITEM", json.get("CHECK_ITEM")); + itme.put("CHECK_CATEGORY", Tools.isEmpty(json.get("CHECK_CATEGORY")) ? CHECK_CATEGORY_Temp : json.get("CHECK_CATEGORY")); + itme.put("CHECK_ITEM", Tools.isEmpty(json.get("CHECK_ITEM")) ? CHECK_ITEM_Temp : 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("COMMON_ITEM_SORT", Tools.notEmpty(json.get("COMMON_ITEM_SORT").toString())? json.get("COMMON_ITEM_SORT") : ""); - itme.put("COMMON_ID", Tools.notEmpty(json.get("COMMON_ID").toString()) ? json.get("COMMON_ID") : ""); - itme.put("COMMON_ITEM_ID", Tools.notEmpty(json.get("COMMON_ITEM_ID").toString()) ? json.get("COMMON_ITEM_ID") : ""); + itme.put("COMMON_ITEM_SORT", commonSort); + 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_ID", Jurisdiction.getUSER_ID()); //添加人id @@ -555,36 +641,38 @@ public class CustomController extends BaseController { // 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()); + /** + * 去修改页面获取数据 + * + * @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()); pd.put("CUSTOM_ID", pd.get("ID")); - List varList = customItemService.listAll(pd); - pd = customService.findById(pd); //根据ID读取 + List varList = customItemService.listAll(pd); + pd = customService.findById(pd); //根据ID读取 - for (PageData item : varList) { - item.put("RECORDITEM_ID", this.get32UUID()); //主键 - } + for (PageData item : varList) { + item.put("RECORDITEM_ID", this.get32UUID()); //主键 + } // List ideList = identificationPartsService.listAllByList(pd); - map.put("varList", varList); + map.put("varList", varList); // map.put("ideList", ideList); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + map.put("pd", pd); + map.put("result", errInfo); + return map; + } /** * 批量删除 @@ -756,6 +844,716 @@ public class CustomController extends BaseController { map.put("result", errInfo); //返回结果 return map; } + + + /** + * 从EXCEL导入到数据库 + * + * @param file + * @return + * @throws Exception + */ + @RequestMapping(value = "/readExcel") + @ResponseBody + @Transactional + @LogAnno(menuType = "双重预防", menuServer = "隐患排查", instructionsOperate = "清单管理", instructionsType = "导入") + public Object readExcel(@RequestParam(value = "FFILE", required = false) MultipartFile file) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + StringBuffer errorStr = new StringBuffer(); + PageData pd = new PageData(); + pd = this.getPageData(); // COURSEWAREID + + if (null != file && !file.isEmpty()) { + File tempFile = new File(file.getOriginalFilename()); //新建file + FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); //将MultipartFile复制到File + List listPd = (List) ObjectExcelRead.readExcel(tempFile, 2, 0, 0); //执行读EXCEL操作,读出的数据导入List 2:从第3行开始;0:从第A列开始;0:第0个sheet + /** + * var0 :序号 + * var1 :清单名称 + * var2 :是否包保责任人任务 + * var3 :任务类型 + * var4 :部门 + * var5 :岗位 + * var6 :负责人 + * var7 :排查类型 + * var8 :排查周期 + * var9 :清单类型 + * var10 :排查日期 + * var11 :检查类别 + * var12 :检查项目 + * var13 :检查内容 + * var14 :检查标准 + * var15 :参考依据 + * var16 :检查合格项 + * var17 :检查不合格项 + * var18 :操作类型 + */ + List header = new ArrayList<>(); + header.add("序号"); + header.add("清单名称"); + header.add("是否包保责任人任务"); + header.add("任务类型"); + header.add("部门"); + header.add("岗位"); + header.add("负责人"); + header.add("排查类型"); + header.add("排查周期"); + header.add("清单类型"); + header.add("排查日期"); + header.add("检查类别"); + header.add("检查项目"); + header.add("检查内容"); + header.add("检查标准"); + header.add("参考依据"); + header.add("检查合格项"); + header.add("检查不合格项"); + header.add("操作类型"); + + if (listPd.size() > 0) { + /** + * 判断是否填写必填 + * 判断excel是有有重复数据 + * 判断数据库是否有重复数据 + * 导入 + * 判断题的CD 为空 ( 多选题 单选题 判断题 ) + * 答案是否正确 + * 长度 + */ + // 查询任务类型 + List taskTypeList = dictionaryService.listSubDictByParentId("7a1afe8a5e594b6a9e0cef42bd00f352"); + Map taskTypeDegreeMap = taskTypeList.stream().collect(Collectors.toMap(Dictionaries::getNAME, Dictionaries::getDICTIONARIES_ID)); + // 排查类型 + List troubleshootingTypeList = dictionaryService.listSubDictByParentId("dc92de8a375c4b638b1b9f8d374e6426"); + Map troubleshootingTypeDegreeMap = troubleshootingTypeList.stream().collect(Collectors.toMap(Dictionaries::getNAME, Dictionaries::getBIANMA)); + // 排查周期 + List troubleshootingCycleList = dictionaryService.listSubDictByParentId("f60cf0e8315b4993b6d6049dd29f2ba5"); + Map troubleshootingCycleDegreeMap = troubleshootingCycleList.stream().collect(Collectors.toMap(Dictionaries::getNAME, Dictionaries::getBIANMA)); + // 清单类型 + List inventoryTypeList = dictionaryService.listSubDictByParentId("4a3d0d99b0ea4e268c11dd0b18866917"); + Map inventoryTypeDegreeMap = inventoryTypeList.stream().collect(Collectors.toMap(Dictionaries::getNAME, Dictionaries::getBIANMA)); +// List departmentList = dictionaryService.listSubDictByParentId("4a3d0d99b0ea4e268c11dd0b18866917"); + List listAll = new ArrayList<>(); + + Integer number = 1;//行数,用于提示用户 + for (PageData lpd : listPd) { + try { + number++; + for (int i = 0; i < 19; i++) { + if (i == 0) { // var0 :序号 非必填 + continue; + } + if (!lpd.containsKey("var" + i) || Tools.isEmpty(lpd.get("var" + i))) { + if ("任务类型".equals(header.get(i))) { + continue; + } + if ("排查日期".equals(header.get(i))) { + continue; + } + if ("参考依据".equals(header.get(i))) { + continue; + } + errorStr.append("第" + number + "行的" + header.get(i) + "无数据;\n"); + continue; + } + if (lpd.get("var" + i).toString().length() >= 250) { //限制内容长度 + errorStr.append("第" + number + "行的 \"" + header.get(i) + "\"字符长度超出,请精简的250内;\n"); + } + + } + String NAME = Tools.excelHandle(lpd.get("var1")); + String BAO_BAO_TYPE = lpd.get("var2") == "是" ? "1" : "0"; + String TASK_TYPE = taskTypeDegreeMap.get(Tools.excelHandle(lpd.get("var3"))); + String DEPARTMENT_NAME = Tools.excelHandle(lpd.get("var4")); + PageData depPd = new PageData(); + depPd.put("NAME", DEPARTMENT_NAME); + depPd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + PageData depInfo = departmentService.findByName(depPd); + String DEPARTMENT_ID = ""; + if (depInfo != null && Tools.notEmpty(depInfo.getString("DEPARTMENT_ID"))) { + DEPARTMENT_ID = depInfo.get("DEPARTMENT_ID").toString(); + }else { + errorStr.append("第" + number + "行的部门不存在;\n"); + continue; + } + PageData postPd = new PageData(); + postPd.put("DEPARTMENT_ID", DEPARTMENT_ID); + postPd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + postPd.put("NAME", Tools.excelHandle(lpd.get("var5"))); + List postList = postService.listAll(postPd); + String POST_ID = ""; + if (postList.size() != 0 && Tools.notEmpty(postList.get(0).getString("POST_ID"))) { + POST_ID = postList.get(0).getString("POST_ID"); + } else { + errorStr.append("第" + number + "行的岗位不存在;\n"); + continue; + } + PageData userPd = new PageData(); + userPd.put("DEPARTMENT_ID", DEPARTMENT_ID); + userPd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + userPd.put("POST_ID", POST_ID); + userPd.put("NAME", Tools.excelHandle(lpd.get("var6"))); + List userList = usersService.listAllUser(userPd); + String USER_ID = ""; + if (userList.size() != 0 && Tools.notEmpty(userList.get(0).getString("USER_ID"))) { + USER_ID = userList.get(0).getString("USER_ID"); + } else { + errorStr.append("第" + number + "行的负责人不存在;\n"); + continue; + } + String SCREENTYPE = troubleshootingTypeDegreeMap.get(Tools.excelHandle(lpd.get("var7"))); + String PERIOD = troubleshootingCycleDegreeMap.get(Tools.excelHandle(lpd.get("var8"))); + String TYPE = inventoryTypeDegreeMap.get(Tools.excelHandle(lpd.get("var9"))); + String CHECK_CATEGORY = Tools.excelHandle(lpd.get("var11")); + String CHECK_ITEM = Tools.excelHandle(lpd.get("var12")); + String CHECK_CONTENT = Tools.excelHandle(lpd.get("var13")); + String CHECK_STANDARD = Tools.excelHandle(lpd.get("var14")); + String REFERENCE_BASIS = Tools.excelHandle(lpd.get("var15")); + String CHECK_QUALIFIED = Tools.excelHandle(lpd.get("var16")); + String CHECK_UNQUALIFIED = Tools.excelHandle(lpd.get("var17")); + String OPERATION_TYPE = Tools.excelHandle(lpd.get("var18")); + //检查类别和检查项目如果字典里存在,则不存字典,如果不存在,则存一下 + PageData dict = new PageData(); + dict.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + List dictList = standardDictionaryService.list(dict); + int maxsortNum = 0; + Boolean exist = false; + for (int j = 0; j < dictList.size(); j++) { + if ("1".equals(dictList.get(j).get("DICTIONARY_LEVEL").toString())) { + if (!dictList.get(j).get("DICTIONARY_NAME").equals(CHECK_CATEGORY)) { //如果不存在该字典,获取最大排序号 + if (maxsortNum < Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT"))) { + maxsortNum = Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT")); + } + } else { + exist = true; + } + } + } + if (!exist) { + dict.put("DICTIONARY_ID", this.get32UUID()); + dict.put("DICTIONARY_LEVEL", "1"); + dict.put("DICTIONARY_SORT", maxsortNum + 1); + dict.put("DICTIONARY_NAME", CHECK_CATEGORY); + dict.put("PARENT_ID", "0"); + dict.put("PARENT_IDS", dict.get("DICTIONARY_ID")); + dict.put("DICTIONARY_NAMES", dict.get("DICTIONARY_NAME")); + dict.put("DICTIONARY_SOURCE", "2"); + dict.put("ISDELETE", "0"); + dict.put("CREATOR_ID", Jurisdiction.getUSER_ID()); + dict.put("CREATOR_NAME", Jurisdiction.getUsername()); + dict.put("CREATE_TIME", DateUtil.date2Str(new Date())); + dict.put("OPERATOR_ID", Jurisdiction.getUSER_ID()); + dict.put("OPERATOR_NAME", Jurisdiction.getUsername()); + dict.put("OPERATE_TIME", DateUtil.date2Str(new Date())); + dict.put("DELETEOR_ID", Jurisdiction.getUSER_ID()); + dict.put("DELETEOR_NAME", Jurisdiction.getUsername()); + dict.put("DELETE_TIME", DateUtil.date2Str(new Date())); + standardDictionaryService.save(dict); + } + PageData dictItem = new PageData(); + dictItem.putAll(dict); + maxsortNum = 0; + exist = false; + for (int j = 0; j < dictList.size(); j++) { + if ("2".equals(dictList.get(j).get("DICTIONARY_LEVEL").toString())) { + if (!dictList.get(j).get("DICTIONARY_NAME").equals(CHECK_ITEM)) { //如果不存在该字典,获取最大排序号 + if (maxsortNum < Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT"))) { + maxsortNum = Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT")); + } + } else { + exist = true; + } + } + } + maxsortNum = maxsortNum == 0 ? 1 : maxsortNum; + if (!exist) { + dictItem.put("DICTIONARY_ID", this.get32UUID()); + dictItem.put("DICTIONARY_LEVEL", "2"); + dictItem.put("DICTIONARY_SORT", maxsortNum + 1); + dictItem.put("DICTIONARY_NAME", CHECK_ITEM); + dictItem.put("PARENT_ID", dict.get("DICTIONARY_ID")); + dictItem.put("PARENT_IDS", dictItem.getString("DICTIONARY_ID") + ',' + dict.getString("DICTIONARY_ID")); + dictItem.put("DICTIONARY_NAMES", dictItem.getString("DICTIONARY_NAME") + ',' + dict.getString("DICTIONARY_NAME")); + standardDictionaryService.save(dictItem); + } + // 隐患排查清单保存 + PageData customData = new PageData(); + customData.put("CUSTOM_ID", this.get32UUID()); + customData.put("NAME", NAME); + customData.put("BAO_BAO_TYPE", BAO_BAO_TYPE); + customData.put("TASK_TYPE", TASK_TYPE); + customData.put("DEPARTMENT_ID", DEPARTMENT_ID); + customData.put("POST_ID", POST_ID); + customData.put("USER_ID", USER_ID); + customData.put("SCREENTYPE", SCREENTYPE); + customData.put("PERIOD", PERIOD); + customData.put("TYPE", TYPE); + customData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 + customData.put("ISDELETE", "0"); //是否删除 + customData.put("CREATOR", Jurisdiction.getUsername()); //添加人 + customData.put("CREATTIME", DateUtil.date2Str(new Date())); //创建时间 + customData.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + customData.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + customService.save(customData); + + // 隐患排查清单检查项保存 + PageData customItemData = new PageData(); + customItemData.putAll(customData); + customItemData.put("CUSTOM_ITEM_ID", this.get32UUID()); //主键 + customItemData.put("CHECK_CATEGORY", CHECK_CATEGORY); + customItemData.put("CHECK_ITEM", CHECK_ITEM); + customItemData.put("CHECK_CONTENT", CHECK_CONTENT); + customItemData.put("CHECK_STANDARD", CHECK_STANDARD); + customItemData.put("REFERENCE_BASIS", REFERENCE_BASIS); + customItemData.put("CHECK_QUALIFIED", CHECK_QUALIFIED); + customItemData.put("CHECK_UNQUALIFIED", CHECK_UNQUALIFIED); + customItemData.put("OPERATION_TYPE", OPERATION_TYPE == "选择" ? "1" : "2"); + customItemData.put("COMMON_ITEM_SORT", dictItem.get("DICTIONARY_SORT")); + customItemData.put("CREATOR_ID", Jurisdiction.getUSER_ID()); + customItemData.put("CREATOR_NAME", Jurisdiction.getUsername()); + customItemData.put("CREATE_TIME", DateUtil.date2Str(new Date())); + customItemData.put("OPERATOR_ID", Jurisdiction.getUSER_ID()); + customItemData.put("OPERATOR_NAME", Jurisdiction.getUsername()); + customItemData.put("OPERATE_TIME", DateUtil.date2Str(new Date())); + customItemData.put("DELETEOR_ID", Jurisdiction.getUSER_ID()); + customItemData.put("DELETEOR_NAME", Jurisdiction.getUsername()); + customItemData.put("DELETE_TIME", DateUtil.date2Str(new Date())); + customItemService.save(customItemData); + listAll.add(customData); + // 修改清单统计 + PageData newpd = new PageData(); + newpd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 + newpd.put("CUSTOM_ID", customData.get("CUSTOM_ID")); + if ("listType0005".equals(TYPE)) { + newpd.put("CUSTOMSTATISTICS_ID", this.get32UUID()); //主键 + newpd.put("STARTTIME", newpd.get("START_DATE").toString() + " 00:00:00"); + newpd.put("ENDTIME", newpd.get("END_DATE").toString() + " 23:59:59"); + newpd.put("PERIOD", null); + PageData statistics = customStatisticsService.findByCondition(newpd); + if (statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 2); + customStatisticsService.edit(statistics); + } + newpd.put("ISSTATISTICS", '0'); + // 本期已检查的不计入统计 + customCheckRecordService.editStatistics(newpd); + } else { + switch (PERIOD) { + case "checkPeriod0001"://每日 + newpd.put("STARTTIME", DateUtil.getDay() + " 00:00:00"); + newpd.put("ENDTIME", DateUtil.getDay() + " 23:59:59"); + break; + + case "checkPeriod0002"://每周 + newpd.put("STARTTIME", DateUtil.getWeekStart()); + newpd.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"; + } + newpd.put("STARTTIME", startTime); + newpd.put("ENDTIME", endTime); + break; + + case "checkPeriod0004"://每月 + newpd.put("STARTTIME", DateUtil.getMonthFirstDay() + " 00:00:00"); + newpd.put("ENDTIME", DateUtil.getMonthEndDay() + " 23:59:59"); + break; + + case "checkPeriod0005"://每季 + newpd.put("STARTTIME", DateUtil.quarterStart() + " 00:00:00"); + newpd.put("ENDTIME", DateUtil.quarterEnd() + " 23:59:59"); + break; + + case "checkPeriod0006"://每年 + newpd.put("STARTTIME", DateUtil.getCurrYearFirst() + " 00:00:00"); + newpd.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 = customStatisticsService.findByCondition(newpd); + if (statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 1); + customStatisticsService.edit(statistics); + } + newpd.put("ISSTATISTICS", '0'); + // 本期已检查的不计入统计 + customCheckRecordService.editStatistics(newpd); + } + } catch (Exception e) { + map.put("result", "fail"); //返回结果 + errorStr.append("第" + number + "行数据出现错误;
"); + return map; + } + } + + if (Tools.isEmpty(errorStr.toString())) { + errorStr.append("成功导入" + listAll.size() + "条数据!"); + } else { + errInfo = "error"; + } + FileUtils.deleteQuietly(tempFile);//删除临时文件 + } else { + map.put("result", "fail");//返回结果 + map.put("msg", "Excel数据为空,请检查数据后,重新上传!"); + FileUtils.deleteQuietly(tempFile);//删除临时文件 + return map; + } + } + map.put("result", errInfo); //返回结果 + map.put("msg", errorStr.toString()); //返回结果 + map.put("resultStr", errorStr.toString()); + return map; + } + /**修改 + * @param + * @throws Exception + */ + @RequestMapping(value="/edit") + // @RequiresPermissions("listmanager: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 = customItemService.listAll(pd2); // + for (PageData pageData : varList) { + PageData citem = new PageData(); + citem.put("CUSTOM_ITEM_ID", pageData.getString("CUSTOM_ITEM_ID")); + customItemService.delete(citem); + } + + if(pd.get("LISTITEM")!=null && !pd.get("LISTITEM").equals("")) { + List list = (List) JSON.parse(pd.get("LISTITEM").toString()); + for (JSONObject json : list) { + int commonSort = 0; + String CHECK_CATEGORY_Temp = ""; + String CHECK_ITEM_Temp = ""; + if (Tools.isEmpty(json.get("CHECK_CATEGORY")) || Tools.isEmpty(json.get("CHECK_ITEM"))) { + PageData dict = new PageData(); + dict.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + List dictList = standardDictionaryService.list(dict); + int maxsortNum = 0; + Boolean existCategory = false; + for (int j = 0; j < dictList.size(); j++) { + if ("1".equals(dictList.get(j).get("DICTIONARY_LEVEL").toString())) { + if (!dictList.get(j).get("DICTIONARY_NAME").equals(json.get("CHECK_CATEGORY_NAME"))) { //如果不存在该字典,获取最大排序号 + if (maxsortNum < Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT"))) { + maxsortNum = Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT")); + } + } else { + CHECK_CATEGORY_Temp = dictList.get(j).get("DICTIONARY_ID").toString(); + existCategory = true; + } + } + } + if (!existCategory) { + dict.put("DICTIONARY_ID", this.get32UUID()); + dict.put("DICTIONARY_LEVEL", "1"); + dict.put("DICTIONARY_SORT", maxsortNum + 1); + dict.put("DICTIONARY_NAME", json.get("CHECK_CATEGORY_NAME")); + dict.put("PARENT_ID", "0"); + dict.put("PARENT_IDS", dict.get("DICTIONARY_ID")); + dict.put("DICTIONARY_NAMES", dict.get("DICTIONARY_NAME")); + dict.put("DICTIONARY_SOURCE", "2"); + dict.put("ISDELETE", "0"); + dict.put("CREATOR_ID", Jurisdiction.getUSER_ID()); + dict.put("CREATOR_NAME", Jurisdiction.getUsername()); + dict.put("CREATE_TIME", DateUtil.date2Str(new Date())); + dict.put("OPERATOR_ID", Jurisdiction.getUSER_ID()); + dict.put("OPERATOR_NAME", Jurisdiction.getUsername()); + dict.put("OPERATE_TIME", DateUtil.date2Str(new Date())); + dict.put("DELETEOR_ID", Jurisdiction.getUSER_ID()); + dict.put("DELETEOR_NAME", Jurisdiction.getUsername()); + dict.put("DELETE_TIME", DateUtil.date2Str(new Date())); + standardDictionaryService.save(dict); + CHECK_CATEGORY_Temp = dict.get("DICTIONARY_ID").toString(); + } + PageData dictItem = new PageData(); + dictItem.putAll(dict); + maxsortNum = 0; + Boolean existItem = false; + for (int j = 0; j < dictList.size(); j++) { + if ("2".equals(dictList.get(j).get("DICTIONARY_LEVEL").toString())) { + if (!dictList.get(j).get("DICTIONARY_NAME").equals(json.get("CHECK_ITEM_NAME"))) { //如果不存在该字典,获取最大排序号 + if (maxsortNum < Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT"))) { + maxsortNum = Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT")); + } + } else { + CHECK_ITEM_Temp = dictList.get(j).get("DICTIONARY_ID").toString(); + existItem = true; + } + } + } + commonSort = maxsortNum == 0 ? 1 : maxsortNum; + if (!existItem) { + dictItem.put("DICTIONARY_ID", this.get32UUID()); + dictItem.put("DICTIONARY_LEVEL", "2"); + dictItem.put("DICTIONARY_SORT", maxsortNum + 1); + dictItem.put("DICTIONARY_NAME", json.get("CHECK_ITEM_NAME")); + dictItem.put("PARENT_ID", dict.get("DICTIONARY_ID")); + dictItem.put("PARENT_IDS", dictItem.getString("DICTIONARY_ID") + ',' + dict.getString("DICTIONARY_ID")); + dictItem.put("DICTIONARY_NAMES", dictItem.getString("DICTIONARY_NAME") + ',' + dict.getString("DICTIONARY_NAME")); + standardDictionaryService.save(dictItem); + CHECK_ITEM_Temp = dictItem.get("DICTIONARY_ID").toString(); + } + } + PageData itme = new PageData(); + itme.put("CUSTOM_ITEM_ID", this.get32UUID()); //主键 + itme.put("CUSTOM_ID", pd.get("CUSTOM_ID")); + itme.put("CHECK_CATEGORY", Tools.isEmpty(json.get("CHECK_CATEGORY")) ? CHECK_CATEGORY_Temp : json.get("CHECK_CATEGORY")); + itme.put("CHECK_ITEM", Tools.isEmpty(json.get("CHECK_ITEM")) ? CHECK_ITEM_Temp : 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("COMMON_ITEM_SORT", commonSort); + 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_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); + } + } + if(pd.getString("TYPE").equals("listType0006")){ + pd.put("ISDELETE","-99"); + }else { + pd.put("ISDELETE","0"); + } + 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("CUSTOMSTATISTICS_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 = customStatisticsService.findByCondition(oldPd); + if(statistics != null && statistics.get("CUSTOMSTATISTICS_ID") != null) { + if(Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-2 <=0) { + customStatisticsService.deletewl(statistics); + } else { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-2); + customStatisticsService.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 = customStatisticsService.findByCondition(oldPd); + if(statistics != null && statistics.get("CUSTOMSTATISTICS_ID") != null) { + if(Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-1 <=0) { + customStatisticsService.deletewl(statistics); + } else { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())-1); + customStatisticsService.edit(statistics); + } + } + } + } + if(pd.get("TYPE") != null && Tools.notEmpty(pd.get("TYPE").toString())) { + pd.put("CUSTOMSTATISTICS_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 = customStatisticsService.findByCondition(pd); + if(statistics != null && statistics.get("CUSTOMSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())+2); + customStatisticsService.edit(statistics); + } else { + pd.put("NOTEXAMINEDNUM", 2); + customStatisticsService.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 = customStatisticsService.findByCondition(pd); + if(statistics != null && statistics.get("CUSTOMSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString())+1); + customStatisticsService.edit(statistics); + } else { + pd.put("NOTEXAMINEDNUM", 1); + customStatisticsService.save(pd); + } + } + } + map.put("result", errInfo); + return map; + } // // /**导出到excel // * @param diff --git a/src/main/java/com/zcloud/mapper/datasource/hiddenDangerCheckStandard/CommonMapper.java b/src/main/java/com/zcloud/mapper/datasource/hiddenDangerCheckStandard/CommonMapper.java index 4895922..678ca32 100644 --- a/src/main/java/com/zcloud/mapper/datasource/hiddenDangerCheckStandard/CommonMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/hiddenDangerCheckStandard/CommonMapper.java @@ -18,5 +18,11 @@ public interface CommonMapper { * @throws Exception */ List datalistPage(Page page); + + /**修改 + * @param pd + * @throws Exception + */ + void edit(PageData pd); } diff --git a/src/main/java/com/zcloud/mapper/datasource/hiddenDangerCheckStandard/StandardDictionaryMapper.java b/src/main/java/com/zcloud/mapper/datasource/hiddenDangerCheckStandard/StandardDictionaryMapper.java index 7d76b4d..3758297 100644 --- a/src/main/java/com/zcloud/mapper/datasource/hiddenDangerCheckStandard/StandardDictionaryMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/hiddenDangerCheckStandard/StandardDictionaryMapper.java @@ -1,5 +1,6 @@ package com.zcloud.mapper.datasource.hiddenDangerCheckStandard; +import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import java.util.List; @@ -17,5 +18,55 @@ public interface StandardDictionaryMapper { * @throws Exception */ List list(PageData pd); + + /**新增 + * @param pd + * @throws Exception + */ + void save(PageData pd); + + /**删除 + * @param pd + * @throws Exception + */ + void delete(PageData pd); + + /**修改 + * @param pd + * @throws Exception + */ + void edit(PageData pd); + + /**列表 + * @param page + * @throws Exception + */ + List datalistPage(Page page); + + /**列表(全部) + * @param pd + * @throws Exception + */ + List listAll(PageData pd); + + /**通过id获取数据 + * @param pd + * @throws Exception + */ + PageData findById(PageData pd); + + /**批量删除 + * @param pd + * @throws Exception + */ + void deleteAll(PageData pd); + + Integer getCount(PageData pd); + + /**列表(全部) + * @param pd + * @throws Exception + */ + List listSelect(PageData pd); } diff --git a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CommonService.java b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CommonService.java index b303e47..b1a760b 100644 --- a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CommonService.java +++ b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CommonService.java @@ -19,5 +19,10 @@ public interface CommonService { */ public List list(Page page)throws Exception; + /**修改 + * @param pd + * @throws Exception + */ + void edit(PageData pd)throws Exception; } diff --git a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CustomService.java b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CustomService.java index a321476..91840b6 100644 --- a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CustomService.java +++ b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/CustomService.java @@ -107,5 +107,6 @@ public interface CustomService { List getListByCorplistPage(Page page)throws Exception; + } diff --git a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/StandardDictionaryService.java b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/StandardDictionaryService.java index ba60f7a..8d4fcb7 100644 --- a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/StandardDictionaryService.java +++ b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/StandardDictionaryService.java @@ -1,5 +1,6 @@ package com.zcloud.service.hiddenDangerCheckStandard; +import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import java.util.List; @@ -17,5 +18,65 @@ public interface StandardDictionaryService { * @throws Exception */ List list(PageData pd)throws Exception; + + /**新增 + * @param pd + * @throws Exception + */ + void save(PageData pd)throws Exception; + + /**删除 + * @param pd + * @throws Exception + */ + void delete(PageData pd)throws Exception; + + /**修改 + * @param pd + * @throws Exception + */ + void edit(PageData pd)throws Exception; + + /**列表 + * @param page + * @throws Exception + */ + List list(Page page)throws Exception; + + /**列表(全部) + * @param pd + * @throws Exception + */ + List listTree(PageData pd)throws Exception; + + /**列表(全部) + * @param pd + * @throws Exception + */ + List listAll(PageData pd)throws Exception; + + /**通过id获取数据 + * @param pd + * @throws Exception + */ + PageData findById(PageData pd)throws Exception; + + /**批量删除 + * @param pd + * @throws Exception + */ + void deleteAll(PageData pd)throws Exception; + + /**通过id获取数据 + * @param pd + * @throws Exception + */ + Integer getCount(PageData pd)throws Exception; + + /**列表(全部) + * @param pd + * @throws Exception + */ + List listSelect(PageData pd)throws Exception; } diff --git a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/CommonServiceImpl.java b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/CommonServiceImpl.java index 6d9a7ee..ecf82fe 100644 --- a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/CommonServiceImpl.java +++ b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/CommonServiceImpl.java @@ -30,6 +30,17 @@ public class CommonServiceImpl implements CommonService { public List list(Page page)throws Exception{ return commonMapper.datalistPage(page); } + + /** + * 修改 + * + * @param pd + * @throws Exception + */ + @Override + public void edit(PageData pd) throws Exception { + commonMapper.edit(pd); + } } 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 2cb20f7..dbe9461 100644 --- a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/CustomServiceImpl.java +++ b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/CustomServiceImpl.java @@ -80,13 +80,6 @@ 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); @@ -147,7 +140,13 @@ public class CustomServiceImpl implements CustomService { return customMapper.getListByCorplistPage(page); } - + /**修改 + * @param pd + * @throws Exception + */ + public void edit(PageData pd)throws Exception{ + customMapper.edit(pd); + } } diff --git a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/StandardDictionaryServiceImpl.java b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/StandardDictionaryServiceImpl.java index c3f20eb..2736638 100644 --- a/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/StandardDictionaryServiceImpl.java +++ b/src/main/java/com/zcloud/service/hiddenDangerCheckStandard/impl/StandardDictionaryServiceImpl.java @@ -1,5 +1,6 @@ package com.zcloud.service.hiddenDangerCheckStandard.impl; +import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.mapper.datasource.hiddenDangerCheckStandard.StandardDictionaryMapper; import com.zcloud.service.hiddenDangerCheckStandard.StandardDictionaryService; @@ -7,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; +import java.util.*; /** * 说明:清单管理 @@ -29,6 +30,134 @@ public class StandardDictionaryServiceImpl implements StandardDictionaryService public List list(PageData pd)throws Exception{ return dictionaryMapper.list(pd); } + /** + * 新增 + * + * @param pd + * @throws Exception + */ + public void save(PageData pd) throws Exception { + dictionaryMapper.save(pd); + } + + /** + * 删除 + * + * @param pd + * @throws Exception + */ + public void delete(PageData pd) throws Exception { + dictionaryMapper.delete(pd); + } + + /** + * 修改 + * + * @param pd + * @throws Exception + */ + public void edit(PageData pd) throws Exception { + dictionaryMapper.edit(pd); + } + + /** + * 列表 + * + * @param page + * @throws Exception + */ + public List list(Page page) throws Exception { + return dictionaryMapper.datalistPage(page); + } + + /**列表(全部) + * @param pd + * @throws Exception + */ + public List listTree(PageData pd)throws Exception { + List list = new ArrayList<>(); + List listAll = dictionaryMapper.listAll(pd); + Map map = new HashMap<>(); + for (PageData r : listAll) { + map.put(r.getString("DICTIONARY_ID"), r); + } + Iterator> it = map.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry entry = it.next(); + PageData root = entry.getValue(); + if ("0".equals(root.getString("PARENT_ID"))) { + root.put("PARENT_NAME", "(无)"); + list.add(entry.getValue()); + it.remove();//使用迭代器的remove()方法删除元素 + } + } + list.sort((x, y) -> Integer.compare(Integer.parseInt(x.get("DICTIONARY_SORT").toString()), Integer.parseInt(y.get("DICTIONARY_SORT").toString()))); + TreeAppendChildren(map, list); + + return list; + } + + private void TreeAppendChildren(Map map, List list) { + if (!map.isEmpty()) { + for (PageData parent : list) { + List children = new ArrayList(); + Iterator> it = map.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry entry = it.next(); + PageData child = entry.getValue(); + if (parent.getString("DICTIONARY_ID").equals(child.getString("PARENT_ID"))) { + children.add(child); + it.remove();//使用迭代器的remove()方法删除元素 + } + } + if (children.size() > 0) { + children.sort((x, y) -> Integer.compare(Integer.parseInt(x.get("DICTIONARY_SORT").toString()), Integer.parseInt(y.get("DICTIONARY_SORT").toString()))); + parent.put("children", children); + TreeAppendChildren(map, children); + } + } + } + } + + /** + * 列表(全部) + * + * @param pd + * @throws Exception + */ + public List listAll(PageData pd) throws Exception { + return dictionaryMapper.listAll(pd); + } + + /** + * 通过id获取数据 + * + * @param pd + * @throws Exception + */ + public PageData findById(PageData pd) throws Exception { + return dictionaryMapper.findById(pd); + } + + /** + * 批量删除 + * + * @param pd + * @throws Exception + */ + public void deleteAll(PageData pd) throws Exception { + dictionaryMapper.deleteAll(pd); + } + + @Override + public Integer getCount(PageData pd) throws Exception { + return dictionaryMapper.getCount(pd); + } + @Override + public List listSelect(PageData pd)throws Exception{ + return dictionaryMapper.listSelect(pd); + } + } diff --git a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CommonMapper.xml b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CommonMapper.xml index 94c2bbf..71b9318 100644 --- a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CommonMapper.xml +++ b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CommonMapper.xml @@ -112,4 +112,58 @@ order by bhci.CHECK_CATEGORY,bhci.CHECK_ITEM,bhci.COMMON_ITEM_SORT + + + update + + set + + INDUSTRY_TYPE = #{INDUSTRY_TYPE}, + + + INDUSTRY_TYPE_TREE = #{INDUSTRY_TYPE_TREE}, + + + INDUSTRY_TYPE_NAMES = #{INDUSTRY_TYPE_NAMES}, + + + CHECK_STANDARD_NAME = #{CHECK_STANDARD_NAME}, + + + COMMON_STATUS = #{COMMON_STATUS}, + + + ISDELETE = #{ISDELETE}, + + + CREATOR_ID = #{CREATOR_ID}, + + + CREATOR_NAME = #{CREATOR_NAME}, + + + CREATE_TIME = #{CREATE_TIME}, + + + OPERATOR_ID = #{OPERATOR_ID}, + + + OPERATOR_NAME = #{OPERATOR_NAME}, + + + OPERATE_TIME = #{OPERATE_TIME}, + + + DELETEOR_ID = #{DELETEOR_ID}, + + + DELETEOR_NAME = #{DELETEOR_NAME}, + + + DELETE_TIME = #{DELETE_TIME}, + + COMMON_ID = COMMON_ID + where + COMMON_ID = #{COMMON_ID} + diff --git a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomCheckRecordMapper.xml b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomCheckRecordMapper.xml index 3cf2b03..e5434e3 100644 --- a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomCheckRecordMapper.xml +++ b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomCheckRecordMapper.xml @@ -22,6 +22,7 @@ f.OPERATOR, f.OPERATTIME, f.ISDELETE, + f.CHECK_USERS, f.LONGITUDE, f.LATITUDE, f.CHECKRECORD_ID, @@ -32,7 +33,8 @@ f.TYPE, f.PERIODSTART, f.PERIODEND, - f.ISSTATISTICS + f.ISSTATISTICS, + f.IMEI diff --git a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomMapper.xml b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomMapper.xml index 0052f3f..1ef005d 100644 --- a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomMapper.xml +++ b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/CustomMapper.xml @@ -1100,4 +1100,54 @@ ORDER BY d.DEP_ORDER,po.POST_ID,f.USER_ID,f.PERIOD + + + + update + + set + NAME = #{NAME}, + PERIOD = #{PERIOD}, + TYPE = #{TYPE}, + + BAO_BAO_DEPARTMENT_ID = #{BAO_BAO_DEPARTMENT_ID}, + + + ISDELETE = #{ISDELETE}, + + + BAO_BAO_USER_ID = #{BAO_BAO_USER_ID}, + + + BAO_BAO_TYPE = #{BAO_BAO_TYPE}, + + + TASK_TYPE = #{TASK_TYPE}, + + + DEPARTMENT_ID= #{DEPARTMENT_ID}, + + + POST_ID =#{POST_ID}, + + + SCREENTYPE =#{SCREENTYPE}, + + + START_DATE =#{START_DATE}, + + + END_DATE =#{END_DATE}, + + + OVERTIMENUM =#{OVERTIMENUM}, + + + USER_ID =#{USER_ID}, + + CUSTOM_ID = CUSTOM_ID + where + CUSTOM_ID = #{CUSTOM_ID} + + diff --git a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/StandardDictionaryMapper.xml b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/StandardDictionaryMapper.xml index c692f51..108da7c 100644 --- a/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/StandardDictionaryMapper.xml +++ b/src/main/resources/mybatis/datasource/hiddenDangerCheckStandard/StandardDictionaryMapper.xml @@ -89,5 +89,195 @@ or ( f.DICTIONARY_SOURCE = 2 and f.CORPINFO_ID = #{CORPINFO_ID} ) + order by f.DICTIONARY_LEVEL desc , f.DICTIONARY_SORT desc + + + + + insert into + + ( + + ) values ( + + ) + + + + + update + + set + ISDELETE = '1', + DELETEOR_ID = #{DELETEOR_ID}, + DELETEOR_NAME = #{DELETEOR_NAME}, + DELETE_TIME = #{DELETE_TIME} + where + DICTIONARY_ID = #{DICTIONARY_ID} + + + + + update + + set + + DICTIONARY_NAME = #{DICTIONARY_NAME}, + + + PARENT_ID = #{PARENT_ID}, + + + PARENT_IDS = #{PARENT_IDS}, + + + DICTIONARY_NAMES = #{DICTIONARY_NAMES}, + + + DICTIONARY_LEVEL = #{DICTIONARY_LEVEL}, + + + DICTIONARY_SORT = #{DICTIONARY_SORT}, + + + DICTIONARY_SOURCE = #{DICTIONARY_SOURCE}, + + + CORPINFO_ID = #{CORPINFO_ID}, + + + ISDELETE = #{ISDELETE}, + + + CREATOR_ID = #{CREATOR_ID}, + + + CREATOR_NAME = #{CREATOR_NAME}, + + + CREATE_TIME = #{CREATE_TIME}, + + + OPERATOR_ID = #{OPERATOR_ID}, + + + OPERATOR_NAME = #{OPERATOR_NAME}, + + + OPERATE_TIME = #{OPERATE_TIME}, + + + DELETEOR_ID = #{DELETEOR_ID}, + + + DELETEOR_NAME = #{DELETEOR_NAME}, + + + DELETE_TIME = #{DELETE_TIME}, + + DICTIONARY_ID = DICTIONARY_ID + where + DICTIONARY_ID = #{DICTIONARY_ID} + + + + + + + + + + + + + + update + + set + ISDELETE = '1', + DELETEOR_ID = #{DELETEOR_ID}, + DELETEOR_NAME = #{DELETEOR_NAME}, + DELETE_TIME = #{DELETE_TIME} + where + DICTIONARY_ID in + + #{item} + + + + + + + diff --git a/src/main/resources/mybatis/datasource/inspection/DictionaryMapper.xml b/src/main/resources/mybatis/datasource/inspection/DictionaryMapper.xml index 6f60d59..c5410a5 100644 --- a/src/main/resources/mybatis/datasource/inspection/DictionaryMapper.xml +++ b/src/main/resources/mybatis/datasource/inspection/DictionaryMapper.xml @@ -23,10 +23,7 @@ TBSNAME, TBFIELD, YNDEL, - DICTIONARIES_ID, - ISDELETE, - VISIBLE - + DICTIONARIES_ID @@ -53,9 +50,7 @@ #{TBSNAME}, #{TBFIELD}, #{YNDEL}, - #{DICTIONARIES_ID}, - #{ISDELETE}, - #{VISIBLE} + #{DICTIONARIES_ID} @@ -91,7 +86,6 @@ from where - ISDELETE = 0 and DICTIONARIES_ID = #{DICTIONARIES_ID} @@ -111,7 +104,6 @@ from where - ISDELETE = 0 and BIANMA = #{BIANMA} @@ -122,7 +114,6 @@ from where - ISDELETE = 0 and PARENT_ID = #{parentId} order by ORDER_BY ASC @@ -132,7 +123,7 @@ from - where ISDELETE = 0 + where and f.PROMISE_NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%') @@ -146,11 +137,6 @@ from where - ISDELETE = 0 - - and VISIBLE = #{ pd.VISIBLE } - - and PARENT_ID = #{pd.DICTIONARIES_ID} @@ -192,7 +178,6 @@ from where - ISDELETE = 0 and DICTIONARIES_ID in #{item} @@ -208,9 +193,7 @@ f.DICTIONARIES_ID, f.NAME, f.BIANMA, p.NAME PARENTNAME, p.BIANMA PARENTBIANMA FROM sys_dictionaries f LEFT JOIN sys_dictionaries p ON p.DICTIONARIES_ID = f.PARENT_ID - WHERE - ISDELETE = 0 and - p.PARENT_ID = #{PARENT_ID} + WHERE p.PARENT_ID = #{PARENT_ID} order by f.ORDER_BY ASC @@ -230,7 +213,6 @@ WHERE - ISDELETE = 0 and f.PARENT_ID = #{DICTIONARIES_ID} AND c.ISDELETE = '0' GROUP BY f.DICTIONARIES_ID ORDER BY f.ORDER_BY ASC @@ -248,7 +230,6 @@ from t where - ISDELETE = 0 and PARENT_ID = #{parentId} order by ORDER_BY @@ -266,7 +247,6 @@ FROM f WHERE - ISDELETE = 0 and f.PARENT_ID = #{PARENT_ID} ORDER BY f.ORDER_BY @@ -275,7 +255,6 @@ select DICTIONARIES_ID ,queryRecursiveDictDown(DICTIONARIES_ID) ids from sys_dictionaries where - ISDELETE = 0 and PARENT_ID = #{PARENT_ID} diff --git a/src/main/resources/mybatis/datasource/system/PostMapper.xml b/src/main/resources/mybatis/datasource/system/PostMapper.xml index 7e2317f..3fa62c9 100644 --- a/src/main/resources/mybatis/datasource/system/PostMapper.xml +++ b/src/main/resources/mybatis/datasource/system/PostMapper.xml @@ -141,6 +141,9 @@ AND f.CORPINFO_ID = #{CORPINFO_ID} + + and f.NAME = #{NAME} + AND f.STATUS = #{STATUS} diff --git a/src/main/resources/mybatis/datasource/system/UsersMapper.xml b/src/main/resources/mybatis/datasource/system/UsersMapper.xml index 47943da..44cfd6c 100644 --- a/src/main/resources/mybatis/datasource/system/UsersMapper.xml +++ b/src/main/resources/mybatis/datasource/system/UsersMapper.xml @@ -645,6 +645,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND u.POST_ID = #{POST_ID} + + AND + u.NAME = #{NAME} + AND u.USER_ID != #{LOGINUSERID}