Commit 3caa5f14bdd628395634291388695da8a8dc391c

Authored by YunaiV
1 parent b84da302

mall + pay:

1. 优化退款管理的接口实现
Showing 17 changed files with 190 additions and 445 deletions
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderRespVO.java 100755 → 100644
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/PayRefundController.java
@@ -2,6 +2,11 @@ package cn.iocoder.yudao.module.pay.controller.admin.refund; @@ -2,6 +2,11 @@ package cn.iocoder.yudao.module.pay.controller.admin.refund;
2 2
3 import cn.hutool.core.collection.CollectionUtil; 3 import cn.hutool.core.collection.CollectionUtil;
4 import cn.hutool.core.util.ObjectUtil; 4 import cn.hutool.core.util.ObjectUtil;
  5 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  8 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  9 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
5 import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.*; 10 import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.*;
6 import cn.iocoder.yudao.module.pay.convert.refund.PayRefundConvert; 11 import cn.iocoder.yudao.module.pay.convert.refund.PayRefundConvert;
7 import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; 12 import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
@@ -10,15 +15,9 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; @@ -10,15 +15,9 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
10 import cn.iocoder.yudao.module.pay.service.app.PayAppService; 15 import cn.iocoder.yudao.module.pay.service.app.PayAppService;
11 import cn.iocoder.yudao.module.pay.service.order.PayOrderService; 16 import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
12 import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; 17 import cn.iocoder.yudao.module.pay.service.refund.PayRefundService;
13 -import cn.iocoder.yudao.framework.common.pojo.CommonResult;  
14 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
15 -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;  
16 -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;  
17 -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;  
18 -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;  
19 -import io.swagger.v3.oas.annotations.tags.Tag;  
20 -import io.swagger.v3.oas.annotations.Parameter;  
21 import io.swagger.v3.oas.annotations.Operation; 18 import io.swagger.v3.oas.annotations.Operation;
  19 +import io.swagger.v3.oas.annotations.Parameter;
  20 +import io.swagger.v3.oas.annotations.tags.Tag;
22 import org.springframework.security.access.prepost.PreAuthorize; 21 import org.springframework.security.access.prepost.PreAuthorize;
23 import org.springframework.validation.annotation.Validated; 22 import org.springframework.validation.annotation.Validated;
24 import org.springframework.web.bind.annotation.GetMapping; 23 import org.springframework.web.bind.annotation.GetMapping;
@@ -35,6 +34,7 @@ import java.util.List; @@ -35,6 +34,7 @@ import java.util.List;
35 import java.util.Map; 34 import java.util.Map;
36 35
37 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 36 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  37 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
38 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; 38 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
39 39
40 @Tag(name = "管理后台 - 退款订单") 40 @Tag(name = "管理后台 - 退款订单")
@@ -56,20 +56,14 @@ public class PayRefundController { @@ -56,20 +56,14 @@ public class PayRefundController {
56 @PreAuthorize("@ss.hasPermission('pay:refund:query')") 56 @PreAuthorize("@ss.hasPermission('pay:refund:query')")
57 public CommonResult<PayRefundDetailsRespVO> getRefund(@RequestParam("id") Long id) { 57 public CommonResult<PayRefundDetailsRespVO> getRefund(@RequestParam("id") Long id) {
58 PayRefundDO refund = refundService.getRefund(id); 58 PayRefundDO refund = refundService.getRefund(id);
59 - if (ObjectUtil.isNull(refund)) { 59 + if (refund == null) {
60 return success(new PayRefundDetailsRespVO()); 60 return success(new PayRefundDetailsRespVO());
61 } 61 }
62 62
63 - PayAppDO appDO = appService.getApp(refund.getAppId());  
64 - PayChannelEnum channelEnum = PayChannelEnum.getByCode(refund.getChannelCode());  
65 - PayOrderDO orderDO = orderService.getOrder(refund.getOrderId());  
66 -  
67 - PayRefundDetailsRespVO refundDetail = PayRefundConvert.INSTANCE.refundDetailConvert(refund);  
68 - refundDetail.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");  
69 - refundDetail.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");  
70 - refundDetail.setSubject(orderDO.getSubject());  
71 -  
72 - return success(refundDetail); 63 + // 拼接数据
  64 + PayAppDO app = appService.getApp(refund.getAppId());
  65 + PayOrderDO order = orderService.getOrder(refund.getOrderId());
  66 + return success(PayRefundConvert.INSTANCE.convert(refund, order, app));
73 } 67 }
74 68
75 @GetMapping("/page") 69 @GetMapping("/page")
@@ -82,21 +76,8 @@ public class PayRefundController { @@ -82,21 +76,8 @@ public class PayRefundController {
82 } 76 }
83 77
84 // 处理应用ID数据 78 // 处理应用ID数据
85 - Map<Long, PayAppDO> appMap = appService.getAppMap(  
86 - CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getAppId));  
87 - List<PayRefundPageItemRespVO> list = new ArrayList<>(pageResult.getList().size());  
88 - pageResult.getList().forEach(c -> {  
89 - PayAppDO appDO = appMap.get(c.getAppId());  
90 - PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());  
91 -  
92 - PayRefundPageItemRespVO item = PayRefundConvert.INSTANCE.pageItemConvert(c);  
93 -  
94 - item.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");  
95 - item.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");  
96 - list.add(item);  
97 - });  
98 -  
99 - return success(new PageResult<>(list, pageResult.getTotal())); 79 + Map<Long, PayAppDO> appMap = appService.getAppMap(convertList(pageResult.getList(), PayRefundDO::getAppId));
  80 + return success(PayRefundConvert.INSTANCE.convertPage(pageResult, appMap));
