hejinbo 2 лет назад
Родитель
Сommit
aa351abd15

+ 16
- 25
ruoyi-admin/src/main/java/com/ruoyi/web/controller/payment/CasePaymentController.java Просмотреть файл

@@ -1,9 +1,11 @@
1 1
 package com.ruoyi.web.controller.payment;
2 2
 
3
-
4
-import com.ruoyi.dto.PayRequest;
5
-import com.ruoyi.system.service.ICasePaymentService;
3
+import com.ruoyi.common.core.domain.AjaxResult;
4
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
5
+import com.ruoyi.wisdomarbitrate.service.ICasePaymentService;
6
+import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO;
6 7
 import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.validation.annotation.Validated;
7 9
 import org.springframework.web.bind.annotation.*;
8 10
 
9 11
 /**
@@ -17,34 +19,23 @@ public class CasePaymentController {
17 19
     public CasePaymentController(ICasePaymentService paymentService){
18 20
        this.paymentService=paymentService;
19 21
     }
20
-
21 22
     /**
22
-     * 查询缴费列表
23
+     * 案件缴费
24
+     * @param casePayDTO 缴费传入参数
25
+     * @return 统一响应结果
23 26
      */
24
-    @GetMapping
25
-    public String queryPayList(){
26
-        return paymentService.queryPayList();
27
+    @PostMapping("/casePay")
28
+    public AjaxResult casePay(@Validated @RequestBody CasePayDTO casePayDTO) {
29
+        return paymentService.casePay(casePayDTO);
27 30
     }
28 31
 
29 32
     /**
30
-     * 根据案件id查询缴费清单
33
+     * 缴费确认
34
+     * @param caseApplication
31 35
      * @return
32 36
      */
33
-    @GetMapping
34
-    public String getPaymentListByCaseId(){
35
-        return paymentService.getPaymentListByCaseId();
36
-    }
37
-    /**
38
-     * 案件缴费
39
-     * @param request
40
-     * @return
41
-     */
42
-    @PostMapping("/casePay")
43
-    public String casePay(PayRequest request) {
44
-        return paymentService.casePay(request);
45
-    }
46
-    @PutMapping
47
-    public String payConfirm(){
48
-        return paymentService.payConfirm();
37
+    @PutMapping("/confirm")
38
+    public AjaxResult confirmPayment(@Validated @RequestBody CaseApplication caseApplication) {
39
+        return paymentService.confirmPayment(caseApplication);
49 40
     }
50 41
 }

+ 0
- 8
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CasePaymentMapper.java Просмотреть файл

@@ -1,8 +0,0 @@
1
-package com.ruoyi.system.mapper;
2
-
3
-import org.apache.ibatis.annotations.Mapper;
4
-
5
-@Mapper
6
-public interface CasePaymentMapper {
7
-    void queryPayList();
8
-}

+ 0
- 21
ruoyi-system/src/main/java/com/ruoyi/system/service/ICasePaymentService.java Просмотреть файл

@@ -1,21 +0,0 @@
1
-package com.ruoyi.system.service;
2
-
3
-import com.ruoyi.dto.PayRequest;
4
-
5
-public interface ICasePaymentService {
6
-    /**
7
-     * 案件缴费
8
-     * @param request
9
-     * @return
10
-     */
11
-    String casePay(PayRequest request);
12
-    /**
13
-     * 查询缴费列表
14
-     */
15
-    String queryPayList();
16
-
17
-    String getPaymentListByCaseId();
18
-
19
-    String payConfirm();
20
-
21
-}

+ 0
- 46
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CasePaymentServiceImpl.java Просмотреть файл

@@ -1,46 +0,0 @@
1
-package com.ruoyi.system.service.impl;
2
-
3
-import com.ruoyi.ElegentPay;
4
-import com.ruoyi.constant.Platform;
5
-import com.ruoyi.constant.TradeType;
6
-import com.ruoyi.dto.PayRequest;
7
-import com.ruoyi.dto.PayResponse;
8
-import com.ruoyi.system.mapper.CasePaymentMapper;
9
-import com.ruoyi.system.service.ICasePaymentService;
10
-import org.springframework.beans.factory.annotation.Autowired;
11
-import org.springframework.stereotype.Service;
12
-
13
-@Service
14
-public class CasePaymentServiceImpl implements ICasePaymentService {
15
-    private final ElegentPay elegentPay;
16
-    private final CasePaymentMapper paymentMapper;
17
-    @Autowired
18
-    public CasePaymentServiceImpl(ElegentPay elegentPay,CasePaymentMapper paymentMapper ){
19
-        this.elegentPay=elegentPay;
20
-        this.paymentMapper=paymentMapper;
21
-    }
22
-    @Override
23
-    public String casePay(PayRequest request) {
24
-        PayResponse payResponse = elegentPay.requestPay(request, TradeType.NATIVE, Platform.WX);
25
-        if (payResponse!=null){
26
-            return payResponse.getCode_url();
27
-        }
28
-        return null;
29
-    }
30
-
31
-    @Override
32
-    public String queryPayList() {
33
-        paymentMapper.queryPayList();
34
-        return null;
35
-    }
36
-
37
-    @Override
38
-    public String getPaymentListByCaseId() {
39
-        return null;
40
-    }
41
-
42
-    @Override
43
-    public String payConfirm() {
44
-        return null;
45
-    }
46
-}

+ 20
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/CasePayDTO.java Просмотреть файл

@@ -0,0 +1,20 @@
1
+package com.ruoyi.wisdomarbitrate.domain.dto;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * 案件缴费传入参数
7
+ */
8
+@Data
9
+public class CasePayDTO {
10
+    private int totalFee; //订单金额 单位:分
11
+    private String body;//商品描述
12
+    /**
13
+     * 交易类型 native(扫码) / jsapi(小程序) / app / h5
14
+     */
15
+    private String tradeType;
16
+    /**
17
+     * 支付方式 wxpay(微信)  alipay(支付宝)
18
+     */
19
+    private String platform;
20
+}

+ 15
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICasePaymentService.java Просмотреть файл

@@ -0,0 +1,15 @@
1
+package com.ruoyi.wisdomarbitrate.service;
2
+
3
+import com.ruoyi.common.core.domain.AjaxResult;
4
+import com.ruoyi.dto.PayRequest;
5
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
6
+import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO;
7
+
8
+public interface ICasePaymentService {
9
+    /**
10
+     * 案件缴费
11
+     */
12
+    AjaxResult casePay(CasePayDTO casePayDTO);
13
+
14
+    AjaxResult confirmPayment(CaseApplication caseApplication);
15
+}

+ 48
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java Просмотреть файл

@@ -0,0 +1,48 @@
1
+package com.ruoyi.wisdomarbitrate.service.impl;
2
+
3
+import com.ruoyi.CallBackService;
4
+import com.ruoyi.ElegentPay;
5
+import com.ruoyi.common.constant.CaseApplicationConstants;
6
+import com.ruoyi.common.core.domain.AjaxResult;
7
+
8
+import com.ruoyi.dto.PayRequest;
9
+import com.ruoyi.dto.PayResponse;
10
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
11
+import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
12
+import com.ruoyi.wisdomarbitrate.service.ICasePaymentService;
13
+import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.stereotype.Service;
16
+
17
+@Service
18
+public class CasePaymentServiceImpl implements ICasePaymentService {
19
+    private final ElegentPay elegentPay;
20
+    private final CaseApplicationMapper caseApplicationMapper;
21
+
22
+    @Autowired
23
+    public CasePaymentServiceImpl(ElegentPay elegentPay
24
+            , CaseApplicationMapper caseApplicationMapper) {
25
+        this.elegentPay = elegentPay;
26
+        this.caseApplicationMapper = caseApplicationMapper;
27
+    }
28
+
29
+    @Override
30
+    public AjaxResult casePay(CasePayDTO casePayDTO) {
31
+        PayRequest payRequest = new PayRequest();
32
+        payRequest.setBody(casePayDTO.getBody());
33
+        payRequest.setOrderSn(System.currentTimeMillis() + "");
34
+        payRequest.setTotalFee(casePayDTO.getTotalFee());
35
+        PayResponse response = elegentPay.requestPay(payRequest, casePayDTO.getTradeType(), casePayDTO.getPlatform());
36
+        return AjaxResult.success(response);
37
+    }
38
+
39
+    @Override
40
+    public AjaxResult confirmPayment(CaseApplication caseApplication) {
41
+        caseApplication.setCaseStatus(CaseApplicationConstants.EVIDENCE_CONFREMED);
42
+        int i = caseApplicationMapper.updataCaseApplication(caseApplication);
43
+        if (i > 0) {
44
+            return AjaxResult.success();
45
+        }
46
+        return AjaxResult.error("暂无需要确认的缴费清单");
47
+    }
48
+}

+ 0
- 9
ruoyi-system/src/main/resources/mapper/system/CasePaymentMapper.xml Просмотреть файл

@@ -1,9 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8" ?>
2
-<!DOCTYPE mapper
3
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
-<mapper namespace="com.ruoyi.system.mapper.CasePaymentMapper">
6
-    <select id="queryPayList">
7
-
8
-    </select>
9
-</mapper>