隐患排查添加导入

pull/4/head
zhangyanli 2024-02-04 17:04:34 +08:00
parent 741d2f1077
commit 4f9ca7c9c9
16 changed files with 1444 additions and 451 deletions

View File

@ -100,11 +100,7 @@ public class CustomController extends BaseController {
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
String listPeriod = pd.getString("PERIOD"); 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("CUSTOM_ID", this.get32UUID()); //主键
pd.put("USER_ID", userIds[i]);
if (pd.get("LISTITEM") != null && !pd.get("LISTITEM").equals("")) { if (pd.get("LISTITEM") != null && !pd.get("LISTITEM").equals("")) {
List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.get("LISTITEM").toString()); List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.get("LISTITEM").toString());
for (JSONObject json : list) { for (JSONObject json : list) {
@ -301,10 +297,8 @@ public class CustomController extends BaseController {
} }
} }
} }
}
} }
}
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
@ -322,13 +316,49 @@ public class CustomController extends BaseController {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success"; String errInfo = "success";
PageData pd = new PageData(); PageData pd = new PageData();
PageData npd = new PageData();
pd = this.getPageData(); pd = this.getPageData();
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); npd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
npd.put("ISMAIN", Jurisdiction.getIS_MAIN());
npd.put("ISSUPERVISE", Jurisdiction.getISSUPERVISE());
npd.put("DEPARTMENT_ID", Jurisdiction.getDEPARTMENT_ID());
pd.put("USER_ID",Jurisdiction.getUSER_ID());
String DEPTIDS = pd.getString("DEPTIDS");
if(Tools.notEmpty(DEPTIDS)) {
String DEPT_IDS[] = DEPTIDS.split(",");
npd.put("DEPT_IDS", DEPT_IDS);
}
npd.put("HIDFORBIDDEN", "no"); //企业
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
if (Tools.notEmpty(KEYWORDS)) pd.put("KEYWORDS", KEYWORDS.trim()); if(Tools.notEmpty(KEYWORDS))npd.put("KEYWORDS", KEYWORDS.trim());
page.setPd(pd); String USERNAME = pd.getString("USERNAME"); //关键词检索条件
if(Tools.notEmpty(USERNAME))npd.put("USERNAME", USERNAME.trim());
PageData cpd = usersService.findById(pd);
npd.put("ISLEADER", cpd.getString("ISLEADER"));
if(cpd.getString("ISLEADER") != null && cpd.getString("ISLEADER").equals("1")){
String DEPARTMENT_ID = npd.getString("DEPARTMENT_ID");
String ids = departmentService.getDEPARTMENT_IDS(DEPARTMENT_ID);
ids=npd.getString("DEPARTMENT_ID")+","+ids; //把自己部门插入进去
if(ids!=null && Tools.notEmpty(ids)&& ids.lastIndexOf(",")>-1) {
ids = ids.substring(0,ids.lastIndexOf(","));
npd.put("DEPARTMENT_IDS", ids.split(","));
}else {
npd.put("DEPARTMENT_IDS", DEPARTMENT_ID);
}
}else{
if(npd.getString("ISMAIN").equals("0") ){
npd.put("USER_ID",Jurisdiction.getUSER_ID());
}
}
npd.put("TYPE",pd.getString("TYPE"));
npd.put("LISTINGLEVEL",pd.getString("LISTINGLEVEL"));
npd.put("RISKCHECKLISTTYPE",pd.getString("RISKCHECKLISTTYPE"));
npd.put("POST_ID",pd.getString("POST_ID"));
npd.put("PERIOD",pd.getString("PERIOD"));
page.setPd(npd);
List<PageData> varList = customService.list(page); List<PageData> varList = customService.list(page);
map.put("varList", varList); map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
@ -374,7 +404,7 @@ public class CustomController extends BaseController {
pd.put("ENDTIME", pd.get("END_DATE").toString() + " 23:59:59"); pd.put("ENDTIME", pd.get("END_DATE").toString() + " 23:59:59");
pd.put("PERIOD", null); pd.put("PERIOD", null);
PageData statistics = customStatisticsService.findByCondition(pd); PageData statistics = customStatisticsService.findByCondition(pd);
if (statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { if (statistics != null && statistics.get("CUSTOMSTATISTICS_ID") != null) {
statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 2); statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 2);
customStatisticsService.edit(statistics); customStatisticsService.edit(statistics);
} }
@ -447,7 +477,7 @@ public class CustomController extends BaseController {
} }
} }
PageData statistics = customStatisticsService.findByCondition(pd); PageData statistics = customStatisticsService.findByCondition(pd);
if (statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { if (statistics != null && statistics.get("CUSTOMSTATISTICS_ID") != null) {
statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 1); statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 1);
customStatisticsService.edit(statistics); customStatisticsService.edit(statistics);
} }
@ -867,40 +897,18 @@ public class CustomController extends BaseController {
if (null != file && !file.isEmpty()) { if (null != file && !file.isEmpty()) {
File tempFile = new File(file.getOriginalFilename()); //新建file File tempFile = new File(file.getOriginalFilename()); //新建file
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); //将MultipartFile复制到File FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); //将MultipartFile复制到File
List<PageData> listPd = (List) ObjectExcelRead.readExcel(tempFile, 2, 0, 0); //执行读EXCEL操作,读出的数据导入List 2:从第3行开始0:从第A列开始0:第0个sheet List<PageData> listPd = (List) ObjectExcelRead.readExcel(tempFile, 1, 0, 0); //执行读EXCEL操作,读出的数据导入List 2:从第3行开始0:从第A列开始0:第0个sheet
/** /**
* var0 : * var0 :
* var1 : * var1 :
* var2 : * var2 :
* var3 : * var3 :
* var4 : * var4 :
* var5 : * var5 :
* var6 : * var6 :
* var7 : * var7 :
* var8 :
* var9 :
* var10 :
* var11 :
* var12 :
* var13 :
* var14 :
* var15 :
* var16 :
* var17 :
* var18 :
*/ */
List<String> header = new ArrayList<>(); List<String> 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("检查内容");
@ -916,40 +924,19 @@ public class CustomController extends BaseController {
* excel * excel
* *
* *
* CD ( )
*
* *
*/ */
// 查询任务类型
List<Dictionaries> taskTypeList = dictionaryService.listSubDictByParentId("7a1afe8a5e594b6a9e0cef42bd00f352");
Map<String, String> taskTypeDegreeMap = taskTypeList.stream().collect(Collectors.toMap(Dictionaries::getNAME, Dictionaries::getDICTIONARIES_ID));
// 排查类型
List<Dictionaries> troubleshootingTypeList = dictionaryService.listSubDictByParentId("dc92de8a375c4b638b1b9f8d374e6426");
Map<String, String> troubleshootingTypeDegreeMap = troubleshootingTypeList.stream().collect(Collectors.toMap(Dictionaries::getNAME, Dictionaries::getBIANMA));
// 排查周期
List<Dictionaries> troubleshootingCycleList = dictionaryService.listSubDictByParentId("f60cf0e8315b4993b6d6049dd29f2ba5");
Map<String, String> troubleshootingCycleDegreeMap = troubleshootingCycleList.stream().collect(Collectors.toMap(Dictionaries::getNAME, Dictionaries::getBIANMA));
// 清单类型
List<Dictionaries> inventoryTypeList = dictionaryService.listSubDictByParentId("4a3d0d99b0ea4e268c11dd0b18866917");
Map<String, String> inventoryTypeDegreeMap = inventoryTypeList.stream().collect(Collectors.toMap(Dictionaries::getNAME, Dictionaries::getBIANMA));
// List<Dictionaries> departmentList = dictionaryService.listSubDictByParentId("4a3d0d99b0ea4e268c11dd0b18866917");
List<PageData> listAll = new ArrayList<>();
Integer number = 1;//行数,用于提示用户 Integer number = 1;//行数,用于提示用户
Boolean firstFlag = true;
String CUSTOM_ID = "";
for (PageData lpd : listPd) { for (PageData lpd : listPd) {
try { try {
number++; number++;
for (int i = 0; i < 19; i++) { for (int i = 0; i < 8; i++) {
if (i == 0) { // var0 :序号 非必填 if (i == 0) { // var0 :序号 非必填
continue; continue;
} }
if (!lpd.containsKey("var" + i) || Tools.isEmpty(lpd.get("var" + i))) { 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))) { if ("参考依据".equals(header.get(i))) {
continue; continue;
} }
@ -961,63 +948,21 @@ public class CustomController extends BaseController {
} }
} }
String NAME = Tools.excelHandle(lpd.get("var1")); String CHECK_CATEGORY = Tools.excelHandle(lpd.get("var0"));
String BAO_BAO_TYPE = lpd.get("var2") == "是" ? "1" : "0"; String CHECK_ITEM = Tools.excelHandle(lpd.get("var1"));
String TASK_TYPE = taskTypeDegreeMap.get(Tools.excelHandle(lpd.get("var3"))); String CHECK_CONTENT = Tools.excelHandle(lpd.get("var2"));
String DEPARTMENT_NAME = Tools.excelHandle(lpd.get("var4")); String CHECK_STANDARD = Tools.excelHandle(lpd.get("var3"));
PageData depPd = new PageData(); String REFERENCE_BASIS = Tools.excelHandle(lpd.get("var4"));
depPd.put("NAME", DEPARTMENT_NAME); String CHECK_QUALIFIED = Tools.excelHandle(lpd.get("var5"));
depPd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); String CHECK_UNQUALIFIED = Tools.excelHandle(lpd.get("var6"));
PageData depInfo = departmentService.findByName(depPd); String OPERATION_TYPE = "选择".equals(Tools.excelHandle(lpd.get("var7"))) ? "1" : "2";
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<PageData> 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<PageData> 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(); PageData dict = new PageData();
dict.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); dict.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
List<PageData> dictList = standardDictionaryService.list(dict); List<PageData> dictList = standardDictionaryService.list(dict);
int maxsortNum = 0; int maxsortNum = 0;
Boolean exist = false; Boolean existCategory = false;
String CHECK_CATEGORY_TEMP = "";
for (int j = 0; j < dictList.size(); j++) { for (int j = 0; j < dictList.size(); j++) {
if ("1".equals(dictList.get(j).get("DICTIONARY_LEVEL").toString())) { if ("1".equals(dictList.get(j).get("DICTIONARY_LEVEL").toString())) {
if (!dictList.get(j).get("DICTIONARY_NAME").equals(CHECK_CATEGORY)) { //如果不存在该字典,获取最大排序号 if (!dictList.get(j).get("DICTIONARY_NAME").equals(CHECK_CATEGORY)) { //如果不存在该字典,获取最大排序号
@ -1025,14 +970,16 @@ public class CustomController extends BaseController {
maxsortNum = Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT")); maxsortNum = Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT"));
} }
} else { } else {
exist = true; CHECK_CATEGORY_TEMP = dictList.get(j).get("DICTIONARY_ID").toString();
existCategory = true;
} }
} }
} }
if (!exist) { maxsortNum = maxsortNum == 0 ? 1 : maxsortNum + 1;
if (!existCategory) {
dict.put("DICTIONARY_ID", this.get32UUID()); dict.put("DICTIONARY_ID", this.get32UUID());
dict.put("DICTIONARY_LEVEL", "1"); dict.put("DICTIONARY_LEVEL", "1");
dict.put("DICTIONARY_SORT", maxsortNum + 1); dict.put("DICTIONARY_SORT", maxsortNum);
dict.put("DICTIONARY_NAME", CHECK_CATEGORY); dict.put("DICTIONARY_NAME", CHECK_CATEGORY);
dict.put("PARENT_ID", "0"); dict.put("PARENT_ID", "0");
dict.put("PARENT_IDS", dict.get("DICTIONARY_ID")); dict.put("PARENT_IDS", dict.get("DICTIONARY_ID"));
@ -1049,11 +996,13 @@ public class CustomController extends BaseController {
dict.put("DELETEOR_NAME", Jurisdiction.getUsername()); dict.put("DELETEOR_NAME", Jurisdiction.getUsername());
dict.put("DELETE_TIME", DateUtil.date2Str(new Date())); dict.put("DELETE_TIME", DateUtil.date2Str(new Date()));
standardDictionaryService.save(dict); standardDictionaryService.save(dict);
CHECK_CATEGORY_TEMP = dict.get("DICTIONARY_ID").toString();
} }
PageData dictItem = new PageData(); PageData dictItem = new PageData();
dictItem.putAll(dict); dictItem.putAll(dict);
maxsortNum = 0; maxsortNum = 0;
exist = false; Boolean existItem = false;
String CHECK_ITEM_TEMP = "";
for (int j = 0; j < dictList.size(); j++) { for (int j = 0; j < dictList.size(); j++) {
if ("2".equals(dictList.get(j).get("DICTIONARY_LEVEL").toString())) { if ("2".equals(dictList.get(j).get("DICTIONARY_LEVEL").toString())) {
if (!dictList.get(j).get("DICTIONARY_NAME").equals(CHECK_ITEM)) { //如果不存在该字典,获取最大排序号 if (!dictList.get(j).get("DICTIONARY_NAME").equals(CHECK_ITEM)) { //如果不存在该字典,获取最大排序号
@ -1061,33 +1010,36 @@ public class CustomController extends BaseController {
maxsortNum = Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT")); maxsortNum = Integer.parseInt(dictList.get(j).getString("DICTIONARY_SORT"));
} }
} else { } else {
exist = true; CHECK_ITEM_TEMP = dictList.get(j).get("DICTIONARY_ID").toString();
existItem = true;
} }
} }
} }
maxsortNum = maxsortNum == 0 ? 1 : maxsortNum; maxsortNum = maxsortNum == 0 ? 1 : maxsortNum + 1;
if (!exist) { if (!existItem) {
dictItem.put("DICTIONARY_ID", this.get32UUID()); dictItem.put("DICTIONARY_ID", this.get32UUID());
dictItem.put("DICTIONARY_LEVEL", "2"); dictItem.put("DICTIONARY_LEVEL", "2");
dictItem.put("DICTIONARY_SORT", maxsortNum + 1); dictItem.put("DICTIONARY_SORT", maxsortNum);
dictItem.put("DICTIONARY_NAME", CHECK_ITEM); dictItem.put("DICTIONARY_NAME", CHECK_ITEM);
dictItem.put("PARENT_ID", dict.get("DICTIONARY_ID")); dictItem.put("PARENT_ID", dict.get("DICTIONARY_ID"));
dictItem.put("PARENT_IDS", dictItem.getString("DICTIONARY_ID") + ',' + dict.getString("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")); dictItem.put("DICTIONARY_NAMES", dictItem.getString("DICTIONARY_NAME") + ',' + dict.getString("DICTIONARY_NAME"));
standardDictionaryService.save(dictItem); standardDictionaryService.save(dictItem);
CHECK_ITEM_TEMP = dictItem.get("DICTIONARY_ID").toString();
} }
if (firstFlag) {
// 隐患排查清单保存 // 隐患排查清单保存
PageData customData = new PageData(); PageData customData = new PageData();
customData.put("CUSTOM_ID", this.get32UUID()); customData.put("CUSTOM_ID", this.get32UUID());
customData.put("NAME", NAME); customData.put("NAME", pd.getString("NAME"));
customData.put("BAO_BAO_TYPE", BAO_BAO_TYPE); customData.put("BAO_BAO_TYPE", pd.getString("BAO_BAO_TYPE"));
customData.put("TASK_TYPE", TASK_TYPE); customData.put("TASK_TYPE", pd.getString("TASK_TYPE"));
customData.put("DEPARTMENT_ID", DEPARTMENT_ID); customData.put("DEPARTMENT_ID", pd.getString("DEPARTMENT_ID"));
customData.put("POST_ID", POST_ID); customData.put("POST_ID", pd.getString("POST_ID"));
customData.put("USER_ID", USER_ID); customData.put("USER_ID", pd.getString("USER_ID"));
customData.put("SCREENTYPE", SCREENTYPE); customData.put("SCREENTYPE", pd.getString("SCREENTYPE"));
customData.put("PERIOD", PERIOD); customData.put("PERIOD", pd.getString("PERIOD"));
customData.put("TYPE", TYPE); customData.put("TYPE", pd.getString("TYPE"));
customData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 customData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业
customData.put("ISDELETE", "0"); //是否删除 customData.put("ISDELETE", "0"); //是否删除
customData.put("CREATOR", Jurisdiction.getUsername()); //添加人 customData.put("CREATOR", Jurisdiction.getUsername()); //添加人
@ -1095,20 +1047,22 @@ public class CustomController extends BaseController {
customData.put("OPERATOR", Jurisdiction.getUsername()); //修改人 customData.put("OPERATOR", Jurisdiction.getUsername()); //修改人
customData.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 customData.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
customService.save(customData); customService.save(customData);
firstFlag = false;
CUSTOM_ID = customData.getString("CUSTOM_ID");
}
// 隐患排查清单检查项保存 // 隐患排查清单检查项保存
PageData customItemData = new PageData(); PageData customItemData = new PageData();
customItemData.putAll(customData);
customItemData.put("CUSTOM_ITEM_ID", this.get32UUID()); //主键 customItemData.put("CUSTOM_ITEM_ID", this.get32UUID()); //主键
customItemData.put("CHECK_CATEGORY", CHECK_CATEGORY); customItemData.put("CUSTOM_ID", CUSTOM_ID);
customItemData.put("CHECK_ITEM", CHECK_ITEM); customItemData.put("CHECK_CATEGORY", CHECK_CATEGORY_TEMP);
customItemData.put("CHECK_ITEM", CHECK_ITEM_TEMP);
customItemData.put("CHECK_CONTENT", CHECK_CONTENT); customItemData.put("CHECK_CONTENT", CHECK_CONTENT);
customItemData.put("CHECK_STANDARD", CHECK_STANDARD); customItemData.put("CHECK_STANDARD", CHECK_STANDARD);
customItemData.put("REFERENCE_BASIS", REFERENCE_BASIS); customItemData.put("REFERENCE_BASIS", REFERENCE_BASIS);
customItemData.put("CHECK_QUALIFIED", CHECK_QUALIFIED); customItemData.put("CHECK_QUALIFIED", CHECK_QUALIFIED);
customItemData.put("CHECK_UNQUALIFIED", CHECK_UNQUALIFIED); customItemData.put("CHECK_UNQUALIFIED", CHECK_UNQUALIFIED);
customItemData.put("OPERATION_TYPE", OPERATION_TYPE == "选择" ? "1" : "2"); customItemData.put("OPERATION_TYPE", OPERATION_TYPE);
customItemData.put("COMMON_ITEM_SORT", dictItem.get("DICTIONARY_SORT")); customItemData.put("COMMON_ITEM_SORT", maxsortNum);
customItemData.put("CREATOR_ID", Jurisdiction.getUSER_ID()); customItemData.put("CREATOR_ID", Jurisdiction.getUSER_ID());
customItemData.put("CREATOR_NAME", Jurisdiction.getUsername()); customItemData.put("CREATOR_NAME", Jurisdiction.getUsername());
customItemData.put("CREATE_TIME", DateUtil.date2Str(new Date())); customItemData.put("CREATE_TIME", DateUtil.date2Str(new Date()));
@ -1117,20 +1071,20 @@ public class CustomController extends BaseController {
customItemData.put("OPERATE_TIME", DateUtil.date2Str(new Date())); customItemData.put("OPERATE_TIME", DateUtil.date2Str(new Date()));
customItemData.put("DELETEOR_ID", Jurisdiction.getUSER_ID()); customItemData.put("DELETEOR_ID", Jurisdiction.getUSER_ID());
customItemData.put("DELETEOR_NAME", Jurisdiction.getUsername()); customItemData.put("DELETEOR_NAME", Jurisdiction.getUsername());
customItemData.put("DELETE_TIME", DateUtil.date2Str(new Date())); customItemData.put("ISDELETE", "0"); //是否删除
customItemService.save(customItemData); customItemService.save(customItemData);
listAll.add(customData); // listAll.add(customData);
// 修改清单统计 // 修改清单统计
PageData newpd = new PageData(); PageData newpd = new PageData();
newpd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 newpd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业
newpd.put("CUSTOM_ID", customData.get("CUSTOM_ID")); newpd.put("CUSTOM_ID", CUSTOM_ID);
if ("listType0005".equals(TYPE)) { if ("listType0005".equals(pd.getString("TYPE"))) {
newpd.put("CUSTOMSTATISTICS_ID", this.get32UUID()); //主键 newpd.put("CUSTOMSTATISTICS_ID", this.get32UUID()); //主键
newpd.put("STARTTIME", newpd.get("START_DATE").toString() + " 00:00:00"); newpd.put("STARTTIME", newpd.get("START_DATE").toString() + " 00:00:00");
newpd.put("ENDTIME", newpd.get("END_DATE").toString() + " 23:59:59"); newpd.put("ENDTIME", newpd.get("END_DATE").toString() + " 23:59:59");
newpd.put("PERIOD", null); newpd.put("PERIOD", null);
PageData statistics = customStatisticsService.findByCondition(newpd); PageData statistics = customStatisticsService.findByCondition(newpd);
if (statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { if (statistics != null && statistics.get("CUSTOMSTATISTICS_ID") != null) {
statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 2); statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 2);
customStatisticsService.edit(statistics); customStatisticsService.edit(statistics);
} }
@ -1138,7 +1092,7 @@ public class CustomController extends BaseController {
// 本期已检查的不计入统计 // 本期已检查的不计入统计
customCheckRecordService.editStatistics(newpd); customCheckRecordService.editStatistics(newpd);
} else { } else {
switch (PERIOD) { switch (pd.getString("PERIOD")) {
case "checkPeriod0001"://每日 case "checkPeriod0001"://每日
newpd.put("STARTTIME", DateUtil.getDay() + " 00:00:00"); newpd.put("STARTTIME", DateUtil.getDay() + " 00:00:00");
newpd.put("ENDTIME", DateUtil.getDay() + " 23:59:59"); newpd.put("ENDTIME", DateUtil.getDay() + " 23:59:59");
@ -1199,7 +1153,7 @@ public class CustomController extends BaseController {
break; break;
} }
PageData statistics = customStatisticsService.findByCondition(newpd); PageData statistics = customStatisticsService.findByCondition(newpd);
if (statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { if (statistics != null && statistics.get("CUSTOMSTATISTICS_ID") != null) {
statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 1); statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 1);
customStatisticsService.edit(statistics); customStatisticsService.edit(statistics);
} }
@ -1215,7 +1169,7 @@ public class CustomController extends BaseController {
} }
if (Tools.isEmpty(errorStr.toString())) { if (Tools.isEmpty(errorStr.toString())) {
errorStr.append("成功导入" + listAll.size() + "条数据!"); errorStr.append("成功导入" + (number - 1) + "条数据!");
} else { } else {
errInfo = "error"; errInfo = "error";
} }
@ -1232,7 +1186,10 @@ public class CustomController extends BaseController {
map.put("resultStr", errorStr.toString()); map.put("resultStr", errorStr.toString());
return map; return map;
} }
/**
/**
*
*
* @param * @param
* @throws Exception * @throws Exception
*/ */
@ -1554,6 +1511,7 @@ public class CustomController extends BaseController {
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
// //
// /**导出到excel // /**导出到excel
// * @param // * @param
@ -1969,17 +1927,17 @@ public class CustomController extends BaseController {
// return map; // return map;
// } // }
// //
// @RequestMapping(value = "/saveBaoBaoType") @RequestMapping(value = "/saveBaoBaoType")
// @ResponseBody @ResponseBody
// public Object saveBaoBaoType() throws Exception { public Object saveBaoBaoType() throws Exception {
// Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
// String errInfo = "success"; String errInfo = "success";
// PageData pd = new PageData(); PageData pd = new PageData();
// pd = this.getPageData(); pd = this.getPageData();
// listmanagerService.saveBaoBaoType(pd); customService.saveBaoBaoType(pd);
// map.put("result", errInfo); map.put("result", errInfo);
// return map; return map;
// } }
// //
// /**清单检查记录(日检)统计 // /**清单检查记录(日检)统计
// * @param // * @param

View File

@ -0,0 +1,34 @@
package com.zcloud.controller.hiddenDangerCheckStandard;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.PageData;
import com.zcloud.service.hiddenDangerCheckStandard.CustomTermLibraryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/customLabelFactory")
public class CustomTermLibraryController extends BaseController {
@Autowired
private CustomTermLibraryService customTermLibraryService;
@RequestMapping(value = "/termList")
@ResponseBody
public Object list() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> varList = customTermLibraryService.listAll(pd); //列出LabelFacory列表
map.put("varList", varList);
map.put("result", errInfo);
return map;
}
}

View File

@ -0,0 +1,64 @@
package com.zcloud.mapper.datasource.hiddenDangerCheckStandard;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2022-12-27
* www.zcloudchina.com
*/
public interface CustomLabelFactoryMapper {
/**
* @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<PageData> datalistPage(Page page);
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
void deleteAll(String[] ArrayDATA_IDS);
List<PageData> findByAncestors(PageData condition);
void deleteByAncestors(PageData leafInfo);
List<PageData> findAllAncestors(PageData condition);
}

View File

@ -0,0 +1,59 @@
package com.zcloud.mapper.datasource.hiddenDangerCheckStandard;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2023-10-13
* www.zcloudchina.com
*/
public interface CustomTermLibraryMapper {
/**
* @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<PageData> datalistPage(Page page);
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
void deleteAll(String[] ArrayDATA_IDS);
}

View File

@ -0,0 +1,64 @@
package com.zcloud.service.hiddenDangerCheckStandard;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2022-12-27
* www.zcloudchina.com
*/
public interface CustomLabelFactoryService {
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception;
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception;
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception;
List<PageData> getTree(PageData condition) throws Exception;
List<PageData> saveTree(PageData pd) throws Exception;
List<PageData> findAllAncestors(PageData condition) throws Exception;
}

View File

@ -106,7 +106,7 @@ public interface CustomService {
*/ */
List<PageData> getListByCorplistPage(Page page)throws Exception; List<PageData> getListByCorplistPage(Page page)throws Exception;
void saveBaoBaoType(PageData pd) throws Exception;
} }

View File

@ -0,0 +1,59 @@
package com.zcloud.service.hiddenDangerCheckStandard;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2023-10-13
* www.zcloudchina.com
*/
public interface CustomTermLibraryService {
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception;
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception;
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception;
}

View File

@ -0,0 +1,249 @@
package com.zcloud.service.hiddenDangerCheckStandard.impl;
import com.alibaba.fastjson.JSONArray;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.hiddenDangerCheckStandard.CustomLabelFactoryMapper;
import com.zcloud.service.hiddenDangerCheckStandard.CustomLabelFactoryService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Warden;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
*
* luoxiaobao
* 2022-12-27
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class CustomLabelFacoryServiceImpl implements CustomLabelFactoryService {
@Resource
private CustomLabelFactoryMapper customLabelFactoryMapper;
/**
*
*
* @param pd
* @throws Exception
*/
public void save(PageData pd) throws Exception {
customLabelFactoryMapper.save(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void delete(PageData pd) throws Exception {
customLabelFactoryMapper.delete(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void edit(PageData pd) throws Exception {
customLabelFactoryMapper.edit(pd);
}
/**
*
*
* @param page
* @throws Exception
*/
public List<PageData> list(Page page) throws Exception {
return customLabelFactoryMapper.datalistPage(page);
}
/**
* ()
*
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd) throws Exception {
return customLabelFactoryMapper.listAll(pd);
}
/**
* id
*
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd) throws Exception {
return customLabelFactoryMapper.findById(pd);
}
/**
*
*
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS) throws Exception {
customLabelFactoryMapper.deleteAll(ArrayDATA_IDS);
}
@Override
public List<PageData> getTree(PageData request) throws Exception {
List<PageData> result = new ArrayList<>();
PageData condition = new PageData();
List<PageData> labels = customLabelFactoryMapper.findByAncestors(condition);
for (PageData label : labels) {
if ("1".equals(label.getString("IS_ANCESTORS_FLAG"))){
condition.clear();
condition.put("BUS_LABEL_FACTORY_ID",label.getString("BUS_LABEL_FACTORY_ID"));
PageData ancestors = customLabelFactoryMapper.findById(condition);
analysis(labels, ancestors);
if (ancestors != null) {
result.add(ancestors);
}
}
}
result = result.stream().sorted(Comparator.comparing(o -> new BigDecimal(String.valueOf(o.get("SORT").toString())))).collect(Collectors.toList());
return result;
}
@Override
@Transactional
public List<PageData> saveTree(PageData pd) throws Exception {
// 组织
List<PageData> _tree = Warden.getList(pd.getString("tree"));
PageData condition = new PageData();
// 删除所有标签
condition.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID());
condition.put("TYPE",pd.getString("TYPE"));
customLabelFactoryMapper.deleteByAncestors(condition);
List<PageData> result = new ArrayList<>();
for (PageData leaf : _tree) {
Warden.initDate(leaf);
leaf.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
if (leaf.get("BUS_LABEL_FACTORY_ID").toString().length() > 30) {
if ("1".equals(leaf.getString("IS_ANCESTORS_FLAG"))) {
leaf.put("NAME", leaf.getString("NAME"));
customLabelFactoryMapper.save(leaf);
} else {
leaf.put("ANCESTORS_ID", leaf.getString("BUS_LABEL_FACTORY_ID"));
leaf.put("NAME", leaf.getString("NAME"));
leaf.put("PARENT_ID", "0");
leaf.put("IS_ANCESTORS_FLAG", "1");
leaf.put("TYPE", pd.getString("TYPE"));
customLabelFactoryMapper.save(leaf);
}
} else {
leaf.put("BUS_LABEL_FACTORY_ID", Warden.get32UUID());
leaf.put("ANCESTORS_ID", leaf.getString("BUS_LABEL_FACTORY_ID"));
leaf.put("NAME", leaf.getString("NAME"));
leaf.put("PARENT_ID", "0");
leaf.put("IS_ANCESTORS_FLAG", "1");
leaf.put("TYPE", pd.getString("TYPE"));
customLabelFactoryMapper.save(leaf);
}
analysis(leaf, result, 1);
}
return result;
}
@Override
public List<PageData> findAllAncestors(PageData condition) throws Exception {
return customLabelFactoryMapper.findAllAncestors(condition);
}
private void analysis(PageData pd, List<PageData> result, Integer level) {
JSONArray children = (JSONArray) pd.get("children");
if (children == null || children.size() <= 0) {
return;
}
List<PageData> tree = Warden.getList(children);
result.addAll(tree);
for (PageData leaf : tree) {
leaf.put("BUS_LABEL_FACTORY_ID", leaf.get("BUS_LABEL_FACTORY_ID").toString().length() > 30 ? leaf.getString("BUS_LABEL_FACTORY_ID") : Warden.get32UUID());
leaf.put("ANCESTORS_ID", pd.getString("ANCESTORS_ID"));
leaf.put("PARENT_ID", pd.getString("BUS_LABEL_FACTORY_ID"));
leaf.put("IS_ANCESTORS_FLAG", "0");
leaf.put("LEVEL", level);
leaf.put("CREATOR_ID", Jurisdiction.getUSER_ID());
leaf.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
leaf.put("CREATED_TIME", DateUtil.date2Str(new Date()));
leaf.put("ISDELETE", "0");
leaf.put("TYPE", pd.getString("TYPE"));
customLabelFactoryMapper.save(leaf);
analysis(leaf, result, ++level);
}
}
private void analysis(List<PageData> labels, PageData parent) {
List<PageData> sons = labels.stream()
.filter(n -> n.getString("PARENT_ID").equals(parent.getString("BUS_LABEL_FACTORY_ID")))
.sorted(Comparator.comparing(o -> new BigDecimal(String.valueOf(o.get("SORT").toString()))))
.collect(Collectors.toList());
if (parent == null) {
return;
}
parent.put("children", sons);
if (sons.size() > 0) {
for (PageData son : sons) {
analysis(labels, son);
}
}
}
private PageData findParentNode(List<PageData> tree, PageData branch) throws Exception {
for (PageData root : tree) {
List<PageData> branches = (List<PageData>) root.get("children");
if (branches.size() <= 0) {
continue;
}
for (PageData _branch : branches) {
if (branch.getString("BUS_LABEL_FACTORY_ID").equals(_branch.getString("BUS_LABEL_FACTORY_ID"))) {
return root;
}
}
PageData parentNode = findParentNode(branches, branch);
if (parentNode != null && parentNode.size() > 0) {
return parentNode;
}
}
return null;
}
private void initNode(PageData info, PageData gene) {
info.put("BUS_LABEL_FACTORY_ID", info.get("BUS_LABEL_FACTORY_ID").toString().length() > 30 ? info.getString("BUS_LABEL_FACTORY_ID") : Warden.get32UUID());
info.put("PARENT_ID", gene.getString("BUS_LABEL_FACTORY_ID"));
info.put("ANCESTORS_ID", gene.getString("ANCESTORS_ID"));
info.put("IS_ANCESTORS_FLAG", "0");
info.put("LEVEL", Integer.parseInt(gene.get("LEVEL").toString()) + 1);
info.put("CREATOR_ID", Jurisdiction.getUSER_ID());
info.put("CREATED_TIME", DateUtil.date2Str(new Date()));
info.put("ISDELETE", "0");
info.put("TYPE", gene.getString("TYPE"));
JSONArray _children = (JSONArray) info.get("children");
if (_children == null || _children.size() <= 0) {
return;
}
List<PageData> children = Warden.getList(_children);
for (PageData child : children) {
initNode(child, info);
}
}
}

View File

@ -2,8 +2,11 @@ package com.zcloud.service.hiddenDangerCheckStandard.impl;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.check.ListCheckItemMapper;
import com.zcloud.mapper.datasource.hiddenDangerCheckStandard.CustomMapper; import com.zcloud.mapper.datasource.hiddenDangerCheckStandard.CustomMapper;
import com.zcloud.service.hiddenDangerCheckStandard.CustomItemService;
import com.zcloud.service.hiddenDangerCheckStandard.CustomService; import com.zcloud.service.hiddenDangerCheckStandard.CustomService;
import com.zcloud.util.Warden;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -22,6 +25,8 @@ public class CustomServiceImpl implements CustomService {
@Autowired @Autowired
private CustomMapper customMapper; private CustomMapper customMapper;
@Autowired
private CustomItemService customItemService;
/** /**
@ -147,6 +152,19 @@ public class CustomServiceImpl implements CustomService {
public void edit(PageData pd)throws Exception{ public void edit(PageData pd)throws Exception{
customMapper.edit(pd); customMapper.edit(pd);
} }
@Override
@Transactional
public void saveBaoBaoType(PageData pd) throws Exception {
List<PageData> itemList = Warden.getList(pd.getString("list"));
for (PageData dto : itemList) {
PageData condition = new PageData();
condition.put("CUSTOM_ITEM_ID",dto.get("CUSTOM_ITEM_ID"));
PageData entity = customItemService.findById(condition);
entity.put("BAO_BAO_NUM",dto.get("BAO_BAO_NUM"));
customItemService.edit(entity);
}
}
} }

View File

@ -0,0 +1,83 @@
package com.zcloud.service.hiddenDangerCheckStandard.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.hiddenDangerCheckStandard.CustomTermLibraryMapper;
import com.zcloud.service.hiddenDangerCheckStandard.CustomTermLibraryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
*
* luoxiaobao
* 2023-10-13
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class CustomTermLibraryServiceImpl implements CustomTermLibraryService {
@Resource
private CustomTermLibraryMapper customTermLibraryMapper;
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception{
customTermLibraryMapper.save(pd);
}
/**
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception{
customTermLibraryMapper.delete(pd);
}
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception{
customTermLibraryMapper.edit(pd);
}
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception{
return customTermLibraryMapper.datalistPage(page);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception{
return customTermLibraryMapper.listAll(pd);
}
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception{
return customTermLibraryMapper.findById(pd);
}
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
customTermLibraryMapper.deleteAll(ArrayDATA_IDS);
}
}

View File

@ -98,10 +98,10 @@
and f.COMMON_STATUS = 1 and f.COMMON_STATUS = 1
and bhci.COMMON_ITEM_STATUS = 1 and bhci.COMMON_ITEM_STATUS = 1
<!-- and f.INDUSTRY_TYPE_NAMES = #{pd.CORP_TYPE_NAME} --> <!-- and f.INDUSTRY_TYPE_NAMES = #{pd.CORP_TYPE_NAME} -->
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 --> <if test="pd.OTHERKEYWORDS != null and pd.OTHERKEYWORDS != ''"><!-- 关键词检索 -->
and and
( (
bhci.CHECK_CONTENT LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%') bhci.CHECK_CONTENT LIKE CONCAT(CONCAT('%', #{pd.OTHERKEYWORDS}),'%')
) )
</if> </if>
<if test="pd.CHECK_CATEGORY != null and pd.CHECK_CATEGORY != ''"><!-- 检查类别 --> <if test="pd.CHECK_CATEGORY != null and pd.CHECK_CATEGORY != ''"><!-- 检查类别 -->

View File

@ -131,7 +131,7 @@
CHECK_UNQUALIFIED = #{CHECK_UNQUALIFIED}, CHECK_UNQUALIFIED = #{CHECK_UNQUALIFIED},
OPERATION_TYPE = #{OPERATION_TYPE}, OPERATION_TYPE = #{OPERATION_TYPE},
BAO_BAO_NUM = #{BAO_BAO_NUM}, BAO_BAO_NUM = #{BAO_BAO_NUM},
LISTCHECKITEM_ID = LISTCHECKITEM_ID CUSTOM_ITEM_ID = CUSTOM_ITEM_ID
where where
CUSTOM_ITEM_ID = #{CUSTOM_ITEM_ID} CUSTOM_ITEM_ID = #{CUSTOM_ITEM_ID}
</update> </update>
@ -189,7 +189,8 @@
blsd.NAME as TASK_TYPE_NAME, blsd.NAME as TASK_TYPE_NAME,
blsd.BZ as TASK_TYPE_NUM, blsd.BZ as TASK_TYPE_NUM,
bhd1.DICTIONARY_NAME as CHECK_CATEGORY_NAME, bhd1.DICTIONARY_NAME as CHECK_CATEGORY_NAME,
bhd2.DICTIONARY_NAME as CHECK_ITEM_NAME bhd2.DICTIONARY_NAME as CHECK_ITEM_NAME,
btl.DESCRIBE as BAO_BAO_NUM_NAME
from from
<include refid="tableName"></include> f <include refid="tableName"></include> f
left join bus_hiddendangercheckstandard_custom bl on bl.CUSTOM_ID = f.CUSTOM_ID left join bus_hiddendangercheckstandard_custom bl on bl.CUSTOM_ID = f.CUSTOM_ID
@ -198,6 +199,7 @@
left join sys_user u on u.USER_ID = bl.USER_ID left join sys_user u on u.USER_ID = bl.USER_ID
left join bus_hiddendangercheckstandard_dictionary bhd1 on bhd1.DICTIONARY_ID = f.CHECK_CATEGORY and bhd1.ISDELETE = 0 left join bus_hiddendangercheckstandard_dictionary bhd1 on bhd1.DICTIONARY_ID = f.CHECK_CATEGORY and bhd1.ISDELETE = 0
left join bus_hiddendangercheckstandard_dictionary bhd2 on bhd2.DICTIONARY_ID = f.CHECK_ITEM and bhd2.ISDELETE = 0 left join bus_hiddendangercheckstandard_dictionary bhd2 on bhd2.DICTIONARY_ID = f.CHECK_ITEM and bhd2.ISDELETE = 0
left join bus_hiddendangercheckstandard_term_library btl on btl.TASK_NUM = f.BAO_BAO_NUM and btl.WORK_TYPE = blsd.BZ
where f.ISDELETE = '0' where f.ISDELETE = '0'
<if test="CUSTOM_ID != null and CUSTOM_ID != ''"><!-- 检查表id --> <if test="CUSTOM_ID != null and CUSTOM_ID != ''"><!-- 检查表id -->
and f.CUSTOM_ID = #{CUSTOM_ID} and f.CUSTOM_ID = #{CUSTOM_ID}

View File

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.datasource.hiddenDangerCheckStandard.CustomLabelFactoryMapper">
<!--表名 -->
<sql id="tableName">
BUS_HIDDENDANGERCHECKSTANDARD_TERM_LIBRARY
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.PARENT_ID,
f.ANCESTORS_ID,
f.IS_ANCESTORS_FLAG,
f.LEVEL,
f.NAME,
f.CREATOR_ID,
f.CREATED_TIME,
f.ISDELETE,
f.SORT,
f.TYPE,
f.BUS_LABEL_FACTORY_ID,
f.CORPINFO_ID
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
PARENT_ID,
ANCESTORS_ID,
IS_ANCESTORS_FLAG,
LEVEL,
NAME,
CREATOR_ID,
CREATED_TIME,
ISDELETE,
SORT,
TYPE,
BUS_LABEL_FACTORY_ID,
CORPINFO_ID
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{PARENT_ID},
#{ANCESTORS_ID},
#{IS_ANCESTORS_FLAG},
#{LEVEL},
#{NAME},
#{CREATOR_ID},
#{CREATED_TIME},
#{ISDELETE},
#{SORT},
#{TYPE},
#{BUS_LABEL_FACTORY_ID},
#{CORPINFO_ID}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
BUS_LABEL_FACTORY_ID = #{BUS_LABEL_FACTORY_ID}
</delete>
<delete id="deleteByAncestors" parameterType="pd">
delete from
<include refid="tableName"></include>
where TYPE = #{TYPE}
<if test="CORPINFO_ID != '' and CORPINFO_ID != null">
and CORPINFO_ID = #{CORPINFO_ID}
</if>
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
PARENT_ID = #{PARENT_ID},
ANCESTORS_ID = #{ANCESTORS_ID},
IS_ANCESTORS_FLAG = #{IS_ANCESTORS_FLAG},
LEVEL = #{LEVEL},
NAME = #{NAME},
CREATOR_ID = #{CREATOR_ID},
CREATED_TIME = #{CREATED_TIME},
SORT = #{SORT},
TYPE = #{TYPE},
CORPINFO_ID = #{CORPINFO_ID},
BUS_LABEL_FACTORY_ID = BUS_LABEL_FACTORY_ID
where
BUS_LABEL_FACTORY_ID = #{BUS_LABEL_FACTORY_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.BUS_LABEL_FACTORY_ID = #{BUS_LABEL_FACTORY_ID}
</select>
<select id="findByAncestors" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include>
f
where f.ISDELETE = '0'
<if test="ANCESTORS_ID != null and ANCESTORS_ID != ''">
and f.ANCESTORS_ID = #{ANCESTORS_ID}
</if>
<if test="TYPE != null and TYPE != ''">
and f.TYPE = #{TYPE}
</if>
<if test="CORPINFO_ID != '' and CORPINFO_ID != null">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="IS_ANCESTORS_FLAG != null and IS_ANCESTORS_FLAG != ''">
and f.IS_ANCESTORS_FLAG = #{IS_ANCESTORS_FLAG}
</if>
</select>
<select id="findAllAncestors" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.IS_ANCESTORS_FLAG = '1' and f.ISDELETE = '0' and TYPE = #{TYPE}
<if test="NAME != null and NAME != ''">
and f.NAME LIKE CONCAT(CONCAT('%', #{NAME}),'%')
</if>
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include>
f
where f.ISDELETE = '0'
<if test="pd.NAME != null and pd.NAME != ''"><!-- 关键词检索 -->
and f.NAME LIKE CONCAT(CONCAT('%', #{pd.NAME}),'%')
</if>
<if test="pd.IS_ANCESTORS_FLAG != null and pd.IS_ANCESTORS_FLAG != ''"><!-- 关键词检索 -->
and f.IS_ANCESTORS_FLAG = #{pd.IS_ANCESTORS_FLAG}
</if>
<if test="pd.TYPE != null and pd.TYPE != ''">
and f.TYPE = #{pd.TYPE}
</if>
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f where f.ISDELETE = '0'
<if test="NAME != '' and NAME != null">
and f.NAME = #{NAME}
</if>
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
BUS_LABEL_FACTORY_ID in
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>

View File

@ -343,6 +343,72 @@
<if test="pd.TYPE != null and pd.TYPE != ''"><!-- 关键词检索 --> <if test="pd.TYPE != null and pd.TYPE != ''"><!-- 关键词检索 -->
and f.TYPE = #{pd.TYPE} and f.TYPE = #{pd.TYPE}
</if> </if>
<choose>
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
and
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="pd.DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
</when>
<otherwise>
<choose>
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
<choose>
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
and
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="pd.DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</when>
<otherwise>
and
(f.DEPARTMENT_ID in (
select
SUB_DEPARTMENT_ID
from
oa_supervision_department osd
where
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
and osd.ISDELETE = '0'
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
)or f.USER_ID = #{pd.USER_ID})
</otherwise>
</choose>
</when>
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
<choose>
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
and
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="pd.DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</when>
<otherwise>
and
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</otherwise>
</choose>
</when>
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
and f.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
</when>
<otherwise>
</otherwise>
</choose>
</otherwise>
</choose>
<if test="pd.LISTINGLEVEL != null and pd.LISTINGLEVEL != ''"><!-- 关键词检索 --> <if test="pd.LISTINGLEVEL != null and pd.LISTINGLEVEL != ''"><!-- 关键词检索 -->
<choose> <choose>
<when test='pd.LISTINGLEVEL == "1"'> <when test='pd.LISTINGLEVEL == "1"'>
@ -353,8 +419,8 @@
</otherwise> </otherwise>
</choose> </choose>
</if> </if>
<if test="pd.SCREENTYPE != null and pd.SCREENTYPE != ''"><!-- 关键词检索 --> <if test="pd.RISKCHECKLISTTYPE != null and pd.RISKCHECKLISTTYPE != ''"><!-- 关键词检索 -->
and f.SCREENTYPE = #{pd.SCREENTYPE} and f.SCREENTYPE = #{pd.RISKCHECKLISTTYPE}
</if> </if>
order by f.ISDELETE,f.OPERATTIME desc order by f.ISDELETE,f.OPERATTIME desc
</select> </select>

View File

@ -4,7 +4,7 @@
<!--表名 --> <!--表名 -->
<sql id="tableName"> <sql id="tableName">
bus_hiddendangercheckstandard_statistics BUS_HIDDENDANGERCHECKSTANDARD_STATISTICS
</sql> </sql>
<!--数据字典表名 --> <!--数据字典表名 -->
@ -79,7 +79,7 @@
set set
ISDELETE = '1' ISDELETE = '1'
where where
LISTSTATISTICS_ID = #{LISTSTATISTICS_ID} CUSTOMSTATISTICS_ID = #{CUSTOMSTATISTICS_ID}
</delete> </delete>
<!-- 物理删除--> <!-- 物理删除-->

View File

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.datasource.hiddenDangerCheckStandard.CustomTermLibraryMapper">
<!--表名 -->
<sql id="tableName">
BUS_HIDDENDANGERCHECKSTANDARD_TERM_LIBRARY
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.TASK_NUM,
f.DESCRIBE,
f.WORK_TYPE,
f.IS_DELETE,
f.CREATE_TIME,
f.TERM_LIBRARY_ID,
f.SORT
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
TASK_NUM,
DESCRIBE,
WORK_TYPE,
IS_DELETE,
CREATE_TIME,
TERM_LIBRARY_ID,
SORT
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{TASK_NUM},
#{DESCRIBE},
#{WORK_TYPE},
#{IS_DELETE},
#{CREATE_TIME},
#{TERM_LIBRARY_ID},
#{SORT}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
IS_DELETE = '1'
where
TERM_LIBRARY_ID = #{TERM_LIBRARY_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
TASK_NUM = #{TASK_NUM},
DESCRIBE = #{DESCRIBE},
WORK_TYPE = #{WORK_TYPE},
IS_DELETE = #{IS_DELETE},
CREATE_TIME = #{CREATE_TIME},
SORT = #{SORT},
TERM_LIBRARY_ID = TERM_LIBRARY_ID
where
TERM_LIBRARY_ID = #{TERM_LIBRARY_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.TERM_LIBRARY_ID = #{TERM_LIBRARY_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.IS_DELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and
(
<!-- 根据需求自己加检索条件
字段1 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
or
字段2 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
-->
)
</if>
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.IS_DELETE = '0'
<if test="WORK_TYPE != null and WORK_TYPE != null">
and f.WORK_TYPE = #{WORK_TYPE}
</if>
order by f.SORT asc
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
IS_DELETE = '1'
where
TERM_LIBRARY_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>