diff --git a/src/main/java/com/zcloud/controller/bus/HotWorkApplicationController.java b/src/main/java/com/zcloud/controller/bus/HotWorkApplicationController.java index 7633e858..e8c88f59 100644 --- a/src/main/java/com/zcloud/controller/bus/HotWorkApplicationController.java +++ b/src/main/java/com/zcloud/controller/bus/HotWorkApplicationController.java @@ -1,6 +1,8 @@ package com.zcloud.controller.bus; import java.io.File; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.*; import java.util.List; @@ -68,6 +70,8 @@ public class HotWorkApplicationController extends BaseController { @Autowired private DictionariesService dictionariesService; + @Autowired + private NoticeCorpService noticeCorpService; /**新增 * @param @@ -76,17 +80,397 @@ public class HotWorkApplicationController extends BaseController { @RequestMapping(value="/add") @RequiresPermissions("hotwork:add") @ResponseBody + @DockAnnotation(isAdd = true) public Object add() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); + PageData dockData = new PageData(); // 主要对接数据 + + pd.put("loginUserId",Jurisdiction.getUSER_ID()); pd.put("HOTWORKAPPLICATION_ID", this.get32UUID()); //主键 + 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("ISDELETE","0"); + pd.put("STATE","1"); // 1 。申请成功 ,项目进入到动火单位负责人确认 + + if("0".equals(pd.getString("HOT_WORK_LEVEL_INDEX"))){ // 特技动火 0 . 1 2 3 + pd.put("STATE","30"); //如果是特级动火 + } + // 新增新的其他措施 + if (pd.get("OTHERMEASURE") != null && !pd.get("OTHERMEASURE").equals("")) { + String[] othermeasure = pd.get("OTHERMEASURE").toString().split(","); + Map safetymethodrecordPdMap = new HashMap(); + int safetymethodrecordPdCount = 1; + for (String content : othermeasure) { + if(Tools.notEmpty(content)) { + PageData safetymethodrecordPd = new PageData(); + safetymethodrecordPd.put("HOTWORKSAFETYMETHODRECORD_ID", this.get32UUID()); //主键 + safetymethodrecordPd.put("HOTWORKAPPLICATION_ID", pd.getString("HOTWORKAPPLICATION_ID")); //主表主键 + safetymethodrecordPd.put("CONTENT", content);//其它安全措施 + safetymethodrecordPd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 + safetymethodrecordPd.put("CREATE_USER_ID", Jurisdiction.getUSER_ID()); //添加用户ID + safetymethodrecordPd.put("CREATE_DEPARTMENT_ID", pd.getString("loginDeptId")); //添加用户部门ID + safetymethodrecordPd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人 + safetymethodrecordPd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 + safetymethodrecordPd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人 + safetymethodrecordPd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + safetymethodrecordPd.put("ISDELETE", "0"); //是否删除 1-是 0-否 + safetymethodrecordPdMap.put("other" + safetymethodrecordPdCount, JSON.toJSONString(safetymethodrecordPd)); + hotWorkSafetyMethodRecordService.save(safetymethodrecordPd); + } + } + dockData.put("safetymethodrecordPd", JSON.toJSONString(safetymethodrecordPdMap)); + } + + PageData confinedPageData = new PageData(); // pd对接数据 + confinedPageData.putAll(pd); + dockData.put("dockData", JSON.toJSONString(confinedPageData)); + Map hotuserMap = new HashMap<>(); + hotWorkApplicationUserService.saveUserByHot(pd.getString("HOTWORKAPPLICATION_ID"),pd,hotuserMap); + dockData.put("hotuserMap", JSON.toJSONString(hotuserMap)); hotworkapplicationService.save(pd); + this.sendNotice(pd); //发送通知公告 + map.put("dockData", JSON.toJSONString(dockData)); map.put("result", errInfo); return map; } + /** + * 发送通知公告 + * @param pageData + */ + public void sendNotice(PageData pageData) { + try{ + PageData hot = hotworkapplicationService.findById(pageData); + String hotState = hot.getString("STATE"); + PageData getHotUser = new PageData(); + getHotUser.put("FOREIGN_KEY",hot.getString("HOTWORKAPPLICATION_ID")); + getHotUser.put("STATE",hotState); + List hotUserList = hotWorkApplicationUserService.listAll(getHotUser); // 找到这一笔的审批人 + if(hotUserList.size()>0){ + if(hot.getString("STATE").equals("1")){ //待确认通知 + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业待确认"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "动火单位负责人确认"); + content.put("params3", "确认");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + if(hot.getString("IS_GAS_TESTING").equals("1")){ //气体分析发站内信 + getHotUser.put("STATE","24"); + hotUserList = hotWorkApplicationUserService.listAll(getHotUser); // 找到这一笔的审批人 + if(hotUserList.size()>0){ + hotUser = hotUserList.get(0); + userID = hotUser.getString("USER_ID"); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业待进行气体分析"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "气体分析"); + content.put("params3", "进行气体分析");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } + } + } else if(hot.getString("STATE").equals("3")){ //待签发通知 + if(hot.getString("JOB_TYPE_INDEX").equals("1")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业待签发"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "项目发包单位签发"); + content.put("params3", "签发");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else { + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业待审核"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "现场管辖单位负责人审核"); + content.put("params3", "审核");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } + } else if(hot.getString("STATE").equals("4")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业待签发"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "动火许可签发单位"); + content.put("params3", "签发");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("5")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业待审批"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "安全总监审批"); + content.put("params3", "审批");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("6")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业待接收"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "现场负责人接收"); + content.put("params3", "接收");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("7")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业待确认"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "动火前现场管辖单位确认"); + content.put("params3", "确认");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("8")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业待确认"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "现场负责人确认"); + content.put("params3", "确认");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("9")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业待确认"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "动火后现场管辖单位确认"); + content.put("params3", "确认");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("10")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业待您进行监火"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "延时监火"); + content.put("params3", "处理");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("30")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条特级动火作业待您确认"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "动火确认人确认"); + content.put("params3", "确认");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("31")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条特级动火作业待您初审"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "项目主管人员初审"); + content.put("params3", "初审");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("32")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条特级动火作业待您审核"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "项目主管部门负责人审核"); + content.put("params3", "审核");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("33")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条特级动火作业待您审批"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "分公司安全总监审批"); + content.put("params3", "审批");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("34")){ + PageData hotUser = hotUserList.get(0); + String userID = hotUser.getString("USER_ID"); + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条特级动火作业待您签批"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", userID); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "分公司主要负责人签批"); + content.put("params3", "签批");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } + } + + if(hot.getString("STATE").equals("-1")){ //普通打回发站内信 + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业打回待处理"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", hot.getString("CREATOR")); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "动火申请管理"); + content.put("params3", "处理");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } else if(hot.getString("STATE").equals("-2")){ + PageData mes = new PageData(); + mes.put("BIANMA","PROCESS_WORK_001"); + mes.put("SENDER_ID", "系统管理员"); // 发送人员ID + mes.put("SENDER_NAME", "1"); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条动火作业打回待处理"); // 站内信标题 + mes.put("CORPINFO_ID", hot.get("CORPINFO_ID"));// 企业id + mes.put("RECEIVER_ID", hot.getString("CREATOR")); // 接收人员ID + PageData content = new PageData(); + content.put("number", hot.getString("JOB_NUMBER"));// 作业编号 + content.put("params1", "动火申请作业"); // 作业名称 + content.put("params2", "动火申请管理"); + content.put("params3", "处理");// 作业操作 + mes.put("CONTENT", content);// 站内信内容 + noticeCorpService.sendNotice(mes); + } + }catch (Exception e){ +// FHLOG.save("动火审批", "发送站内信失败!"); + + } + + + } + /**删除 * @param out * @throws Exception @@ -719,6 +1103,493 @@ public class HotWorkApplicationController extends BaseController { return map; } + /** 审批 + * @throws Exception + */ + @RequestMapping(value="/editOpinion") + @ResponseBody + @Transactional + @DockAnnotation(hasAnnex = true) + public Object editOpinion() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + PageData dockData = new PageData(); // 主要对接数据 + PageData confinedPageData = new PageData(); // pd对接数据 + confinedPageData.putAll(pd); + dockData.put("dockData", JSON.toJSONString(confinedPageData)); + String type = pd.getString("TYPE"); //1 通过 2.未通过 + PageData hotUserPd = new PageData(); + hotUserPd.put("FOREIGN_KEY",pd.getString("HOTWORKAPPLICATION_ID")); // 动火标识 + hotUserPd.put("STATE",pd.get("STATE").toString()); // 哪一步 + hotUserPd.put("USER_ID",pd.getString("loginUserId"));// 登录人 + if ("10".equals(pd.get("STATE").toString())) { + PageData hotWorkApplication = hotworkapplicationService.findById(pd); + if(!Tools.isEmpty(hotWorkApplication) && hotWorkApplication.getString("STATE").equals("11")){ // 判断此作业是否已归档 + map.put("result", "error"); + map.put("msg", "此作业已归档,请勿重复操作!"); + return map; + } + } + + List hotUserList = new ArrayList<>(); + if (!pd.getString("STATE").equals("10")) { + hotUserList = hotWorkApplicationUserService.listAll(hotUserPd); // 找到这一笔的审批人 + if (hotUserList.size() != 1) { + map.put("result", "error"); + map.put("msg", "获取审批人意见失败!请联系管理员"); + return map; + } + } else { + //先判断延时监火是否为选择部门 + hotUserList = hotWorkApplicationUserService.listByDepartment(hotUserPd); // 找到这一笔的审批人们(选择部门) + if (hotUserList.size() < 1) { + //如果查询部门查不到就根据人查询 + hotUserList = hotWorkApplicationUserService.listAll(hotUserPd); // 找到这一笔的审批人(选择人) + if (hotUserList.size() != 1) { + map.put("result", "error"); + map.put("msg", "获取审批人意见失败!请联系管理员"); + return map; + } + } + } + + + PageData hotUser = hotUserList.get(0); + PageData hot = hotworkapplicationService.findById(pd); + hot.put("loginUserId",pd.getString("loginUserId")); + String judgeState = this.judgeHotTime(hot);//判断是否超时 + if(!"true".equals(judgeState)){ + map.put("result", "error"); + map.put("msg", "动火超期!请重新申请动火许可!"); + return map; + } + if("1".equals(type)){ + hotUser.put("OPINION",pd.getString("OPINION")); + hotUser.put("TYPE","1"); + String state = "-1"; + // 特级动火打回 + if(hot.get("STATE") != null && Tools.notEmpty(hot.get("STATE").toString())){ + Integer hotSta = Integer.parseInt(hot.get("STATE").toString()); + if(hotSta >= 30 && hotSta <= 37){ + state = "-2";// 其他审核。返回 -2 + } + } + // 删除原有其他隐患措施 + PageData delPd = new PageData(); + delPd.put("HOTWORKAPPLICATION_ID", pd.get("HOTWORKAPPLICATION_ID")); + delPd.put("OPERATOR", pd.get("loginUserName")); + delPd.put("OPERATTIME", DateUtil.date2Str(new Date())); + + PageData confinedPageDatadelPd = new PageData(); // pd对接数据 + confinedPageDatadelPd.putAll(delPd); + dockData.put("dockDatadelPd", JSON.toJSONString(confinedPageDatadelPd)); + + hotWorkSafetyMethodRecordService.deleteByCheck(delPd); + PageData stateData = new PageData(); + stateData.put("HOTWORKAPPLICATION_ID", hot.getString("HOTWORKAPPLICATION_ID")); + stateData.put("loginUserId", pd.get("loginUserId")); + stateData.put("STATE", state); + stateData.put("WORK_LONGITUDE", pd.get("WORK_LONGITUDE")); + stateData.put("WORK_LATITUDE", pd.get("WORK_LATITUDE")); + + PageData confinedstateData = new PageData(); // pd对接数据 + confinedstateData.putAll(stateData); + dockData.put("dockDatastateData", JSON.toJSONString(confinedstateData)); + hotworkapplicationService.editByState(stateData); // 把动火状态修改成未通过 + + }else if ("2".equals(type)){ + if(!Tools.isEmpty(pd.get("USER_SIGN_IMG"))){ + ArrayList pictureList = new ArrayList<>(); + MultipartFile file = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("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.FILEPATHYHTP + pd.get("CORPINFO_ID").toString() + "/" + ffile); + + pictureList.add(Const.FILEPATHYHTP + pd.get("CORPINFO_ID").toString() + "/" + ffile + "/" + fileName + "@@" + fileName); + map.put("sendPicturesList", JSON.toJSONString(pictureList)); + hotUser.put("AUTOGRAPH",Const.FILEPATHYHTP + pd.get("CORPINFO_ID").toString() + "/" + ffile + "/" + fileName); + } + hotUser.put("TYPE","2"); + // 审批进入下一阶段 1.特技动火。2发包单位 + if ("0".equals(hot.getString("JOB_TYPE_INDEX")) && "1".equals(hot.get("STATE").toString())){ + hot.put("STATE","2"); // 如何是内容作业,跳过项目单发作业 + } + if ("0".equals(hot.getString("IS_SAFETY_DIRECTOR")) && "4".equals(hot.get("STATE").toString())){ + hot.put("STATE","5"); + } + + PageData stateData = new PageData(); + stateData.put("HOTWORKAPPLICATION_ID", hot.getString("HOTWORKAPPLICATION_ID")); + stateData.put("loginUserId", pd.get("loginUserId")); + stateData.put("STATE", hot.get("STATE").toString()); + + PageData confinedstateData = new PageData(); // pd对接数据 + confinedstateData.putAll(stateData); + dockData.put("dockDatastateData", JSON.toJSONString(confinedstateData)); + + hotworkapplicationService.editByState(stateData); + PageData Position = new PageData(); + Position.put("WORK_LONGITUDE", pd.get("WORK_LONGITUDE")); + Position.put("WORK_LATITUDE", pd.get("WORK_LATITUDE")); + Position.put("HOTWORKAPPLICATION_ID", hot.getString("HOTWORKAPPLICATION_ID")); + + PageData confinedPosition = new PageData(); // pd对接数据 + confinedPosition.putAll(Position); + dockData.put("dockDataPosition", JSON.toJSONString(confinedPosition)); + hotworkapplicationService.editPosition(Position); //添加定位 +// hotworkapplicationService.editByState(hot.getString("HOTWORKAPPLICATION_ID"),hot.get("STATE").toString()); + // 单位负责人确认时。保存主要安全措施 + if("1".equals(pd.get("STATE").toString()) && pd.get("measureList") != null && Tools.notEmpty(pd.get("measureList").toString())){ + List list = (List) JSON.parse(pd.get("measureList").toString()); + Map measuresMap = new HashMap<>(); + int measuresCount = 1; + for (JSONObject json : list) { + // 因必须选择符合,所以只存需要填的项 + if(json.get("ANSWER1") != null || json.get("ANSWER2") != null || json.get("ANSWER3") != null || json.get("ANSWER4") != null){ + PageData measures = new PageData(); + measures.put("HOTWORKTOMEASURES_ID", this.get32UUID()); // 主键 + measures.put("HOTWORKAPPLICATION_ID", pd.getString("HOTWORKAPPLICATION_ID")); + measures.put("BUS_HOTWORK_MEASURES_ID", json.get("BUS_HOTWORK_MEASURES_ID")); + measures.put("ANSWER1", json.get("ANSWER1")); + measures.put("ANSWER2", json.get("ANSWER2")); + measures.put("ANSWER3", json.get("ANSWER3")); + measures.put("ANSWER4", json.get("ANSWER4")); + measures.put("STATUS", json.get("radio")); + measuresMap.put("other" + measuresCount, JSON.toJSONString(measures)); + measuresCount++; + hotworkToMeasuresService.save(measures); + } + + } + dockData.put("dockDatameasuresMap", JSON.toJSONString(measuresMap)); + } + // 新增新的其他措施 + if (pd.get("OTHERMEASURE") != null && !pd.get("OTHERMEASURE").equals("")) { + String[] othermeasure = pd.get("OTHERMEASURE").toString().split(","); + Map safemethodrecordPdMap = new HashMap<>(); + int count = 1; + for (String content : othermeasure) { + if(Tools.notEmpty(content)) { + PageData safetymethodrecordPd = new PageData(); + safetymethodrecordPd.put("HOTWORKSAFETYMETHODRECORD_ID", this.get32UUID()); //主键 + safetymethodrecordPd.put("HOTWORKAPPLICATION_ID", pd.getString("HOTWORKAPPLICATION_ID")); //主表主键 + safetymethodrecordPd.put("CONTENT", content);//其它安全措施 + safetymethodrecordPd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); //企业 + safetymethodrecordPd.put("CREATE_USER_ID", pd.getString("loginUserId")); //添加用户ID + safetymethodrecordPd.put("CREATE_DEPARTMENT_ID", pd.getString("loginDeptId")); //添加用户部门ID + safetymethodrecordPd.put("CREATOR", pd.getString("loginUserName")); //添加人 + safetymethodrecordPd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 + safetymethodrecordPd.put("OPERATOR", pd.getString("loginUserName")); //修改人 + safetymethodrecordPd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + safetymethodrecordPd.put("ISDELETE", "0"); //是否删除 1-是 0-否 + safemethodrecordPdMap.put("other" + count, JSON.toJSONString(safetymethodrecordPd)); + count++; + hotWorkSafetyMethodRecordService.save(safetymethodrecordPd); + } + } + dockData.put("dockDatasafemethodrecordPdMap", JSON.toJSONString(safemethodrecordPdMap)); + } + if("6".equals(pd.getString("STATE"))){ // 添加动火前 + PageData leaderUser = new PageData(); + leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); + leaderUser.put("USER_ID",pd.get("HOT_WORK_BEFORE_UNIT_LEADER_ID")); + leaderUser.put("STATE","7"); + leaderUser.put("TYPE","-1"); + leaderUser.put("ISDELETE","0"); + leaderUser.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + leaderUser.put("CREATOR",pd.getString("loginUserId")); + leaderUser.put("CREATTIME",DateUtil.date2Str(new Date())); + leaderUser.put("OPERATOR",pd.getString("loginUserId")); + leaderUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedleaderUser = new PageData(); // pd对接数据 + confinedleaderUser.putAll(leaderUser); + dockData.put("dockDataleaderUser", JSON.toJSONString(confinedleaderUser)); + + hotWorkApplicationUserService.save(leaderUser); // + }else if("8".equals(pd.getString("STATE"))){ // 添加动火后现场负责人 + PageData leaderUser = new PageData(); + leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); + leaderUser.put("USER_ID",pd.get("HOT_WORK_AFTER_UNIT_LEADER_ID")); + leaderUser.put("STATE","9"); + leaderUser.put("TYPE","-1"); + leaderUser.put("ISDELETE","0"); + leaderUser.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + leaderUser.put("CREATOR",pd.getString("loginUserId")); + leaderUser.put("CREATTIME",DateUtil.date2Str(new Date())); + leaderUser.put("OPERATOR",pd.getString("loginUserId")); + leaderUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedleaderUser = new PageData(); // pd对接数据 + confinedleaderUser.putAll(leaderUser); + dockData.put("dockDataleaderUser", JSON.toJSONString(confinedleaderUser)); + + hotWorkApplicationUserService.save(leaderUser); // 添加 动火后负责人 + }else if("9".equals(pd.getString("STATE"))){ // 添加 临时监火 + PageData leaderUser = new PageData(); + leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); +// leaderUser.put("USER_ID",pd.get("TIME_LAPSE_FIREMAN_ID")); + leaderUser.put("USER_ID",pd.get("TIME_LAPSE_FIREMAN_DEPARTMENT_ID")); + leaderUser.put("STATE","10"); + leaderUser.put("TYPE","-1"); + leaderUser.put("ISDELETE","0"); + leaderUser.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + leaderUser.put("CREATOR",pd.getString("loginUserId")); + leaderUser.put("CREATTIME",DateUtil.date2Str(new Date())); + leaderUser.put("OPERATOR",pd.getString("loginUserId")); + leaderUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedleaderUser = new PageData(); // pd对接数据 + confinedleaderUser.putAll(leaderUser); + dockData.put("dockDataleaderUser", JSON.toJSONString(confinedleaderUser)); + + hotWorkApplicationUserService.save(leaderUser); // 添加 动火后负责人 + } else if("10".equals(pd.getString("STATE"))){ // 延时监火完成后,进行归档 + PageData leaderUser = new PageData(); + leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); + leaderUser.put("USER_ID",pd.get("loginUserId")); + leaderUser.put("STATE","11"); + leaderUser.put("TYPE","2"); + leaderUser.put("ISDELETE","0"); + leaderUser.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + leaderUser.put("CREATOR",pd.getString("loginUserId")); + leaderUser.put("CREATTIME",DateUtil.date2Str(new Date())); + leaderUser.put("OPERATOR",pd.getString("loginUserId")); + leaderUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedleaderUser = new PageData(); // pd对接数据 + confinedleaderUser.putAll(leaderUser); + dockData.put("dockDataleaderUser", JSON.toJSONString(confinedleaderUser)); + + hotWorkApplicationUserService.save(leaderUser); // 添加 动火后负责人 + } else if("30".equals(pd.getString("STATE"))){ // 特级动火 -- 选择项目主管人员 + PageData leaderUser = new PageData(); + leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); + leaderUser.put("USER_ID",pd.get("projectSupervisor_USER_ID")); + leaderUser.put("STATE","31"); + leaderUser.put("TYPE","-1"); + leaderUser.put("ISDELETE","0"); + leaderUser.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + leaderUser.put("CREATOR",pd.getString("loginUserId")); + leaderUser.put("CREATTIME",DateUtil.date2Str(new Date())); + leaderUser.put("OPERATOR",pd.getString("loginUserId")); + leaderUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedleaderUser = new PageData(); // pd对接数据 + confinedleaderUser.putAll(leaderUser); + dockData.put("dockDataleaderUser", JSON.toJSONString(confinedleaderUser)); + + hotWorkApplicationUserService.save(leaderUser); + }else if("31".equals(pd.getString("STATE"))){ // 特级动火 -- 项目主管部门负责人 + //防止打回后有多个意见 + PageData leaderUser = new PageData(); + leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); + leaderUser.put("USER_ID",pd.get("projectPreliminarily_USER_ID")); + leaderUser.put("STATE","32"); + leaderUser.put("TYPE","-1"); + leaderUser.put("ISDELETE","0"); + leaderUser.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + leaderUser.put("CREATOR",pd.getString("loginUserId")); + leaderUser.put("CREATTIME",DateUtil.date2Str(new Date())); + leaderUser.put("OPERATOR",pd.getString("loginUserId")); + leaderUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedleaderUser = new PageData(); // pd对接数据 + confinedleaderUser.putAll(leaderUser); + dockData.put("dockDataleaderUser", JSON.toJSONString(confinedleaderUser)); + + hotWorkApplicationUserService.save(leaderUser); + }else if("32".equals(pd.getString("STATE"))){ // 特级动火 + PageData back = new PageData(); + back.put("STATE","33"); + back.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + + PageData confinedback = new PageData(); // pd对接数据 + confinedback.putAll(back); + dockData.put("dockDataback", JSON.toJSONString(confinedback)); + + hotWorkApplicationUserService.deleteForBack(back); + PageData leaderUser = new PageData(); + leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); + leaderUser.put("USER_ID",pd.get("inspectorGeneral_USER_ID")); + leaderUser.put("STATE","33"); + leaderUser.put("TYPE","-1"); + leaderUser.put("ISDELETE","0"); + leaderUser.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + leaderUser.put("CREATOR",pd.getString("loginUserId")); + leaderUser.put("CREATTIME",DateUtil.date2Str(new Date())); + leaderUser.put("OPERATOR",pd.getString("loginUserId")); + leaderUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedleaderUser = new PageData(); // pd对接数据 + confinedleaderUser.putAll(leaderUser); + dockData.put("dockDataleaderUser", JSON.toJSONString(confinedleaderUser)); + + hotWorkApplicationUserService.save(leaderUser); + }else if("33".equals(pd.getString("STATE"))){ // 特级动火 + PageData back = new PageData(); + back.put("STATE","34"); + back.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + + PageData confinedback = new PageData(); // pd对接数据 + confinedback.putAll(back); + dockData.put("dockDataback", JSON.toJSONString(confinedback)); + + hotWorkApplicationUserService.deleteForBack(back); + PageData leaderUser = new PageData(); + leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); + leaderUser.put("USER_ID",pd.get("officeResponsible_USER_ID")); + leaderUser.put("STATE","34"); + leaderUser.put("TYPE","-1"); + leaderUser.put("ISDELETE","0"); + leaderUser.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + leaderUser.put("CREATOR",pd.getString("loginUserId")); + leaderUser.put("CREATTIME",DateUtil.date2Str(new Date())); + leaderUser.put("OPERATOR",pd.getString("loginUserId")); + leaderUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedleaderUser = new PageData(); // pd对接数据 + confinedleaderUser.putAll(leaderUser); + dockData.put("dockDataleaderUser", JSON.toJSONString(confinedleaderUser)); + + hotWorkApplicationUserService.save(leaderUser); + }else if("34".equals(pd.getString("STATE"))){ // 特级动火 + PageData back = new PageData(); + back.put("STATE","35"); + back.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + + PageData confinedback = new PageData(); // pd对接数据 + confinedback.putAll(back); + dockData.put("dockDataback", JSON.toJSONString(confinedback)); + + hotWorkApplicationUserService.deleteForBack(back); + PageData leaderUser = new PageData(); + leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); + leaderUser.put("USER_ID",pd.get("supervision_USER_ID")); + leaderUser.put("STATE","35"); + leaderUser.put("TYPE","-1"); + leaderUser.put("ISDELETE","0"); + leaderUser.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + leaderUser.put("CREATOR",pd.getString("loginUserId")); + leaderUser.put("CREATTIME",DateUtil.date2Str(new Date())); + leaderUser.put("OPERATOR",pd.getString("loginUserId")); + leaderUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedleaderUser = new PageData(); // pd对接数据 + confinedleaderUser.putAll(leaderUser); + dockData.put("dockDataleaderUser", JSON.toJSONString(confinedleaderUser)); + + hotWorkApplicationUserService.save(leaderUser); + if(Tools.notEmpty(pd.getString("supervision_USER_ID"))){ + PageData mes = new PageData(); + mes.put("SENDER_ID", pd.getString("loginUserId")); // 发送人员ID + mes.put("SENDER_NAME", pd.getString("loginUserId")); // 发送人员姓名 + mes.put("SYNOPSIS", "友情提示:有一条特级动火数据需要初审"); // 站内信标题 + mes.put("RECEIVER_ID", pd.getString("supervision_USER_ID")); // 接收人员ID + mes.put("CONTENT", "有一条特级动火数据在“安全监督部初审”,等您审核");// 站内信内容 + + PageData confinedmes = new PageData(); // pd对接数据 + confinedmes.putAll(mes); + dockData.put("dockDatames", JSON.toJSONString(confinedmes)); + + noticeRegulatoryService.sendMessage(mes); + } + }else if("35".equals(pd.getString("STATE"))){ // 特级动火 + PageData leaderUser = new PageData(); + leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); + leaderUser.put("USER_ID",pd.get("committee_USER_ID")); + leaderUser.put("STATE","36"); + leaderUser.put("TYPE","-1"); + leaderUser.put("ISDELETE","0"); + leaderUser.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + leaderUser.put("CREATOR",pd.getString("loginUserId")); + leaderUser.put("CREATTIME",DateUtil.date2Str(new Date())); + leaderUser.put("OPERATOR",pd.getString("loginUserId")); + leaderUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedleaderUser = new PageData(); // pd对接数据 + confinedleaderUser.putAll(leaderUser); + dockData.put("dockDataleaderUser", JSON.toJSONString(confinedleaderUser)); + + hotWorkApplicationUserService.save(leaderUser); + }else if("36".equals(pd.getString("STATE"))){ // 特级动火 + PageData leaderUser = new PageData(); + leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); + leaderUser.put("USER_ID",pd.get("safetyDirector_USER_ID")); + leaderUser.put("STATE","37"); + leaderUser.put("TYPE","-1"); + leaderUser.put("ISDELETE","0"); + leaderUser.put("FOREIGN_KEY",pd.get("HOTWORKAPPLICATION_ID")); + leaderUser.put("CREATOR",pd.getString("loginUserId")); + leaderUser.put("CREATTIME",DateUtil.date2Str(new Date())); + leaderUser.put("OPERATOR",pd.getString("loginUserId")); + leaderUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedleaderUser = new PageData(); // pd对接数据 + confinedleaderUser.putAll(leaderUser); + dockData.put("dockDataleaderUser", JSON.toJSONString(confinedleaderUser)); + + hotWorkApplicationUserService.save(leaderUser); + } + }else{ + map.put("result", "error"); + map.put("msg", "未知审批状态!请联系管理员"); + return map; + } + /** + * + */ + hotUser.put("OPERATOR",pd.getString("loginUserId")); + hotUser.put("OPERATTIME",DateUtil.date2Str(new Date())); + + PageData confinedhotUser = new PageData(); // pd对接数据 + confinedhotUser.putAll(hotUser); + dockData.put("dockDatahotUser", JSON.toJSONString(confinedhotUser)); + + hotWorkApplicationUserService.edit(hotUser); + this.sendNotice(pd); + map.put("dockData", JSON.toJSONString(dockData)); + map.put("result", errInfo); + return map; + } + + // 判断动火是否超时 + public String judgeHotTime (PageData hot){ + try { + if(hot.getString("STATE").equals("10")|| + hot.getString("STATE").equals("11")){ + return "true"; + } + DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + if(!Tools.isEmpty(hot.getString("HOT_WORK_TIME_END"))){ + String hotWorkTimeEnd = hot.getString("HOT_WORK_TIME_END"); //动火结束时间 + long hotTimeEnd = fmt.parse(hotWorkTimeEnd).getTime(); + long nowTime = new Date().getTime(); + if(nowTime <= hotTimeEnd){ + return "true"; + } + } + hot.put("STATE","-6"); + hotworkapplicationService.editByState(hot); + messageService.sendMessageByParameter("HOT_MAIL_001", "友情提示:有一条动火申请过期", + hot.getString("CORPINFO_ID"),hot.getString("CREATOR"),hot.getString("HOTWORKAPPLICATION_ID"), + hot.getString("JOB_NUMBER"),fmt.format(new Date()),"","",""); + + }catch (Exception e){ + return ""; + } + return ""; + } + /** * 特级动火审批 * @param files203 @@ -1417,7 +2288,11 @@ public class HotWorkApplicationController extends BaseController { }else if("2".equals(type)){ // 项目发包单位负责人 hot.put("PROJECT_UNIT_LEADER_NAME",userPageData.getString("userName")); hot.put("PROJECT_UNIT_LEADER_ID",userPageData.getString("USER_ID")); -// }else if("4".equals(type)){ // 现场管辖单位负责人 + }else if("4".equals(type)){ // 动火许可签发单位 + hot.put("ISSUING_DEPARTMENT_ID",userPageData.getString("DEPARTMENT_ID")); + hot.put("ISSUING_DEPARTMENT_NAME",userPageData.getString("deptName")); + hot.put("ISSUING_USER_NAME",userPageData.getString("userName")); + hot.put("ISSUING_USER_ID",userPageData.getString("USER_ID")); }else if("3".equals(type)){ // 现场管辖单位负责人 hot.put("UNIT_LEADER_DEPARTMENT_ID",userPageData.getString("DEPARTMENT_ID")); hot.put("UNIT_LEADER_DEPARTMENT_NAME",userPageData.getString("deptName")); diff --git a/src/main/java/com/zcloud/controller/bus/RelevantUnitController.java b/src/main/java/com/zcloud/controller/bus/RelevantUnitController.java index e330832d..5e3dce40 100644 --- a/src/main/java/com/zcloud/controller/bus/RelevantUnitController.java +++ b/src/main/java/com/zcloud/controller/bus/RelevantUnitController.java @@ -322,4 +322,53 @@ public class RelevantUnitController extends BaseController { map.put("result", errInfo); return map; } + + /**列表 + * @throws Exception + */ + @RequestMapping(value="/listAllForHotWork") + @ResponseBody + @Transactional + public Object listAllForHotWork() 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()); + List unitAllList = relevantunitService.listNameAll(pd); //列出RelevantUnit列表 + PageData corp = new PageData(); + corp.put("RELEVANTUNIT_ID",Jurisdiction.getCORPINFO_ID()); + corp.put("id",Jurisdiction.getCORPINFO_ID()); + corp.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID()); + PageData corpName = corpinfoService.findById(corp); + corp.put("RELEVANT_NAME", corpName.getString("CORP_NAME")); + corp.put("label", corpName.getString("CORP_NAME")); + corp.put("nodeLevel", "0"); + unitAllList.add(corp); + String endday = DateUtil.getDay(); + PageData getPD = new PageData(); + getPD.put("endday",endday); + getPD.put("KEYWORDS",pd.getString("KEYWORDS")); + getPD.put("DEPT_IDS",pd.getString("DEPT_IDS")); + List userAllList = specialuserService.listAll(getPD); + if(!Tools.isEmpty(pd.get("CORPINFO_ID"))){ + PageData corpinfo = new PageData(); + corpinfo.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); + corpinfo =corpinfoService.findById(corpinfo); + PageData addPd = new PageData(); + if (!corpinfo.getString("CORP_NAME").equals("唐山曹妃甸煤炭港务有限公司")) { + addPd.put("RELEVANT_NAME",corpinfo.getString("CORP_NAME")); + addPd.put("label",corpinfo.getString("CORP_NAME")); + addPd.put("nodeLevel","0"); + addPd.put("RELEVANTUNIT_ID",corpinfo.getString("CORPINFO_ID")); + addPd.put("id",corpinfo.getString("CORPINFO_ID")); + unitAllList.add(addPd); + } + } + map.put("varList", userAllList); + map.put("deptList", unitAllList); + map.put("result", errInfo); + return map; + } } diff --git a/src/main/java/com/zcloud/controller/keyProjects/OutSourcedController.java b/src/main/java/com/zcloud/controller/keyProjects/OutSourcedController.java index 8df4419e..411bc71a 100644 --- a/src/main/java/com/zcloud/controller/keyProjects/OutSourcedController.java +++ b/src/main/java/com/zcloud/controller/keyProjects/OutSourcedController.java @@ -488,6 +488,7 @@ public class OutSourcedController extends BaseController { String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); + pd.put("UserId", Jurisdiction.getUSER_ID()); if (!StringUtils.equals(Jurisdiction.getUSER_ID(), "c5187fb9565649a89267f9adf6b0fab6")) { if (!StringUtils.equals(Jurisdiction.getCORPINFO_ID(), "1e6dbbe16004402f8d2c0e52afd9a676") && !StringUtils.equals(Jurisdiction.getCORPINFO_ID(), "3a854eefa7894e06aaa1a2611bca80f6") diff --git a/src/main/java/com/zcloud/controller/keyProjects/UnitsController.java b/src/main/java/com/zcloud/controller/keyProjects/UnitsController.java index f6c6f8ab..128299e8 100644 --- a/src/main/java/com/zcloud/controller/keyProjects/UnitsController.java +++ b/src/main/java/com/zcloud/controller/keyProjects/UnitsController.java @@ -58,7 +58,7 @@ public class UnitsController extends BaseController { pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd.put("ISDELETE", "0"); //是否删除 Map result = HttpClientService.doPost(tongBuUrl + "/api/units/findByName", pd); - if (result.get("pd")==null) { + if (Tools.isEmpty(result) || result.get("pd")==null) { 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)) { diff --git a/src/main/java/com/zcloud/controller/system/DepartmentController.java b/src/main/java/com/zcloud/controller/system/DepartmentController.java index ea759e27..20aebb25 100644 --- a/src/main/java/com/zcloud/controller/system/DepartmentController.java +++ b/src/main/java/com/zcloud/controller/system/DepartmentController.java @@ -450,6 +450,25 @@ public class DepartmentController extends BaseController { return map; } + /** + * 去修改页面 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/getById") + @ResponseBody + public Object getById() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd = departmentService.findById(pd); //根据ID读取 + map.put("pd", pd); //放入视图容器 + map.put("result", errInfo); + return map; + } + /** * 判断编码是否存在 * diff --git a/src/main/java/com/zcloud/controller/system/UsersController.java b/src/main/java/com/zcloud/controller/system/UsersController.java index 3d7831f2..0a21951e 100644 --- a/src/main/java/com/zcloud/controller/system/UsersController.java +++ b/src/main/java/com/zcloud/controller/system/UsersController.java @@ -1427,12 +1427,31 @@ public class UsersController extends BaseController { Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); + pd.put("DEPARTMENT_ID",pd.get("DEPARTMENT_ID[0]")); List userList = usersService.listAllUser(pd); //列出Post列表 map.put("userList", userList); map.put("result", errInfo); return map; } + /** + * 列表 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/listAllForHotWork") + @ResponseBody + public Object listAllForHotWork() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = this.getPageData(); + List userList = usersService.listAllForHotWork(pd); //列出Post列表 + map.put("userList", userList); + map.put("result", errInfo); + return map; + } + /** * 导出到excel * diff --git a/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java b/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java index 93ccf8dd..20e29f68 100644 --- a/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java @@ -89,6 +89,8 @@ public interface UsersMapper { */ List listAllUser(PageData pd); + List listAllForHotWork(PageData pd); + /** 获取获取部门账号 * @param pd * @return diff --git a/src/main/java/com/zcloud/service/system/UsersService.java b/src/main/java/com/zcloud/service/system/UsersService.java index a0c3da79..dbcd1db0 100644 --- a/src/main/java/com/zcloud/service/system/UsersService.java +++ b/src/main/java/com/zcloud/service/system/UsersService.java @@ -160,6 +160,8 @@ public interface UsersService { */ public List listAllUser(PageData pd)throws Exception; + public List listAllForHotWork(PageData pd)throws Exception; + /**用户列表(弹窗选择用) * @param page * @return diff --git a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java index 215fb9d2..b29b101a 100644 --- a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java +++ b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java @@ -237,6 +237,10 @@ public class UsersServiceImpl implements UsersService { return usersMapper.listAllUser(pd); } + public List listAllForHotWork(PageData pd)throws Exception{ + return usersMapper.listAllForHotWork(pd); + } + /**用户列表(弹窗选择用) * @param page * @return diff --git a/src/main/resources/mybatis/datasource/bus/RelevantUnitMapper.xml b/src/main/resources/mybatis/datasource/bus/RelevantUnitMapper.xml index 6df3e6f6..b0c70693 100644 --- a/src/main/resources/mybatis/datasource/bus/RelevantUnitMapper.xml +++ b/src/main/resources/mybatis/datasource/bus/RelevantUnitMapper.xml @@ -199,7 +199,10 @@ diff --git a/src/main/resources/mybatis/datasource/bus/SpecialUserMapper.xml b/src/main/resources/mybatis/datasource/bus/SpecialUserMapper.xml index 28de9b6e..f0334368 100644 --- a/src/main/resources/mybatis/datasource/bus/SpecialUserMapper.xml +++ b/src/main/resources/mybatis/datasource/bus/SpecialUserMapper.xml @@ -191,7 +191,8 @@ IF(f.USER_TYPE='1',corp.CORP_NAME,unit.RELEVANT_NAME) unitName, cuser.USERNAME as cuserName , ccorp.CORP_NAME as corpName , - poDic.NAME as operationName + poDic.NAME as operationName, + spType.NAME AS typeName from f left join bus_relevantunit unit on unit.RELEVANTUNIT_ID = f.UNIT_ID @@ -199,6 +200,7 @@ left join sys_user cuser on cuser.USER_ID = f.CREATOR left join bus_corp_info ccorp on ccorp.CORPINFO_ID = cuser.CORPINFO_ID left join sys_dictionaries poDic on poDic.DICTIONARIES_ID = f.OPERATION_TYPE + LEFT JOIN sys_dictionaries spType ON spType.DICTIONARIES_ID = f.SPECIAL_TYPE where f.ISDELETE = '0' and f.SPECIAL_TYPE = #{pd.keySpecialType} @@ -272,7 +274,8 @@ cuser.USERNAME as cuserName , ccorp.CORP_NAME as corpName , poDic.NAME as operationName , - count(1) OPERATE_COUNT + count(1) OPERATE_COUNT, + spType.NAME as typeName from f left join bus_relevantunit unit on unit.RELEVANTUNIT_ID = f.UNIT_ID @@ -280,6 +283,7 @@ left join sys_user cuser on cuser.USER_ID = f.CREATOR left join bus_corp_info ccorp on ccorp.CORPINFO_ID = cuser.CORPINFO_ID left join sys_dictionaries poDic on poDic.DICTIONARIES_ID = f.OPERATION_TYPE + LEFT JOIN sys_dictionaries spType ON spType.DICTIONARIES_ID = f.SPECIAL_TYPE where f.ISDELETE = '0' and f.UNIT_ID = #{pd.UNIT_ID} @@ -294,15 +298,25 @@ diff --git a/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalMapper.xml b/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalMapper.xml index 6368da5b..c9265a3c 100644 --- a/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalMapper.xml +++ b/src/main/resources/mybatis/datasource/inspection/SafetyEnvironmentalMapper.xml @@ -339,7 +339,11 @@ ) GROUP BY f.INSPECTION_ID - ORDER BY f.CREATTIME DESC + ORDER BY + + field(f.INSPECTION_STATUS,'-1') DESC, field(f.INSPECTION_ORIGINATOR_ID,#{pd.loginUserId}) DESC, + + f.CREATTIME DESC @@ -710,7 +714,7 @@ ) GROUP BY f.INSPECTION_ID - ORDER BY f.CREATTIME DESC + ORDER BY field(f.INSPECTION_STATUS,'8') ASC, f.CREATTIME DESC + + +