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

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

@@ -41,12 +41,11 @@ 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(@Validated @RequestBody CaseApplication caseApplication){
49
+        return adjudicationService.getLogisticsInfo(caseApplication);
51 50
     }
52 51
 }

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

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

@@ -8,5 +8,5 @@ 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 12
 }

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

@@ -1,11 +1,14 @@
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;
@@ -47,6 +50,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
47 50
     private EmailOutUtil emailOutUtil;
48 51
     @Autowired
49 52
     private ICaseApplicationService caseApplicationService;
53
+
50 54
     @Override
51 55
     public AjaxResult createDocument(CaseApplication caseApplication) {
52 56
         try {
@@ -133,10 +137,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
133 137
             datas.put("day", day);
134 138
             String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
135 139
             //String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
136
-            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" +year + "/" + month + "/" + day;
140
+            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
137 141
             //String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
138 142
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
139
-            String saveName = "/profile/upload/"+year + "/" + month + "/" + day +"/" +fileName;
143
+            String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
140 144
             String resultFilePath = saveFolderPath + "/" + fileName;
141 145
             // 创建日期目录
142 146
             File saveFolder = new File(saveFolderPath);
@@ -176,7 +180,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
176 180
 
177 181
     @Override
178 182
     @Transactional
179
-    public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail ,String apptrackingNum,String restrackingNum) {
183
+    public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum) {
180 184
         CaseApplication caseApplication = new CaseApplication();
181 185
         caseApplication.setId(id);
182 186
         CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
@@ -189,15 +193,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
189 193
             List<File> fileList = new ArrayList<>();
190 194
             CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
191 195
             List<CaseAttach> caseAttachList = caseApplication2.getCaseAttachList();
192
-            if (caseAttachList!=null&& caseAttachList.size()>0){
196
+            if (caseAttachList != null && caseAttachList.size() > 0) {
193 197
                 for (CaseAttach caseAttach : caseAttachList) {
194
-                    if (caseAttach.getAnnexType() == 3){
198
+                    if (caseAttach.getAnnexType() == 3) {
195 199
                         String annexPath = caseAttach.getAnnexPath();
196 200
                         fileList.add(new File(annexPath));
197 201
                     }
198 202
                 }
199 203
             }
200
-            if (fileList.size()<1){
204
+            if (fileList.size() < 1) {
201 205
                 return AjaxResult.error("未查询到裁决书");
202 206
             }
203 207
             File file = fileList.get(0);
@@ -218,13 +222,13 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
218 222
             CaseAffiliate caseAffiliate = new CaseAffiliate();
219 223
             caseAffiliate.setCaseAppliId(id);
220 224
             List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
221
-            if (caseAffiliates!=null&&caseAffiliates.size()>0){
225
+            if (caseAffiliates != null && caseAffiliates.size() > 0) {
222 226
                 for (CaseAffiliate affiliate : caseAffiliates) {
223
-                    if (affiliate.getIdentityType() == 1){  //申请人
227
+                    if (affiliate.getIdentityType() == 1) {  //申请人
224 228
                         affiliate.setSendEmail(appEmail);
225 229
                         affiliate.setTrackNum(apptrackingNum);
226 230
                         caseAffiliateMapper.updataCaseAffiliate(affiliate);
227
-                    }else {
231
+                    } else {
228 232
                         affiliate.setSendEmail(resEmail);
229 233
                         affiliate.setTrackNum(restrackingNum);
230 234
                         caseAffiliateMapper.updataCaseAffiliate(affiliate);
@@ -238,36 +242,56 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
238 242
     }
239 243
 
240 244
     @Override
241
-    public AjaxResult getLogisticsInfo(String trackingNum, Integer phoneLastFour) {
245
+    public AjaxResult getLogisticsInfo(CaseApplication caseApplication) {
242 246
         try {
243 247
             //快递单号查询
244 248
             String key = "70ba5c7b327f71fccd5924f70e3e7b7f";
245 249
             String com = "auto";
246
-            // 构造查询字符串参数
247
-            String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d",
248
-                    URLEncoder.encode(key, "UTF-8"),
249
-                    URLEncoder.encode(com, "UTF-8"),
250
-                    URLEncoder.encode(trackingNum, "UTF-8"),
251
-                    phoneLastFour);
252
-            // 拼接到API URL中
253
-            String fullUrl = apiUrl + "?" + queryParameters;
254
-            URL url = new URL(fullUrl);
255
-            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
256
-            connection.setRequestMethod("GET");
257
-            int responseCode = connection.getResponseCode();
258
-            if (responseCode == HttpURLConnection.HTTP_OK) {
259
-                BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
260
-                String line;
261
-                StringBuilder response = new StringBuilder();
262
-                while ((line = reader.readLine()) != null) {
263
-                    response.append(line);
250
+            //根据案件id查询单号信息
251
+            CaseAffiliate caseAffiliate = new CaseAffiliate();
252
+            caseAffiliate.setCaseAppliId(caseApplication.getId());
253
+            List<LogisticsInfoVO> logisticsInfoVOList = new ArrayList<>();
254
+            List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
255
+            if (caseAffiliates != null && caseAffiliates.size() > 0) {
256
+                for (CaseAffiliate affiliate : caseAffiliates) {
257
+                    LogisticsInfoVO logisticsInfoVO = new LogisticsInfoVO();
258
+                    String trackNum = affiliate.getTrackNum();
259
+                    if (trackNum != null) {
260
+                        // 构造查询字符串参数
261
+                        String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d",
262
+                                URLEncoder.encode(key, "UTF-8"),
263
+                                URLEncoder.encode(com, "UTF-8"),
264
+                                URLEncoder.encode(trackNum, "UTF-8"), null);
265
+                        // 拼接到API URL中
266
+                        String fullUrl = apiUrl + "?" + queryParameters;
267
+                        URL url = new URL(fullUrl);
268
+                        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
269
+                        connection.setRequestMethod("GET");
270
+                        int responseCode = connection.getResponseCode();
271
+                        if (responseCode == HttpURLConnection.HTTP_OK) {
272
+                            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
273
+                            String line;
274
+                            StringBuilder response = new StringBuilder();
275
+                            while ((line = reader.readLine()) != null) {
276
+                                response.append(line);
277
+                            }
278
+                            reader.close();
279
+                            // 处理返回的响应数据\
280
+                            JSONObject jsonObject = JSON.parseObject(response.toString());
281
+                            // 提取 "data" 字段并转换为字符串
282
+                            String data = jsonObject.getString("data");
283
+                            if (data != null) {
284
+                                logisticsInfoVO.setIdentityType(affiliate.getIdentityType());
285
+                                logisticsInfoVO.setLogisticsInfo(data);
286
+                                logisticsInfoVOList.add(logisticsInfoVO);
287
+                            }
288
+                        } else {
289
+                            // 请求失败
290
+                            return AjaxResult.error("请求失败,错误码:" + responseCode);
291
+                        }
292
+                    }
264 293
                 }
265
-                reader.close();
266
-                // 处理返回的响应数据
267
-                return AjaxResult.success(response);
268
-            } else {
269
-                // 请求失败
270
-                return AjaxResult.error("请求失败,错误码:" + responseCode);
294
+                return AjaxResult.success(logisticsInfoVOList);
271 295
             }
272 296
         } catch (IOException e) {
273 297
             e.printStackTrace();

+ 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 ">