From 80e9814cd6dbd0f236b95d429b9ee9b9934eca5a Mon Sep 17 00:00:00 2001 From: hejinbo Date: Sat, 7 Oct 2023 19:00:15 +0800 Subject: [PATCH] =?UTF-8?q?10.7=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bestsign/RegisterController.java | 2 ++ .../service/impl/AdjudicationServiceImpl.java | 28 ++++++++++++------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/RegisterController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/RegisterController.java index 6e349cb..5f3b0d1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/RegisterController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/RegisterController.java @@ -26,4 +26,6 @@ public class RegisterController { public AjaxResult createDocument(@Validated @RequestBody PersonRegisterVO personRegisterVO) { return signRegisterService.registerPerson(personRegisterVO); } +// @PostMapping("/registerEnterprise") +// public AjaxResult } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java index 9fff3eb..179e34b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java @@ -11,6 +11,7 @@ import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper; import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper; import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; +import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; import org.apache.poi.xwpf.usermodel.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.MailSendException; @@ -44,7 +45,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService { private CaseAttachMapper caseAttachMapper; @Autowired private EmailOutUtil emailOutUtil; - + @Autowired + private ICaseApplicationService caseApplicationService; @Override public AjaxResult createDocument(CaseApplication caseApplication) { try { @@ -123,14 +125,18 @@ public class AdjudicationServiceImpl implements IAdjudicationService { datas.put("arbitratorName2", secondName); } LocalDate now = LocalDate.now(); - datas.put("year", now.getYear()); - datas.put("months", now.getMonthValue()); - datas.put("day", now.getDayOfMonth()); + String year = Integer.toString(now.getYear()); + String month = String.format("%02d", now.getMonthValue()); + String day = String.format("%02d", now.getDayOfMonth()); + datas.put("year", year); + datas.put("months", month); + datas.put("day", day); String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx"; //String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx"; - String saveFolderPath = "/data/arbitrate-document/formal/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth(); + String saveFolderPath = "/home/ruoyi/uploadPath/upload/" +year + "/" + month + "/" + day; //String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth(); String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx"; + String saveName = "/profile/upload/"+year + "/" + month + "/" + day +"/" +fileName; String resultFilePath = saveFolderPath + "/" + fileName; // 创建日期目录 File saveFolder = new File(saveFolderPath); @@ -141,14 +147,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService { Path destinationPath = new File(resultFilePath).toPath(); Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING); String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath); + String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8); //修改案件状态 caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION); caseApplicationMapper.submitCaseApplication(caseApplication1); //将裁决书保存到附件表里 CaseAttach caseAttach = CaseAttach.builder() .caseAppliId(id) - .annexName(fileName) - .annexPath(docFilePath) + .annexName(saveName) + .annexPath(savePath) .annexType(3) .build(); int i = caseAttachMapper.save(caseAttach); @@ -180,10 +187,11 @@ public class AdjudicationServiceImpl implements IAdjudicationService { //根据案件id查询裁决书 try { List fileList = new ArrayList<>(); - List caseAttachList = caseAttachMapper.queryAnnexPathByCaseId(id); - if (caseAttachList != null && caseAttachList.size() > 0) { + CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication); + List caseAttachList = caseApplication2.getCaseAttachList(); + if (caseAttachList!=null&& caseAttachList.size()>0){ for (CaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == 3) { + if (caseAttach.getAnnexType() == 3){ String annexPath = caseAttach.getAnnexPath(); fileList.add(new File(annexPath)); }