Parcourir la source

Merge branch 'hjb' of SH-Arbitrate/Arbitrate-Backend into dev

hejinbo il y a 2 ans
Parent
révision
7e8d1f3d06

+ 30
- 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java Voir le fichier

@@ -6,18 +6,44 @@ 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")
16 13
 public class AdjudicationController extends BaseController {
17 14
     @Autowired
18 15
     private IAdjudicationService adjudicationService;
16
+
17
+    /**
18
+     * 生成裁决书
19
+     * @param caseApplication
20
+     * @return
21
+     */
19 22
     @PostMapping("/document")
20 23
     public AjaxResult createDocument(@Validated @RequestBody CaseApplication caseApplication){
21 24
         return adjudicationService.createDocument(caseApplication);
22 25
     }
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);
48
+    }
23 49
 }

+ 11
- 0
ruoyi-admin/src/main/resources/application.yml Voir le fichier

@@ -91,6 +91,17 @@ spring:
91 91
   web:
92 92
     resources:
93 93
       static-locations:  file:/home/ruoyi/
94
+  mail:
95
+    host: smtp.163.com
96
+    port: 25
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
94 105
 
95 106
 # token配置
96 107
 token:

+ 22
- 0
ruoyi-common/pom.xml Voir le fichier

@@ -152,6 +152,28 @@
152 152
             <version>1.9.1</version>
153 153
         </dependency>
154 154
 
155
+        <!--  发送邮件-->
156
+        <dependency>
157
+            <groupId>org.springframework.boot</groupId>
158
+            <artifactId>spring-boot-starter-mail</artifactId>
159
+            <version>3.1.4</version>
160
+        </dependency>
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
+
155 177
     </dependencies>
156 178
 
157 179
 </project>

+ 187
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java Voir le fichier

@@ -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
+}

+ 1
- 2
ruoyi-common/src/main/java/com/ruoyi/common/utils/WordUtil.java Voir le fichier

@@ -19,8 +19,7 @@ import java.util.List;
19 19
 import java.util.Map;
20 20
 
21 21
 /**
22
- * @Author: ymbgy
23
- * @Date: 2022-09-21 13:26
22
+ * 文档生成工具类
24 23
  */
