From ae5bcebb97787727afc63e2517bc29364b551cc9 Mon Sep 17 00:00:00 2001 From: WenShiJun Date: Mon, 11 Mar 2024 18:10:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E4=BE=8B=E4=BC=9A=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E5=B2=97=E4=BD=8D=E5=AE=89=E5=85=A8=E8=B4=A3?= =?UTF-8?q?=E4=BB=BB=E4=B9=A6=E5=BC=80=E5=8F=91=20=E5=B2=97=E4=BD=8D?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=89=BF=E8=AF=BA=E4=B9=A6=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppTrafficSafetyMeetingController.java | 46 ++++++++++++++----- .../TrafficSecurityCommitmentController.java | 13 ++++++ .../TrafficSecurityCommitmentMapper.java | 1 + .../TrafficSecurityCommitmentService.java | 1 + .../TrafficSecurityCommitmentServiceImpl.java | 5 ++ .../TrafficSafetyMeetingRecipientMapper.xml | 2 +- .../TrafficSecurityCommitmentMapper.xml | 9 ++++ .../TrafficSecurityLaborContractMapper.xml | 2 +- 8 files changed, 65 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/zcloud/controller/comprehensive/AppTrafficSafetyMeetingController.java b/src/main/java/com/zcloud/controller/comprehensive/AppTrafficSafetyMeetingController.java index a4a2c32..f925de7 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/AppTrafficSafetyMeetingController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/AppTrafficSafetyMeetingController.java @@ -102,7 +102,8 @@ public class AppTrafficSafetyMeetingController extends BaseController { //修改 @RequestMapping(value = "/edit") @ResponseBody - public Object edit(@RequestParam(value="livePhoto",required=false) MultipartFile file) throws Exception { + public Object edit(@RequestParam(value="livePhoto",required=false) MultipartFile livePhoto, + @RequestParam(value="signPhoto", required=false) MultipartFile signPhoto) throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); @@ -112,20 +113,29 @@ public class AppTrafficSafetyMeetingController extends BaseController { pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间 pd.put("TRANSPORTATIONCOMPANY", Jurisdiction.getCORPINFO_ID()); // 经营企业 - String ffile = DateUtil.getDays(); - if (file != null && StringUtils.isNotBlank(pd.getString("OPERATORNAME"))){ - String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); - if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName)) { + if (livePhoto != null && StringUtils.isNotBlank(pd.getString("OPERATORNAME"))){ + String livePhotoPath = saveFile(livePhoto, pd); + if (livePhotoPath != null) { + pd.put("LIVEPHOTOS", livePhotoPath); + } else { errInfo = "fail"; map.put("result", errInfo); - map.put("msg", "文件格式不正确!"); + map.put("msg", "实时照片文件格式不正确或保存失败!"); + return map; + } + } + + // 对于signPhoto的处理 + if (signPhoto != null && StringUtils.isNotBlank(pd.getString("OPERATORNAME"))){ + String signPhotoPath = saveFile(signPhoto, pd); + if (signPhotoPath != null) { + pd.put("SIGNATUREPICTURE", signPhotoPath); + } else { + errInfo = "fail"; + map.put("result", errInfo); + map.put("msg", "签字图片文件格式不正确或保存失败!"); return map; } - String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("TRANSPORTATIONCOMPANY") + "/" + ffile); - pd.put("LIVEPHOTOS", Const.FILEPATHFILE + pd.getString("TRANSPORTATIONCOMPANY") + "/" + ffile + "/" + fileName); - pd.put("ATTACHMENT_NAME",pd.getString("CREATORNAME")); - pd.put("CONFIRM_MESSAGE_TIME",DateUtil.date2Str(new Date())); } meetingRecipienService.edit(pd); @@ -134,5 +144,17 @@ public class AppTrafficSafetyMeetingController extends BaseController { map.put("pd", pd); return map; } - + private String saveFile(MultipartFile file, PageData pd) throws Exception { + String ffile = DateUtil.getDays(), fileName = null; + if (file != null) { + String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase(); + if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName)) { + return null; + } + fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("TRANSPORTATIONCOMPANY") + "/" + ffile); + return Const.FILEPATHFILE + pd.getString("TRANSPORTATIONCOMPANY") + "/" + ffile + "/" + fileName; + } + return null; + } } diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCommitmentController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCommitmentController.java index d242463..e7fbdda 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCommitmentController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCommitmentController.java @@ -147,4 +147,17 @@ public class TrafficSecurityCommitmentController extends BaseController { return map; } + //详情 + @RequestMapping(value="/goEdit") + @ResponseBody + public Object goEdit() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd = securityCommitmentService.findById(pd); //根据ID读取 + map.put("pd", pd); + map.put("result", errInfo); + return map; + } } diff --git a/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCommitmentMapper.java b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCommitmentMapper.java index c723175..eb9b4bb 100644 --- a/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCommitmentMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityCommitmentMapper.java @@ -14,4 +14,5 @@ public interface TrafficSecurityCommitmentMapper { void edit(PageData pd); + PageData findById(PageData pd); } diff --git a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCommitmentService.java b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCommitmentService.java index 8bd846e..5c3ab36 100644 --- a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCommitmentService.java +++ b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCommitmentService.java @@ -12,4 +12,5 @@ public interface TrafficSecurityCommitmentService { List listForSecurityStaffing(Page page); + PageData findById(PageData pd); } diff --git a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCommitmentServiceImpl.java b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCommitmentServiceImpl.java index c859650..3ee545d 100644 --- a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCommitmentServiceImpl.java +++ b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityCommitmentServiceImpl.java @@ -27,4 +27,9 @@ public class TrafficSecurityCommitmentServiceImpl implements TrafficSecurityComm public List listForSecurityStaffing(Page page) { return securityCommitmentMapper.datalistPage(page); } + + @Override + public PageData findById(PageData pd) { + return securityCommitmentMapper.findById(pd); + } } diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyMeetingRecipientMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyMeetingRecipientMapper.xml index 2372954..41120cd 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyMeetingRecipientMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyMeetingRecipientMapper.xml @@ -116,7 +116,7 @@ f.OPERATORNAME = #{OPERATORNAME}, f.OPERATTIME = #{OPERATTIME}, f.SIGNATUREPICTURE = #{SIGNATUREPICTURE}, - f.LIVEPHOTOS = #{LIVEPHOTOS}, + f.LIVEPHOTOS = IF(#{LIVEPHOTOS} IS NOT NULL AND #{LIVEPHOTOS} != '', #{LIVEPHOTOS}, f.LIVEPHOTOS), f.ATTENDANCE_STATUS = #{ATTENDANCE_STATUS}, f.LOCATIONADDRESS = #{LOCATIONADDRESS}, f.LATITUDE = #{LATITUDE}, diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCommitmentMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCommitmentMapper.xml index 13dab41..303d6ce 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCommitmentMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCommitmentMapper.xml @@ -149,4 +149,13 @@ where u.ISDELETE = '0' and u.ISMAIN != '1' + + diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityLaborContractMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityLaborContractMapper.xml index 660d52e..2b9208f 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityLaborContractMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityLaborContractMapper.xml @@ -157,6 +157,6 @@ from f where - f.STAFFING_ID = #{STAFFING_ID} + f.LABORCONTRACT_ID = #{LABORCONTRACT_ID}