pet
shanao 2024-10-19 17:34:40 +08:00
parent 9e089fcb62
commit 38986c3364
16 changed files with 689 additions and 345 deletions

View File

@ -920,7 +920,6 @@ public class AppHiddenController extends BaseController {
hs.put("ISDELETE", "0"); hs.put("ISDELETE", "0");
hiddenSchemeService.edit(hs); hiddenSchemeService.edit(hs);
} }
return map; return map;
} }

View File

@ -1,32 +1,23 @@
package com.zcloud.controller.app; package com.zcloud.controller.app;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.zcloud.controller.base.BaseController; import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.service.bus.NoticeCorpService; import com.zcloud.service.bus.NoticeCorpService;
import com.zcloud.service.bus.NoticeCorpUserService; import com.zcloud.service.bus.NoticeCorpUserService;
import com.zcloud.service.bus.NoticeLogService;
import com.zcloud.service.bus.ServiceNoticeService; import com.zcloud.service.bus.ServiceNoticeService;
import com.zcloud.service.system.UsersService; import com.zcloud.service.system.UsersService;
import com.zcloud.util.DateUtil; import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.ObjectExcelView;
import com.zcloud.util.Tools; import com.zcloud.util.Tools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.apache.shiro.authz.annotation.RequiresPermissions; import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* *

View File