25 24
 public class WordUtil {
26 25
 

+ 4
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java Voir le fichier

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

+ 144
- 48
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java Voir le fichier

@@ -1,7 +1,9 @@
1 1
 package com.ruoyi.wisdomarbitrate.service.impl;
2 2
 
3 3
 import com.deepoove.poi.config.Configure;
4
+import com.ruoyi.common.constant.CaseApplicationConstants;
4 5
 import com.ruoyi.common.core.domain.AjaxResult;
6
+import com.ruoyi.common.utils.EmailOutUtil;
5 7
 import com.ruoyi.common.utils.WordUtil;
6 8
 import com.ruoyi.wisdomarbitrate.domain.*;
7 9
 import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper;
@@ -11,9 +13,14 @@ import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
11 13
 import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
12 14
 import org.apache.poi.xwpf.usermodel.*;
13 15
 import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.mail.MailSendException;
17
+import org.springframework.mail.javamail.JavaMailSender;
14 18
 import org.springframework.stereotype.Service;
15 19
 
16 20
 import java.io.*;
21
+import java.net.HttpURLConnection;
22
+import java.net.URL;
23
+import java.net.URLEncoder;
17 24
 import java.nio.file.Files;
18 25
 import java.nio.file.Path;
19 26
 import java.nio.file.StandardCopyOption;
@@ -24,6 +31,8 @@ import java.util.*;
24 31
 
25 32
 @Service
26 33
 public class AdjudicationServiceImpl implements IAdjudicationService {
34
+    private final String apiUrl = "http://api.cainiaoapi.com/api/exp/v1/index";
35
+
27 36
     @Autowired
28 37
     private CaseApplicationMapper caseApplicationMapper;
29 38
     @Autowired
@@ -32,14 +41,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
32 41
     private ArbitrateRecordMapper arbitrateRecordMapper;
33 42
     @Autowired
34 43
     private CaseAttachMapper caseAttachMapper;
44
+    @Autowired
45
+    private EmailOutUtil emailOutUtil;
35 46
 
36 47
     @Override
37 48
     public AjaxResult createDocument(CaseApplication caseApplication) {
38 49
         try {
39 50
             Map<String, Object> datas = new HashMap<>();
40
-            Adjudication adjudication = new Adjudication();
41 51
             Long id = caseApplication.getId();
42
-            if (id == null){
52
+            if (id == null) {
43 53
                 return null;
44 54
             }
45 55
             //获取案件详细信息
@@ -53,59 +63,60 @@ 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) {    //申请人
61 71
                         datas.put("appName", affiliate.getName());
62
-                        datas.put("appSex", null);
63 72
                         datas.put("appIDNo", affiliate.getIdentityNum());
64 73
                         datas.put("appAddress", affiliate.getContactAddress());
65 74
                         datas.put("appAgentName", affiliate.getNameAgent());
66
-                        datas.put("appAgentIDNo",affiliate.getIdentityNumAgent());
67
-                    }else if (identityType == 2){  //被申请人
75
+                        datas.put("appAgentIDNo", affiliate.getIdentityNumAgent());
76
+                    } else if (identityType == 2) {  //被申请人
68 77
                         datas.put("resName", affiliate.getName());
69
-                        datas.put("resSex", null);
70 78
                         datas.put("resIDNo", affiliate.getIdentityNum());
71 79
                         datas.put("resAddress", affiliate.getContactAddress());
72 80
                         datas.put("resAgentName", affiliate.getNameAgent());
73
-                        datas.put("resAgentIDNo",affiliate.getIdentityNumAgent());
81
+                        datas.put("resAgentIDNo", affiliate.getIdentityNumAgent());
74 82
                     }
75 83
                 }
76 84
             }
77 85
             String arbitratorName = caseApplication1.getArbitratorName();
78
-            datas.put("caseName",caseApplication1.getCaseName());
79
-            datas.put("arbitratorName",arbitratorName);
80
-            LocalDate localDate = caseApplication1.getHearDate()
81
-                    .toInstant()
82
-                    .atZone(ZoneId.systemDefault())
83
-                    .toLocalDate();
84
-            datas.put("hearYear",  localDate.getYear());
85
-            datas.put("hearMonths",  localDate.getMonthValue());
86
-            datas.put("hearDay",  localDate.getDayOfMonth());
87
-            datas.put("appArbitrationClaims", null);
88
-            datas.put("appEvidenceName", null);
89
-            datas.put("appProveFacts", null);
90
-            datas.put("resDefenseContentToApp", null);
91
-            datas.put("resArbitrationClaims", null);
92
-            datas.put("resEvidenceName", null);
93
-            datas.put("resProveFacts", null);
94
-            datas.put("appDefenseContentToRes", null);
95
-            datas.put("evidenDetermi", arbitrateRecord1.getEvidenDetermi());
96
-            datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
97
-            datas.put("caseSketch", arbitrateRecord1.getCaseSketch());
98
-            datas.put("arbitrateThink", arbitrateRecord1.getArbitrateThink());
99
-            datas.put("legalProvisions", null);
100
-            datas.put("rulingFollows", arbitrateRecord1.getRulingFollows());
101
-            datas.put("umpire", null);
102
-            if (arbitratorName.contains(",")){
86
+            datas.put("caseName", caseApplication1.getCaseName());
87
+            datas.put("arbitratorName", arbitratorName);
88
+            Date hearDate = caseApplication1.getHearDate();
89
+            if (hearDate != null) {
90
+                LocalDate localDate = hearDate.toInstant()
91
+                        .atZone(ZoneId.systemDefault())
92
+                        .toLocalDate();
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);
100
+            }
101
+            datas.put("appArbitrationClaims", caseApplication1.getArbitratClaims());
102
+            if (arbitrateRecord1 != null) {
103
+                datas.put("evidenDetermi", arbitrateRecord1.getEvidenDetermi());
104
+                datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
105
+                datas.put("caseSketch", arbitrateRecord1.getCaseSketch());
106
+                datas.put("arbitrateThink", arbitrateRecord1.getArbitrateThink());
107
+                datas.put("rulingFollows", arbitrateRecord1.getRulingFollows());
108
+            }
109
+            datas.put("legalProvisions", "仲裁法");
110
+            if (arbitratorName == null) {
111
+                datas.put("arbitratorName1", null);
112
+                datas.put("arbitratorName2", null);
113
+            } else if (arbitratorName.contains(",")) {
103 114
                 String[] nameArray = arbitratorName.split(",");
104 115
                 String firstName = nameArray[0];
105 116
                 String secondName = nameArray[1];
106 117
                 datas.put("arbitratorName1", firstName);
107 118
                 datas.put("arbitratorName2", secondName);
108
-            }else {
119
+            } else {
109 120
                 String secondName = "";
110 121
                 datas.put("arbitratorName1", arbitratorName);
111 122
                 datas.put("arbitratorName2", secondName);
@@ -114,19 +125,24 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
114 125
             datas.put("year", now.getYear());
115 126
             datas.put("months", now.getMonthValue());
116 127
             datas.put("day", now.getDayOfMonth());
117
-            datas.put("clerk", null);
118
-            String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
119
-
120
-            String currentDateStr = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
121
-            String saveFolderPath = "/data/arbitrate-document/formal/" + currentDateStr;
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();
132
+            String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
133
+            String resultFilePath = saveFolderPath + "/" + fileName;
122 134
             // 创建日期目录
123 135
             File saveFolder = new File(saveFolderPath);
124 136
             if (!saveFolder.exists()) {
125 137
                 saveFolder.mkdirs();
126 138
             }
127
-            String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
128
-            String resultFilePath = saveFolderPath+ fileName;
139
+            Path sourcePath = new File(modalFilePath).toPath();
140
+            Path destinationPath = new File(resultFilePath).toPath();
141
+            Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
129 142
             String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
143
+            //修改案件状态
144
+            caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
145
+            caseApplicationMapper.submitCaseApplication(caseApplication1);
130 146
             //将裁决书保存到附件表里
131 147
             CaseAttach caseAttach = CaseAttach.builder()
132 148
                     .caseAppliId(id)
@@ -135,13 +151,93 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
135 151
                     .annexType(3)
136 152
                     .build();
137 153
             int i = caseAttachMapper.save(caseAttach);
138
-            if (i>0){
139
-                Integer annexId = caseAttach.getAnnexId();
140
-                //将附件id保存到仲裁记录表里面
141
-                arbitrateRecord1.setAnnexId(annexId);
142
-                arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
154
+            if (i > 0) {
155
+                if (arbitrateRecord1 != null) {
156
+                    Integer annexId = caseAttach.getAnnexId();
157
+                    //将附件id保存到仲裁记录表里面
158
+                    arbitrateRecord1.setAnnexId(annexId);
159
+                    arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
160
+                }
161
+            }
162
+            return AjaxResult.success("裁决书已生成");
163
+        } catch (IOException e) {
164
+            e.printStackTrace();
165
+        }
166
+        return null;
167
+    }
168
+
169
+    @Override
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);
143 240
             }
