From 38986c33642cd70bf7e5d0fb2f75fb0b1c000df0 Mon Sep 17 00:00:00 2001 From: shanao Date: Sat, 19 Oct 2024 17:34:40 +0800 Subject: [PATCH] 1111111 --- .../controller/app/AppHiddenController.java | 1 - .../app/AppServiceNoticeController.java | 25 +- .../SafetyEnvironmentalController.java | 1 + .../SafetyEnvironmentalExplainController.java | 495 +++++++++--------- .../messages/MessagesController.java | 76 +++ .../MessagesControllerExceptionHandler.java | 55 ++ .../zcloud/entity/messages/PushRecords.java | 35 ++ .../datasource/messages/MessagesMapper.java | 10 + .../service/bus/impl/CorpInfoServiceImpl.java | 11 +- .../service/messages/MessagesService.java | 8 + .../messages/impl/MessagesServiceImpl.java | 85 +++ src/main/resources/application-dev.properties | 10 +- .../datasource/bus/NoticeCorpMapper.xml | 2 +- .../SafetyEnvironmentalExplainMapper.xml | 163 +++--- .../inspection/SafetyEnvironmentalMapper.xml | 4 +- .../datasource/messages/MessagesMapper.xml | 53 ++ 16 files changed, 689 insertions(+), 345 deletions(-) create mode 100644 src/main/java/com/zcloud/controller/messages/MessagesController.java create mode 100644 src/main/java/com/zcloud/controller/messages/MessagesControllerExceptionHandler.java create mode 100644 src/main/java/com/zcloud/entity/messages/PushRecords.java create mode 100644 src/main/java/com/zcloud/mapper/datasource/messages/MessagesMapper.java create mode 100644 src/main/java/com/zcloud/service/messages/MessagesService.java create mode 100644 src/main/java/com/zcloud/service/messages/impl/MessagesServiceImpl.java create mode 100644 src/main/resources/mybatis/datasource/messages/MessagesMapper.xml diff --git a/src/main/java/com/zcloud/controller/app/AppHiddenController.java b/src/main/java/com/zcloud/controller/app/AppHiddenController.java index c653f501..036dbb9d 100644 --- a/src/main/java/com/zcloud/controller/app/AppHiddenController.java +++ b/src/main/java/com/zcloud/controller/app/AppHiddenController.java @@ -920,7 +920,6 @@ public class AppHiddenController extends BaseController { hs.put("ISDELETE", "0"); hiddenSchemeService.edit(hs); } - return map; } diff --git a/src/main/java/com/zcloud/controller/app/AppServiceNoticeController.java b/src/main/java/com/zcloud/controller/app/AppServiceNoticeController.java index 81c61279..3a843968 100644 --- a/src/main/java/com/zcloud/controller/app/AppServiceNoticeController.java +++ b/src/main/java/com/zcloud/controller/app/AppServiceNoticeController.java @@ -1,32 +1,23 @@ 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.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.bus.NoticeCorpService; import com.zcloud.service.bus.NoticeCorpUserService; -import com.zcloud.service.bus.NoticeLogService; import com.zcloud.service.bus.ServiceNoticeService; import com.zcloud.service.system.UsersService; import com.zcloud.util.DateUtil; -import com.zcloud.util.Jurisdiction; -import com.zcloud.util.ObjectExcelView; 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; /** * 说明:通知公告 diff --git a/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java b/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java index 043b1215..a8b43a61 100644 --- a/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java +++ b/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java @@ -734,6 +734,7 @@ public class SafetyEnvironmentalController extends BaseController { pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID pd.put("waffle", Jurisdiction.getUSER_ID()); page.setPd(pd); + pd.put("loginUserId", Jurisdiction.getUSER_ID()); List varList = safetyenvironmentalService.checkList(page); //列出SafetyEnvironmental列表 /* 针对验收部分特殊处理 */ for (PageData vector : varList) { diff --git a/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalExplainController.java b/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalExplainController.java index 1cd904e2..d4569390 100644 --- a/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalExplainController.java +++ b/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalExplainController.java @@ -32,39 +32,42 @@ import java.util.stream.Collectors; @RequestMapping("/safetyenvironmentalexplain") public class SafetyEnvironmentalExplainController extends BaseController { - @Autowired - private SafetyEnvironmentalExplainService safetyenvironmentalexplainService; - @Autowired - private HiddenService hiddenService; + @Autowired + private SafetyEnvironmentalExplainService safetyenvironmentalexplainService; + @Autowired + private HiddenService hiddenService; - @Autowired - private DepartmentService departmentService; - @Resource - private NoticeCorpUtil noticeCorpUtil; + @Autowired + private DepartmentService departmentService; + @Resource + private NoticeCorpUtil noticeCorpUtil; - /**列表 - * @param page - * @throws Exception - */ - @RequestMapping(value="/list") - @RequiresPermissions("safetyenvironmentalexplain:list") - @ResponseBody - public Object list(Page page) throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 - if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); + /** + * 列表 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/list") + @RequiresPermissions("safetyenvironmentalexplain:list") + @ResponseBody + public Object list(Page page) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 + if (Tools.notEmpty(KEYWORDS)) pd.put("KEYWORDS", KEYWORDS.trim()); // pd.put("INSPECTED_SITEUSER_ID", Jurisdiction.getUSER_ID()); //被检查单位现场负责人 - pd = Jurisdiction.getUserDataJurisdiction(pd); - page.setPd(pd); - List varList = safetyenvironmentalexplainService.list(page); //列出SafetyEnvironmentalExplain列表 - for (PageData vector: varList) { - PageData condition = new PageData(); - condition.put("DEPARTMENT_ID",vector.getString("INSPECTED_DEPARTMENT_ID")); - List parent_list = departmentService.getGenealogy(condition); - String corp_infos = ""; + pd = Jurisdiction.getUserDataJurisdiction(pd); + pd.put("loginUserId", Jurisdiction.getUSER_ID()); + page.setPd(pd); + List varList = safetyenvironmentalexplainService.list(page); //列出SafetyEnvironmentalExplain列表 + for (PageData vector : varList) { + PageData condition = new PageData(); + condition.put("DEPARTMENT_ID", vector.getString("INSPECTED_DEPARTMENT_ID")); + List parent_list = departmentService.getGenealogy(condition); + String corp_infos = ""; /*for(PageData pageData:parent_list){ for(Object key:pageData.keySet()){ 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)){ - 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); - } - map.put("varList", varList); - map.put("page", page); - map.put("result", errInfo); - return map; - } + 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("-")); + } + vector.put("INSPECTED_DEPARTMENT_NAMES", corp_infos); + } + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } - /**新增 - * @param - * @throws Exception - */ - @RequestMapping(value="/add") - @RequiresPermissions("safetyenvironmentalexplain:add") - @ResponseBody - public Object add(@RequestParam(value="file",required=false) MultipartFile file) throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd.put("INSPECTION_EXPLAIN_ID", this.get32UUID()); //主键 - pd.put("ISDELETE", "0"); //是否删除(0:有效 1:删除) - pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人 - pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 - pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人 - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID - pd.put("ACTION_USER", Jurisdiction.getName()); //操作人 - pd.put("VALID","1"); - pd.put("ISPASS","0"); - if (StringUtils.isNotBlank(pd.getString("INSPECTED_SITEUSER_SIGN_IMG"))) { - MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("INSPECTED_SITEUSER_SIGN_IMG")); - String suffixName = img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); - if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { - errInfo = "fail"; - map.put("result", errInfo); - map.put("msg", "文件格式不正确!"); - return map; - } - 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); + /** + * 新增 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/add") + @RequiresPermissions("safetyenvironmentalexplain:add") + @ResponseBody + public Object add(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("INSPECTION_EXPLAIN_ID", this.get32UUID()); //主键 + pd.put("ISDELETE", "0"); //是否删除(0:有效 1:删除) + pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人 + pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 + pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID + pd.put("ACTION_USER", Jurisdiction.getName()); //操作人 + pd.put("VALID", "1"); + pd.put("ISPASS", "0"); + if (StringUtils.isNotBlank(pd.getString("INSPECTED_SITEUSER_SIGN_IMG"))) { + MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("INSPECTED_SITEUSER_SIGN_IMG")); + String suffixName = img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase(); + if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { + errInfo = "fail"; + map.put("result", errInfo); + map.put("msg", "文件格式不正确!"); + return map; + } + 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); - } - if (null != file && !file.isEmpty()) { - 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)) { - errInfo = "fail"; - map.put("result", errInfo); - map.put("msg", "文件格式不正确!"); - return map; - } - String ffile = DateUtil.getDays(); - //服务器 - String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - Smb.sshSftp(file, fileName, Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile); - pd.put("INSPECTED_EXPLAIN_FILENAME", file.getOriginalFilename()); - pd.put("INSPECTED_EXPLAIN_FILEPATH", Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); - } - safetyenvironmentalexplainService.save(pd); + pd.put("INSPECTED_SITEUSER_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); + } + if (null != file && !file.isEmpty()) { + 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)) { + errInfo = "fail"; + map.put("result", errInfo); + map.put("msg", "文件格式不正确!"); + return map; + } + String ffile = DateUtil.getDays(); + //服务器 + String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + Smb.sshSftp(file, fileName, Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile); + pd.put("INSPECTED_EXPLAIN_FILENAME", file.getOriginalFilename()); + pd.put("INSPECTED_EXPLAIN_FILEPATH", Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); + } + safetyenvironmentalexplainService.save(pd); - noticeCorpUtil.SE_PleadingStepUtil(pd); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + noticeCorpUtil.SE_PleadingStepUtil(pd); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - /**删除 - * @param - * @throws Exception - */ - @RequestMapping(value="/delete") - @RequiresPermissions("safetyenvironmentalexplain:del") - @ResponseBody - public Object delete() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - safetyenvironmentalexplainService.delete(pd); - map.put("result", errInfo); //返回结果 - return map; - } + /** + * 删除 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/delete") + @RequiresPermissions("safetyenvironmentalexplain:del") + @ResponseBody + public Object delete() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + safetyenvironmentalexplainService.delete(pd); + map.put("result", errInfo); //返回结果 + return map; + } - /**修改 - * @param - * @throws Exception - */ - @RequestMapping(value="/edit") - @RequiresPermissions("safetyenvironmentalexplain:edit") - @ResponseBody - public Object edit() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - safetyenvironmentalexplainService.edit(pd); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + /** + * 修改 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/edit") + @RequiresPermissions("safetyenvironmentalexplain:edit") + @ResponseBody + public Object edit() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + safetyenvironmentalexplainService.edit(pd); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - /**去修改页面获取数据 - * @param - * @throws Exception - */ - @RequestMapping(value="/goEdit") - @RequiresPermissions("safetyenvironmentalexplain:edit") - @ResponseBody - public Object goEdit() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd = safetyenvironmentalexplainService.findById(pd); //根据ID读取 - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + /** + * 去修改页面获取数据 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/goEdit") + @RequiresPermissions("safetyenvironmentalexplain:edit") + @ResponseBody + public Object goEdit() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd = safetyenvironmentalexplainService.findById(pd); //根据ID读取 + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - /**批量删除 - * @param - * @throws Exception - */ - @RequestMapping(value="/deleteAll") - @RequiresPermissions("safetyenvironmentalexplain:del") - @ResponseBody - public Object deleteAll() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - String DATA_IDS = pd.getString("DATA_IDS"); - if(Tools.notEmpty(DATA_IDS)){ - String[] ArrayDATA_IDS = DATA_IDS.split(","); - pd.put("ArrayDATA_IDS", ArrayDATA_IDS); //待删除ids - safetyenvironmentalexplainService.deleteAll(pd); - errInfo = "success"; - }else{ - errInfo = "fail"; - } - map.put("result", errInfo); //返回结果 - return map; - } + /** + * 批量删除 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/deleteAll") + @RequiresPermissions("safetyenvironmentalexplain:del") + @ResponseBody + public Object deleteAll() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + String DATA_IDS = pd.getString("DATA_IDS"); + if (Tools.notEmpty(DATA_IDS)) { + String[] ArrayDATA_IDS = DATA_IDS.split(","); + pd.put("ArrayDATA_IDS", ArrayDATA_IDS); //待删除ids + safetyenvironmentalexplainService.deleteAll(pd); + errInfo = "success"; + } else { + errInfo = "fail"; + } + map.put("result", errInfo); //返回结果 + return map; + } - /**导出到excel - * @param - * @throws Exception - */ - @RequestMapping(value="/excel") - @RequiresPermissions("toExcel") - public ModelAndView exportExcel() throws Exception{ - ModelAndView mv = new ModelAndView(); - PageData pd = new PageData(); - pd = this.getPageData(); - Map dataMap = new HashMap(); - List titles = new ArrayList(); - titles.add("安全环保检查ID"); //1 - titles.add("申辩内容"); //2 - titles.add("是否删除(0:有效 1:删除)"); //3 - titles.add("添加人"); //4 - titles.add("添加时间"); //5 - titles.add("修改人"); //6 - titles.add("修改时间"); //7 - titles.add("企业ID"); //8 - dataMap.put("titles", titles); - pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID - List varOList = safetyenvironmentalexplainService.listAll(pd); - List varList = new ArrayList(); - for(int i=0;i dataMap = new HashMap(); + List titles = new ArrayList(); + titles.add("安全环保检查ID"); //1 + titles.add("申辩内容"); //2 + titles.add("是否删除(0:有效 1:删除)"); //3 + titles.add("添加人"); //4 + titles.add("添加时间"); //5 + titles.add("修改人"); //6 + titles.add("修改时间"); //7 + titles.add("企业ID"); //8 + dataMap.put("titles", titles); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID + List varOList = safetyenvironmentalexplainService.listAll(pd); + List varList = new ArrayList(); + for (int i = 0; i < varOList.size(); i++) { + PageData vpd = new PageData(); + vpd.put("var1", varOList.get(i).getString("INSPECTION_ID")); //1 + vpd.put("var2", varOList.get(i).getString("INSPECTED_EXPLAIN")); //2 + vpd.put("var3", varOList.get(i).getString("ISDELETE")); //3 + vpd.put("var4", varOList.get(i).getString("CREATOR")); //4 + vpd.put("var5", varOList.get(i).getString("CREATTIME")); //5 + vpd.put("var6", varOList.get(i).getString("OPERATOR")); //6 + vpd.put("var7", varOList.get(i).getString("OPERATTIME")); //7 + vpd.put("var8", varOList.get(i).getString("CORPINFO_ID")); //8 + varList.add(vpd); + } + dataMap.put("varList", varList); + ObjectExcelView erv = new ObjectExcelView(); + mv = new ModelAndView(erv, dataMap); + return mv; + } - /**查询安环检查是否有隐患 - * @param - * @throws Exception - */ - @RequestMapping(value="/hiddencount") - @ResponseBody - public Object hiddencount() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - List hiddenlist = hiddenService.findByInspectionId(pd); //根据ID读取 - if(hiddenlist.size()>0){ - map.put("hiddencount",'1'); - } else { - map.put("hiddencount",'0'); - } - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + /** + * 查询安环检查是否有隐患 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/hiddencount") + @ResponseBody + public Object hiddencount() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + List hiddenlist = hiddenService.findByInspectionId(pd); //根据ID读取 + if (hiddenlist.size() > 0) { + map.put("hiddencount", '1'); + } else { + map.put("hiddencount", '0'); + } + map.put("pd", pd); + map.put("result", errInfo); + return map; + } } diff --git a/src/main/java/com/zcloud/controller/messages/MessagesController.java b/src/main/java/com/zcloud/controller/messages/MessagesController.java new file mode 100644 index 00000000..5160a9c6 --- /dev/null +++ b/src/main/java/com/zcloud/controller/messages/MessagesController.java @@ -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 push(@RequestBody Map body) throws Exception { + Map 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> 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 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("解密失败"); + } + } +} diff --git a/src/main/java/com/zcloud/controller/messages/MessagesControllerExceptionHandler.java b/src/main/java/com/zcloud/controller/messages/MessagesControllerExceptionHandler.java new file mode 100644 index 00000000..370d1c12 --- /dev/null +++ b/src/main/java/com/zcloud/controller/messages/MessagesControllerExceptionHandler.java @@ -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 handleMethodArgumentNotValidException(MethodArgumentNotValidException ex) { + Map 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 handleConstraintViolationException(ConstraintViolationException ex) { + Map result = new HashMap<>(); + result.put("msg", ex.getMessage()); + result.put("code", 500); + return result; + } + + @ExceptionHandler(RuntimeException.class) + public Map handleRuntimeException(RuntimeException ex) { + Map result = new HashMap<>(); + result.put("msg", ex.getMessage()); + result.put("code", 500); + return result; + } + + @ExceptionHandler(Exception.class) + public Map handleRuntimeException(Exception ex) { + log.error("系统异常,请稍后重试", ex); + Map result = new HashMap<>(); + result.put("msg", ex.getMessage()); + result.put("code", 500); + return result; + } +} diff --git a/src/main/java/com/zcloud/entity/messages/PushRecords.java b/src/main/java/com/zcloud/entity/messages/PushRecords.java new file mode 100644 index 00000000..3ca02e19 --- /dev/null +++ b/src/main/java/com/zcloud/entity/messages/PushRecords.java @@ -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; +} diff --git a/src/main/java/com/zcloud/mapper/datasource/messages/MessagesMapper.java b/src/main/java/com/zcloud/mapper/datasource/messages/MessagesMapper.java new file mode 100644 index 00000000..a3c36138 --- /dev/null +++ b/src/main/java/com/zcloud/mapper/datasource/messages/MessagesMapper.java @@ -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); +} diff --git a/src/main/java/com/zcloud/service/bus/impl/CorpInfoServiceImpl.java b/src/main/java/com/zcloud/service/bus/impl/CorpInfoServiceImpl.java index 99d0b82d..7eb8ee68 100644 --- a/src/main/java/com/zcloud/service/bus/impl/CorpInfoServiceImpl.java +++ b/src/main/java/com/zcloud/service/bus/impl/CorpInfoServiceImpl.java @@ -1,13 +1,14 @@ 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.PageData; import com.zcloud.mapper.datasource.bus.CorpInfoMapper; 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{ PageData byId = corpinfoMapper.findById(pd); - if (byId.get("FOURTYPE") != null) { + if (byId != null && byId.get("FOURTYPE") != null) { String fourtype = byId.get("FOURTYPE").toString(); byId.put("FOURTYPE", fourtype); } diff --git a/src/main/java/com/zcloud/service/messages/MessagesService.java b/src/main/java/com/zcloud/service/messages/MessagesService.java new file mode 100644 index 00000000..89006974 --- /dev/null +++ b/src/main/java/com/zcloud/service/messages/MessagesService.java @@ -0,0 +1,8 @@ +package com.zcloud.service.messages; + +import com.zcloud.entity.messages.PushRecords; + +public interface MessagesService { + + void push(PushRecords pushRecords) throws Exception; +} diff --git a/src/main/java/com/zcloud/service/messages/impl/MessagesServiceImpl.java b/src/main/java/com/zcloud/service/messages/impl/MessagesServiceImpl.java new file mode 100644 index 00000000..72af1bba --- /dev/null +++ b/src/main/java/com/zcloud/service/messages/impl/MessagesServiceImpl.java @@ -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); + } +} diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 86a5d55e..d17a5e34 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -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.username=dev 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.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.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??? @@ -112,6 +106,7 @@ perLoc.url=http://192.168.210.32:8084 perLoc.userName=qaaqadmin perLoc.pwd=Cfd2023@ 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.group=scheduled_tasks_csy_docking @@ -150,10 +145,9 @@ gongJiangXueYuanProdUrl=https://gjxy.bjttsx.com gongJiangXueYuanGetImgUrl=https://wwag.qhdsafety.com/file/ # \u4E2D\u53F0 -tongbu.url=http://127.0.0.1:8094 # \u6D88\u8D39\u4E2D\u53F0\u901A\u77E5 mq.consumer.dataChange.tongbu-data-change.topic=tongbu_dataChange_docking 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 -mq.producer.dataChange.slice-data-change.topic=slice_dataChange_docking \ No newline at end of file +mq.producer.dataChange.slice-data-change.topic=slice_dataChange_docking diff --git a/src/main/resources/mybatis/datasource/bus/NoticeCorpMapper.xml b/src/main/resources/mybatis/datasource/bus/NoticeCorpMapper.xml index 2f2bada1..39d84775 100644 --- a/src/main/resources/mybatis/datasource/bus/NoticeCorpMapper.xml +++ b/src/main/resources/mybatis/datasource/bus/NoticeCorpMapper.xml @@ -161,7 +161,7 @@ - select - iou.NAME INSPECTION_ORIGINATOR_NAME, - iod.NAME INSPECTION_DEPARTMENT_NAME, - isd.NAME INSPECTED_DEPARTMENT_NAME, - isu.NAME INSPECTED_SITEUSER_NAME, - IFNULL(GROUP_CONCAT(REPLACE(siu.NAME,'/',',')),'') AS INSPECTION_USER_NAME, - CASE WHEN IFNULL(se.INSPECTION_TYPE_OTHER, '') = '' THEN d.NAME ELSE se.INSPECTION_TYPE_OTHER END INSPECTION_TYPE_NAME, - se.INSPECTION_TIME_START, - se.INSPECTION_TIME_END, - se.INSPECTION_STATUS, - se.INSPECTION_SUBJECT, - se.INSPECTED_EXPLAIN, - se.INSPECTED_EXPLAIN_FILENAME, - se.INSPECTED_EXPLAIN_FILEPATH, - se.INSPECTED_SITEUSER_SIGN_IMG, - se.INSPECTED_SITEUSER_SIGN_TIME, - se.INSPECTION_ID, - se.INSPECTED_SITEUSER_ID, - se.INSPECTED_DEPARTMENT_ID - from BUS_INSPECTION_SAFETYENVIRONMENTAL se - LEFT JOIN VI_USER_ALL iou ON iou.USER_ID = se.INSPECTION_ORIGINATOR_ID - LEFT JOIN VI_DEPARTMENT_ALL iod ON iod.DEPARTMENT_ID = iou.DEPARTMENT_ID - LEFT JOIN OA_DEPARTMENT isd ON isd.DEPARTMENT_ID = se.INSPECTED_DEPARTMENT_ID - LEFT JOIN SYS_USER isu ON isu.USER_ID = se.INSPECTED_SITEUSER_ID - LEFT JOIN bus_inspection_safetyenvironmental_inspector si ON si.INSPECTION_ID = se.INSPECTION_ID and si.ISDELETE = '0' - LEFT JOIN vi_user_all siu ON siu.USER_ID = si.INSPECTION_USER_ID - LEFT JOIN sys_dictionaries d ON d.BIANMA = se.INSPECTION_TYPE - where se.ISDELETE = '0' and se.INSPECTION_STATUS = '2' - - - - - - and siu.DEPARTMENT_ID in (${pd.supDeparIds}) or se.INSPECTED_DEPARTMENT_ID in (${pd.supDeparIds}) - - - and siu.USER_ID in (#{pd.loginUserId}) or se.INSPECTED_SITEUSER_ID in (#{pd.loginUserId}) - - - - - and se.INSPECTED_SITEUSER_ID = #{pd.INSPECTED_SITEUSER_ID} - - - and se.INSPECTION_SUBJECT = #{pd.INSPECTION_SUBJECT,jdbcType=VARCHAR} - - - and isd.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTED_DEPARTMENT_NAME}),'%') - - - and iod.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_DEPARTMENT_NAME}),'%') - - - and iou.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_ORIGINATOR_NAME}),'%') - - - and se.INSPECTION_TYPE = #{pd.INSPECTION_TYPE} - - - and se.INSPECTION_TIME_START >= CONCAT(#{pd.INSPECTION_TIME_START}, ' 00:00') - - - and se.INSPECTION_TIME_END <= CONCAT(#{pd.INSPECTION_TIME_END}, ' 23:59') - - - and se.INSPECTION_STATUS = #{pd.INSPECTION_STATUS} - - - and se.CORPINFO_ID = #{pd.CORPINFO_ID} - - GROUP BY se.INSPECTION_ID - ORDER BY se.INSPECTION_TIME_START DESC - + select iou.NAME INSPECTION_ORIGINATOR_NAME, + iod.NAME INSPECTION_DEPARTMENT_NAME, + isd.NAME INSPECTED_DEPARTMENT_NAME, + isu.NAME INSPECTED_SITEUSER_NAME, + IFNULL(GROUP_CONCAT(REPLACE(siu.NAME, '/', ',')), '') AS INSPECTION_USER_NAME, + CASE + WHEN IFNULL(se.INSPECTION_TYPE_OTHER, '') = '' THEN d.NAME + ELSE se.INSPECTION_TYPE_OTHER END INSPECTION_TYPE_NAME, + se.INSPECTION_TIME_START, + se.INSPECTION_TIME_END, + se.INSPECTION_STATUS, + se.INSPECTION_SUBJECT, + se.INSPECTED_EXPLAIN, + se.INSPECTED_EXPLAIN_FILENAME, + se.INSPECTED_EXPLAIN_FILEPATH, + se.INSPECTED_SITEUSER_SIGN_IMG, + se.INSPECTED_SITEUSER_SIGN_TIME, + se.INSPECTION_ID, + se.INSPECTED_SITEUSER_ID, + se.INSPECTED_DEPARTMENT_ID + from BUS_INSPECTION_SAFETYENVIRONMENTAL se + LEFT JOIN VI_USER_ALL iou ON iou.USER_ID = se.INSPECTION_ORIGINATOR_ID + LEFT JOIN VI_DEPARTMENT_ALL iod ON iod.DEPARTMENT_ID = iou.DEPARTMENT_ID + LEFT JOIN OA_DEPARTMENT isd ON isd.DEPARTMENT_ID = se.INSPECTED_DEPARTMENT_ID + LEFT JOIN SYS_USER isu ON isu.USER_ID = se.INSPECTED_SITEUSER_ID + LEFT JOIN bus_inspection_safetyenvironmental_inspector si + ON si.INSPECTION_ID = se.INSPECTION_ID and si.ISDELETE = '0' + LEFT JOIN vi_user_all siu ON siu.USER_ID = si.INSPECTION_USER_ID + LEFT JOIN sys_dictionaries d ON d.BIANMA = se.INSPECTION_TYPE + where se.ISDELETE = '0' and se.INSPECTION_STATUS = '2' + + + + + + + and siu.DEPARTMENT_ID in (${pd.supDeparIds}) + or se.INSPECTED_DEPARTMENT_ID in (${pd.supDeparIds}) + + + and siu.USER_ID in (#{pd.loginUserId}) + or se.INSPECTED_SITEUSER_ID in (#{pd.loginUserId}) + + + + + + and se.INSPECTED_SITEUSER_ID = #{pd.INSPECTED_SITEUSER_ID} + + + + and se.INSPECTION_SUBJECT = #{pd.INSPECTION_SUBJECT,jdbcType=VARCHAR} + + + + and isd.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTED_DEPARTMENT_NAME}), '%') + + + + and iod.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_DEPARTMENT_NAME}), '%') + + + + and iou.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_ORIGINATOR_NAME}), '%') + + + + and se.INSPECTION_TYPE = #{pd.INSPECTION_TYPE} + + + + and se.INSPECTION_TIME_START >= CONCAT(#{pd.INSPECTION_TIME_START}, ' 00:00') + + + + and se.INSPECTION_TIME_END <= CONCAT(#{pd.INSPECTION_TIME_END}, ' 23:59') + + + + and se.INSPECTION_STATUS = #{pd.INSPECTION_STATUS} + + + + and se.CORPINFO_ID = #{pd.CORPINFO_ID} + + 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 + + insert into push_records + + + ID, + + + PHONE, + + + MESSAGE_TITLE, + + + MESSAGE_CONTENT, + + + MESSAGE_TYPE, + + + SEND_TIME, + + + values + + + #{id}, + + + #{phone}, + + + #{messageTitle}, + + + #{messageContent}, + + + #{messageType}, + + + #{sendTime}, + + + + + + \ No newline at end of file