Bladeren bron

批量缴费接口开发

hejinbo 2 jaren geleden
bovenliggende
commit
0b94672e58

+ 9
- 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java Bestand weergeven

@@ -6,7 +6,6 @@ import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
6 6
 import com.ruoyi.wisdomarbitrate.service.ICasePaymentService;
7 7
 import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO;
8 8
 import org.springframework.beans.factory.annotation.Autowired;
9
-import org.springframework.security.access.prepost.PreAuthorize;
10 9
 import org.springframework.validation.annotation.Validated;
11 10
 import org.springframework.web.bind.annotation.*;
12 11
 
@@ -52,4 +51,13 @@ public class CasePaymentController {
52 51
     public AjaxResult confirmPayment(@Validated @RequestBody CaseApplication caseApplication) {
53 52
         return paymentService.confirmPayment(caseApplication);
54 53
     }
54
+    /**
55
+     * 缴费列表查询
56
+     * @param casePayDTO
57
+     * @return
58
+     */
59
+    @GetMapping("/list")
60
+    public AjaxResult casePayList(CasePayDTO casePayDTO) {
61
+        return paymentService.casePayList(casePayDTO);
62
+    }
55 63
 }

+ 23
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplicationPay.java Bestand weergeven

@@ -0,0 +1,23 @@
1
+package com.ruoyi.wisdomarbitrate.domain;
2
+
3
+import com.ruoyi.common.annotation.Excel;
4
+import lombok.Data;
5
+
6
+import java.math.BigDecimal;
7
+
8
+@Data
9
+public class CaseApplicationPay {
10
+    /** 案件编号 */
11
+    private String caseNum;
12
+    /** 案件标的 */
13
+    private BigDecimal caseSubjectAmount;
14
+    /** 仲裁应缴费用 */
15
+    private BigDecimal feePayable;
16
+    /** 案件状态 */
17
+    private Integer caseStatus;
18
+    /**申请人 */
19
+    private String caseAppName;
20
+    /**被申请人 */
21
+    private String caseResName;
22
+
23
+}

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/CasePayDTO.java Bestand weergeven

@@ -13,7 +13,7 @@ public class CasePayDTO {
13 13
     /**
14 14
      * 案件id
15 15
      */
16
-    private Long caseId;
16
+    private List<Long> caseIds;
17 17
 
18 18
     /**
19 19
      * 订单金额 单位:分

+ 25
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CasePayListVO.java Bestand weergeven

@@ -0,0 +1,25 @@
1
+package com.ruoyi.wisdomarbitrate.domain.vo;
2
+
3
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
4
+import com.ruoyi.wisdomarbitrate.domain.CaseApplicationPay;
5
+import lombok.Data;
6
+
7
+import java.util.List;
8
+
9
+@Data
10
+public class CasePayListVO {
11
+    /**
12
+     * 订单总金额 单位:分
13
+     */
14
+    private int totalFee;
15
+
16
+    /**
17
+     * 案件总条数
18
+     */
19
+    private int CaseTotal;
20
+
21
+    /**
22
+     * 案件订单列表
23
+     */
24
+    private List<CaseApplicationPay> caseApplicationList;
25
+}

+ 4
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICasePaymentService.java Bestand weergeven

@@ -20,4 +20,8 @@ public interface ICasePaymentService {
20 20
      * @return
21 21
      */
22 22
     AjaxResult confirmPay(CaseConfirmPayDTO payDTO);
23
+
24
+
25
+    AjaxResult casePayList(CasePayDTO casePayDTO);
26
+
23 27
 }

+ 61
- 11
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java Bestand weergeven

@@ -11,7 +11,9 @@ import com.ruoyi.common.exception.ServiceException;
11 11
 import com.ruoyi.common.utils.SecurityUtils;
12 12
 import com.ruoyi.wisdomarbitrate.domain.*;
13 13
 import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
14
+import com.ruoyi.wisdomarbitrate.domain.vo.CasePayListVO;
14 15
 import com.ruoyi.wisdomarbitrate.mapper.*;
16
+import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
15 17
 import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
16 18
 import com.ruoyi.common.utils.SmsUtils;
17 19
 import com.ruoyi.dto.PayRequest;
@@ -22,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
22 24
 import org.springframework.stereotype.Service;
23 25
 import org.springframework.transaction.annotation.Transactional;
24 26
 
27
+import java.math.BigDecimal;
28
+import java.util.ArrayList;
25 29
 import java.util.Date;
26 30
 import java.util.List;
27 31
 
@@ -42,12 +46,15 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
42 46
     public CasePaymentServiceImpl(ElegentPay elegentPay
43 47
             , CaseApplicationMapper caseApplicationMapper
44 48
             , CasePaymentRecordMapper casePaymentRecordMapper
45
-            , CaseAffiliateMapper caseAffiliateMapper) {
49
+            , CaseAffiliateMapper caseAffiliateMapper
50
+            ) {
46 51
         this.elegentPay = elegentPay;
47 52
         this.caseApplicationMapper = caseApplicationMapper;
48 53
         this.casePaymentRecordMapper = casePaymentRecordMapper;
49 54
         this.caseAffiliateMapper = caseAffiliateMapper;
50 55
     }
