diff --git a/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java b/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java index 78fdeb0..ed9d3c2 100644 --- a/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java +++ b/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java @@ -125,18 +125,6 @@ public class AppHotworkController extends BaseController { return map; } - @RequestMapping("/cancel") - @ResponseBody - @LogAnno(menuType= "手机",menuServer= "动火作业",instructionsOperate = "动火作业",instructionsType = "打回") - public Object cancel()throws Exception{ - Map map = new HashMap<>(); - String errInfo = "success"; - PageData pd = new PageData(); - pd = this.getPageData(); - hotworkService.cancel(pd); - map.put("result",errInfo); - return map; - } @RequestMapping("/nextStep") @ResponseBody @@ -215,12 +203,18 @@ public class AppHotworkController extends BaseController { @RequestMapping(value="/gas/save") @ResponseBody @LogAnno(menuType= "手机",menuServer= "动火作业",instructionsOperate = "动火作业",instructionsType = "保存气体检测") - public Object gasSave(@RequestParam(value="file",required=false) MultipartFile file) throws Exception{ + public Object gasSave(MultipartRequest request) throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); - hotworkService.saveGas(pd,file); + List fileList = new ArrayList(); + String SIGNTIME[] = pd.getString("SIGNTIME").split(","); + + for (int i = 0; i < SIGNTIME.length; i++) { + fileList.add(request.getFile("file" + i)); + } + hotworkService.saveGas(pd,fileList.toArray(new MultipartFile[fileList.size()])); map.put("result", errInfo); return map; } diff --git a/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkMapper.java b/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkMapper.java index b9647f2..9f6cb9a 100644 --- a/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkMapper.java @@ -18,7 +18,6 @@ public interface HotworkMapper { void editGasTime(PageData pd); void editStep(PageData pd); List datalistPage(Page page); - void cancel(PageData pd); List listAllMeasures(); List checkWorkCount(PageData pd); diff --git a/src/main/java/com/zcloud/service/eightwork/HotworkService.java b/src/main/java/com/zcloud/service/eightwork/HotworkService.java index 9e7e4cf..c7f5789 100644 --- a/src/main/java/com/zcloud/service/eightwork/HotworkService.java +++ b/src/main/java/com/zcloud/service/eightwork/HotworkService.java @@ -22,8 +22,6 @@ public interface HotworkService { void nextStep(PageData pd, MultipartFile[] files) throws Exception; - void cancel(PageData pd) throws Exception; - PageData findById(PageData pd) throws Exception; PageData checkWorkCount(PageData pd); @@ -37,6 +35,6 @@ public interface HotworkService { // //获取所有签字完成的措施(bus_hotworktomeasures) List listSignFinishMeasures(PageData pd) throws Exception; - void saveGas(PageData pd,MultipartFile file) throws Exception; + void saveGas(PageData pd,MultipartFile[] files) throws Exception; } diff --git a/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java b/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java index d482d1f..a316b3c 100644 --- a/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java +++ b/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java @@ -134,7 +134,7 @@ public class HotworkServiceImpl implements HotworkService { } List unsignedList = hotworkSignMapper.checkUnsigned(sign);//当前步骤未签名人列表 - if(unsignedList == null || unsignedList.size() == 0){//如果没有未签人 则跳转下一步 + if((unsignedList == null || unsignedList.size() == 0) && pd.getString("APPLY_STATUS").equals("1")){//如果没有未签人 则跳转下一步 hotworkMapper.editStep(work); //保存日志 @@ -148,21 +148,14 @@ public class HotworkServiceImpl implements HotworkService { savePreparers(work,currentflow); } saveNextSigner(work,currentflow); + }else if(pd.getString("APPLY_STATUS").equals("-1")){ + work.put("STEP_ID",-1); + hotworkMapper.editStep(work); + //保存日志 + saveLog(work,work.getString(flow.get("ACTOR_FIELD")),"-1"); } } - /** - * 取消 - */ - @Override - @Transactional - public void cancel(PageData pd)throws Exception{ - PageData flow = getStep(pd.get("TASK_ID"), pd.get("STEP_ID")); - saveLog(pd,pd.getString(flow.get("ACTOR_FIELD")),"-1"); - pd.put("STEP_ID", -1); - hotworkMapper.editStep(pd); - } - @Override public PageData findById(PageData pd) throws Exception { PageData pageData = hotworkMapper.findById(pd); @@ -202,45 +195,56 @@ public class HotworkServiceImpl implements HotworkService { @Override @Transactional - public void saveGas(PageData pd,MultipartFile file) throws Exception { + public void saveGas(PageData pd, MultipartFile[] files) throws Exception { PageData work = hotworkMapper.findById(pd); - String ffile = DateUtil.getDays(); - String fileName = UuidUtil.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); - String filePath = Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName; + List filePaths = new ArrayList<>(); + for (int i = 0; i < files.length; i++) { + //保存签名文件 + String ffile = DateUtil.getDays(); + String fileName = UuidUtil.get32UUID() + files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".")); + smb.sshSftp(files[i], fileName, Const.FILEPATHFILE + work.getString("CORPINFO_ID") + "/" + ffile); + filePaths.add(Const.FILEPATHFILE + work.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); + } pd.put("HOTWORKGAS_ID", UuidUtil.get32UUID()); //主键 pd.put("ISDELETE", "0"); //是否删除 1-是 0-否 - pd.put("SIGN_PATH", filePath); + pd.put("SIGN_PATH", String.join(",",filePaths)); hotworkGasMapper.save(pd); hotworkMapper.editGasTime(pd);//修改最后一次气体检测时间 PageData flow = getStep(work.get("TASK_ID"), work.get("STEP_ID")); if (pd.get("APPLY_STATUS").equals("1")) { //如果通过 - if(flow.get("NEXT_STEP_ID") != null && flow.getString("NEXT_STEP_ID").equals("2")){//如果为气体检测步骤,则保存日志并跳转下一步 + if(flow.get("NEXT_STEP_ID") != null && flow.getString("NEXT_STEP_ID").equals("2")) {//如果为气体检测步骤,则保存日志并跳转下一步 PageData sign = new PageData(); sign.put(primary_key, work.get(primary_key)); sign.put("STEP_ID", 2); sign.put("SIGN_USER_ID", pd.get("USER_ID")); sign.put("SIGN_TIME", DateUtil.date2Str(new Date())); - sign.put("SIGN_PATH", filePath); + sign.put("SIGN_PATH", String.join(",", filePaths)); sign.put("DESCR", pd.get("DESCR")); hotworkSignMapper.edit(sign); - work.put("STEP_ID", flow.get("NEXT_STEP_ID")); hotworkMapper.editStep(work); //保存日志 - saveLog(work,work.getString(flow.get("ACTOR_FIELD")),"1"); + saveLog(work, work.getString(flow.get("ACTOR_FIELD")), "1"); //预存下一步 PageData currentflow = getStep(work.get("TASK_ID"), work.get("STEP_ID")); - saveNextSigner(work,currentflow); - + saveNextSigner(work, currentflow); } - }else{ - saveLog(work,pd.getString("USER_ID"),"-2"); - work.put("STEP_ID", -1); + }else if(pd.getString("APPLY_STATUS").equals("-1")){ + PageData sign = new PageData(); + sign.put(primary_key, work.get(primary_key)); + sign.put("STEP_ID", 2); + sign.put("SIGN_USER_ID", pd.get("USER_ID")); + sign.put("SIGN_TIME", DateUtil.date2Str(new Date())); + sign.put("SIGN_PATH", String.join(",", filePaths)); + sign.put("DESCR", pd.get("DESCR")); + hotworkSignMapper.edit(sign); + work.put("STEP_ID",-1); hotworkMapper.editStep(work); + //保存日志 + saveLog(work,pd.getString("USER_ID"),"-2"); } }