隐患排查标准库(编辑,查看,删除)

pull/1/head
wangpeng 2024-01-27 16:33:15 +08:00
parent 75933a92d8
commit 97e792b467
14 changed files with 736 additions and 66 deletions

View File

@ -8,6 +8,7 @@ import com.zcloud.service.bus.HiddenCheckService;
import com.zcloud.service.bus.HiddenSchemeService;
import com.zcloud.service.bus.HiddenService;
import com.zcloud.service.bus.ImgFilesService;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.CommonItemService;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.CommonService;
import com.zcloud.util.*;
import org.apache.commons.lang.StringUtils;
@ -39,6 +40,9 @@ public class CommonController extends BaseController {
@Autowired
private CommonService commonService;
@Autowired
private CommonItemService commonItemService;
/**
*
*
@ -54,6 +58,7 @@ public class CommonController extends BaseController {
PageData pd = new PageData();
pd = this.getPageData();
pd.put("COMMON_ID", this.get32UUID());
Warden.initDate(pd);
commonService.save(pd);
map.put("result", errInfo);
return map;
@ -62,7 +67,7 @@ public class CommonController extends BaseController {
/**
*
*
* @param out
* @param
* @throws Exception
*/
@RequestMapping(value = "/delete")
@ -73,9 +78,7 @@ public class CommonController extends BaseController {
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("DELETEOR_ID", Jurisdiction.getUSER_ID());
pd.put("DELETEOR_NAME", Jurisdiction.getName());
pd.put("DELETE_TIME", DateUtil.getTime());
Warden.deleteDate(pd);
commonService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
@ -95,6 +98,7 @@ public class CommonController extends BaseController {
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
Warden.updateDate(pd);
commonService.edit(pd);
map.put("result", errInfo);
return map;
@ -142,6 +146,25 @@ public class CommonController extends BaseController {
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/getInfo")
@ResponseBody
public Object getInfo() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = commonService.getInfo(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
*
*
@ -161,6 +184,7 @@ public class CommonController extends BaseController {
String ArrayDATA_IDS[] = DATA_IDS.split(",");
PageData del = new PageData();
del.put("ArrayDATA_IDS", ArrayDATA_IDS);
Warden.deleteDate(del);
commonService.deleteAll(del);
errInfo = "success";
} else {
@ -194,4 +218,117 @@ public class CommonController extends BaseController {
return map;
}
}
/**
*
*
* @param page
* @throws Exception
*/
@RequestMapping(value = "/pageItem")
@RequiresPermissions("hiddenDangerCheckStandardCommon:list")
@ResponseBody
public Object pageItem(Page page) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
page.setPd(pd);
List<PageData> varList = commonItemService.list(page); //列出Common列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/addItem")
@RequiresPermissions("hiddenDangerCheckStandardCommon:add")
@ResponseBody
public Object addItem() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("COMMON_ITEM_ID", this.get32UUID());
Warden.initDate(pd);
commonItemService.saveItem(pd);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/editItem")
@RequiresPermissions("hiddenDangerCheckStandardCommon:edit")
@ResponseBody
public Object editItem() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
Warden.updateDate(pd);
commonItemService.editItem(pd);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/deleteItem")
@RequiresPermissions("hiddenDangerCheckStandardCommon:del")
@ResponseBody
public Object deleteItem() throws Exception {
Map<String, String> map = new HashMap<String, String>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
Warden.deleteDate(pd);
commonItemService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/deleteItemAll")
@RequiresPermissions("hiddenDangerCheckStandardCommon:del")
@ResponseBody
public Object deleteItemAll() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String DATA_IDS = pd.getString("DATA_IDS");
if (Tools.notEmpty(DATA_IDS)) {
String ArrayDATA_IDS[] = DATA_IDS.split(",");
PageData del = new PageData();
del.put("ArrayDATA_IDS", ArrayDATA_IDS);
commonItemService.deleteAll(del);
errInfo = "success";
} else {
errInfo = "error";
}
map.put("result", errInfo); //返回结果
return map;
}
}

View File

@ -0,0 +1,202 @@
package com.zcloud.controller.hiddenDangerCheckStandardLibrary;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.DictionaryService;
import com.zcloud.util.*;
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;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* wangpeng
* 2024-01-25
* www.zcloudchina.com
*/
@Controller
@RequestMapping("/hiddenDangerCheckStandardDictionary")
public class DictionaryController extends BaseController {
@Autowired
private DictionaryService dictionaryService;
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/add")
@RequiresPermissions("hiddenDangerCheckStandardDictionary:add")
@ResponseBody
public Object add() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("COMMON_ID", this.get32UUID());
dictionaryService.save(pd);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/delete")
@RequiresPermissions("hiddenDangerCheckStandardDictionary:del")
@ResponseBody
public Object delete() throws Exception {
Map<String, String> map = new HashMap<String, String>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
Warden.deleteDate(pd);
dictionaryService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/edit")
@RequiresPermissions("hiddenDangerCheckStandardDictionary: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);
dictionaryService.edit(pd);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param page
* @throws Exception
*/
@RequestMapping(value = "/list")
@RequiresPermissions("hiddenDangerCheckStandardDictionary:list")
@ResponseBody
public Object list(Page page) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
page.setPd(pd);
List<PageData> varList = dictionaryService.list(page); //列出Dictionary列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/listTree")
@RequiresPermissions("hiddenDangerCheckStandardDictionary:list")
@ResponseBody
public Object listTree() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> varList = dictionaryService.listTree(pd); //列出Dictionary列表
map.put("varList", varList);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/goEdit")
@RequiresPermissions("hiddenDangerCheckStandardDictionary:edit")
@ResponseBody
public Object goEdit() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = dictionaryService.findById(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/deleteAll")
@RequiresPermissions("hiddenDangerCheckStandardDictionary:del")
@ResponseBody
public Object deleteAll() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String DATA_IDS = pd.getString("DATA_IDS");
if (Tools.notEmpty(DATA_IDS)) {
String ArrayDATA_IDS[] = DATA_IDS.split(",");
PageData del = new PageData();
del.put("ArrayDATA_IDS", ArrayDATA_IDS);
dictionaryService.deleteAll(del);
errInfo = "success";
} else {
errInfo = "error";
}
map.put("result", errInfo); //返回结果
return map;
}
/**
*
*
* @param page
* @throws Exception
*/
@RequestMapping(value = "/listSelect")
@ResponseBody
public Object listSelect() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> list = dictionaryService.listSelect(pd); //列出Dictionary列表
map.put("list", list);
map.put("result", errInfo);
return map;
}
}

View File

@ -54,5 +54,13 @@ public interface CommonItemMapper {
* @throws Exception
*/
void deleteAll(PageData pd);
Integer getCount(PageData pd);
/**()
* @param pd
* @throws Exception
*/
void deleteByCommon(PageData pd);
}

View File

@ -56,5 +56,11 @@ public interface DictionaryMapper {
void deleteAll(PageData pd);
Integer getCount(PageData pd);
/**()
* @param pd
* @throws Exception
*/
List<PageData> listSelect(PageData pd);
}

View File

@ -19,6 +19,12 @@ public interface CommonItemService {
*/
void save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void saveItem(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
@ -31,6 +37,14 @@ public interface CommonItemService {
*/
void edit(PageData pd)throws Exception;
/**
*
*
* @param pd
* @throws Exception
*/
public void editItem(PageData pd) throws Exception;
/**
* @param page
* @throws Exception
@ -54,5 +68,17 @@ public interface CommonItemService {
* @throws Exception
*/
void deleteAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
Integer getCount(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void deleteByCommon(PageData pd)throws Exception;
}

View File

@ -51,6 +51,13 @@ public interface CommonService {
*/
PageData findById(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
PageData getInfo(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception

View File

@ -37,6 +37,12 @@ public interface DictionaryService {
*/
List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
List<PageData> listTree(PageData pd)throws Exception;
/**()
* @param pd
* @throws Exception
@ -60,5 +66,11 @@ public interface DictionaryService {
* @throws Exception
*/
Integer getCount(PageData pd)throws Exception;
/**()
* @param pd
* @throws Exception
*/
List<PageData> listSelect(PageData pd)throws Exception;
}

View File

@ -6,7 +6,11 @@ import com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary.CommonItemMapper
import com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary.CommonMapper;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.CommonItemService;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.CommonService;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.DictionaryService;
import com.zcloud.util.Tools;
import com.zcloud.util.UuidUtil;
import com.zcloud.util.Warden;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -23,11 +27,14 @@ import java.util.List;
@Transactional //开启事物
public class CommonItemServiceImpl implements CommonItemService {
@Resource
private CommonService commonService;
@Resource
private CommonItemMapper commonItemMapper;
@Autowired
private CommonService commonService;
@Autowired
private DictionaryService dictionaryService;
/**
*
*
@ -35,7 +42,45 @@ public class CommonItemServiceImpl implements CommonItemService {
* @throws Exception
*/
public void save(PageData pd) throws Exception {
Warden.initDate(pd);
commonItemMapper.save(pd);
}
/**
* @param pd
* @throws Exception
*/
public void saveItem(PageData pd)throws Exception {
if ("value".equals(pd.getString("CHECK_CATEGORY_WAY"))) {
// 标准类别
PageData commonDict1 = new PageData();
commonDict1.put("DICTIONARY_ID", UuidUtil.get32UUID());
commonDict1.put("DICTIONARY_NAME", pd.getString("CHECK_CATEGORY"));
commonDict1.put("PARENT_ID", "0");
commonDict1.put("PARENT_IDS", commonDict1.getString("DICTIONARY_ID"));
commonDict1.put("DICTIONARY_NAMES", commonDict1.getString("DICTIONARY_NAME"));
commonDict1.put("DICTIONARY_LEVEL", 1);
Warden.initDate(commonDict1);
Integer count = dictionaryService.getCount(commonDict1);
commonDict1.put("DICTIONARY_SORT", count+1);
commonDict1.put("DICTIONARY_SOURCE", 1);
dictionaryService.save(commonDict1);
pd.put("CHECK_CATEGORY", commonDict1.getString("DICTIONARY_ID"));
// 标准项目
PageData commonDict2 = new PageData();
commonDict2.put("DICTIONARY_ID", UuidUtil.get32UUID());
commonDict2.put("DICTIONARY_NAME", pd.getString("CHECK_ITEM"));
commonDict2.put("PARENT_ID", commonDict1.getString("DICTIONARY_ID"));
commonDict2.put("PARENT_IDS", commonDict1.getString("DICTIONARY_ID")+","+commonDict2.getString("DICTIONARY_ID"));
commonDict2.put("DICTIONARY_NAMES", commonDict1.getString("DICTIONARY_NAME")+","+commonDict2.getString("DICTIONARY_NAME"));
commonDict2.put("DICTIONARY_LEVEL", 2);
Warden.initDate(commonDict2);
count = dictionaryService.getCount(commonDict2);
commonDict2.put("DICTIONARY_SORT", count+1);
commonDict2.put("DICTIONARY_SOURCE", 1);
dictionaryService.save(commonDict2);
pd.put("CHECK_ITEM", commonDict2.getString("DICTIONARY_ID"));
}
commonItemMapper.save(pd);
}
@ -60,6 +105,47 @@ public class CommonItemServiceImpl implements CommonItemService {
commonItemMapper.edit(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void editItem(PageData pd) throws Exception {
if ("value".equals(pd.getString("CHECK_CATEGORY_WAY"))) {
// 标准类别
PageData commonDict1 = new PageData();
commonDict1.put("DICTIONARY_ID", UuidUtil.get32UUID());
commonDict1.put("DICTIONARY_NAME", pd.getString("CHECK_CATEGORY"));
commonDict1.put("PARENT_ID", "0");
commonDict1.put("PARENT_IDS", commonDict1.getString("DICTIONARY_ID"));
commonDict1.put("DICTIONARY_NAMES", commonDict1.getString("DICTIONARY_NAME"));
commonDict1.put("DICTIONARY_LEVEL", 1);
Warden.initDate(commonDict1);
Integer count = dictionaryService.getCount(commonDict1);
commonDict1.put("DICTIONARY_SORT", count+1);
commonDict1.put("DICTIONARY_SOURCE", 1);
dictionaryService.save(commonDict1);
pd.put("CHECK_CATEGORY", commonDict1.getString("DICTIONARY_ID"));
// 标准项目
PageData commonDict2 = new PageData();
commonDict2.put("DICTIONARY_ID", UuidUtil.get32UUID());
commonDict2.put("DICTIONARY_NAME", pd.getString("CHECK_ITEM"));
commonDict2.put("PARENT_ID", commonDict1.getString("DICTIONARY_ID"));
commonDict2.put("PARENT_IDS", commonDict1.getString("DICTIONARY_ID")+","+commonDict2.getString("DICTIONARY_ID"));
commonDict2.put("DICTIONARY_NAMES", commonDict1.getString("DICTIONARY_NAME")+","+commonDict2.getString("DICTIONARY_NAME"));
commonDict2.put("DICTIONARY_LEVEL", 2);
Warden.initDate(commonDict2);
count = dictionaryService.getCount(commonDict2);
commonDict2.put("DICTIONARY_SORT", count+1);
commonDict2.put("DICTIONARY_SOURCE", 1);
dictionaryService.save(commonDict2);
pd.put("CHECK_ITEM", commonDict2.getString("DICTIONARY_ID"));
}
commonItemMapper.edit(pd);
}
/**
*
*
@ -100,5 +186,23 @@ public class CommonItemServiceImpl implements CommonItemService {
commonItemMapper.deleteAll(pd);
}
/**id
* @param pd
* @throws Exception
*/
@Override
public Integer getCount(PageData pd)throws Exception {
return commonItemMapper.getCount(pd);
}
/**()
* @param pd
* @throws Exception
*/
@Override
public void deleteByCommon(PageData pd)throws Exception {
commonItemMapper.deleteByCommon(pd);
}
}

View File

@ -47,8 +47,8 @@ public class CommonServiceImpl implements CommonService {
* @param pd
* @throws Exception
*/
@Override
public void save(PageData pd) throws Exception {
Warden.initDate(pd);
commonMapper.save(pd);
}
@ -58,6 +58,7 @@ public class CommonServiceImpl implements CommonService {
* @param pd
* @throws Exception
*/
@Override
public void delete(PageData pd) throws Exception {
commonMapper.delete(pd);
}
@ -68,8 +69,8 @@ public class CommonServiceImpl implements CommonService {
* @param pd
* @throws Exception
*/
@Override
public void edit(PageData pd) throws Exception {
Warden.updateDate(pd);
commonMapper.edit(pd);
}
@ -79,6 +80,7 @@ public class CommonServiceImpl implements CommonService {
* @param page
* @throws Exception
*/
@Override
public List<PageData> list(Page page) throws Exception {
return commonMapper.datalistPage(page);
}
@ -89,6 +91,7 @@ public class CommonServiceImpl implements CommonService {
* @param pd
* @throws Exception
*/
@Override
public List<PageData> listAll(PageData pd) throws Exception {
return commonMapper.listAll(pd);
}
@ -99,16 +102,32 @@ public class CommonServiceImpl implements CommonService {
* @param pd
* @throws Exception
*/
@Override
public PageData findById(PageData pd) throws Exception {
return commonMapper.findById(pd);
}
/**id
* @param pd
* @throws Exception
*/
@Override
public PageData getInfo(PageData pd)throws Exception {
pd = this.findById(pd);
PageData itemPd = new PageData();
itemPd.put("COMMON_ID", pd.getString("COMMON_ID"));
List<PageData> itemList = commonItemService.listAll(itemPd);
pd.put("itemList", itemList);
return pd;
}
/**
*
*
* @param pd
* @throws Exception
*/
@Override
public void deleteAll(PageData pd) throws Exception {
commonMapper.deleteAll(pd);
}
@ -140,16 +159,22 @@ public class CommonServiceImpl implements CommonService {
List<PageData> dictSaveList = new ArrayList<>();
List<PageData> dataList = new ArrayList<>();
int succeeNum = 1;
int itemSort = 0;
if ("appendImport".equals(pd.getString("importType"))) { //重新导入
PageData itemPd = new PageData();
itemPd.put("COMMON_ID", pd.getString("COMMON_ID"));
itemSort = commonItemService.getCount(itemPd);
}
StringBuffer errorStr = new StringBuffer();
for (int i = 0; i < excelInfo.size(); i++) {
succeeNum++;
itemSort++;
PageData data = new PageData();
data.put("COMMON_ITEM_ID",UuidUtil.get32UUID());
data.put("COMMON_ITEM_SORT",(i+1));
data.put("COMMON_ITEM_SORT",itemSort);
Map<Integer, String> mapExcel = excelInfo.get(i);
PageData dict1 = new PageData();
PageData dict2 = new PageData();
PageData dict3 = new PageData();
for (int j = 0; j < header.size(); j++) {
if (Tools.isEmpty(mapExcel.get(j)) && j < 7) {
errorStr.append("<p>第" + succeeNum + "行的\"" + header.get(j) + "\"无数据</p>");
@ -165,10 +190,13 @@ public class CommonServiceImpl implements CommonService {
}
}
if (j<3) {
setItemDict(dictAll, mapExcel, j, data, dictSaveList, dict1, dict2, dict3);
if (j<2) {
setItemDict(dictAll, mapExcel, j, data, dictSaveList, dict1, dict2);
} else {
switch (j) {
case 2:
data.put("CHECK_CONTENT", mapExcel.get(j).trim());
break;
case 3:
data.put("CHECK_STANDARD", mapExcel.get(j).trim());
break;
@ -190,13 +218,28 @@ public class CommonServiceImpl implements CommonService {
dataList.add(data);
}
if (Tools.isEmpty(errorStr.toString())) {
pd.put("COMMON_ID",UuidUtil.get32UUID());
this.save(pd);
if ("import".equals(pd.getString("importType"))) {
pd.put("COMMON_ID",UuidUtil.get32UUID());
pd.put("COMMON_STATUS",1); // 有效
Warden.initDate(pd);
this.save(pd);
}
for (PageData dict : dictSaveList) {
Warden.initDate(dict);
if (Tools.isEmpty(dict.getString("DICTIONARY_SORT"))) {
Integer count = dictionaryService.getCount(dict);
dict.put("DICTIONARY_SORT", count+1);
}
dict.put("DICTIONARY_SOURCE", 1);
dictionaryService.save(dict);
}
if ("reimport".equals(pd.getString("importType"))) { //重新导入
Warden.deleteDate(pd);
commonItemService.deleteByCommon(pd);
}
for (PageData entity : dataList) {
entity.put("COMMON_ID",pd.getString("COMMON_ID"));
Warden.initDate(entity);
commonItemService.save(entity);
}
errorStr.append("成功导入" + dataList.size() + "条数据!");
@ -211,7 +254,7 @@ public class CommonServiceImpl implements CommonService {
}
private void setItemDict(Map<String, PageData> dictAll, Map<Integer, String> map, int j, PageData data, List<PageData> dictSaveList,
PageData dict1, PageData dict2, PageData dict3) {
PageData dict1, PageData dict2) {
if (dictAll.containsKey(map.get(j).trim()+"_"+(j+1))) {
switch(j) {
case 0:
@ -222,10 +265,6 @@ public class CommonServiceImpl implements CommonService {
dict2 = dictAll.get(map.get(j).trim()+"_"+(j+1));
data.put("CHECK_ITEM",dict2.getString("DICTIONARY_ID"));
break;
case 2:
dict3 = dictAll.get(map.get(j).trim()+"_"+(j+1));
data.put("CHECK_CONTENT",dict3.getString("DICTIONARY_ID"));
break;
}
} else {
if (j == 0) {
@ -248,16 +287,6 @@ public class CommonServiceImpl implements CommonService {
dictSaveList.add(dict2);
dictAll.put(dict2.getString("DICTIONARY_NAME")+"_"+dict2.getString("DICTIONARY_LEVEL"), dict2);
data.put("CHECK_ITEM",dictAll.get(map.get(j)+"_"+(j+1)).getString("DICTIONARY_ID"));
} else if (j == 2) {
dict3.put("DICTIONARY_ID", UuidUtil.get32UUID());
dict3.put("DICTIONARY_NAME", map.get(j));
dict3.put("PARENT_ID", dict1.getString("DICTIONARY_ID"));
dict3.put("PARENT_IDS", dict1.getString("DICTIONARY_ID")+","+dict2.getString("DICTIONARY_ID")+","+dict3.getString("DICTIONARY_ID"));
dict3.put("DICTIONARY_NAMES", dict1.getString("DICTIONARY_NAME")+","+dict2.getString("DICTIONARY_NAME")+","+dict3.getString("DICTIONARY_NAME"));
dict3.put("DICTIONARY_LEVEL", 3);
dictSaveList.add(dict3);
dictAll.put(dict3.getString("DICTIONARY_NAME")+"_"+dict3.getString("DICTIONARY_LEVEL"), dict3);
data.put("CHECK_CONTENT",dictAll.get(map.get(j)+"_"+(j+1)).getString("DICTIONARY_ID"));
}
}
}

View File

@ -1,5 +1,6 @@
package com.zcloud.service.hiddenDangerCheckStandardLibrary.impl;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary.DictionaryMapper;
@ -10,7 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.*;
/**
*
@ -32,11 +33,6 @@ public class DictionaryServiceImpl implements DictionaryService {
* @throws Exception
*/
public void save(PageData pd) throws Exception {
Warden.initDate(pd);
if (Tools.isEmpty(pd.getString("DICTIONARY_SORT"))) {
Integer count = this.getCount(pd);
pd.put("DICTIONARY_SORT", count+1);
}
dictionaryMapper.save(pd);
}
@ -57,7 +53,6 @@ public class DictionaryServiceImpl implements DictionaryService {
* @throws Exception
*/
public void edit(PageData pd) throws Exception {
Warden.updateDate(pd);
dictionaryMapper.edit(pd);
}
@ -71,6 +66,55 @@ public class DictionaryServiceImpl implements DictionaryService {
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);
}
}
}
}
/**
* ()
*
@ -105,5 +149,9 @@ public class DictionaryServiceImpl implements DictionaryService {
public Integer getCount(PageData pd) throws Exception {
return dictionaryMapper.getCount(pd);
}
@Override
public List<PageData> listSelect(PageData pd)throws Exception{
return dictionaryMapper.listSelect(pd);
}
}

View File

@ -75,6 +75,13 @@ public class Warden {
entity.put("ISDELETE", "0");
}
public static void deleteDate(PageData entity) {
entity.put("DELETEOR_ID", Jurisdiction.getUSER_ID());
entity.put("DELETEOR_NAME", Jurisdiction.getName());
entity.put("DELETE_TIME", DateUtil.getTime());
entity.put("ISDELETE", "1");
}
public static Date addDate(Date date, long day) {
if (date == null) {
return new Date();

View File

@ -27,7 +27,7 @@
f.ISDELETE,
f.CREATOR_ID,
f.CREATOR_NAME,
f.CREATED_TIME,
f.CREATE_TIME,
f.OPERATOR_ID,
f.OPERATOR_NAME,
f.OPERATE_TIME,
@ -52,7 +52,7 @@
ISDELETE,
CREATOR_ID,
CREATOR_NAME,
CREATED_TIME,
CREATE_TIME,
OPERATOR_ID,
OPERATOR_NAME,
OPERATE_TIME,
@ -77,7 +77,7 @@
#{ISDELETE},
#{CREATOR_ID},
#{CREATOR_NAME},
#{CREATED_TIME},
#{CREATE_TIME},
#{OPERATOR_ID},
#{OPERATOR_NAME},
#{OPERATE_TIME},
@ -155,8 +155,8 @@
<if test="CREATOR_NAME != null and CREATOR_NAME != ''">
CREATOR_NAME = #{CREATOR_NAME},
</if>
<if test="CREATED_TIME != null and CREATED_TIME != ''">
CREATED_TIME = #{CREATED_TIME},
<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},
@ -197,13 +197,11 @@
select
dca.DICTIONARY_NAME CHECK_CATEGORY_NAME,
di.DICTIONARY_NAME CHECK_ITEM_NAME,
dco.DICTIONARY_NAME CHECK_CONTENT_NAME,
<include refid="Field"></include>
from
<include refid="tableName"></include> f
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY dca on dca.DICTIONARY_ID = f.CHECK_CATEGORY and dca.DICTIONARY_LEVEL = 1
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY di on di.DICTIONARY_ID = f.CHECK_ITEM and di.DICTIONARY_LEVEL = 2
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY dco on dco.DICTIONARY_ID = f.CHECK_CONTENT and dco.DICTIONARY_LEVEL = 3
where f.ISDELETE = '0'
<if test="pd.COMMON_ID != null and pd.COMMON_ID != ''">
and f.COMMON_ID = #{pd.COMMON_ID}
@ -211,13 +209,13 @@
<if test="pd.CHECK_CATEGORY != null and pd.CHECK_CATEGORY != ''">
and f.CHECK_CATEGORY = #{pd.CHECK_CATEGORY}
</if>
<if test="pd.CHECK_CATEGORY != null and pd.CHECK_CATEGORY != ''">
and f.HIDDEN_DESCR like CONCAT(CONCAT('%', #{pd.HIDDEN_DESCR}),'%')
<if test="pd.CHECK_ITEM != null and pd.CHECK_ITEM != ''">
and f.CHECK_ITEM = #{pd.CHECK_ITEM}
</if>
<if test="pd.HIDDEN_DESCR != null and pd.HIDDEN_DESCR != ''">
and f.HIDDEN_DESCR like CONCAT(CONCAT('%', #{pd.HIDDEN_DESCR}),'%')
<if test="pd.CHECK_CONTENT != null and pd.CHECK_CONTENT != ''">
and f.CHECK_CONTENT like CONCAT(CONCAT('%', #{pd.CHECK_CONTENT}),'%')
</if>
order by dca.DICTIONARY_SORT asc, di.DICTIONARY_SORT asc, dco.DICTIONARY_SORT asc, f.ITEM_SORT asc
order by dca.DICTIONARY_SORT asc, di.DICTIONARY_SORT asc, f.COMMON_ITEM_SORT asc
</select>
<!-- 列表(全部) -->
@ -225,18 +223,16 @@
select
dca.DICTIONARY_NAME CHECK_CATEGORY_NAME,
di.DICTIONARY_NAME CHECK_ITEM_NAME,
dco.DICTIONARY_NAME CHECK_CONTENT_NAME,
<include refid="Field"></include>
from
<include refid="tableName"></include> f
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY dca on dca.DICTIONARY_ID = f.CHECK_CATEGORY and dca.DICTIONARY_LEVEL = 1
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY di on di.DICTIONARY_ID = f.CHECK_ITEM and di.DICTIONARY_LEVEL = 2
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY dco on dco.DICTIONARY_ID = f.CHECK_CONTENT and dco.DICTIONARY_LEVEL = 3
where f.ISDELETE = '0'
<if test="pd.COMMON_ID != null and pd.COMMON_ID != ''">
and f.COMMON_ID = #{pd.COMMON_ID}
<if test="COMMON_ID != null and COMMON_ID != ''">
and f.COMMON_ID = #{COMMON_ID}
</if>
order by dca.DICTIONARY_SORT asc, di.DICTIONARY_SORT asc, dco.DICTIONARY_SORT asc, f.ITEM_SORT asc
order by dca.DICTIONARY_SORT asc, di.DICTIONARY_SORT asc, f.COMMON_ITEM_SORT asc
</select>
<!-- 批量删除 -->
@ -255,4 +251,32 @@
</foreach>
</delete>
<!-- * 获取符合条件数,+1后作为排序使用-->
<select id="getCount" parameterType="pd" resultType="Integer" >
SELECT
COUNT(*)
FROM
<include refid="tableName"></include>
WHERE 1 = 1
<if test="ISDELETE != null and ISDELETE != ''">
and ISDELETE = #{ISDELETE}
</if>
<if test="COMMON_ID != null and COMMON_ID != ''">
and COMMON_ID = #{COMMON_ID}
</if>
</select>
<!-- 删除(根据标准删除所有标准项)-->
<delete id="deleteByCommon" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = #{ISDELETE},
DELETEOR_ID = #{DELETEOR_ID},
DELETEOR_NAME = #{DELETEOR_NAME},
DELETE_TIME = #{DELETE_TIME}
where ISDELETE = '0'
and COMMON_ID = #{COMMON_ID}
</delete>
</mapper>

View File

@ -18,10 +18,11 @@
f.INDUSTRY_TYPE_TREE,
f.INDUSTRY_TYPE_NAMES,
f.CHECK_STANDARD_NAME,
f.COMMON_STATUS,
f.ISDELETE,
f.CREATOR_ID,
f.CREATOR_NAME,
f.CREATED_TIME,
f.CREATE_TIME,
f.OPERATOR_ID,
f.OPERATOR_NAME,
f.OPERATE_TIME,
@ -37,10 +38,11 @@
INDUSTRY_TYPE_TREE,
INDUSTRY_TYPE_NAMES,
CHECK_STANDARD_NAME,
COMMON_STATUS,
ISDELETE,
CREATOR_ID,
CREATOR_NAME,
CREATED_TIME,
CREATE_TIME,
OPERATOR_ID,
OPERATOR_NAME,
OPERATE_TIME,
@ -56,10 +58,11 @@
#{INDUSTRY_TYPE_TREE},
#{INDUSTRY_TYPE_NAMES},
#{CHECK_STANDARD_NAME},
#{COMMON_STATUS},
#{ISDELETE},
#{CREATOR_ID},
#{CREATOR_NAME},
#{CREATED_TIME},
#{CREATE_TIME},
#{OPERATOR_ID},
#{OPERATOR_NAME},
#{OPERATE_TIME},
@ -110,6 +113,9 @@
<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>
@ -119,8 +125,8 @@
<if test="CREATOR_NAME != null and CREATOR_NAME != ''">
CREATOR_NAME = #{CREATOR_NAME},
</if>
<if test="CREATED_TIME != null and CREATED_TIME != ''">
CREATED_TIME = #{CREATED_TIME},
<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},
@ -165,12 +171,21 @@
<if test="pd.INDUSTRY_TYPE != null and pd.INDUSTRY_TYPE != ''">
and f.INDUSTRY_TYPE = #{pd.INDUSTRY_TYPE}
</if>
<if test="pd.COMMON_STATUS != null and pd.COMMON_STATUS != ''">
and f.COMMON_STATUS = #{pd.COMMON_STATUS}
</if>
<if test="pd.INDUSTRY_TYPE_TREE != null and pd.INDUSTRY_TYPE_TREE != ''">
and f.INDUSTRY_TYPE_TREE like CONCAT(CONCAT('%', #{pd.INDUSTRY_TYPE_TREE}),'%')
</if>
<if test="pd.CHECK_STANDARD_NAME != null and pd.CHECK_STANDARD_NAME != ''">
and f.CHECK_STANDARD_NAME like CONCAT(CONCAT('%', #{pd.CHECK_STANDARD_NAME}),'%')
</if>
<if test="pd.CREATE_TIME_BEGIN!=null and pd.CREATE_TIME_BEGIN!=''"><!-- 开始时间检索 -->
and f.CREATE_TIME &gt;= CONCAT(#{pd.CREATE_TIME_BEGIN},' 00:00:00')
</if>
<if test="pd.CREATE_TIME_END!=null and pd.CREATE_TIME_END!=''"><!-- 结束时间检索 -->
and f.CREATE_TIME &lt;= CONCAT(#{pd.CREATE_TIME_END},' 23:59:59')
</if>
order by date(f.OPERATE_TIME) desc
</select>
@ -181,6 +196,9 @@
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="COMMON_STATUS != null">
and f.COMMON_STATUS = #{COMMON_STATUS},
</if>
</select>
<!-- 批量删除 -->

View File

@ -20,10 +20,12 @@
f.DICTIONARY_NAMES,
f.DICTIONARY_LEVEL,
f.DICTIONARY_SORT,
f.DICTIONARY_SOURCE,
f.CORPINFO_ID,
f.ISDELETE,
f.CREATOR_ID,
f.CREATOR_NAME,
f.CREATED_TIME,
f.CREATE_TIME,
f.OPERATOR_ID,
f.OPERATOR_NAME,
f.OPERATE_TIME,
@ -41,10 +43,12 @@
DICTIONARY_NAMES,
DICTIONARY_LEVEL,
DICTIONARY_SORT,
DICTIONARY_SOURCE,
CORPINFO_ID,
ISDELETE,
CREATOR_ID,
CREATOR_NAME,
CREATED_TIME,
CREATE_TIME,
OPERATOR_ID,
OPERATOR_NAME,
OPERATE_TIME,
@ -62,10 +66,12 @@
#{DICTIONARY_NAMES},
#{DICTIONARY_LEVEL},
#{DICTIONARY_SORT},
#{DICTIONARY_SOURCE},
#{CORPINFO_ID},
#{ISDELETE},
#{CREATOR_ID},
#{CREATOR_NAME},
#{CREATED_TIME},
#{CREATE_TIME},
#{OPERATOR_ID},
#{OPERATOR_NAME},
#{OPERATE_TIME},
@ -122,6 +128,12 @@
<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>
@ -131,8 +143,8 @@
<if test="CREATOR_NAME != null and CREATOR_NAME != ''">
CREATOR_NAME = #{CREATOR_NAME},
</if>
<if test="CREATED_TIME != null and CREATED_TIME != ''">
CREATED_TIME = #{CREATED_TIME},
<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},
@ -177,6 +189,9 @@
<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>
@ -187,7 +202,7 @@
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
order by f.DICTIONARY_SORT asc
order by f.DICTIONARY_LEVEL asc, f.DICTIONARY_SORT asc
</select>
<!-- 批量删除 -->
@ -205,7 +220,7 @@
#{item}
</foreach>
</delete>
<!-- * 获取最大题号,导入时候使用-->
<!-- * 获取符合条件数,+1后作为排序使用-->
<select id="getCount" parameterType="pd" resultType="Integer" >
SELECT
COUNT(*)
@ -217,4 +232,31 @@
</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>