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 935ecb9e4..24e2b22e5 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
@@ -1,16 +1,13 @@
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;
-import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
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;
@@ -62,8 +59,7 @@ public class PayRefundController {
// 拼接数据
PayAppDO app = appService.getApp(refund.getAppId());
- PayOrderDO order = orderService.getOrder(refund.getOrderId());
- return success(PayRefundConvert.INSTANCE.convert(refund, order, app));
+ return success(PayRefundConvert.INSTANCE.convert(refund, app));
}
@GetMapping("/page")
@@ -93,29 +89,11 @@ public class PayRefundController {
return;
}
- // 处理应用ID数据
- Map appMap = appService.getAppMap(
- convertList(list, PayRefundDO::getAppId));
-
- List excelDatum = new ArrayList<>(list.size());
- // 处理商品名称数据
- Map orderMap = orderService.getOrderSubjectMap(
- convertList(list, PayRefundDO::getOrderId));
-
- list.forEach(c -> {
- PayAppDO appDO = appMap.get(c.getAppId());
- PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
-
- PayRefundExcelVO excelItem = PayRefundConvert.INSTANCE.excelConvert(c);
- excelItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
- excelItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
- excelItem.setSubject(orderMap.get(c.getOrderId()).getSubject());
-
- excelDatum.add(excelItem);
- });
-
+ // 拼接返回
+ Map appMap = appService.getAppMap(convertList(list, PayRefundDO::getAppId));
+ List excelList = PayRefundConvert.INSTANCE.convertList(list, appMap);
// 导出 Excel
- ExcelUtils.write(response, "退款订单.xls", "数据", PayRefundExcelVO.class, excelDatum);
+ ExcelUtils.write(response, "退款订单.xls", "数据", PayRefundExcelVO.class, excelList);
}
}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExcelVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExcelVO.java
index b818e43df..758b6b6b0 100755
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExcelVO.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExcelVO.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.controller.admin.refund.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
+import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert;
import cn.iocoder.yudao.module.pay.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@@ -19,56 +20,42 @@ public class PayRefundExcelVO {
@ExcelProperty("支付退款编号")
private Long id;
- @ExcelProperty("商品名称")
- private String subject;
+ @ExcelProperty("创建时间")
+ private LocalDateTime createTime;
- @ExcelProperty(value = "应用名称")
- private String appName;
+ @ExcelProperty(value = "支付金额", converter = MoneyConvert.class)
+ private Integer payPrice;
- @ExcelProperty(value = "渠道编号名称")
- private String channelCodeName;
+ @ExcelProperty(value = "退款金额", converter = MoneyConvert.class)
+ private Integer refundPrice;
- @ExcelProperty("交易订单号")
- private String tradeNo;
+ @ExcelProperty("商户退款单号")
+ private String merchantRefundId;
+ @ExcelProperty("退款单号")
+ private String no;
+ @ExcelProperty("渠道退款单号")
+ private String channelRefundNo;
- @ExcelProperty("商户订单编号")
+ @ExcelProperty("商户支付单号")
private String merchantOrderId;
+ @ExcelProperty("渠道支付单号")
+ private String channelOrderNo;
- @ExcelProperty("商户退款订单号")
- private String merchantRefundNo;
-
- @ExcelProperty("异步通知商户地址")
- private String notifyUrl;
-
- @DictFormat(DictTypeConstants.REFUND_STATUS)
@ExcelProperty(value = "退款状态", converter = DictConvert.class)
+ @DictFormat(DictTypeConstants.REFUND_STATUS)
private Integer status;
- @ExcelProperty("支付金额,单位:元")
- private String payPrice;
+ @ExcelProperty(value = "退款渠道", converter = DictConvert.class)
+ @DictFormat(DictTypeConstants.CHANNEL_CODE)
+ private String channelCode;
- @ExcelProperty("退款金额,单位:元")
- private String refundPrice;
+ @ExcelProperty("成功时间")
+ private LocalDateTime successTime;
+
+ @ExcelProperty(value = "支付应用")
+ private String appName;
@ExcelProperty("退款原因")
private String reason;
- @ExcelProperty("用户付款 IP")
- private String userIp;
-
- @ExcelProperty("渠道订单号")
- private String channelOrderNo;
-
- @ExcelProperty("渠道退款单号")
- private String channelRefundNo;
-
- @ExcelProperty("创建时间")
- private LocalDateTime createTime;
-
- @ExcelProperty("退款成功时间")
- private LocalDateTime successTime;
-
- @ExcelProperty("退款失效时间")
- private LocalDateTime expireTime;
-
}
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 de6519648..9f087f702 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,6 +1,7 @@
package cn.iocoder.yudao.module.pay.convert.refund;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
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;
@@ -13,8 +14,7 @@ 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
@@ -23,9 +23,8 @@ public interface PayRefundConvert {
PayRefundConvert INSTANCE = Mappers.getMapper(PayRefundConvert.class);
- default PayRefundDetailsRespVO convert(PayRefundDO refund, PayOrderDO order, PayAppDO app) {
- PayRefundDetailsRespVO respVO = convert(refund)
- .setOrder(convert(order));
+ default PayRefundDetailsRespVO convert(PayRefundDO refund, PayAppDO app) {
+ PayRefundDetailsRespVO respVO = convert(refund);
if (app != null) {
respVO.setAppName(app.getName());
}
@@ -41,44 +40,17 @@ public interface PayRefundConvert {
}
PageResult convertPage(PageResult page);
- /**
- * 退款订单DO 转 导出excel VO
- *
- * @param bean 退款订单DO
- * @return 导出 excel VO
- */
- default PayRefundExcelVO excelConvert(PayRefundDO bean) {
- if (bean == null) {
- return null;
- }
-
- PayRefundExcelVO payRefundExcelVO = new PayRefundExcelVO();
-
- payRefundExcelVO.setId(bean.getId());
- payRefundExcelVO.setTradeNo(bean.getNo());
- payRefundExcelVO.setMerchantOrderId(bean.getMerchantOrderId());
- // TODO 芋艿:晚点在改
-// payRefundExcelVO.setMerchantRefundNo(bean.getMerchantRefundNo());
- payRefundExcelVO.setNotifyUrl(bean.getNotifyUrl());
- payRefundExcelVO.setStatus(bean.getStatus());
- payRefundExcelVO.setReason(bean.getReason());
- payRefundExcelVO.setUserIp(bean.getUserIp());
- payRefundExcelVO.setChannelOrderNo(bean.getChannelOrderNo());
- payRefundExcelVO.setChannelRefundNo(bean.getChannelRefundNo());
- payRefundExcelVO.setSuccessTime(bean.getSuccessTime());
- payRefundExcelVO.setCreateTime(bean.getCreateTime());
-
- BigDecimal multiple = new BigDecimal(100);
- payRefundExcelVO.setPayPrice(BigDecimal.valueOf(bean.getPayPrice())
- .divide(multiple, 2, RoundingMode.HALF_UP).toString());
- payRefundExcelVO.setRefundPrice(BigDecimal.valueOf(bean.getRefundPrice())
- .divide(multiple, 2, RoundingMode.HALF_UP).toString());
-
- return payRefundExcelVO;
- }
-
PayRefundDO convert(PayRefundCreateReqDTO bean);
PayRefundRespDTO convert02(PayRefundDO bean);
+ default List convertList(List list, Map appMap) {
+ return CollectionUtils.convertList(list, order -> {
+ PayRefundExcelVO excelVO = convertExcel(order);
+ MapUtils.findAndThen(appMap, order.getAppId(), app -> excelVO.setAppName(app.getName()));
+ return excelVO;
+ });
+ }
+ PayRefundExcelVO convertExcel(PayRefundDO bean);
+
}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java
index e9e13ed27..3ad204744 100755
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java
@@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.pay.service.order;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO;
@@ -13,9 +12,7 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
-import java.util.Collection;
import java.util.List;
-import java.util.Map;
/**
* 支付订单 Service 接口
@@ -65,25 +62,6 @@ public interface PayOrderService {
*/
List getOrderList(PayOrderExportReqVO exportReqVO);
- /**
- * 获得支付订单列表
- *
- * @param ids 订单 ID 集合
- * @return 支付订单列表
- */
- List getOrderList(Collection ids);
-
- /**
- * 获得支付订单 Map
- *
- * @param ids 订单 ID 集合
- * @return 支付订单 Map 集合
- */
- default Map getOrderSubjectMap(Collection ids) {
- List list = getOrderList(ids);
- return CollectionUtils.convertMap(list, PayOrderDO::getId);
- }
-
/**
* 创建支付单
*
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
index 41dbf4104..23fc59199 100755
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
@@ -41,7 +41,6 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.time.LocalDateTime;
-import java.util.Collection;
import java.util.List;
import java.util.Objects;
@@ -102,11 +101,6 @@ public class PayOrderServiceImpl implements PayOrderService {
return orderMapper.selectList(exportReqVO);
}
- @Override
- public List getOrderList(Collection ids) {
- return orderMapper.selectBatchIds(ids);
- }
-
@Override
public Long createOrder(PayOrderCreateReqDTO reqDTO) {
// 校验 App
diff --git a/yudao-ui-admin/src/views/pay/order/index.vue b/yudao-ui-admin/src/views/pay/order/index.vue
index fe24d0d45..1ceb52918 100755
--- a/yudao-ui-admin/src/views/pay/order/index.vue
+++ b/yudao-ui-admin/src/views/pay/order/index.vue
@@ -127,7 +127,7 @@
{{ orderDetail.merchantOrderId }}
- {{ orderDetail.no }}
+ {{ orderDetail.no }}
@@ -278,7 +278,6 @@ export default {
this.open = true;
});
},
-
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
diff --git a/yudao-ui-admin/src/views/pay/refund/index.vue b/yudao-ui-admin/src/views/pay/refund/index.vue
index e2ed22384..3ea674531 100755
--- a/yudao-ui-admin/src/views/pay/refund/index.vue
+++ b/yudao-ui-admin/src/views/pay/refund/index.vue
@@ -78,7 +78,7 @@
商户 {{scope.row.merchantRefundId}}
- 支付 {{scope.row.no}}
+ 退款 {{scope.row.no}}
渠道 {{scope.row.channelRefundNo}}
@@ -110,6 +110,11 @@
{{ parseTime(scope.row.successTime) }}
+
+
+ {{ scope.row.appName }}
+
+
-
+
-
- {{ refundDetail.appName }}
- {{ refundDetail.subject }}
-
-
- {{ refundDetail.merchantRefundNo }}
+ {{ refundDetail.merchantRefundId }}
+
+
+ {{ refundDetail.channelRefundNo }}
- {{ refundDetail.merchantOrderId }}
- {{ refundDetail.tradeNo }}
-
+
+
+ {{ refundDetail.merchantOrderId }}
+
+
+ {{ refundDetail.channelOrderNo }}
+
+
+
+ {{ refundDetail.appId }}
+ {{ refundDetail.appName }}
+
- {{ parseFloat(refundDetail.payPrice / 100).toFixed(2) }}
+ ¥{{ (refundDetail.payPrice / 100.0).toFixed(2) }}
-
- {{ parseFloat(refundDetail.refundPrice / 100).toFixed(2) }}
+
+ ¥{{ (refundDetail.refundPrice / 100.0).toFixed(2) }}
+
+
+ {{ parseTime(refundDetail.successTime) }}
+
+
{{ parseTime(refundDetail.createTime) }}
- {{ parseTime(refundDetail.successTime) }}
- {{ parseTime(refundDetail.expireTime) }}
{{ parseTime(refundDetail.updateTime) }}
-
+
+
-
- {{ refundDetail.channelCodeName }}
+
+
-
- {{refundDetail.userIp}}
-
- {{ refundDetail.notifyUrl }}
+ {{ refundDetail.reason }}
+
+ {{ refundDetail.userIp }}
+ {{ refundDetail.notifyUrl }}
+
+
- {{ refundDetail.channelOrderNo }}
- {{ refundDetail.channelRefundNo }}
{{refundDetail.channelErrorCode}}
{{refundDetail.channelErrorMsg}}
-
- {{ refundDetail.channelExtras }}
- {{ refundDetail.reason }}
+
+ {{ refundDetail.channelNotifyData }}
+