forked from integrated_whb/integrated_whb
隐患排查接口
parent
c886521b5b
commit
69ba309b4e
|
@ -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<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
Warden.updateDate(pd);
|
||||
commonService.edit(pd);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ public class CustomCheckRecordController extends BaseController {
|
|||
List<JSONObject> itemsList = (List<JSONObject>) 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<JSONObject> list = (List<JSONObject>) 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<PageData> 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,15 +641,17 @@ public class CustomController extends BaseController {
|
|||
// return map;
|
||||
// }
|
||||
|
||||
/**去修改页面获取数据
|
||||
/**
|
||||
* 去修改页面获取数据
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/goEdit")
|
||||
@RequestMapping(value = "/goEdit")
|
||||
@ResponseBody
|
||||
@LogAnno(menuType= "双重预防",menuServer= "隐患排查",instructionsOperate = "清单管理",instructionsType = "去修改页面获取数据")
|
||||
public Object goEdit() throws Exception{
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
@LogAnno(menuType = "双重预防", menuServer = "隐患排查", instructionsOperate = "清单管理", instructionsType = "去修改页面获取数据")
|
||||
public Object goEdit() throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
|
@ -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<String, String> map = new HashMap<String, String>();
|
||||
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<PageData> 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<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("检查合格项");
|
||||
header.add("检查不合格项");
|
||||
header.add("操作类型");
|
||||
|
||||
if (listPd.size() > 0) {
|
||||
/**
|
||||
* 判断是否填写必填
|
||||
* 判断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;//行数,用于提示用户
|
||||
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<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();
|
||||
dict.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
||||
List<PageData> 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 + "行数据出现错误;<br/>");
|
||||
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<String,Object> map = new HashMap<String,Object>();
|
||||
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<PageData> 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<JSONObject> list = (List<JSONObject>) 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<PageData> 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
|
||||
|
|
|
@ -18,5 +18,11 @@ public interface CommonMapper {
|
|||
* @throws Exception
|
||||
*/
|
||||
List<PageData> datalistPage(Page page);
|
||||
|
||||
/**修改
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
void edit(PageData pd);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<PageData> 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<PageData> datalistPage(Page page);
|
||||
|
||||
/**列表(全部)
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
List<PageData> 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<PageData> listSelect(PageData pd);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,5 +19,10 @@ public interface CommonService {
|
|||
*/
|
||||
public List<PageData> list(Page page)throws Exception;
|
||||
|
||||
/**修改
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
void edit(PageData pd)throws Exception;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,5 +107,6 @@ public interface CustomService {
|
|||
List<PageData> getListByCorplistPage(Page page)throws Exception;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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<PageData> 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<PageData> list(Page page)throws Exception;
|
||||
|
||||
/**列表(全部)
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
List<PageData> listTree(PageData pd)throws Exception;
|
||||
|
||||
/**列表(全部)
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
List<PageData> 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<PageData> listSelect(PageData pd)throws Exception;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,17 @@ public class CommonServiceImpl implements CommonService {
|
|||
public List<PageData> list(Page page)throws Exception{
|
||||
return commonMapper.datalistPage(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void edit(PageData pd) throws Exception {
|
||||
commonMapper.edit(pd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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<PageData> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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<PageData> 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<PageData> list(Page page) throws Exception {
|
||||
return dictionaryMapper.datalistPage(page);
|
||||
}
|
||||
|
||||
/**列表(全部)
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PageData> listTree(PageData pd)throws Exception {
|
||||
List<PageData> list = new ArrayList<>();
|
||||
List<PageData> listAll = dictionaryMapper.listAll(pd);
|
||||
Map<String, PageData> map = new HashMap<>();
|
||||
for (PageData r : listAll) {
|
||||
map.put(r.getString("DICTIONARY_ID"), r);
|
||||
}
|
||||
Iterator<Map.Entry<String, PageData>> it = map.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, PageData> 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<String, PageData> map, List<PageData> list) {
|
||||
if (!map.isEmpty()) {
|
||||
for (PageData parent : list) {
|
||||
List<PageData> children = new ArrayList<PageData>();
|
||||
Iterator<Map.Entry<String, PageData>> it = map.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, PageData> 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<PageData> 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<PageData> listSelect(PageData pd)throws Exception{
|
||||
return dictionaryMapper.listSelect(pd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -112,4 +112,58 @@
|
|||
</if>
|
||||
order by bhci.CHECK_CATEGORY,bhci.CHECK_ITEM,bhci.COMMON_ITEM_SORT
|
||||
</select>
|
||||
<!-- 修改 -->
|
||||
<update id="edit" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
<if test="INDUSTRY_TYPE != null and INDUSTRY_TYPE != ''">
|
||||
INDUSTRY_TYPE = #{INDUSTRY_TYPE},
|
||||
</if>
|
||||
<if test="INDUSTRY_TYPE_TREE != null and INDUSTRY_TYPE_TREE != ''">
|
||||
INDUSTRY_TYPE_TREE = #{INDUSTRY_TYPE_TREE},
|
||||
</if>
|
||||
<if test="INDUSTRY_TYPE_NAMES != null and INDUSTRY_TYPE_NAMES != ''">
|
||||
INDUSTRY_TYPE_NAMES = #{INDUSTRY_TYPE_NAMES},
|
||||
</if>
|
||||
<if test="CHECK_STANDARD_NAME != null and CHECK_STANDARD_NAME != ''">
|
||||
CHECK_STANDARD_NAME = #{CHECK_STANDARD_NAME},
|
||||
</if>
|
||||
<if test="COMMON_STATUS != null and COMMON_STATUS != ''">
|
||||
COMMON_STATUS = #{COMMON_STATUS},
|
||||
</if>
|
||||
<if test="ISDELETE != null and ISDELETE != ''">
|
||||
ISDELETE = #{ISDELETE},
|
||||
</if>
|
||||
<if test="CREATOR_ID != null and CREATOR_ID != ''">
|
||||
CREATOR_ID = #{CREATOR_ID},
|
||||
</if>
|
||||
<if test="CREATOR_NAME != null and CREATOR_NAME != ''">
|
||||
CREATOR_NAME = #{CREATOR_NAME},
|
||||
</if>
|
||||
<if test="CREATE_TIME != null and CREATE_TIME != ''">
|
||||
CREATE_TIME = #{CREATE_TIME},
|
||||
</if>
|
||||
<if test="OPERATOR_ID != null and OPERATOR_ID != ''">
|
||||
OPERATOR_ID = #{OPERATOR_ID},
|
||||
</if>
|
||||
<if test="OPERATOR_NAME != null and OPERATOR_NAME != ''">
|
||||
OPERATOR_NAME = #{OPERATOR_NAME},
|
||||
</if>
|
||||
<if test="OPERATE_TIME != null and OPERATE_TIME != ''">
|
||||
OPERATE_TIME = #{OPERATE_TIME},
|
||||
</if>
|
||||
<if test="DELETEOR_ID != null and DELETEOR_ID != ''">
|
||||
DELETEOR_ID = #{DELETEOR_ID},
|
||||
</if>
|
||||
<if test="DELETEOR_NAME != null and DELETEOR_NAME != ''">
|
||||
DELETEOR_NAME = #{DELETEOR_NAME},
|
||||
</if>
|
||||
<if test="DELETE_TIME != null and DELETE_TIME != ''">
|
||||
DELETE_TIME = #{DELETE_TIME},
|
||||
</if>
|
||||
COMMON_ID = COMMON_ID
|
||||
where
|
||||
COMMON_ID = #{COMMON_ID}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
@ -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
|
||||
</sql>
|
||||
|
||||
<!-- 字段用于新增 -->
|
||||
|
|
|
@ -1100,4 +1100,54 @@
|
|||
|
||||
ORDER BY d.DEP_ORDER,po.POST_ID,f.USER_ID,f.PERIOD
|
||||
</select>
|
||||
|
||||
<!-- 修改 -->
|
||||
<update id="edit" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
NAME = #{NAME},
|
||||
PERIOD = #{PERIOD},
|
||||
TYPE = #{TYPE},
|
||||
<if test="BAO_BAO_DEPARTMENT_ID != null or BAO_BAO_DEPARTMENT_ID != ''">
|
||||
BAO_BAO_DEPARTMENT_ID = #{BAO_BAO_DEPARTMENT_ID},
|
||||
</if>
|
||||
<if test="ISDELETE != null or ISDELETE != ''">
|
||||
ISDELETE = #{ISDELETE},
|
||||
</if>
|
||||
<if test="BAO_BAO_USER_ID != null or BAO_BAO_USER_ID != ''">
|
||||
BAO_BAO_USER_ID = #{BAO_BAO_USER_ID},
|
||||
</if>
|
||||
<if test="BAO_BAO_TYPE != null or BAO_BAO_TYPE != ''">
|
||||
BAO_BAO_TYPE = #{BAO_BAO_TYPE},
|
||||
</if>
|
||||
<if test="TASK_TYPE != null or TASK_TYPE != ''">
|
||||
TASK_TYPE = #{TASK_TYPE},
|
||||
</if>
|
||||
<if test="DEPARTMENT_ID != null or DEPARTMENT_ID != ''">
|
||||
DEPARTMENT_ID= #{DEPARTMENT_ID},
|
||||
</if>
|
||||
<if test="POST_ID != null or POST_ID != ''">
|
||||
POST_ID =#{POST_ID},
|
||||
</if>
|
||||
<if test="SCREENTYPE != null or SCREENTYPE != ''">
|
||||
SCREENTYPE =#{SCREENTYPE},
|
||||
</if>
|
||||
<if test="START_DATE != null or START_DATE != ''">
|
||||
START_DATE =#{START_DATE},
|
||||
</if>
|
||||
<if test="END_DATE != null or END_DATE != ''">
|
||||
END_DATE =#{END_DATE},
|
||||
</if>
|
||||
<if test="OVERTIMENUM != null or OVERTIMENUM != ''">
|
||||
OVERTIMENUM =#{OVERTIMENUM},
|
||||
</if>
|
||||
<if test="USER_ID != null or USER_ID!= ''">
|
||||
USER_ID =#{USER_ID},
|
||||
</if>
|
||||
CUSTOM_ID = CUSTOM_ID
|
||||
where
|
||||
CUSTOM_ID = #{CUSTOM_ID}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -89,5 +89,195 @@
|
|||
or ( f.DICTIONARY_SOURCE = 2
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID} )
|
||||
</if>
|
||||
order by f.DICTIONARY_LEVEL desc , f.DICTIONARY_SORT desc
|
||||
</select>
|
||||
|
||||
<!-- 新增-->
|
||||
<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',
|
||||
DELETEOR_ID = #{DELETEOR_ID},
|
||||
DELETEOR_NAME = #{DELETEOR_NAME},
|
||||
DELETE_TIME = #{DELETE_TIME}
|
||||
where
|
||||
DICTIONARY_ID = #{DICTIONARY_ID}
|
||||
</delete>
|
||||
|
||||
<!-- 修改 -->
|
||||
<update id="edit" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
<if test="DICTIONARY_NAME != null and DICTIONARY_NAME != ''">
|
||||
DICTIONARY_NAME = #{DICTIONARY_NAME},
|
||||
</if>
|
||||
<if test="PARENT_ID != null and PARENT_ID != ''">
|
||||
PARENT_ID = #{PARENT_ID},
|
||||
</if>
|
||||
<if test="PARENT_IDS != null and PARENT_IDS != ''">
|
||||
PARENT_IDS = #{PARENT_IDS},
|
||||
</if>
|
||||
<if test="DICTIONARY_NAMES != null and DICTIONARY_NAMES != ''">
|
||||
DICTIONARY_NAMES = #{DICTIONARY_NAMES},
|
||||
</if>
|
||||
<if test="DICTIONARY_LEVEL != null">
|
||||
DICTIONARY_LEVEL = #{DICTIONARY_LEVEL},
|
||||
</if>
|
||||
<if test="DICTIONARY_SORT != null">
|
||||
DICTIONARY_SORT = #{DICTIONARY_SORT},
|
||||
</if>
|
||||
<if test="DICTIONARY_SOURCE != null">
|
||||
DICTIONARY_SOURCE = #{DICTIONARY_SOURCE},
|
||||
</if>
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
|
||||
CORPINFO_ID = #{CORPINFO_ID},
|
||||
</if>
|
||||
<if test="ISDELETE != null and ISDELETE != ''">
|
||||
ISDELETE = #{ISDELETE},
|
||||
</if>
|
||||
<if test="CREATOR_ID != null and CREATOR_ID != ''">
|
||||
CREATOR_ID = #{CREATOR_ID},
|
||||
</if>
|
||||
<if test="CREATOR_NAME != null and CREATOR_NAME != ''">
|
||||
CREATOR_NAME = #{CREATOR_NAME},
|
||||
</if>
|
||||
<if test="CREATE_TIME != null and CREATE_TIME != ''">
|
||||
CREATE_TIME = #{CREATE_TIME},
|
||||
</if>
|
||||
<if test="OPERATOR_ID != null and OPERATOR_ID != ''">
|
||||
OPERATOR_ID = #{OPERATOR_ID},
|
||||
</if>
|
||||
<if test="OPERATOR_NAME != null and OPERATOR_NAME != ''">
|
||||
OPERATOR_NAME = #{OPERATOR_NAME},
|
||||
</if>
|
||||
<if test="OPERATE_TIME != null and OPERATE_TIME != ''">
|
||||
OPERATE_TIME = #{OPERATE_TIME},
|
||||
</if>
|
||||
<if test="DELETEOR_ID != null and DELETEOR_ID != ''">
|
||||
DELETEOR_ID = #{DELETEOR_ID},
|
||||
</if>
|
||||
<if test="DELETEOR_NAME != null and DELETEOR_NAME != ''">
|
||||
DELETEOR_NAME = #{DELETEOR_NAME},
|
||||
</if>
|
||||
<if test="DELETE_TIME != null and DELETE_TIME != ''">
|
||||
DELETE_TIME = #{DELETE_TIME},
|
||||
</if>
|
||||
DICTIONARY_ID = DICTIONARY_ID
|
||||
where
|
||||
DICTIONARY_ID = #{DICTIONARY_ID}
|
||||
</update>
|
||||
|
||||
<!-- 通过ID获取数据 -->
|
||||
<select id="findById" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
where
|
||||
f.DICTIONARY_ID = #{DICTIONARY_ID}
|
||||
</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.DICTIONARY_NAME != null and pd.DICTIONARY_NAME != ''">
|
||||
and f.DICTIONARY_NAME like CONCAT(CONCAT('%', #{pd.DICTIONARY_NAME}),'%')
|
||||
</if>
|
||||
<if test="pd.DICTIONARY_NAMES != null and pd.DICTIONARY_NAMES != ''">
|
||||
and f.DICTIONARY_NAMES like CONCAT(CONCAT('%', #{pd.DICTIONARY_NAMES}),'%')
|
||||
</if>
|
||||
order by f.DICTIONARY_SORT asc
|
||||
</select>
|
||||
|
||||
<!-- 列表(全部) -->
|
||||
<select id="listAll" parameterType="pd" resultType="pd">
|
||||
select
|
||||
CASE f.DICTIONARY_LEVEL
|
||||
WHEN 1 THEN
|
||||
COUNT(cca.COMMON_ITEM_ID)+COUNT(cua.CUSTOM_ITEM_ID)
|
||||
WHEN 2 THEN
|
||||
COUNT(cci.COMMON_ITEM_ID)+COUNT(cui.CUSTOM_ITEM_ID)
|
||||
END COUNT_USE,
|
||||
<include refid="Field"></include>
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
left join bus_hiddendangercheckstandard_common_item cca on cca.CHECK_CATEGORY = f.DICTIONARY_ID
|
||||
left join bus_hiddendangercheckstandard_common_item cci on cci.CHECK_ITEM = f.DICTIONARY_ID
|
||||
left join bus_hiddendangercheckstandard_custom_item cua on cua.CHECK_CATEGORY = f.DICTIONARY_ID
|
||||
left join bus_hiddendangercheckstandard_custom_item cui on cui.CHECK_ITEM = f.DICTIONARY_ID
|
||||
where f.ISDELETE = '0'
|
||||
group by f.DICTIONARY_ID
|
||||
order by f.DICTIONARY_LEVEL asc, f.DICTIONARY_SORT asc
|
||||
</select>
|
||||
|
||||
<!-- 批量删除 -->
|
||||
<delete id="deleteAll" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
ISDELETE = '1',
|
||||
DELETEOR_ID = #{DELETEOR_ID},
|
||||
DELETEOR_NAME = #{DELETEOR_NAME},
|
||||
DELETE_TIME = #{DELETE_TIME}
|
||||
where
|
||||
DICTIONARY_ID in
|
||||
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
<!-- * 获取符合条件数,+1后作为排序使用-->
|
||||
<select id="getCount" parameterType="pd" resultType="Integer" >
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
<include refid="tableName"></include> f
|
||||
WHERE
|
||||
<if test="DICTIONARY_LEVEL != null">
|
||||
DICTIONARY_LEVEL = #{DICTIONARY_LEVEL}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 列表(全部) -->
|
||||
<select id="listSelect" parameterType="pd" resultType="pd">
|
||||
select
|
||||
f.DICTIONARY_ID,
|
||||
f.DICTIONARY_NAME,
|
||||
f.PARENT_IDS
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
where f.ISDELETE = '0'
|
||||
<if test="DICTIONARY_LEVEL != null and DICTIONARY_LEVEL != ''">
|
||||
and f.DICTIONARY_LEVEL = #{DICTIONARY_LEVEL}
|
||||
</if>
|
||||
<if test="COMMON_ID != null and COMMON_ID != ''">
|
||||
<choose>
|
||||
<when test="DICTIONARY_LEVEL == 1">
|
||||
and exists(select 1 from BUS_HIDDENDANGERCHECKSTANDARD_COMMON_ITEM ci where ci.CHECK_CATEGORY = f.DICTIONARY_ID and
|
||||
ci.ISDELETE = '0' and ci.COMMON_ID = #{COMMON_ID}
|
||||
</when>
|
||||
<when test="DICTIONARY_LEVEL == 2">
|
||||
and exists(select 1 from BUS_HIDDENDANGERCHECKSTANDARD_COMMON_ITEM ci where ci.CHECK_ITEM = f.DICTIONARY_ID and
|
||||
ci.ISDELETE = '0' and ci.COMMON_ID = #{COMMON_ID}
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
order by f.DICTIONARY_SORT asc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -23,10 +23,7 @@
|
|||
TBSNAME,
|
||||
TBFIELD,
|
||||
YNDEL,
|
||||
DICTIONARIES_ID,
|
||||
ISDELETE,
|
||||
VISIBLE
|
||||
|
||||
DICTIONARIES_ID
|
||||
</sql>
|
||||
|
||||
<!-- 字段 -->
|
||||
|
@ -53,9 +50,7 @@
|
|||
#{TBSNAME},
|
||||
#{TBFIELD},
|
||||
#{YNDEL},
|
||||
#{DICTIONARIES_ID},
|
||||
#{ISDELETE},
|
||||
#{VISIBLE}
|
||||
#{DICTIONARIES_ID}
|
||||
</sql>
|
||||
|
||||
<!-- 新增-->
|
||||
|
@ -91,7 +86,6 @@
|
|||
from
|
||||
<include refid="tableName"></include>
|
||||
where
|
||||
ISDELETE = 0 and
|
||||
DICTIONARIES_ID = #{DICTIONARIES_ID}
|
||||
</select>
|
||||
<select id="findByName" parameterType="pd" resultType="pd">
|
||||
|
@ -100,7 +94,6 @@
|
|||
from
|
||||
<include refid="tableName"></include>
|
||||
where
|
||||
ISDELETE = 0 and
|
||||
NAME = #{NAME}
|
||||
</select>
|
||||
|
||||
|
@ -111,7 +104,6 @@
|
|||
from
|
||||
<include refid="tableName"></include>
|
||||
where
|
||||
ISDELETE = 0 and
|
||||
BIANMA = #{BIANMA}
|
||||
</select>
|
||||
|
||||
|
@ -122,7 +114,6 @@
|
|||
from
|
||||
<include refid="tableName"></include>
|
||||
where
|
||||
ISDELETE = 0 and
|
||||
PARENT_ID = #{parentId} order by ORDER_BY ASC
|
||||
</select>
|
||||
|
||||
|
@ -132,7 +123,7 @@
|
|||
<include refid="Field"></include>
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
where ISDELETE = 0
|
||||
where
|
||||
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
||||
and f.PROMISE_NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||||
</if>
|
||||
|
@ -146,11 +137,6 @@
|
|||
from
|
||||
<include refid="tableName"></include>
|
||||
where
|
||||
ISDELETE = 0
|
||||
<if test="pd.DICTIONARIES_ID == '0'.toString()"><!-- 检索 -->
|
||||
and VISIBLE = #{ pd.VISIBLE }
|
||||
</if>
|
||||
|
||||
<if test="pd.DICTIONARIES_ID!= null and pd.DICTIONARIES_ID != ''"><!-- 检索 -->
|
||||
and PARENT_ID = #{pd.DICTIONARIES_ID}
|
||||
</if>
|
||||
|
@ -192,7 +178,6 @@
|
|||
from
|
||||
<include refid="tableName"></include>
|
||||
where
|
||||
ISDELETE = 0 and
|
||||
DICTIONARIES_ID in
|
||||
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
|
||||
#{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
|
||||
|
||||
</select>
|
||||
|
@ -230,7 +213,6 @@
|
|||
</otherwise>
|
||||
</choose>
|
||||
WHERE
|
||||
ISDELETE = 0 and
|
||||
f.PARENT_ID = #{DICTIONARIES_ID} AND c.ISDELETE = '0' GROUP BY f.DICTIONARIES_ID ORDER BY f.ORDER_BY ASC
|
||||
</select>
|
||||
<!-- 通过ID获取其子级列表 -->
|
||||
|
@ -248,7 +230,6 @@
|
|||
from
|
||||
<include refid="tableName"></include> t
|
||||
where
|
||||
ISDELETE = 0 and
|
||||
PARENT_ID = #{parentId} order by ORDER_BY
|
||||
</select>
|
||||
<!-- 查询同一父级下的所有子集 -->
|
||||
|
@ -266,7 +247,6 @@
|
|||
FROM
|
||||
<include refid="tableName"></include> 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}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -141,6 +141,9 @@
|
|||
AND
|
||||
f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="NAME!= null and NAME != ''"><!-- 检索 -->
|
||||
and f.NAME = #{NAME}
|
||||
</if>
|
||||
<if test="STATUS != null and STATUS != ''"><!-- 关键词检索 -->
|
||||
AND
|
||||
f.STATUS = #{STATUS}
|
||||
|
|
|
@ -645,6 +645,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND
|
||||
u.POST_ID = #{POST_ID}
|
||||
</if>
|
||||
<if test="NAME != null and NAME != ''"><!-- 关键词检索 -->
|
||||
AND
|
||||
u.NAME = #{NAME}
|
||||
</if>
|
||||
<if test="NOSELF != null and NOSELF != ''"><!-- 关键词检索 -->
|
||||
AND
|
||||
u.USER_ID != #{LOGINUSERID}
|
||||
|
|
Loading…
Reference in New Issue