mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 07:55:06 +08:00
mall + pay:
1. 优化退款管理的接口实现
This commit is contained in:
0
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderRespVO.java
Executable file → Normal file
0
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderRespVO.java
Executable file → Normal file
@ -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<PayRefundDetailsRespVO> 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<Long, PayAppDO> appMap = appService.getAppMap(
|
||||
CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getAppId));
|
||||
List<PayRefundPageItemRespVO> 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<Long, PayAppDO> 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<PayRefundDO> list = refundService.getRefundList(exportReqVO);
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
ExcelUtils.write(response, "退款订单.xls", "数据",
|
||||
PayRefundExcelVO.class, new ArrayList<>());
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理应用ID数据
|
||||
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
||||
CollectionUtils.convertList(list, PayRefundDO::getAppId));
|
||||
convertList(list, PayRefundDO::getAppId));
|
||||
|
||||
List<PayRefundExcelVO> excelDatum = new ArrayList<>(list.size());
|
||||
// 处理商品名称数据
|
||||
Map<Long, PayOrderDO> orderMap = orderService.getOrderSubjectMap(
|
||||
CollectionUtils.convertList(list, PayRefundDO::getOrderId));
|
||||
convertList(list, PayRefundDO::getOrderId));
|
||||
|
||||
list.forEach(c -> {
|
||||
PayAppDO appDO = appMap.get(c.getAppId());
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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 {
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 = "创建时间")
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 = "创建时间")
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<PayRefundRespVO> convertList(List<PayRefundDO> list);
|
||||
|
||||
PageResult<PayRefundRespVO> convertPage(PageResult<PayRefundDO> page);
|
||||
default PageResult<PayRefundPageItemRespVO> convertPage(PageResult<PayRefundDO> page, Map<Long, PayAppDO> appMap) {
|
||||
PageResult<PayRefundPageItemRespVO> result = convertPage(page);
|
||||
result.getList().forEach(order -> MapUtils.findAndThen(appMap, order.getAppId(), app -> order.setAppName(app.getName())));
|
||||
return result;
|
||||
}
|
||||
PageResult<PayRefundPageItemRespVO> convertPage(PageResult<PayRefundDO> page);
|
||||
|
||||
/**
|
||||
* 退款订单DO 转 导出excel VO
|
||||
|
@ -140,7 +140,7 @@ public class PayRefundDO extends BaseDO {
|
||||
*/
|
||||
private String channelErrorCode;
|
||||
/**
|
||||
* 调用渠道报错时,错误信息
|
||||
* 调用渠道的错误提示
|
||||
*/
|
||||
private String channelErrorMsg;
|
||||
|
||||
|
@ -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<PayRefundDO> {
|
||||
}
|
||||
|
||||
default PageResult<PayRefundDO> selectPage(PayRefundPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<PayRefundDO>()
|
||||
.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<PayRefundDO>()
|
||||
.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<PayRefundDO> selectList(PayRefundExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<PayRefundDO>()
|
||||
.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<PayRefundDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)}));
|
||||
|
||||
|
Reference in New Issue
Block a user