144
-            return AjaxResult.success("裁决书保存路径为" + docFilePath);
145 241
         } catch (IOException e) {
146 242
             e.printStackTrace();
147 243
         }

+ 47
- 16
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java Voir le fichier

@@ -42,12 +42,22 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
42 42
         if (opinion==0){   //拒绝
43 43
             if (arbitratMethod == 2){
44 44
                 caseApplication1.setArbitratMethod(1);  // 更改仲裁方式
45
+                //修改案件状态为待开庭审理
46
+                caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR);
45 47
             }else {
46 48
                 caseApplication1.setArbitratMethod(2);
49
+                //修改案件状态为待书面审理
50
+                caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR);
51
+            }
52
+        }else {
53
+            if (arbitratMethod == 2){
54
+                //修改案件状态为待书面审理
55
+                caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR);
56
+            }else {
57
+                //修改案件状态为待开庭审理
58
+                caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR);
47 59
             }
48 60
         }
49
-        //修改案件状态为待开庭
50
-        caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR);
51 61
         int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
52 62
         if (i > 0) {
53 63
             String arbitratMethodStr = caseApplication1.getArbitratMethod() == 1 ? "开庭审理" : "书面审理";
@@ -92,21 +102,42 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
92 102
         if (createBy!=null){
93 103
             arbitrateRecord.setCreateBy(createBy);
94 104
         }
95
-        //提交仲裁结果
96
-        int i =  arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord);
97
-        if (i>0){
98
-            //案件日志表里添加数据
99
-            CaseLogRecord caseLogRecord = new CaseLogRecord();
100
-            caseLogRecord.setCaseAppliId(caseApplication1.getId());
101
-            caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
102
-            if (createBy!=null){
103
-                caseLogRecord.setCreateBy(createBy);
105
+        //先判断案件是否已经提交过仲裁结果
106
+        ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
107
+        if (arbitrateRecord1!=null){
108
+            int i = arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
109
+            if (i>0){
110
+                //案件日志表里添加数据
111
+                CaseLogRecord caseLogRecord = new CaseLogRecord();
112
+                caseLogRecord.setCaseAppliId(caseApplication1.getId());
113
+                caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
114
+                if (createBy!=null){
115
+                    caseLogRecord.setCreateBy(createBy);
116
+                }
117
+                caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
118
+                //修改案件状态
119
+                caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION);
120
+                caseApplicationMapper.submitCaseApplication(caseApplication);
121
+                return AjaxResult.success("提交成功");
122
+            }
123
+        }else {
124
+            //提交仲裁结果
125
+            int i =  arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord);
126
+
127
+            if (i>0){
128
+                //案件日志表里添加数据
129
+                CaseLogRecord caseLogRecord = new CaseLogRecord();
130
+                caseLogRecord.setCaseAppliId(caseApplication1.getId());
131
+                caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
132
+                if (createBy!=null){
133
+                    caseLogRecord.setCreateBy(createBy);
134
+                }
135
+                caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
136
+                //修改案件状态
137
+                caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION);
138
+                caseApplicationMapper.submitCaseApplication(caseApplication);
139
+                return AjaxResult.success("提交成功");
104 140
             }
105
-            caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
106
-            //修改案件状态
107
-            caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION);
108
-            caseApplicationMapper.submitCaseApplication(caseApplication);
109
-            return AjaxResult.success("提交成功");
110 141
         }
111 142
         return AjaxResult.error("暂无需要提交仲裁结果的案件");
112 143
     }

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java Voir le fichier

@@ -85,7 +85,7 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
85 85
         caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
86 86
         //修改案件状态
87 87
         caseApplicationMapper.submitCaseApplication(caseApplication1);
88
-        return AjaxResult.success();
88
+        return AjaxResult.success("支付成功");
89 89
     }
90 90
 
91 91
     @Override