diff --git a/src/main/java/com/zcloud/controller/app/highriskwork/AppHotworkCfdController.java b/src/main/java/com/zcloud/controller/app/highriskwork/AppHotworkCfdController.java index d02cbabd..13d0c4e2 100644 --- a/src/main/java/com/zcloud/controller/app/highriskwork/AppHotworkCfdController.java +++ b/src/main/java/com/zcloud/controller/app/highriskwork/AppHotworkCfdController.java @@ -650,33 +650,33 @@ public class AppHotworkCfdController extends BaseController { * @param * @throws Exception */ - @RequestMapping(value = "/editAcceptconfess") - @ResponseBody - @Transactional - @LogAnno(menuType = "手机", menuServer = "动土作业", instructionsOperate = "动土作业", instructionsType = "修改") - public Object editAcceptconfess(MultipartRequest request) throws Exception { - Map map = new HashMap(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - PageData pd2 = new PageData(); - pd2 = hotworkCfdService.findById(pd); - pd2.put("OPERATOR", pd.get("OPERATOR")); //修改人 - pd2.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - List fileList = new ArrayList(); - String signertime = ""; - String SIGNTIME[] = pd.getString("SIGNTIME").split(","); - - for (int i = 0; i < SIGNTIME.length; i++) { - signertime = SIGNTIME[i]; - fileList.add(request.getFile("file" + i)); - MultipartFile[] fileArr = new MultipartFile[fileList.size()]; - saveImg(fileList.toArray(fileArr), signertime, pd.getString("HOTWORK_ID"), pd.getString("CORPINFO_ID"), pd.getString("ACCEPT_CONFESS_USER_ID"), pd.getString("ACCEPT_CONFESS_DEPARTMENT_ID")); - fileList.clear(); - } - map.put("result", errInfo); - return map; - } +// @RequestMapping(value = "/editAcceptconfess") +// @ResponseBody +// @Transactional +// @LogAnno(menuType = "手机", menuServer = "动土作业", instructionsOperate = "动土作业", instructionsType = "修改") +// public Object editAcceptconfess(MultipartRequest request) throws Exception { +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = new PageData(); +// pd = this.getPageData(); +// PageData pd2 = new PageData(); +// pd2 = hotworkCfdService.findById(pd); +// pd2.put("OPERATOR", pd.get("OPERATOR")); //修改人 +// pd2.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 +// List fileList = new ArrayList(); +// String signertime = ""; +// String SIGNTIME[] = pd.getString("SIGNTIME").split(","); +// +// for (int i = 0; i < SIGNTIME.length; i++) { +// signertime = SIGNTIME[i]; +// fileList.add(request.getFile("file" + i)); +// MultipartFile[] fileArr = new MultipartFile[fileList.size()]; +// saveImg(fileList.toArray(fileArr), signertime, pd.getString("HOTWORK_ID"), pd.getString("CORPINFO_ID"), pd.getString("ACCEPT_CONFESS_USER_ID"), pd.getString("ACCEPT_CONFESS_DEPARTMENT_ID")); +// fileList.clear(); +// } +// map.put("result", errInfo); +// return map; +// } private void saveImg(MultipartFile[] files, String signertime, String HOTWORK_ID, String CORPINFO_ID, String ACCEPT_CONFESS_USER_ID, String ACCEPT_CONFESS_DEPARTMENT_ID) throws Exception { if (files != null && files.length > 0) { @@ -1665,8 +1665,19 @@ public class AppHotworkCfdController extends BaseController { map.put("gasList", hotworkGasCfdService.listAll(pd)); // imgList是接受交底人签字 - map.put("imgList", hotworkAcceptUserCfdService.findByIds(pd)); - map.put("imgList1", hotworkAcceptUserCfdService.findById(pd)); + List acceptConfessList = (List) pd.get("acceptConfessList"); +// List imgList = new ArrayList<>(); +// if (acceptConfessList != null) { +// for (PageData acceptConfess : acceptConfessList) { +// String signerPath = acceptConfess.getString("ACCEPT_CONFESS_USER_SIGNER_PATH"); +// if (signerPath != null && !signerPath.isEmpty()) { +// imgList.add(signerPath); +// } +// } +// } + map.put("imgList", acceptConfessList); +// map.put("imgList", hotworkAcceptUserCfdService.findByIds(pd)); +// map.put("imgList1", hotworkAcceptUserCfdService.findById(pd)); condition.clear(); condition.put("TYPE","115"); condition.put("FOREIGN_KEY",pd.getString("HOTWORK_ID")); @@ -1847,6 +1858,36 @@ public class AppHotworkCfdController extends BaseController { } } + /** + * 接受交底人审批 + * @param files + * @return + * @throws Exception + */ + @RequestMapping(value = "/editAcceptconfess") + @ResponseBody + public Object editAcceptconfess(@RequestParam(value = "FFILE", required = false) MultipartFile[] files) throws Exception { + PageData response = new PageData(); + try { + PageData request = this.getPageData(); + PageData condition = new PageData(); + condition.put("HOTWORK_ID",request.get("HOTWORK_ID")); + condition.put("USER_ID",request.get("USER_ID")); + condition.put("CORPINFO_ID",request.get("CORPINFO_ID")); + condition.put("TYPE","3"); + condition.put("APPROVAL_STATUS","1"); + hotworkCfdService.confessApproval(condition, files); + response.put("result", "success"); + return response; + } catch (Exception e) { + e.printStackTrace(); + response.put("result", "error"); + response.put("message", e.getMessage()); + return response; + } + } + + /** * 安全交底人审批 * created by liu jun diff --git a/src/main/java/com/zcloud/service/highriskwork/impl/HotworkCfdServiceImpl.java b/src/main/java/com/zcloud/service/highriskwork/impl/HotworkCfdServiceImpl.java index 5a5b81cf..5b1dcb4c 100644 --- a/src/main/java/com/zcloud/service/highriskwork/impl/HotworkCfdServiceImpl.java +++ b/src/main/java/com/zcloud/service/highriskwork/impl/HotworkCfdServiceImpl.java @@ -65,6 +65,7 @@ public class HotworkCfdServiceImpl implements HotworkCfdService { @Transactional public void saveConfess(PageData info) throws Exception{ List list = Warden.getList(info.getString("confessList")); + List listAccept = Warden.getList(info.getString("acceptconfessUserList")); String flowsId = Warden.get32UUID(); String time = DateUtil.getTime(); PageData condition = new PageData(); @@ -80,7 +81,27 @@ public class HotworkCfdServiceImpl implements HotworkCfdService { entity.put("DEPARTMENT_NAME", x.get("CONFESS_DEPARTMENT_NAME")); this.getCorpInfo(entity); entity.put("TYPE", "0"); - entity.put("TYPE_NAME", "动火交底人"); + entity.put("TYPE_NAME", "安全交底人"); + entity.put("APPROVAL_OPINIONS",info.getString("CONFESS_DEPARTMENT_OPINIONS")); + entity.put("APPROVAL_STATUS", "0"); + entity.put("STATUS", "0"); + entity.put("CREATE_TIME", time); + entity.put("VALID_FLAG", "1"); + entity.put("IS_DELETE", "0"); + busHotworkCfdExamineMapper.save(entity); + } + for (PageData x : listAccept) { + PageData entity = new PageData(); + entity.put("HOTWORK_EXAMINE_ID", Warden.get32UUID()); + entity.put("HOTWORK_ID", info.getString("HOTWORK_ID")); + entity.put("FLOW_ID", flowsId);// 流程id + entity.put("USER_ID", x.get("ACCEPT_CONFESS_USER_ID")); + entity.put("USER_NAME", x.get("ACCEPT_CONFESS_USER_NAME")); + entity.put("DEPARTMENT_ID", x.get("ACCEPT_CONFESS_DEPARTMENT_ID")); + entity.put("DEPARTMENT_NAME", x.get("ACCEPT_CONFESS_DEPARTMENT_NAME")); + this.getCorpInfo(entity); + entity.put("TYPE", "3"); + entity.put("TYPE_NAME", "接受交底人"); entity.put("APPROVAL_OPINIONS",info.getString("CONFESS_DEPARTMENT_OPINIONS")); entity.put("APPROVAL_STATUS", "0"); entity.put("STATUS", "0"); @@ -432,6 +453,9 @@ public class HotworkCfdServiceImpl implements HotworkCfdService { condition.put("isValid","1"); //动火交底人需处理数 info.put("confessNum", busHotworkCfdExamineMapper.findByCondition(condition).size()); + //接受交底人需处理数 + condition.put("TYPE", "3"); + info.put("acceptConfessNum", busHotworkCfdExamineMapper.findByCondition(condition).size()); condition.put("TYPE", "1"); // 项目主管部门需处理数 List _belongingList = busHotworkCfdExamineMapper.findByCondition(condition); @@ -501,6 +525,24 @@ public class HotworkCfdServiceImpl implements HotworkCfdService { }else { pd.put("confessStatus", "1"); } + //接受交底人 + List acceptConfess = approvalInfos.stream() + .filter(x -> "3".equals(x.getString("TYPE"))) + .collect(Collectors.toList()); + for (PageData x : acceptConfess) { + x.put("ACCEPT_CONFESS_USER_ID", x.get("USER_ID")); + x.put("ACCEPT_CONFESS_USER_NAME", x.get("USER_NAME")); + x.put("ACCEPT_CONFESS_DEPARTMENT_ID", x.get("DEPARTMENT_ID")); + x.put("ACCEPT_CONFESS_DEPARTMENT_NAME", x.get("DEPARTMENT_NAME")); + x.put("ACCEPT_CONFESS_USER_SIGNER_PATH", x.get("APPROVAL_SIGNATURE")); + } + pd.put("acceptConfessUserNames", acceptConfess.stream().map(x -> x.getString("USER_NAME")).collect(Collectors.joining(","))); + pd.put("acceptConfessList", acceptConfess); + if (acceptConfess.stream().anyMatch(x -> "0".equals(x.getString("APPROVAL_STATUS")))){ + pd.put("acceptConfessStatus", "0"); + }else { + pd.put("acceptConfessStatus", "1"); + } // 项目责任负责人 PageData belong = approvalInfos.stream().filter(x -> "1".equals(x.getString("TYPE"))).findFirst().orElse(null);