56
+    @Autowired
57
+    private ICaseApplicationService caseApplicationService;
51 58
 
52 59
     @Override
53 60
     @Transactional
@@ -60,16 +67,22 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
60 67
         if (response.getCode_url() == null) {
61 68
             return AjaxResult.error();
62 69
         }
63
-        //缴费记录表里新增数据
64
-        CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
65
-        casePaymentRecord.setCaseId(casePayDTO.getCaseId());
66
-        casePaymentRecord.setOrderNumber(payRequest.getOrderSn());
67
-        casePaymentRecord.setPaymentStatus(0);
68
-        casePaymentRecord.setCreateTime(new Date());
69
-        int count = casePaymentRecordMapper.saveRecord(casePaymentRecord);
70
-        if (count < 1) {
70
+        List<Long> caseIds = casePayDTO.getCaseIds();
71
+        if (CollectionUtil.isEmpty(caseIds)) {
71 72
             return AjaxResult.error("请检查参数是否有误");
72 73
         }
74
+        for (Long caseId : caseIds) {
75
+            //缴费记录表里新增数据
76
+            CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
77
+            casePaymentRecord.setCaseId(caseId);
78
+            casePaymentRecord.setOrderNumber(payRequest.getOrderSn());
79
+            casePaymentRecord.setPaymentStatus(0);
80
+            casePaymentRecord.setCreateTime(new Date());
81
+            int count = casePaymentRecordMapper.saveRecord(casePaymentRecord);
82
+            if (count < 1) {
83
+                return AjaxResult.error("请检查参数是否有误");
84
+            }
85
+        }
73 86
         return AjaxResult.success(response);
74 87
     }
75 88
 
@@ -151,9 +164,9 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
151 164
                         String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信";
152 165
                         smsSendRecord.setSendContent(content);
153 166
                         smsSendRecord.setCreateBy(getUsername());
154
-                        if (aBoolean){
167
+                        if (aBoolean) {
155 168
                             smsSendRecord.setSendStatus(1);
156
-                        }else {
169
+                        } else {
157 170
                             smsSendRecord.setSendStatus(0);
158 171
                         }
159 172
                         smsRecordMapper.saveSmsSendRecord(smsSendRecord);
@@ -211,5 +224,42 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
211 224
         return AjaxResult.success("确认缴费失败");
212 225
     }
213 226
 
227
+    @Override
228
+    public AjaxResult casePayList(CasePayDTO casePayDTO) {
229
+        //参数校验
230
+        List<Long> caseIds = casePayDTO.getCaseIds();
231
+        if (caseIds == null || caseIds.size() == 0) {
232
+            return null;
233
+        }
234
+        BigDecimal totalCost  = new BigDecimal(0);
235
+        BigDecimal sum =totalCost;
236
+        CasePayListVO listVO = new CasePayListVO();
237
+        listVO.setCaseTotal(caseIds.size());
238
+        List<CaseApplicationPay> caseApplicationList =new ArrayList<>();
239
+        for (Long caseId : caseIds) {
240
+            CaseApplication caseApplication = new CaseApplication();
241
+            CaseApplicationPay caseApplicationPay = new CaseApplicationPay();
242
+            caseApplication.setId(caseId);
243
+            CaseApplication caseApplication1 = caseApplicationService.selectCaseApplication(caseApplication);
244
+            BigDecimal feePayable = caseApplication1.getFeePayable();
245
+            feePayable = feePayable.multiply(new BigDecimal(100));
246
+            sum = sum.add(feePayable);
247
+            listVO.setTotalFee(sum.intValue());
248
+            caseApplicationPay.setCaseAppName(caseApplication1.getApplicantName());
249
+            caseApplicationPay.setCaseResName(caseApplication1.getRespondentName());
250
+            caseApplicationPay.setCaseNum(caseApplication1.getCaseNum());
251
+            caseApplicationPay.setCaseStatus(caseApplication1.getCaseStatus());
252
+            caseApplicationPay.setCaseSubjectAmount(caseApplication1.getCaseSubjectAmount());
253
+            caseApplicationPay.setFeePayable(caseApplication1.getFeePayable());
254
+            caseApplicationList.add(caseApplicationPay);
255
+            listVO.setCaseApplicationList(caseApplicationList);
256
+        }
257
+
258
+        if (sum.compareTo(BigDecimal.ZERO) == 0) {
259
+            return AjaxResult.error("没有可支付的费用");
260
+        }
261
+        return AjaxResult.success(listVO);
262
+    }
263
+
214 264
 
215 265
 }

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java Bestand weergeven

@@ -419,7 +419,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
419 419
                 String prefix = "/profile";
420 420
                 int startIndex = fileName.indexOf(prefix);
421 421
                 startIndex += prefix.length();
422
-                String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
422
+                String annexPath = "uploadPath" + fileName.substring(startIndex);
423 423
                 templateManage.setTemOrigPath(annexPath);
424 424
                 String format = getFileExtension(fileName);
425 425
                 templateManage.setTemFormat(format);