From 80e9814cd6dbd0f236b95d429b9ee9b9934eca5a Mon Sep 17 00:00:00 2001 From: hejinbo Date: Sat, 7 Oct 2023 19:00:15 +0800 Subject: [PATCH 1/3] =?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)); } From 848581e155a016f4a3e311e7d04cfdcfa64c9b3f Mon Sep 17 00:00:00 2001 From: hejinbo Date: Sun, 8 Oct 2023 16:56:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?10.8=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdjudicationController.java | 7 +- .../domain/vo/LogisticsInfoVO.java | 16 ++++ .../service/IAdjudicationService.java | 2 +- .../service/impl/AdjudicationServiceImpl.java | 92 ++++++++++++------- .../wisdomarbitrate/CaseAffiliateMapper.xml | 4 +- 5 files changed, 81 insertions(+), 40 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/LogisticsInfoVO.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java index 0c3b451..8629f05 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java @@ -41,12 +41,11 @@ public class AdjudicationController extends BaseController { /** * 根据快递单号查询物流信息 - * @param trackingNum 单号 - * @param phoneLastFour 收/寄件人手机号后四位,顺丰快递需填写本字段。 + * @param caseApplication * @return */ @GetMapping("/logistics") - public AjaxResult getLogisticsInfo(String trackingNum,Integer phoneLastFour){ - return adjudicationService.getLogisticsInfo(trackingNum,phoneLastFour); + public AjaxResult getLogisticsInfo(@Validated @RequestBody CaseApplication caseApplication){ + return adjudicationService.getLogisticsInfo(caseApplication); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/LogisticsInfoVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/LogisticsInfoVO.java new file mode 100644 index 0000000..480a96a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/LogisticsInfoVO.java @@ -0,0 +1,16 @@ +package com.ruoyi.wisdomarbitrate.domain.vo; + +import lombok.Data; + +@Data +public class LogisticsInfoVO { + /** + * 案件关联人身份类型 + */ + private Integer identityType; + + /** + * 物流信息 + */ + private String logisticsInfo; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java index 416e92c..27d01a3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java @@ -8,5 +8,5 @@ public interface IAdjudicationService { AjaxResult sendDocumentByEmail(Long id,String appEmail,String resEmail ,String apptrackingNum,String restrackingNum); - AjaxResult getLogisticsInfo(String trackingNum,Integer phoneLastFour); + AjaxResult getLogisticsInfo(CaseApplication caseApplication); } 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 179e34b..6ff0555 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 @@ -1,11 +1,14 @@ package com.ruoyi.wisdomarbitrate.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.deepoove.poi.config.Configure; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.EmailOutUtil; import com.ruoyi.common.utils.WordUtil; import com.ruoyi.wisdomarbitrate.domain.*; +import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO; import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper; import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper; @@ -47,6 +50,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { private EmailOutUtil emailOutUtil; @Autowired private ICaseApplicationService caseApplicationService; + @Override public AjaxResult createDocument(CaseApplication caseApplication) { try { @@ -133,10 +137,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService { datas.put("day", day); String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx"; //String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx"; - String saveFolderPath = "/home/ruoyi/uploadPath/upload/" +year + "/" + month + "/" + day; + 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 saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; String resultFilePath = saveFolderPath + "/" + fileName; // 创建日期目录 File saveFolder = new File(saveFolderPath); @@ -176,7 +180,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { @Override @Transactional - public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail ,String apptrackingNum,String restrackingNum) { + public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum) { CaseApplication caseApplication = new CaseApplication(); caseApplication.setId(id); CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); @@ -189,15 +193,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService { List fileList = new ArrayList<>(); CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication); List caseAttachList = caseApplication2.getCaseAttachList(); - if (caseAttachList!=null&& caseAttachList.size()>0){ + 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)); } } } - if (fileList.size()<1){ + if (fileList.size() < 1) { return AjaxResult.error("未查询到裁决书"); } File file = fileList.get(0); @@ -218,13 +222,13 @@ public class AdjudicationServiceImpl implements IAdjudicationService { CaseAffiliate caseAffiliate = new CaseAffiliate(); caseAffiliate.setCaseAppliId(id); List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if (caseAffiliates!=null&&caseAffiliates.size()>0){ + if (caseAffiliates != null && caseAffiliates.size() > 0) { for (CaseAffiliate affiliate : caseAffiliates) { - if (affiliate.getIdentityType() == 1){ //申请人 + if (affiliate.getIdentityType() == 1) { //申请人 affiliate.setSendEmail(appEmail); affiliate.setTrackNum(apptrackingNum); caseAffiliateMapper.updataCaseAffiliate(affiliate); - }else { + } else { affiliate.setSendEmail(resEmail); affiliate.setTrackNum(restrackingNum); caseAffiliateMapper.updataCaseAffiliate(affiliate); @@ -238,36 +242,56 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } @Override - public AjaxResult getLogisticsInfo(String trackingNum, Integer phoneLastFour) { + public AjaxResult getLogisticsInfo(CaseApplication caseApplication) { try { //快递单号查询 String key = "70ba5c7b327f71fccd5924f70e3e7b7f"; String com = "auto"; - // 构造查询字符串参数 - String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d", - URLEncoder.encode(key, "UTF-8"), - URLEncoder.encode(com, "UTF-8"), - URLEncoder.encode(trackingNum, "UTF-8"), - phoneLastFour); - // 拼接到API URL中 - String fullUrl = apiUrl + "?" + queryParameters; - URL url = new URL(fullUrl); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setRequestMethod("GET"); - int responseCode = connection.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK) { - BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String line; - StringBuilder response = new StringBuilder(); - while ((line = reader.readLine()) != null) { - response.append(line); + //根据案件id查询单号信息 + CaseAffiliate caseAffiliate = new CaseAffiliate(); + caseAffiliate.setCaseAppliId(caseApplication.getId()); + List logisticsInfoVOList = new ArrayList<>(); + List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); + if (caseAffiliates != null && caseAffiliates.size() > 0) { + for (CaseAffiliate affiliate : caseAffiliates) { + LogisticsInfoVO logisticsInfoVO = new LogisticsInfoVO(); + String trackNum = affiliate.getTrackNum(); + if (trackNum != null) { + // 构造查询字符串参数 + String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d", + URLEncoder.encode(key, "UTF-8"), + URLEncoder.encode(com, "UTF-8"), + URLEncoder.encode(trackNum, "UTF-8"), null); + // 拼接到API URL中 + String fullUrl = apiUrl + "?" + queryParameters; + URL url = new URL(fullUrl); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("GET"); + int responseCode = connection.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String line; + StringBuilder response = new StringBuilder(); + while ((line = reader.readLine()) != null) { + response.append(line); + } + reader.close(); + // 处理返回的响应数据\ + JSONObject jsonObject = JSON.parseObject(response.toString()); + // 提取 "data" 字段并转换为字符串 + String data = jsonObject.getString("data"); + if (data != null) { + logisticsInfoVO.setIdentityType(affiliate.getIdentityType()); + logisticsInfoVO.setLogisticsInfo(data); + logisticsInfoVOList.add(logisticsInfoVO); + } + } else { + // 请求失败 + return AjaxResult.error("请求失败,错误码:" + responseCode); + } + } } - reader.close(); - // 处理返回的响应数据 - return AjaxResult.success(response); - } else { - // 请求失败 - return AjaxResult.error("请求失败,错误码:" + responseCode); + return AjaxResult.success(logisticsInfoVOList); } } catch (IOException e) { e.printStackTrace(); diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml index 974b9f6..9e6312f 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml @@ -18,12 +18,14 @@ +