@ -734,6 +734,7 @@ public class SafetyEnvironmentalController extends BaseController {
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID
pd.put("waffle", Jurisdiction.getUSER_ID()); pd.put("waffle", Jurisdiction.getUSER_ID());
page.setPd(pd); page.setPd(pd);
pd.put("loginUserId", Jurisdiction.getUSER_ID());
List<PageData> varList = safetyenvironmentalService.checkList(page); //列出SafetyEnvironmental列表 List<PageData> varList = safetyenvironmentalService.checkList(page); //列出SafetyEnvironmental列表
/* 针对验收部分特殊处理 */ /* 针对验收部分特殊处理 */
for (PageData vector : varList) { for (PageData vector : varList) {

View File

@ -32,39 +32,42 @@ import java.util.stream.Collectors;
@RequestMapping("/safetyenvironmentalexplain") @RequestMapping("/safetyenvironmentalexplain")
public class SafetyEnvironmentalExplainController extends BaseController { public class SafetyEnvironmentalExplainController extends BaseController {
@Autowired @Autowired
private SafetyEnvironmentalExplainService safetyenvironmentalexplainService; private SafetyEnvironmentalExplainService safetyenvironmentalexplainService;
@Autowired @Autowired
private HiddenService hiddenService; private HiddenService hiddenService;
@Autowired @Autowired
private DepartmentService departmentService; private DepartmentService departmentService;
@Resource @Resource
private NoticeCorpUtil noticeCorpUtil; private NoticeCorpUtil noticeCorpUtil;
/** /**
* @param page *
* @throws Exception *
*/ * @param page
@RequestMapping(value="/list") * @throws Exception
@RequiresPermissions("safetyenvironmentalexplain:list") */
@ResponseBody @RequestMapping(value = "/list")
public Object list(Page page) throws Exception{ @RequiresPermissions("safetyenvironmentalexplain:list")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object list(Page page) throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 PageData pd = new PageData();
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); pd = this.getPageData();
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
if (Tools.notEmpty(KEYWORDS)) pd.put("KEYWORDS", KEYWORDS.trim());
// pd.put("INSPECTED_SITEUSER_ID", Jurisdiction.getUSER_ID()); //被检查单位现场负责人 // pd.put("INSPECTED_SITEUSER_ID", Jurisdiction.getUSER_ID()); //被检查单位现场负责人
pd = Jurisdiction.getUserDataJurisdiction(pd); pd = Jurisdiction.getUserDataJurisdiction(pd);
page.setPd(pd); pd.put("loginUserId", Jurisdiction.getUSER_ID());
List<PageData> varList = safetyenvironmentalexplainService.list(page); //列出SafetyEnvironmentalExplain列表 page.setPd(pd);
for (PageData vector: varList) { List<PageData> varList = safetyenvironmentalexplainService.list(page); //列出SafetyEnvironmentalExplain列表
PageData condition = new PageData(); for (PageData vector : varList) {
condition.put("DEPARTMENT_ID",vector.getString("INSPECTED_DEPARTMENT_ID")); PageData condition = new PageData();
List<PageData> parent_list = departmentService.getGenealogy(condition); condition.put("DEPARTMENT_ID", vector.getString("INSPECTED_DEPARTMENT_ID"));
String corp_infos = ""; List<PageData> parent_list = departmentService.getGenealogy(condition);
String corp_infos = "";
/*for(PageData pageData:parent_list){ /*for(PageData pageData:parent_list){
for(Object key:pageData.keySet()){ for(Object key:pageData.keySet()){
if(StringUtils.equals("NAME",key.toString())&&StringUtils.isBlank(pageData.getString(key))){ if(StringUtils.equals("NAME",key.toString())&&StringUtils.isBlank(pageData.getString(key))){
@ -79,223 +82,237 @@ public class SafetyEnvironmentalExplainController extends BaseController {
} }
}*/ }*/
if(!Tools.isEmpty(parent_list)){ if (!Tools.isEmpty(parent_list)) {
corp_infos = parent_list.stream().filter(n->StringUtils.isNotBlank(n.getString("NAME"))).map(n -> n.getString("NAME")).collect(Collectors.joining("-")); corp_infos = parent_list.stream().filter(n -> StringUtils.isNotBlank(n.getString("NAME"))).map(n -> n.getString("NAME")).collect(Collectors.joining("-"));
} }
vector.put("INSPECTED_DEPARTMENT_NAMES",corp_infos); vector.put("INSPECTED_DEPARTMENT_NAMES", corp_infos);
} }
map.put("varList", varList); map.put("varList", varList);
map.put("page", page); map.put("page", page);
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/add") * @throws Exception
@RequiresPermissions("safetyenvironmentalexplain:add") */
@ResponseBody @RequestMapping(value = "/add")
public Object add(@RequestParam(value="file",required=false) MultipartFile file) throws Exception{ @RequiresPermissions("safetyenvironmentalexplain:add")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object add(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
pd.put("INSPECTION_EXPLAIN_ID", this.get32UUID()); //主键 PageData pd = new PageData();
pd.put("ISDELETE", "0"); //是否删除(0:有效 1删除) pd = this.getPageData();
pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人 pd.put("INSPECTION_EXPLAIN_ID", this.get32UUID()); //主键
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 pd.put("ISDELETE", "0"); //是否删除(0:有效 1删除)
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人 pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人
pd.put("ACTION_USER", Jurisdiction.getName()); //操作人 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("VALID","1"); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID
pd.put("ISPASS","0"); pd.put("ACTION_USER", Jurisdiction.getName()); //操作人
if (StringUtils.isNotBlank(pd.getString("INSPECTED_SITEUSER_SIGN_IMG"))) { pd.put("VALID", "1");
MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("INSPECTED_SITEUSER_SIGN_IMG")); pd.put("ISPASS", "0");
String suffixName = img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); if (StringUtils.isNotBlank(pd.getString("INSPECTED_SITEUSER_SIGN_IMG"))) {
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("INSPECTED_SITEUSER_SIGN_IMG"));
errInfo = "fail"; String suffixName = img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase();
map.put("result", errInfo); if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
map.put("msg", "文件格式不正确!"); errInfo = "fail";
return map; map.put("result", errInfo);
} map.put("msg", "文件格式不正确!");
String ffile = DateUtil.getDays(); return map;
String fileName = this.get32UUID()+img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".")); }
Smb.sshSftp(img, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); String ffile = DateUtil.getDays();
String fileName = this.get32UUID() + img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(img, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd.put("INSPECTED_SITEUSER_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); pd.put("INSPECTED_SITEUSER_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
} }
if (null != file && !file.isEmpty()) { if (null != file && !file.isEmpty()) {
String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase();
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
errInfo = "fail"; errInfo = "fail";
map.put("result", errInfo); map.put("result", errInfo);
map.put("msg", "文件格式不正确!"); map.put("msg", "文件格式不正确!");
return map; return map;
} }
String ffile = DateUtil.getDays(); String ffile = DateUtil.getDays();
//服务器 //服务器
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile); Smb.sshSftp(file, fileName, Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile);
pd.put("INSPECTED_EXPLAIN_FILENAME", file.getOriginalFilename()); pd.put("INSPECTED_EXPLAIN_FILENAME", file.getOriginalFilename());
pd.put("INSPECTED_EXPLAIN_FILEPATH", Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); pd.put("INSPECTED_EXPLAIN_FILEPATH", Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName);
} }
safetyenvironmentalexplainService.save(pd); safetyenvironmentalexplainService.save(pd);
noticeCorpUtil.SE_PleadingStepUtil(pd); noticeCorpUtil.SE_PleadingStepUtil(pd);
map.put("pd", pd); map.put("pd", pd);
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/delete") * @throws Exception
@RequiresPermissions("safetyenvironmentalexplain:del") */
@ResponseBody @RequestMapping(value = "/delete")
public Object delete() throws Exception{ @RequiresPermissions("safetyenvironmentalexplain:del")
Map<String,String> map = new HashMap<String,String>(); @ResponseBody
String errInfo = "success"; public Object delete() throws Exception {
PageData pd = new PageData(); Map<String, String> map = new HashMap<String, String>();
pd = this.getPageData(); String errInfo = "success";
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 PageData pd = new PageData();
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd = this.getPageData();
safetyenvironmentalexplainService.delete(pd); pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
map.put("result", errInfo); //返回结果 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
return map; safetyenvironmentalexplainService.delete(pd);
} map.put("result", errInfo); //返回结果
return map;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/edit") * @throws Exception
@RequiresPermissions("safetyenvironmentalexplain:edit") */
@ResponseBody @RequestMapping(value = "/edit")
public Object edit() throws Exception{ @RequiresPermissions("safetyenvironmentalexplain:edit")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object edit() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 PageData pd = new PageData();
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd = this.getPageData();
safetyenvironmentalexplainService.edit(pd); pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
map.put("pd", pd); pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
map.put("result", errInfo); safetyenvironmentalexplainService.edit(pd);
return map; map.put("pd", pd);
} map.put("result", errInfo);
return map;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/goEdit") * @throws Exception
@RequiresPermissions("safetyenvironmentalexplain:edit") */
@ResponseBody @RequestMapping(value = "/goEdit")
public Object goEdit() throws Exception{ @RequiresPermissions("safetyenvironmentalexplain:edit")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object goEdit() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
pd = safetyenvironmentalexplainService.findById(pd); //根据ID读取 PageData pd = new PageData();
map.put("pd", pd); pd = this.getPageData();
map.put("result", errInfo); pd = safetyenvironmentalexplainService.findById(pd); //根据ID读取
return map; map.put("pd", pd);
} map.put("result", errInfo);
return map;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/deleteAll") * @throws Exception
@RequiresPermissions("safetyenvironmentalexplain:del") */
@ResponseBody @RequestMapping(value = "/deleteAll")
public Object deleteAll() throws Exception{ @RequiresPermissions("safetyenvironmentalexplain:del")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object deleteAll() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 PageData pd = new PageData();
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd = this.getPageData();
String DATA_IDS = pd.getString("DATA_IDS"); pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
if(Tools.notEmpty(DATA_IDS)){ pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
String[] ArrayDATA_IDS = DATA_IDS.split(","); String DATA_IDS = pd.getString("DATA_IDS");
pd.put("ArrayDATA_IDS", ArrayDATA_IDS); //待删除ids if (Tools.notEmpty(DATA_IDS)) {
safetyenvironmentalexplainService.deleteAll(pd); String[] ArrayDATA_IDS = DATA_IDS.split(",");
errInfo = "success"; pd.put("ArrayDATA_IDS", ArrayDATA_IDS); //待删除ids
}else{ safetyenvironmentalexplainService.deleteAll(pd);
errInfo = "fail"; errInfo = "success";
} } else {
map.put("result", errInfo); //返回结果 errInfo = "fail";
return map; }
} map.put("result", errInfo); //返回结果
return map;
}
/**excel /**
* @param * excel
* @throws Exception *
*/ * @param
@RequestMapping(value="/excel") * @throws Exception
@RequiresPermissions("toExcel") */
public ModelAndView exportExcel() throws Exception{ @RequestMapping(value = "/excel")
ModelAndView mv = new ModelAndView(); @RequiresPermissions("toExcel")
PageData pd = new PageData(); public ModelAndView exportExcel() throws Exception {
pd = this.getPageData(); ModelAndView mv = new ModelAndView();
Map<String,Object> dataMap = new HashMap<String,Object>(); PageData pd = new PageData();
List<String> titles = new ArrayList<String>(); pd = this.getPageData();
titles.add("安全环保检查ID"); //1 Map<String, Object> dataMap = new HashMap<String, Object>();
titles.add("申辩内容"); //2 List<String> titles = new ArrayList<String>();
titles.add("是否删除(0:有效 1删除)"); //3 titles.add("安全环保检查ID"); //1
titles.add("添加人"); //4 titles.add("申辩内容"); //2
titles.add("添加时间"); //5 titles.add("是否删除(0:有效 1删除)"); //3
titles.add("修改人"); //6 titles.add("添加人"); //4
titles.add("修改时间"); //7 titles.add("添加时间"); //5
titles.add("企业ID"); //8 titles.add("修改人"); //6
dataMap.put("titles", titles); titles.add("修改时间"); //7
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID titles.add("企业ID"); //8
List<PageData> varOList = safetyenvironmentalexplainService.listAll(pd); dataMap.put("titles", titles);
List<PageData> varList = new ArrayList<PageData>(); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID
for(int i=0;i<varOList.size();i++){ List<PageData> varOList = safetyenvironmentalexplainService.listAll(pd);
PageData vpd = new PageData(); List<PageData> varList = new ArrayList<PageData>();
vpd.put("var1", varOList.get(i).getString("INSPECTION_ID")); //1 for (int i = 0; i < varOList.size(); i++) {
vpd.put("var2", varOList.get(i).getString("INSPECTED_EXPLAIN")); //2 PageData vpd = new PageData();
vpd.put("var3", varOList.get(i).getString("ISDELETE")); //3 vpd.put("var1", varOList.get(i).getString("INSPECTION_ID")); //1
vpd.put("var4", varOList.get(i).getString("CREATOR")); //4 vpd.put("var2", varOList.get(i).getString("INSPECTED_EXPLAIN")); //2
vpd.put("var5", varOList.get(i).getString("CREATTIME")); //5 vpd.put("var3", varOList.get(i).getString("ISDELETE")); //3
vpd.put("var6", varOList.get(i).getString("OPERATOR")); //6 vpd.put("var4", varOList.get(i).getString("CREATOR")); //4
vpd.put("var7", varOList.get(i).getString("OPERATTIME")); //7 vpd.put("var5", varOList.get(i).getString("CREATTIME")); //5
vpd.put("var8", varOList.get(i).getString("CORPINFO_ID")); //8 vpd.put("var6", varOList.get(i).getString("OPERATOR")); //6
varList.add(vpd); vpd.put("var7", varOList.get(i).getString("OPERATTIME")); //7
} vpd.put("var8", varOList.get(i).getString("CORPINFO_ID")); //8
dataMap.put("varList", varList); varList.add(vpd);
ObjectExcelView erv = new ObjectExcelView(); }
mv = new ModelAndView(erv,dataMap); dataMap.put("varList", varList);
return mv; ObjectExcelView erv = new ObjectExcelView();
} mv = new ModelAndView(erv, dataMap);
return mv;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/hiddencount") * @throws Exception
@ResponseBody */
public Object hiddencount() throws Exception{ @RequestMapping(value = "/hiddencount")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object hiddencount() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
List<PageData> hiddenlist = hiddenService.findByInspectionId(pd); //根据ID读取 PageData pd = new PageData();
if(hiddenlist.size()>0){ pd = this.getPageData();
map.put("hiddencount",'1'); List<PageData> hiddenlist = hiddenService.findByInspectionId(pd); //根据ID读取
} else { if (hiddenlist.size() > 0) {
map.put("hiddencount",'0'); map.put("hiddencount", '1');
} } else {
map.put("pd", pd); map.put("hiddencount", '0');
map.put("result", errInfo); }
return map; map.put("pd", pd);
} map.put("result", errInfo);
return map;
}
} }

