diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderRespVO.java old mode 100755 new mode 100644 diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/PayRefundController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/PayRefundController.java index 5f8446192..935ecb9e4 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/PayRefundController.java +++ b/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; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.*; import cn.iocoder.yudao.module.pay.convert.refund.PayRefundConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; @@ -10,15 +15,9 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; import cn.iocoder.yudao.module.pay.service.app.PayAppService; import cn.iocoder.yudao.module.pay.service.order.PayOrderService; import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; @@ -35,6 +34,7 @@ import java.util.List; import java.util.Map; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @Tag(name = "管理后台 - 退款订单") @@ -56,20 +56,14 @@ public class PayRefundController { @PreAuthorize("@ss.hasPermission('pay:refund:query')") public CommonResult getRefund(@RequestParam("id") Long id) { PayRefundDO refund = refundService.getRefund(id); - if (ObjectUtil.isNull(refund)) { + if (refund == null) { return success(new PayRefundDetailsRespVO()); } - PayAppDO appDO = appService.getApp(refund.getAppId()); - PayChannelEnum channelEnum = PayChannelEnum.getByCode(refund.getChannelCode()); - PayOrderDO orderDO = orderService.getOrder(refund.getOrderId()); - - PayRefundDetailsRespVO refundDetail = PayRefundConvert.INSTANCE.refundDetailConvert(refund); - refundDetail.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用"); - refundDetail.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道"); - refundDetail.setSubject(orderDO.getSubject()); - - return success(refundDetail); + // 拼接数据 + PayAppDO app = appService.getApp(refund.getAppId()); + PayOrderDO order = orderService.getOrder(refund.getOrderId()); + return success(PayRefundConvert.INSTANCE.convert(refund, order, app)); } @GetMapping("/page") @@ -82,21 +76,8 @@ public class PayRefundController { } // 处理应用ID数据 - Map appMap = appService.getAppMap( - CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getAppId)); - List list = new ArrayList<>(pageResult.getList().size()); - pageResult.getList().forEach(c -> { - PayAppDO appDO = appMap.get(c.getAppId()); - PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode()); - - PayRefundPageItemRespVO item = PayRefundConvert.INSTANCE.pageItemConvert(c); - - item.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用"); - item.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道"); - list.add(item); - }); - - return success(new PageResult<>(list, pageResult.getTotal())); + Map appMap = appService.getAppMap(convertList(pageResult.getList(), PayRefundDO::getAppId)); + return success(PayRefundConvert.INSTANCE.convertPage(pageResult, appMap)); } @GetMapping("/export-excel") @@ -105,21 +86,21 @@ public class PayRefundController { @OperateLog(type = EXPORT) public void exportRefundExcel(@Valid PayRefundExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = refundService.getRefundList(exportReqVO); if (CollectionUtil.isEmpty(list)) { ExcelUtils.write(response, "退款订单.xls", "数据", PayRefundExcelVO.class, new ArrayList<>()); + return; } // 处理应用ID数据 Map appMap = appService.getAppMap( - CollectionUtils.convertList(list, PayRefundDO::getAppId)); + convertList(list, PayRefundDO::getAppId)); List excelDatum = new ArrayList<>(list.size()); // 处理商品名称数据 Map orderMap = orderService.getOrderSubjectMap( - CollectionUtils.convertList(list, PayRefundDO::getOrderId)); + convertList(list, PayRefundDO::getOrderId)); list.forEach(c -> { PayAppDO appDO = appMap.get(c.getAppId()); diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundBaseVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundBaseVO.java index 61a0fd63d..25cadf478 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundBaseVO.java @@ -1,13 +1,10 @@ package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; -import javax.validation.constraints.NotNull; import java.time.LocalDateTime; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - /** * 退款订单 Base VO,提供给添加、修改、详细的子 VO 使用 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 @@ -15,83 +12,67 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data public class PayRefundBaseVO { - @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "应用编号不能为空") + @Schema(description = "外部退款号", requiredMode = Schema.RequiredMode.REQUIRED, example = "110") + private String no; + + @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") private Long appId; - @Schema(description = "渠道编号", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "渠道编号不能为空") + @Schema(description = "渠道编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") private Long channelId; - @Schema(description = "渠道编码", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "渠道编码不能为空") + @Schema(description = "渠道编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "wx_app") private String channelCode; - @Schema(description = "支付订单编号 pay_order 表id", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "支付订单编号 pay_order 表id不能为空") + @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") private Long orderId; - @Schema(description = "交易订单号 pay_extension 表no 字段", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "交易订单号 pay_extension 表no 字段不能为空") - private String tradeNo; + // ========== 商户相关字段 ========== - @Schema(description = "商户订单编号(商户系统生成)", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "商户订单编号(商户系统生成)不能为空") + @Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "225") private String merchantOrderId; - @Schema(description = "商户退款订单号(商户系统生成)", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "商户退款订单号(商户系统生成)不能为空") - private String merchantRefundNo; + @Schema(description = "商户退款订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "512") + private String merchantRefundId; - @Schema(description = "异步通知商户地址", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "异步通知商户地址不能为空") + @Schema(description = "异步通知地址", requiredMode = Schema.RequiredMode.REQUIRED) private String notifyUrl; - @Schema(description = "退款状态", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "退款状态不能为空") + // ========== 退款相关字段 ========== + + @Schema(description = "退款状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") private Integer status; - @Schema(description = "退款类型(部分退款,全部退款)", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "退款类型(部分退款,全部退款)不能为空") - private Integer type; + @Schema(description = "支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") + private Long payPrice; - @Schema(description = "支付金额,单位分", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "支付金额,单位分不能为空") - private Long payAmount; + @Schema(description = "退款金额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "200") + private Long refundPrice; - @Schema(description = "退款金额,单位分", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "退款金额,单位分不能为空") - private Long refundAmount; - - @Schema(description = "退款原因", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "退款原因不能为空") + @Schema(description = "退款原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "我要退了") private String reason; - @Schema(description = "用户 IP") + @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1") private String userIp; - @Schema(description = "渠道订单号,pay_order 中的channel_order_no 对应", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "渠道订单号,pay_order 中的channel_order_no 对应不能为空") + // ========== 渠道相关字段 ========== + + @Schema(description = "渠道订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "233") private String channelOrderNo; - @Schema(description = "渠道退款单号,渠道返回") + @Schema(description = "渠道退款单号", example = "2022") private String channelRefundNo; - @Schema(description = "渠道调用报错时,错误码") + @Schema(description = "退款成功时间") + private LocalDateTime successTime; + + @Schema(description = "调用渠道的错误码") private String channelErrorCode; - @Schema(description = "渠道调用报错时,错误信息") + @Schema(description = "调用渠道的错误提示") private String channelErrorMsg; @Schema(description = "支付渠道的额外参数") - private String channelExtras; - - @Schema(description = "退款失效时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime expireTime; - - @Schema(description = "退款成功时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime successTime; + private String channelNotifyData; } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundCreateReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundCreateReqVO.java deleted file mode 100755 index 86cf94636..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundCreateReqVO.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; - -@Schema(description = "管理后台 - 退款订单创建 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class PayRefundCreateReqVO extends PayRefundBaseVO { - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundDetailsRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundDetailsRespVO.java index f622dda79..8f50a3a13 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundDetailsRespVO.java +++ b/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; import lombok.EqualsAndHashCode; import lombok.ToString; -import javax.validation.constraints.NotNull; import java.time.LocalDateTime; @Schema(description = "管理后台 - 退款订单详情 Response VO") @@ -17,14 +16,11 @@ public class PayRefundDetailsRespVO extends PayRefundBaseVO { @Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED) private Long id; - @Schema(description = "应用名称") + @Schema(description = "应用名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是芋艿") private String appName; - @Schema(description = "渠道编号名称") - private String channelCodeName; - - @NotNull(message = "商品标题不能为空") - private String subject; + @Schema(description = "支付订单", requiredMode = Schema.RequiredMode.REQUIRED) + private Order order; @Schema(description = "创建时间") private LocalDateTime createTime; @@ -32,4 +28,13 @@ public class PayRefundDetailsRespVO extends PayRefundBaseVO { @Schema(description = "更新时间") private LocalDateTime updateTime; + @Schema(description = "管理后台 - 支付订单") + @Data + public static class Order { + + @Schema(description = "商品标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "土豆") + private String subject; + + } + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExportReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExportReqVO.java index f2b9b9d06..645816ee2 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExportReqVO.java +++ b/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_ @Data public class PayRefundExportReqVO { - @Schema(description = "应用编号") + @Schema(description = "应用编号", example = "1024") private Long appId; - @Schema(description = "渠道编号") - private Long channelId; - - @Schema(description = "渠道编码") + @Schema(description = "渠道编码", example = "wx_app") private String channelCode; - @Schema(description = "支付订单编号 pay_order 表id") - private Long orderId; - - @Schema(description = "交易订单号 pay_extension 表no 字段") - private String tradeNo; - - @Schema(description = "商户订单编号(商户系统生成)") + @Schema(description = "商户支付单号", example = "10") private String merchantOrderId; - @Schema(description = "商户退款订单号(商户系统生成)") - private String merchantRefundNo; + @Schema(description = "商户退款单号", example = "20") + private String merchantRefundId; - @Schema(description = "异步通知商户地址") - private String notifyUrl; - - @Schema(description = "退款状态") - private Integer status; - - @Schema(description = "退款类型(部分退款,全部退款)") - private Integer type; - - @Schema(description = "支付金额,单位分") - private Long payPrice; - - @Schema(description = "退款金额,单位分") - private Long refundPrice; - - @Schema(description = "退款原因") - private String reason; - - @Schema(description = "用户 IP") - private String userIp; - - @Schema(description = "渠道订单号,pay_order 中的channel_order_no 对应") + @Schema(description = "渠道支付单号", example = "30") private String channelOrderNo; - @Schema(description = "渠道退款单号,渠道返回") + @Schema(description = "渠道退款单号", example = "40") private String channelRefundNo; - @Schema(description = "渠道调用报错时,错误码") - private String channelErrorCode; - - @Schema(description = "渠道调用报错时,错误信息") - private String channelErrorMsg; - - @Schema(description = "支付渠道的额外参数") - private String channelExtras; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @Schema(description = "退款失效时间") - private LocalDateTime[] expireTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @Schema(description = "退款成功时间") - private LocalDateTime[] successTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @Schema(description = "退款通知时间") - private LocalDateTime[] notifyTime; + @Schema(description = "退款状态", example = "0") + private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @Schema(description = "创建时间") diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageItemRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageItemRespVO.java index 8c547c6e4..27c1285cc 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageItemRespVO.java +++ b/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; @ToString(callSuper = true) public class PayRefundPageItemRespVO extends PayRefundBaseVO { - @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") private Long id; - @Schema(description = "应用名称") + @Schema(description = "应用名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是芋艿") private String appName; - @Schema(description = "渠道名称") - private String channelCodeName; - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) private LocalDateTime createTime; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageReqVO.java index 3c9cb8613..7ff1530f0 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageReqVO.java +++ b/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_ @ToString(callSuper = true) public class PayRefundPageReqVO extends PageParam { - @Schema(description = "应用编号") + @Schema(description = "应用编号", example = "1024") private Long appId; - @Schema(description = "渠道编号") - private Long channelId; - - @Schema(description = "渠道编码") + @Schema(description = "渠道编码", example = "wx_app") private String channelCode; - @Schema(description = "支付订单编号 pay_order 表id") - private Long orderId; - - @Schema(description = "交易订单号 pay_extension 表no 字段") - private String tradeNo; - - @Schema(description = "商户订单编号(商户系统生成)") + @Schema(description = "商户支付单号", example = "10") private String merchantOrderId; - @Schema(description = "商户退款订单号(商户系统生成)") - private String merchantRefundNo; + @Schema(description = "商户退款单号", example = "20") + private String merchantRefundId; - @Schema(description = "异步通知商户地址") - private String notifyUrl; - - @Schema(description = "退款状态") - private Integer status; - - @Schema(description = "退款类型(部分退款,全部退款)") - private Integer type; - - @Schema(description = "支付金额,单位分") - private Long payPrice; - - @Schema(description = "退款金额,单位分") - private Long refundPrice; - - @Schema(description = "退款原因") - private String reason; - - @Schema(description = "用户 IP") - private String userIp; - - @Schema(description = "渠道订单号,pay_order 中的channel_order_no 对应") + @Schema(description = "渠道支付单号", example = "30") private String channelOrderNo; - @Schema(description = "渠道退款单号,渠道返回") + @Schema(description = "渠道退款单号", example = "40") private String channelRefundNo; - @Schema(description = "渠道调用报错时,错误码") - private String channelErrorCode; - - @Schema(description = "渠道调用报错时,错误信息") - private String channelErrorMsg; - - @Schema(description = "支付渠道的额外参数") - private String channelExtras; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @Schema(description = "退款失效时间") - private LocalDateTime[] expireTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @Schema(description = "退款成功时间") - private LocalDateTime[] successTime; + @Schema(description = "退款状态", example = "0") + private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @Schema(description = "创建时间") diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundRespVO.java deleted file mode 100755 index d3ee9f455..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundRespVO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.time.LocalDateTime; - -@Schema(description = "管理后台 - 退款订单 Response VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class PayRefundRespVO extends PayRefundBaseVO { - - @Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED) - private Long id; - - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) - private LocalDateTime createTime; - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundUpdateReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundUpdateReqVO.java deleted file mode 100755 index cf5b0be1f..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundUpdateReqVO.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import javax.validation.constraints.*; - -@Schema(description = "管理后台 - 退款订单更新 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class PayRefundUpdateReqVO extends PayRefundBaseVO { - - @Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "支付退款编号不能为空") - private Long id; - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/refund/PayRefundConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/refund/PayRefundConvert.java index d60682595..de6519648 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/refund/PayRefundConvert.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/refund/PayRefundConvert.java @@ -1,47 +1,45 @@ package cn.iocoder.yudao.module.pay.convert.refund; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundRespDTO; -import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.*; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundDetailsRespVO; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExcelVO; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageItemRespVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; import java.math.BigDecimal; import java.math.RoundingMode; -import java.util.List; +import java.util.Map; @Mapper public interface PayRefundConvert { PayRefundConvert INSTANCE = Mappers.getMapper(PayRefundConvert.class); - PayRefundDO convert(PayRefundCreateReqVO bean); - PayRefundDO convert(PayRefundUpdateReqVO bean); + default PayRefundDetailsRespVO convert(PayRefundDO refund, PayOrderDO order, PayAppDO app) { + PayRefundDetailsRespVO respVO = convert(refund) + .setOrder(convert(order)); + if (app != null) { + respVO.setAppName(app.getName()); + } + return respVO; + } + PayRefundDetailsRespVO convert(PayRefundDO bean); + PayRefundDetailsRespVO.Order convert(PayOrderDO bean); - PayRefundRespVO convert(PayRefundDO bean); - - /** - * 退款订单 DO 转 退款详情订单 VO - * - * @param bean 退款订单 DO - * @return 退款详情订单 VO - */ - PayRefundDetailsRespVO refundDetailConvert(PayRefundDO bean); - - /** - * 退款订单DO 转 分页退款条目VO - * - * @param bean 退款订单DO - * @return 分页退款条目VO - */ - PayRefundPageItemRespVO pageItemConvert(PayRefundDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); + default PageResult convertPage(PageResult page, Map appMap) { + PageResult result = convertPage(page); + result.getList().forEach(order -> MapUtils.findAndThen(appMap, order.getAppId(), app -> order.setAppName(app.getName()))); + return result; + } + PageResult convertPage(PageResult page); /** * 退款订单DO 转 导出excel VO diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/refund/PayRefundDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/refund/PayRefundDO.java index 6261729ad..a3ca04871 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/refund/PayRefundDO.java +++ b/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 { */ private String channelErrorCode; /** - * 调用渠道报错时,错误信息 + * 调用渠道的错误提示 */ private String channelErrorMsg; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/refund/PayRefundMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/refund/PayRefundMapper.java index eda29f46e..788576059 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/refund/PayRefundMapper.java +++ b/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; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; @@ -44,25 +43,29 @@ public interface PayRefundMapper extends BaseMapperX { } default PageResult selectPage(PayRefundPageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() - .eqIfPresent("app_id", reqVO.getAppId()) - .eqIfPresent("channel_code", reqVO.getChannelCode()) - .likeIfPresent("merchant_refund_no", reqVO.getMerchantRefundNo()) - .eqIfPresent("type", reqVO.getType()) - .eqIfPresent("status", reqVO.getStatus()) - .betweenIfPresent("create_time", reqVO.getCreateTime()) - .orderByDesc("id")); + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(PayRefundDO::getAppId, reqVO.getAppId()) + .eqIfPresent(PayRefundDO::getChannelCode, reqVO.getChannelCode()) + .likeIfPresent(PayRefundDO::getMerchantOrderId, reqVO.getMerchantOrderId()) + .likeIfPresent(PayRefundDO::getMerchantRefundId, reqVO.getMerchantRefundId()) + .likeIfPresent(PayRefundDO::getChannelOrderNo, reqVO.getChannelOrderNo()) + .likeIfPresent(PayRefundDO::getChannelRefundNo, reqVO.getChannelRefundNo()) + .eqIfPresent(PayRefundDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(PayRefundDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PayRefundDO::getId)); } default List selectList(PayRefundExportReqVO reqVO) { - return selectList(new QueryWrapperX() - .eqIfPresent("app_id", reqVO.getAppId()) - .eqIfPresent("channel_code", reqVO.getChannelCode()) - .likeIfPresent("merchant_refund_no", reqVO.getMerchantRefundNo()) - .eqIfPresent("type", reqVO.getType()) - .eqIfPresent("status", reqVO.getStatus()) - .betweenIfPresent("create_time", reqVO.getCreateTime()) - .orderByDesc("id")); + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(PayRefundDO::getAppId, reqVO.getAppId()) + .eqIfPresent(PayRefundDO::getChannelCode, reqVO.getChannelCode()) + .likeIfPresent(PayRefundDO::getMerchantOrderId, reqVO.getMerchantOrderId()) + .likeIfPresent(PayRefundDO::getMerchantRefundId, reqVO.getMerchantRefundId()) + .likeIfPresent(PayRefundDO::getChannelOrderNo, reqVO.getChannelOrderNo()) + .likeIfPresent(PayRefundDO::getChannelRefundNo, reqVO.getChannelRefundNo()) + .eqIfPresent(PayRefundDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(PayRefundDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PayRefundDO::getId)); } } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java index 5d66a66dd..ab880e2b0 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java +++ b/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 { PayRefundPageReqVO reqVO = new PayRefundPageReqVO(); reqVO.setAppId(1L); reqVO.setChannelCode(PayChannelEnum.WX_PUB.getCode()); - reqVO.setMerchantRefundNo("MRF0000001"); + reqVO.setMerchantRefundId("MRF0000001"); reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()); reqVO.setCreateTime((new LocalDateTime[]{LocalDateTime.of(2021, 1, 1, 10, 10, 10), LocalDateTime.of(2021, 1, 1, 10, 10, 12)})); @@ -145,7 +145,6 @@ public class PayRefundServiceTest extends BaseDbUnitTest { PayRefundExportReqVO reqVO = new PayRefundExportReqVO(); reqVO.setAppId(1L); reqVO.setChannelCode(PayChannelEnum.WX_PUB.getCode()); - reqVO.setMerchantRefundNo("MRF0000001"); reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()); reqVO.setCreateTime((new LocalDateTime[]{LocalDateTime.of(2021, 1, 1, 10, 10, 10), LocalDateTime.of(2021, 1, 1, 10, 10, 12)})); diff --git a/yudao-ui-admin/src/utils/dict.js b/yudao-ui-admin/src/utils/dict.js index 04f79df5b..4f20c890b 100644 --- a/yudao-ui-admin/src/utils/dict.js +++ b/yudao-ui-admin/src/utils/dict.js @@ -58,7 +58,7 @@ export const DICT_TYPE = { PAY_CHANNEL_CODE: 'pay_channel_code', // 支付渠道编码类型 PAY_NOTIFY_STATUS: 'pay_notify_status', // 商户支付回调状态 PAY_ORDER_STATUS: 'pay_order_status', // 商户支付订单状态 - PAY_REFUND_ORDER_STATUS: 'pay_refund_order_status', // 退款订单状态 + PAY_REFUND_STATUS: 'pay_refund_status', // 退款订单状态 // ========== MP 模块 ========== MP_AUTO_REPLY_REQUEST_MATCH: 'mp_auto_reply_request_match', // 自动回复请求匹配类型 diff --git a/yudao-ui-admin/src/views/pay/order/index.vue b/yudao-ui-admin/src/views/pay/order/index.vue index b9010ee9c..fe24d0d45 100755 --- a/yudao-ui-admin/src/views/pay/order/index.vue +++ b/yudao-ui-admin/src/views/pay/order/index.vue @@ -9,8 +9,7 @@ - + @@ -77,9 +76,15 @@ diff --git a/yudao-ui-admin/src/views/pay/refund/index.vue b/yudao-ui-admin/src/views/pay/refund/index.vue index e60ab89b4..e2ed22384 100755 --- a/yudao-ui-admin/src/views/pay/refund/index.vue +++ b/yudao-ui-admin/src/views/pay/refund/index.vue @@ -7,25 +7,30 @@ - - - + + + - - - - + + - - + + + + + + + - @@ -52,65 +57,55 @@ - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + @@ -150,7 +145,7 @@ {{ parseFloat(refundDetail.refundPrice / 100).toFixed(2) }} - + {{ parseTime(refundDetail.createTime) }} {{ parseTime(refundDetail.successTime) }} @@ -185,37 +180,7 @@