From e4a311fdb24c5f6e42200eae0790cb402ac39e3c Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Thu, 21 Dec 2023 14:18:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E9=98=B2=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/app/AppHiddenController.java | 3221 +++++++++-------- .../controller/app/AppImgFilesController.java | 609 ++-- .../filemanager/MfolderController.java | 4 +- .../firemanager/FireResourcesController.java | 95 + .../app/AppFireRecordController.java | 41 +- .../zcloud/service/bus/ImgFilesService.java | 4 +- .../service/bus/impl/ImgFilesServiceImpl.java | 9 +- .../service/mq/DockSendMessageService.java | 1 + .../mq/impl/DockSendMessageServiceImpl.java | 23 + 9 files changed, 2100 insertions(+), 1907 deletions(-) create mode 100644 src/main/java/com/zcloud/controller/firemanager/FireResourcesController.java diff --git a/src/main/java/com/zcloud/controller/app/AppHiddenController.java b/src/main/java/com/zcloud/controller/app/AppHiddenController.java index e79a4918..94f1d8ce 100644 --- a/src/main/java/com/zcloud/controller/app/AppHiddenController.java +++ b/src/main/java/com/zcloud/controller/app/AppHiddenController.java @@ -59,1011 +59,1030 @@ import javax.tools.Tool; @RequestMapping("/app/hidden") public class AppHiddenController extends BaseController { - @Autowired - private HiddenService hiddenService; - @Autowired - private ImgFilesService imgFilesService; - @Autowired - private UsersService usersService; - @Autowired - private ListCheckItemService listcheckitemService; - @Autowired - private DepartmentService departmentService; - @Autowired - private HiddenSchemeService hiddenSchemeService; - @Autowired - private HiddenCheckService hiddenCheckService; - @Autowired - private CorpInfoService corpinfoService; - @Autowired - private ListManagerService listmanagerService; - //@Autowired - //private CheckRecordService checkrecordService; + @Autowired + private HiddenService hiddenService; + @Autowired + private ImgFilesService imgFilesService; + @Autowired + private UsersService usersService; + @Autowired + private ListCheckItemService listcheckitemService; + @Autowired + private DepartmentService departmentService; + @Autowired + private HiddenSchemeService hiddenSchemeService; + @Autowired + private HiddenCheckService hiddenCheckService; + @Autowired + private CorpInfoService corpinfoService; + @Autowired + private ListManagerService listmanagerService; + //@Autowired + //private CheckRecordService checkrecordService; - @Autowired - private SMSManagementService smsmanagementService; - @Autowired - private MSMLoginService msmloginService; - @Autowired - private HiddenUserService hiddenUserService; // 隐患相关人员信息 - @Autowired - private HiddenExamineService hiddenexamineService; // 隐患意见 - @Autowired - private HiddenRegionService hiddenRegionService; - @Autowired - private SafetyEnvironmentalService safetyenvironmentalService; - @Autowired - private HiddenExamineService hiddenExamineService; //隐患审核 - @Autowired - private HiddenMailService hiddenMailService; - @Autowired - private FHlogService FHLOG;//日志记录 + @Autowired + private SMSManagementService smsmanagementService; + @Autowired + private MSMLoginService msmloginService; + @Autowired + private HiddenUserService hiddenUserService; // 隐患相关人员信息 + @Autowired + private HiddenExamineService hiddenexamineService; // 隐患意见 + @Autowired + private HiddenRegionService hiddenRegionService; + @Autowired + private SafetyEnvironmentalService safetyenvironmentalService; + @Autowired + private HiddenExamineService hiddenExamineService; //隐患审核 + @Autowired + private HiddenMailService hiddenMailService; + @Autowired + private FHlogService FHLOG;//日志记录 - @Autowired - private NoticeCorpUtil noticeUtil; - @Resource - private ApplicationContext applicationContext; - @Autowired - private HiddenCheckApiService hiddenCheckApiService ; //隐患验收人 - @Autowired - private HiddenApiService hiddenApiService; - @Autowired - private HiddenExamineApiService hiddenExamineApiService; //隐患审核 隐患的审核步骤的人员的信息的记录 - @Autowired - private MessageService messageService; - /** - * app首页获取数量 - * - * @param page - * @throws Exception - */ - @RequestMapping(value = "/getCountByUserId") - @ResponseBody - public Object getCountByUserId(Page page) throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - Map hidCount = new HashMap<>(); - pd.put("userId", pd.getString("userId")); // 发现人 - Integer dzg = 0;// 待整改 1 - Integer ycq = 0;// 已超期 5 - Integer dfc = 0;// 待复查 2 - Integer yys = 0;// 已验收 4 - Integer dys = 0;// 待验收 3 - Integer dpc = 0;// 待排查 - Integer dqr = 0;// 待确认 - Integer tscz = 0;//特殊处置1 - Integer yq = 0;//延期2 - // STATE -- 隐患状态 0-未提交 1- 未整改 2-已整改 3-已复查 4-已验收 5-已过期 - if (Tools.notEmpty(pd.get("userId").toString())) { - pd.put("SELFUSERID", pd.get("userId")); - List rectifiHid = hiddenService.getCountByRectifiCationorId(pd); // 根据人员id获取整改隐患信息 state 1 5 - for (int i = 0; i < rectifiHid.size(); i++) { - PageData rec = rectifiHid.get(i); - if (null == rec.get("STATE")) { - continue; - } - if (rec.get("STATE").equals("1") || rec.get("STATE").equals("-1") || rec.get("STATE").equals("10")) { - dzg++; - } - } + @Autowired + private NoticeCorpUtil noticeUtil; + @Resource + private ApplicationContext applicationContext; + @Autowired + private HiddenCheckApiService hiddenCheckApiService; //隐患验收人 + @Autowired + private HiddenApiService hiddenApiService; + @Autowired + private HiddenExamineApiService hiddenExamineApiService; //隐患审核 隐患的审核步骤的人员的信息的记录 + @Autowired + private MessageService messageService; - List checkorHid = hiddenService.getCountByCheckorId(pd); // 根据人员id获取整改隐患信息 state 1 5 - for (int i = 0; i < checkorHid.size(); i++) { - PageData che = checkorHid.get(i); - if (null == che.get("STATE")) { - continue; - } - if (che.get("STATE").equals("2")) { //原来是3,但是手机端待验收数据与列表数据不对。调整为2 - dys++; - } - } + /** + * app首页获取数量 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/getCountByUserId") + @ResponseBody + public Object getCountByUserId(Page page) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + Map hidCount = new HashMap<>(); + pd.put("userId", pd.getString("userId")); // 发现人 + Integer dzg = 0;// 待整改 1 + Integer ycq = 0;// 已超期 5 + Integer dfc = 0;// 待复查 2 + Integer yys = 0;// 已验收 4 + Integer dys = 0;// 待验收 3 + Integer dpc = 0;// 待排查 + Integer dqr = 0;// 待确认 + Integer tscz = 0;//特殊处置1 + Integer yq = 0;//延期2 + // STATE -- 隐患状态 0-未提交 1- 未整改 2-已整改 3-已复查 4-已验收 5-已过期 + if (Tools.notEmpty(pd.get("userId").toString())) { + pd.put("SELFUSERID", pd.get("userId")); + List rectifiHid = hiddenService.getCountByRectifiCationorId(pd); // 根据人员id获取整改隐患信息 state 1 5 + for (int i = 0; i < rectifiHid.size(); i++) { + PageData rec = rectifiHid.get(i); + if (null == rec.get("STATE")) { + continue; + } + if (rec.get("STATE").equals("1") || rec.get("STATE").equals("-1") || rec.get("STATE").equals("10")) { + dzg++; + } + } - List confirmHid = hiddenService.getCountByConfirmId(pd); // 根据人员id获取整改隐患信息 state 1 5 - for (int i = 0; i < confirmHid.size(); i++) { - PageData che = confirmHid.get(i); - if (null == che.get("STATE")) { - continue; - } - if (che.get("STATE").equals("-2")) { //待确认是-2 - dqr++; - } - } - // userId -> 85437f01be1f4c959f71a850b1d731a1 - List specialHid = hiddenService.getCountSpecialByhId(pd); // 根据人员id获取特殊处理隐患和延期隐患信息 state 1 5 - for (int i = 0; i < specialHid.size(); i++) { - PageData che = specialHid.get(i); - if (null == che.get("TYPE")) { - continue; - } - if (che.get("TYPE").toString().equals("1")) { //特殊处置1 - tscz++; - } - if (che.get("TYPE").toString().equals("2")) { //延期是2 - yq++; - } - } + List checkorHid = hiddenService.getCountByCheckorId(pd); // 根据人员id获取整改隐患信息 state 1 5 + for (int i = 0; i < checkorHid.size(); i++) { + PageData che = checkorHid.get(i); + if (null == che.get("STATE")) { + continue; + } + if (che.get("STATE").equals("2")) { //原来是3,但是手机端待验收数据与列表数据不对。调整为2 + dys++; + } + } + + List confirmHid = hiddenService.getCountByConfirmId(pd); // 根据人员id获取整改隐患信息 state 1 5 + for (int i = 0; i < confirmHid.size(); i++) { + PageData che = confirmHid.get(i); + if (null == che.get("STATE")) { + continue; + } + if (che.get("STATE").equals("-2")) { //待确认是-2 + dqr++; + } + } + // userId -> 85437f01be1f4c959f71a850b1d731a1 + List specialHid = hiddenService.getCountSpecialByhId(pd); // 根据人员id获取特殊处理隐患和延期隐患信息 state 1 5 + for (int i = 0; i < specialHid.size(); i++) { + PageData che = specialHid.get(i); + if (null == che.get("TYPE")) { + continue; + } + if (che.get("TYPE").toString().equals("1")) { //特殊处置1 + tscz++; + } + if (che.get("TYPE").toString().equals("2")) { //延期是2 + yq++; + } + } - - - List creatorHid = hiddenService.getCountByCreatorId(pd); // 根据人员id获取发现隐患信息 - for (int i = 0; i < creatorHid.size(); i++) { - PageData cre = creatorHid.get(i); - if (null == cre.get("STATE")) { - continue; - } - if (cre.get("STATE").equals("2")) { - dfc++; - } - if (cre.get("STATE").equals("4")) { - yys++; - } + List creatorHid = hiddenService.getCountByCreatorId(pd); // 根据人员id获取发现隐患信息 + for (int i = 0; i < creatorHid.size(); i++) { + PageData cre = creatorHid.get(i); + if (null == cre.get("STATE")) { + continue; + } + if (cre.get("STATE").equals("2")) { + dfc++; + } + if (cre.get("STATE").equals("4")) { + yys++; + } // if(cre.get("STATE").equals("3")) { // dys++; // } - if (cre.get("STATE").equals("-1")) { - ycq++; - } - } - } - hidCount.put("dys", dys); - hidCount.put("dzg", dzg); - hidCount.put("ycq", ycq); - hidCount.put("dfc", dfc); - hidCount.put("yys", yys); - hidCount.put("dqr", dqr); - hidCount.put("tscz", tscz); - hidCount.put("yq",yq); + if (cre.get("STATE").equals("-1")) { + ycq++; + } + } + } + hidCount.put("dys", dys); + hidCount.put("dzg", dzg); + hidCount.put("ycq", ycq); + hidCount.put("dfc", dfc); + hidCount.put("yys", yys); + hidCount.put("dqr", dqr); + hidCount.put("tscz", tscz); + hidCount.put("yq", yq); - // 待排查数量 - String USER_NAME = pd.getString("USER_NAME"); - String DEPARTMENT_ID = pd.getString("CHECK_DEPARTMENT_ID"); - String ids = departmentService.getDEPARTMENT_IDS(DEPARTMENT_ID); + // 待排查数量 + String USER_NAME = pd.getString("USER_NAME"); + String DEPARTMENT_ID = pd.getString("CHECK_DEPARTMENT_ID"); + String ids = departmentService.getDEPARTMENT_IDS(DEPARTMENT_ID); // if(pd.getString("IS_MAIN").equals("0")) { - if (ids != null && Tools.notEmpty(ids) && ids.lastIndexOf(",") > -1) { - ids = ids.substring(0, ids.lastIndexOf(",")); - pd.put("DEPARTMENT_IDS", ids.split(",")); - } else { - pd.put("DEPARTMENT_ID", DEPARTMENT_ID); - } + if (ids != null && Tools.notEmpty(ids) && ids.lastIndexOf(",") > -1) { + ids = ids.substring(0, ids.lastIndexOf(",")); + pd.put("DEPARTMENT_IDS", ids.split(",")); + } else { + pd.put("DEPARTMENT_ID", DEPARTMENT_ID); + } // } - int wjcNum = 0; - int yjcNum = 0; - List varList = listmanagerService.listAll(pd);// 列出ListManager列表 - for (PageData list : varList) { - String cycle = list.getString("PERIODNAME"); - if (list.getString("TYPE").equals("listType0005")) { - if (Integer.parseInt(list.get("checkCount").toString()) > 0) { - yjcNum++; - } else { - wjcNum++; - } - continue; - } - if (Integer.parseInt(list.get("checkCount").toString()) > 0) { - yjcNum++; - } else { - wjcNum++; - } - } - hidCount.put("dpc", wjcNum); - map.put("hidCount", hidCount); + int wjcNum = 0; + int yjcNum = 0; + List varList = listmanagerService.listAll(pd);// 列出ListManager列表 + for (PageData list : varList) { + String cycle = list.getString("PERIODNAME"); + if (list.getString("TYPE").equals("listType0005")) { + if (Integer.parseInt(list.get("checkCount").toString()) > 0) { + yjcNum++; + } else { + wjcNum++; + } + continue; + } + if (Integer.parseInt(list.get("checkCount").toString()) > 0) { + yjcNum++; + } else { + wjcNum++; + } + } + hidCount.put("dpc", wjcNum); + map.put("hidCount", hidCount); - map.put("page", page); - map.put("result", errInfo); - return map; - } + map.put("page", page); + map.put("result", errInfo); + return map; + } - /** - * 新增 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/add") - @ResponseBody - public Object add() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - PageData mes = new PageData(); - pd = this.getPageData(); - pd.put("HIDDEN_ID", this.get32UUID()); // 主键 - pd.put("CREATTIME", DateUtil.date2Str(new Date())); // 发现时间 - pd.put("CREATOR", pd.get("CREATOR")); // 发现时间 - pd.put("ISDELETE", "0"); // 是否删除 1 删除 0未删除 - pd.put("ISCONFIRM", "0"); // + /** + * 新增 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/add") + @ResponseBody + public Object add() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + PageData mes = new PageData(); + pd = this.getPageData(); + pd.put("HIDDEN_ID", this.get32UUID()); // 主键 + pd.put("CREATTIME", DateUtil.date2Str(new Date())); // 发现时间 + pd.put("CREATOR", pd.get("CREATOR")); // 发现时间 + pd.put("ISDELETE", "0"); // 是否删除 1 删除 0未删除 + pd.put("ISCONFIRM", "0"); // // pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业id - if (pd.get("RECTIFICATIONTYPE") != null && Tools.notEmpty(pd.get("RECTIFICATIONTYPE").toString())) { - if ("1".equals(pd.get("RECTIFICATIONTYPE").toString())) { - pd.put("RECTIFICATIONTIME", DateUtil.getDay()); // 整改时间 - pd.put("RECTIFICATIONOR", pd.get("CREATOR")); // 整改人 - pd.put("RECTIFICATIONDEPT", pd.get("HIDDENFINDDEPT")); - } - } - if (pd.get("RISKITEM_ID") != null && Tools.notEmpty(pd.get("RISKITEM_ID").toString())) { - PageData item = new PageData(); - item.put("LISTCHECKITEM_ID", pd.get("RISKITEM_ID")); - item = this.listcheckitemService.findById(item); - pd.put("RISK_UNIT", item.get("RISKUNITNAME")); - pd.put("IDENTIFICATION", item.get("PARTSNAME")); - pd.put("RISK_DESCR", item.get("RISK_DESCR")); - pd.put("RISK_POSITION", item.get("POSITIONNAME")); - pd.put("LEVEL", item.get("DNAME5")); - } - List list = (List) JSON.parse(pd.get("other").toString()); // 隐患发现人 - for (JSONObject json : list){ - PageData hiddenconUserAdd = new PageData(); - hiddenconUserAdd.put("HIDDENUSER_ID", UuidUtil.get32UUID()); - hiddenconUserAdd.put("HIDDEN_ID",pd.getString("HIDDEN_ID")); - hiddenconUserAdd.put("USER_ID",json.get("USER_ID")); - hiddenconUserAdd.put("TYPE","1"); - hiddenconUserAdd.put("IS_MAIN","0"); - hiddenUserService.save(hiddenconUserAdd); // 添加隐患发现人 - } - if(pd.getString("HIDDENLEVEL").equals("jdyh001") || pd.getString("HIDDENLEVEL").equals("hiddenLevel2002")){//判断是否是重大隐患 - PageData userpd = new PageData(); - userpd.put("USER_ID",pd.getString("CREATOR")); - userpd.put("DEPARTMENT_ID",usersService.findById(userpd).getString("DEPARTMENT_ID"));//获取登录人的部门ID - if(departmentService.findById(userpd).getString("LEVEL").equals("departmentLevel0003")){//判断部门级别是不是班组 - userpd.put("DEPARTMENT_ID",departmentService.findById(userpd).getString("DEPARTMENT_ID")); - if(Tools.isEmpty(departmentService.findById(userpd).getString("HEADMAN"))){//判断部门是否有负责人 - map.put("msg", "所在部门未维护部门负责人"); - return map; - }else { - userpd.put("USER_ID",departmentService.findById(userpd).getString("HEADMAN")); - pd.put("CONFIRM_USER",usersService.findById(userpd).getString("USER_ID"));//通过名字查询用户获取出ID - mes.put("RECEIVER_ID",usersService.findById(userpd).getString("USER_ID")); // 如果是较大或重大隐患在这里给站内信接收人赋值 - } - }else{ - if(Tools.isEmpty(departmentService.findById(userpd).getString("HEADMAN"))) {//判断部门是否有负责人 - map.put("msg", "所在部门未维护部门负责人"); - return map; - }{ - userpd.put("USER_ID",departmentService.findById(userpd).getString("HEADMAN")); - userpd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); - if (Tools.isEmpty(usersService.findById(userpd))) { - map.put("msg", "所在部门未维护部门负责人"); - return map; - }else{ - pd.put("CONFIRM_USER", usersService.findById(userpd).getString("USER_ID"));//通过名字查询用户获取出ID - } - } - } + if (pd.get("RECTIFICATIONTYPE") != null && Tools.notEmpty(pd.get("RECTIFICATIONTYPE").toString())) { + if ("1".equals(pd.get("RECTIFICATIONTYPE").toString())) { + pd.put("RECTIFICATIONTIME", DateUtil.getDay()); // 整改时间 + pd.put("RECTIFICATIONOR", pd.get("CREATOR")); // 整改人 + pd.put("RECTIFICATIONDEPT", pd.get("HIDDENFINDDEPT")); + } + } + if (pd.get("RISKITEM_ID") != null && Tools.notEmpty(pd.get("RISKITEM_ID").toString())) { + PageData item = new PageData(); + item.put("LISTCHECKITEM_ID", pd.get("RISKITEM_ID")); + item = this.listcheckitemService.findById(item); + pd.put("RISK_UNIT", item.get("RISKUNITNAME")); + pd.put("IDENTIFICATION", item.get("PARTSNAME")); + pd.put("RISK_DESCR", item.get("RISK_DESCR")); + pd.put("RISK_POSITION", item.get("POSITIONNAME")); + pd.put("LEVEL", item.get("DNAME5")); + } + List list = (List) JSON.parse(pd.get("other").toString()); // 隐患发现人 + for (JSONObject json : list) { + PageData hiddenconUserAdd = new PageData(); + hiddenconUserAdd.put("HIDDENUSER_ID", UuidUtil.get32UUID()); + hiddenconUserAdd.put("HIDDEN_ID", pd.getString("HIDDEN_ID")); + hiddenconUserAdd.put("USER_ID", json.get("USER_ID")); + hiddenconUserAdd.put("TYPE", "1"); + hiddenconUserAdd.put("IS_MAIN", "0"); + hiddenUserService.save(hiddenconUserAdd); // 添加隐患发现人 + } + if (pd.getString("HIDDENLEVEL").equals("jdyh001") || pd.getString("HIDDENLEVEL").equals("hiddenLevel2002")) {//判断是否是重大隐患 + PageData userpd = new PageData(); + userpd.put("USER_ID", pd.getString("CREATOR")); + userpd.put("DEPARTMENT_ID", usersService.findById(userpd).getString("DEPARTMENT_ID"));//获取登录人的部门ID + if (departmentService.findById(userpd).getString("LEVEL").equals("departmentLevel0003")) {//判断部门级别是不是班组 + userpd.put("DEPARTMENT_ID", departmentService.findById(userpd).getString("DEPARTMENT_ID")); + if (Tools.isEmpty(departmentService.findById(userpd).getString("HEADMAN"))) {//判断部门是否有负责人 + map.put("msg", "所在部门未维护部门负责人"); + return map; + } else { + userpd.put("USER_ID", departmentService.findById(userpd).getString("HEADMAN")); + pd.put("CONFIRM_USER", usersService.findById(userpd).getString("USER_ID"));//通过名字查询用户获取出ID + mes.put("RECEIVER_ID", usersService.findById(userpd).getString("USER_ID")); // 如果是较大或重大隐患在这里给站内信接收人赋值 + } + } else { + if (Tools.isEmpty(departmentService.findById(userpd).getString("HEADMAN"))) {//判断部门是否有负责人 + map.put("msg", "所在部门未维护部门负责人"); + return map; + } + { + userpd.put("USER_ID", departmentService.findById(userpd).getString("HEADMAN")); + userpd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); + if (Tools.isEmpty(usersService.findById(userpd))) { + map.put("msg", "所在部门未维护部门负责人"); + return map; + } else { + pd.put("CONFIRM_USER", usersService.findById(userpd).getString("USER_ID"));//通过名字查询用户获取出ID + } + } + } - } - PageData before = new PageData();// 添加隐患初始信息 - before.put("TYPE","0"); - before.put("STATE","2"); - before.put("HIDDEN_ID",pd.get("HIDDEN_ID")); - before.put("spare1",pd.getString("HIDDENLEVEL")); - before.put("spare2",pd.getString("RECTIFICATIONOR")); - before.put("spare3",pd.getString("RECTIFICATIONDEADLINE")); - before.put("spare4",pd.getString("RECTIFICATIONDEPT")); - before.put("CREATOR", pd.getString("loginUserId")); - before.put("OPERATOR",pd.getString("loginUserId")); - hiddenExamineService.saveApp(before); - hiddenService.save(pd); - if(!pd.getString("STATE").equals("0")){ - messageService.sendMessageByParameter("HIDDEN_MAIL_001","友情提示:有一条隐患需要确认",pd.getString("CORPINFO_ID"),pd.getString("CONFIRM_USER"),pd.getString("HIDDEN_ID"), - pd.getString("HIDDENDESCR"),"隐患确认","确认","",""); - } - // 清除同检查记录合格图片 - if(pd.get("CLEARIMG") != null && Tools.notEmpty(pd.get("CLEARIMG").toString()) && "1".equals(pd.get("CLEARIMG").toString())) { - imgFilesService.delete(pd); - PageData img = new PageData(); - img.put("FOREIGN_KEY", pd.get("RECORDITEM_ID")); - img.put("TYPE", "14"); - List imgs = imgFilesService.listAll(img); //根据ID读取 - if(imgs != null && imgs.size() > 0) { - for(PageData i: imgs) { - File file = new File(PathUtil.getProjectpath()+i.getString("FILEPATH")); - file.delete(); - imgFilesService.delete(i); - } - } + } + PageData before = new PageData();// 添加隐患初始信息 + before.put("TYPE", "0"); + before.put("STATE", "2"); + before.put("HIDDEN_ID", pd.get("HIDDEN_ID")); + before.put("spare1", pd.getString("HIDDENLEVEL")); + before.put("spare2", pd.getString("RECTIFICATIONOR")); + before.put("spare3", pd.getString("RECTIFICATIONDEADLINE")); + before.put("spare4", pd.getString("RECTIFICATIONDEPT")); + before.put("CREATOR", pd.getString("loginUserId")); + before.put("OPERATOR", pd.getString("loginUserId")); + hiddenExamineService.saveApp(before); + hiddenService.save(pd); + if (!pd.getString("STATE").equals("0")) { + messageService.sendMessageByParameter("HIDDEN_MAIL_001", "友情提示:有一条隐患需要确认", pd.getString("CORPINFO_ID"), pd.getString("CONFIRM_USER"), pd.getString("HIDDEN_ID"), + pd.getString("HIDDENDESCR"), "隐患确认", "确认", "", ""); + } + // 清除同检查记录合格图片 + if (pd.get("CLEARIMG") != null && Tools.notEmpty(pd.get("CLEARIMG").toString()) && "1".equals(pd.get("CLEARIMG").toString())) { + imgFilesService.delete(pd); + PageData img = new PageData(); + img.put("FOREIGN_KEY", pd.get("RECORDITEM_ID")); + img.put("TYPE", "14"); + List imgs = imgFilesService.listAll(img); //根据ID读取 + if (imgs != null && imgs.size() > 0) { + for (PageData i : imgs) { + File file = new File(PathUtil.getProjectpath() + i.getString("FILEPATH")); + file.delete(); + imgFilesService.delete(i); + } + } - } - map.put("result", errInfo); - map.put("pd", pd); - return map; - } + } + map.put("result", errInfo); + map.put("pd", pd); + return map; + } - /** - * 新增 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/appAdd") - @ResponseBody - public Object appAdd() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd.put("HIDDEN_ID", this.get32UUID()); // 主键 + /** + * 新增 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/appAdd") + @ResponseBody + @DockAnnotation(hasAnnex = true) + public Object appAdd() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("HIDDEN_ID", this.get32UUID()); // 主键 // pd.put("CREATOR", Jurisdiction.getUSER_ID()); //发现人 // pd.put("HIDDENFINDDEPT", Jurisdiction.getDEPARTMENT_ID()); - pd.put("CREATTIME", DateUtil.date2Str(new Date())); // 发现时间 - pd.put("ISDELETE", "0"); // 是否删除 1 删除 0未删除 + pd.put("CREATTIME", DateUtil.date2Str(new Date())); // 发现时间 + pd.put("ISDELETE", "0"); // 是否删除 1 删除 0未删除 // pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业id - if (pd.get("RECTIFICATIONTYPE") != null && Tools.notEmpty(pd.get("RECTIFICATIONTYPE").toString())) { - if ("1".equals(pd.get("RECTIFICATIONTYPE").toString())) { // 立即整改 - pd.put("RECTIFICATIONTIME", DateUtil.getDay()); // 整改时间 - pd.put("RECTIFICATIONOR", pd.get("CREATOR")); // 整改人 - pd.put("RECTIFICATIONDEPT", pd.get("HIDDENFINDDEPT")); - pd.put("RECTIFICATIONDEADLINE", DateUtil.date2Str(new Date())); - pd.put("STATE", "-2"); - } else { - pd.put("STATE", "-2"); - } - } - PageData before = new PageData();// 添加隐患初始信息 - before.put("TYPE","0"); - before.put("STATE","2"); - before.put("HIDDEN_ID",pd.get("HIDDEN_ID")); - before.put("spare1",pd.getString("HIDDENLEVEL")); - before.put("spare2",pd.getString("RECTIFICATIONOR")); - before.put("spare3",pd.getString("RECTIFICATIONDEADLINE")); - before.put("spare4",pd.getString("RECTIFICATIONDEPT")); - before.put("CREATOR", pd.getString("loginUserId")); - before.put("OPERATOR",pd.getString("loginUserId")); - hiddenExamineService.saveApp(before); - if (pd.get("RISKITEM_ID") != null && Tools.notEmpty(pd.get("RISKITEM_ID").toString())) { - if("2".equals(pd.getString("SOURCE"))){ - PageData item = new PageData(); - item.put("LISTCHECKITEM_ID", pd.get("RISKITEM_ID")); - item = this.listcheckitemService.findById(item); - pd.put("RISK_UNIT", item.get("RISKUNITNAME")); // 风险单元 - pd.put("IDENTIFICATION", item.get("PARTSNAME")); //辨识部位 - pd.put("RISK_DESCR", item.get("RISK_DESCR")); //存在风险 - pd.put("RISK_POSITION", item.get("POSITIONNAME")); // 风险点位置 - pd.put("LEVEL", item.get("DNAME5")); //风险分级 - }else if("6".equals(pd.getString("SOURCE"))){ - // 消防点检 切换为为提交的状态 - // 隐患状态 0-未提交 - // 1- 未整改 2-已整改 - // 3-已复查 4-已验收 - // 7待处理的特殊申请隐患 8已处理的特殊隐患 - // -1-已过期 -2待确认 - // ,5忽略隐患6重大隐患。 - // 7待处理的特殊隐患。8处理的特殊隐患。 - // 10验收打回。11分公司安委会办公室副主任核定。 - // 12分公司安委会办公室副主任核实 - //13港股分公司安委会办公室副主任核定、重大隐患待整改 - //14重大隐患待验收 - //15重大隐患已归档 - //16确认打回 - //100-安全环保检查暂存的隐患 - //101.检查已归档,待指派 - //102.检查已归档,指派中 - pd.put("STATE", "0"); - } + if (pd.get("RECTIFICATIONTYPE") != null && Tools.notEmpty(pd.get("RECTIFICATIONTYPE").toString())) { + if ("1".equals(pd.get("RECTIFICATIONTYPE").toString())) { // 立即整改 + pd.put("RECTIFICATIONTIME", DateUtil.getDay()); // 整改时间 + pd.put("RECTIFICATIONOR", pd.get("CREATOR")); // 整改人 + pd.put("RECTIFICATIONDEPT", pd.get("HIDDENFINDDEPT")); + pd.put("RECTIFICATIONDEADLINE", DateUtil.date2Str(new Date())); + pd.put("STATE", "-2"); + } else { + pd.put("STATE", "-2"); + } + } + PageData before = new PageData();// 添加隐患初始信息 + before.put("TYPE", "0"); + before.put("STATE", "2"); + before.put("HIDDEN_ID", pd.get("HIDDEN_ID")); + before.put("spare1", pd.getString("HIDDENLEVEL")); + before.put("spare2", pd.getString("RECTIFICATIONOR")); + before.put("spare3", pd.getString("RECTIFICATIONDEADLINE")); + before.put("spare4", pd.getString("RECTIFICATIONDEPT")); + before.put("CREATOR", pd.getString("loginUserId")); + before.put("OPERATOR", pd.getString("loginUserId")); + hiddenExamineService.saveApp(before); + PageData hiddenExaminePageData = new PageData(); + hiddenExaminePageData.putAll(before); - } + if (pd.get("RISKITEM_ID") != null && Tools.notEmpty(pd.get("RISKITEM_ID").toString())) { + if ("2".equals(pd.getString("SOURCE"))) { + PageData item = new PageData(); + item.put("LISTCHECKITEM_ID", pd.get("RISKITEM_ID")); + item = this.listcheckitemService.findById(item); + pd.put("RISK_UNIT", item.get("RISKUNITNAME")); // 风险单元 + pd.put("IDENTIFICATION", item.get("PARTSNAME")); //辨识部位 + pd.put("RISK_DESCR", item.get("RISK_DESCR")); //存在风险 + pd.put("RISK_POSITION", item.get("POSITIONNAME")); // 风险点位置 + pd.put("LEVEL", item.get("DNAME5")); //风险分级 + } else if ("6".equals(pd.getString("SOURCE"))) { + // 消防点检 切换为为提交的状态 + // 隐患状态 0-未提交 + // 1- 未整改 2-已整改 + // 3-已复查 4-已验收 + // 7待处理的特殊申请隐患 8已处理的特殊隐患 + // -1-已过期 -2待确认 + // ,5忽略隐患6重大隐患。 + // 7待处理的特殊隐患。8处理的特殊隐患。 + // 10验收打回。11分公司安委会办公室副主任核定。 + // 12分公司安委会办公室副主任核实 + //13港股分公司安委会办公室副主任核定、重大隐患待整改 + //14重大隐患待验收 + //15重大隐患已归档 + //16确认打回 + //100-安全环保检查暂存的隐患 + //101.检查已归档,待指派 + //102.检查已归档,指派中 + pd.put("STATE", "0"); + } - if("6".equals(pd.getString("SOURCE"))){ - // 消防点检 切换为为提交的状态 - // 隐患状态 0-未提交 - // 1- 未整改 2-已整改 - // 3-已复查 4-已验收 - // 7待处理的特殊申请隐患 8已处理的特殊隐患 - // -1-已过期 -2待确认 - // ,5忽略隐患6重大隐患。 - // 7待处理的特殊隐患。8处理的特殊隐患。 - // 10验收打回。11分公司安委会办公室副主任核定。 - // 12分公司安委会办公室副主任核实 - //13港股分公司安委会办公室副主任核定、重大隐患待整改 - //14重大隐患待验收 - //15重大隐患已归档 - //16确认打回 - //100-安全环保检查暂存的隐患 - //101.检查已归档,待指派 - //102.检查已归档,指派中 - pd.put("STATE", "0"); - } - List list = (List) JSON.parse(pd.get("other").toString()); // 隐患发现人 - for (JSONObject json : list){ - PageData hiddenconUserAdd = new PageData(); - hiddenconUserAdd.put("HIDDENUSER_ID", UuidUtil.get32UUID()); - hiddenconUserAdd.put("HIDDEN_ID",pd.getString("HIDDEN_ID")); - hiddenconUserAdd.put("USER_ID",json.get("USER_ID")); - hiddenconUserAdd.put("TYPE","1"); - hiddenconUserAdd.put("IS_MAIN","0"); - hiddenUserService.save(hiddenconUserAdd); // 添加隐患发现人 - } - pd.put("ISCONFIRM", "0"); - if(pd.getString("HIDDENLEVEL").equals("jdyh001") || pd.getString("HIDDENLEVEL").equals("hiddenLevel2002")){//判断是否是重大隐患 - PageData userpd = new PageData(); - userpd.put("USER_ID",pd.getString("CREATOR")); - userpd.put("DEPARTMENT_ID",usersService.findById(userpd).getString("DEPARTMENT_ID"));//获取登录人的部门ID - if(departmentService.findById(userpd).getString("LEVEL").equals("departmentLevel0003")){//判断部门级别是不是班组 - userpd.put("DEPARTMENT_ID",departmentService.findById(userpd).getString("DEPARTMENT_ID")); - if(Tools.isEmpty(departmentService.findById(userpd).getString("HEADMAN"))){//判断部门是否有负责人 - map.put("msg", "所在部门未维护部门负责人"); - return map; - }else { - userpd.put("USER_ID",departmentService.findById(userpd).getString("HEADMAN")); - if(Tools.notEmpty(usersService.findById(userpd).getString("USER_ID"))){ - pd.put("CONFIRM_USER",usersService.findById(userpd).getString("USER_ID"));//通过名字查询用户获取出ID - }else { - map.put("msg", "未查询到部门负责人"); - } - } - }else{ - if(Tools.isEmpty(departmentService.findById(userpd).getString("HEADMAN"))) {//判断部门是否有负责人 - map.put("msg", "所在部门未维护部门负责人"); - return map; - }{ - userpd.put("USER_ID",departmentService.findById(userpd).getString("HEADMAN")); - userpd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); - PageData usersPd = usersService.findById(userpd); - if(usersPd != null && Tools.notEmpty(usersPd.getString("USER_ID"))){ - pd.put("CONFIRM_USER",usersService.findById(userpd).getString("USER_ID"));//通过名字查询用户获取出ID - }else { - map.put("msg", "所在部门未维护部门负责人"); - return map; - } - } - } - } - hiddenService.save(pd); - // 发送短信 - if(Tools.notEmpty(pd.getString("CONFIRM_USER")) && !pd.getString("STATE").equals("0")){ - messageService.sendMessageByParameter("HIDDEN_MAIL_001","友情提示:有一条隐患需要确认",pd.getString("CORPINFO_ID"),pd.getString("CONFIRM_USER"),pd.getString("HIDDEN_ID"), - pd.getString("HIDDENDESCR"),"隐患确认","确认","",""); - } - map.put("result", errInfo); - map.put("pd", pd); - return map; - } + } - public String getCode() { - String code = ""; - Random random = new Random(); - for (int i = 0; i < 6; i++) { + if ("6".equals(pd.getString("SOURCE"))) { + // 消防点检 切换为为提交的状态 + // 隐患状态 0-未提交 + // 1- 未整改 2-已整改 + // 3-已复查 4-已验收 + // 7待处理的特殊申请隐患 8已处理的特殊隐患 + // -1-已过期 -2待确认 + // ,5忽略隐患6重大隐患。 + // 7待处理的特殊隐患。8处理的特殊隐患。 + // 10验收打回。11分公司安委会办公室副主任核定。 + // 12分公司安委会办公室副主任核实 + //13港股分公司安委会办公室副主任核定、重大隐患待整改 + //14重大隐患待验收 + //15重大隐患已归档 + //16确认打回 + //100-安全环保检查暂存的隐患 + //101.检查已归档,待指派 + //102.检查已归档,指派中 + pd.put("STATE", "0"); + } + List list = (List) JSON.parse(pd.get("other").toString()); // 隐患发现人 + ArrayList hiddenUserList = new ArrayList<>(); + for (JSONObject json : list) { + PageData hiddenconUserAdd = new PageData(); + hiddenconUserAdd.put("HIDDENUSER_ID", UuidUtil.get32UUID()); + hiddenconUserAdd.put("HIDDEN_ID", pd.getString("HIDDEN_ID")); + hiddenconUserAdd.put("USER_ID", json.get("USER_ID")); + hiddenconUserAdd.put("TYPE", "1"); + hiddenconUserAdd.put("IS_MAIN", "0"); + hiddenUserService.save(hiddenconUserAdd); // 添加隐患发现人 + hiddenUserList.add(hiddenconUserAdd); + } + pd.put("ISCONFIRM", "0"); + if (pd.getString("HIDDENLEVEL").equals("jdyh001") || pd.getString("HIDDENLEVEL").equals("hiddenLevel2002")) {//判断是否是重大隐患 + PageData userpd = new PageData(); + userpd.put("USER_ID", pd.getString("CREATOR")); + userpd.put("DEPARTMENT_ID", usersService.findById(userpd).getString("DEPARTMENT_ID"));//获取登录人的部门ID + if (departmentService.findById(userpd).getString("LEVEL").equals("departmentLevel0003")) {//判断部门级别是不是班组 + userpd.put("DEPARTMENT_ID", departmentService.findById(userpd).getString("DEPARTMENT_ID")); + if (Tools.isEmpty(departmentService.findById(userpd).getString("HEADMAN"))) {//判断部门是否有负责人 + map.put("msg", "所在部门未维护部门负责人"); + return map; + } else { + userpd.put("USER_ID", departmentService.findById(userpd).getString("HEADMAN")); + if (Tools.notEmpty(usersService.findById(userpd).getString("USER_ID"))) { + pd.put("CONFIRM_USER", usersService.findById(userpd).getString("USER_ID"));//通过名字查询用户获取出ID + } else { + map.put("msg", "未查询到部门负责人"); + } + } + } else { + if (Tools.isEmpty(departmentService.findById(userpd).getString("HEADMAN"))) {//判断部门是否有负责人 + map.put("msg", "所在部门未维护部门负责人"); + return map; + } + { + userpd.put("USER_ID", departmentService.findById(userpd).getString("HEADMAN")); + userpd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); + PageData usersPd = usersService.findById(userpd); + if (usersPd != null && Tools.notEmpty(usersPd.getString("USER_ID"))) { + pd.put("CONFIRM_USER", usersService.findById(userpd).getString("USER_ID"));//通过名字查询用户获取出ID + } else { + map.put("msg", "所在部门未维护部门负责人"); + return map; + } + } + } + } + hiddenService.save(pd); + PageData dockData = new PageData(); + dockData.put("hiddenData", pd); + dockData.put("hiddenExaminePageData", hiddenExaminePageData); + dockData.put("hiddenUserList", hiddenUserList); + // 发送短信 + if (Tools.notEmpty(pd.getString("CONFIRM_USER")) && !pd.getString("STATE").equals("0")) { + messageService.sendMessageByParameter("HIDDEN_MAIL_001", "友情提示:有一条隐患需要确认", pd.getString("CORPINFO_ID"), pd.getString("CONFIRM_USER"), pd.getString("HIDDEN_ID"), + pd.getString("HIDDENDESCR"), "隐患确认", "确认", "", ""); + } + map.put("result", errInfo); + map.put("pd", pd); + map.put("dockData", JSON.toJSONString(dockData)); + return map; + } - int r = random.nextInt(10); // 每次随机出一个数字(0-9) + public String getCode() { + String code = ""; + Random random = new Random(); + for (int i = 0; i < 6; i++) { - code = code + r; // 把每次随机出的数字拼在一起 + int r = random.nextInt(10); // 每次随机出一个数字(0-9) - } - return code; - } + code = code + r; // 把每次随机出的数字拼在一起 - /** - * 上传图片 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/uploadImg") - @ResponseBody - public Object uploadImg(@RequestParam(value = "FFILE", required = false) MultipartFile file, - @RequestParam(value = "TYPE", required = false) String TYPE, - @RequestParam(value = "FOREIGN_KEY", required = false) String FOREIGN_KEY) throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - 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; - } - File tempFile = new File(file.getOriginalFilename()); - FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); - if (!FileUpload.isImage(tempFile)) { - tempFile.delete(); - map.put("result", "failed"); - map.put("exception", "上传图片格式不正确,请重新上传"); - return map; - } - if (tempFile.exists()) { - tempFile.delete(); - } - String ffile = DateUtil.getDays(); + } + return code; + } + + /** + * 上传图片 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/uploadImg") + @ResponseBody + public Object uploadImg(@RequestParam(value = "FFILE", required = false) MultipartFile file, + @RequestParam(value = "TYPE", required = false) String TYPE, + @RequestParam(value = "FOREIGN_KEY", required = false) String FOREIGN_KEY) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + 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; + } + File tempFile = new File(file.getOriginalFilename()); + FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); + if (!FileUpload.isImage(tempFile)) { + tempFile.delete(); + map.put("result", "failed"); + map.put("exception", "上传图片格式不正确,请重新上传"); + return map; + } + if (tempFile.exists()) { + tempFile.delete(); + } + String ffile = DateUtil.getDays(); // String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径 // String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传 - String fileName = this.get32UUID() - + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - Smb.sshSftp(file, fileName, Const.FILEPATHFILE + ffile); - PageData pd = new PageData(); - pd.put("IMGFILES_ID", this.get32UUID()); - pd.put("FILEPATH", Const.FILEPATHFILE + ffile + "/" + fileName); - pd.put("TYPE", TYPE); - pd.put("FOREIGN_KEY", FOREIGN_KEY); - imgFilesService.save(pd); + String fileName = this.get32UUID() + + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + Smb.sshSftp(file, fileName, Const.FILEPATHFILE + ffile); + PageData pd = new PageData(); + pd.put("IMGFILES_ID", this.get32UUID()); + pd.put("FILEPATH", Const.FILEPATHFILE + ffile + "/" + fileName); + pd.put("TYPE", TYPE); + pd.put("FOREIGN_KEY", FOREIGN_KEY); + imgFilesService.save(pd); - return map; - } + return map; + } - /**去修改页面获取数据 - * @param - * @throws Exception - */ - @RequestMapping(value="/goEditWeui") - @ResponseBody - public Object goEditWeui() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd = hiddenService.findById(pd); //根据ID读取 - PageData pd2 = new PageData(); - pd2.put("FOREIGN_KEY", pd.getString("HIDDEN_ID")); - pd2.put("TYPE",3); - List hImgs = imgFilesService.listAll(pd2);//隐患图片 - pd2.put("TYPE",4); - List rImgs = imgFilesService.listAll(pd2);//整改图片 - pd2.put("TYPE",102); - List hiddenVideo = imgFilesService.listAll(pd2);//隐患视频 + /** + * 去修改页面获取数据 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/goEditWeui") + @ResponseBody + public Object goEditWeui() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd = hiddenService.findById(pd); //根据ID读取 + PageData pd2 = new PageData(); + pd2.put("FOREIGN_KEY", pd.getString("HIDDEN_ID")); + pd2.put("TYPE", 3); + List hImgs = imgFilesService.listAll(pd2);//隐患图片 + pd2.put("TYPE", 4); + List rImgs = imgFilesService.listAll(pd2);//整改图片 + pd2.put("TYPE", 102); + List hiddenVideo = imgFilesService.listAll(pd2);//隐患视频 /*pd2.put("TYPE",5); List cImgs = imgFilesService.listAll(pd2);//验收图片 -*/ //查询整改方案 - PageData hs = hiddenSchemeService.findByHdId(pd); - List sImgs = new ArrayList(); +*/ //查询整改方案 + PageData hs = hiddenSchemeService.findByHdId(pd); + List sImgs = new ArrayList(); - if(hs != null && hs.getString("HIDDENSCHEME_ID") != null) { - PageData pd3 = new PageData(); - pd3.put("FOREIGN_KEY", hs.getString("HIDDENSCHEME_ID")); - pd3.put("TYPE",8); - sImgs = imgFilesService.listAll(pd3);//方案图片 - } + if (hs != null && hs.getString("HIDDENSCHEME_ID") != null) { + PageData pd3 = new PageData(); + pd3.put("FOREIGN_KEY", hs.getString("HIDDENSCHEME_ID")); + pd3.put("TYPE", 8); + sImgs = imgFilesService.listAll(pd3);//方案图片 + } - List checkList = hiddenCheckService.listAll(pd); - if(checkList != null && checkList.size() > 0) { - PageData pd3 = new PageData(); - pd3.put("TYPE",5); - for(PageData check: checkList) { - pd3.put("FOREIGN_KEY", check.get("HIDDENCHECK_ID")); - check.put("cImgs", imgFilesService.listAll(pd3));//验收图片 - } - } - map.put("pd", pd); - map.put("hs", hs); - map.put("hImgs", hImgs); - map.put("rImgs", rImgs); + List checkList = hiddenCheckService.listAll(pd); + if (checkList != null && checkList.size() > 0) { + PageData pd3 = new PageData(); + pd3.put("TYPE", 5); + for (PageData check : checkList) { + pd3.put("FOREIGN_KEY", check.get("HIDDENCHECK_ID")); + check.put("cImgs", imgFilesService.listAll(pd3));//验收图片 + } + } + map.put("pd", pd); + map.put("hs", hs); + map.put("hImgs", hImgs); + map.put("rImgs", rImgs); // map.put("cImgs", cImgs); - map.put("sImgs", sImgs); - map.put("checkList", checkList); - map.put("hiddenVideo",hiddenVideo); - map.put("result", errInfo); - return map; - } + map.put("sImgs", sImgs); + map.put("checkList", checkList); + map.put("hiddenVideo", hiddenVideo); + map.put("result", errInfo); + return map; + } - /** - * 删除 - * - * @param out - * @throws Exception - */ - @RequestMapping(value = "/delete") - @ResponseBody - @DockAnnotation - public Object delete() throws Exception { - // 获取IP - HttpServletRequest request = this.getRequest(); - String ip = ""; - if (request.getHeader("x-forwarded-for") == null) { - ip = request.getRemoteAddr(); - }else{ - ip = request.getHeader("x-forwarded-for"); - } - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - hiddenService.delete(pd); - FHLOG.save(pd.getString("loginUserName"), "删除隐患ID:"+pd.getString("HIDDEN_ID"),ip); //记录日志 用户ID 隐患id 时间 - applicationContext.publishEvent(new DeviceHiddenEvent(new Object(),pd.getString("HIDDEN_ID"),"1")); - map.put("result", errInfo); // 返回结果 - return map; - } + /** + * 删除 + * + * @param out + * @throws Exception + */ + @RequestMapping(value = "/delete") + @ResponseBody + @DockAnnotation + public Object delete() throws Exception { + // 获取IP + HttpServletRequest request = this.getRequest(); + String ip = ""; + if (request.getHeader("x-forwarded-for") == null) { + ip = request.getRemoteAddr(); + } else { + ip = request.getHeader("x-forwarded-for"); + } + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + hiddenService.delete(pd); + FHLOG.save(pd.getString("loginUserName"), "删除隐患ID:" + pd.getString("HIDDEN_ID"), ip); //记录日志 用户ID 隐患id 时间 + applicationContext.publishEvent(new DeviceHiddenEvent(new Object(), pd.getString("HIDDEN_ID"), "1")); + map.put("result", errInfo); // 返回结果 + return map; + } - /** - * 获取清单风险点 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/getOtherHidden") - @ResponseBody - public Object getOtherHidden() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - String USER_ID = pd.getString("USER_ID"); - pd = listmanagerService.findById(pd); - if (pd.getString("TYPE").equals("listType0005")) { - if (DateUtil.timeCalendar(new Date(), DateUtil.fomatDateTime(pd.getString("START_DATE") + " 00:00:00"), - DateUtil.fomatDateTime(pd.getString("END_DATE") + " 23:59:59"))) { - PageData type = new PageData(); - type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); - type.put("IS_XUN", 1);// 查询方法和旬一样,直接借用 - type.put("STATE", "0"); - type.put("USER_ID", USER_ID); - type.put("BEGINTIME", pd.getString("START_DATE") + " 00:00:00"); - type.put("ENDTIME", pd.getString("END_DATE") + " 23:59:59"); - List hiddenList = hiddenService.getOtherHidden(type); - map.put("hiddenList", hiddenList); - } - map.put("result", errInfo); - return map; - } - String cycle = pd.getString("PERIODNAME"); - PageData type = new PageData(); - if (cycle.equals("每日")) { - type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); - type.put("IS_DAY", 1); - type.put("STATE", "0"); - type.put("USER_ID", USER_ID); - } else if (cycle.equals("每周")) { - type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); - type.put("IS_WEEK", 1); - type.put("STATE", "0"); - type.put("USER_ID", USER_ID); - } else if (cycle.equals("每旬")) { - // 1-10 - if (DateUtil.timeCalendar(new Date(), - DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "01 00:00:00"), - DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "10 23:59:59"))) { - type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); - type.put("IS_XUN", 1); - type.put("STATE", "0"); - type.put("USER_ID", USER_ID); - type.put("BEGINTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "01 00:00:00"); - type.put("ENDTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "10 23:59:59"); - } - // 11-20 - if (DateUtil.timeCalendar(new Date(), - DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "11 00:00:00"), - DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "20 23:59:59"))) { - type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); - type.put("IS_XUN", 1); - type.put("STATE", "0"); - type.put("USER_ID", USER_ID); - type.put("BEGINTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "11 00:00:00"); - type.put("ENDTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "20 23:59:59"); - } - // 21-月底 - if (DateUtil.timeCalendar(new Date(), - DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "21 00:00:00"), - DateUtil.fomatDateTime(DateUtil.getMonthEndDay() + " 23:59:59"))) { - type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); - type.put("IS_XUN", 1); - type.put("STATE", "0"); - type.put("USER_ID", USER_ID); - type.put("BEGINTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "21 00:00:00"); - type.put("ENDTIME", DateUtil.getMonthEndDay() + " 23:59:59"); - } + /** + * 获取清单风险点 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/getOtherHidden") + @ResponseBody + public Object getOtherHidden() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + String USER_ID = pd.getString("USER_ID"); + pd = listmanagerService.findById(pd); + if (pd.getString("TYPE").equals("listType0005")) { + if (DateUtil.timeCalendar(new Date(), DateUtil.fomatDateTime(pd.getString("START_DATE") + " 00:00:00"), + DateUtil.fomatDateTime(pd.getString("END_DATE") + " 23:59:59"))) { + PageData type = new PageData(); + type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); + type.put("IS_XUN", 1);// 查询方法和旬一样,直接借用 + type.put("STATE", "0"); + type.put("USER_ID", USER_ID); + type.put("BEGINTIME", pd.getString("START_DATE") + " 00:00:00"); + type.put("ENDTIME", pd.getString("END_DATE") + " 23:59:59"); + List hiddenList = hiddenService.getOtherHidden(type); + map.put("hiddenList", hiddenList); + } + map.put("result", errInfo); + return map; + } + String cycle = pd.getString("PERIODNAME"); + PageData type = new PageData(); + if (cycle.equals("每日")) { + type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); + type.put("IS_DAY", 1); + type.put("STATE", "0"); + type.put("USER_ID", USER_ID); + } else if (cycle.equals("每周")) { + type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); + type.put("IS_WEEK", 1); + type.put("STATE", "0"); + type.put("USER_ID", USER_ID); + } else if (cycle.equals("每旬")) { + // 1-10 + if (DateUtil.timeCalendar(new Date(), + DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "01 00:00:00"), + DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "10 23:59:59"))) { + type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); + type.put("IS_XUN", 1); + type.put("STATE", "0"); + type.put("USER_ID", USER_ID); + type.put("BEGINTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "01 00:00:00"); + type.put("ENDTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "10 23:59:59"); + } + // 11-20 + if (DateUtil.timeCalendar(new Date(), + DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "11 00:00:00"), + DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "20 23:59:59"))) { + type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); + type.put("IS_XUN", 1); + type.put("STATE", "0"); + type.put("USER_ID", USER_ID); + type.put("BEGINTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "11 00:00:00"); + type.put("ENDTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "20 23:59:59"); + } + // 21-月底 + if (DateUtil.timeCalendar(new Date(), + DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "21 00:00:00"), + DateUtil.fomatDateTime(DateUtil.getMonthEndDay() + " 23:59:59"))) { + type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); + type.put("IS_XUN", 1); + type.put("STATE", "0"); + type.put("USER_ID", USER_ID); + type.put("BEGINTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "21 00:00:00"); + type.put("ENDTIME", DateUtil.getMonthEndDay() + " 23:59:59"); + } - } else if (cycle.equals("每月")) { - type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); - type.put("IS_MONTH", 1); - type.put("STATE", "0"); - type.put("USER_ID", USER_ID); - } else if (cycle.equals("每季")) { - type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); - type.put("IS_QUARTER", 1); - type.put("STATE", "0"); - type.put("USER_ID", USER_ID); - } else if (cycle.equals("半年")) { - type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); - type.put("IS_HALFYEAR", 1); - type.put("STATE", "0"); - type.put("USER_ID", USER_ID); - } else if (cycle.equals("每年")) { - type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); - type.put("IS_YEAR", 1); - type.put("STATE", "0"); - type.put("USER_ID", USER_ID); - } + } else if (cycle.equals("每月")) { + type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); + type.put("IS_MONTH", 1); + type.put("STATE", "0"); + type.put("USER_ID", USER_ID); + } else if (cycle.equals("每季")) { + type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); + type.put("IS_QUARTER", 1); + type.put("STATE", "0"); + type.put("USER_ID", USER_ID); + } else if (cycle.equals("半年")) { + type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); + type.put("IS_HALFYEAR", 1); + type.put("STATE", "0"); + type.put("USER_ID", USER_ID); + } else if (cycle.equals("每年")) { + type.put("LISTMANAGER_ID", pd.get("LISTMANAGER_ID")); + type.put("IS_YEAR", 1); + type.put("STATE", "0"); + type.put("USER_ID", USER_ID); + } - List hiddenList = hiddenService.getOtherHidden(type); - map.put("result", errInfo); - map.put("hiddenList", hiddenList); - return map; - } + List hiddenList = hiddenService.getOtherHidden(type); + map.put("result", errInfo); + map.put("hiddenList", hiddenList); + return map; + } - /** - * 修改 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/edit") - @ResponseBody - public Object edit() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - - hiddenUserService.delete(pd); //删除隐患相关人员 -- 隐患发现人 - if(pd.getString("STATE").equals("16")){//如果状态等于16进入此方法肯定是提交过来的,赋值给待确认 - pd.put("STATE","-2"); - if(Tools.notEmpty(pd.getString("POSITIONDESC"))){hiddenService.editInformation(pd);} - hiddenService.editstate(pd); - } - hiddenService.editInfo(pd); - - List list = (List) JSON.parse(pd.get("other").toString()); // 隐患发现人 - for (JSONObject json : list){ - PageData hiddenconUserAdd = new PageData(); - hiddenconUserAdd.put("HIDDENUSER_ID", UuidUtil.get32UUID()); - hiddenconUserAdd.put("HIDDEN_ID",pd.getString("HIDDEN_ID")); - hiddenconUserAdd.put("USER_ID",json.get("USER_ID")); - hiddenconUserAdd.put("TYPE","1"); - hiddenconUserAdd.put("IS_MAIN","0"); - hiddenUserService.save(hiddenconUserAdd); // 添加隐患发现人 - } + /** + * 修改 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/edit") + @ResponseBody + @DockAnnotation + public Object edit() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = this.getPageData(); + hiddenUserService.delete(pd); //删除隐患相关人员 -- 隐患发现人 + if (pd.getString("STATE").equals("16")) {//如果状态等于16进入此方法肯定是提交过来的,赋值给待确认 + pd.put("STATE", "-2"); + if (Tools.notEmpty(pd.getString("POSITIONDESC"))) { + hiddenService.editInformation(pd); + } + hiddenService.editstate(pd); + } + hiddenService.editInfo(pd); + List list = (List) JSON.parse(pd.get("other").toString()); // 隐患发现人 + ArrayList hiddenUserList = new ArrayList<>(); + for (JSONObject json : list) { + PageData hiddenconUserAdd = new PageData(); + hiddenconUserAdd.put("HIDDENUSER_ID", UuidUtil.get32UUID()); + hiddenconUserAdd.put("HIDDEN_ID", pd.getString("HIDDEN_ID")); + hiddenconUserAdd.put("USER_ID", json.get("USER_ID")); + hiddenconUserAdd.put("TYPE", "1"); + hiddenconUserAdd.put("IS_MAIN", "0"); + hiddenUserService.save(hiddenconUserAdd); // 添加隐患发现人 + hiddenUserList.add(hiddenconUserAdd); + } + PageData dockData = new PageData(); + dockData.putAll(pd); + dockData.put("hiddenUserList",hiddenUserList); map.put("pd", pd); - map.put("result", errInfo); - return map; - } + map.put("dockData", dockData); + map.put("result", errInfo); + return map; + } + /** + * 修改 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/editRec") + @ResponseBody + public Object editRec() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + hiddenService.edit(pd); - /** - * 修改 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/editRec") - @ResponseBody - public Object editRec() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - hiddenService.edit(pd); + pd = hiddenService.findById(pd); + PageData corpinfo = new PageData(); + corpinfo.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); + corpinfo = corpinfoService.findById(pd); - pd = hiddenService.findById(pd); - PageData corpinfo = new PageData(); - corpinfo.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); - corpinfo = corpinfoService.findById(pd); + PageData lpd = new PageData(); + lpd.put("STATE", "OK"); + lpd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); + int usedCount = msmloginService.msUsedCount(lpd); + PageData sms = new PageData(); + sms.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); + sms.put("ISENABLE", "1"); + sms.put("SMSCODE", "SMS_215820677"); + List sList = smsmanagementService.listAll(sms); + if (corpinfo.getString("ISRECEIVE").equals("1") + && Integer.parseInt(corpinfo.getString("SMS_COUNT")) - usedCount > 0 && sList.size() > 0) { + if (!"1".equals(pd.get("RECTIFICATIONTYPE").toString())) { - PageData lpd = new PageData(); - lpd.put("STATE", "OK"); - lpd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); - int usedCount = msmloginService.msUsedCount(lpd); - PageData sms = new PageData(); - sms.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); - sms.put("ISENABLE", "1"); - sms.put("SMSCODE", "SMS_215820677"); - List sList = smsmanagementService.listAll(sms); - if (corpinfo.getString("ISRECEIVE").equals("1") - && Integer.parseInt(corpinfo.getString("SMS_COUNT")) - usedCount > 0 && sList.size() > 0) { - if (!"1".equals(pd.get("RECTIFICATIONTYPE").toString())) { + PageData user = new PageData(); + user.put("USER_ID", pd.get("RECTIFICATIONOR")); + user = usersService.findById(user); + if (user.get("USERNAME") != null && Tools.notEmpty(user.get("USERNAME").toString())) { + String phone = user.get("USERNAME").toString(); + Map mes = new HashMap(); + mes.put("phone", phone); + mes.put("templateCode", "SMS_215820677"); + mes.put("time", pd.get("RECTIFICATIONDEADLINE")); + mes.put("type", "1"); + SendSmsResponse ssms = AliSmsUtil.sendSms(mes); + msmloginService.addForAliSmsUtil(mes, pd.getString("CORPINFO_ID"), ssms); + // System.out.println(ssms.getCode()); + if (ssms.getCode().equals("OK")) { + map.put("result", "success"); + } else { + map.put("result", "fail"); + map.put("msg", "您的操作过去频繁,请稍后重试!"); + } + } + if (sList.get(0).getString("ADDRESSEE") != null) { + String[] uid = sList.get(0).getString("ADDRESSEE").split(","); + for (int i = 0; i < uid.length; i++) { + PageData suser = new PageData(); + suser.put("USER_ID", uid[i].toString()); + suser = usersService.findById(suser); + if (suser.get("USERNAME") != null && Tools.notEmpty(suser.get("USERNAME").toString())) { + String uphone = suser.get("USERNAME").toString(); + Map umes = new HashMap(); + umes.put("phone", uphone); + umes.put("templateCode", "SMS_215820677"); + umes.put("time", pd.get("RECTIFICATIONDEADLINE")); + umes.put("type", "1"); + PageData ewpd = new PageData(); + ewpd.put("STATE", "OK"); + ewpd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); + int ewusedCount = msmloginService.msUsedCount(ewpd); + if (Integer.parseInt(corpinfo.getString("SMS_COUNT")) - ewusedCount > 0) { + SendSmsResponse ussms = AliSmsUtil.sendSms(umes); + msmloginService.addForAliSmsUtil(umes, pd.getString("CORPINFO_ID"), ussms); + } + } - PageData user = new PageData(); - user.put("USER_ID", pd.get("RECTIFICATIONOR")); - user = usersService.findById(user); - if (user.get("USERNAME") != null && Tools.notEmpty(user.get("USERNAME").toString())) { - String phone = user.get("USERNAME").toString(); - Map mes = new HashMap(); - mes.put("phone", phone); - mes.put("templateCode", "SMS_215820677"); - mes.put("time", pd.get("RECTIFICATIONDEADLINE")); - mes.put("type", "1"); - SendSmsResponse ssms = AliSmsUtil.sendSms(mes); - msmloginService.addForAliSmsUtil(mes, pd.getString("CORPINFO_ID"), ssms); - // System.out.println(ssms.getCode()); - if (ssms.getCode().equals("OK")) { - map.put("result", "success"); - } else { - map.put("result", "fail"); - map.put("msg", "您的操作过去频繁,请稍后重试!"); - } - } - if (sList.get(0).getString("ADDRESSEE") != null) { - String[] uid = sList.get(0).getString("ADDRESSEE").split(","); - for (int i = 0; i < uid.length; i++) { - PageData suser = new PageData(); - suser.put("USER_ID", uid[i].toString()); - suser = usersService.findById(suser); - if (suser.get("USERNAME") != null && Tools.notEmpty(suser.get("USERNAME").toString())) { - String uphone = suser.get("USERNAME").toString(); - Map umes = new HashMap(); - umes.put("phone", uphone); - umes.put("templateCode", "SMS_215820677"); - umes.put("time", pd.get("RECTIFICATIONDEADLINE")); - umes.put("type", "1"); - PageData ewpd = new PageData(); - ewpd.put("STATE", "OK"); - ewpd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); - int ewusedCount = msmloginService.msUsedCount(ewpd); - if (Integer.parseInt(corpinfo.getString("SMS_COUNT")) - ewusedCount > 0) { - SendSmsResponse ussms = AliSmsUtil.sendSms(umes); - msmloginService.addForAliSmsUtil(umes, pd.getString("CORPINFO_ID"), ussms); - } - } + } + } - } - } + } + } - } - } + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - map.put("pd", pd); - map.put("result", errInfo); - return map; - } - - @RequestMapping(value = "/upFile") - @ResponseBody - public Object upFile(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - if (null != file && !file.isEmpty()) { - String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); - if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { - errInfo = "fail"; - map.put("result", errInfo); - map.put("msg", "文件格式不正确!"); - return map; - } - PageData hs = hiddenSchemeService.findById(pd); - String ffile = DateUtil.getDays(); + @RequestMapping(value = "/upFile") + @ResponseBody + public Object upFile(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + if (null != file && !file.isEmpty()) { + String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase(); + if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { + errInfo = "fail"; + map.put("result", errInfo); + map.put("msg", "文件格式不正确!"); + return map; + } + PageData hs = hiddenSchemeService.findById(pd); + String ffile = DateUtil.getDays(); // String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径 // String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传 - String fileName = this.get32UUID() - + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - Smb.sshSftp(file, fileName, Const.FILEPATHFILE + ffile); - pd.put("FILEPATH", Const.FILEPATHFILE + ffile + "/" + fileName); - hs.put("ISDELETE", "0"); - hiddenSchemeService.edit(hs); - } + String fileName = this.get32UUID() + + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + Smb.sshSftp(file, fileName, Const.FILEPATHFILE + ffile); + pd.put("FILEPATH", Const.FILEPATHFILE + ffile + "/" + fileName); + hs.put("ISDELETE", "0"); + hiddenSchemeService.edit(hs); + } - return map; - } + return map; + } - /** - * 整改 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/rectify") - @ResponseBody - @Transactional - public Object rectify() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - PageData corpinfo = new PageData(); - corpinfo.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); - corpinfo = corpinfoService.findById(pd); - pd.put("STATE","2"); - pd.put("INVESTMENT_FUNDS",pd.getString("INVEST_FUNDS")); - hiddenService.rectify(pd); + /** + * 整改 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/rectify") + @ResponseBody + @Transactional + public Object rectify() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + PageData corpinfo = new PageData(); + corpinfo.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); + corpinfo = corpinfoService.findById(pd); + pd.put("STATE", "2"); + pd.put("INVESTMENT_FUNDS", pd.getString("INVEST_FUNDS")); + hiddenService.rectify(pd); - pd.put("HIDDENSCHEME_ID", this.get32UUID()); // 主键 - hiddenSchemeService.deleteHd(pd); - if (Tools.notEmpty(pd.get("HAVESCHEME").toString())) { - pd.put("CREATOR", pd.get("USER_ID")); // - pd.put("CREATTIME", DateUtil.date2Str(new Date())); // - pd.put("OPERATOR", pd.get("USER_ID")); // - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // - pd.put("ISDELETE", "0"); // 是否删除 1 删除 0未删除 - pd.put("CORPINFO_ID", pd.get("CORPINFO_ID")); // 企业id - hiddenSchemeService.save(pd); - } - this.hiddenCheckService.delete(pd); - if(Tools.notEmpty(pd.getString("CHECKOR"))){//判断验收人是否空,否就发送站内信 - PageData mes = new PageData(); - PageData hiddenPd = hiddenService.findById(pd); - messageService.sendMessageByParameter("HIDDEN_MAIL_004","友情提示:有一条隐患需要验收", - hiddenPd.getString("CORPINFO_ID"),pd.getString("USER_ID"),hiddenPd.getString("HIDDEN_ID"), - hiddenPd.getString("HIDDENDESCR"),"隐患验收","验收","",""); - } + pd.put("HIDDENSCHEME_ID", this.get32UUID()); // 主键 + hiddenSchemeService.deleteHd(pd); + if (Tools.notEmpty(pd.get("HAVESCHEME").toString())) { + pd.put("CREATOR", pd.get("USER_ID")); // + pd.put("CREATTIME", DateUtil.date2Str(new Date())); // + pd.put("OPERATOR", pd.get("USER_ID")); // + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // + pd.put("ISDELETE", "0"); // 是否删除 1 删除 0未删除 + pd.put("CORPINFO_ID", pd.get("CORPINFO_ID")); // 企业id + hiddenSchemeService.save(pd); + } + this.hiddenCheckService.delete(pd); + if (Tools.notEmpty(pd.getString("CHECKOR"))) {//判断验收人是否空,否就发送站内信 + PageData mes = new PageData(); + PageData hiddenPd = hiddenService.findById(pd); + messageService.sendMessageByParameter("HIDDEN_MAIL_004", "友情提示:有一条隐患需要验收", + hiddenPd.getString("CORPINFO_ID"), pd.getString("USER_ID"), hiddenPd.getString("HIDDEN_ID"), + hiddenPd.getString("HIDDENDESCR"), "隐患验收", "验收", "", ""); + } - if (pd.get("OTHER") != null && !pd.get("OTHER").equals("")) { - List list = (List) JSON.parse(pd.get("OTHER").toString()); - for (JSONObject json : list) { + if (pd.get("OTHER") != null && !pd.get("OTHER").equals("")) { + List list = (List) JSON.parse(pd.get("OTHER").toString()); + for (JSONObject json : list) { // if (json.get("DEPARTMENT_ID") != null && json.get("DEPARTMENT_ID") != "" && json.get("USER_ID") != null // && json.get("USER_ID") != "") { - if(!Tools.isEmpty(json.get("DEPARTMENT_ID")) && !Tools.isEmpty(json.get("USER_ID")) ){ - PageData other = new PageData(); - other.put("HIDDENCHECK_ID", this.get32UUID()); // 主键 - other.put("HIDDEN_ID", pd.get("HIDDEN_ID")); - other.put("DEPARTMENT_ID", json.get("DEPARTMENT_ID")); - other.put("USER_ID", json.get("USER_ID")); - other.put("STATUS", "0"); - hiddenCheckService.save(other); - PageData hiddenPd = hiddenService.findById(pd); - messageService.sendMessageByParameter("HIDDEN_MAIL_004","友情提示:有一条隐患需要验收", - hiddenPd.getString("CORPINFO_ID"),json.get("USER_ID").toString(),hiddenPd.getString("HIDDEN_ID"), - hiddenPd.getString("HIDDENDESCR"),"隐患验收","验收","",""); - } - } - } - map.put("result", errInfo); - map.put("HIDDENSCHEME_ID", pd.get("HIDDENSCHEME_ID")); - return map; - } + if (!Tools.isEmpty(json.get("DEPARTMENT_ID")) && !Tools.isEmpty(json.get("USER_ID"))) { + PageData other = new PageData(); + other.put("HIDDENCHECK_ID", this.get32UUID()); // 主键 + other.put("HIDDEN_ID", pd.get("HIDDEN_ID")); + other.put("DEPARTMENT_ID", json.get("DEPARTMENT_ID")); + other.put("USER_ID", json.get("USER_ID")); + other.put("STATUS", "0"); + hiddenCheckService.save(other); + PageData hiddenPd = hiddenService.findById(pd); + messageService.sendMessageByParameter("HIDDEN_MAIL_004", "友情提示:有一条隐患需要验收", + hiddenPd.getString("CORPINFO_ID"), json.get("USER_ID").toString(), hiddenPd.getString("HIDDEN_ID"), + hiddenPd.getString("HIDDENDESCR"), "隐患验收", "验收", "", ""); + } + } + } + map.put("result", errInfo); + map.put("HIDDENSCHEME_ID", pd.get("HIDDENSCHEME_ID")); + return map; + } - /** - * 复查 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/review") - @ResponseBody - public Object review() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - hiddenService.review(pd); - // 删除整改照片 - if (pd.get("ISPASS") != null && Tools.notEmpty(pd.get("ISPASS").toString())) { - if ("0".equals(pd.get("ISPASS").toString())) { - PageData pic = new PageData(); - List picList = new ArrayList(); - pic.put("FOREIGN_KEY", pd.get("HIDDEN_ID")); - pic.put("TYPE", "4"); - picList = imgFilesService.listAll(pic); - if (picList != null && picList.size() > 0) { - for (PageData deletePic : picList) { - File file = new File(PathUtil.getProjectpath() + deletePic.getString("FILEPATH")); - file.delete(); - } - } - imgFilesService.deleteList(pic); - List picsList = new ArrayList(); - pic.put("FOREIGN_KEY", pd.get("HIDDENSCHEME_ID")); - pic.put("TYPE", "8"); - picsList = imgFilesService.listAll(pic); - if (picsList != null && picsList.size() > 0) { - for (PageData deletePic : picsList) { - File file = new File(PathUtil.getProjectpath() + deletePic.getString("FILEPATH")); - file.delete(); - } - } - hiddenSchemeService.deleteHd(pd); - imgFilesService.deleteList(pic); - } + /** + * 复查 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/review") + @ResponseBody + public Object review() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + hiddenService.review(pd); + // 删除整改照片 + if (pd.get("ISPASS") != null && Tools.notEmpty(pd.get("ISPASS").toString())) { + if ("0".equals(pd.get("ISPASS").toString())) { + PageData pic = new PageData(); + List picList = new ArrayList(); + pic.put("FOREIGN_KEY", pd.get("HIDDEN_ID")); + pic.put("TYPE", "4"); + picList = imgFilesService.listAll(pic); + if (picList != null && picList.size() > 0) { + for (PageData deletePic : picList) { + File file = new File(PathUtil.getProjectpath() + deletePic.getString("FILEPATH")); + file.delete(); + } + } + imgFilesService.deleteList(pic); + List picsList = new ArrayList(); + pic.put("FOREIGN_KEY", pd.get("HIDDENSCHEME_ID")); + pic.put("TYPE", "8"); + picsList = imgFilesService.listAll(pic); + if (picsList != null && picsList.size() > 0) { + for (PageData deletePic : picsList) { + File file = new File(PathUtil.getProjectpath() + deletePic.getString("FILEPATH")); + file.delete(); + } + } + hiddenSchemeService.deleteHd(pd); + imgFilesService.deleteList(pic); + } - } - map.put("result", errInfo); - return map; - } + } + map.put("result", errInfo); + return map; + } - /** - * 验收 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/check") - @ResponseBody - public Object check() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - if (pd.get("ISQUALIFIED").equals("1")) { //验收合格 - List pd2 = this.hiddenCheckService.findByHidden(pd); //获取这个隐患的验收人信息 - if(pd2.size()>0){ - for(PageData checklist: pd2){ - pd.put("STATUS", 1); - pd.put("HIDDENCHECK_ID", checklist.get("HIDDENCHECK_ID")); - pd.put("DEPARTMENT_ID", checklist.get("DEPARTMENT_ID")); - pd.put("USER_ID", checklist.get("USER_ID")); - hiddenCheckService.edit(pd); - } - } + /** + * 验收 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/check") + @ResponseBody + public Object check() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + if (pd.get("ISQUALIFIED").equals("1")) { //验收合格 + List pd2 = this.hiddenCheckService.findByHidden(pd); //获取这个隐患的验收人信息 + if (pd2.size() > 0) { + for (PageData checklist : pd2) { + pd.put("STATUS", 1); + pd.put("HIDDENCHECK_ID", checklist.get("HIDDENCHECK_ID")); + pd.put("DEPARTMENT_ID", checklist.get("DEPARTMENT_ID")); + pd.put("USER_ID", checklist.get("USER_ID")); + hiddenCheckService.edit(pd); + } + } // List checkList = hiddenCheckService.listAll(pd); // for (PageData check : checkList) { @@ -1071,318 +1090,320 @@ public class AppHiddenController extends BaseController { // break; // } // } - List checkList = hiddenCheckService.listAll(pd); - for (PageData check : checkList) { - if (check.get("STATUS").toString().equals("0")) { - map.put("result", errInfo); - map.put("code","1000"); - map.put("errorMessage","此次检查还有未合格项,不能验收"); - map.put("check", pd); - return map; - } - } - if(Tools.isEmpty(pd.getString("CHECKTIME")) && Tools.notEmpty(pd.getString("CHECK_TIME"))){//用于手机端传验收时间,存隐患表20220920 - pd.put("CHECKTIME",pd.getString("CHECK_TIME")); - } - hiddenService.check(pd); - if (Tools.notEmpty(pd.getString("INSPECTION_ID"))) { //安全环保检查验收 - pd.put("ACCEPTSTEP", 6); - List list = hiddenService.listOtherNotAccept(pd); - PageData inspection = new PageData(); - if (list.size() == 0) { - inspection.put("INSPECTION_ID", pd.getString("INSPECTION_ID")); - inspection.put("OPERATOR", pd.getString("CHECKOR")); - inspection.put("OPERATTIME", DateUtil.date2Str(new Date())); - inspection.put("INSPECTION_STATUS", "6"); // 已验收 - safetyenvironmentalService.editStatus(inspection); - } - inspection.put("INSPECTION_ID", pd.getString("INSPECTION_ID")); - inspection.put("OPERATOR", pd.getString("CHECKOR")); - inspection.put("HIDDEN_vector",pd.getString("HIDDEN_ID")); - noticeUtil.SE_ThreeStepUtil(inspection); - } - // 隐患验收清理点检处的状态 - applicationContext.publishEvent(new DeviceHiddenEvent(new Object(),pd.getString("HIDDEN_ID"),"0")); - } else { - PageData pd2 = new PageData(); //验收打回 - pd2.put("FOREIGN_KEY", pd.get("HIDDEN_ID")); - pd2.put("TYPE", "4"); - List zgImgs = imgFilesService.listAll(pd2); - for (PageData pageData : zgImgs) { + List checkList = hiddenCheckService.listAll(pd); + for (PageData check : checkList) { + if (check.get("STATUS").toString().equals("0")) { + map.put("result", errInfo); + map.put("code", "1000"); + map.put("errorMessage", "此次检查还有未合格项,不能验收"); + map.put("check", pd); + return map; + } + } + if (Tools.isEmpty(pd.getString("CHECKTIME")) && Tools.notEmpty(pd.getString("CHECK_TIME"))) {//用于手机端传验收时间,存隐患表20220920 + pd.put("CHECKTIME", pd.getString("CHECK_TIME")); + } + hiddenService.check(pd); + if (Tools.notEmpty(pd.getString("INSPECTION_ID"))) { //安全环保检查验收 + pd.put("ACCEPTSTEP", 6); + List list = hiddenService.listOtherNotAccept(pd); + PageData inspection = new PageData(); + if (list.size() == 0) { + inspection.put("INSPECTION_ID", pd.getString("INSPECTION_ID")); + inspection.put("OPERATOR", pd.getString("CHECKOR")); + inspection.put("OPERATTIME", DateUtil.date2Str(new Date())); + inspection.put("INSPECTION_STATUS", "6"); // 已验收 + safetyenvironmentalService.editStatus(inspection); + } + inspection.put("INSPECTION_ID", pd.getString("INSPECTION_ID")); + inspection.put("OPERATOR", pd.getString("CHECKOR")); + inspection.put("HIDDEN_vector", pd.getString("HIDDEN_ID")); + noticeUtil.SE_ThreeStepUtil(inspection); + } + // 隐患验收清理点检处的状态 + applicationContext.publishEvent(new DeviceHiddenEvent(new Object(), pd.getString("HIDDEN_ID"), "0")); + } else { + PageData pd2 = new PageData(); //验收打回 + pd2.put("FOREIGN_KEY", pd.get("HIDDEN_ID")); + pd2.put("TYPE", "4"); + List zgImgs = imgFilesService.listAll(pd2); + for (PageData pageData : zgImgs) { - imgFilesService.delete(pageData); - if(Tools.notEmpty(pageData.getString("FILEPATH"))) { - Smb.deleteFile(pageData.getString("FILEPATH")); - } + imgFilesService.delete(pageData); + if (Tools.notEmpty(pageData.getString("FILEPATH"))) { + Smb.deleteFile(pageData.getString("FILEPATH")); + } - } - /** 删除所有验收人数据。**/ - hiddenCheckApiService.deleteByHiddenId(pd.getString("HIDDEN_ID")); - /** 验收打回 **/ - hiddenApiService.repulseCheck(pd.getString("HIDDEN_ID")); - /** 记录打回 **/ - hiddenExamineApiService.saveRepulseCheckApp(pd.getString("HIDDEN_ID"),pd.getString("CONTENT"),pd.getString("CHECKOR")); - } - hiddenMailService.apphiddneCheckAdopt(pd); - map.put("check", pd); - map.put("result", errInfo); - return map; - } + } + /** 删除所有验收人数据。**/ + hiddenCheckApiService.deleteByHiddenId(pd.getString("HIDDEN_ID")); + /** 验收打回 **/ + hiddenApiService.repulseCheck(pd.getString("HIDDEN_ID")); + /** 记录打回 **/ + hiddenExamineApiService.saveRepulseCheckApp(pd.getString("HIDDEN_ID"), pd.getString("CONTENT"), pd.getString("CHECKOR")); + } + hiddenMailService.apphiddneCheckAdopt(pd); + map.put("check", pd); + map.put("result", errInfo); + return map; + } - /** - * 列表 - * - * @param page - * @throws Exception - */ - @RequestMapping(value = "/list") - @ResponseBody - public Object list() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - Page page = new Page(); - pd = this.getPageData(); - page.setCurrentPage(Integer.parseInt(pd.get("currentPage").toString())); - page.setShowCount(Integer.parseInt(pd.get("showCount").toString())); - page.setTotalResult(Integer.parseInt(pd.get("totalResult").toString())); + /** + * 列表 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/list") + @ResponseBody + public Object list() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + Page page = new Page(); + pd = this.getPageData(); + page.setCurrentPage(Integer.parseInt(pd.get("currentPage").toString())); + page.setShowCount(Integer.parseInt(pd.get("showCount").toString())); + page.setTotalResult(Integer.parseInt(pd.get("totalResult").toString())); // String DEPARTMENT_ID = pd.getString("USERDEPT"); // String ids = departmentService.getDEPARTMENT_IDS(DEPARTMENT_ID); // if(ids!=null && Tools.notEmpty(ids)) { // ids = ids.substring(0,ids.lastIndexOf(",")); // pd.put("DEPARTMENT_IDS", ids.split(",")); // } - String KEYWORDS = pd.getString("KEYWORDS"); // 关键词检索条件 - if (Tools.notEmpty(KEYWORDS)) - pd.put("KEYWORDS", KEYWORDS.trim()); - String HIDDENDESCR = pd.getString("HIDDENDESCR"); // 关键词检索条件 - if (Tools.notEmpty(HIDDENDESCR)) - pd.put("HIDDENDESCR", HIDDENDESCR.trim()); - String ISQUALIFIED = pd.getString("ISQUALIFIED"); // 关键词检索条件 - if (Tools.notEmpty(ISQUALIFIED)) - pd.put("ISQUALIFIED", ISQUALIFIED.trim()); - String HIDDENLEVELE = pd.getString("HIDDENLEVELE"); // 关键词检索条件 - if (Tools.notEmpty(HIDDENLEVELE)) - pd.put("HIDDENLEVELE", HIDDENLEVELE.trim()); - String STARTTIME = pd.getString("STARTTIME"); // 关键词检索条件 - if (Tools.notEmpty(STARTTIME)) - pd.put("STARTTIME", STARTTIME.trim()); - String ENDTIME = pd.getString("ENDTIME"); // 关键词检索条件 - if (Tools.notEmpty(ENDTIME)) - pd.put("ENDTIME", ENDTIME.trim()); - if (pd.get("isIndex") != null && Tools.notEmpty(pd.get("isIndex").toString()) - && pd.get("isIndex").toString().equals("1")) { - pd.put("SELF_USER_ID", pd.get("SELFUSERID")); - } - pd.put("ISMAIN", "0"); - String DISPOSESTATE = pd.getString("DISPOSESTATE"); // 关键词检索条件 - if (Tools.notEmpty(DISPOSESTATE)) { - pd.put("DISPOSESTATE", DISPOSESTATE.trim()); - pd.put("SELFUSERID", pd.get("SELFUSERID")); - pd.put("USERDEPT", pd.get("USERDEPT")); - } - page.setPd(pd); - List varList = hiddenService.list(page); // 列出Hidden列表 - varList = hiddenUserService.getHiddebFind(varList); - map.put("varList", varList); - map.put("page", page); - map.put("result", errInfo); - return map; - } + String KEYWORDS = pd.getString("KEYWORDS"); // 关键词检索条件 + if (Tools.notEmpty(KEYWORDS)) + pd.put("KEYWORDS", KEYWORDS.trim()); + String HIDDENDESCR = pd.getString("HIDDENDESCR"); // 关键词检索条件 + if (Tools.notEmpty(HIDDENDESCR)) + pd.put("HIDDENDESCR", HIDDENDESCR.trim()); + String ISQUALIFIED = pd.getString("ISQUALIFIED"); // 关键词检索条件 + if (Tools.notEmpty(ISQUALIFIED)) + pd.put("ISQUALIFIED", ISQUALIFIED.trim()); + String HIDDENLEVELE = pd.getString("HIDDENLEVELE"); // 关键词检索条件 + if (Tools.notEmpty(HIDDENLEVELE)) + pd.put("HIDDENLEVELE", HIDDENLEVELE.trim()); + String STARTTIME = pd.getString("STARTTIME"); // 关键词检索条件 + if (Tools.notEmpty(STARTTIME)) + pd.put("STARTTIME", STARTTIME.trim()); + String ENDTIME = pd.getString("ENDTIME"); // 关键词检索条件 + if (Tools.notEmpty(ENDTIME)) + pd.put("ENDTIME", ENDTIME.trim()); + if (pd.get("isIndex") != null && Tools.notEmpty(pd.get("isIndex").toString()) + && pd.get("isIndex").toString().equals("1")) { + pd.put("SELF_USER_ID", pd.get("SELFUSERID")); + } + pd.put("ISMAIN", "0"); + String DISPOSESTATE = pd.getString("DISPOSESTATE"); // 关键词检索条件 + if (Tools.notEmpty(DISPOSESTATE)) { + pd.put("DISPOSESTATE", DISPOSESTATE.trim()); + pd.put("SELFUSERID", pd.get("SELFUSERID")); + pd.put("USERDEPT", pd.get("USERDEPT")); + } + page.setPd(pd); + List varList = hiddenService.list(page); // 列出Hidden列表 + varList = hiddenUserService.getHiddebFind(varList); + map.put("varList", varList); + map.put("page", page); + 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 = hiddenService.findById(pd); // 根据ID读取 - if(pd.getString("CONFIRM_USER")!=null || pd.getString("CONFIRM_USER").equals("undefined")){ - pd.put("USER_ID",pd.getString("CONFIRM_USER")); - PageData user = usersService.findById(pd); - if(user!=null){ - pd.put("confirmDeptId",user.getString("DEPARTMENT_ID")); - pd.put("conUserId",pd.getString("CONFIRM_USER")); - } - } - PageData pd2 = new PageData(); - pd2.put("FOREIGN_KEY", pd.getString("HIDDEN_ID")); - pd2.put("TYPE", 3); - List hImgs = imgFilesService.listAll(pd2);// 隐患图片 - pd2.put("TYPE", 4); - List rImgs = imgFilesService.listAll(pd2);// 整改图片 - /* - * pd2.put("TYPE",5); List cImgs = imgFilesService.listAll(pd2);//验收图片 d770367816c34f53bf22177da3965f6c - */ // 查询整改方案 - PageData hs = hiddenSchemeService.findByHdId(pd); - List sImgs = new ArrayList(); + /** + * 去修改页面获取数据 + * + * @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 = hiddenService.findById(pd); // 根据ID读取 + if (pd.getString("CONFIRM_USER") != null || pd.getString("CONFIRM_USER").equals("undefined")) { + pd.put("USER_ID", pd.getString("CONFIRM_USER")); + PageData user = usersService.findById(pd); + if (user != null) { + pd.put("confirmDeptId", user.getString("DEPARTMENT_ID")); + pd.put("conUserId", pd.getString("CONFIRM_USER")); + } + } + PageData pd2 = new PageData(); + pd2.put("FOREIGN_KEY", pd.getString("HIDDEN_ID")); + pd2.put("TYPE", 3); + List hImgs = imgFilesService.listAll(pd2);// 隐患图片 + pd2.put("TYPE", 4); + List rImgs = imgFilesService.listAll(pd2);// 整改图片 + /* + * pd2.put("TYPE",5); List cImgs = imgFilesService.listAll(pd2);//验收图片 d770367816c34f53bf22177da3965f6c + */ // 查询整改方案 + PageData hs = hiddenSchemeService.findByHdId(pd); + List sImgs = new ArrayList(); - if (hs != null && hs.getString("HIDDENSCHEME_ID") != null) { - PageData pd3 = new PageData(); - pd3.put("FOREIGN_KEY", pd.getString("HIDDEN_ID")); - pd3.put("TYPE", 8); - sImgs = imgFilesService.listAll(pd3);// 方案图片 + if (hs != null && hs.getString("HIDDENSCHEME_ID") != null) { + PageData pd3 = new PageData(); + pd3.put("FOREIGN_KEY", pd.getString("HIDDEN_ID")); + pd3.put("TYPE", 8); + sImgs = imgFilesService.listAll(pd3);// 方案图片 - PageData pd31 = new PageData(); - pd31.put("FOREIGN_KEY", hs.getString("HIDDENSCHEME_ID")); - pd31.put("TYPE", 8); - List sImgs2 = imgFilesService.listAll(pd31);// 方案图片 - sImgs.addAll(sImgs2); - } + PageData pd31 = new PageData(); + pd31.put("FOREIGN_KEY", hs.getString("HIDDENSCHEME_ID")); + pd31.put("TYPE", 8); + List sImgs2 = imgFilesService.listAll(pd31);// 方案图片 + sImgs.addAll(sImgs2); + } - List checkList = hiddenCheckService.listAll(pd); - if (checkList != null && checkList.size() > 0) { - PageData pd3 = new PageData(); - pd3.put("TYPE", 5); - for (PageData check : checkList) { - pd3.put("FOREIGN_KEY", check.get("HIDDENCHECK_ID")); - check.put("cImgs", imgFilesService.listAll(pd3));// 验收图片 - } - } - List hiddenExa = hiddenExamineService.listAllByHiddenId(pd.getString("HIDDEN_ID")); // 隐患流程信息 - List repulsecause = hiddenExamineService.findByHiddenId(pd);//确认人打回信息 - for (PageData pageData :hiddenExa){ - if("0".equals(pageData.getString("TYPE"))){ - pd.put("editUserName",pageData.get("editUserName")); - pd.put("editDeptName",pageData.get("editDeptName")); - pd.put("editLevelName",pageData.get("editLevelName")); - pd.put("editRectificationDeadline",pageData.get("spare3")); - } - } - map.put("hiddenExa", hiddenExa); // //特殊审批信息 - List hiddenFindPeople = hiddenUserService.listAll(pd);// 隐患相关人员信息 --隐患发现人 - map.put("pd", pd); - map.put("hs", hs); - map.put("hImgs", hImgs); - map.put("rImgs", rImgs); - map.put("hiddenVideo", imgFilesService.getListByKeyAndType(pd.getString("HIDDEN_ID"),"102"));// 隐患视频 + List checkList = hiddenCheckService.listAll(pd); + if (checkList != null && checkList.size() > 0) { + PageData pd3 = new PageData(); + pd3.put("TYPE", 5); + for (PageData check : checkList) { + pd3.put("FOREIGN_KEY", check.get("HIDDENCHECK_ID")); + check.put("cImgs", imgFilesService.listAll(pd3));// 验收图片 + } + } + List hiddenExa = hiddenExamineService.listAllByHiddenId(pd.getString("HIDDEN_ID")); // 隐患流程信息 + List repulsecause = hiddenExamineService.findByHiddenId(pd);//确认人打回信息 + for (PageData pageData : hiddenExa) { + if ("0".equals(pageData.getString("TYPE"))) { + pd.put("editUserName", pageData.get("editUserName")); + pd.put("editDeptName", pageData.get("editDeptName")); + pd.put("editLevelName", pageData.get("editLevelName")); + pd.put("editRectificationDeadline", pageData.get("spare3")); + } + } + map.put("hiddenExa", hiddenExa); // //特殊审批信息 + List hiddenFindPeople = hiddenUserService.listAll(pd);// 隐患相关人员信息 --隐患发现人 + map.put("pd", pd); + map.put("hs", hs); + map.put("hImgs", hImgs); + map.put("rImgs", rImgs); + map.put("hiddenVideo", imgFilesService.getListByKeyAndType(pd.getString("HIDDEN_ID"), "102"));// 隐患视频 // map.put("cImgs", cImgs); - map.put("sImgs", sImgs); - map.put("hiddenFindPeople", hiddenFindPeople); // 隐患相关人员信息 - map.put("checkList", checkList); - map.put("repulsecause",repulsecause); - map.put("result", errInfo); - return map; - } + map.put("sImgs", sImgs); + map.put("hiddenFindPeople", hiddenFindPeople); // 隐患相关人员信息 + map.put("checkList", checkList); + map.put("repulsecause", repulsecause); + map.put("result", errInfo); + return map; + } - /** - * 首页统计 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/statistic") - @ResponseBody - public Object statistic() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");// 设置日期格式 - Date now = new Date(); - String endDay = sdf.format(now); - Calendar calendar = Calendar.getInstance(); - calendar.setTime(now); - calendar.add(Calendar.DATE, -15); - String startDay = sdf.format(calendar.getTime()); - pd.put("START_DAY", startDay); - pd.put("END_DAY", endDay); - pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); - pd.put("HIDDENLEVEL", "hiddenLevel0001");// 一般隐患 - List nhds = hiddenService.hiddenStatisticsByDay(pd); - System.out.println(nhds.toString()); - pd.put("HIDDENLEVEL", "hiddenLevel0002");// 一般隐患 - List zhds = hiddenService.hiddenStatisticsByDay(pd); + /** + * 首页统计 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/statistic") + @ResponseBody + public Object statistic() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");// 设置日期格式 + Date now = new Date(); + String endDay = sdf.format(now); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(now); + calendar.add(Calendar.DATE, -15); + String startDay = sdf.format(calendar.getTime()); + pd.put("START_DAY", startDay); + pd.put("END_DAY", endDay); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + pd.put("HIDDENLEVEL", "hiddenLevel0001");// 一般隐患 + List nhds = hiddenService.hiddenStatisticsByDay(pd); + System.out.println(nhds.toString()); + pd.put("HIDDENLEVEL", "hiddenLevel0002");// 一般隐患 + List zhds = hiddenService.hiddenStatisticsByDay(pd); - List hdAll = hiddenService.hiddenStatisticsAll(pd); - map.put("nhds", nhds); - map.put("zhds", zhds); - map.put("hdAll", hdAll); - map.put("result", errInfo); - return map; - } + List hdAll = hiddenService.hiddenStatisticsAll(pd); + map.put("nhds", nhds); + map.put("zhds", zhds); + map.put("hdAll", hdAll); + map.put("result", errInfo); + return map; + } - /** - * 首页统计 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/getIndexCount") - @ResponseBody - public Object getIndexCount() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - List varList = hiddenService.getBICount(pd); - if (varList != null && varList.size() > 0) { - map.put("total", varList.size()); - int checked = 0; - int uncheck = 0; - for (PageData hidden : varList) { - if (hidden.get("STATE").toString().equals("4")||hidden.get("STATE").toString().equals("2")) { - checked++; - } else { - uncheck++; - } + /** + * 首页统计 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/getIndexCount") + @ResponseBody + public Object getIndexCount() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + List varList = hiddenService.getBICount(pd); + if (varList != null && varList.size() > 0) { + map.put("total", varList.size()); + int checked = 0; + int uncheck = 0; + for (PageData hidden : varList) { + if (hidden.get("STATE").toString().equals("4") || hidden.get("STATE").toString().equals("2")) { + checked++; + } else { + uncheck++; + } - } - map.put("checked", checked); - map.put("uncheck", uncheck); - } else { - map.put("total", 0); - map.put("checked", 0); - map.put("uncheck", 0); - } + } + map.put("checked", checked); + map.put("uncheck", uncheck); + } else { + map.put("total", 0); + map.put("checked", 0); + map.put("uncheck", 0); + } - map.put("result", errInfo); - return map; - } - /** - * 获取检查记录风险点 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/getChcenkHidden") - @ResponseBody - public Object getChcenkHidden() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - List hiddenList = hiddenService.getOtherHidden(pd); - map.put("result", errInfo); - map.put("hiddenList", hiddenList); - return map; - } - /** - * 列表 隐患列表接口 - * - * @param page - * @throws Exception - */ - @RequestMapping(value = "/listGwj") - @ResponseBody - public Object listGwj(Page page) throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - if(Tools.isEmpty(pd.get("loginUserId"))){ // 由我确认的隐患 - map.put("varList", new ArrayList<>()); - map.put("page", page); - map.put("result", "Error"); - map.put("msg", "未找到登录人信息,请联系管理员"); - } + map.put("result", errInfo); + return map; + } + + /** + * 获取检查记录风险点 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/getChcenkHidden") + @ResponseBody + public Object getChcenkHidden() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + List hiddenList = hiddenService.getOtherHidden(pd); + map.put("result", errInfo); + map.put("hiddenList", hiddenList); + return map; + } + + /** + * 列表 隐患列表接口 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/listGwj") + @ResponseBody + public Object listGwj(Page page) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + if (Tools.isEmpty(pd.get("loginUserId"))) { // 由我确认的隐患 + map.put("varList", new ArrayList<>()); + map.put("page", page); + map.put("result", "Error"); + map.put("msg", "未找到登录人信息,请联系管理员"); + } /* 1. 让我确认的信息 -- 确认人是我的隐患 @@ -1390,306 +1411,308 @@ public class AppHiddenController extends BaseController { 3.让我验收的隐患 */ - if("0".equals(pd.getString("stateConfirm"))){ //确认的隐患 stateConfirm:0全部 。1未确认的,2已确认的 - pd.put("CONFIRM_USER",pd.get("loginUserId")); - } - if("0".equals(pd.getString("stateRectify"))){ //我整改的隐患 - pd.put("RECTIFICATIONOR",pd.get("loginUserId")); - pd.put("STATE","1"); - } - if (!Tools.isEmpty(pd.get("corpinfoId"))){ - pd.put("CORPINFO_ID",pd.getString("corpinfoId")); - } - page.setPd(pd); - List varList = hiddenService.listGwj(page); // 列出Hidden列表 - varList = hiddenUserService.getHiddebFind(varList); //添加发现人 - map.put("varList", varList); - map.put("page", page); - map.put("result", errInfo); - return map; - } + if ("0".equals(pd.getString("stateConfirm"))) { //确认的隐患 stateConfirm:0全部 。1未确认的,2已确认的 + pd.put("CONFIRM_USER", pd.get("loginUserId")); + } + if ("0".equals(pd.getString("stateRectify"))) { //我整改的隐患 + pd.put("RECTIFICATIONOR", pd.get("loginUserId")); + pd.put("STATE", "1"); + } + if (!Tools.isEmpty(pd.get("corpinfoId"))) { + pd.put("CORPINFO_ID", pd.getString("corpinfoId")); + } + page.setPd(pd); + List varList = hiddenService.listGwj(page); // 列出Hidden列表 + varList = hiddenUserService.getHiddebFind(varList); //添加发现人 + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } - /** - * 列表 隐患列表接口 - * - * @param page - * @throws Exception - */ - @RequestMapping(value = "/listIgnore") - @ResponseBody - public Object listIgnore(Page page) throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - if(Tools.isEmpty(pd.get("loginUserId"))){ // 由我确认的隐患 - map.put("varList", new ArrayList<>()); - map.put("page", page); - map.put("result", "Error"); - map.put("msg", "未找到登录人信息,请联系管理员"); - } - pd.put("CONFIRM_USER",pd.getString("loginUserId")); - if (!Tools.isEmpty(pd.get("corpinfoId"))){ - pd.put("CORPINFO_ID",pd.getString("corpinfoId")); - } - page.setPd(pd); - List varList = hiddenService.listIgnore(page); // 列出Hidden列表 - varList = hiddenUserService.getHiddebFind(varList); //添加发现人 - map.put("varList", varList); - map.put("page", page); - map.put("result", errInfo); - return map; - } + /** + * 列表 隐患列表接口 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/listIgnore") + @ResponseBody + public Object listIgnore(Page page) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + if (Tools.isEmpty(pd.get("loginUserId"))) { // 由我确认的隐患 + map.put("varList", new ArrayList<>()); + map.put("page", page); + map.put("result", "Error"); + map.put("msg", "未找到登录人信息,请联系管理员"); + } + pd.put("CONFIRM_USER", pd.getString("loginUserId")); + if (!Tools.isEmpty(pd.get("corpinfoId"))) { + pd.put("CORPINFO_ID", pd.getString("corpinfoId")); + } + page.setPd(pd); + List varList = hiddenService.listIgnore(page); // 列出Hidden列表 + varList = hiddenUserService.getHiddebFind(varList); //添加发现人 + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } - /** - * --确认隐患 - * - * @throws Exception - */ - @RequestMapping(value = "/confirm") - @ResponseBody - public Object confirmUpdate() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - if("1".equals(pd.get("isEmis"))){ - errInfo = hiddenService.goEmis(pd); - if("success".equals(errInfo)){ - map.put("result", errInfo); - return map; - }else{ - map.put("result", "errInfo"); - map.put("msg", errInfo); - return map; - } + /** + * --确认隐患 + * + * @throws Exception + */ + @RequestMapping(value = "/confirm") + @ResponseBody + public Object confirmUpdate() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + if ("1".equals(pd.get("isEmis"))) { + errInfo = hiddenService.goEmis(pd); + if ("success".equals(errInfo)) { + map.put("result", errInfo); + return map; + } else { + map.put("result", "errInfo"); + map.put("msg", errInfo); + return map; + } - } - PageData editHidden = new PageData(); - if("hiddenLevel1001".equals(pd.getString("HIDDENLEVEL"))){ // 如果是忽略隐患 - editHidden.put("STATE","5"); - applicationContext.publishEvent(new DeviceHiddenEvent(new Object(),pd.getString("HIDDEN_ID"),"0")); - }else if("hiddenLevel2002".equals(pd.getString("HIDDENLEVEL"))){ // 如果是是重大隐患 - editHidden.put("STATE","6"); - }else { - editHidden.put("STATE","1"); - } + } + PageData editHidden = new PageData(); + if ("hiddenLevel1001".equals(pd.getString("HIDDENLEVEL"))) { // 如果是忽略隐患 + editHidden.put("STATE", "5"); + applicationContext.publishEvent(new DeviceHiddenEvent(new Object(), pd.getString("HIDDEN_ID"), "0")); + } else if ("hiddenLevel2002".equals(pd.getString("HIDDENLEVEL"))) { // 如果是是重大隐患 + editHidden.put("STATE", "6"); + } else { + editHidden.put("STATE", "1"); + } - editHidden.put("CONFIRM_USER",pd.get("USER_ID")); // 隐患确认人 - editHidden.put("CONFIRM_TIME",DateUtil.date2Str(new Date())); // 隐患确认时间 - editHidden.put("RECTIFICATIONDEPT",pd.get("RECTIFICATIONDEPT")); // 整改部门 - editHidden.put("RECTIFICATIONOR",pd.get("RECTIFICATIONOR")); // 整改人 - editHidden.put("RECTIFICATIONDEADLINE",pd.get("RECTIFICATIONDEADLINE")); // 整改期限 - editHidden.put("HIDDENLEVEL",pd.get("HIDDENLEVEL")); // 隐患级别 - editHidden.put("HIDDEN_ID",pd.get("HIDDEN_ID")); // 隐患id - PageData hidden = hiddenService.findById(pd); - if("1".equals(hidden.get("RECTIFICATIONTYPE").toString())){ - editHidden.put("STATE","4"); - } - PageData exaPd = new PageData(); // 添加隐患确认信息 - exaPd.put("TYPE","4"); - exaPd.put("STATE","2"); - exaPd.put("HIDDEN_ID",hidden.get("HIDDEN_ID")); - exaPd.put("spare1",pd.getString("HIDDENLEVEL")); - exaPd.put("spare2",pd.getString("RECTIFICATIONOR")); - exaPd.put("spare3",pd.getString("RECTIFICATIONDEADLINE")); - exaPd.put("spare4",pd.getString("RECTIFICATIONDEPT")); - exaPd.put("CREATOR", pd.getString("loginUserId")); - exaPd.put("OPERATOR",pd.getString("loginUserId")); - hiddenExamineService.saveApp(exaPd); - if("1".equals(hidden.get("RECTIFICATIONTYPE").toString())){ //确认时判断是否是立即整改 - if(pd.getString("isTrue").equals("1")){ - editHidden.put("STATE","4"); - editHidden.put("CHECKOR",hidden.getString("CREATOR")); - }else { - editHidden.put("STATE","1"); - editHidden.put("RECTIFICATIONTYPE","2"); - } + editHidden.put("CONFIRM_USER", pd.get("USER_ID")); // 隐患确认人 + editHidden.put("CONFIRM_TIME", DateUtil.date2Str(new Date())); // 隐患确认时间 + editHidden.put("RECTIFICATIONDEPT", pd.get("RECTIFICATIONDEPT")); // 整改部门 + editHidden.put("RECTIFICATIONOR", pd.get("RECTIFICATIONOR")); // 整改人 + editHidden.put("RECTIFICATIONDEADLINE", pd.get("RECTIFICATIONDEADLINE")); // 整改期限 + editHidden.put("HIDDENLEVEL", pd.get("HIDDENLEVEL")); // 隐患级别 + editHidden.put("HIDDEN_ID", pd.get("HIDDEN_ID")); // 隐患id + PageData hidden = hiddenService.findById(pd); + if ("1".equals(hidden.get("RECTIFICATIONTYPE").toString())) { + editHidden.put("STATE", "4"); + } + PageData exaPd = new PageData(); // 添加隐患确认信息 + exaPd.put("TYPE", "4"); + exaPd.put("STATE", "2"); + exaPd.put("HIDDEN_ID", hidden.get("HIDDEN_ID")); + exaPd.put("spare1", pd.getString("HIDDENLEVEL")); + exaPd.put("spare2", pd.getString("RECTIFICATIONOR")); + exaPd.put("spare3", pd.getString("RECTIFICATIONDEADLINE")); + exaPd.put("spare4", pd.getString("RECTIFICATIONDEPT")); + exaPd.put("CREATOR", pd.getString("loginUserId")); + exaPd.put("OPERATOR", pd.getString("loginUserId")); + hiddenExamineService.saveApp(exaPd); + if ("1".equals(hidden.get("RECTIFICATIONTYPE").toString())) { //确认时判断是否是立即整改 + if (pd.getString("isTrue").equals("1")) { + editHidden.put("STATE", "4"); + editHidden.put("CHECKOR", hidden.getString("CREATOR")); + } else { + editHidden.put("STATE", "1"); + editHidden.put("RECTIFICATIONTYPE", "2"); + } - } - hiddenService.confirmHidden(editHidden); // 隐患确认 - if(Tools.notEmpty(pd.getString("RECTIFICATIONOR")) && !hidden.getString("RECTIFICATIONTYPE").equals("1")){ - messageService.sendMessageByParameter("HIDDEN_MAIL_002","友情提示:有一条隐患需要整改", - hidden.getString("CORPINFO_ID"),pd.getString("USER_ID"),hidden.getString("HIDDEN_ID"), - hidden.getString("HIDDENDESCR"),"隐患整改","整改","",""); - }else if("1".equals(hidden.getString("RECTIFICATIONTYPE"))){ - messageService.sendMessageByParameter("HIDDEN_MAIL_003","友情提示:有一条隐患已验收", - hidden.getString("CORPINFO_ID"),pd.getString("USER_ID"),hidden.getString("HIDDEN_ID"), - hidden.getString("HIDDENDESCR"),"通过","整改","",""); - } - List repulsecause = hiddenExamineService.findByHiddenId(pd);//确认人打回信息 - if(repulsecause.size()>0){ - for(PageData IDS:repulsecause){ - PageData repulse = new PageData(); - repulse.put("HIDDENEXAMINE_ID",IDS.getString("HIDDENEXAMINE_ID")); - hiddenExamineService.editrepulse(repulse); //有打回记录的隐患信息,把spare5改成1。确认通过后就不显示出来 - } - } + } + hiddenService.confirmHidden(editHidden); // 隐患确认 + if (Tools.notEmpty(pd.getString("RECTIFICATIONOR")) && !hidden.getString("RECTIFICATIONTYPE").equals("1")) { + messageService.sendMessageByParameter("HIDDEN_MAIL_002", "友情提示:有一条隐患需要整改", + hidden.getString("CORPINFO_ID"), pd.getString("USER_ID"), hidden.getString("HIDDEN_ID"), + hidden.getString("HIDDENDESCR"), "隐患整改", "整改", "", ""); + } else if ("1".equals(hidden.getString("RECTIFICATIONTYPE"))) { + messageService.sendMessageByParameter("HIDDEN_MAIL_003", "友情提示:有一条隐患已验收", + hidden.getString("CORPINFO_ID"), pd.getString("USER_ID"), hidden.getString("HIDDEN_ID"), + hidden.getString("HIDDENDESCR"), "通过", "整改", "", ""); + } + List repulsecause = hiddenExamineService.findByHiddenId(pd);//确认人打回信息 + if (repulsecause.size() > 0) { + for (PageData IDS : repulsecause) { + PageData repulse = new PageData(); + repulse.put("HIDDENEXAMINE_ID", IDS.getString("HIDDENEXAMINE_ID")); + hiddenExamineService.editrepulse(repulse); //有打回记录的隐患信息,把spare5改成1。确认通过后就不显示出来 + } + } - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - /** - * 获取隐患部位列表(菜单管理) - * @return - */ - @RequestMapping(value="/getTreehiddenRegionListAll") - @ResponseBody - public Object getTreehiddenRegionListAll()throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - JSONArray arr = JSONArray.fromObject(hiddenRegionService.listAll("0" , pd.getString("CORPINFO_ID"))); - String json = arr.toString(); - json = json.replaceAll("HIDDENREGION_ID", "id") - .replaceAll("PARENT_ID", "pId") - .replaceAll("HIDDENREGION", "name") - .replaceAll("subhiddenRegion", "children") - .replaceAll("hashiddenRegion", "checked") - .replaceAll("HIDDENREGION_URL", "url"); - map.put("zTreeNodes", json); - map.put("result", errInfo); - return map; - } + /** + * 获取隐患部位列表(菜单管理) + * + * @return + */ + @RequestMapping(value = "/getTreehiddenRegionListAll") + @ResponseBody + public Object getTreehiddenRegionListAll() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + JSONArray arr = JSONArray.fromObject(hiddenRegionService.listAll("0", pd.getString("CORPINFO_ID"))); + String json = arr.toString(); + json = json.replaceAll("HIDDENREGION_ID", "id") + .replaceAll("PARENT_ID", "pId") + .replaceAll("HIDDENREGION", "name") + .replaceAll("subhiddenRegion", "children") + .replaceAll("hashiddenRegion", "checked") + .replaceAll("HIDDENREGION_URL", "url"); + map.put("zTreeNodes", json); + map.put("result", errInfo); + return map; + } - /** - * 列表 - * - * @param page - * @throws Exception - */ - @RequestMapping(value = "/listForSafetyEnvironmental") - @ResponseBody - public Object listForSafetyEnvironmental(Page page) throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); + /** + * 列表 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/listForSafetyEnvironmental") + @ResponseBody + public Object listForSafetyEnvironmental(Page page) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); - page.setPd(pd); + page.setPd(pd); - List varList = hiddenService.listForSafetyEnvironmental(page); // 列出Hidden列表 - varList = hiddenUserService.getHiddebFind(varList); - //对于超期数据状态的 - varList.stream() - .filter(n -> "1".equals(n.getString("STATE"))) - .forEach(n -> { - String limit_date = n.getString("RECTIFICATIONDEADLINE"); - if (StringUtils.isNotBlank(limit_date)) { - if ("1".equals(n.getString("RECTIFICATIONTYPE"))) { - if (DateUtil.fomatDate(limit_date).getTime() < new Date().getTime()) - n.put("OVERTIME_FLAG", "1"); - } else { - if (DateUtil.fomatDate(limit_date).getTime() < new Date().getTime()) - n.put("OVERTIME_FLAG", "2"); - } - } - }); - map.put("varList", varList); - map.put("page", page); - map.put("result", errInfo); - return map; - } - /** - * 安全环保检查隐患指派 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/assign") - @ResponseBody - public Object assign() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); + List varList = hiddenService.listForSafetyEnvironmental(page); // 列出Hidden列表 + varList = hiddenUserService.getHiddebFind(varList); + //对于超期数据状态的 + varList.stream() + .filter(n -> "1".equals(n.getString("STATE"))) + .forEach(n -> { + String limit_date = n.getString("RECTIFICATIONDEADLINE"); + if (StringUtils.isNotBlank(limit_date)) { + if ("1".equals(n.getString("RECTIFICATIONTYPE"))) { + if (DateUtil.fomatDate(limit_date).getTime() < new Date().getTime()) + n.put("OVERTIME_FLAG", "1"); + } else { + if (DateUtil.fomatDate(limit_date).getTime() < new Date().getTime()) + n.put("OVERTIME_FLAG", "2"); + } + } + }); + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } + + /** + * 安全环保检查隐患指派 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/assign") + @ResponseBody + public Object assign() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); // PageData hidden = hiddenService.findById(pd); - pd.put("STATE", pd.getString("HIDDEN_STATUS")); - List list = hiddenService.listOtherNotAssign(pd); - PageData inspection = new PageData(); - inspection.put("INSPECTION_ID", pd.getString("INSPECTION_ID")); - inspection.put("OPERATOR", pd.getString("OPERATOR")); - inspection.put("OPERATTIME", DateUtil.date2Str(new Date())); - if ("-2".equals(pd.getString("HIDDEN_STATUS"))) { - pd.put("ISCONFIRM", "0"); // - pd.put("CONFIRM_TIME",DateUtil.date2Str(new Date())); - if (list.size() == 0) { - inspection.put("INSPECTION_STATUS", "5"); // 指派完成 - } else { - inspection.put("INSPECTION_STATUS", "4"); // 指派中 - } - safetyenvironmentalService.editStatus(inspection); - } - hiddenService.assign(pd); - if(Tools.notEmpty(pd.getString("CONFIRM_USER"))){ - messageService.sendMessageByParameter("HIDDEN_MAIL_001","友情提示:有一条隐患需要确定",pd.getString("CORPINFO_ID"), - pd.getString("CONFIRM_USER"),"", - pd.getString("HIDDENDESCR"),"隐患确认","确认","",""); - } - map.put("result", errInfo); - map.put("pd", pd); - return map; - } + pd.put("STATE", pd.getString("HIDDEN_STATUS")); + List list = hiddenService.listOtherNotAssign(pd); + PageData inspection = new PageData(); + inspection.put("INSPECTION_ID", pd.getString("INSPECTION_ID")); + inspection.put("OPERATOR", pd.getString("OPERATOR")); + inspection.put("OPERATTIME", DateUtil.date2Str(new Date())); + if ("-2".equals(pd.getString("HIDDEN_STATUS"))) { + pd.put("ISCONFIRM", "0"); // + pd.put("CONFIRM_TIME", DateUtil.date2Str(new Date())); + if (list.size() == 0) { + inspection.put("INSPECTION_STATUS", "5"); // 指派完成 + } else { + inspection.put("INSPECTION_STATUS", "4"); // 指派中 + } + safetyenvironmentalService.editStatus(inspection); + } + hiddenService.assign(pd); + if (Tools.notEmpty(pd.getString("CONFIRM_USER"))) { + messageService.sendMessageByParameter("HIDDEN_MAIL_001", "友情提示:有一条隐患需要确定", pd.getString("CORPINFO_ID"), + pd.getString("CONFIRM_USER"), "", + pd.getString("HIDDENDESCR"), "隐患确认", "确认", "", ""); + } + map.put("result", errInfo); + map.put("pd", pd); + return map; + } - /** - * 安全环保检查验收 - * - * @param - * @throws Exception - */ - @RequestMapping(value = "/finalcheck") - @ResponseBody - public Object finalcheck() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - hiddenService.finalcheck(pd); - if ("1".equals(pd.get("FINAL_CHECK").toString())) { - if (Tools.notEmpty(pd.getString("INSPECTION_ID"))) { //安全环保检查验收 - pd.put("ACCEPTSTEP", 7); - List list = hiddenService.listOtherNotAccept4pc(pd); - if (list.size() == 0) { - PageData inspection = new PageData(); - inspection.put("INSPECTION_ID", pd.getString("INSPECTION_ID")); - inspection.put("OPERATOR", pd.getString("FINAL_CHECKOR")); - inspection.put("OPERATTIME", DateUtil.date2Str(new Date())); - inspection.put("INSPECTION_STATUS", "8"); // 已验收 - safetyenvironmentalService.editStatus(inspection); - } - } - } else { - PageData pd2 = new PageData(); - pd2.put("FOREIGN_KEY", pd.get("HIDDEN_ID")); - pd2.put("TYPE", "4"); - List zgImgs = imgFilesService.listAll(pd2); - for (PageData pageData : zgImgs) { + /** + * 安全环保检查验收 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/finalcheck") + @ResponseBody + public Object finalcheck() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + hiddenService.finalcheck(pd); + if ("1".equals(pd.get("FINAL_CHECK").toString())) { + if (Tools.notEmpty(pd.getString("INSPECTION_ID"))) { //安全环保检查验收 + pd.put("ACCEPTSTEP", 7); + List list = hiddenService.listOtherNotAccept4pc(pd); + if (list.size() == 0) { + PageData inspection = new PageData(); + inspection.put("INSPECTION_ID", pd.getString("INSPECTION_ID")); + inspection.put("OPERATOR", pd.getString("FINAL_CHECKOR")); + inspection.put("OPERATTIME", DateUtil.date2Str(new Date())); + inspection.put("INSPECTION_STATUS", "8"); // 已验收 + safetyenvironmentalService.editStatus(inspection); + } + } + } else { + PageData pd2 = new PageData(); + pd2.put("FOREIGN_KEY", pd.get("HIDDEN_ID")); + pd2.put("TYPE", "4"); + List zgImgs = imgFilesService.listAll(pd2); + for (PageData pageData : zgImgs) { - imgFilesService.delete(pageData); - if(Tools.notEmpty(pageData.getString("FILEPATH"))) { - Smb.deleteFile(pageData.getString("FILEPATH")); - } - } - PageData hidden = new PageData(); - hidden.put("HIDDEN_ID", pd.get("HIDDEN_ID")); - hidden.put("STATE", "101"); //修改隐患表状态为验收打回 - hiddenService.changeState(hidden); + imgFilesService.delete(pageData); + if (Tools.notEmpty(pageData.getString("FILEPATH"))) { + Smb.deleteFile(pageData.getString("FILEPATH")); + } + } + PageData hidden = new PageData(); + hidden.put("HIDDEN_ID", pd.get("HIDDEN_ID")); + hidden.put("STATE", "101"); //修改隐患表状态为验收打回 + hiddenService.changeState(hidden); - PageData inspection = new PageData(); - inspection.put("INSPECTION_ID", pd.getString("INSPECTION_ID")); - inspection.put("OPERATOR", pd.getString("FINAL_CHECKOR")); - inspection.put("OPERATTIME", DateUtil.date2Str(new Date())); - inspection.put("INSPECTION_STATUS", "3"); // 安全环保检查打回到归档,隐患待指派 - safetyenvironmentalService.editStatus(inspection); + PageData inspection = new PageData(); + inspection.put("INSPECTION_ID", pd.getString("INSPECTION_ID")); + inspection.put("OPERATOR", pd.getString("FINAL_CHECKOR")); + inspection.put("OPERATTIME", DateUtil.date2Str(new Date())); + inspection.put("INSPECTION_STATUS", "3"); // 安全环保检查打回到归档,隐患待指派 + safetyenvironmentalService.editStatus(inspection); - inspection.put("SENDER_ID",pd.getString("FINAL_CHECKOR")); - inspection.put("SENDER_NAME",pd.getString("FINAL_CHECKOR")); - noticeUtil.SE_Repulse(inspection); - // hiddenExamineService.deleteByHiddenId(pd); //如果验收打回删除隐患相关信息 + inspection.put("SENDER_ID", pd.getString("FINAL_CHECKOR")); + inspection.put("SENDER_NAME", pd.getString("FINAL_CHECKOR")); + noticeUtil.SE_Repulse(inspection); + // hiddenExamineService.deleteByHiddenId(pd); //如果验收打回删除隐患相关信息 // hidden.put("HIDDENEXAMINE_ID",this.get32UUID()); // hidden.put("EXAMINE",pd.get("CONTENT"));//打回意见 // hidden.put("CREATOR",pd.getString("FINAL_CHECKOR")); @@ -1699,89 +1722,91 @@ public class AppHiddenController extends BaseController { // hidden.put("TYPE",3);//验收打回 // hidden.put("STATE",-1);//验收打回变成初始状态-1 // hiddenExamineService.saveApp(hidden); - } - map.put("check", pd); - map.put("result", errInfo); - return map; - } + } + map.put("check", pd); + map.put("result", errInfo); + return map; + } - /** - * 隐患确认打回 - * @param - * @throws Exception - */ - @RequestMapping(value = "/repulseHidden") - //@RequiresPermissions("hidden:edit") - @ResponseBody - public Object repulseHidden() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - hiddenService.editstate(pd); - pd.put("HIDDENEXAMINE_ID", UuidUtil.get32UUID()); - pd.put("CREATTIME", DateUtil.date2Str(new Date())); - pd.put("OPERATTIME",DateUtil.date2Str(new Date())); - hiddenExamineService.saverepulse(pd); - hiddenMailService.reject(pd); - map.put("result",errInfo); - return map; - } + /** + * 隐患确认打回 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/repulseHidden") + //@RequiresPermissions("hidden:edit") + @ResponseBody + public Object repulseHidden() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + hiddenService.editstate(pd); + pd.put("HIDDENEXAMINE_ID", UuidUtil.get32UUID()); + pd.put("CREATTIME", DateUtil.date2Str(new Date())); + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); + hiddenExamineService.saverepulse(pd); + hiddenMailService.reject(pd); + map.put("result", errInfo); + return map; + } - /** - * 列表 - * - * @param page - * @throws Exception - */ - @RequestMapping(value = "/listV2") - @ResponseBody - public Object listV2() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - Page page = new Page(); - pd = this.getPageData(); - page.setCurrentPage(Integer.parseInt(pd.get("currentPage").toString())); - page.setShowCount(Integer.parseInt(pd.get("showCount").toString())); - page.setTotalResult(Integer.parseInt(pd.get("totalResult").toString())); + /** + * 列表 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/listV2") + @ResponseBody + public Object listV2() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + Page page = new Page(); + pd = this.getPageData(); + page.setCurrentPage(Integer.parseInt(pd.get("currentPage").toString())); + page.setShowCount(Integer.parseInt(pd.get("showCount").toString())); + page.setTotalResult(Integer.parseInt(pd.get("totalResult").toString())); - pd.put("CORPINFO_ID",pd.getString("CORPINFO_ID")); - pd.put("queryUserId",pd.getString("SELFUSERID")); - page.setPd(pd); - List varList = hiddenService.getListForTianzhang(page); // 列出Hidden列表 - varList = hiddenUserService.getHiddebFind(varList); - map.put("varList", varList); - map.put("page", page); - map.put("result", errInfo); - return map; - } + pd.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); + pd.put("queryUserId", pd.getString("SELFUSERID")); + page.setPd(pd); + List varList = hiddenService.getListForTianzhang(page); // 列出Hidden列表 + varList = hiddenUserService.getHiddebFind(varList); + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } - /** - * 判断登录人是否已经验收 - * @param - * @throws Exception - */ - @RequestMapping(value = "/isChek") - //@RequiresPermissions("hidden:edit") - @ResponseBody - public Object isChek() throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - List checkList = hiddenCheckService.findByHidden(pd); - if(checkList.size()>0){ - for(PageData arr:checkList){ - if(arr.getString("STATUS").equals("1")){ - map.put("istrue","1"); - } else if (arr.getString("STATUS").equals("0")){ - map.put("istrue","0"); - } - } - } - map.put("result",errInfo); - return map; - } + /** + * 判断登录人是否已经验收 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/isChek") + //@RequiresPermissions("hidden:edit") + @ResponseBody + public Object isChek() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + List checkList = hiddenCheckService.findByHidden(pd); + if (checkList.size() > 0) { + for (PageData arr : checkList) { + if (arr.getString("STATUS").equals("1")) { + map.put("istrue", "1"); + } else if (arr.getString("STATUS").equals("0")) { + map.put("istrue", "0"); + } + } + } + map.put("result", errInfo); + return map; + } } diff --git a/src/main/java/com/zcloud/controller/app/AppImgFilesController.java b/src/main/java/com/zcloud/controller/app/AppImgFilesController.java index 526cc82c..cd490554 100644 --- a/src/main/java/com/zcloud/controller/app/AppImgFilesController.java +++ b/src/main/java/com/zcloud/controller/app/AppImgFilesController.java @@ -7,6 +7,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import com.zcloud.aspect.DockAnnotation; +import com.zcloud.dto.TenCorpDto; +import com.zcloud.service.mq.DockSendMessageService; import com.zcloud.util.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -34,327 +37,357 @@ import com.zcloud.service.bus.ImgFilesService; @RequestMapping("/app/imgfiles") public class AppImgFilesController extends BaseController { - @Autowired - private ImgFilesService imgfilesService; + @Autowired + private ImgFilesService imgfilesService; + @Autowired + private DockSendMessageService dockSendMessageService; - /**完成 - * @param - * @throws Exception - */ - @RequestMapping(value="/add", headers = "content-type=multipart/form-data") - @ResponseBody - @Transactional - public Object finish( - @RequestParam(value="FFILE",required=false) MultipartFile[] files, - @RequestParam(value="TYPE",required=false) String TYPE, - @RequestParam(value="FOREIGN_KEY",required=false) String FOREIGN_KEY - ) throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; + /** + * 完成 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/add", headers = "content-type=multipart/form-data") + @ResponseBody + @Transactional + @DockAnnotation(hasAnnex = true) + public Object finish( + @RequestParam(value = "FFILE", required = false) MultipartFile[] files, + @RequestParam(value = "TYPE", required = false) String TYPE, + @RequestParam(value = "FOREIGN_KEY", required = false) String FOREIGN_KEY + ) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; if (files != null && files.length > 0) { - for (int i = 0; i < files.length; i++) { - String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); - if (!"json".equals(suffixName) && !"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; - } - } + for (int i = 0; i < files.length; i++) { + String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".") + 1).toLowerCase(); + if (!"json".equals(suffixName) && !"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; + } + } for (int i = 0; i < files.length; i++) { MultipartFile file = files[i]; // 保存文件 File tempFile = new File(file.getOriginalFilename()); - FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); - if(!FileUpload.isImage(tempFile) && !TYPE.equals("2") && !TYPE.equals("102")) {//四色图改为json文件,不用判断类型 - tempFile.delete(); - map.put("result", "failed"); - map.put("exception", "上传图片格式不正确,请重新上传"); - return map; - } - if (tempFile.exists()) { - tempFile.delete(); - } + FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); + if (!FileUpload.isImage(tempFile) && !TYPE.equals("2") && !TYPE.equals("102")) {//四色图改为json文件,不用判断类型 + tempFile.delete(); + map.put("result", "failed"); + map.put("exception", "上传图片格式不正确,请重新上传"); + return map; + } + if (tempFile.exists()) { + tempFile.delete(); + } - if(TYPE.equals("2") || TYPE.equals("102")) {//先删除原四色图 - PageData pd2 = new PageData(); - pd2.put("FOREIGN_KEY",FOREIGN_KEY); - pd2.put("TYPE",TYPE); - List four = imgfilesService.listAll(pd2); - for (PageData pageData : four) { - File old = new File(PathUtil.getProjectpath()+pageData.getString("FILEPATH")); - old.delete(); - imgfilesService.delete(pageData); - } - } - PageData pd = new PageData(); - pd = this.getPageData(); - String ffile = DateUtil.getDays(); + if (TYPE.equals("2") || TYPE.equals("102")) {//先删除原四色图 + PageData pd2 = new PageData(); + pd2.put("FOREIGN_KEY", FOREIGN_KEY); + pd2.put("TYPE", TYPE); + List four = imgfilesService.listAll(pd2); + for (PageData pageData : four) { + File old = new File(PathUtil.getProjectpath() + pageData.getString("FILEPATH")); + old.delete(); + imgfilesService.delete(pageData); + pageData.put("delete","1"); + TenCorpDto tenCorpDto = new TenCorpDto(); + tenCorpDto.setMessage("删除文件消息"); + tenCorpDto.setId(UuidUtil.get32UUID()); + tenCorpDto.setTopic("docking"); + tenCorpDto.setProducer_name("qa-prevention-czks"); + tenCorpDto.setData(pageData); + dockSendMessageService.sendMessagePictureDelete(tenCorpDto); + } + } + PageData pd = new PageData(); + pd = this.getPageData(); + String ffile = DateUtil.getDays(); // String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径 // String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传 - String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - Smb.sshSftp(file, fileName,Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); - - pd.put("IMGFILES_ID", this.get32UUID()); - pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); - pd.put("TYPE", TYPE); - pd.put("FOREIGN_KEY", FOREIGN_KEY); - imgfilesService.save(pd); + String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + String IMGFILES_ID = this.get32UUID(); + pd.put("IMGFILES_ID", IMGFILES_ID); + pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); + pd.put("TYPE", TYPE); + pd.put("FOREIGN_KEY", FOREIGN_KEY); + Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile, IMGFILES_ID, FOREIGN_KEY, TYPE); + imgfilesService.save(pd); } } - - map.put("result", errInfo); - return map; - } + map.put("result", errInfo); + return map; + } - /**新增 - * @param - * @throws Exception - */ - @RequestMapping(value="/add64") - @ResponseBody - public Object add64() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("FILEPATH")); - String suffixName = img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); - if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { - errInfo = "fail"; - map.put("result", errInfo); - map.put("msg", "文件格式不正确!"); - return map; - } - String ffile = DateUtil.getDays(); - String fileName = this.get32UUID()+img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".")); - Smb.sshSftp(img, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); - pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); - pd.put("IMGFILES_ID", this.get32UUID()); - pd.put("TYPE", pd.getString("TYPE")); - pd.put("FOREIGN_KEY", pd.getString("FOREIGN_KEY")); - imgfilesService.save(pd); - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + /** + * 新增 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/add64") + @ResponseBody + public Object add64() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("FILEPATH")); + String suffixName = img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase(); + if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { + errInfo = "fail"; + map.put("result", errInfo); + map.put("msg", "文件格式不正确!"); + return map; + } + String ffile = DateUtil.getDays(); + String fileName = this.get32UUID() + img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".")); + Smb.sshSftp(img, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); + pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); + pd.put("IMGFILES_ID", this.get32UUID()); + pd.put("TYPE", pd.getString("TYPE")); + pd.put("FOREIGN_KEY", pd.getString("FOREIGN_KEY")); + imgfilesService.save(pd); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - /**完成 - * @param - * @throws Exception - */ - @RequestMapping(value="/edit", headers = "content-type=multipart/form-data") - @ResponseBody - @Transactional - public Object edit( - @RequestParam(value="FFILE",required=false) MultipartFile[] files, - @RequestParam(value="TYPE",required=false) String TYPE, - @RequestParam(value="FOREIGN_KEY",required=false) String FOREIGN_KEY - ) throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; + /** + * 完成 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/edit", headers = "content-type=multipart/form-data") + @ResponseBody + @Transactional + public Object edit( + @RequestParam(value = "FFILE", required = false) MultipartFile[] files, + @RequestParam(value = "TYPE", required = false) String TYPE, + @RequestParam(value = "FOREIGN_KEY", required = false) String FOREIGN_KEY + ) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; if (files != null && files.length > 0) { - for (int i = 0; i < files.length; i++) { - String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); - if (!"json".equals(suffixName) && !"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; - } - } - PageData pd2 = new PageData(); - pd2.put("FOREIGN_KEY",FOREIGN_KEY); - pd2.put("TYPE",TYPE); - List four = imgfilesService.listAll(pd2); - for (PageData pageData : four) { - File old = new File(PathUtil.getProjectpath()+pageData.getString("FILEPATH")); - old.delete(); - imgfilesService.delete(pageData); - } + for (int i = 0; i < files.length; i++) { + String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".") + 1).toLowerCase(); + if (!"json".equals(suffixName) && !"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; + } + } + PageData pd2 = new PageData(); + pd2.put("FOREIGN_KEY", FOREIGN_KEY); + pd2.put("TYPE", TYPE); + List four = imgfilesService.listAll(pd2); + for (PageData pageData : four) { + File old = new File(PathUtil.getProjectpath() + pageData.getString("FILEPATH")); + old.delete(); + imgfilesService.delete(pageData); + } for (int i = 0; i < files.length; i++) { MultipartFile file = files[i]; // 保存文件 File tempFile = new File(file.getOriginalFilename()); - FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); - if(!FileUpload.isImage(tempFile) && !TYPE.equals("2")) {//四色图改为json文件,不用判断类型 - tempFile.delete(); - map.put("result", "failed"); - map.put("exception", "上传图片格式不正确,请重新上传"); - return map; - } - if (tempFile.exists()) { - tempFile.delete(); - } - PageData pd = new PageData(); - pd = this.getPageData(); - String ffile = DateUtil.getDays(); + FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); + if (!FileUpload.isImage(tempFile) && !TYPE.equals("2")) {//四色图改为json文件,不用判断类型 + tempFile.delete(); + map.put("result", "failed"); + map.put("exception", "上传图片格式不正确,请重新上传"); + return map; + } + if (tempFile.exists()) { + tempFile.delete(); + } + PageData pd = new PageData(); + pd = this.getPageData(); + String ffile = DateUtil.getDays(); // String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径 // String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传 - String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - Smb.sshSftp(file, fileName,Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); + String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); - pd.put("IMGFILES_ID", this.get32UUID()); - pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); - pd.put("TYPE", TYPE); - pd.put("FOREIGN_KEY", FOREIGN_KEY); - imgfilesService.save(pd); + pd.put("IMGFILES_ID", this.get32UUID()); + pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); + pd.put("TYPE", TYPE); + pd.put("FOREIGN_KEY", FOREIGN_KEY); + imgfilesService.save(pd); } } - map.put("result", errInfo); - return map; - } + map.put("result", errInfo); + return map; + } - /**删除 - * @param out - * @throws Exception - */ - @RequestMapping(value="/delete") - @ResponseBody - public Object delete() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd = imgfilesService.findById(pd); //根据ID读取 - File file = new File(PathUtil.getProjectpath()+pd.getString("FILEPATH")); - file.delete(); - imgfilesService.delete(pd); - map.put("result", errInfo); //返回结果 - return map; - } + /** + * 删除 + * + * @param out + * @throws Exception + */ + @RequestMapping(value = "/delete") + @ResponseBody + public Object delete() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd = imgfilesService.findById(pd); //根据ID读取 + File file = new File(PathUtil.getProjectpath() + pd.getString("FILEPATH")); + file.delete(); + imgfilesService.delete(pd); + map.put("result", errInfo); //返回结果 + return map; + } - /**修改 - * @param - * @throws Exception - */ - @RequestMapping(value="/edit") - @RequiresPermissions("imgfiles:edit") - @ResponseBody - public Object edit() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - imgfilesService.edit(pd); - map.put("result", errInfo); - return map; - } + /** + * 修改 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/edit") + @RequiresPermissions("imgfiles:edit") + @ResponseBody + public Object edit() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + imgfilesService.edit(pd); + map.put("result", errInfo); + return map; + } - /**列表 - * @param page - * @throws Exception - */ - @RequestMapping(value="/list") - @RequiresPermissions("imgfiles: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 = imgfilesService.list(page); //列出ImgFiles列表 - map.put("varList", varList); - map.put("page", page); - map.put("result", errInfo); - return map; - } + /** + * 列表 + * + * @param page + * @throws Exception + */ + @RequestMapping(value = "/list") + @RequiresPermissions("imgfiles: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 = imgfilesService.list(page); //列出ImgFiles列表 + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } - /**去修改页面获取数据 - * @param - * @throws Exception - */ - @RequestMapping(value="/goEdit") - @RequiresPermissions("imgfiles:edit") - @ResponseBody - public Object goEdit() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - pd = imgfilesService.findById(pd); //根据ID读取 - map.put("pd", pd); - map.put("result", errInfo); - return map; - } + /** + * 去修改页面获取数据 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/goEdit") + @RequiresPermissions("imgfiles:edit") + @ResponseBody + public Object goEdit() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd = imgfilesService.findById(pd); //根据ID读取 + map.put("pd", pd); + map.put("result", errInfo); + return map; + } - /**批量删除 - * @param - * @throws Exception - */ - @RequestMapping(value="/deleteAll") - @RequiresPermissions("imgfiles:del") - @ResponseBody - public Object deleteAll() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - String DATA_IDS = pd.getString("DATA_IDS"); - if(Tools.notEmpty(DATA_IDS)){ - String ArrayDATA_IDS[] = DATA_IDS.split(","); - imgfilesService.deleteAll(ArrayDATA_IDS); - errInfo = "success"; - }else{ - errInfo = "fail"; - } - map.put("result", errInfo); //返回结果 - return map; - } + /** + * 批量删除 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/deleteAll") + @RequiresPermissions("imgfiles:del") + @ResponseBody + public Object deleteAll() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + String DATA_IDS = pd.getString("DATA_IDS"); + if (Tools.notEmpty(DATA_IDS)) { + String ArrayDATA_IDS[] = DATA_IDS.split(","); + imgfilesService.deleteAll(ArrayDATA_IDS); + 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 - dataMap.put("titles", titles); - List varOList = imgfilesService.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 + dataMap.put("titles", titles); + List varOList = imgfilesService.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("FILEPATH")); //1 + vpd.put("var2", varOList.get(i).get("TYPE").toString()); //2 + vpd.put("var3", varOList.get(i).getString("FOREIGN_KEY")); //3 + varList.add(vpd); + } + dataMap.put("varList", varList); + ObjectExcelView erv = new ObjectExcelView(); + mv = new ModelAndView(erv, dataMap); + return mv; + } - /**查询图片集合 - * @param - * @throws Exception - */ - @RequestMapping(value="/listImgs") - @ResponseBody - public Object listImgs() throws Exception{ - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - List imgs = imgfilesService.listAll(pd); //根据ID读取 - map.put("imgs", imgs); - map.put("result", errInfo); - return map; - } + /** + * 查询图片集合 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/listImgs") + @ResponseBody + public Object listImgs() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + List imgs = imgfilesService.listAll(pd); //根据ID读取 + map.put("imgs", imgs); + map.put("result", errInfo); + return map; + } } diff --git a/src/main/java/com/zcloud/controller/filemanager/MfolderController.java b/src/main/java/com/zcloud/controller/filemanager/MfolderController.java index 85211206..7708001e 100644 --- a/src/main/java/com/zcloud/controller/filemanager/MfolderController.java +++ b/src/main/java/com/zcloud/controller/filemanager/MfolderController.java @@ -118,7 +118,9 @@ public class MfolderController extends BaseController { pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 mfolderService.save(pd); //存入数据库表 //存自己表里的附件 使用文件全路径加文件名的方式 示例 - // /uploadFiles/yhtp/8415df13cc4c46f0ac32f579462dbb8f/20231215/d3bc85d1bbe84b75b1e6e8b6182dc547.jpg@@d3bc85d1bbe84b75b1e6e8b6182dc547.jpg + // /uploadFiles/yhtp/8415df13cc4c46f0ac32f579462dbb8f/20231215/d3bc85d1bbe84b75b1e6e8b6182dc547.jpg + // @@ + // d3bc85d1bbe84b75b1e6e8b6182dc547.jpg pictureList.add(Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName+ "@@" +fileName); diff --git a/src/main/java/com/zcloud/controller/firemanager/FireResourcesController.java b/src/main/java/com/zcloud/controller/firemanager/FireResourcesController.java new file mode 100644 index 00000000..cc420ca7 --- /dev/null +++ b/src/main/java/com/zcloud/controller/firemanager/FireResourcesController.java @@ -0,0 +1,95 @@ +package com.zcloud.controller.firemanager; + +import com.zcloud.controller.base.BaseController; +import com.zcloud.entity.Page; +import com.zcloud.entity.PageData; +import com.zcloud.service.fireresources.FireResourcesService; +import com.zcloud.util.DateUtil; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@RequestMapping("/fireResources") +public class FireResourcesController extends BaseController { + + @Resource + private FireResourcesService fireResourcesService; + @RequestMapping(value = "/list") + @ResponseBody + public Object page(Page page) { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = this.getPageData(); + page.setPd(pd); + //获取当前人的公司id + List varList = fireResourcesService.datalistPage(page); + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } + + @RequestMapping(value = "/getById") + @ResponseBody + public Object getById() { + Map map = new HashMap(); + String errInfo = "success"; + PageData pddata = this.getPageData(); + //获取当前人的公司id + PageData pd = fireResourcesService.getDataById(pddata); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } + + @RequestMapping(value = "/add") + @ResponseBody + public Object add(@RequestParam(value="FFILE",required=false) MultipartFile[] files) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = this.getPageData(); + String FIRERESOURCES_ID = this.get32UUID(); + pd.put("FIRERESOURCES_ID", FIRERESOURCES_ID); + pd.put("CREATIME", DateUtil.date2Str(new Date())); + pd.put("OPERATIME", DateUtil.date2Str(new Date())); + pd.put("ISDELETE", "0"); + fireResourcesService.save(pd,files); + map.put("result", errInfo); + return map; + } + + @RequestMapping(value = "/edit") + @ResponseBody + public Object edit(@RequestParam(value="FFILE",required=false) MultipartFile[] files) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("OPERATIME", DateUtil.date2Str(new Date())); + pd.put("ISDELETE", "0"); + fireResourcesService.edit(pd,files); + map.put("result", errInfo); + return map; + } + + @RequestMapping(value = "/delete") + @ResponseBody + public Object delete(Page page) { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + fireResourcesService.delete(pd); + map.put("result", errInfo); + return map; + } +} diff --git a/src/main/java/com/zcloud/controller/firemanager/app/AppFireRecordController.java b/src/main/java/com/zcloud/controller/firemanager/app/AppFireRecordController.java index 47c547dc..c4a5f934 100644 --- a/src/main/java/com/zcloud/controller/firemanager/app/AppFireRecordController.java +++ b/src/main/java/com/zcloud/controller/firemanager/app/AppFireRecordController.java @@ -1,12 +1,16 @@ package com.zcloud.controller.firemanager.app; import com.alibaba.fastjson.JSONObject; +import com.zcloud.aspect.DockAnnotation; import com.zcloud.controller.base.BaseController; +import com.zcloud.dto.TenCorpDto; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.mapper.datasource.firemanager.FireDeviceMapper; import com.zcloud.service.bus.ImgFilesService; import com.zcloud.service.firemanager.*; +import com.zcloud.service.mq.DockSendMessageService; +import com.zcloud.service.mq.SendMessageService; import com.zcloud.util.DateUtil; import com.zcloud.util.InitPageDataUtil; import com.zcloud.util.Jurisdiction; @@ -35,7 +39,8 @@ public class AppFireRecordController extends BaseController { @Resource private ImgFilesService imgFilesService; - + @Resource + private DockSendMessageService dockSendMessageService; @Resource private FireCheckStandardService fireCheckStandardService; @Autowired @@ -47,7 +52,6 @@ public class AppFireRecordController extends BaseController { @Autowired private FirePointService firePointService; - @Resource private InitPageDataUtil initPageDataUtil; @@ -67,7 +71,7 @@ public class AppFireRecordController extends BaseController { Map map = new HashMap(); String errInfo = "success"; PageData pageData = this.getPageData(); - pageData.put("TYPE",115); + pageData.put("TYPE", 115); List dataList = fireQualifiedPhotosService.getPointQualifiedPhotos(pageData); map.put("varList", dataList); map.put("result", errInfo); @@ -134,6 +138,7 @@ public class AppFireRecordController extends BaseController { map.put("result", errInfo); return map; } + /** * @Description: 清单列表总数 * @Author: dearLin @@ -173,6 +178,7 @@ public class AppFireRecordController extends BaseController { map.put("varList", res); return map; } + /** * @Description: 所有清单的检查记录最外层 * @Author: dearLin @@ -194,6 +200,7 @@ public class AppFireRecordController extends BaseController { map.put("varList", res); return map; } + /** * @Description: 清单下的检查记录 * @Author: dearLin @@ -274,7 +281,7 @@ public class AppFireRecordController extends BaseController { String errInfo = "success"; Map map = new HashMap(); PageData pageData = this.getPageData(); - ListvarList = fireRecordService.getDeviceRecordByPoint(pageData); + List varList = fireRecordService.getDeviceRecordByPoint(pageData); map.put("varList", varList); map.put("result", errInfo); return map; @@ -306,41 +313,41 @@ public class AppFireRecordController extends BaseController { * @Return: java.lang.Object */ @RequestMapping("/editDeviceCheck") + @DockAnnotation public Object editDeviceCheck() throws Exception { String errInfo = "success"; Map map = new HashMap(); PageData pd = this.getPageData(); List list = JSONObject.parseArray(pd.getString("CHECK_DATA"), PageData.class); + ArrayList dataArrayList = new ArrayList<>(); // 点位下设备检查记录 list.forEach(itemCheck -> { PageData itemCheckData = new PageData(); itemCheckData.putAll(itemCheck); itemCheckData.put("FOREIGN_KEY", itemCheck.getString("EQUIPMENT_RECORD_ID")); itemCheckData.put("TYPE", "14"); - List data = null; - try { - data = imgFilesService.listAll(itemCheckData); - } catch (Exception e) { - throw new RuntimeException(e); - } + List data = imgFilesService.listAll(itemCheckData); // 不合格 if (!"0".equals(itemCheckData.getString("ISNORMAL"))) { // 删除合格得照片 data.forEach(item -> { + imgFilesService.delete(item); + TenCorpDto tenCorpDto = new TenCorpDto(); + tenCorpDto.setData(item); try { - imgFilesService.delete(item); + dockSendMessageService.sendMessagePictureDelete(tenCorpDto); } catch (Exception e) { throw new RuntimeException(e); } + }); } fireRecordService.editDeviceCheckByApp(itemCheckData); - + dataArrayList.add(itemCheckData); }); - // todo 校验一下有没有点位图片 - -// fireRecordService.modifyPointRecord(pd); map.put("result", errInfo); + pd.put("dataArrayList",dataArrayList); + map.put("dockData", pd); return map; } @@ -352,12 +359,14 @@ public class AppFireRecordController extends BaseController { * @Return: java.lang.Object */ @RequestMapping("/editDeviceCheckFine") + @DockAnnotation public Object editDeviceCheckFine() throws Exception { String errInfo = "success"; Map map = new HashMap(); PageData pd = this.getPageData(); fireRecordService.modifyPointRecord(pd); map.put("result", errInfo); + map.put("dockData", pd); return map; } @@ -542,7 +551,7 @@ public class AppFireRecordController extends BaseController { if (deviceListByPointId.size() > 0) { deviceListByPointId.forEach(item -> { String[] fireCheckStandardItems = item.getString("FIRE_CHECK_STANDARD_ITEM").split("@@"); - item.put("FIRE_CHECK_STANDARD_ITEM",fireCheckStandardItems); + item.put("FIRE_CHECK_STANDARD_ITEM", fireCheckStandardItems); }); } diff --git a/src/main/java/com/zcloud/service/bus/ImgFilesService.java b/src/main/java/com/zcloud/service/bus/ImgFilesService.java index 111f5eb8..56734cc6 100644 --- a/src/main/java/com/zcloud/service/bus/ImgFilesService.java +++ b/src/main/java/com/zcloud/service/bus/ImgFilesService.java @@ -23,7 +23,7 @@ public interface ImgFilesService{ * @param pd * @throws Exception */ - public void delete(PageData pd)throws Exception; + public void delete(PageData pd); /**删除 * @param pd @@ -47,7 +47,7 @@ public interface ImgFilesService{ * @param pd * @throws Exception */ - public List listAll(PageData pd)throws Exception; + public List listAll(PageData pd); /**通过id获取数据 * @param pd diff --git a/src/main/java/com/zcloud/service/bus/impl/ImgFilesServiceImpl.java b/src/main/java/com/zcloud/service/bus/impl/ImgFilesServiceImpl.java index a4e45627..25909c6d 100644 --- a/src/main/java/com/zcloud/service/bus/impl/ImgFilesServiceImpl.java +++ b/src/main/java/com/zcloud/service/bus/impl/ImgFilesServiceImpl.java @@ -5,6 +5,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import com.zcloud.dto.TenCorpDto; +import com.zcloud.service.mq.DockSendMessageService; import com.zcloud.util.*; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -28,7 +30,8 @@ public class ImgFilesServiceImpl implements ImgFilesService{ @Autowired private ImgFilesMapper imgfilesMapper; - + @Autowired + private DockSendMessageService dockSendMessageService; /**新增 * @param pd * @throws Exception @@ -41,8 +44,10 @@ public class ImgFilesServiceImpl implements ImgFilesService{ * @param pd * @throws Exception */ - public void delete(PageData pd)throws Exception{ + @Override + public void delete(PageData pd){ imgfilesMapper.delete(pd); + } /**删除 diff --git a/src/main/java/com/zcloud/service/mq/DockSendMessageService.java b/src/main/java/com/zcloud/service/mq/DockSendMessageService.java index 64d3b3e3..225f9b01 100644 --- a/src/main/java/com/zcloud/service/mq/DockSendMessageService.java +++ b/src/main/java/com/zcloud/service/mq/DockSendMessageService.java @@ -6,6 +6,7 @@ public interface DockSendMessageService { void sendMessage(TenCorpDto tenCorpDto) throws Exception; void sendMessagePicture(TenCorpDto tenCorpDto) throws Exception; + void sendMessagePictureDelete(TenCorpDto tenCorpDto) throws Exception; void SendDelayQueue(TenCorpDto tenCorpDto); void SendDelayQueue(String message); diff --git a/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java b/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java index cc2cc2b0..97d7b5ca 100644 --- a/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java +++ b/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java @@ -84,6 +84,29 @@ public class DockSendMessageServiceImpl implements DockSendMessageService { } } + @Override + public void sendMessagePictureDelete(TenCorpDto tenCorpDto) throws Exception { + try { + PageData log = tenCorpDto.getPd(); + log.put("MESSAGE_LOG_ID", Warden.get32UUID()); + log.put("CREATE_TIME", DateUtil.getTime()); + mqMessageLogMapper.save(log); + System.out.println("生产者:" + tenCorpDto.toString()); + SendResult sendResult = rocketMQTemplate.syncSend(this.dockingPicture, tenCorpDto.toString()); + if (!sendResult.getSendStatus().equals(SendStatus.SEND_OK)) { + throw new RuntimeException("产品入栈失败"); + } + } catch (Exception e) { + e.printStackTrace(); + PageData log = tenCorpDto.getPd(); + log.put("MESSAGE_ERROR_LOG_ID", Warden.get32UUID()); + log.put("ERROR_MESSAGE", e.getMessage()); + log.put("TYPE", "0"); + log.put("TIME", DateUtil.getTime()); + mqErrorMessageLogMapper.save(log); + } + } + @Override public void SendDelayQueue(TenCorpDto tenCorpDto) { PageData log = tenCorpDto.getPd();