ソースを参照

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

hejinbo 2 年 前
コミット
a9af3ebdbb

+ 2
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/bestsign/RegisterController.java ファイルの表示

@@ -26,4 +26,6 @@ public class RegisterController {
26 26
     public AjaxResult createDocument(@Validated @RequestBody PersonRegisterVO personRegisterVO) {
27 27
         return signRegisterService.registerPerson(personRegisterVO);
28 28
     }
29
+//    @PostMapping("/registerEnterprise")
30
+//    public AjaxResult
29 31
 }

+ 38
- 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java ファイルの表示

@@ -41,12 +41,46 @@ public class AdjudicationController extends BaseController {
41 41
 
42 42
     /**
43 43
      * 根据快递单号查询物流信息
44
-     * @param trackingNum 单号
45
-     * @param phoneLastFour 收/寄件人手机号后四位,顺丰快递需填写本字段。
44
+     * @param caseApplication
46 45
      * @return
47 46
      */
48 47
     @GetMapping("/logistics")
49
-    public AjaxResult  getLogisticsInfo(String trackingNum,Integer phoneLastFour){
50
-        return adjudicationService.getLogisticsInfo(trackingNum,phoneLastFour);
48
+    public AjaxResult  getLogisticsInfo(CaseApplication caseApplication){
49
+        return adjudicationService.getLogisticsInfo(caseApplication);
50
+    }
51
+
52
+    /**
53
+     * 签名(暂时只改案件状态)
54
+     * @param caseApplication
55
+     * @return
56
+     */
57
+    @PostMapping("/signature")
58
+    public AjaxResult signature(@Validated @RequestBody CaseApplication caseApplication){
59
+        return adjudicationService.signature(caseApplication);
60
+    }
61
+
62
+    /**
63
+     * 归档(暂时只改案件状态)
64
+     * @param caseApplication
65
+     * @return
66
+     */
67
+    @PostMapping("/caseFile")
68
+    public AjaxResult caseFile(@Validated @RequestBody CaseApplication caseApplication){
69
+        return adjudicationService.caseFile(caseApplication);
70
+    }
71
+
72
+    /**
73
+     * 送达(不包含发送电子邮件)
74
+     * @param id
75
+     * @param appEmail
76
+     * @param resEmail
77
+     * @param apptrackingNum
78
+     * @param restrackingNum
79
+     * @return
80
+     */
81
+    @PostMapping("/service")
82
+    public AjaxResult service(Long id,String appEmail,String resEmail
83
+            ,String apptrackingNum,String restrackingNum){
84
+        return adjudicationService.service(id,appEmail,resEmail,apptrackingNum,restrackingNum);
51 85
     }
52 86
 }

+ 3
- 2
ruoyi-common/src/main/java/com/ruoyi/common/constant/CaseApplicationConstants.java ファイルの表示

@@ -37,12 +37,13 @@ public class CaseApplicationConstants {
37 37
     /**待仲裁文书签名*/
38 38
     public static final int SIGN_ARBITRATION = 13;
39 39
     /** 待仲裁文书用印 */
40
-    public static final int ARBITRATED_SEAL = 14;
40
+    public static final int     ARBITRATED_SEAL = 14;
41 41
     /** 待仲裁文书送达 */
42 42
     public static final int ARBITRATION_DELIVERY = 15;
43 43
     /** 待案件归档*/
44 44
     public static final int CASE_FILING = 16;
45
-
45
+    /** 已归档*/
46
+    public static final int CASE_ARCHIVED = 17;
46 47
 
47 48
 
48 49
 

+ 16
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/LogisticsInfoVO.java ファイルの表示

@@ -0,0 +1,16 @@
1
+package com.ruoyi.wisdomarbitrate.domain.vo;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class LogisticsInfoVO {
7
+    /**
8
+     * 案件关联人身份类型
9
+     */
10
+    private Integer identityType;
11
+
12
+    /**
13
+     * 物流信息
14
+     */
15
+    private String logisticsInfo;
16
+}

+ 8
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java ファイルの表示

@@ -8,5 +8,12 @@ public interface IAdjudicationService {
8 8
 
9 9
     AjaxResult sendDocumentByEmail(Long id,String appEmail,String resEmail ,String apptrackingNum,String restrackingNum);
10 10
 
11
-    AjaxResult getLogisticsInfo(String trackingNum,Integer phoneLastFour);
11
+    AjaxResult getLogisticsInfo(CaseApplication caseApplication);
12
+
13
+    AjaxResult signature(CaseApplication caseApplication);
14
+
15
+    AjaxResult caseFile(CaseApplication caseApplication);
16
+
17
+    AjaxResult service(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum);
18
+
12 19
 }

+ 141
- 39
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java ファイルの表示

@@ -1,16 +1,21 @@
1 1
 package com.ruoyi.wisdomarbitrate.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONObject;
3 5
 import com.deepoove.poi.config.Configure;
4 6
 import com.ruoyi.common.constant.CaseApplicationConstants;
5 7
 import com.ruoyi.common.core.domain.AjaxResult;
6 8
 import com.ruoyi.common.utils.EmailOutUtil;
7 9
 import com.ruoyi.common.utils.WordUtil;
8 10
 import com.ruoyi.wisdomarbitrate.domain.*;
11
+import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO;
9 12
 import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper;
10 13
 import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
11 14
 import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
12 15
 import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
13 16
 import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
17
+import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
18
+import lombok.extern.slf4j.Slf4j;
14 19
 import org.apache.poi.xwpf.usermodel.*;
15 20
 import org.springframework.beans.factory.annotation.Autowired;
16 21
 import org.springframework.mail.MailSendException;
@@ -31,6 +36,7 @@ import java.time.format.DateTimeFormatter;
31 36
 import java.util.*;
32 37
 
33 38
 @Service
39
+@Slf4j
34 40
 public class AdjudicationServiceImpl implements IAdjudicationService {
35 41
     private final String apiUrl = "http://api.cainiaoapi.com/api/exp/v1/index";
36 42
 
@@ -44,6 +50,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
44 50
     private CaseAttachMapper caseAttachMapper;
45 51
     @Autowired
46 52
     private EmailOutUtil emailOutUtil;
53
+    @Autowired
54
+    private ICaseApplicationService caseApplicationService;
47 55
 
48 56
     @Override
49 57
     public AjaxResult createDocument(CaseApplication caseApplication) {
@@ -123,14 +131,18 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
123 131
                 datas.put("arbitratorName2", secondName);
124 132
             }
125 133
             LocalDate now = LocalDate.now();
126
-            datas.put("year", now.getYear());
127
-            datas.put("months", now.getMonthValue());
128
-            datas.put("day", now.getDayOfMonth());
134
+            String year = Integer.toString(now.getYear());
135
+            String month = String.format("%02d", now.getMonthValue());
136
+            String day = String.format("%02d", now.getDayOfMonth());
137
+            datas.put("year", year);
138
+            datas.put("months", month);
139
+            datas.put("day", day);
129 140
             String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
130 141
             //String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
131
-            String saveFolderPath = "/data/arbitrate-document/formal/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
142
+            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
132 143
             //String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
133 144
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
145
+            String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
134 146
             String resultFilePath = saveFolderPath + "/" + fileName;
135 147
             // 创建日期目录
136 148
             File saveFolder = new File(saveFolderPath);
@@ -141,14 +153,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
141 153
             Path destinationPath = new File(resultFilePath).toPath();
142 154
             Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
143 155
             String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
156
+            String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
144 157
             //修改案件状态
145 158
             caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
146 159
             caseApplicationMapper.submitCaseApplication(caseApplication1);
147 160
             //将裁决书保存到附件表里
148 161
             CaseAttach caseAttach = CaseAttach.builder()
149 162
                     .caseAppliId(id)
150
-                    .annexName(fileName)
151
-                    .annexPath(docFilePath)
163
+                    .annexName(saveName)
164
+                    .annexPath(savePath)
152 165
                     .annexType(3)
153 166
                     .build();
154 167
             int i = caseAttachMapper.save(caseAttach);
@@ -169,7 +182,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
169 182
 
170 183
     @Override
171 184
     @Transactional
172
-    public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail ,String apptrackingNum,String restrackingNum) {
185
+    public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum) {
173 186
         CaseApplication caseApplication = new CaseApplication();
174 187
         caseApplication.setId(id);
175 188
         CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
@@ -180,16 +193,21 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
180 193
         //根据案件id查询裁决书
181 194
         try {
182 195
             List<File> fileList = new ArrayList<>();
183
-            List<CaseAttach> caseAttachList = caseAttachMapper.queryAnnexPathByCaseId(id);
196
+            CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
197
+            List<CaseAttach> caseAttachList = caseApplication2.getCaseAttachList();
184 198
             if (caseAttachList != null && caseAttachList.size() > 0) {
185 199
                 for (CaseAttach caseAttach : caseAttachList) {
186 200
                     if (caseAttach.getAnnexType() == 3) {
187 201
                         String annexPath = caseAttach.getAnnexPath();
188
-                        fileList.add(new File(annexPath));
202
+                        //File file = new File("/home/ruoyi/" + annexPath);
203
+                        String path = "/home/ruoyi/" + annexPath;
204
+                        File file = new File(path);
205
+                        System.out.println("文件是:" + file);
206
+                        fileList.add(file);
189 207
                     }
190 208
                 }
191 209
             }
192
-            if (fileList.size()<1){
210
+            if (fileList.size() < 1) {
193 211
                 return AjaxResult.error("未查询到裁决书");
194 212
             }
195 213
             File file = fileList.get(0);
@@ -210,13 +228,13 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
210 228
             CaseAffiliate caseAffiliate = new CaseAffiliate();
211 229
             caseAffiliate.setCaseAppliId(id);
212 230
             List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
213
-            if (caseAffiliates!=null&&caseAffiliates.size()>0){
231
+            if (caseAffiliates != null && caseAffiliates.size() > 0) {
214 232
                 for (CaseAffiliate affiliate : caseAffiliates) {
215
-                    if (affiliate.getIdentityType() == 1){  //申请人
233
+                    if (affiliate.getIdentityType() == 1) {  //申请人
216 234
                         affiliate.setSendEmail(appEmail);
217 235
                         affiliate.setTrackNum(apptrackingNum);
218 236
                         caseAffiliateMapper.updataCaseAffiliate(affiliate);
219
-                    }else {
237
+                    } else {
220 238
                         affiliate.setSendEmail(resEmail);
221 239
                         affiliate.setTrackNum(restrackingNum);
222 240
                         caseAffiliateMapper.updataCaseAffiliate(affiliate);
@@ -230,40 +248,124 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
230 248
     }
231 249
 
232 250
     @Override
233
-    public AjaxResult getLogisticsInfo(String trackingNum, Integer phoneLastFour) {
251
+    public AjaxResult getLogisticsInfo(CaseApplication caseApplication) {
234 252
         try {
235 253
             //快递单号查询
236
-            String key = "70ba5c7b327f71fccd5924f70e3e7b7f";
254
+            String key = "729437f92468910aee6c12dbfeaee3c1";
237 255
             String com = "auto";
238
-            // 构造查询字符串参数
239
-            String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d",
240
-                    URLEncoder.encode(key, "UTF-8"),
241
-                    URLEncoder.encode(com, "UTF-8"),
242
-                    URLEncoder.encode(trackingNum, "UTF-8"),
243
-                    phoneLastFour);
244
-            // 拼接到API URL中
245
-            String fullUrl = apiUrl + "?" + queryParameters;
246
-            URL url = new URL(fullUrl);
247
-            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
248
-            connection.setRequestMethod("GET");
249
-            int responseCode = connection.getResponseCode();
250
-            if (responseCode == HttpURLConnection.HTTP_OK) {
251
-                BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
252
-                String line;
253
-                StringBuilder response = new StringBuilder();
254
-                while ((line = reader.readLine()) != null) {
255
-                    response.append(line);
256
+            //根据案件id查询单号信息
257
+            CaseAffiliate caseAffiliate = new CaseAffiliate();
258
+            caseAffiliate.setCaseAppliId(caseApplication.getId());
259
+            List<LogisticsInfoVO> logisticsInfoVOList = new ArrayList<>();
260
+            List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
261
+            if (caseAffiliates != null && caseAffiliates.size() > 0) {
262
+                for (CaseAffiliate affiliate : caseAffiliates) {
263
+                    LogisticsInfoVO logisticsInfoVO = new LogisticsInfoVO();
264
+                    String trackNum = affiliate.getTrackNum();
265
+                    if (trackNum != null) {
266
+                        // 构造查询字符串参数
267
+                        String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d",
268
+                                URLEncoder.encode(key, "UTF-8"),
269
+                                URLEncoder.encode(com, "UTF-8"),
270
+                                URLEncoder.encode(trackNum, "UTF-8"), null);
271
+                        // 拼接到API URL中
272
+                        String fullUrl = apiUrl + "?" + queryParameters;
273
+                        URL url = new URL(fullUrl);
274
+                        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
275
+                        connection.setRequestMethod("GET");
276
+                        int responseCode = connection.getResponseCode();
277
+                        if (responseCode == HttpURLConnection.HTTP_OK) {
278
+                            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
279
+                            String line;
280
+                            StringBuilder response = new StringBuilder();
281
+                            while ((line = reader.readLine()) != null) {
282
+                                response.append(line);
283
+                            }
284
+                            reader.close();
285
+                            // 处理返回的响应数据\
286
+                            JSONObject jsonObject = JSON.parseObject(response.toString());
287
+                            // 提取 "data" 字段并转换为字符串
288
+                            String data = jsonObject.getString("data");
289
+                            if (data != null) {
290
+                                logisticsInfoVO.setIdentityType(affiliate.getIdentityType());
291
+                                logisticsInfoVO.setLogisticsInfo(data);
292
+                                logisticsInfoVOList.add(logisticsInfoVO);
293
+                            }
294
+                        } else {
295
+                            // 请求失败
296
+                            return AjaxResult.error("请求失败,错误码:" + responseCode);
297
+                        }
298
+                    }
256 299
                 }
257
-                reader.close();
258
-                // 处理返回的响应数据
259
-                return AjaxResult.success(response);
260
-            } else {
261
-                // 请求失败
262
-                return AjaxResult.error("请求失败,错误码:" + responseCode);
300
+                return AjaxResult.success(logisticsInfoVOList);
263 301
             }
264 302
         } catch (IOException e) {
265 303
             e.printStackTrace();
266 304
         }
267 305
         return null;
268 306
     }
307
+
308
+    @Override
309
+    public AjaxResult signature(CaseApplication caseApplication) {
310
+        //更改案件状态(暂时)
311
+        caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
312
+        caseApplicationMapper.submitCaseApplication(caseApplication);
313
+        return AjaxResult.success("签名成功,案件状态已改为待仲裁文书用印");
314
+    }
315
+
316
+    @Override
317
+    public AjaxResult caseFile(CaseApplication caseApplication) {
318
+        //更改案件状态(暂时)
319
+        caseApplication.setCaseStatus(CaseApplicationConstants.CASE_ARCHIVED);
320
+        caseApplicationMapper.submitCaseApplication(caseApplication);
321
+        return AjaxResult.success("归档成功,案件状态已改为已归档");
322
+    }
323
+
324
+    @Override
325
+    public AjaxResult service(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum) {
326
+        CaseApplication caseApplication = new CaseApplication();
327
+        caseApplication.setId(id);
328
+        CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
329
+        if (caseApplication1 == null) {
330
+            return AjaxResult.error("未查询到相关案件");
331
+        }
332
+        //修改案件状态
333
+        caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING);
334
+        caseApplicationMapper.submitCaseApplication(caseApplication1);
335
+        //保存邮箱信息和快递单号到关联人表
336
+        CaseAffiliate caseAffiliate = new CaseAffiliate();
337
+        caseAffiliate.setCaseAppliId(id);
338
+        List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
339
+        if (caseAffiliates != null && caseAffiliates.size() > 0) {
340
+            for (CaseAffiliate affiliate : caseAffiliates) {
341
+                if (affiliate.getIdentityType() == 1) {  //申请人
342
+                    affiliate.setSendEmail(appEmail);
343
+                    affiliate.setTrackNum(apptrackingNum);
344
+                    caseAffiliateMapper.updataCaseAffiliate(affiliate);
345
+                } else {
346
+                    affiliate.setSendEmail(resEmail);
347
+                    affiliate.setTrackNum(restrackingNum);
348
+                    caseAffiliateMapper.updataCaseAffiliate(affiliate);
349
+                }
350
+            }
351
+        }
352
+        return AjaxResult.success("仲裁文书送达成功");
353
+    }
354
+
355
+    public static void main(String[] args) {
356
+        try {
357
+            List<File> fileList = new ArrayList<>();
358
+            fileList.add(new File("D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\b442880179844a848f1f8b08c29e3d0c.docx"));
359
+            File file = fileList.get(0);
360
+            //电子邮件送达
361
+            EmailOutUtil emailOutUtil = new EmailOutUtil();
362
+            JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender();
363
+            if (javaMailSender != null) {
364
+                emailOutUtil.sendMessageCarryFile("1154956315@qq.com", "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
365
+                        , "hjbjava@163.com", javaMailSender);
366
+            }
367
+        } catch (MailSendException e) {
368
+            e.printStackTrace();
369
+        }
370
+    }
269 371
 }

+ 3
- 1
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml ファイルの表示

@@ -18,12 +18,14 @@
18 18
         <result property="identityNumAgent"      column="identity_num_agent"     />
19 19
         <result property="contactTelphoneAgent"      column="contact_telphone_agent"     />
20 20
         <result property="contactAddressAgent"    column="contact_address_agent"   />
21
+        <result property="trackNum"    column="track_num"   />
21 22
 
22 23
     </resultMap>
23 24
 
24 25
     <select id="selectCaseAffiliate" parameterType="CaseAffiliate" resultMap="CaseAffiliateResult">
25 26
         select c.id ,c.case_appli_id ,c.identity_type ,c.name ,c.identity_num ,c.contact_telphone ,c.contact_address ,
26
-        c.work_address ,c.work_telphone ,c.name_agent, c.identity_num_agent ,c.contact_telphone_agent ,c.contact_address_agent
27
+        c.work_address ,c.work_telphone ,c.name_agent, c.identity_num_agent ,c.contact_telphone_agent ,c.contact_address_agent,
28
+        c.track_num
27 29
         from case_affiliate c
28 30
         <where>
29 31
             <if test="caseAppliId != null ">