View File

@ -0,0 +1,76 @@
package com.zcloud.controller.messages;
import cn.hutool.core.convert.Convert;
import cn.hutool.crypto.asymmetric.KeyType;
import cn.hutool.crypto.asymmetric.RSA;
import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
import cn.hutool.crypto.symmetric.SymmetricCrypto;
import com.alibaba.fastjson.JSON;
import com.zcloud.entity.messages.PushRecords;
import com.zcloud.service.messages.MessagesService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validator;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/messages")
public class MessagesController {
private static final String privateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAI/0e9Q2v5Hi9j2BRHz2U/0skmjTX" +
"iqNsl/hEylAZdfA4vTdFT9VSf9Pl91MqTAVi1rTojLEQV/QLdGuqY/6bHyb0PL0A/4Lx0ddVRs3hNPmX32JD8HgPiRIxdXyzKkZHskvUg6gPYYPgzv" +
"OPWjxeVZz8QA4bDYUKr+X7WrEyu+bAgMBAAECgYAITF9Z0uDrmUoSyC5foIvwtsHAq2df8me7cWXIEkj5c7DBmjMDQevjloqz4s6H+CrFDOXqbkTK4" +
"xAytUWO1RbgaGhEJpVGHxxzml+npbI4KGbs11IVcaH70FJcL44gYyX+G+2aj372aykldUH56IwPO7Z8cV0WTTZaIel3D5NDKQJBAKN90RJ1dpiMROg" +
"qGChoshstpkEgRRdFBA26hmIeMaQZyrgzLGvcjEETo5zbzcwvSi5jMLK8FhlAquof3db8sBMCQQDhaMIaKfSmghrl3eBf7PxoXvmBNqWy7ZpmOWcA0" +
"GfvNdHc1NAsSw272CFl7cSwdI6DW9vu1ULZy5Iw6rJuyINZAkACzxiWfpopCM/uRTrhBtt4iBJBMDK/sZneOoQwj2A+94p6G7b5q3Jlc9btzQD+Lxn" +
"RLjcZ+w1OJcRJ/X4sQW8tAkEAvrSZ2/b5NNLInQguKBphppAL+iVY5VwfEDOqkMbB2GGpb3NhuMe7E90UzJ7wlPXYCQzzs0oc6BVSVy6Jzi646QJAP" +
"4uFZIPgEAGi4iw4uvio1URXVVwqTgIaqiQ/cJ8rpV2txiSdbEsGrR9V8QYPyxS//rVSK8JJAHVJGWRiuxZ24A==";
private final MessagesService service;
private final Validator validator;
@PostMapping(value = "/push")
public Map<String, Object> push(@RequestBody Map<String, Object> body) throws Exception {
Map<String, Object> result = new HashMap<>();
if (body == null || !body.containsKey("key") || !body.containsKey("value")) {
throw new RuntimeException("参数为空");
}
PushRecords pushRecords = JSON.parseObject(decrypt(body, privateKey), PushRecords.class);
Set<ConstraintViolation<PushRecords>> validate = validator.validate(pushRecords);
if (!validate.isEmpty()) {
throw new ConstraintViolationException(validate);
}
// 校验 发送时间 距离当前时间不能超过6 秒
// if (DateUtil.betweenMs(DateUtil.parseDateTime(pushRecords.getSendTime()), new Date()) > 6000) {
// throw new RuntimeException("发送时间距离当前时间不能超过10 秒");
// }
service.push(pushRecords);
result.put("code", 0);
result.put("msg", "成功");
return result;
}
private String decrypt(Map<String, Object> body, String privateKey) {
try {
RSA rsa = new RSA(privateKey, null);
byte[] aesKey = rsa.decrypt(Convert.toStr(body.get("key")), KeyType.PrivateKey);
SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, aesKey);
return aes.decryptStr(Convert.toStr(body.get("value")), StandardCharsets.UTF_8);
} catch (Exception e) {
log.error("对接消息接口解密失败", e);
throw new RuntimeException("解密失败");
}
}
}

