hejinbo пре 2 година
родитељ
комит
2a147f119e

+ 23
- 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java Прегледај датотеку

@@ -6,10 +6,7 @@ import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
6 6
 import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
7 7
 import org.springframework.beans.factory.annotation.Autowired;
8 8
 import org.springframework.validation.annotation.Validated;
9
-import org.springframework.web.bind.annotation.PostMapping;
10
-import org.springframework.web.bind.annotation.RequestBody;
11
-import org.springframework.web.bind.annotation.RequestMapping;
12
-import org.springframework.web.bind.annotation.RestController;
9
+import org.springframework.web.bind.annotation.*;
13 10
 
14 11
 @RestController
15 12
 @RequestMapping("/adjudication")
@@ -26,8 +23,27 @@ public class AdjudicationController extends BaseController {
26 23
     public AjaxResult createDocument(@Validated @RequestBody CaseApplication caseApplication){
27 24
         return adjudicationService.createDocument(caseApplication);
28 25
     }
29
-    @PostMapping("/")
30
-    public AjaxResult sendDocumentByEmail(){
31
-        return adjudicationService.sendDocumentByEmail();
26
+
27
+    /**
28
+     * 裁决书送达(电子邮件)
29
+     * @param id 案件id
30
+     * @param appEmail 申请人邮箱
31
+     * @param resEmail 被申请人邮箱
32
+     * @return
33
+     */
34
+    @PostMapping("/delivery")
35
+    public AjaxResult sendDocumentByEmail(Long id,String appEmail,String resEmail){
36
+        return adjudicationService.sendDocumentByEmail(id,appEmail,resEmail);
37
+    }
38
+
39
+    /**
40
+     * 根据快递单号查询物流信息
41
+     * @param trackingNum 单号
42
+     * @param phoneLastFour 收/寄件人手机号后四位,顺丰快递需填写本字段。
43
+     * @return
44
+     */
45
+    @GetMapping("/logistics")
46
+    public AjaxResult  getLogisticsInfo(String trackingNum,Integer phoneLastFour){
47
+        return adjudicationService.getLogisticsInfo(trackingNum,phoneLastFour);
32 48
     }
33 49
 }

+ 8
- 22
ruoyi-admin/src/main/resources/application.yml Прегледај датотеку

@@ -92,30 +92,16 @@ spring:
92 92
     resources:
93 93
       static-locations:  file:/home/ruoyi/
94 94
   mail:
95
-    # 邮件服务地址
96 95
     host: smtp.163.com
97
-    # 默认端口25,可不写
98 96
     port: 25
99
-    # 编码格式
100
-    default-encoding: utf-8
101
-    # 发送者用户名
102
-    username: xxx@163.com
103
-    # 授权码,刚才获取的代码
104
-    password: xxx
105
-    # 其它参数
106
-    #    properties:
107
-    #      mail:
108
-    #        smtp:
109
-    #          # 如果是用 SSL 方式,需要配置如下属性
110
-    #          ssl:
111
-    #            enable: true
112
-    #            required: true
113
-    #          # 邮件接收时间的限制,单位毫秒
114
-    #          timeout: 10000
115
-    #          # 连接时间的限制,单位毫秒
116
-    #          connectiontimeout: 10000
117
-    #          # 邮件发送时间的限制,单位毫秒
118
-    #          writetimeout: 10000
97
+    username: hjbjava@163.com
98
+    password: BSRSSEPJWGNNVYYL
99
+    default-encoding: UTF-8
100
+    properties:
101
+      mail:
102
+        smtp:
103
+          socketFactoryClass: javax.net.ssl.SSLSocketFactory
104
+        debug: false
119 105
 
120 106
 # token配置
121 107
 token:

+ 15
- 0
ruoyi-common/pom.xml Прегледај датотеку

@@ -159,6 +159,21 @@
159 159
             <version>3.1.4</version>
160 160
         </dependency>
161 161
 
162
+        <dependency>
163
+            <groupId>javax.activation</groupId>
164
+            <artifactId>activation</artifactId>
165
+            <version>1.1.1</version>
166
+        </dependency>
167
+
168
+        <!-- https://mvnrepository.com/artifact/javax.mail/mail -->
169
+        <dependency>
170
+            <groupId>javax.mail</groupId>
171
+            <artifactId>mail</artifactId>
172
+            <version>1.4.7</version>
173
+        </dependency>
174
+
175
+
176
+
162 177
     </dependencies>
163 178
 
164 179
 </project>

+ 187
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java Прегледај датотеку

@@ -0,0 +1,187 @@
1
+package com.ruoyi.common.utils;
2
+
3
+
4
+import lombok.Data;
5
+import lombok.extern.slf4j.Slf4j;
6
+import org.springframework.beans.factory.annotation.Value;
7
+import org.springframework.mail.SimpleMailMessage;
8
+
9
+import org.springframework.mail.javamail.JavaMailSender;
10
+import org.springframework.mail.javamail.JavaMailSenderImpl;
11
+import org.springframework.mail.javamail.MimeMessageHelper;
12
+import org.springframework.stereotype.Component;
13
+
14
+import javax.mail.MessagingException;
15
+import javax.mail.internet.MimeMessage;
16
+import javax.validation.constraints.NotNull;
17
+import java.io.File;
18
+import java.io.IOException;
19
+import java.util.List;
20
+import java.util.regex.Matcher;
21
+import java.util.regex.Pattern;
22
+
23
+/**
24
+ * @ClassName EmailInUtil
25
+ * @Description 邮件发送工具
26
+ */
27
+@Component
28
+@Data
29
+@Slf4j
30
+public class EmailOutUtil {
31
+    private static Pattern emailPattern = Pattern.compile("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$");
32
+    //    private static Pattern phonePattern = Pattern.compile("0?(13|14|15|18)[0-9]{9}");
33
+    private static Pattern phonePattern = Pattern.compile("^1\\d{10}$");
34
+
35
+
36
+//    @Autowired
37
+//    private JavaMailSender mailSender;
38
+
39
+    // 发送发邮箱地址(外网地址)
40
+//    @Value("${spring.mail-out-network.from}")
41
+//    private static String fromOut;
42
+    @Value("${spring.mail.host}")
43
+    private  String hostOut;
44
+    @Value("${spring.mail.username}")
45
+    private  String usernameOut;
46
+    @Value("${spring.mail.password}")
47
+    private   String passwordOut;
48
+    @Value("${spring.mail.port}")
49
+    private  Integer portOut;
50
+
51
+    public  JavaMailSender rebuildMailSender() {
52
+        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
53
+        mailSender.setHost(hostOut);
54
+        mailSender.setUsername(usernameOut);
55
+        mailSender.setPassword(passwordOut);
56
+        mailSender.setPort(portOut);
57
+        mailSender.setProtocol("smtp");
58
+        mailSender.setDefaultEncoding("UTF-8");
59
+        return mailSender;
60
+    }
61
+
62
+    /**
63
+     * 发送纯文本邮件信息
64
+     *
65
+     * @param to      接收方
66
+     * @param subject 邮件主题
67
+     * @param content 邮件内容(发送内容)
68
+     */
69
+    public  void sendMessage(String to, String subject, String content, String from, JavaMailSender mailSender) {
70
+        // 创建一个邮件对象
71
+        SimpleMailMessage msg = new SimpleMailMessage();
72
+        msg.setFrom(from);
73
+        msg.setTo(to);
74
+        // 设置邮件主题
75
+        msg.setSubject(subject);
76
+        // 设置邮件内容
77
+        msg.setText(content);
78
+        // 发送邮件
79
+        mailSender.send(msg);
80
+        ////System.out.println("发送成功:" + from + ":to:" + to);
81
+    }
82
+
83
+    /**
84
+     * 发送带附件的邮件信息
85
+     *
86
+     * @param to      接收方
87
+     * @param subject 邮件主题
88
+     * @param content 邮件内容(发送内容)
89
+     * @param fileList   文件集合 // 可发送多个附件
90
+     */
91
+    public  void sendMessageCarryFiles(String to, String subject, String content, List<File> fileList, String from, @NotNull JavaMailSender mailSender) {
92
+        MimeMessage mimeMessage = mailSender.createMimeMessage();
93
+        try {
94
+            MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
95
+            helper.setFrom(from);
96
+            helper.setTo(to);
97
+            // 设置邮件主题
98
+            helper.setSubject(subject);
99
+            // 设置邮件内容
100
+            helper.setText(content);
101
+            // 添加附件(多个)
102
+            if (fileList != null && fileList.size() > 0) {
103
+                for (File file : fileList) {
104
+                    helper.addAttachment(file.getName(), file);
105
+                }
106
+            }
107
+        } catch (MessagingException e) {
108
+            e.printStackTrace();
109
+        }
110
+        // 发送邮件
111
+        mailSender.send(mimeMessage);
112
+    }
113
+
114
+    /**
115
+     * 发送带附件的邮件信息
116
+     *
117
+     * @param to      接收方
118
+     * @param subject 邮件主题
119
+     * @param content 邮件内容(发送内容)
120
+     * @param file    单个文件
121
+     */
122
+    public void sendMessageCarryFile(String to, String subject, String content, File file, String from, JavaMailSender mailSender) {
123
+        MimeMessage mimeMessage = mailSender.createMimeMessage();
124
+        try {
125
+            MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
126
+            helper.setFrom(from);
127
+            helper.setTo(to);
128
+            // 设置邮件主题
129
+            helper.setSubject(subject);
130
+            // 设置邮件内容
131
+            helper.setText(content);
132
+            // 单个附件
133
+            helper.addAttachment(file.getName(), file);
134
+        } catch (MessagingException e) {
135
+            e.printStackTrace();
136
+        }
137
+        // 发送邮件
138
+        mailSender.send(mimeMessage);
139
+    }
140
+
141
+    /**
142
+     * 初始化内外网邮件发送对象
143
+     *
144
+     * @param num
145
+     */
146
+//    public static JavaMailSender initJavaMailSender(Integer num) {
147
+//        if (num != null && num == 1) {
148
+//            //内网
149
+//            return rebuildMailSender(hostIn, usernameIn, passwordIn, Integer.parseInt(portIn), "smtps");
150
+//        } else {
151
+//            //外网
152
+//            return rebuildMailSender(hostOut, usernameOut, passwordOut, Integer.parseInt(portOut), "smtps");
153
+//        }
154
+//    }
155
+
156
+//    public static String getInnerFrom() {
157
+//        return EmailInUtil;
158
+//    }
159
+//
160
+//    public static String getOutterFrom() {
161
+//        return fromOut;
162
+//    }
163
+
164
+    /**
165
+     * 验证邮箱格式
166
+     *
167
+     * @param str
168
+     * @return
169
+     */
170
+    public static boolean isEmail(String str) {
171
+        boolean flag = false;
172
+        Matcher matcher = emailPattern.matcher(str);
173
+        if (matcher.matches()) {
174
+            flag = true;
175
+        }
176
+        return flag;
177
+    }
178
+
179
+    public static boolean isPhoneNumber(String str) {
180
+        boolean flag = false;
181
+        Matcher matcher = phonePattern.matcher(str);
182
+        if (matcher.matches()) {
183
+            flag = true;
184
+        }
185
+        return flag;
186
+    }
187
+}

+ 0
- 49
ruoyi-common/src/main/java/com/ruoyi/common/utils/SendMailUtils.java Прегледај датотеку

@@ -1,49 +0,0 @@
1
-//package com.ruoyi.common.utils;
2
-//
3
-//
4
-//import jakarta.mail.internet.MimeMessage;
5
-//import org.springframework.beans.factory.annotation.Autowired;
6
-//import org.springframework.core.io.FileSystemResource;
7
-//import org.springframework.mail.javamail.JavaMailSender;
8
-//import org.springframework.mail.javamail.MimeMessageHelper;
9
-//import org.springframework.stereotype.Component;
10
-//
11
-//import java.io.File;
12
-//import java.util.List;
13
-//
14
-//@Component
15
-//public class SendMailUtils {
16
-//    private static final String SENDER = "xxx@163.com";
17
-//    @Autowired
18
-//    private JavaMailSender mailSender;
19
-//    /**
20
-//     * 发送带附件的邮件
21
-//     *
22
-//     * @param to       收件人
23
-//     * @param subject  主题
24
-//     * @param content  内容
25
-//     * @param fileList 附件
26
-//     */
27
-//    public void sendFileMail(String to, String subject, String content, List<File> fileList) {
28
-//        MimeMessage message = mailSender.createMimeMessage();
29
-//        try {
30
-//            //true表示需要创建一个multipart message
31
-//            MimeMessageHelper helper = new MimeMessageHelper(message, true);
32
-//            helper.setFrom(SENDER);
33
-//            helper.setTo(to);
34
-//            helper.setSubject(subject);
35
-//            helper.setText(content, true);
36
-//
37
-//            if (fileList != null && fileList.size() > 0) {
38
-//                for (File file : fileList) {
39
-//                    FileSystemResource fileSystemResource = new FileSystemResource(file);
40
-//                    String fileName = fileSystemResource.getFilename();
41
-//                    helper.addAttachment(fileName, fileSystemResource);
42
-//                }
43
-//            }
44
-//            mailSender.send(message);
45
-//        } catch (MessagingException e) {
46
-//            System.out.println("发送带附件的邮件时发生异常!" + e);
47
-//        }
48
-//    }
49
-//}

+ 2
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java Прегледај датотеку

@@ -6,6 +6,7 @@ import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
6 6
 public interface IAdjudicationService {
7 7
     AjaxResult createDocument(CaseApplication caseApplication);
8 8
 
9
-    AjaxResult sendDocumentByEmail();
9
+    AjaxResult sendDocumentByEmail(Long id,String appEmail,String resEmail);
10 10
 
11
+    AjaxResult getLogisticsInfo(String trackingNum,Integer phoneLastFour);
11 12
 }

+ 111
- 27
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java Прегледај датотеку

@@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.service.impl;
3 3
 import com.deepoove.poi.config.Configure;
4 4
 import com.ruoyi.common.constant.CaseApplicationConstants;
5 5
 import com.ruoyi.common.core.domain.AjaxResult;
6
+import com.ruoyi.common.utils.EmailOutUtil;
6 7
 import com.ruoyi.common.utils.WordUtil;
7 8
 import com.ruoyi.wisdomarbitrate.domain.*;
8 9
 import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper;
@@ -12,9 +13,14 @@ import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
12 13
 import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
13 14
 import org.apache.poi.xwpf.usermodel.*;
14 15
 import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.mail.MailSendException;
17
+import org.springframework.mail.javamail.JavaMailSender;
15 18
 import org.springframework.stereotype.Service;
16 19
 
17 20
 import java.io.*;
21
+import java.net.HttpURLConnection;
22
+import java.net.URL;
23
+import java.net.URLEncoder;
18 24
 import java.nio.file.Files;
19 25
 import java.nio.file.Path;
20 26
 import java.nio.file.StandardCopyOption;
@@ -25,6 +31,8 @@ import java.util.*;
25 31
 
26 32
 @Service
27 33
 public class AdjudicationServiceImpl implements IAdjudicationService {
34
+    private final String apiUrl = "http://api.cainiaoapi.com/api/exp/v1/index";
35
+
28 36
     @Autowired
29 37
     private CaseApplicationMapper caseApplicationMapper;
30 38
     @Autowired
@@ -33,13 +41,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
33 41
     private ArbitrateRecordMapper arbitrateRecordMapper;
34 42
     @Autowired
35 43
     private CaseAttachMapper caseAttachMapper;
44
+    @Autowired
45
+    private EmailOutUtil emailOutUtil;
36 46
 
37 47
     @Override
38 48
     public AjaxResult createDocument(CaseApplication caseApplication) {
39 49
         try {
40 50
             Map<String, Object> datas = new HashMap<>();
41 51
             Long id = caseApplication.getId();
42
-            if (id == null){
52
+            if (id == null) {
43 53
                 return null;
44 54
             }
45 55
             //获取案件详细信息
@@ -53,8 +63,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
53 63
             CaseAffiliate caseAffiliate = new CaseAffiliate();
54 64
             caseAffiliate.setCaseAppliId(id);
55 65
             List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
56
-            if (caseAffiliates != null && caseAffiliates.size() > 0){
57
-                for (CaseAffiliate affiliate : caseAffiliates){
66
+            if (caseAffiliates != null && caseAffiliates.size() > 0) {
67
+                for (CaseAffiliate affiliate : caseAffiliates) {
58 68
                     //获取身份类型
59 69
                     int identityType = affiliate.getIdentityType();
60 70
                     if (identityType == 1) {    //申请人
@@ -62,34 +72,34 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
62 72
                         datas.put("appIDNo", affiliate.getIdentityNum());
63 73
                         datas.put("appAddress", affiliate.getContactAddress());
64 74
                         datas.put("appAgentName", affiliate.getNameAgent());
65
-                        datas.put("appAgentIDNo",affiliate.getIdentityNumAgent());
66
-                    }else if (identityType == 2){  //被申请人
75
+                        datas.put("appAgentIDNo", affiliate.getIdentityNumAgent());
76
+                    } else if (identityType == 2) {  //被申请人
67 77
                         datas.put("resName", affiliate.getName());
68 78
                         datas.put("resIDNo", affiliate.getIdentityNum());
69 79
                         datas.put("resAddress", affiliate.getContactAddress());
70 80
                         datas.put("resAgentName", affiliate.getNameAgent());
71
-                        datas.put("resAgentIDNo",affiliate.getIdentityNumAgent());
81
+                        datas.put("resAgentIDNo", affiliate.getIdentityNumAgent());
72 82
                     }
73 83
                 }
74 84
             }
75 85
             String arbitratorName = caseApplication1.getArbitratorName();
76
-            datas.put("caseName",caseApplication1.getCaseName());
77
-            datas.put("arbitratorName",arbitratorName);
86
+            datas.put("caseName", caseApplication1.getCaseName());
87
+            datas.put("arbitratorName", arbitratorName);
78 88
             Date hearDate = caseApplication1.getHearDate();
79 89
             if (hearDate != null) {
80 90
                 LocalDate localDate = hearDate.toInstant()
81 91
                         .atZone(ZoneId.systemDefault())
82 92
                         .toLocalDate();
83
-                datas.put("hearYear",  localDate.getYear());
84
-                datas.put("hearMonths",  localDate.getMonthValue());
85
-                datas.put("hearDay",  localDate.getDayOfMonth());
86
-            }else {
87
-                datas.put("hearYear",  null);
88
-                datas.put("hearMonths",  null);
89
-                datas.put("hearDay",  null);
93
+                datas.put("hearYear", localDate.getYear());
94
+                datas.put("hearMonths", localDate.getMonthValue());
95
+                datas.put("hearDay", localDate.getDayOfMonth());
96
+            } else {
97
+                datas.put("hearYear", null);
98
+                datas.put("hearMonths", null);
99
+                datas.put("hearDay", null);
90 100
             }
91
-            datas.put("appArbitrationClaims",  caseApplication1.getArbitratClaims());
92
-            if (arbitrateRecord1!=null){
101
+            datas.put("appArbitrationClaims", caseApplication1.getArbitratClaims());
102
+            if (arbitrateRecord1 != null) {
93 103
                 datas.put("evidenDetermi", arbitrateRecord1.getEvidenDetermi());
94 104
                 datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
95 105
                 datas.put("caseSketch", arbitrateRecord1.getCaseSketch());
@@ -97,10 +107,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
97 107
                 datas.put("rulingFollows", arbitrateRecord1.getRulingFollows());
98 108
             }
99 109
             datas.put("legalProvisions", "仲裁法");
100
-            if (arbitratorName==null){
110
+            if (arbitratorName == null) {
101 111
                 datas.put("arbitratorName1", null);
102 112
                 datas.put("arbitratorName2", null);
103
-            }else if (arbitratorName.contains(",")){
113
+            } else if (arbitratorName.contains(",")) {
104 114
                 String[] nameArray = arbitratorName.split(",");
105 115
                 String firstName = nameArray[0];
106 116
                 String secondName = nameArray[1];
@@ -115,10 +125,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
115 125
             datas.put("year", now.getYear());
116 126
             datas.put("months", now.getMonthValue());
117 127
             datas.put("day", now.getDayOfMonth());
118
-            String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
119
-            //String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
120
-            String saveFolderPath = "/data/arbitrate-document/formal/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
121
-            //String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
128
+            //String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
129
+            String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
130
+            //String saveFolderPath = "/data/arbitrate-document/formal/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
131
+            String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
122 132
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
123 133
             String resultFilePath = saveFolderPath + "/" + fileName;
124 134
             // 创建日期目录
@@ -129,7 +139,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
129 139
             Path sourcePath = new File(modalFilePath).toPath();
130 140
             Path destinationPath = new File(resultFilePath).toPath();
131 141
             Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
132
-            String docFilePath = WordUtil.getDocFilePath(datas,modalFilePath,resultFilePath);
142
+            String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
133 143
             //修改案件状态
134 144
             caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
135 145
             caseApplicationMapper.submitCaseApplication(caseApplication1);
@@ -141,8 +151,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
141 151
                     .annexType(3)
142 152
                     .build();
143 153
             int i = caseAttachMapper.save(caseAttach);
144
-            if (i>0){
145
-                if (arbitrateRecord1!=null){
154
+            if (i > 0) {
155
+                if (arbitrateRecord1 != null) {
146 156
                     Integer annexId = caseAttach.getAnnexId();
147 157
                     //将附件id保存到仲裁记录表里面
148 158
                     arbitrateRecord1.setAnnexId(annexId);
@@ -157,7 +167,81 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
157 167
     }
158 168
 
159 169
     @Override
160
-    public AjaxResult sendDocumentByEmail() {
170
+    public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail) {
171
+        CaseApplication caseApplication = new CaseApplication();
172
+        caseApplication.setId(id);
173
+        CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
174
+        if (caseApplication1 == null) {
175
+            return AjaxResult.error("未查询到相关案件");
176
+        }
177
+
178
+        //根据案件id查询裁决书
179
+        try {
180
+            List<File> fileList = new ArrayList<>();
181
+            List<CaseAttach> caseAttachList = caseAttachMapper.queryAnnexPathByCaseId(id);
182
+            if (caseAttachList != null && caseAttachList.size() > 0) {
183
+                for (CaseAttach caseAttach : caseAttachList) {
184
+                    if (caseAttach.getAnnexType() == 3) {
185
+                        String annexPath = caseAttach.getAnnexPath();
186
+                        fileList.add(new File(annexPath));
187
+                    }
188
+                }
189
+            }
190
+            //电子邮件送达
191
+            JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender();
192
+            if (appEmail != null) {
193
+                emailOutUtil.sendMessageCarryFiles(appEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", fileList
194
+                        , "hjbjava@163.com", javaMailSender);
195
+            }
196
+            if (resEmail != null) {
197
+                emailOutUtil.sendMessageCarryFiles(resEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", fileList
198
+                        , "hjbjava@163.com", javaMailSender);
199
+            }
200
+            //修改案件状态
201
+            caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING);
202
+            caseApplicationMapper.submitCaseApplication(caseApplication1);
203
+            return AjaxResult.success("仲裁文书送达成功");
204
+        } catch (MailSendException e) {
205
+            return AjaxResult.error("发送失败,请检查文件路径");
206
+        }
207
+    }
208
+
209
+    @Override
210
+    public AjaxResult getLogisticsInfo(String trackingNum, Integer phoneLastFour) {
211
+        try {
212
+            //快递单号查询
213
+            String key = "70ba5c7b327f71fccd5924f70e3e7b7f";
214
+            String com = "auto";
215
+            // 构造查询字符串参数
216
+            String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d",
217
+                    URLEncoder.encode(key, "UTF-8"),
218
+                    URLEncoder.encode(com, "UTF-8"),
219
+                    URLEncoder.encode(trackingNum, "UTF-8"),
220
+                    phoneLastFour);
221
+            // 拼接到API URL中
222
+            String fullUrl = apiUrl + "?" + queryParameters;
223
+            URL url = new URL(fullUrl);
224
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
225
+            connection.setRequestMethod("GET");
226
+            int responseCode = connection.getResponseCode();
227
+            if (responseCode == HttpURLConnection.HTTP_OK) {
228
+                BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
229
+                String line;
230
+                StringBuilder response = new StringBuilder();
231
+                while ((line = reader.readLine()) != null) {
232
+                    response.append(line);
233
+                }
234
+                reader.close();
235
+                // 处理返回的响应数据
236
+                return AjaxResult.success(response);
237
+            } else {
238
+                // 请求失败
239
+                return AjaxResult.error("请求失败,错误码:" + responseCode);
240
+            }
241
+        } catch (IOException e) {
242
+            e.printStackTrace();
243
+
244
+        }
161 245
         return null;
162 246
     }
163 247
 }