diff --git a/src/main/java/com/zcloud/controller/app/inspection/AppSafetyEnvironmentalController.java b/src/main/java/com/zcloud/controller/app/inspection/AppSafetyEnvironmentalController.java index 5ad5002c..d3b5b997 100644 --- a/src/main/java/com/zcloud/controller/app/inspection/AppSafetyEnvironmentalController.java +++ b/src/main/java/com/zcloud/controller/app/inspection/AppSafetyEnvironmentalController.java @@ -3,7 +3,6 @@ package com.zcloud.controller.app.inspection; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; -import com.zcloud.entity.hotWorkApplication.Node; import com.zcloud.entity.hotWorkApplication.NodeApp; import com.zcloud.entity.hotWorkApplication.Overseer; import com.zcloud.service.bus.HiddenService; @@ -14,7 +13,6 @@ import com.zcloud.service.inspection.SafetyEnvironmentalInspectorService; import com.zcloud.service.inspection.SafetyEnvironmentalService; import com.zcloud.service.system.DepartmentService; import com.zcloud.util.*; -import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -26,9 +24,7 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; -import java.io.File; import java.util.*; -import java.util.stream.Collectors; /** * 说明:安全环保检查 @@ -40,484 +36,511 @@ import java.util.stream.Collectors; @RequestMapping("/app/safetyenvironmental") public class AppSafetyEnvironmentalController extends BaseController { - @Autowired - private SafetyEnvironmentalService safetyenvironmentalService; - @Autowired - private SafetyEnvironmentalInspectorService safetyEnvironmentalInspectorService; - @Autowired - private SafetyEnvironmentalExplainService explainService; - @Autowired - private HiddenService hiddenService; - @Autowired - private DepartmentService departmentService; - @Resource - private SafetyEnvironmentalInspectorService inspectorService; - @Resource - private SafetyEnvironmentalAssessService assessService; - @Autowired - private NoticeCorpUtil noticeCorpUtil; + @Autowired + private SafetyEnvironmentalService safetyenvironmentalService; + @Autowired + private SafetyEnvironmentalInspectorService safetyEnvironmentalInspectorService; + @Autowired + private SafetyEnvironmentalExplainService explainService; + @Autowired + private HiddenService hiddenService; + @Autowired + private DepartmentService departmentService; + @Resource + private SafetyEnvironmentalInspectorService inspectorService; + @Resource + private SafetyEnvironmentalAssessService assessService; + @Autowired + private NoticeCorpUtil noticeCorpUtil; - /**列表 - * @param page - * @throws Exception - */ - @RequestMapping(value="/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()); - page.setPd(pd); - List varList = safetyenvironmentalService.list(page); //列出SafetyEnvironmental列表 - map.put("varList", varList); - map.put("page", page); - map.put("result", errInfo); - return map; - } + /** + * 列表 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/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()); + page.setPd(pd); + List varList = safetyenvironmentalService.list(page); //列出SafetyEnvironmental列表 + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } - /**新增 - * @param - * @throws Exception - */ - @RequestMapping(value="/add") - @ResponseBody - public Object add(@RequestParam(value="FFILE",required=false) MultipartFile file) throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd.put("INSPECTION_ID", this.get32UUID()); //主键 - pd.put("INSPECTION_ORIGINATOR_ID", pd.getString("CREATOR")); //检查发起人 - pd.put("ISDELETE", "0"); //是否删除(0:有效 1:删除) - pd.put("CREATOR", pd.getString("CREATOR")); //添加人 - pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 - pd.put("OPERATOR", pd.getString("CREATOR")); //修改人 - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - pd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); //企业ID - pd.put("ACTION_USER", pd.getString("ACTION_USER")); //操作人 - String ffile = DateUtil.getDays(); - if (file != null && StringUtils.isNotBlank(pd.getString("INSPECTION_USER_OPINION"))){ - 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 fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); - pd.put("CONFIRM_MESSAGE_SIGN_ROUTE", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); - pd.put("CONFIRM_MESSAGE",pd.getString("INSPECTION_USER_OPINION")); - pd.put("CONFIRM_MESSAGE_TIME",DateUtil.date2Str(new Date())); - } - List hiddenList = safetyenvironmentalService.save(pd); - pd.put("hiddenList", hiddenList); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + /** + * 新增 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/add") + @ResponseBody + public Object add(@RequestParam(value = "FFILE", required = false) MultipartFile file) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("INSPECTION_ID", this.get32UUID()); //主键 + pd.put("INSPECTION_ORIGINATOR_ID", pd.getString("CREATOR")); //检查发起人 + pd.put("ISDELETE", "0"); //是否删除(0:有效 1:删除) + pd.put("CREATOR", pd.getString("CREATOR")); //添加人 + pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 + pd.put("OPERATOR", pd.getString("CREATOR")); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); //企业ID + pd.put("ACTION_USER", pd.getString("ACTION_USER")); //操作人 + String ffile = DateUtil.getDays(); + if (file != null && StringUtils.isNotBlank(pd.getString("INSPECTION_USER_OPINION"))) { + 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 fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); + pd.put("CONFIRM_MESSAGE_SIGN_ROUTE", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); + pd.put("CONFIRM_MESSAGE", pd.getString("INSPECTION_USER_OPINION")); + pd.put("CONFIRM_MESSAGE_TIME", DateUtil.date2Str(new Date())); + } + List hiddenList = safetyenvironmentalService.save(pd); + pd.put("hiddenList", hiddenList); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - /**去修改页面获取数据 - * @param - * @throws Exception - */ - @RequestMapping(value="/goShow") - @ResponseBody - public Object goShow() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd = safetyenvironmentalService.findShowById(pd); //根据ID读取 - safetyenvironmentalService.departmentUtil(pd); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + /** + * 去修改页面获取数据 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/goShow") + @ResponseBody + public Object goShow() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd = safetyenvironmentalService.findShowById(pd); //根据ID读取 + safetyenvironmentalService.departmentUtil(pd); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - /**去修改页面获取数据 - * @param - * @throws Exception - */ - @RequestMapping(value="/goEdit") - @ResponseBody - public Object goEdit() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd = safetyenvironmentalService.findFormById(pd); //根据ID读取 - safetyenvironmentalService.departmentUtil(pd); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + /** + * 去修改页面获取数据 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/goEdit") + @ResponseBody + public Object goEdit() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd = safetyenvironmentalService.findFormById(pd); //根据ID读取 + safetyenvironmentalService.departmentUtil(pd); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - /**修改 - * @param - * @throws Exception - */ - @RequestMapping(value="/edit") - @ResponseBody - public Object edit(@RequestParam(value="FFILE",required=false) MultipartFile file) throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd.put("INSPECTION_STATUS", "0"); //状态(0.待检查人核实 1.检查人核实中、2.待被检查人确认、3.已归档 -1.检查人核实打回 -2被检查人申辩) - pd.put("OPERATOR", pd.getString("OPERATOR")); //修改人 - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - pd.put("ACTION_USER", pd.getString("ACTION_USER")); //操作人 - String ffile = DateUtil.getDays(); - if (file != null && StringUtils.isNotBlank(pd.getString("INSPECTION_USER_OPINION"))){ - 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 fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); - pd.put("CONFIRM_MESSAGE_SIGN_ROUTE", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); - pd.put("CONFIRM_MESSAGE",pd.getString("INSPECTION_USER_OPINION")); - pd.put("CONFIRM_MESSAGE_TIME",DateUtil.date2Str(new Date())); - } - List hiddenList = safetyenvironmentalService.edit(pd); - pd.put("hiddenList", hiddenList); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + /** + * 修改 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/edit") + @ResponseBody + public Object edit(@RequestParam(value = "FFILE", required = false) MultipartFile file) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("INSPECTION_STATUS", "0"); //状态(0.待检查人核实 1.检查人核实中、2.待被检查人确认、3.已归档 -1.检查人核实打回 -2被检查人申辩) + pd.put("OPERATOR", pd.getString("OPERATOR")); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("ACTION_USER", pd.getString("ACTION_USER")); //操作人 + String ffile = DateUtil.getDays(); + if (file != null && StringUtils.isNotBlank(pd.getString("INSPECTION_USER_OPINION"))) { + 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 fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); + pd.put("CONFIRM_MESSAGE_SIGN_ROUTE", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); + pd.put("CONFIRM_MESSAGE", pd.getString("INSPECTION_USER_OPINION")); + pd.put("CONFIRM_MESSAGE_TIME", DateUtil.date2Str(new Date())); + } + List hiddenList = safetyenvironmentalService.edit(pd); + pd.put("hiddenList", hiddenList); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - /**修改 - * @param - * @throws Exception - */ - @RequestMapping(value="/explain") - //@RequiresPermissions("safetyenvironmental:edit") - @ResponseBody - public Object explain(@RequestParam(value="FFILE",required=false) MultipartFile[] files) throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - if (files != null && files.length > 0) { - MultipartFile file = files[0]; - 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; - } + /** + * 修改 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/explain") + //@RequiresPermissions("safetyenvironmental:edit") + @ResponseBody + public Object explain(@RequestParam(value = "FFILE", required = false) MultipartFile[] files) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + if (files != null && files.length > 0) { + MultipartFile file = files[0]; + 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 + pd.getString("CORPINFO_ID") + "/" + ffile); + String ffile = DateUtil.getDays(); + String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); - pd.put("INSPECTION_ORIGINATOR_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); - } - safetyenvironmentalService.explain(pd); - pd.put("inspector",pd.getString("OPERATOR")); - noticeCorpUtil.FailPleadind(pd); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + pd.put("INSPECTION_ORIGINATOR_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); + } + safetyenvironmentalService.explain(pd); + pd.put("inspector", pd.getString("OPERATOR")); + noticeCorpUtil.FailPleadind(pd); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - /**删除 - * @param - * @throws Exception - */ - @RequestMapping(value="/delete") - @RequiresPermissions("safetyenvironmental:del") - @ResponseBody - public Object delete() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - safetyenvironmentalService.delete(pd); - map.put("result", errInfo); //返回结果 - return map; - } + /** + * 删除 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/delete") + @RequiresPermissions("safetyenvironmental:del") + @ResponseBody + public Object delete() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + safetyenvironmentalService.delete(pd); + map.put("result", errInfo); //返回结果 + return map; + } - /**批量删除 - * @param - * @throws Exception - */ - @RequestMapping(value="/deleteAll") - @RequiresPermissions("safetyenvironmental: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.getUSER_ID()); //修改人 - 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 - safetyenvironmentalService.deleteAll(pd); - errInfo = "success"; - }else{ - errInfo = "fail"; - } - map.put("result", errInfo); //返回结果 - return map; - } + /** + * 批量删除 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/deleteAll") + @RequiresPermissions("safetyenvironmental: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.getUSER_ID()); //修改人 + 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 + safetyenvironmentalService.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("检查发起人"); //1 - titles.add("被检查单位"); //2 - titles.add("被检查单位现场负责人"); //3 - titles.add("申辩内容"); //4 - titles.add("被检查单位现场负责人签字"); //5 - titles.add("被检查单位现场负责人签字时间"); //6 - titles.add("检查类型"); //7 - titles.add("检查场所"); //8 - titles.add("检查开始时间"); //9 - titles.add("检查结束时间"); //10 - titles.add("状态(0.暂存 1.检查人待确认、2.被检查人待确认、3.归档 -1.检查人异议打回 -2被检查人申辩)"); //11 - titles.add("是否删除(0:有效 1:删除)"); //12 - titles.add("添加人"); //13 - titles.add("添加时间"); //14 - titles.add("修改人"); //15 - titles.add("修改时间"); //16 - titles.add("企业ID"); //17 - dataMap.put("titles", titles); - pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID - List varOList = safetyenvironmentalService.listAll(pd); - List varList = new ArrayList(); - for(int i=0;i dataMap = new HashMap(); + List titles = new ArrayList(); + titles.add("检查发起人"); //1 + titles.add("被检查单位"); //2 + titles.add("被检查单位现场负责人"); //3 + titles.add("申辩内容"); //4 + titles.add("被检查单位现场负责人签字"); //5 + titles.add("被检查单位现场负责人签字时间"); //6 + titles.add("检查类型"); //7 + titles.add("检查场所"); //8 + titles.add("检查开始时间"); //9 + titles.add("检查结束时间"); //10 + titles.add("状态(0.暂存 1.检查人待确认、2.被检查人待确认、3.归档 -1.检查人异议打回 -2被检查人申辩)"); //11 + titles.add("是否删除(0:有效 1:删除)"); //12 + titles.add("添加人"); //13 + titles.add("添加时间"); //14 + titles.add("修改人"); //15 + titles.add("修改时间"); //16 + titles.add("企业ID"); //17 + dataMap.put("titles", titles); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID + List varOList = safetyenvironmentalService.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_ORIGINATOR_ID")); //1 + vpd.put("var2", varOList.get(i).getString("INSPECTED_DEPARTMENT_ID")); //2 + vpd.put("var3", varOList.get(i).getString("INSPECTED_SITEUSER_ID")); //3 + vpd.put("var4", varOList.get(i).getString("INSPECTED_EXPLAIN")); //4 + vpd.put("var5", varOList.get(i).getString("INSPECTED_SITEUSER_SIGN_IMG")); //5 + vpd.put("var6", varOList.get(i).getString("INSPECTED_SITEUSER_SIGN_TIME")); //6 + vpd.put("var7", varOList.get(i).getString("INSPECTION_TYPE")); //7 + vpd.put("var8", varOList.get(i).getString("INSPECTION_PLACE")); //8 + vpd.put("var9", varOList.get(i).getString("INSPECTION_TIME_START")); //9 + vpd.put("var10", varOList.get(i).getString("INSPECTION_TIME_END")); //10 + vpd.put("var11", varOList.get(i).getString("INSPECTION_STATUS")); //11 + vpd.put("var12", varOList.get(i).getString("ISDELETE")); //12 + vpd.put("var13", varOList.get(i).getString("CREATOR")); //13 + vpd.put("var14", varOList.get(i).getString("CREATTIME")); //14 + vpd.put("var15", varOList.get(i).getString("OPERATOR")); //15 + vpd.put("var16", varOList.get(i).getString("OPERATTIME")); //16 + vpd.put("var17", varOList.get(i).getString("CORPINFO_ID")); //17 + varList.add(vpd); + } + dataMap.put("varList", varList); + ObjectExcelView erv = new ObjectExcelView(); + mv = new ModelAndView(erv, dataMap); + return mv; + } - /**安全环保检查待办作业数统计 - * @param - * @throws Exception - */ - @RequestMapping(value="/countCheck") - @ResponseBody - public Object countCheck() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - PageData confirmCount = safetyEnvironmentalInspectorService.confirmCount(pd); //检查人确认数 - PageData checkedCount = safetyenvironmentalService.checkedCount(pd); //被检查人签字数 - PageData repulseCount = safetyenvironmentalService.repulseCount(pd); //打回数 - PageData repulseAndCheckCount = safetyenvironmentalService.repulseAndCheckCountCount(pd); //指派+验收数 + /** + * 安全环保检查待办作业数统计 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/countCheck") + @ResponseBody + public Object countCheck() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + PageData confirmCount = safetyEnvironmentalInspectorService.confirmCount(pd); //检查人确认数 + PageData checkedCount = safetyenvironmentalService.checkedCount(pd); //被检查人签字数 + PageData repulseCount = safetyenvironmentalService.repulseCount(pd); //打回数 + PageData repulseAndCheckCount = safetyenvironmentalService.repulseAndCheckCountCount(pd); //指派+验收数 - map.put("result", errInfo); - map.put("confirmCount", confirmCount); - map.put("checkedCount",checkedCount); - map.put("repulseCount",repulseCount); - map.put("repulseAndCheckCount",repulseAndCheckCount); - return map; - } + map.put("result", errInfo); + map.put("confirmCount", confirmCount); + map.put("checkedCount", checkedCount); + map.put("repulseCount", repulseCount); + map.put("repulseAndCheckCount", repulseAndCheckCount); + return map; + } - @RequestMapping(value="/getExplain") - @ResponseBody - public Object getExplain() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = this.getPageData(); - List list = explainService.findExplainById(pd); - map.put("list",list); - map.put("result", errInfo); - return map; - } + @RequestMapping(value = "/getExplain") + @ResponseBody + public Object getExplain() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = this.getPageData(); + List list = explainService.findExplainById(pd); + map.put("list", list); + map.put("result", errInfo); + return map; + } - /**一公司app首页安全环保检查统计 - * @param - * @throws Exception - */ - @RequestMapping(value="/countHome") - @ResponseBody - public Object countHome() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - PageData count = safetyEnvironmentalInspectorService.countHome(pd); //一公司app首页安全环保检查统计 - map.put("result", errInfo); - map.put("count", count); - return map; - } + /** + * 一公司app首页安全环保检查统计 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/countHome") + @ResponseBody + public Object countHome() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + PageData count = safetyEnvironmentalInspectorService.countHome(pd); //一公司app首页安全环保检查统计 + map.put("result", errInfo); + map.put("count", count); + return map; + } - /**列表 - * @param page - * @throws Exception - */ - @RequestMapping(value="/pleadList") - @ResponseBody - public Object pleadList(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()); - page.setPd(pd); - List varList = safetyenvironmentalService.pleadList(page); //列出SafetyEnvironmental列表 - map.put("varList", varList); - map.put("page", page); - map.put("result", errInfo); - return map; - } + /** + * 列表 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/pleadList") + @ResponseBody + public Object pleadList(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()); + page.setPd(pd); + List varList = safetyenvironmentalService.pleadList(page); //列出SafetyEnvironmental列表 + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } - /**列表 - * 规则: 如果当前人是,被检查人,检查人,参与人则可以查询到此条数据 - * @param page - * @throws Exception - */ - @RequestMapping(value="/checkList") - @ResponseBody - public Object checkList(Page page) throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = this.getPageData(); - String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 - if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); - pd.put("waffle",pd.getString("ARCHIVE_USER_ID")); - page.setPd(pd); - List varList = safetyenvironmentalService.checkList(page); //列出SafetyEnvironmental列表 - /* 针对验收部分特殊处理 */ - String user_id = pd.getString("ARCHIVE_USER_ID"); - for (PageData vector : varList) { - if (StringUtils.isNotBlank(vector.getString("INSPECTION_STATUS")) && - ("6".equals(vector.getString("INSPECTION_STATUS")) - || "5".equals(vector.getString("INSPECTION_STATUS")) - || "7".equals(vector.getString("INSPECTION_STATUS"))) - ) { - PageData condition = new PageData(); - condition.put("FOREIGN_ID",vector.getString("INSPECTION_ID")); - List waffle = hiddenService.findByKey(condition); //d - if (waffle == null || waffle.isEmpty()){ - continue; - } - Long number = waffle.stream() - .filter(n -> - user_id.equals(n.getString("CREATOR")) - && (StringUtils.isNotBlank(n.getString("STATE"))&&( - "4".equals(n.getString("STATE"))|| "8".equals(n.getString("STATE")))) + /** + * 列表 + * 规则: 如果当前人是,被检查人,检查人,参与人则可以查询到此条数据 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/checkList") + @ResponseBody + public Object checkList(Page page) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = this.getPageData(); + String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 + if (Tools.notEmpty(KEYWORDS)) pd.put("KEYWORDS", KEYWORDS.trim()); + pd.put("waffle", pd.getString("ARCHIVE_USER_ID")); + pd.put("loginUserId", Jurisdiction.getUSER_ID()); + page.setPd(pd); + List varList = safetyenvironmentalService.checkList(page); //列出SafetyEnvironmental列表 + /* 针对验收部分特殊处理 */ + String user_id = pd.getString("ARCHIVE_USER_ID"); + for (PageData vector : varList) { + if (StringUtils.isNotBlank(vector.getString("INSPECTION_STATUS")) && + ("6".equals(vector.getString("INSPECTION_STATUS")) + || "5".equals(vector.getString("INSPECTION_STATUS")) + || "7".equals(vector.getString("INSPECTION_STATUS"))) + ) { + PageData condition = new PageData(); + condition.put("FOREIGN_ID", vector.getString("INSPECTION_ID")); + List waffle = hiddenService.findByKey(condition); //d + if (waffle == null || waffle.isEmpty()) { + continue; + } + Long number = waffle.stream() + .filter(n -> + user_id.equals(n.getString("CREATOR")) + && (StringUtils.isNotBlank(n.getString("STATE")) && ( + "4".equals(n.getString("STATE")) || "8".equals(n.getString("STATE")))) - &&(StringUtils.isBlank(n.getString("FINAL_CHECK"))|| "2".equals(n.getString("FINAL_CHECK"))) - ) - .count(); - if (number >0){ - vector.put("checkout",1); - } - } - } - map.put("varList", varList); - map.put("page", page); - map.put("result", errInfo); - return map; - } + && (StringUtils.isBlank(n.getString("FINAL_CHECK")) || "2".equals(n.getString("FINAL_CHECK"))) + ) + .count(); + if (number > 0) { + vector.put("checkout", 1); + } + } + } + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } - @RequestMapping(value="/showFlowChart") - @ResponseBody - public Object showFlowChart() throws Exception{ - HashMap response = new HashMap<>(); - response.put("result","success"); - PageData condition = this.getPageData(); - condition.put("INSPECTION_ID",condition.getString("ID")); - PageData safety = safetyenvironmentalService.findById(condition); - if (safety == null || safety.size() <= 0) { - response.put("result", "error"); - response.put("errorMessage", "数据异常"); - } - // 1、整理基础数据 - Overseer overseer = new Overseer(); - List nodes = overseer.getSafetyAppWorkFlow(); - // 初始话安全环保发起人、被检查人数据 - nodes.get(0).safety_order(safety); - nodes.stream().forEach(n -> n.safety_creator_util(safety)); - for (NodeApp nodeApp : nodes) { - if (StringUtils.isNotBlank(nodeApp.getActive())) - overseer.setSafetyAppVector(nodeApp.getOrder()); - } - // 2、整理特殊数据 - // 2、1检查人将检查状态 - if ("2,3,4".contains(safety.getString("order"))) { - List inspectors = inspectorService.listAll(condition); - nodes.stream() - .filter(n -> "1".equals(n.getOrder())) - .forEach(n -> n.safety_inspector_util(inspectors)); - } + @RequestMapping(value = "/showFlowChart") + @ResponseBody + public Object showFlowChart() throws Exception { + HashMap response = new HashMap<>(); + response.put("result", "success"); + PageData condition = this.getPageData(); + condition.put("INSPECTION_ID", condition.getString("ID")); + PageData safety = safetyenvironmentalService.findById(condition); + if (safety == null || safety.size() <= 0) { + response.put("result", "error"); + response.put("errorMessage", "数据异常"); + } + // 1、整理基础数据 + Overseer overseer = new Overseer(); + List nodes = overseer.getSafetyAppWorkFlow(); + // 初始话安全环保发起人、被检查人数据 + nodes.get(0).safety_order(safety); + nodes.stream().forEach(n -> n.safety_creator_util(safety)); + for (NodeApp nodeApp : nodes) { + if (StringUtils.isNotBlank(nodeApp.getActive())) + overseer.setSafetyAppVector(nodeApp.getOrder()); + } + // 2、整理特殊数据 + // 2、1检查人将检查状态 + if ("2,3,4".contains(safety.getString("order"))) { + List inspectors = inspectorService.listAll(condition); + nodes.stream() + .filter(n -> "1".equals(n.getOrder())) + .forEach(n -> n.safety_inspector_util(inspectors)); + } - //隐患指派流程 - if ("3,4".contains(safety.getString("order"))) { - List hiddenz = safetyenvironmentalService.findByyin(condition); - if (hiddenz != null && hiddenz.size() > 0) { - nodes.stream() - .filter(n -> "3".equals(n.getOrder())) - .forEach(n -> n.safety_hiddenz(hiddenz)); - } - } - if ("4".equals(safety.getString("order"))) { - // 2、2 隐患发现人状态 - condition.put("FOREIGN_ID", condition.getString("INSPECTION_ID")); - List hiddens = hiddenService.findByKey(condition); - nodes.stream() - .filter(n -> "4".equals(n.getOrder())) - .forEach(n -> n.safety_hiddenCreator_util(hiddens)); - } - // 2、3 考评人 + //隐患指派流程 + if ("3,4".contains(safety.getString("order"))) { + List hiddenz = safetyenvironmentalService.findByyin(condition); + if (hiddenz != null && hiddenz.size() > 0) { + nodes.stream() + .filter(n -> "3".equals(n.getOrder())) + .forEach(n -> n.safety_hiddenz(hiddenz)); + } + } + if ("4".equals(safety.getString("order"))) { + // 2、2 隐患发现人状态 + condition.put("FOREIGN_ID", condition.getString("INSPECTION_ID")); + List hiddens = hiddenService.findByKey(condition); + nodes.stream() + .filter(n -> "4".equals(n.getOrder())) + .forEach(n -> n.safety_hiddenCreator_util(hiddens)); + } + // 2、3 考评人 // List assess = assessService.findByMainId(condition); // if (assess != null && assess.size() > 0) { // nodes.stream() // .filter(n -> "5".equals(n.getOrder())) // .forEach(n -> n.safety_assessor_util(assess)); // } - response.put("varList", nodes); - response.put("active" ,overseer.getSafetyAppVector()); - return response; - } + response.put("varList", nodes); + response.put("active", overseer.getSafetyAppVector()); + return response; + } } diff --git a/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java b/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java index a8b43a61..7aa6e3f4 100644 --- a/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java +++ b/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java @@ -737,31 +737,35 @@ public class SafetyEnvironmentalController extends BaseController { pd.put("loginUserId", Jurisdiction.getUSER_ID()); List varList = safetyenvironmentalService.checkList(page); //列出SafetyEnvironmental列表 /* 针对验收部分特殊处理 */ - for (PageData vector : varList) { - if (StringUtils.isNotBlank(vector.getString("INSPECTION_STATUS")) && - ("6".equals(vector.getString("INSPECTION_STATUS")) - || "5".equals(vector.getString("INSPECTION_STATUS")) -// || "7".equals(vector.getString("INSPECTION_STATUS")) - ) - ) { - PageData condition = new PageData(); - condition.put("FOREIGN_ID", vector.getString("INSPECTION_ID")); - List waffle = hiddenService.findByKey(condition); - if (waffle == null || waffle.isEmpty()) { - continue; - } - Long number = waffle.stream() - .filter(n -> - Jurisdiction.getUSER_ID().equals(n.getString("CREATOR")) && - (StringUtils.isNotBlank(n.getString("STATE")) && ("4".equals(n.getString("STATE")) || "8".equals(n.getString("STATE")))) && - (StringUtils.isBlank(n.getString("FINAL_CHECK")) || "2".equals(n.getString("FINAL_CHECK"))) - ) - .count(); - if (number > 0) { - vector.put("checkout", 1); - } - } - } +// for (PageData vector : varList) { +// if (StringUtils.isNotBlank(vector.getString("INSPECTION_STATUS")) && +// ("6".equals(vector.getString("INSPECTION_STATUS")) +// || "5".equals(vector.getString("INSPECTION_STATUS")) +//// || "7".equals(vector.getString("INSPECTION_STATUS")) +// ) +// ) { +// PageData condition = new PageData(); +// condition.put("FOREIGN_ID", vector.getString("INSPECTION_ID")); +// List waffle = hiddenService.findByKey(condition); +// if (waffle == null || waffle.isEmpty()) { +// continue; +// } +// Long number = waffle.stream() +// .filter(n -> Jurisdiction.getUSER_ID().equals(n.getString("CREATOR")) && +// (StringUtils.isNotBlank(n.getString("STATE")) && +// ("4".equals(n.getString("STATE")) || +// "8".equals(n.getString("STATE")))) && +// (StringUtils.isBlank(n.getString("FINAL_CHECK")) || +// "2".equals(n.getString("FINAL_CHECK"))) +// ) +// .count(); +// if (number > 0) { +// vector.put("checkout", 1); +// } else { +// vector.put("checkout", 0); +// } +// } +// } map.put("varList", varList); map.put("page", page); map.put("result", errInfo); diff --git a/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalInspectorController.java b/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalInspectorController.java index 7c2072e9..42cce1a9 100644 --- a/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalInspectorController.java +++ b/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalInspectorController.java @@ -30,262 +30,269 @@ import java.util.stream.Collectors; @RequestMapping("/safetyenvironmentalinspector") public class SafetyEnvironmentalInspectorController extends BaseController { - @Autowired - private SafetyEnvironmentalInspectorService safetyenvironmentalinspectorService; + @Autowired + private SafetyEnvironmentalInspectorService safetyenvironmentalinspectorService; - @Autowired - private DepartmentService departmentService; + @Autowired + private DepartmentService departmentService; - /**列表 - * @param page - * @throws Exception - */ - @RequestMapping(value="/list") - @RequiresPermissions("safetyenvironmentalinspector: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("INSPECTION_USER_ID", Jurisdiction.getUSER_ID()); //检查人ID - Session session = Jurisdiction.getSession(); - User loginUser = (User)session.getAttribute(Const.SESSION_USER); - if(null != loginUser){ - pd.put("supDeparIds",loginUser.getSuperviseDepartId()); - pd.put("roleLevel",loginUser.getRoleLevel()); - pd.put("loginUserId",loginUser.getUSER_ID()); - } + /** + * 列表 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/list") + @RequiresPermissions("safetyenvironmentalinspector: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("INSPECTION_USER_ID", Jurisdiction.getUSER_ID()); //检查人ID + Session session = Jurisdiction.getSession(); + User loginUser = (User) session.getAttribute(Const.SESSION_USER); + if (null != loginUser) { + pd.put("supDeparIds", loginUser.getSuperviseDepartId()); + pd.put("roleLevel", loginUser.getRoleLevel()); + pd.put("loginUserId", loginUser.getUSER_ID()); + } + pd.put("loginUserId", Jurisdiction.getUSER_ID()); + page.setPd(pd); + List varList = safetyenvironmentalinspectorService.list(page); //列出SafetyEnvironmentalInspector列表 + for (PageData vector : varList) { + PageData condition = new PageData(); + condition.put("DEPARTMENT_ID", vector.getString("INSPECTED_DEPARTMENT_ID")); + List parent_list = departmentService.getGenealogy(condition); + if (parent_list == null || parent_list.size() < 1) { + String corp_infos = ""; + vector.put("INSPECTED_DEPARTMENT_NAMES", corp_infos); + } else { + String corp_infos = parent_list.stream().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; + } - page.setPd(pd); - List varList = safetyenvironmentalinspectorService.list(page); //列出SafetyEnvironmentalInspector列表 - for (PageData vector: varList) { - PageData condition = new PageData(); - condition.put("DEPARTMENT_ID",vector.getString("INSPECTED_DEPARTMENT_ID")); - List parent_list = departmentService.getGenealogy(condition); - if (parent_list == null || parent_list.size() < 1) { - String corp_infos = ""; - vector.put("INSPECTED_DEPARTMENT_NAMES", corp_infos); - } else { - String corp_infos = parent_list.stream().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 = "/verify") + @RequiresPermissions("safetyenvironmentalinspector:add") + @ResponseBody + public Object verify() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + PageData uBean = safetyenvironmentalinspectorService.findById(pd); + uBean.put("INSPECTION_USER_OPINION", pd.getString("INSPECTION_USER_OPINION")); + uBean.put("INSPECTION_USER_SIGN_TIME", DateUtil.date2Str(new Date())); + uBean.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人 + uBean.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + uBean.put("INSPECTION_STATUS", pd.getString("INSPECTION_STATUS")); //检查进度状态 + uBean.put("ACTION_USER", Jurisdiction.getName()); //检查进度状态 - /**检查人核实 - * @param - * @throws Exception - */ - @RequestMapping(value="/verify") - @RequiresPermissions("safetyenvironmentalinspector:add") - @ResponseBody - public Object verify() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - PageData uBean= safetyenvironmentalinspectorService.findById(pd); - uBean.put("INSPECTION_USER_OPINION", pd.getString("INSPECTION_USER_OPINION")); - uBean.put("INSPECTION_USER_SIGN_TIME", DateUtil.date2Str(new Date())); - uBean.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人 - uBean.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - uBean.put("INSPECTION_STATUS", pd.getString("INSPECTION_STATUS")); //检查进度状态 - uBean.put("ACTION_USER", Jurisdiction.getName()); //检查进度状态 + if (StringUtils.isNotBlank(pd.getString("INSPECTION_USER_SIGN_IMG"))) { + MultipartFile file = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("INSPECTION_USER_SIGN_IMG")); + 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 + pd.getString("CORPINFO_ID") + "/" + ffile); - if (StringUtils.isNotBlank(pd.getString("INSPECTION_USER_SIGN_IMG"))) { - MultipartFile file = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("INSPECTION_USER_SIGN_IMG")); - 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 + pd.getString("CORPINFO_ID") + "/" + ffile); - - uBean.put("INSPECTION_USER_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); - } - safetyenvironmentalinspectorService.verify(uBean); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + uBean.put("INSPECTION_USER_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); + } + safetyenvironmentalinspectorService.verify(uBean); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } + /** + * 新增 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/add") + @RequiresPermissions("safetyenvironmentalinspector:add") + @ResponseBody + public Object add() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("INSPECTION_INSPECTOR_ID", this.get32UUID()); //主键 + pd.put("ISDELETE", ""); //是否删除(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 + safetyenvironmentalinspectorService.save(pd); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } + /** + * 删除 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/delete") + @RequiresPermissions("safetyenvironmentalinspector: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.getUSER_ID()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + safetyenvironmentalinspectorService.delete(pd); + map.put("result", errInfo); //返回结果 + return map; + } + /** + * 修改 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/edit") + @RequiresPermissions("safetyenvironmentalinspector: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.getUSER_ID()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + safetyenvironmentalinspectorService.edit(pd); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } + /** + * 去修改页面获取数据 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/goEdit") + @RequiresPermissions("safetyenvironmentalinspector:edit") + @ResponseBody + public Object goEdit() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd = safetyenvironmentalinspectorService.findById(pd); //根据ID读取 + map.put("pd", pd); + map.put("result", errInfo); + return map; + } + /** + * 批量删除 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/deleteAll") + @RequiresPermissions("safetyenvironmentalinspector: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.getUSER_ID()); //修改人 + 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 + safetyenvironmentalinspectorService.deleteAll(pd); + errInfo = "success"; + } else { + errInfo = "fail"; + } + map.put("result", errInfo); //返回结果 + return map; + } - - - - - /**新增 - * @param - * @throws Exception - */ - @RequestMapping(value="/add") - @RequiresPermissions("safetyenvironmentalinspector:add") - @ResponseBody - public Object add() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd.put("INSPECTION_INSPECTOR_ID", this.get32UUID()); //主键 - pd.put("ISDELETE", ""); //是否删除(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 - safetyenvironmentalinspectorService.save(pd); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } - - /**删除 - * @param - * @throws Exception - */ - @RequestMapping(value="/delete") - @RequiresPermissions("safetyenvironmentalinspector: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.getUSER_ID()); //修改人 - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - safetyenvironmentalinspectorService.delete(pd); - map.put("result", errInfo); //返回结果 - return map; - } - - /**修改 - * @param - * @throws Exception - */ - @RequestMapping(value="/edit") - @RequiresPermissions("safetyenvironmentalinspector: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.getUSER_ID()); //修改人 - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - safetyenvironmentalinspectorService.edit(pd); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } - - /**去修改页面获取数据 - * @param - * @throws Exception - */ - @RequestMapping(value="/goEdit") - @RequiresPermissions("safetyenvironmentalinspector:edit") - @ResponseBody - public Object goEdit() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd = safetyenvironmentalinspectorService.findById(pd); //根据ID读取 - map.put("pd", pd); - map.put("result", errInfo); - return map; - } - - /**批量删除 - * @param - * @throws Exception - */ - @RequestMapping(value="/deleteAll") - @RequiresPermissions("safetyenvironmentalinspector: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.getUSER_ID()); //修改人 - 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 - safetyenvironmentalinspectorService.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("检查人意见(有异议时必填)"); //3 - titles.add("检查人签字"); //4 - titles.add("检查人签字时间"); //5 - titles.add("是否删除(0:有效 1:删除)"); //6 - titles.add("添加人"); //7 - titles.add("添加时间"); //8 - titles.add("修改人"); //9 - titles.add("修改时间"); //10 - titles.add("企业ID"); //11 - dataMap.put("titles", titles); - pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID - List varOList = safetyenvironmentalinspectorService.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("检查人意见(有异议时必填)"); //3 + titles.add("检查人签字"); //4 + titles.add("检查人签字时间"); //5 + titles.add("是否删除(0:有效 1:删除)"); //6 + titles.add("添加人"); //7 + titles.add("添加时间"); //8 + titles.add("修改人"); //9 + titles.add("修改时间"); //10 + titles.add("企业ID"); //11 + dataMap.put("titles", titles); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID + List varOList = safetyenvironmentalinspectorService.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("INSPECTION_USER_ID")); //2 + vpd.put("var3", varOList.get(i).getString("INSPECTION_USER_OPINION")); //3 + vpd.put("var4", varOList.get(i).getString("INSPECTION_USER_SIGN_IMG")); //4 + vpd.put("var5", varOList.get(i).getString("INSPECTION_USER_SIGN_TIME")); //5 + vpd.put("var6", varOList.get(i).getString("ISDELETE")); //6 + vpd.put("var7", varOList.get(i).getString("CREATOR")); //7 + vpd.put("var8", varOList.get(i).getString("CREATTIME")); //8 + vpd.put("var9", varOList.get(i).getString("OPERATOR")); //9 + vpd.put("var10", varOList.get(i).getString("OPERATTIME")); //10 + vpd.put("var11", varOList.get(i).getString("CORPINFO_ID")); //11 + varList.add(vpd); + } + dataMap.put("varList", varList); + ObjectExcelView erv = new ObjectExcelView(); + mv = new ModelAndView(erv, dataMap); + return mv; + } } diff --git a/src/main/java/com/zcloud/service/messages/impl/AllMessagesImpl.java b/src/main/java/com/zcloud/service/messages/impl/AllMessagesImpl.java index 3ec8e98e..001493fb 100644 --- a/src/main/java/com/zcloud/service/messages/impl/AllMessagesImpl.java +++ b/src/main/java/com/zcloud/service/messages/impl/AllMessagesImpl.java @@ -4,6 +4,7 @@ import com.zcloud.entity.messages.PushRecords; import com.zcloud.service.messages.PushMessages; import lombok.AllArgsConstructor; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; /** * 发送站内信 @@ -16,6 +17,7 @@ public class AllMessagesImpl implements PushMessages { private final SmsMessagesImpl smsMessages; @Override + @Transactional(rollbackFor = Exception.class) public void push(PushRecords pushRecords, String userId) throws Exception { insideMessages.push(pushRecords, userId); smsMessages.push(pushRecords, userId); diff --git a/src/main/java/com/zcloud/service/messages/impl/InsideMessagesImpl.java b/src/main/java/com/zcloud/service/messages/impl/InsideMessagesImpl.java index cf3ae852..603e2db8 100644 --- a/src/main/java/com/zcloud/service/messages/impl/InsideMessagesImpl.java +++ b/src/main/java/com/zcloud/service/messages/impl/InsideMessagesImpl.java @@ -6,6 +6,7 @@ import com.zcloud.service.bus.NoticeCorpService; import com.zcloud.service.messages.PushMessages; import lombok.AllArgsConstructor; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; /** * 发送站内信 @@ -17,6 +18,7 @@ public class InsideMessagesImpl implements PushMessages { private final NoticeCorpService noticeCorpService; @Override + @Transactional(rollbackFor = Exception.class) public void push(PushRecords pushRecords, String userId) throws Exception { PageData mes = new PageData(); mes.put("BIANMA", "PUSH_RECORDS"); diff --git a/src/main/java/com/zcloud/service/messages/impl/MessagesServiceImpl.java b/src/main/java/com/zcloud/service/messages/impl/MessagesServiceImpl.java index 0395d214..51b1e0fa 100644 --- a/src/main/java/com/zcloud/service/messages/impl/MessagesServiceImpl.java +++ b/src/main/java/com/zcloud/service/messages/impl/MessagesServiceImpl.java @@ -10,7 +10,6 @@ import com.zcloud.util.UuidUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.Map; @@ -21,10 +20,8 @@ public class MessagesServiceImpl implements MessagesService { private final MessagesMapper mapper; private final Map messages; - - + @Override - @Transactional(rollbackFor = Exception.class) public void push(PushRecords pushRecords) throws Exception { // 先记录数据 pushRecords.setId(UuidUtil.get32UUID()); diff --git a/src/main/java/com/zcloud/util/AliSmsToolUtil.java b/src/main/java/com/zcloud/util/AliSmsToolUtil.java index 8847ead8..95ef2958 100644 --- a/src/main/java/com/zcloud/util/AliSmsToolUtil.java +++ b/src/main/java/com/zcloud/util/AliSmsToolUtil.java @@ -117,9 +117,33 @@ public class AliSmsToolUtil { //发短信 Map map = new HashMap(); map.put("infoDetail", "阿斯顿发"); - map.put("phone", "18630363710"); + map.put("phone", "18630387571"); map.put("infoType", "阿三地方"); + map.put("templateCode", "SMS_227260789"); List paramsList = new ArrayList(); + PageData params1 = new PageData(); + // 第1个参数 + params1.put("name", "number");// 存入短信模板中的参数名称 + params1.put("value", 2);// 存入上面参数名称所传递的值 + paramsList.add(params1); + + PageData params2 = new PageData(); + // 第2个参数 + params2.put("name", "params1");// 存入短信模板中的参数名称 + params2.put("value", "盲板作业");// 存入上面参数名称所传递的值 + paramsList.add(params2); + + PageData params3 = new PageData(); + // 第3个参数 + params3.put("name", "params2");// 存入短信模板中的参数名称 + params3.put("value", "生产部门意见");// 存入上面参数名称所传递的值 + paramsList.add(params3); + + PageData params4 = new PageData(); + // 第4个参数 + params4.put("name", "params3");// 存入短信模板中的参数名称 + params4.put("value", "审核");// 存入上面参数名称所传递的值 + paramsList.add(params4); SendSmsResponse response = sendSms(map,paramsList); System.out.println("短信接口返回的数据----------------"); System.out.println("Code=" + response.getCode()); diff --git a/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalInspectorMapper.xml b/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalInspectorMapper.xml index 0635afd4..f786f694 100644 --- a/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalInspectorMapper.xml +++ b/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalInspectorMapper.xml @@ -194,7 +194,11 @@ ) GROUP BY f.INSPECTION_ID - ORDER BY FIELD (se.INSPECTION_STATUS , '0','1','2','3','4','5','6','7','8','-1','-2') asc, se.INSPECTION_TIME_START DESC , se.INSPECTION_TIME_END DESC + ORDER BY + FIELD(if(f.INSPECTION_USER_SIGN_TIME is not null,'2','1'), '1','2'), + FIELD(if(se.INSPECTED_SITEUSER_ID = #{pd.loginUserId},#{pd.loginUserId},'1'), #{pd.loginUserId}, '1'), + FIELD (se.INSPECTION_STATUS , '0','1','2','3','4','5','6','7','8','-1','-2') , + se.INSPECTION_TIME_START DESC , se.INSPECTION_TIME_END DESC diff --git a/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalMapper.xml b/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalMapper.xml index d765acb9..ac29f748 100644 --- a/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalMapper.xml +++ b/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalMapper.xml @@ -649,82 +649,111 @@ + + + and ( + isd.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}), '%') + OR iod.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}), '%') + ) + + GROUP BY f.INSPECTION_ID + ORDER BY CASE + WHEN f.INSPECTION_STATUS IN ('3', '4') AND f.INSPECTED_SITEUSER_ID = #{pd.loginUserId} THEN 1 + WHEN f.INSPECTION_STATUS IN ('5', '6', '7') AND checkout = 1 THEN 2 + ELSE 3 + END, + field(f.INSPECTION_STATUS, '3', '6', '4', '7', '5', '0', '1', '2', '8', '-1', '-2'), + f.INSPECTION_TIME_END DESC +