100 } 81 }
101 82
102 @GetMapping("/export-excel") 83 @GetMapping("/export-excel")
@@ -105,21 +86,21 @@ public class PayRefundController { @@ -105,21 +86,21 @@ public class PayRefundController {
105 @OperateLog(type = EXPORT) 86 @OperateLog(type = EXPORT)
106 public void exportRefundExcel(@Valid PayRefundExportReqVO exportReqVO, 87 public void exportRefundExcel(@Valid PayRefundExportReqVO exportReqVO,
107 HttpServletResponse response) throws IOException { 88 HttpServletResponse response) throws IOException {
108 -  
109 List<PayRefundDO> list = refundService.getRefundList(exportReqVO); 89 List<PayRefundDO> list = refundService.getRefundList(exportReqVO);
110 if (CollectionUtil.isEmpty(list)) { 90 if (CollectionUtil.isEmpty(list)) {
111 ExcelUtils.write(response, "退款订单.xls", "数据", 91 ExcelUtils.write(response, "退款订单.xls", "数据",
112 PayRefundExcelVO.class, new ArrayList<>()); 92 PayRefundExcelVO.class, new ArrayList<>());
  93 + return;
113 } 94 }
114 95
115 // 处理应用ID数据 96 // 处理应用ID数据
116 Map<Long, PayAppDO> appMap = appService.getAppMap( 97 Map<Long, PayAppDO> appMap = appService.getAppMap(
117 - CollectionUtils.convertList(list, PayRefundDO::getAppId)); 98 + convertList(list, PayRefundDO::getAppId));
118 99
119 List<PayRefundExcelVO> excelDatum = new ArrayList<>(list.size()); 100 List<PayRefundExcelVO> excelDatum = new ArrayList<>(list.size());
120 // 处理商品名称数据 101 // 处理商品名称数据
121 Map<Long, PayOrderDO> orderMap = orderService.getOrderSubjectMap( 102 Map<Long, PayOrderDO> orderMap = orderService.getOrderSubjectMap(
122 - CollectionUtils.convertList(list, PayRefundDO::getOrderId)); 103 + convertList(list, PayRefundDO::getOrderId));
123 104
124 list.forEach(c -> { 105 list.forEach(c -> {
125 PayAppDO appDO = appMap.get(c.getAppId()); 106 PayAppDO appDO = appMap.get(c.getAppId());
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundBaseVO.java
1 package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; 1 package cn.iocoder.yudao.module.pay.controller.admin.refund.vo;
  2 +
2 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
3 import lombok.Data; 4 import lombok.Data;
4 -import org.springframework.format.annotation.DateTimeFormat;  
5 5
6 -import javax.validation.constraints.NotNull;  
7 import java.time.LocalDateTime; 6 import java.time.LocalDateTime;
8 7
9 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
10 -  
11 /** 8 /**
12 * 退款订单 Base VO,提供给添加、修改、详细的子 VO 使用 9 * 退款订单 Base VO,提供给添加、修改、详细的子 VO 使用
13 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 10 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
@@ -15,83 +12,67 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -15,83 +12,67 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
15 @Data 12 @Data
16 public class PayRefundBaseVO { 13 public class PayRefundBaseVO {
17 14
18 - @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED)  
19 - @NotNull(message = "应用编号不能为空") 15 + @Schema(description = "外部退款号", requiredMode = Schema.RequiredMode.REQUIRED, example = "110")
  16 + private String no;
  17 +
  18 + @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
20 private Long appId; 19 private Long appId;
21 20
22 - @Schema(description = "渠道编号", requiredMode = Schema.RequiredMode.REQUIRED)  
23 - @NotNull(message = "渠道编号不能为空") 21 + @Schema(description = "渠道编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
24 private Long channelId; 22 private Long channelId;
25 23
26 - @Schema(description = "渠道编码", requiredMode = Schema.RequiredMode.REQUIRED)  
27 - @NotNull(message = "渠道编码不能为空") 24 + @Schema(description = "渠道编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "wx_app")
28 private String channelCode; 25 private String channelCode;
29 26
30 - @Schema(description = "支付订单编号 pay_order 表id", requiredMode = Schema.RequiredMode.REQUIRED)  
31 - @NotNull(message = "支付订单编号 pay_order 表id不能为空") 27 + @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
32 private Long orderId; 28 private Long orderId;
33 29
34 - @Schema(description = "交易订单号 pay_extension 表no 字段", requiredMode = Schema.RequiredMode.REQUIRED)  
35 - @NotNull(message = "交易订单号 pay_extension 表no 字段不能为空")  
36 - private String tradeNo; 30 + // ========== 商户相关字段 ==========
37 31
38 - @Schema(description = "商户订单编号(商户系统生成)", requiredMode = Schema.RequiredMode.REQUIRED)  
39 - @NotNull(message = "商户订单编号(商户系统生成)不能为空") 32 + @Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "225")
40 private String merchantOrderId; 33 private String merchantOrderId;
41 34
42 - @Schema(description = "商户退款订单号(商户系统生成)", requiredMode = Schema.RequiredMode.REQUIRED)  
43 - @NotNull(message = "商户退款订单号(商户系统生成)不能为空")  
44 - private String merchantRefundNo; 35 + @Schema(description = "商户退款订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "512")
  36 + private String merchantRefundId;
45 37
46 - @Schema(description = "异步通知商户地址", requiredMode = Schema.RequiredMode.REQUIRED)  
47 - @NotNull(message = "异步通知商户地址不能为空") 38 + @Schema(description = "异步通知地址", requiredMode = Schema.RequiredMode.REQUIRED)
48 private String notifyUrl; 39 private String notifyUrl;
49 40
50 - @Schema(description = "退款状态", requiredMode = Schema.RequiredMode.REQUIRED)  
51 - @NotNull(message = "退款状态不能为空")  
52 - private Integer status; 41 + // ========== 退款相关字段 ==========
53 42
54 - @Schema(description = "退款类型(部分退款,全部退款)", requiredMode = Schema.RequiredMode.REQUIRED)  
55 - @NotNull(message = "退款类型(部分退款,全部退款)不能为空")  
56 - private Integer type; 43 + @Schema(description = "退款状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
  44 + private Integer status;
57 45
58 - @Schema(description = "支付金额,单位分", requiredMode = Schema.RequiredMode.REQUIRED)  
59 - @NotNull(message = "支付金额,单位分不能为空")  
60 - private Long payAmount; 46 + @Schema(description = "支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
  47 + private Long payPrice;
61 48
62 - @Schema(description = "退款金额,单位分", requiredMode = Schema.RequiredMode.REQUIRED)  
63 - @NotNull(message = "退款金额,单位分不能为空")  
64 - private Long refundAmount; 49 + @Schema(description = "退款金额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
  50 + private Long refundPrice;
65 51
66 - @Schema(description = "退款原因", requiredMode = Schema.RequiredMode.REQUIRED)  
67 - @NotNull(message = "退款原因不能为空") 52 + @Schema(description = "退款原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "我要退了")
68 private String reason; 53 private String reason;
69 54
70 - @Schema(description = "用户 IP") 55 + @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")
71 private String userIp; 56 private String userIp;
72 57
73 - @Schema(description = "渠道订单号,pay_order 中的channel_order_no 对应", requiredMode = Schema.RequiredMode.REQUIRED)  
74 - @NotNull(message = "渠道订单号,pay_order 中的channel_order_no 对应不能为空") 58 + // ========== 渠道相关字段 ==========
  59 +
  60 + @Schema(description = "渠道订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "233")
75 private String channelOrderNo; 61 private String channelOrderNo;
76 62
77 - @Schema(description = "渠道退款单号,渠道返回") 63 + @Schema(description = "渠道退款单号", example = "2022")
78 private String channelRefundNo; 64 private String channelRefundNo;
79 65
80 - @Schema(description = "渠道调用报错时,错误码") 66 + @Schema(description = "退款成功时间")
  67 + private LocalDateTime successTime;
  68 +
  69 + @Schema(description = "调用渠道的错误码")
81 private String channelErrorCode; 70 private String channelErrorCode;
82 71
83 - @Schema(description = "渠道调用报错时,错误信息") 72 + @Schema(description = "调用渠道的错误提示")
84 private String channelErrorMsg; 73 private String channelErrorMsg;
85 74
86 @Schema(description = "支付渠道的额外参数") 75 @Schema(description = "支付渠道的额外参数")
87 - private String channelExtras;  
88 -  
89 - @Schema(description = "退款失效时间")  
90 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
91 - private LocalDateTime expireTime;  
92 -  
93 - @Schema(description = "退款成功时间")  
94 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
95 - private LocalDateTime successTime; 76 + private String channelNotifyData;
96 77
97 } 78 }
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundCreateReqVO.java deleted
1 -package cn.iocoder.yudao.module.pay.controller.admin.refund.vo;  
2 -import io.swagger.v3.oas.annotations.media.Schema;  
3 -import lombok.*;  
4 -  
5 -@Schema(description = "管理后台 - 退款订单创建 Request VO")  
6 -@Data  
7 -@EqualsAndHashCode(callSuper = true)  
8 -@ToString(callSuper = true)  
9 -public class PayRefundCreateReqVO extends PayRefundBaseVO {  
10 -  
11 -}  
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundDetailsRespVO.java
@@ -5,7 +5,6 @@ import lombok.Data; @@ -5,7 +5,6 @@ import lombok.Data;
5 import lombok.EqualsAndHashCode; 5 import lombok.EqualsAndHashCode;
6 import lombok.ToString; 6 import lombok.ToString;
7 7
8 -import javax.validation.constraints.NotNull;  
9 import java.time.LocalDateTime; 8 import java.time.LocalDateTime;
10 9
11 @Schema(description = "管理后台 - 退款订单详情 Response VO") 10 @Schema(description = "管理后台 - 退款订单详情 Response VO")
@@ -17,14 +16,11 @@ public class PayRefundDetailsRespVO extends PayRefundBaseVO { @@ -17,14 +16,11 @@ public class PayRefundDetailsRespVO extends PayRefundBaseVO {
17 @Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED) 16 @Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED)
18 private Long id; 17 private Long id;
19 18
20 - @Schema(description = "应用名称") 19 + @Schema(description = "应用名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是芋艿")
21 private String appName; 20 private String appName;
22 21
23 - @Schema(description = "渠道编号名称")  
24 - private String channelCodeName;  
25 -  
26 - @NotNull(message = "商品标题不能为空")  
27 - private String subject; 22 + @Schema(description = "支付订单", requiredMode = Schema.RequiredMode.REQUIRED)
  23 + private Order order;
28 24
29 @Schema(description = "创建时间") 25 @Schema(description = "创建时间")
30 private LocalDateTime createTime; 26 private LocalDateTime createTime;
@@ -32,4 +28,13 @@ public class PayRefundDetailsRespVO extends PayRefundBaseVO { @@ -32,4 +28,13 @@ public class PayRefundDetailsRespVO extends PayRefundBaseVO {
32 @Schema(description = "更新时间") 28 @Schema(description = "更新时间")
33 private LocalDateTime updateTime; 29 private LocalDateTime updateTime;
34 30
  31 + @Schema(description = "管理后台 - 支付订单")
  32 + @Data
  33 + public static class Order {
  34 +
  35 + @Schema(description = "商品标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "土豆")
  36 + private String subject;
  37 +
  38 + }
  39 +
35 } 40 }
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExportReqVO.java
@@ -12,74 +12,26 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -12,74 +12,26 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
12 @Data 12 @Data
13 public class PayRefundExportReqVO { 13 public class PayRefundExportReqVO {
14 14
15 - @Schema(description = "应用编号") 15 + @Schema(description = "应用编号", example = "1024")
16 private Long appId; 16 private Long appId;
17 17
18 - @Schema(description = "渠道编号")  
19 - private Long channelId;  
20 -  
21 - @Schema(description = "渠道编码") 18 + @Schema(description = "渠道编码", example = "wx_app")
22 private String channelCode; 19 private String channelCode;
23 20
24 - @Schema(description = "支付订单编号 pay_order 表id")  
25 - private Long orderId;  
26 -  
27 - @Schema(description = "交易订单号 pay_extension 表no 字段")  
28 - private String tradeNo;  
29 -  
30 - @Schema(description = "商户订单编号(商户系统生成)") 21 + @Schema(description = "商户支付单号", example = "10")
31 private String merchantOrderId; 22 private String merchantOrderId;
32 23
33 - @Schema(description = "商户退款订单号(商户系统生成)")  
34 - private String merchantRefundNo;  
35 -  
36 - @Schema(description = "异步通知商户地址")  
37 - private String notifyUrl;  
38 -  
39 - @Schema(description = "退款状态")  
40 - private Integer status;  
41 -  
42 - @Schema(description = "退款类型(部分退款,全部退款)")  
43 - private Integer type;  
44 -  
45 - @Schema(description = "支付金额,单位分")  
46 - private Long payPrice;  
47 -  
48 - @Schema(description = "退款金额,单位分")  
49 - private Long refundPrice;  
50 -  
51 - @Schema(description = "退款原因")  
52 - private String reason; 24 + @Schema(description = "商户退款单号", example = "20")
  25 + private String merchantRefundId;
53 26
54 - @Schema(description = "用户 IP")  
55 - private String userIp;  
56 -  
57 - @Schema(description = "渠道订单号,pay_order 中的channel_order_no 对应") 27 + @Schema(description = "渠道支付单号", example = "30")
58 private String channelOrderNo; 28 private String channelOrderNo;
59 29
60 - @Schema(description = "渠道退款单号,渠道返回") 30 + @Schema(description = "渠道退款单号", example = "40")
61 private String channelRefundNo; 31 private String channelRefundNo;
62 32
63 - @Schema(description = "渠道调用报错时,错误码")  
64 - private String channelErrorCode;  
65 -  
66 - @Schema(description = "渠道调用报错时,错误信息")  
67 - private String channelErrorMsg;  
68 -  
69 - @Schema(description = "支付渠道的额外参数")  
70 - private String channelExtras;  
71 -  
72 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
73 - @Schema(description = "退款失效时间")  
74 - private LocalDateTime[] expireTime;  
75 -  
76 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
77 - @Schema(description = "退款成功时间")  
78 - private LocalDateTime[] successTime;  
79 -  
80 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
81 - @Schema(description = "退款通知时间")  
82 - private LocalDateTime[] notifyTime; 33 + @Schema(description = "退款状态", example = "0")
  34 + private Integer status;
83 35
84 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) 36 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
85 @Schema(description = "创建时间") 37 @Schema(description = "创建时间")
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageItemRespVO.java
@@ -13,15 +13,12 @@ import java.time.LocalDateTime; @@ -13,15 +13,12 @@ import java.time.LocalDateTime;
13 @ToString(callSuper = true) 13 @ToString(callSuper = true)
14 public class PayRefundPageItemRespVO extends PayRefundBaseVO { 14 public class PayRefundPageItemRespVO extends PayRefundBaseVO {
15 15
16 - @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED) 16 + @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
17 private Long id; 17 private Long id;
18 18
19 - @Schema(description = "应用名称") 19 + @Schema(description = "应用名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是芋艿")
20 private String appName; 20 private String appName;
21 21
22 - @Schema(description = "渠道名称")  
23 - private String channelCodeName;  
24 -  
25 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) 22 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
26 private LocalDateTime createTime; 23 private LocalDateTime createTime;
27 24
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageReqVO.java
@@ -17,70 +17,26 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -17,70 +17,26 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
17 @ToString(callSuper = true) 17 @ToString(callSuper = true)
18 public class PayRefundPageReqVO extends PageParam { 18 public class PayRefundPageReqVO extends PageParam {
19 19
20 - @Schema(description = "应用编号") 20 + @Schema(description = "应用编号", example = "1024")
21 private Long appId; 21 private Long appId;
22 22
23 - @Schema(description = "渠道编号")  
24 - private Long channelId;  
25 -  
26 - @Schema(description = "渠道编码") 23 + @Schema(description = "渠道编码", example = "wx_app")
27 private String channelCode; 24 private String channelCode;
28 25
29 - @Schema(description = "支付订单编号 pay_order 表id")  
30 - private Long orderId;  
31 -  
32 - @Schema(description = "交易订单号 pay_extension 表no 字段")  
33 - private String tradeNo;  
34 -  
35 - @Schema(description = "商户订单编号(商户系统生成)") 26 + @Schema(description = "商户支付单号", example = "10")
36 private String merchantOrderId; 27 private String merchantOrderId;
37 28
38 - @Schema(description = "商户退款订单号(商户系统生成)")  
39 - private String merchantRefundNo;  
40 -  
41 - @Schema(description = "异步通知商户地址")  
42 - private String notifyUrl;  
43 -  
44 - @Schema(description = "退款状态")  
45 - private Integer status;  
46 -  
47 - @Schema(description = "退款类型(部分退款,全部退款)")  
48 - private Integer type;  
49 -  
50 - @Schema(description = "支付金额,单位分")  
51 - private Long payPrice;  
52 -  
53 - @Schema(description = "退款金额,单位分")  
54 - private Long refundPrice; 29 + @Schema(description = "商户退款单号", example = "20")
  30 + private String merchantRefundId;
55 31
56 - @Schema(description = "退款原因")  
57 - private String reason;  
58 -  
59 - @Schema(description = "用户 IP")  
60 - private String userIp;  
61 -  
62 - @Schema(description = "渠道订单号,pay_order 中的channel_order_no 对应") 32 + @Schema(description = "渠道支付单号", example = "30")
63 private String channelOrderNo; 33 private String channelOrderNo;
64 34
65 - @Schema(description = "渠道退款单号,渠道返回") 35 + @Schema(description = "渠道退款单号", example = "40")
66 private String channelRefundNo; 36 private String channelRefundNo;
67 37
68 - @Schema(description = "渠道调用报错时,错误码")  
69 - private String channelErrorCode;  
70 -  
71 - @Schema(description = "渠道调用报错时,错误信息")  
72 - private String channelErrorMsg;  
73 -  
74 - @Schema(description = "支付渠道的额外参数")  
75 - private String channelExtras;  
76 -  
77 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
78 - @Schema(description = "退款失效时间")  
79 - private LocalDateTime[] expireTime;  
80 -  
81 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
82 - @Schema(description = "退款成功时间")  
83 - private LocalDateTime[] successTime; 38 + @Schema(description = "退款状态", example = "0")
  39 + private Integer status;
84 40
85 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) 41 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
86 @Schema(description = "创建时间") 42 @Schema(description = "创建时间")
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundRespVO.java deleted
1 -package cn.iocoder.yudao.module.pay.controller.admin.refund.vo;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import lombok.EqualsAndHashCode;  
6 -import lombok.ToString;  
7 -  
8 -import java.time.LocalDateTime;  
9 -  
10 -@Schema(description = "管理后台 - 退款订单 Response VO")  
11 -@Data  
12 -@EqualsAndHashCode(callSuper = true)  
13 -@ToString(callSuper = true)  
14 -public class PayRefundRespVO extends PayRefundBaseVO {  
15 -  
16 - @Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED)  
17 - private Long id;  
18 -  
19 - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)  
20 - private LocalDateTime createTime;  
21 -  
22 -}  
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundUpdateReqVO.java deleted
1 -package cn.iocoder.yudao.module.pay.controller.admin.refund.vo;  
2 -import io.swagger.v3.oas.annotations.media.Schema;  
3 -import lombok.*;  
4 -import javax.validation.constraints.*;  
5 -  
6 -@Schema(description = "管理后台 - 退款订单更新 Request VO")  
7 -@Data  
8 -@EqualsAndHashCode(callSuper = true)  
9 -@ToString(callSuper = true)  
10 -public class PayRefundUpdateReqVO extends PayRefundBaseVO {  
11 -  
12 - @Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED)  
13 - @NotNull(message = "支付退款编号不能为空")  
14 - private Long id;  
15 -  
16 -}  
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/refund/PayRefundConvert.java
1 package cn.iocoder.yudao.module.pay.convert.refund; 1 package cn.iocoder.yudao.module.pay.convert.refund;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
4 import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; 5 import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
5 import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundRespDTO; 6 import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundRespDTO;
6 -import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.*; 7 +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundDetailsRespVO;
  8 +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExcelVO;
  9 +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageItemRespVO;
  10 +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
  11 +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
7 import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; 12 import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
8 import org.mapstruct.Mapper; 13 import org.mapstruct.Mapper;
9 import org.mapstruct.factory.Mappers; 14 import org.mapstruct.factory.Mappers;
10 15
11 import java.math.BigDecimal; 16 import java.math.BigDecimal;
12 import java.math.RoundingMode; 17 import java.math.RoundingMode;
13 -import java.util.List; 18 +import java.util.Map;
14 19
15 @Mapper 20 @Mapper
16 public interface PayRefundConvert { 21 public interface PayRefundConvert {
17 22
18 PayRefundConvert INSTANCE = Mappers.getMapper(PayRefundConvert.class); 23 PayRefundConvert INSTANCE = Mappers.getMapper(PayRefundConvert.class);
19 24
20 - PayRefundDO convert(PayRefundCreateReqVO bean);  
21 25
22 - PayRefundDO convert(PayRefundUpdateReqVO bean);  
23 -  
24 - PayRefundRespVO convert(PayRefundDO bean);  
25 -  
26 - /**  
27 - * 退款订单 DO 转 退款详情订单 VO  
28 - *  
29 - * @param bean 退款订单 DO  
30 - * @return 退款详情订单 VO  
31 - */  
32 - PayRefundDetailsRespVO refundDetailConvert(PayRefundDO bean);  
33 -  
34 - /**  
35 - * 退款订单DO 转 分页退款条目VO  
36 - *  
37 - * @param bean 退款订单DO  
38 - * @return 分页退款条目VO  
39 - */  
40 - PayRefundPageItemRespVO pageItemConvert(PayRefundDO bean);  
41 -  
42 - List<PayRefundRespVO> convertList(List<PayRefundDO> list); 26 + default PayRefundDetailsRespVO convert(PayRefundDO refund, PayOrderDO order, PayAppDO app) {
  27 + PayRefundDetailsRespVO respVO = convert(refund)
  28 + .setOrder(convert(order));
  29 + if (app != null) {
  30 + respVO.setAppName(app.getName());
  31 + }
  32 + return respVO;
  33 + }
  34 + PayRefundDetailsRespVO convert(PayRefundDO bean);
  35 + PayRefundDetailsRespVO.Order convert(PayOrderDO bean);
43 36
44 - PageResult<PayRefundRespVO> convertPage(PageResult<PayRefundDO> page); 37 + default PageResult<PayRefundPageItemRespVO> convertPage(PageResult<PayRefundDO> page, Map<Long, PayAppDO> appMap) {
  38 + PageResult<PayRefundPageItemRespVO> result = convertPage(page);
  39 + result.getList().forEach(order -> MapUtils.findAndThen(appMap, order.getAppId(), app -> order.setAppName(app.getName())));
  40 + return result;
  41 + }
  42 + PageResult<PayRefundPageItemRespVO> convertPage(PageResult<PayRefundDO> page);
45 43
46 /** 44 /**
47 * 退款订单DO 转 导出excel VO 45 * 退款订单DO 转 导出excel VO
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/refund/PayRefundDO.java
@@ -140,7 +140,7 @@ public class PayRefundDO extends BaseDO { @@ -140,7 +140,7 @@ public class PayRefundDO extends BaseDO {
140 */ 140 */
141 private String channelErrorCode; 141 private String channelErrorCode;
142 /** 142 /**
143 - * 调用渠道报错时,错误信息 143 + * 调用渠道的错误提示
144 */ 144 */
145 private String channelErrorMsg; 145 private String channelErrorMsg;
146 146
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/refund/PayRefundMapper.java
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.pay.dal.mysql.refund; @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.pay.dal.mysql.refund;
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;  
7 import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; 6 import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO;
8 import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO; 7 import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO;
9 import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; 8 import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
@@ -44,25 +43,29 @@ public interface PayRefundMapper extends BaseMapperX&lt;PayRefundDO&gt; { @@ -44,25 +43,29 @@ public interface PayRefundMapper extends BaseMapperX&lt;PayRefundDO&gt; {
44 } 43 }
45 44
46 default PageResult<PayRefundDO> selectPage(PayRefundPageReqVO reqVO) { 45 default PageResult<PayRefundDO> selectPage(PayRefundPageReqVO reqVO) {
47 - return selectPage(reqVO, new QueryWrapperX<PayRefundDO>()  
48 - .eqIfPresent("app_id", reqVO.getAppId())  
49 - .eqIfPresent("channel_code", reqVO.getChannelCode())  
50 - .likeIfPresent("merchant_refund_no", reqVO.getMerchantRefundNo())  
51 - .eqIfPresent("type", reqVO.getType())  
52 - .eqIfPresent("status", reqVO.getStatus())  
53 - .betweenIfPresent("create_time", reqVO.getCreateTime())  
54 - .orderByDesc("id")); 46 + return selectPage(reqVO, new LambdaQueryWrapperX<PayRefundDO>()
  47 + .eqIfPresent(PayRefundDO::getAppId, reqVO.getAppId())
  48 + .eqIfPresent(PayRefundDO::getChannelCode, reqVO.getChannelCode())
  49 + .likeIfPresent(PayRefundDO::getMerchantOrderId, reqVO.getMerchantOrderId())
  50 + .likeIfPresent(PayRefundDO::getMerchantRefundId, reqVO.getMerchantRefundId())
  51 + .likeIfPresent(PayRefundDO::getChannelOrderNo, reqVO.getChannelOrderNo())
  52 + .likeIfPresent(PayRefundDO::getChannelRefundNo, reqVO.getChannelRefundNo())
  53 + .eqIfPresent(PayRefundDO::getStatus, reqVO.getStatus())
  54 + .betweenIfPresent(PayRefundDO::getCreateTime, reqVO.getCreateTime())
  55 + .orderByDesc(PayRefundDO::getId));
55 } 56 }
56 57
57 default List<PayRefundDO> selectList(PayRefundExportReqVO reqVO) { 58 default List<PayRefundDO> selectList(PayRefundExportReqVO reqVO) {
58 - return selectList(new QueryWrapperX<PayRefundDO>()  
59 - .eqIfPresent("app_id", reqVO.getAppId())  
60 - .eqIfPresent("channel_code", reqVO.getChannelCode())  
61 - .likeIfPresent("merchant_refund_no", reqVO.getMerchantRefundNo())  
62 - .eqIfPresent("type", reqVO.getType())  
63 - .eqIfPresent("status", reqVO.getStatus())  
64 - .betweenIfPresent("create_time", reqVO.getCreateTime())  
65 - .orderByDesc("id")); 59 + return selectList(new LambdaQueryWrapperX<PayRefundDO>()
  60 + .eqIfPresent(PayRefundDO::getAppId, reqVO.getAppId())
  61 + .eqIfPresent(PayRefundDO::getChannelCode, reqVO.getChannelCode())
  62 + .likeIfPresent(PayRefundDO::getMerchantOrderId, reqVO.getMerchantOrderId())
  63 + .likeIfPresent(PayRefundDO::getMerchantRefundId, reqVO.getMerchantRefundId())
  64 + .likeIfPresent(PayRefundDO::getChannelOrderNo, reqVO.getChannelOrderNo())
  65 + .likeIfPresent(PayRefundDO::getChannelRefundNo, reqVO.getChannelRefundNo())
  66 + .eqIfPresent(PayRefundDO::getStatus, reqVO.getStatus())
  67 + .betweenIfPresent(PayRefundDO::getCreateTime, reqVO.getCreateTime())
  68 + .orderByDesc(PayRefundDO::getId));
66 } 69 }
67 70
68 } 71 }
yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java
@@ -91,7 +91,7 @@ public class PayRefundServiceTest extends BaseDbUnitTest { @@ -91,7 +91,7 @@ public class PayRefundServiceTest extends BaseDbUnitTest {
91 PayRefundPageReqVO reqVO = new PayRefundPageReqVO(); 91 PayRefundPageReqVO reqVO = new PayRefundPageReqVO();
92 reqVO.setAppId(1L); 92 reqVO.setAppId(1L);
93 reqVO.setChannelCode(PayChannelEnum.WX_PUB.getCode()); 93 reqVO.setChannelCode(PayChannelEnum.WX_PUB.getCode());
94 - reqVO.setMerchantRefundNo("MRF0000001"); 94 + reqVO.setMerchantRefundId("MRF0000001");
95 reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()); 95 reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus());
96 reqVO.setCreateTime((new LocalDateTime[]{LocalDateTime.of(2021, 1, 1, 10, 10, 10), LocalDateTime.of(2021, 1, 1, 10, 10, 12)})); 96 reqVO.setCreateTime((new LocalDateTime[]{LocalDateTime.of(2021, 1, 1, 10, 10, 10), LocalDateTime.of(2021, 1, 1, 10, 10, 12)}));
97 97
@@ -145,7 +145,6 @@ public class PayRefundServiceTest extends BaseDbUnitTest { @@ -145,7 +145,6 @@ public class PayRefundServiceTest extends BaseDbUnitTest {
145 PayRefundExportReqVO reqVO = new PayRefundExportReqVO(); 145 PayRefundExportReqVO reqVO = new PayRefundExportReqVO();
146 reqVO.setAppId(1L); 146 reqVO.setAppId(1L);
147 reqVO.setChannelCode(PayChannelEnum.WX_PUB.getCode()); 147 reqVO.setChannelCode(PayChannelEnum.WX_PUB.getCode());
148 - reqVO.setMerchantRefundNo("MRF0000001");  
149 reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()); 148 reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus());
150 reqVO.setCreateTime((new LocalDateTime[]{LocalDateTime.of(2021, 1, 1, 10, 10, 10), LocalDateTime.of(2021, 1, 1, 10, 10, 12)})); 149 reqVO.setCreateTime((new LocalDateTime[]{LocalDateTime.of(2021, 1, 1, 10, 10, 10), LocalDateTime.of(2021, 1, 1, 10, 10, 12)}));
151 150
yudao-ui-admin/src/utils/dict.js
@@ -58,7 +58,7 @@ export const DICT_TYPE = { @@ -58,7 +58,7 @@ export const DICT_TYPE = {
58 PAY_CHANNEL_CODE: 'pay_channel_code', // 支付渠道编码类型 58 PAY_CHANNEL_CODE: 'pay_channel_code', // 支付渠道编码类型
59 PAY_NOTIFY_STATUS: 'pay_notify_status', // 商户支付回调状态 59 PAY_NOTIFY_STATUS: 'pay_notify_status', // 商户支付回调状态
60 PAY_ORDER_STATUS: 'pay_order_status', // 商户支付订单状态 60 PAY_ORDER_STATUS: 'pay_order_status', // 商户支付订单状态
61 - PAY_REFUND_ORDER_STATUS: 'pay_refund_order_status', // 退款订单状态 61 + PAY_REFUND_STATUS: 'pay_refund_status', // 退款订单状态
62 62
63 // ========== MP 模块 ========== 63 // ========== MP 模块 ==========
64 MP_AUTO_REPLY_REQUEST_MATCH: 'mp_auto_reply_request_match', // 自动回复请求匹配类型 64 MP_AUTO_REPLY_REQUEST_MATCH: 'mp_auto_reply_request_match', // 自动回复请求匹配类型
yudao-ui-admin/src/views/pay/order/index.vue
@@ -9,8 +9,7 @@ @@ -9,8 +9,7 @@
9 </el-select> 9 </el-select>
10 </el-form-item> 10 </el-form-item>
11 <el-form-item label="支付渠道" prop="channelCode"> 11 <el-form-item label="支付渠道" prop="channelCode">
12 - <el-select v-model="queryParams.channelCode" placeholder="请选择支付渠道" clearable  
13 - @clear="()=>{queryParams.channelCode = null}"> 12 + <el-select v-model="queryParams.channelCode" placeholder="请选择支付渠道" clearable>
14 <el-option v-for="dict in this.getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE)" :key="dict.value" :label="dict.label" :value="dict.value"/> 13 <el-option v-for="dict in this.getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE)" :key="dict.value" :label="dict.label" :value="dict.value"/>
15 </el-select> 14 </el-select>
16 </el-form-item> 15 </el-form-item>
@@ -77,9 +76,15 @@ @@ -77,9 +76,15 @@
77 </el-table-column> 76 </el-table-column>
78 <el-table-column label="订单号" align="left" width="300"> 77 <el-table-column label="订单号" align="left" width="300">
79 <template v-slot="scope"> 78 <template v-slot="scope">
80 - <p class="order-font"><el-tag size="mini">商户单号</el-tag> {{scope.row.merchantOrderId}}</p>  
81 - <p class="order-font" v-if="scope.row.no"><el-tag size="mini" type="warning">支付单号</el-tag> {{scope.row.no}}</p>  
82 - <p class="order-font" v-if="scope.row.channelOrderNo"><el-tag size="mini" type="success">渠道单号</el-tag> {{scope.row.channelOrderNo}}</p> 79 + <p class="order-font"><el-tag size="mini">
  80 + 商户</el-tag> {{scope.row.merchantOrderId}}
  81 + </p>
  82 + <p class="order-font" v-if="scope.row.no">
  83 + <el-tag size="mini" type="warning">支付</el-tag> {{scope.row.no}}
  84 + </p>
  85 + <p class="order-font" v-if="scope.row.channelOrderNo">
  86 + <el-tag size="mini" type="success">渠道</el-tag> {{scope.row.channelOrderNo}}
  87 + </p>
83 </template> 88 </template>
84 </el-table-column> 89 </el-table-column>
85 <el-table-column label="支付状态" align="center" prop="status"> 90 <el-table-column label="支付状态" align="center" prop="status">
yudao-ui-admin/src/views/pay/refund/index.vue
@@ -7,25 +7,30 @@ @@ -7,25 +7,30 @@
7 <el-option v-for="item in appList" :key="item.id" :label="item.name" :value="item.id" /> 7 <el-option v-for="item in appList" :key="item.id" :label="item.name" :value="item.id" />
8 </el-select> 8 </el-select>
9 </el-form-item> 9 </el-form-item>
10 - <el-form-item label="渠道编码" prop="channelCode">  
11 - <el-select v-model="queryParams.channelCode" placeholder="请输入渠道编码" clearable  
12 - @clear="()=>{queryParams.channelCode = null}">  
13 - <el-option v-for="dict in payChannelCodeDictDatum" :key="dict.value" :label="dict.label" :value="dict.value"/> 10 + <el-form-item label="退款渠道" prop="channelCode">
  11 + <el-select v-model="queryParams.channelCode" placeholder="请选择退款渠道" clearable>
  12 + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE)" :key="dict.value" :label="dict.label" :value="dict.value"/>
14 </el-select> 13 </el-select>
15 </el-form-item> 14 </el-form-item>
16 - <el-form-item label="退款类型" prop="type">  
17 - <el-select v-model="queryParams.type" placeholder="请选择退款类型" clearable>  
18 - <el-option v-for="dict in payRefundOrderTypeDictDatum" :key="parseInt(dict.value)"  
19 - :label="dict.label" :value="parseInt(dict.value)"/>  
20 - </el-select> 15 + <el-form-item label="商户支付单号" prop="merchantOrderId">
  16 + <el-input v-model="queryParams.merchantOrderId" placeholder="请输入商户支付单号" clearable
  17 + @keyup.enter.native="handleQuery"/>
  18 + </el-form-item>
  19 + <el-form-item label="商户退款单号" prop="merchantRefundId">
  20 + <el-input v-model="queryParams.merchantRefundId" placeholder="请输入商户退款单号" clearable
  21 + @keyup.enter.native="handleQuery"/>
  22 + </el-form-item>
  23 + <el-form-item label="渠道支付单号" prop="channelOrderNo">
  24 + <el-input v-model="queryParams.channelOrderNo" placeholder="请输入渠道支付单号" clearable
  25 + @keyup.enter.native="handleQuery"/>
21 </el-form-item> 26 </el-form-item>
22 - <el-form-item label="商户退款订单号" prop="merchantRefundNo">  
23 - <el-input v-model="queryParams.merchantRefundNo" placeholder="请输入商户退款订单号" clearable 27 + <el-form-item label="渠道退款单号" prop="channelRefundNo">
  28 + <el-input v-model="queryParams.channelRefundNo" placeholder="请输入渠道退款单号" clearable
24 @keyup.enter.native="handleQuery"/> 29 @keyup.enter.native="handleQuery"/>
25 </el-form-item> 30 </el-form-item>
26 <el-form-item label="退款状态" prop="status"> 31 <el-form-item label="退款状态" prop="status">
27 <el-select v-model="queryParams.status" placeholder="请选择退款状态" clearable> 32 <el-select v-model="queryParams.status" placeholder="请选择退款状态" clearable>
28 - <el-option v-for="dict in payRefundOrderDictDatum" :key="parseInt(dict.value)" 33 + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.PAY_REFUND_STATUS)" :key="parseInt(dict.value)"
29 :label="dict.label" :value="parseInt(dict.value)"/> 34 :label="dict.label" :value="parseInt(dict.value)"/>
30 </el-select> 35 </el-select>
31 </el-form-item> 36 </el-form-item>
@@ -52,65 +57,55 @@ @@ -52,65 +57,55 @@
52 <!-- 列表 --> 57 <!-- 列表 -->
53 <el-table v-loading="loading" :data="list"> 58 <el-table v-loading="loading" :data="list">
54 <el-table-column label="编号" align="center" prop="id"/> 59 <el-table-column label="编号" align="center" prop="id"/>
55 - <el-table-column label="支付渠道" align="center" width="130"> 60 + <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  61 + <template v-slot="scope">
  62 + <span>{{ parseTime(scope.row.createTime) }}</span>
  63 + </template>
  64 + </el-table-column>
  65 + <el-table-column label="支付金额" align="center" prop="payPrice" width="100">
  66 + <template v-slot="scope" class="">
  67 + ¥{{ (scope.row.payPrice / 100.0).toFixed(2) }}
  68 + </template>
  69 + </el-table-column>
  70 + <el-table-column label="退款金额" align="center" prop="refundPrice" width="100">
56 <template v-slot="scope"> 71 <template v-slot="scope">
57 - <el-popover trigger="hover" placement="top">  
58 - <p>应用名称: {{ scope.row.appName }}</p>  
59 - <p>渠道名称: {{ scope.row.channelCodeName }}</p>  
60 - <div slot="reference" class="name-wrapper">  
61 - {{ scope.row.channelCodeName }}  
62 - </div>  
63 - </el-popover> 72 + ¥{{ (scope.row.refundPrice / 100.0).toFixed(2) }}
64 </template> 73 </template>
65 </el-table-column> 74 </el-table-column>
66 - <!-- <el-table-column label="交易订单号" align="center" prop="tradeNo" width="140"/>-->  
67 - <!-- <el-table-column label="商户订单编号" align="center" prop="merchantOrderId" width="140"/>-->  
68 - <el-table-column label="商户订单号" align="left" width="230"> 75 + <el-table-column label="退款订单号" align="left" width="300">
69 <template v-slot="scope"> 76 <template v-slot="scope">
70 <p class="order-font"> 77 <p class="order-font">
71 - <el-tag size="mini">退款</el-tag>  
72 - {{ scope.row.merchantRefundNo }} 78 + <el-tag size="mini">商户</el-tag> {{scope.row.merchantRefundId}}
73 </p> 79 </p>
74 <p class="order-font"> 80 <p class="order-font">
75 - <el-tag type="success">交易</el-tag>  
76 - {{ scope.row.merchantOrderId }} 81 + <el-tag size="mini" type="warning">支付</el-tag> {{scope.row.no}}
  82 + </p>
  83 + <p class="order-font" v-if="scope.row.channelRefundNo">
  84 + <el-tag size="mini" type="success">渠道</el-tag> {{scope.row.channelRefundNo}}
77 </p> 85 </p>
78 </template> 86 </template>
79 </el-table-column> 87 </el-table-column>
80 - <el-table-column label="支付订单号" align="center" prop="merchantRefundNo" width="250"> 88 + <el-table-column label="支付订单号" align="left" width="300">
81 <template v-slot="scope"> 89 <template v-slot="scope">
82 <p class="order-font"> 90 <p class="order-font">
83 - <el-tag size="mini">交易</el-tag>  
84 - {{ scope.row.tradeNo }} 91 + <el-tag size="mini">商户</el-tag> {{scope.row.merchantOrderId}}
85 </p> 92 </p>
86 <p class="order-font"> 93 <p class="order-font">
87 - <el-tag size="mini" type="warning">渠道</el-tag>  
88 - {{ scope.row.channelOrderNo }} 94 + <el-tag size="mini" type="success">渠道</el-tag> {{scope.row.channelOrderNo}}
89 </p> 95 </p>
90 </template> 96 </template>
91 </el-table-column> 97 </el-table-column>
92 - <el-table-column label="支付金额(元)" align="center" prop="payPrice" width="100">  
93 - <template v-slot="scope" class="">  
94 - ¥{{ parseFloat(scope.row.payPrice / 100).toFixed(2) }}  
95 - </template>  
96 - </el-table-column>  
97 - <el-table-column label="退款金额(元)" align="center" prop="refundPrice" width="100">  
98 - <template v-slot="scope">  
99 - ¥{{ parseFloat(scope.row.refundPrice / 100).toFixed(2) }}  
100 - </template>  
101 - </el-table-column>  
102 <el-table-column label="退款状态" align="center" prop="status"> 98 <el-table-column label="退款状态" align="center" prop="status">
103 <template v-slot="scope"> 99 <template v-slot="scope">
104 - <dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_STATUS" :value="scope.row.status" /> 100 + <dict-tag :type="DICT_TYPE.PAY_REFUND_STATUS" :value="scope.row.status" />
105 </template> 101 </template>
106 </el-table-column> 102 </el-table-column>
107 - <el-table-column label="退款原因" align="center" prop="reason" width="140" :show-overflow-tooltip="true"/>  
108 - <el-table-column label="创建时间" align="center" prop="createTime" width="100"> 103 + <el-table-column label="退款渠道" align="center" width="140">
109 <template v-slot="scope"> 104 <template v-slot="scope">
110 - <span>{{ parseTime(scope.row.createTime) }}</span> 105 + <dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE" :value="scope.row.channelCode" />
111 </template> 106 </template>
112 </el-table-column> 107 </el-table-column>
113 - <el-table-column label="退款成功时间" align="center" prop="successTime" width="100"> 108 + <el-table-column label="成功时间" align="center" prop="successTime" width="180">
114 <template v-slot="scope"> 109 <template v-slot="scope">
115 <span>{{ parseTime(scope.row.successTime) }}</span> 110 <span>{{ parseTime(scope.row.successTime) }}</span>
116 </template> 111 </template>
@@ -150,7 +145,7 @@ @@ -150,7 +145,7 @@
150 <el-tag class="tag-purple" size="mini">{{ parseFloat(refundDetail.refundPrice / 100).toFixed(2) }}</el-tag> 145 <el-tag class="tag-purple" size="mini">{{ parseFloat(refundDetail.refundPrice / 100).toFixed(2) }}</el-tag>
151 </el-descriptions-item> 146 </el-descriptions-item>
152 <el-descriptions-item label="退款状态"> 147 <el-descriptions-item label="退款状态">
153 - <dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_STATUS" :value="refundDetail.status" /> 148 + <dict-tag :type="DICT_TYPE.PAY_REFUND_STATUS" :value="refundDetail.status" />
154 </el-descriptions-item> 149 </el-descriptions-item>
155 <el-descriptions-item label="创建时间">{{ parseTime(refundDetail.createTime) }}</el-descriptions-item> 150 <el-descriptions-item label="创建时间">{{ parseTime(refundDetail.createTime) }}</el-descriptions-item>
156 <el-descriptions-item label="退款成功时间">{{ parseTime(refundDetail.successTime) }}</el-descriptions-item> 151 <el-descriptions-item label="退款成功时间">{{ parseTime(refundDetail.successTime) }}</el-descriptions-item>
@@ -185,37 +180,7 @@ @@ -185,37 +180,7 @@
185 180
186 <script> 181 <script>
187 import {getRefundPage, exportRefundExcel, getRefund} from "@/api/pay/refund"; 182 import {getRefundPage, exportRefundExcel, getRefund} from "@/api/pay/refund";
188 -import { DICT_TYPE, getDictDatas } from "@/utils/dict";  
189 -import { getNowDateTime } from "@/utils/ruoyi";  
190 -  
191 -const defaultRefundDetail = {  
192 - id: null,  
193 - appId: null,  
194 - appName: '',  
195 - channelCode: '',  
196 - channelCodeName: '',  
197 - channelErrorCode: '',  
198 - channelErrorMsg: '',  
199 - channelExtras: '',  
200 - channelId: null,  
201 - channelOrderNo: '',  
202 - channelRefundNo: '',  
203 - createTime: null,  
204 - expireTime: null,  
205 - merchantOrderId: '',  
206 - merchantRefundNo: '',  
207 - notifyUrl: '',  
208 - orderId: null,  
209 - payPrice: null,  
210 - reason: '',  
211 - refundPrice: null,  
212 - status: null,  
213 - subject: '',  
214 - successTime: null,  
215 - tradeNo: '',  
216 - type: null,  
217 - userIp: ''  
218 -} 183 +import { getAppList } from "@/api/pay/app";
219 184
220 export default { 185 export default {
221 name: "PayRefund", 186 name: "PayRefund",
@@ -239,67 +204,30 @@ export default { @@ -239,67 +204,30 @@ export default {
239 pageNo: 1, 204 pageNo: 1,
240 pageSize: 10, 205 pageSize: 10,
241 appId: null, 206 appId: null,
242 - channelId: null,  
243 channelCode: null, 207 channelCode: null,
244 - orderId: null,  
245 - tradeNo: null,  
246 merchantOrderId: null, 208 merchantOrderId: null,
247 - merchantRefundNo: null,  
248 - notifyUrl: null,  
249 - status: null,  
250 - type: null,  
251 - payPrice: null,  
252 - refundPrice: null,  
253 - reason: null,  
254 - userIp: null, 209 + merchantRefundId: null,
255 channelOrderNo: null, 210 channelOrderNo: null,
256 channelRefundNo: null, 211 channelRefundNo: null,
257 - channelErrorCode: null,  
258 - channelErrorMsg: null,  
259 - channelExtras: null,  
260 - expireTime: [],  
261 - successTime: [], 212 + status: null,
262 createTime: [] 213 createTime: []
263 }, 214 },
264 - // 商户加载遮罩层  
265 - merchantLoading: false,  
266 - // 商户列表集合  
267 - merchantList: null,  
268 // 支付应用列表集合 215 // 支付应用列表集合
269 appList: null, 216 appList: null,
270 - // 支付渠道编码字典数据集合  
271 - payChannelCodeDictDatum: getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE),  
272 - // 订单退款状态字典数据集合  
273 - payRefundOrderDictDatum: getDictDatas(DICT_TYPE.PAY_REFUND_ORDER_STATUS),  
274 - // 订单回调商户状态字典数据集合  
275 - payOrderNotifyDictDatum: getDictDatas(DICT_TYPE.PAY_NOTIFY_STATUS),  
276 // 退款订单详情 217 // 退款订单详情
277 - refundDetail: JSON.parse(JSON.stringify(defaultRefundDetail)), 218 + refundDetail: {},
278 }; 219 };
279 }, 220 },
280 created() { 221 created() {
281 - this.initTime();  
282 this.getList(); 222 this.getList();
283 - this.handleGetMerchantListByName(null); 223 + // 获得筛选项
  224 + getAppList().then(response => {
  225 + this.appList = response.data;
  226 + })
284 }, 227 },
285 methods: { 228 methods: {
286 - initTime(){  
287 - this.queryParams.createTime = [getNowDateTime("00:00:00"), getNowDateTime("23:59:59")];  
288 - },  
289 /** 查询列表 */ 229 /** 查询列表 */
290 getList() { 230 getList() {
291 - // 判断选择的日期是否超过了一个月  
292 - let oneMonthTime = 31 * 24 * 3600 * 1000;  
293 - if (this.queryParams.createTime == null){  
294 - this.initTime();  
295 - } else {  
296 - let minDateTime = new Date(this.queryParams.createTime[0]).getTime();  
297 - let maxDateTime = new Date(this.queryParams.createTime[1]).getTime()  
298 - if (maxDateTime - minDateTime > oneMonthTime) {  
299 - this.$message.error('时间范围最大为 31 天!');  
300 - return false;  
301 - }  
302 - }  
303 this.loading = true; 231 this.loading = true;
304 // 执行查询 232 // 执行查询
305 getRefundPage(this.queryParams).then(response => { 233 getRefundPage(this.queryParams).then(response => {
@@ -336,25 +264,14 @@ export default { @@ -336,25 +264,14 @@ export default {
336 }).catch(() => {}); 264 }).catch(() => {});
337 }, 265 },
338 /** 266 /**
339 - * 根据商户名称模糊匹配商户信息  
340 - * @param name 商户名称  
341 - */  
342 - handleGetMerchantListByName(name) {  
343 - getMerchantListByName(name).then(response => {  
344 - this.merchantList = response.data;  
345 - this.merchantLoading = false;  
346 - });  
347 - },  
348 - /**  
349 * 查看订单详情 267 * 查看订单详情
350 */ 268 */
351 handleQueryDetails(row) { 269 handleQueryDetails(row) {
352 - this.refundDetail = JSON.parse(JSON.stringify(defaultRefundDetail)); 270 + this.refundDetail = {};
353 getRefund(row.id).then(response => { 271 getRefund(row.id).then(response => {
354 this.refundDetail = response.data; 272 this.refundDetail = response.data;
355 this.open = true; 273 this.open = true;
356 }); 274 });
357 -  
358 }, 275 },
359 } 276 }
360 }; 277 };