View File

@ -0,0 +1,55 @@
package com.zcloud.controller.messages;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.handler.annotation.support.MethodArgumentNotValidException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.validation.ConstraintViolationException;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@RestControllerAdvice(assignableTypes = MessagesController.class)
public class MessagesControllerExceptionHandler {
@ExceptionHandler(MethodArgumentNotValidException.class)
public Map<String, Object> handleMethodArgumentNotValidException(MethodArgumentNotValidException ex) {
Map<String, Object> result = new HashMap<>();
BindingResult bindingResult = ex.getBindingResult();
StringBuilder sb = new StringBuilder("校验失败:");
for (FieldError fieldError : bindingResult.getFieldErrors()) {
sb.append(fieldError.getField()).append("").append(fieldError.getDefaultMessage()).append(", ");
}
result.put("msg", sb.toString());
result.put("code", 500);
return result;
}
@ExceptionHandler(ConstraintViolationException.class)
public Map<String, Object> handleConstraintViolationException(ConstraintViolationException ex) {
Map<String, Object> result = new HashMap<>();
result.put("msg", ex.getMessage());
result.put("code", 500);
return result;
}
@ExceptionHandler(RuntimeException.class)
public Map<String, Object> handleRuntimeException(RuntimeException ex) {
Map<String, Object> result = new HashMap<>();
result.put("msg", ex.getMessage());
result.put("code", 500);
return result;
}
@ExceptionHandler(Exception.class)
public Map<String, Object> handleRuntimeException(Exception ex) {
log.error("系统异常,请稍后重试", ex);
Map<String, Object> result = new HashMap<>();
result.put("msg", ex.getMessage());
result.put("code", 500);
return result;
}
}

View File

@ -0,0 +1,35 @@
package com.zcloud.entity.messages;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
public class PushRecords implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
@NotBlank(message = "要发送人的手机号不能为空")
@Length(min = 1, max = 12, message = "手机号长度为1-11位")
private String phone;
@Length(max = 255, message = "消息标题长度不能大于255")
private String messageTitle;
@NotBlank(message = "消息内容不能为空")
@Length(max = 255, message = "消息内容长度不能大于255")
private String messageContent;
@NotNull(message = "消息类型不能为空")
@Range(min = 1, max = 3, message = "消息类型只能是1或2或3")
private Integer messageType;
@NotBlank(message = "发送时间不能为空")
private String sendTime;
}

View File

@ -0,0 +1,10 @@
package com.zcloud.mapper.datasource.messages;
import com.zcloud.entity.messages.PushRecords;
import org.apache.ibatis.annotations.Param;
public interface MessagesMapper {
void install(PushRecords pushRecords);
String findUserIdByPhone(@Param("phone") String phone);
}

View File

@ -1,13 +1,14 @@
package com.zcloud.service.bus.impl; package com.zcloud.service.bus.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.bus.CorpInfoMapper; import com.zcloud.mapper.datasource.bus.CorpInfoMapper;
import com.zcloud.service.bus.CorpInfoService; import com.zcloud.service.bus.CorpInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/** /**
* *
@ -83,7 +84,7 @@ public class CorpInfoServiceImpl implements CorpInfoService{
*/ */
public PageData findById(PageData pd)throws Exception{ public PageData findById(PageData pd)throws Exception{
PageData byId = corpinfoMapper.findById(pd); PageData byId = corpinfoMapper.findById(pd);
if (byId.get("FOURTYPE") != null) { if (byId != null && byId.get("FOURTYPE") != null) {
String fourtype = byId.get("FOURTYPE").toString(); String fourtype = byId.get("FOURTYPE").toString();
byId.put("FOURTYPE", fourtype); byId.put("FOURTYPE", fourtype);
} }

View File

@ -0,0 +1,8 @@
package com.zcloud.service.messages;
import com.zcloud.entity.messages.PushRecords;
public interface MessagesService {
void push(PushRecords pushRecords) throws Exception;
}

View File

@ -0,0 +1,85 @@
package com.zcloud.service.messages.impl;
import cn.hutool.core.util.StrUtil;
import com.zcloud.entity.PageData;
import com.zcloud.entity.messages.PushRecords;
import com.zcloud.mapper.datasource.messages.MessagesMapper;
import com.zcloud.service.bus.NoticeCorpService;
import com.zcloud.service.messages.MessagesService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.UuidUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Service
@RequiredArgsConstructor
public class MessagesServiceImpl implements MessagesService {
private final MessagesMapper mapper;
private final NoticeCorpService noticeCorpService;
@Override
@Transactional(rollbackFor = Exception.class)
public void push(PushRecords pushRecords) throws Exception {
// 先记录数据
pushRecords.setId(UuidUtil.get32UUID());
pushRecords.setSendTime(DateUtil.getTime());
mapper.install(pushRecords);
// 根据手机号查找用户id
String userId = mapper.findUserIdByPhone(pushRecords.getPhone());
if (StrUtil.isEmpty(userId)) {
throw new RuntimeException("该用户不存在");
}
Integer type = pushRecords.getMessageType();
// 1-短信 2-平台信息 3-全发
if (type == 1) {
pushSms(pushRecords);
} else if (type == 2) {
PageData data = pushInfo(pushRecords, userId);
noticeCorpService.sendNotice(data);
} else if (type == 3) {
pushSms(pushRecords);
PageData data = pushInfo(pushRecords, userId);
noticeCorpService.sendNotice(data);
} else {
throw new RuntimeException("消息类型:【" + type + "】错误");
}
}
/**
* ()
* private
*
* @param pushRecords
* @param userId id
*/
private PageData pushInfo(PushRecords pushRecords, String userId) throws Exception {
PageData mes = new PageData();
mes.put("BIANMA", "PUSH_RECORDS");
mes.put("SENDER_ID", "九公司应急管理"); // 发送人员ID
mes.put("SENDER_NAME", "九公司应急管理"); // 发送人员姓名
mes.put("SYNOPSIS", pushRecords.getMessageTitle()); // 站内信标题
//mes.put("WORKURL", "/pages/application/high-risk-work/limited-space/gas-analysis/list?NameLikes=" + pd.getString("WORK_PERMIT_NUMBER")); // 操作链接
mes.put("CORPINFO_ID", "48a8ca9815814c979814ddcf041c5cd5");// 企业id
mes.put("RECEIVER_ID", userId); // 接收人员ID
PageData content = new PageData();
content.put("msg", pushRecords.getMessageContent());// 作业编号
mes.put("CONTENT", content);// 站内信内容
return mes;
}
/**
* ()
* private
*
* @param pushRecords
*/
private void pushSms(PushRecords pushRecords) {
// todo
log.error("===================>推送短信信息");
log.error("消息内容:{}", pushRecords);
}
}

View File

@ -2,16 +2,10 @@ datasource.no1.driver-class-name: com.mysql.cj.jdbc.Driver
datasource.no1.url=jdbc:mysql://39.101.130.96:33068/qa-gwj-prevention?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8 datasource.no1.url=jdbc:mysql://39.101.130.96:33068/qa-gwj-prevention?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
datasource.no1.username=dev datasource.no1.username=dev
datasource.no1.password=Zykj@dev123456 datasource.no1.password=Zykj@dev123456
#datasource.no1.url=jdbc:mysql://127.0.0.1:3306/qa-gwj-prevention?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
#datasource.no1.username=root
#datasource.no1.password=123456
datasource.no2.driver-class-name: com.mysql.cj.jdbc.Driver datasource.no2.driver-class-name: com.mysql.cj.jdbc.Driver
datasource.no2.url=jdbc:mysql://39.101.130.96:33068/qa-gwj-regulatory?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8 datasource.no2.url=jdbc:mysql://39.101.130.96:33068/qa-gwj-regulatory?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
datasource.no2.username=dev datasource.no2.username=dev
datasource.no2.password=Zykj@dev123456 datasource.no2.password=Zykj@dev123456
#datasource.no2.url=jdbc:mysql://127.0.0.1:3306/qa-gwj-regulatory?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
#datasource.no2.username=root
#datasource.no2.password=123456
#druid??? #druid???
@ -112,6 +106,7 @@ perLoc.url=http://192.168.210.32:8084
perLoc.userName=qaaqadmin perLoc.userName=qaaqadmin
perLoc.pwd=Cfd2023@ perLoc.pwd=Cfd2023@
baseimgpath =http://192.168.192.201:8991/file/ baseimgpath =http://192.168.192.201:8991/file/
tongbu.url=http://127.0.0.1:9006/qa-prevention-gwj-tongbu/
mq.csy.data.topic=csy_docking mq.csy.data.topic=csy_docking
mq.csy.data.group=scheduled_tasks_csy_docking mq.csy.data.group=scheduled_tasks_csy_docking
@ -150,10 +145,9 @@ gongJiangXueYuanProdUrl=https://gjxy.bjttsx.com
gongJiangXueYuanGetImgUrl=https://wwag.qhdsafety.com/file/ gongJiangXueYuanGetImgUrl=https://wwag.qhdsafety.com/file/
# \u4E2D\u53F0 # \u4E2D\u53F0
tongbu.url=http://127.0.0.1:8094
# \u6D88\u8D39\u4E2D\u53F0\u901A\u77E5 # \u6D88\u8D39\u4E2D\u53F0\u901A\u77E5
mq.consumer.dataChange.tongbu-data-change.topic=tongbu_dataChange_docking mq.consumer.dataChange.tongbu-data-change.topic=tongbu_dataChange_docking
mq.consumer.dataChange.tongbu-data-change.group=tongbu_dataChange_group mq.consumer.dataChange.tongbu-data-change.group=tongbu_dataChange_group
# \u672C\u5730\u6570\u636E\u4FEE\u6539\u540E\u5411\u8FD9\u4E2Atopic\u63A8\u9001\uFF08\u6240\u6709\u7C7B\u578B\u540C\u6B65\u6570\u636E\u516C\u7528\uFF09 # \u672C\u5730\u6570\u636E\u4FEE\u6539\u540E\u5411\u8FD9\u4E2Atopic\u63A8\u9001\uFF08\u6240\u6709\u7C7B\u578B\u540C\u6B65\u6570\u636E\u516C\u7528\uFF09
mq.producer.dataChange.slice-data-change.topic=slice_dataChange_docking mq.producer.dataChange.slice-data-change.topic=slice_dataChange_docking

View File

@ -161,7 +161,7 @@
<!-- 列表 --> <!-- 列表 -->
<select id="listByUserId" parameterType="page" resultType="pd"> <select id="listByUserId" parameterType="page" resultType="pd">
SELECT SELECT
c.*,u.TYPE c.*,u.TYPE
FROM FROM
bus_noticecorpuserid u bus_noticecorpuserid u

View File

@ -120,79 +120,96 @@
<!-- 列表 --> <!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd"> <select id="datalistPage" parameterType="page" resultType="pd">
select select iou.NAME INSPECTION_ORIGINATOR_NAME,
iou.NAME INSPECTION_ORIGINATOR_NAME, iod.NAME INSPECTION_DEPARTMENT_NAME,
iod.NAME INSPECTION_DEPARTMENT_NAME, isd.NAME INSPECTED_DEPARTMENT_NAME,
isd.NAME INSPECTED_DEPARTMENT_NAME, isu.NAME INSPECTED_SITEUSER_NAME,
isu.NAME INSPECTED_SITEUSER_NAME, IFNULL(GROUP_CONCAT(REPLACE(siu.NAME, '/', ',')), '') AS INSPECTION_USER_NAME,
IFNULL(GROUP_CONCAT(REPLACE(siu.NAME,'/',',')),'') AS INSPECTION_USER_NAME, CASE
CASE WHEN IFNULL(se.INSPECTION_TYPE_OTHER, '') = '' THEN d.NAME ELSE se.INSPECTION_TYPE_OTHER END INSPECTION_TYPE_NAME, WHEN IFNULL(se.INSPECTION_TYPE_OTHER, '') = '' THEN d.NAME
se.INSPECTION_TIME_START, ELSE se.INSPECTION_TYPE_OTHER END INSPECTION_TYPE_NAME,
se.INSPECTION_TIME_END, se.INSPECTION_TIME_START,
se.INSPECTION_STATUS, se.INSPECTION_TIME_END,
se.INSPECTION_SUBJECT, se.INSPECTION_STATUS,
se.INSPECTED_EXPLAIN, se.INSPECTION_SUBJECT,
se.INSPECTED_EXPLAIN_FILENAME, se.INSPECTED_EXPLAIN,
se.INSPECTED_EXPLAIN_FILEPATH, se.INSPECTED_EXPLAIN_FILENAME,
se.INSPECTED_SITEUSER_SIGN_IMG, se.INSPECTED_EXPLAIN_FILEPATH,
se.INSPECTED_SITEUSER_SIGN_TIME, se.INSPECTED_SITEUSER_SIGN_IMG,
se.INSPECTION_ID, se.INSPECTED_SITEUSER_SIGN_TIME,
se.INSPECTED_SITEUSER_ID, se.INSPECTION_ID,
se.INSPECTED_DEPARTMENT_ID se.INSPECTED_SITEUSER_ID,
from BUS_INSPECTION_SAFETYENVIRONMENTAL se se.INSPECTED_DEPARTMENT_ID
LEFT JOIN VI_USER_ALL iou ON iou.USER_ID = se.INSPECTION_ORIGINATOR_ID from BUS_INSPECTION_SAFETYENVIRONMENTAL se
LEFT JOIN VI_DEPARTMENT_ALL iod ON iod.DEPARTMENT_ID = iou.DEPARTMENT_ID LEFT JOIN VI_USER_ALL iou ON iou.USER_ID = se.INSPECTION_ORIGINATOR_ID
LEFT JOIN OA_DEPARTMENT isd ON isd.DEPARTMENT_ID = se.INSPECTED_DEPARTMENT_ID LEFT JOIN VI_DEPARTMENT_ALL iod ON iod.DEPARTMENT_ID = iou.DEPARTMENT_ID
LEFT JOIN SYS_USER isu ON isu.USER_ID = se.INSPECTED_SITEUSER_ID LEFT JOIN OA_DEPARTMENT isd ON isd.DEPARTMENT_ID = se.INSPECTED_DEPARTMENT_ID
LEFT JOIN bus_inspection_safetyenvironmental_inspector si ON si.INSPECTION_ID = se.INSPECTION_ID and si.ISDELETE = '0' LEFT JOIN SYS_USER isu ON isu.USER_ID = se.INSPECTED_SITEUSER_ID
LEFT JOIN vi_user_all siu ON siu.USER_ID = si.INSPECTION_USER_ID LEFT JOIN bus_inspection_safetyenvironmental_inspector si
LEFT JOIN sys_dictionaries d ON d.BIANMA = se.INSPECTION_TYPE ON si.INSPECTION_ID = se.INSPECTION_ID and si.ISDELETE = '0'
where se.ISDELETE = '0' and se.INSPECTION_STATUS = '2' LEFT JOIN vi_user_all siu ON siu.USER_ID = si.INSPECTION_USER_ID
<if test="pd.roleLevel != null and pd.roleLevel != ''"><!-- 权限显示 --> LEFT JOIN sys_dictionaries d ON d.BIANMA = se.INSPECTION_TYPE
<choose> where se.ISDELETE = '0' and se.INSPECTION_STATUS = '2'
<when test='pd.roleLevel == "0"'> <if test="pd.roleLevel != null and pd.roleLevel != ''">
</when> <!-- 权限显示 -->
<when test='pd.roleLevel =="1"'> <choose>
and siu.DEPARTMENT_ID in (${pd.supDeparIds}) or se.INSPECTED_DEPARTMENT_ID in (${pd.supDeparIds}) <when test='pd.roleLevel == "0"'>
</when> </when>
<when test='pd.roleLevel =="2"'> <when test='pd.roleLevel == "1"'>
and siu.USER_ID in (#{pd.loginUserId}) or se.INSPECTED_SITEUSER_ID in (#{pd.loginUserId}) and siu.DEPARTMENT_ID in (${pd.supDeparIds})
</when> or se.INSPECTED_DEPARTMENT_ID in (${pd.supDeparIds})
</choose> </when>
</if> <when test='pd.roleLevel == "2"'>
<if test='pd.INSPECTED_SITEUSER_ID != null and pd.INSPECTED_SITEUSER_ID != ""'><!-- 被检查单位现场负责人 --> and siu.USER_ID in (#{pd.loginUserId})
and se.INSPECTED_SITEUSER_ID = #{pd.INSPECTED_SITEUSER_ID} or se.INSPECTED_SITEUSER_ID in (#{pd.loginUserId})
</if> </when>
<if test="pd.INSPECTION_SUBJECT != null and pd.INSPECTION_SUBJECT != ''"><!-- 检查题目 --> </choose>
and se.INSPECTION_SUBJECT = #{pd.INSPECTION_SUBJECT,jdbcType=VARCHAR} </if>
</if> <if test='pd.INSPECTED_SITEUSER_ID != null and pd.INSPECTED_SITEUSER_ID != ""'>
<if test="pd.INSPECTED_DEPARTMENT_NAME != null and pd.INSPECTED_DEPARTMENT_NAME != ''"><!-- 被检查单位 --> <!-- 被检查单位现场负责人 -->
and isd.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTED_DEPARTMENT_NAME}),'%') and se.INSPECTED_SITEUSER_ID = #{pd.INSPECTED_SITEUSER_ID}
</if> </if>
<if test="pd.INSPECTION_DEPARTMENT_NAME != null and pd.INSPECTION_DEPARTMENT_NAME != ''"><!-- 检查部门 --> <if test="pd.INSPECTION_SUBJECT != null and pd.INSPECTION_SUBJECT != ''">
and iod.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_DEPARTMENT_NAME}),'%') <!-- 检查题目 -->
</if> and se.INSPECTION_SUBJECT = #{pd.INSPECTION_SUBJECT,jdbcType=VARCHAR}
<if test="pd.INSPECTION_ORIGINATOR_NAME != null and pd.INSPECTION_ORIGINATOR_NAME != ''"><!-- 检查发起人 --> </if>
and iou.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_ORIGINATOR_NAME}),'%') <if test="pd.INSPECTED_DEPARTMENT_NAME != null and pd.INSPECTED_DEPARTMENT_NAME != ''">
</if> <!-- 被检查单位 -->
<if test="pd.INSPECTION_TYPE != null and pd.INSPECTION_TYPE != ''"><!-- 检查类型 --> and isd.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTED_DEPARTMENT_NAME}), '%')
and se.INSPECTION_TYPE = #{pd.INSPECTION_TYPE} </if>
</if> <if test="pd.INSPECTION_DEPARTMENT_NAME != null and pd.INSPECTION_DEPARTMENT_NAME != ''">
<if test="pd.INSPECTION_TIME_START != null and pd.INSPECTION_TIME_START != ''"><!-- 检查时间 --> <!-- 检查部门 -->
and se.INSPECTION_TIME_START &gt;= CONCAT(#{pd.INSPECTION_TIME_START}, ' 00:00') and iod.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_DEPARTMENT_NAME}), '%')
</if> </if>
<if test="pd.INSPECTION_TIME_END != null and pd.INSPECTION_TIME_END != ''"><!-- 检查时间 --> <if test="pd.INSPECTION_ORIGINATOR_NAME != null and pd.INSPECTION_ORIGINATOR_NAME != ''">
and se.INSPECTION_TIME_END &lt;= CONCAT(#{pd.INSPECTION_TIME_END}, ' 23:59') <!-- 检查发起人 -->
</if> and iou.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_ORIGINATOR_NAME}), '%')
<if test="pd.INSPECTION_STATUS != null and pd.INSPECTION_STATUS != ''"><!-- 检查状态 --> </if>
and se.INSPECTION_STATUS = #{pd.INSPECTION_STATUS} <if test="pd.INSPECTION_TYPE != null and pd.INSPECTION_TYPE != ''">
</if> <!-- 检查类型 -->
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''"><!-- 关键词检索 --> and se.INSPECTION_TYPE = #{pd.INSPECTION_TYPE}
and se.CORPINFO_ID = #{pd.CORPINFO_ID} </if>
</if> <if test="pd.INSPECTION_TIME_START != null and pd.INSPECTION_TIME_START != ''">
GROUP BY se.INSPECTION_ID <!-- 检查时间 -->
ORDER BY se.INSPECTION_TIME_START DESC and se.INSPECTION_TIME_START &gt;= CONCAT(#{pd.INSPECTION_TIME_START}, ' 00:00')
</select> </if>
<if test="pd.INSPECTION_TIME_END != null and pd.INSPECTION_TIME_END != ''">
<!-- 检查时间 -->
and se.INSPECTION_TIME_END &lt;= CONCAT(#{pd.INSPECTION_TIME_END}, ' 23:59')
</if>
<if test="pd.INSPECTION_STATUS != null and pd.INSPECTION_STATUS != ''">
<!-- 检查状态 -->
and se.INSPECTION_STATUS = #{pd.INSPECTION_STATUS}
</if>
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
<!-- 关键词检索 -->
and se.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
GROUP BY se.INSPECTION_ID
ORDER BY FIELD(se.INSPECTION_STATUS, '2', '1', '0', '3', '4', '5', '6', '7', '8', '-1', '-2'),
FIELD(if(se.INSPECTED_SITEUSER_ID = #{pd.loginUserId},se.INSPECTED_SITEUSER_ID,'1'), se.INSPECTED_SITEUSER_ID, '1'),
se.INSPECTION_TIME_START DESC
</select>
<!-- 列表(全部) --> <!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd"> <select id="listAll" parameterType="pd" resultType="pd">

View File

@ -721,7 +721,9 @@
) )
</if> </if>
GROUP BY f.INSPECTION_ID GROUP BY f.INSPECTION_ID
ORDER BY f.INSPECTION_TIME_END DESC ORDER BY FIELD(if(f.INSPECTED_SITEUSER_ID = #{pd.loginUserId},f.INSPECTED_SITEUSER_ID,'1'), f.INSPECTED_SITEUSER_ID, '1'),
field(f.INSPECTION_STATUS , '3','4','6','7','5','0','1','2','8','-1','-2'),
f.INSPECTION_TIME_END DESC
</select> </select>
<select id="statisticsBranchGroupDept" parameterType="pd" resultType="pd"> <select id="statisticsBranchGroupDept" parameterType="pd" resultType="pd">

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.datasource.messages.MessagesMapper">
<select id="install">
insert into push_records
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="phone != null and phone != ''">
PHONE,
</if>
<if test="messageTitle != null and messageTitle != ''">
MESSAGE_TITLE,
</if>
<if test="messageContent != null and messageContent != ''">
MESSAGE_CONTENT,
</if>
<if test="messageType != null">
MESSAGE_TYPE,
</if>
<if test="sendTime != null and sendTime != ''">
SEND_TIME,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="phone != null and phone != ''">
#{phone},
</if>
<if test="messageTitle != null and messageTitle != ''">
#{messageTitle},
</if>
<if test="messageContent != null and messageContent != ''">
#{messageContent},
</if>
<if test="messageType != null">
#{messageType},
</if>
<if test="sendTime != null and sendTime != ''">
#{sendTime},
</if>
</trim>
</select>
<select id="findUserIdByPhone" resultType="java.lang.String">
select USER_ID from sys_user where USERNAME = #{phone} and ISDELETE = 0 limit 1
</select>
</mapper>