diff --git a/.gitignore b/.gitignore index a58be0137..2135c33ab 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,5 @@ nbdist/ !*/build/*.java !*/build/*.html !*/build/*.xml + +yudao-user-server/src/main/resources/application-local.yaml \ No newline at end of file diff --git a/sql/pay-dict.sql b/sql/pay-dict.sql index 3d490fece..4e61b3d6e 100644 --- a/sql/pay-dict.sql +++ b/sql/pay-dict.sql @@ -171,4 +171,21 @@ VALUES (2, '部分退款', '10', 'pay_order_refund_status', 0, '部分退款', ' INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3, '全部退款', '20', 'pay_order_refund_status', 0, '全部退款', '1', '2021-12-03 11:30:52', '1', '2021-12-03 11:34:14', - b'0'); \ No newline at end of file + b'0'); + +-- 退款订单状态 +INSERT INTO `sys_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('退款订单状态', 'pay_refund_order_status', 0, '退款订单状态', '1', '2021-12-10 16:42:50', '1', '2021-12-10 16:42:50', b'0'); +INSERT INTO `sys_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (117, 1, '退款订单生成', '0', 'pay_refund_order_status', 0, '退款订单生成', '1', '2021-12-10 16:44:44', '1', '2021-12-10 16:44:44', b'0'); +INSERT INTO `sys_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (118, 2, '退款成功', '1', 'pay_refund_order_status', 0, '退款成功', '1', '2021-12-10 16:44:59', '1', '2021-12-10 16:44:59', b'0'); +INSERT INTO `sys_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (119, 3, '退款失败', '2', 'pay_refund_order_status', 0, '退款失败', '1', '2021-12-10 16:45:10', '1', '2021-12-10 16:45:10', b'0'); +INSERT INTO `sys_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (120, 4, '退款中, 渠道通知结果', '3', 'pay_refund_order_status', 0, '退款中, 渠道通知结果', '1', '2021-12-10 16:45:32', '1', '2021-12-10 16:45:32', b'0'); +INSERT INTO `sys_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (121, 5, '退款中, 系统查询结果', '4', 'pay_refund_order_status', 0, '退款中, 系统查询结果', '1', '2021-12-10 16:45:48', '1', '2021-12-10 16:45:48', b'0'); +INSERT INTO `sys_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (122, 6, '状态未知,需要重试', '5', 'pay_refund_order_status', 0, '状态未知,需要重试', '1', '2021-12-10 16:46:03', '1', '2021-12-10 16:46:03', b'0'); +INSERT INTO `sys_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (123, 7, '状态未知,系统查询结果', '6', 'pay_refund_order_status', 0, '状态未知,系统查询结果', '1', '2021-12-10 16:46:13', '1', '2021-12-10 16:46:13', b'0'); +INSERT INTO `sys_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (124, 8, '退款关闭', '99', 'pay_refund_order_status', 0, '退款关闭', '1', '2021-12-10 16:46:26', '1', '2021-12-10 16:46:26', b'0'); + +-- 退款订单类别 +INSERT INTO `sys_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('退款订单类别', 'pay_refund_order_type', 0, '退款订单类别', '1', '2021-12-10 17:14:53', '1', '2021-12-10 17:14:53', b'0'); +INSERT INTO `ruoyi-vue-pro`.`sys_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (125, 1, '未退款', '0', 'pay_refund_order_type', 0, '未退款', '1', '2021-12-10 17:15:11', '1', '2021-12-10 17:15:11', b'0'); +INSERT INTO `ruoyi-vue-pro`.`sys_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (126, 2, '部分退款', '10', 'pay_refund_order_type', 0, '部分退款', '1', '2021-12-10 17:15:24', '1', '2021-12-10 17:15:24', b'0'); +INSERT INTO `ruoyi-vue-pro`.`sys_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (127, 3, '全部退款', '20', 'pay_refund_order_type', 0, '全部退款', '1', '2021-12-10 17:15:34', '1', '2021-12-10 17:15:34', b'0'); \ No newline at end of file diff --git a/sql/pay-refund-menu.sql b/sql/pay-refund-menu.sql new file mode 100644 index 000000000..4d1b0bed9 --- /dev/null +++ b/sql/pay-refund-menu.sql @@ -0,0 +1,54 @@ +-- 菜单 SQL +INSERT INTO `sys_menu`( + `name`, `permission`, `menu_type`, `sort`, `parent_id`, + `path`, `icon`, `component`, `status` +) +VALUES ( + '退款订单管理', '', 2, 0, 1117, + 'refund', '', 'pay/refund/index', 0 + ); + +-- 按钮父菜单ID +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +INSERT INTO `sys_menu`( + `name`, `permission`, `menu_type`, `sort`, `parent_id`, + `path`, `icon`, `component`, `status` +) +VALUES ( + '退款订单查询', 'pay:refund:query', 3, 1, @parentId, + '', '', '', 0 + ); +INSERT INTO `sys_menu`( + `name`, `permission`, `menu_type`, `sort`, `parent_id`, + `path`, `icon`, `component`, `status` +) +VALUES ( + '退款订单创建', 'pay:refund:create', 3, 2, @parentId, + '', '', '', 0 + ); +INSERT INTO `sys_menu`( + `name`, `permission`, `menu_type`, `sort`, `parent_id`, + `path`, `icon`, `component`, `status` +) +VALUES ( + '退款订单更新', 'pay:refund:update', 3, 3, @parentId, + '', '', '', 0 + ); +INSERT INTO `sys_menu`( + `name`, `permission`, `menu_type`, `sort`, `parent_id`, + `path`, `icon`, `component`, `status` +) +VALUES ( + '退款订单删除', 'pay:refund:delete', 3, 4, @parentId, + '', '', '', 0 + ); +INSERT INTO `sys_menu`( + `name`, `permission`, `menu_type`, `sort`, `parent_id`, + `path`, `icon`, `component`, `status` +) +VALUES ( + '退款订单导出', 'pay:refund:export', 3, 5, @parentId, + '', '', '', 0 + ); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayOrderController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayOrderController.java index fc0ae16b4..2ac44c66e 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayOrderController.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayOrderController.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.adminserver.modules.pay.controller.order; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.*; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.*; import cn.iocoder.yudao.adminserver.modules.pay.convert.order.PayOrderConvert; import cn.iocoder.yudao.adminserver.modules.pay.service.app.PayAppService; import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService; @@ -33,7 +33,6 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; @@ -102,15 +101,6 @@ public class PayOrderController { return success(respVO); } - @GetMapping("/list") - @ApiOperation("获得支付订单列表") - @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) - @PreAuthorize("@ss.hasPermission('pay:order:query')") - public CommonResult> getOrderList(@RequestParam("ids") Collection ids) { - List list = orderService.getOrderList(ids); - return success(PayOrderConvert.INSTANCE.convertList(list)); - } - @GetMapping("/page") @ApiOperation("获得支付订单分页") @PreAuthorize("@ss.hasPermission('pay:order:query')") diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayRefundController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayRefundController.java new file mode 100755 index 000000000..912d35254 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayRefundController.java @@ -0,0 +1,174 @@ +package cn.iocoder.yudao.adminserver.modules.pay.controller.order; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.*; +import cn.iocoder.yudao.adminserver.modules.pay.convert.refund.PayRefundConvert; +import cn.iocoder.yudao.adminserver.modules.pay.service.app.PayAppService; +import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService; +import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderService; +import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayRefundService; +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; +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.PayChannelEnum; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +/** + * 退款订单 Controller 组件 + * + * @author aquan + */ +@Api(tags = "退款订单") +@RestController +@RequestMapping("/pay/refund") +@Validated +public class PayRefundController { + + @Resource + private PayRefundService refundService; + + /** + * 商户 service 组件 + */ + @Resource + private PayMerchantService merchantService; + + /** + * 应用 service 组件 + */ + @Resource + private PayAppService appService; + + /** + * 订单 service 组件 + */ + @Resource + private PayOrderService orderService; + + + @GetMapping("/get") + @ApiOperation("获得退款订单") + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) + @PreAuthorize("@ss.hasPermission('pay:refund:query')") + public CommonResult getRefund(@RequestParam("id") Long id) { + PayRefundDO refund = refundService.getRefund(id); + if (ObjectUtil.isNull(refund)) { + return success(new PayRefundDetailsRespVO()); + } + + PayMerchantDO merchantDO = merchantService.getMerchant(refund.getMerchantId()); + 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.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户"); + refundDetail.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用"); + refundDetail.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道"); + refundDetail.setSubject(orderDO.getSubject()); + + return success(refundDetail); + } + + @GetMapping("/page") + @ApiOperation("获得退款订单分页") + @PreAuthorize("@ss.hasPermission('pay:refund:query')") + public CommonResult> getRefundPage(@Valid PayRefundPageReqVO pageVO) { + PageResult pageResult = refundService.getRefundPage(pageVO); + if (CollectionUtil.isEmpty(pageResult.getList())) { + return success(new PageResult<>(pageResult.getTotal())); + } + + // 处理商户ID数据 + Map merchantMap = merchantService.getMerchantMap( + CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getMerchantId)); + // 处理应用ID数据 + Map appMap = appService.getAppMap( + CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getAppId)); + List list = new ArrayList<>(pageResult.getList().size()); + pageResult.getList().forEach(c -> { + PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId()); + PayAppDO appDO = appMap.get(c.getAppId()); + PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode()); + + PayRefundPageItemRespVO item = PayRefundConvert.INSTANCE.pageItemConvert(c); + + item.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户"); + item.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用"); + item.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道"); + list.add(item); + }); + + return success(new PageResult<>(list, pageResult.getTotal())); + } + + @GetMapping("/export-excel") + @ApiOperation("导出退款订单 Excel") + @PreAuthorize("@ss.hasPermission('pay:refund:export')") + @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<>()); + } + + // 处理商户ID数据 + Map merchantMap = merchantService.getMerchantMap( + CollectionUtils.convertList(list, PayRefundDO::getMerchantId)); + // 处理应用ID数据 + Map appMap = appService.getAppMap( + CollectionUtils.convertList(list, PayRefundDO::getAppId)); + + List excelDatum = new ArrayList<>(list.size()); + // 处理商品名称数据 + Map orderMap = orderService.getOrderSubjectMap( + CollectionUtils.convertList(list, PayRefundDO::getOrderId)); + + list.forEach(c -> { + PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId()); + PayAppDO appDO = appMap.get(c.getAppId()); + PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode()); + + PayRefundExcelVO excelItem = PayRefundConvert.INSTANCE.excelConvert(c); + excelItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户"); + excelItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用"); + excelItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道"); + excelItem.setSubject(orderMap.get(c.getOrderId()).getSubject()); + + excelDatum.add(excelItem); + }); + + // 导出 Excel + ExcelUtils.write(response, "退款订单.xls", "数据", PayRefundExcelVO.class, excelDatum); + } + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderBaseVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderBaseVO.java similarity index 99% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderBaseVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderBaseVO.java index fb9c7e3db..320125a40 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderBaseVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo; +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderDetailsRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderDetailsRespVO.java similarity index 99% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderDetailsRespVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderDetailsRespVO.java index 0a56ea510..8db4c1dd3 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderDetailsRespVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderDetailsRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo; +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderExcelVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExcelVO.java similarity index 99% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderExcelVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExcelVO.java index e06de94ab..48d69c490 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderExcelVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExcelVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo; +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; import cn.iocoder.yudao.adminserver.modules.system.enums.SysDictTypeConstants; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderExportReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExportReqVO.java similarity index 99% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderExportReqVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExportReqVO.java index ee0cfd326..3445c86b9 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderExportReqVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo; +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderPageItemRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageItemRespVO.java similarity index 98% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderPageItemRespVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageItemRespVO.java index 4ecdb1830..b24b27a47 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderPageItemRespVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageItemRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo; +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderPageReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageReqVO.java similarity index 99% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderPageReqVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageReqVO.java index 9d493f519..07fa6a820 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderPageReqVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo; +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; import cn.iocoder.yudao.framework.common.pojo.PageParam; import io.swagger.annotations.ApiModel; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderRespVO.java similarity index 98% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderRespVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderRespVO.java index 0ad0004c9..c46693635 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/PayOrderRespVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo; +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundBaseVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundBaseVO.java new file mode 100755 index 000000000..87d75d597 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundBaseVO.java @@ -0,0 +1,114 @@ +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +/** +* 退款订单 Base VO,提供给添加、修改、详细的子 VO 使用 +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 +*/ +@Data +public class PayRefundBaseVO { + + @ApiModelProperty(value = "退款单请求号", required = true) + @NotNull(message = "退款单请求号不能为空") + private String reqNo; + + @ApiModelProperty(value = "商户编号", required = true) + @NotNull(message = "商户编号不能为空") + private Long merchantId; + + @ApiModelProperty(value = "应用编号", required = true) + @NotNull(message = "应用编号不能为空") + private Long appId; + + @ApiModelProperty(value = "渠道编号", required = true) + @NotNull(message = "渠道编号不能为空") + private Long channelId; + + @ApiModelProperty(value = "渠道编码", required = true) + @NotNull(message = "渠道编码不能为空") + private String channelCode; + + @ApiModelProperty(value = "支付订单编号 pay_order 表id", required = true) + @NotNull(message = "支付订单编号 pay_order 表id不能为空") + private Long orderId; + + @ApiModelProperty(value = "交易订单号 pay_extension 表no 字段", required = true) + @NotNull(message = "交易订单号 pay_extension 表no 字段不能为空") + private String tradeNo; + + @ApiModelProperty(value = "商户订单编号(商户系统生成)", required = true) + @NotNull(message = "商户订单编号(商户系统生成)不能为空") + private String merchantOrderId; + + @ApiModelProperty(value = "商户退款订单号(商户系统生成)", required = true) + @NotNull(message = "商户退款订单号(商户系统生成)不能为空") + private String merchantRefundNo; + + @ApiModelProperty(value = "异步通知商户地址", required = true) + @NotNull(message = "异步通知商户地址不能为空") + private String notifyUrl; + + @ApiModelProperty(value = "通知商户退款结果的回调状态", required = true) + @NotNull(message = "通知商户退款结果的回调状态不能为空") + private Integer notifyStatus; + + @ApiModelProperty(value = "退款状态", required = true) + @NotNull(message = "退款状态不能为空") + private Integer status; + + @ApiModelProperty(value = "退款类型(部分退款,全部退款)", required = true) + @NotNull(message = "退款类型(部分退款,全部退款)不能为空") + private Integer type; + + @ApiModelProperty(value = "支付金额,单位分", required = true) + @NotNull(message = "支付金额,单位分不能为空") + private Long payAmount; + + @ApiModelProperty(value = "退款金额,单位分", required = true) + @NotNull(message = "退款金额,单位分不能为空") + private Long refundAmount; + + @ApiModelProperty(value = "退款原因", required = true) + @NotNull(message = "退款原因不能为空") + private String reason; + + @ApiModelProperty(value = "用户 IP") + private String userIp; + + @ApiModelProperty(value = "渠道订单号,pay_order 中的channel_order_no 对应", required = true) + @NotNull(message = "渠道订单号,pay_order 中的channel_order_no 对应不能为空") + private String channelOrderNo; + + @ApiModelProperty(value = "渠道退款单号,渠道返回") + private String channelRefundNo; + + @ApiModelProperty(value = "渠道调用报错时,错误码") + private String channelErrorCode; + + @ApiModelProperty(value = "渠道调用报错时,错误信息") + private String channelErrorMsg; + + @ApiModelProperty(value = "支付渠道的额外参数") + private String channelExtras; + + @ApiModelProperty(value = "退款失效时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date expireTime; + + @ApiModelProperty(value = "退款成功时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date successTime; + + @ApiModelProperty(value = "退款通知时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date notifyTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundCreateReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundCreateReqVO.java new file mode 100755 index 000000000..79b05c625 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundCreateReqVO.java @@ -0,0 +1,12 @@ +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; + +import lombok.*; +import io.swagger.annotations.*; + +@ApiModel("退款订单创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PayRefundCreateReqVO extends PayRefundBaseVO { + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundDetailsRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundDetailsRespVO.java new file mode 100755 index 000000000..d1d6739ee --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundDetailsRespVO.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + * 退款订单详情 Response VO + * + * @author aquan + */ +@ApiModel("退款订单详情 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PayRefundDetailsRespVO extends PayRefundBaseVO { + + @ApiModelProperty(value = "支付退款编号", required = true) + private Long id; + + @ApiModelProperty(value = "商户名称") + private String merchantName; + + @ApiModelProperty(value = "应用名称") + private String appName; + + @ApiModelProperty(value = "渠道编号名称") + private String channelCodeName; + + @NotNull(message = "商品标题不能为空") + private String subject; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + private Date updateTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExcelVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExcelVO.java new file mode 100755 index 000000000..edc394a1a --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExcelVO.java @@ -0,0 +1,91 @@ +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; + +import cn.iocoder.yudao.adminserver.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * 退款订单 Excel VO + * + * @author aquan + */ +@Data +public class PayRefundExcelVO { + + @ExcelProperty("支付退款编号") + private Long id; + + @ExcelProperty("商品名称") + private String subject; + + @ExcelProperty("退款单请求号") + private String reqNo; + + @ExcelProperty(value = "商户名称") + private String merchantName; + + @ExcelProperty(value = "应用名称") + private String appName; + + @ExcelProperty(value = "渠道编号名称") + private String channelCodeName; + + @ExcelProperty("交易订单号") + private String tradeNo; + + @ExcelProperty("商户订单编号") + private String merchantOrderId; + + @ExcelProperty("商户退款订单号") + private String merchantRefundNo; + + @ExcelProperty("异步通知商户地址") + private String notifyUrl; + + @DictFormat(SysDictTypeConstants.PAY_ORDER_NOTIFY_STATUS) + @ExcelProperty(value = "商户退款结果回调状态", converter = DictConvert.class) + private Integer notifyStatus; + + @DictFormat(SysDictTypeConstants.PAY_REFUND_ORDER_STATUS) + @ExcelProperty(value = "退款状态", converter = DictConvert.class) + private Integer status; + + @DictFormat(SysDictTypeConstants.PAY_REFUND_ORDER_TYPE) + @ExcelProperty(value = "退款类型", converter = DictConvert.class) + private Integer type; + + @ExcelProperty("支付金额,单位:元") + private String payAmount; + + @ExcelProperty("退款金额,单位:元") + private String refundAmount; + + @ExcelProperty("退款原因") + private String reason; + + @ExcelProperty("用户付款 IP") + private String userIp; + + @ExcelProperty("渠道订单号") + private String channelOrderNo; + + @ExcelProperty("渠道退款单号") + private String channelRefundNo; + + @ExcelProperty("创建时间") + private Date createTime; + + @ExcelProperty("退款成功时间") + private Date successTime; + + @ExcelProperty("退款通知时间") + private Date notifyTime; + + @ExcelProperty("退款失效时间") + private Date expireTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExportReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExportReqVO.java new file mode 100755 index 000000000..4e8cc6f6b --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExportReqVO.java @@ -0,0 +1,114 @@ +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@ApiModel(value = "退款订单 Excel 导出 Request VO", description = "参数和 PayRefundPageReqVO 是一致的") +@Data +public class PayRefundExportReqVO { + + @ApiModelProperty(value = "退款单请求号") + private String reqNo; + + @ApiModelProperty(value = "商户编号") + private Long merchantId; + + @ApiModelProperty(value = "应用编号") + private Long appId; + + @ApiModelProperty(value = "渠道编号") + private Long channelId; + + @ApiModelProperty(value = "渠道编码") + private String channelCode; + + @ApiModelProperty(value = "支付订单编号 pay_order 表id") + private Long orderId; + + @ApiModelProperty(value = "交易订单号 pay_extension 表no 字段") + private String tradeNo; + + @ApiModelProperty(value = "商户订单编号(商户系统生成)") + private String merchantOrderId; + + @ApiModelProperty(value = "商户退款订单号(商户系统生成)") + private String merchantRefundNo; + + @ApiModelProperty(value = "异步通知商户地址") + private String notifyUrl; + + @ApiModelProperty(value = "通知商户退款结果的回调状态") + private Integer notifyStatus; + + @ApiModelProperty(value = "退款状态") + private Integer status; + + @ApiModelProperty(value = "退款类型(部分退款,全部退款)") + private Integer type; + + @ApiModelProperty(value = "支付金额,单位分") + private Long payAmount; + + @ApiModelProperty(value = "退款金额,单位分") + private Long refundAmount; + + @ApiModelProperty(value = "退款原因") + private String reason; + + @ApiModelProperty(value = "用户 IP") + private String userIp; + + @ApiModelProperty(value = "渠道订单号,pay_order 中的channel_order_no 对应") + private String channelOrderNo; + + @ApiModelProperty(value = "渠道退款单号,渠道返回") + private String channelRefundNo; + + @ApiModelProperty(value = "渠道调用报错时,错误码") + private String channelErrorCode; + + @ApiModelProperty(value = "渠道调用报错时,错误信息") + private String channelErrorMsg; + + @ApiModelProperty(value = "支付渠道的额外参数") + private String channelExtras; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始退款失效时间") + private Date beginExpireTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束退款失效时间") + private Date endExpireTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始退款成功时间") + private Date beginSuccessTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束退款成功时间") + private Date endSuccessTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始退款通知时间") + private Date beginNotifyTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束退款通知时间") + private Date endNotifyTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始创建时间") + private Date beginCreateTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束创建时间") + private Date endCreateTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageItemRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageItemRespVO.java new file mode 100755 index 000000000..69e881bce --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageItemRespVO.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.util.Date; + +/** + * 退款订单分页查询 Response VO + * @author aquan + */ +@ApiModel("退款订单分页查询 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PayRefundPageItemRespVO extends PayRefundBaseVO { + + @ApiModelProperty(value = "支付订单编号", required = true) + private Long id; + + @ApiModelProperty(value = "商户名称") + private String merchantName; + + @ApiModelProperty(value = "应用名称") + private String appName; + + @ApiModelProperty(value = "渠道名称") + private String channelCodeName; + + @ApiModelProperty(value = "创建时间", required = true) + private Date createTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageReqVO.java new file mode 100755 index 000000000..eddfddfee --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageReqVO.java @@ -0,0 +1,119 @@ +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@ApiModel("退款订单分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PayRefundPageReqVO extends PageParam { + + @ApiModelProperty(value = "退款单请求号") + private String reqNo; + + @ApiModelProperty(value = "商户编号") + private Long merchantId; + + @ApiModelProperty(value = "应用编号") + private Long appId; + + @ApiModelProperty(value = "渠道编号") + private Long channelId; + + @ApiModelProperty(value = "渠道编码") + private String channelCode; + + @ApiModelProperty(value = "支付订单编号 pay_order 表id") + private Long orderId; + + @ApiModelProperty(value = "交易订单号 pay_extension 表no 字段") + private String tradeNo; + + @ApiModelProperty(value = "商户订单编号(商户系统生成)") + private String merchantOrderId; + + @ApiModelProperty(value = "商户退款订单号(商户系统生成)") + private String merchantRefundNo; + + @ApiModelProperty(value = "异步通知商户地址") + private String notifyUrl; + + @ApiModelProperty(value = "通知商户退款结果的回调状态") + private Integer notifyStatus; + + @ApiModelProperty(value = "退款状态") + private Integer status; + + @ApiModelProperty(value = "退款类型(部分退款,全部退款)") + private Integer type; + + @ApiModelProperty(value = "支付金额,单位分") + private Long payAmount; + + @ApiModelProperty(value = "退款金额,单位分") + private Long refundAmount; + + @ApiModelProperty(value = "退款原因") + private String reason; + + @ApiModelProperty(value = "用户 IP") + private String userIp; + + @ApiModelProperty(value = "渠道订单号,pay_order 中的channel_order_no 对应") + private String channelOrderNo; + + @ApiModelProperty(value = "渠道退款单号,渠道返回") + private String channelRefundNo; + + @ApiModelProperty(value = "渠道调用报错时,错误码") + private String channelErrorCode; + + @ApiModelProperty(value = "渠道调用报错时,错误信息") + private String channelErrorMsg; + + @ApiModelProperty(value = "支付渠道的额外参数") + private String channelExtras; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始退款失效时间") + private Date beginExpireTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束退款失效时间") + private Date endExpireTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始退款成功时间") + private Date beginSuccessTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束退款成功时间") + private Date endSuccessTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始退款通知时间") + private Date beginNotifyTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束退款通知时间") + private Date endNotifyTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始创建时间") + private Date beginCreateTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束创建时间") + private Date endCreateTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundRespVO.java new file mode 100755 index 000000000..901a0fe85 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundRespVO.java @@ -0,0 +1,23 @@ +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.util.Date; + +@ApiModel("退款订单 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PayRefundRespVO extends PayRefundBaseVO { + + @ApiModelProperty(value = "支付退款编号", required = true) + private Long id; + + @ApiModelProperty(value = "创建时间", required = true) + private Date createTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundUpdateReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundUpdateReqVO.java new file mode 100755 index 000000000..8cb2dcf67 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundUpdateReqVO.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; + +import lombok.*; +import io.swagger.annotations.*; +import javax.validation.constraints.*; + +@ApiModel("退款订单更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PayRefundUpdateReqVO extends PayRefundBaseVO { + + @ApiModelProperty(value = "支付退款编号", required = true) + @NotNull(message = "支付退款编号不能为空") + private Long id; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/order/PayOrderConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/order/PayOrderConvert.java index 08d0e73f1..7af6201a5 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/order/PayOrderConvert.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/order/PayOrderConvert.java @@ -1,6 +1,9 @@ package cn.iocoder.yudao.adminserver.modules.pay.convert.order; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.*; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderDetailsRespVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderExcelVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderPageItemRespVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderRespVO; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/refund/PayRefundConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/refund/PayRefundConvert.java new file mode 100755 index 000000000..fe4d2a44d --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/refund/PayRefundConvert.java @@ -0,0 +1,91 @@ +package cn.iocoder.yudao.adminserver.modules.pay.convert.refund; + +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.*; +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.List; + +/** + * 退款订单 Convert + * + * @author aquan + */ +@Mapper +public interface PayRefundConvert { + + PayRefundConvert INSTANCE = Mappers.getMapper(PayRefundConvert.class); + + PayRefundDO convert(PayRefundCreateReqVO bean); + + PayRefundDO convert(PayRefundUpdateReqVO 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); + + List convertList02(List list); + + /** + * 退款订单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.setReqNo(bean.getReqNo()); + payRefundExcelVO.setTradeNo(bean.getTradeNo()); + payRefundExcelVO.setMerchantOrderId(bean.getMerchantOrderId()); + payRefundExcelVO.setMerchantRefundNo(bean.getMerchantRefundNo()); + payRefundExcelVO.setNotifyUrl(bean.getNotifyUrl()); + payRefundExcelVO.setNotifyStatus(bean.getNotifyStatus()); + payRefundExcelVO.setStatus(bean.getStatus()); + payRefundExcelVO.setType(bean.getType()); + payRefundExcelVO.setReason(bean.getReason()); + payRefundExcelVO.setUserIp(bean.getUserIp()); + payRefundExcelVO.setChannelOrderNo(bean.getChannelOrderNo()); + payRefundExcelVO.setChannelRefundNo(bean.getChannelRefundNo()); + payRefundExcelVO.setExpireTime(bean.getExpireTime()); + payRefundExcelVO.setSuccessTime(bean.getSuccessTime()); + payRefundExcelVO.setNotifyTime(bean.getNotifyTime()); + payRefundExcelVO.setCreateTime(bean.getCreateTime()); + + BigDecimal multiple = new BigDecimal(100); + payRefundExcelVO.setPayAmount(BigDecimal.valueOf(bean.getPayAmount()) + .divide(multiple, 2, RoundingMode.HALF_UP).toString()); + payRefundExcelVO.setRefundAmount(BigDecimal.valueOf(bean.getRefundAmount()) + .divide(multiple, 2, RoundingMode.HALF_UP).toString()); + + return payRefundExcelVO; + } + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayOrderMapper.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayOrderMapper.java index cb7c6ae0d..39fc71287 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayOrderMapper.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayOrderMapper.java @@ -1,20 +1,21 @@ package cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderPageReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderExportReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderPageReqVO; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; 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.QueryWrapperX; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.apache.ibatis.annotations.Mapper; +import java.util.Collection; import java.util.List; /** - * 支付订单 - * Mapper + * 支付订单 Mapper 组件 * - * @author 芋艿 + * @author aquan */ @Mapper public interface PayOrderMapper extends BaseMapperX { @@ -49,4 +50,16 @@ public interface PayOrderMapper extends BaseMapperX { .orderByDesc("id")); } + /** + * 根据订单 ID 集合查询订单商品名称 + * + * @param idList 订单 ID 集合 + * @return 只包含商品名称和标题的订单集合对象 + */ + default List findByIdListQueryOrderSubject(Collection idList) { + return selectList(new LambdaQueryWrapper() + .select(PayOrderDO::getId, PayOrderDO::getSubject) + .in(PayOrderDO::getId, idList)); + } + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayRefundMapper.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayRefundMapper.java new file mode 100755 index 000000000..c5f9c632b --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayRefundMapper.java @@ -0,0 +1,49 @@ +package cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order; + +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundExportReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundPageReqVO; +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; +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.QueryWrapperX; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 退款订单 Mapper + * + * @author aquan + */ +@Mapper +public interface PayRefundMapper extends BaseMapperX { + + default PageResult selectPage(PayRefundPageReqVO reqVO) { + return selectPage(reqVO, new QueryWrapperX() + .likeIfPresent("req_no", reqVO.getReqNo()) + .eqIfPresent("merchant_id", reqVO.getMerchantId()) + .eqIfPresent("app_id", reqVO.getAppId()) + .eqIfPresent("channel_code", reqVO.getChannelCode()) + .likeIfPresent("merchant_refund_no", reqVO.getMerchantRefundNo()) + .eqIfPresent("type", reqVO.getType()) + .eqIfPresent("status", reqVO.getStatus()) + .eqIfPresent("notify_status", reqVO.getNotifyStatus()) + .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc("id")); + } + + default List selectList(PayRefundExportReqVO reqVO) { + return selectList(new QueryWrapperX() + .eqIfPresent("merchant_id", reqVO.getMerchantId()) + .eqIfPresent("app_id", reqVO.getAppId()) + .eqIfPresent("channel_code", reqVO.getChannelCode()) + .likeIfPresent("req_no", reqVO.getReqNo()) + .likeIfPresent("merchant_refund_no", reqVO.getMerchantRefundNo()) + .eqIfPresent("type", reqVO.getType()) + .eqIfPresent("status", reqVO.getStatus()) + .eqIfPresent("notify_status", reqVO.getNotifyStatus()) + .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc("id")); + } + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderService.java index 6ea6b4793..56981bc4f 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderService.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderService.java @@ -1,12 +1,14 @@ package cn.iocoder.yudao.adminserver.modules.pay.service.order; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderPageReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderExportReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderPageReqVO; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import java.util.Collection; import java.util.List; +import java.util.Map; /** * 支付订单 @@ -24,16 +26,6 @@ public interface PayOrderService { */ PayOrderDO getOrder(Long id); - /** - * 获得支付订单 - * 列表 - * - * @param ids 编号 - * @return 支付订单 - * 列表 - */ - List getOrderList(Collection ids); - /** * 获得支付订单 * 分页 @@ -54,4 +46,23 @@ public interface PayOrderService { */ List getOrderList(PayOrderExportReqVO exportReqVO); + /** + * 根据 ID 集合获取只包含商品名称的订单集合 + * + * @param idList 订单 ID 集合 + * @return 只包含商品名称的订单集合 + */ + List getOrderSubjectList(Collection idList); + + /** + * 根据订单 ID 集合获取订单商品名称Map集合 + * + * @param idList 订单 ID 集合 + * @return 订单商品 map 集合 + */ + default Map getOrderSubjectMap(Collection idList) { + List list = getOrderSubjectList(idList); + return CollectionUtils.convertMap(list, PayOrderDO::getId); + } + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayRefundService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayRefundService.java new file mode 100755 index 000000000..1412bdefe --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayRefundService.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.adminserver.modules.pay.service.order; + +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundExportReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundPageReqVO; +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import java.util.List; + +/** + * 退款订单 Service 接口 + * + * @author aquan + */ +public interface PayRefundService { + + /** + * 获得退款订单 + * + * @param id 编号 + * @return 退款订单 + */ + PayRefundDO getRefund(Long id); + + /** + * 获得退款订单分页 + * + * @param pageReqVO 分页查询 + * @return 退款订单分页 + */ + PageResult getRefundPage(PayRefundPageReqVO pageReqVO); + + /** + * 获得退款订单列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 退款订单列表 + */ + List getRefundList(PayRefundExportReqVO exportReqVO); + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayOrderServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayOrderServiceImpl.java index dd914e109..dd6d0a8bd 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayOrderServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayOrderServiceImpl.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.adminserver.modules.pay.service.order.impl; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderPageReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderExportReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderPageReqVO; import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayOrderMapper; import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderService; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; @@ -30,11 +30,6 @@ public class PayOrderServiceImpl implements PayOrderService { return orderMapper.selectById(id); } - @Override - public List getOrderList(Collection ids) { - return orderMapper.selectBatchIds(ids); - } - @Override public PageResult getOrderPage(PayOrderPageReqVO pageReqVO) { return orderMapper.selectPage(pageReqVO); @@ -45,4 +40,15 @@ public class PayOrderServiceImpl implements PayOrderService { return orderMapper.selectList(exportReqVO); } + /** + * 根据 ID 集合获取只包含商品名称的订单集合 + * + * @param idList 订单 ID 集合 + * @return 只包含商品名称的订单集合 + */ + @Override + public List getOrderSubjectList(Collection idList) { + return orderMapper.findByIdListQueryOrderSubject(idList); + } + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayRefundServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayRefundServiceImpl.java new file mode 100755 index 000000000..00f42ebcd --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayRefundServiceImpl.java @@ -0,0 +1,42 @@ +package cn.iocoder.yudao.adminserver.modules.pay.service.order.impl; + +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundExportReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundPageReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayRefundMapper; +import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayRefundService; +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 退款订单 Service 实现类 + * + * @author aquan + */ +@Service +@Validated +public class PayRefundServiceImpl implements PayRefundService { + + @Resource + private PayRefundMapper refundMapper; + + @Override + public PayRefundDO getRefund(Long id) { + return refundMapper.selectById(id); + } + + @Override + public PageResult getRefundPage(PayRefundPageReqVO pageReqVO) { + return refundMapper.selectPage(pageReqVO); + } + + @Override + public List getRefundList(PayRefundExportReqVO exportReqVO) { + return refundMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/enums/SysDictTypeConstants.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/enums/SysDictTypeConstants.java index 357f966d9..9d6aefa08 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/enums/SysDictTypeConstants.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/enums/SysDictTypeConstants.java @@ -37,4 +37,14 @@ public interface SysDictTypeConstants { */ String PAY_ORDER_REFUND_STATUS = "pay_order_refund_status"; + /** + * 支付-退款订单-退款状态 + */ + String PAY_REFUND_ORDER_STATUS = "pay_refund_order_status"; + + /** + * 支付-退款订单-退款类别 + */ + String PAY_REFUND_ORDER_TYPE = "pay_refund_order_type"; + } diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderServiceTest.java b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderServiceTest.java index 21cbdc584..b3250248f 100755 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderServiceTest.java +++ b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderServiceTest.java @@ -3,8 +3,8 @@ package cn.iocoder.yudao.adminserver.modules.pay.service.order; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.RandomUtil; import cn.iocoder.yudao.adminserver.BaseDbUnitTest; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderPageReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderExportReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderPageReqVO; import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayOrderMapper; import cn.iocoder.yudao.adminserver.modules.pay.service.order.impl.PayOrderServiceImpl; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; @@ -44,7 +44,7 @@ public class PayOrderServiceTest extends BaseDbUnitTest { return DateUtil.format(new Date(), "yyyyMMddHHmmss") + RandomUtil.randomInt(100000, 999999); } - @Test // TODO 请修改 null 为需要的值 + @Test public void testGetOrderPage() { String merchantOrderId = generateNo(); @@ -120,7 +120,7 @@ public class PayOrderServiceTest extends BaseDbUnitTest { // assertEquals(0, dbOrder.getUpdateTime().compareTo(pageResult.getList().get(0).getUpdateTime())); } - @Test // TODO 请修改 null 为需要的值 + @Test public void testGetOrderList() { // mock 数据 String merchantOrderId = generateNo(); diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/refund/PayRefundServiceTest.java b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/refund/PayRefundServiceTest.java new file mode 100755 index 000000000..29035a3bc --- /dev/null +++ b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/refund/PayRefundServiceTest.java @@ -0,0 +1,190 @@ +package cn.iocoder.yudao.adminserver.modules.pay.service.refund; + +import cn.iocoder.yudao.adminserver.BaseDbUnitTest; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundExportReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundPageReqVO; +import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayRefundMapper; +import cn.iocoder.yudao.adminserver.modules.pay.service.order.impl.PayRefundServiceImpl; +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; +import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderNotifyStatusEnum; +import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundStatusEnum; +import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundTypeEnum; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.date.DateUtils; +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; +import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Import; + +import javax.annotation.Resource; +import java.util.List; + +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * {@link PayRefundServiceImpl} 的单元测试类 + * + * @author aquan + */ +@Import(PayRefundServiceImpl.class) +public class PayRefundServiceTest extends BaseDbUnitTest { + + @Resource + private PayRefundServiceImpl refundService; + + @Resource + private PayRefundMapper refundMapper; + + + @Test + public void testGetRefundPage() { + // mock 数据 + PayRefundDO dbRefund = randomPojo(PayRefundDO.class, o -> { // 等会查询到 + o.setReqNo("RF0000001"); + o.setMerchantId(1L); + o.setAppId(1L); + o.setChannelId(1L); + o.setChannelCode(PayChannelEnum.WX_PUB.getCode()); + o.setOrderId(1L); + o.setTradeNo("OT0000001"); + o.setMerchantOrderId("MOT0000001"); + o.setMerchantRefundNo("MRF0000001"); + o.setNotifyUrl("https://www.cancanzi.com"); + o.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus()); + o.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()); + o.setType(PayRefundTypeEnum.SOME.getStatus()); + o.setPayAmount(100L); + o.setRefundAmount(500L); + o.setReason("就是想退款了,你有意见吗"); + o.setUserIp("127.0.0.1"); + o.setChannelOrderNo("CH0000001"); + o.setChannelRefundNo("CHR0000001"); + o.setChannelErrorCode(""); + o.setChannelErrorMsg(""); + o.setChannelExtras(""); + o.setExpireTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 30)); + o.setSuccessTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 15)); + o.setNotifyTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 20)); + o.setCreateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 10)); + o.setUpdateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 35)); + }); + refundMapper.insert(dbRefund); + // 测试 reqNo 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setReqNo("RF1111112"))); + // 测试 merchantId 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setMerchantId(2L))); + // 测试 appId 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setAppId(2L))); + // 测试 channelCode 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setChannelCode(PayChannelEnum.ALIPAY_APP.getCode()))); + // 测试 merchantRefundNo 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setMerchantRefundNo("MRF1111112"))); + // 测试 notifyStatus 不匹配 + refundMapper.insert( + ObjectUtils.clone(dbRefund, o -> o.setNotifyStatus(PayOrderNotifyStatusEnum.FAILURE.getStatus()))); + // 测试 status 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setStatus(PayRefundStatusEnum.CLOSE.getStatus()))); + // 测试 type 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setType(PayRefundTypeEnum.ALL.getStatus()))); + // 测试 createTime 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> + o.setCreateTime(DateUtils.buildTime(2022, 1, 1, 10, 10, 10)))); + // 准备参数 + PayRefundPageReqVO reqVO = new PayRefundPageReqVO(); + reqVO.setReqNo("RF0000001"); + reqVO.setMerchantId(1L); + reqVO.setAppId(1L); + reqVO.setChannelCode(PayChannelEnum.WX_PUB.getCode()); + reqVO.setMerchantRefundNo("MRF0000001"); + reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus()); + reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()); + reqVO.setType(PayRefundTypeEnum.SOME.getStatus()); + reqVO.setBeginCreateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 10)); + reqVO.setEndCreateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 12)); + + + // 调用 + PageResult pageResult = refundService.getRefundPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbRefund, pageResult.getList().get(0)); + } + + @Test + public void testGetRefundList() { + // mock 数据 + PayRefundDO dbRefund = randomPojo(PayRefundDO.class, o -> { // 等会查询到 + o.setReqNo("RF0000001"); + o.setMerchantId(1L); + o.setAppId(1L); + o.setChannelId(1L); + o.setChannelCode(PayChannelEnum.WX_PUB.getCode()); + o.setOrderId(1L); + o.setTradeNo("OT0000001"); + o.setMerchantOrderId("MOT0000001"); + o.setMerchantRefundNo("MRF0000001"); + o.setNotifyUrl("https://www.cancanzi.com"); + o.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus()); + o.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()); + o.setType(PayRefundTypeEnum.SOME.getStatus()); + o.setPayAmount(100L); + o.setRefundAmount(500L); + o.setReason("就是想退款了,你有意见吗"); + o.setUserIp("127.0.0.1"); + o.setChannelOrderNo("CH0000001"); + o.setChannelRefundNo("CHR0000001"); + o.setChannelErrorCode(""); + o.setChannelErrorMsg(""); + o.setChannelExtras(""); + o.setExpireTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 30)); + o.setSuccessTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 15)); + o.setNotifyTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 20)); + o.setCreateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 10)); + o.setUpdateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 35)); + }); + refundMapper.insert(dbRefund); + // 测试 reqNo 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setReqNo("RF1111112"))); + // 测试 merchantId 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setMerchantId(2L))); + // 测试 appId 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setAppId(2L))); + // 测试 channelCode 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setChannelCode(PayChannelEnum.ALIPAY_APP.getCode()))); + // 测试 merchantRefundNo 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setMerchantRefundNo("MRF1111112"))); + // 测试 notifyStatus 不匹配 + refundMapper.insert( + ObjectUtils.clone(dbRefund, o -> o.setNotifyStatus(PayOrderNotifyStatusEnum.FAILURE.getStatus()))); + // 测试 status 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setStatus(PayRefundStatusEnum.CLOSE.getStatus()))); + // 测试 type 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> o.setType(PayRefundTypeEnum.ALL.getStatus()))); + // 测试 createTime 不匹配 + refundMapper.insert(ObjectUtils.clone(dbRefund, o -> + o.setCreateTime(DateUtils.buildTime(2022, 1, 1, 10, 10, 10)))); + + // 准备参数 + PayRefundExportReqVO reqVO = new PayRefundExportReqVO(); + reqVO.setReqNo("RF0000001"); + reqVO.setMerchantId(1L); + reqVO.setAppId(1L); + reqVO.setChannelCode(PayChannelEnum.WX_PUB.getCode()); + reqVO.setMerchantRefundNo("MRF0000001"); + reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus()); + reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()); + reqVO.setType(PayRefundTypeEnum.SOME.getStatus()); + reqVO.setBeginCreateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 10)); + reqVO.setEndCreateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 12)); + + // 调用 + List list = refundService.getRefundList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbRefund, list.get(0)); + } + +} diff --git a/yudao-admin-server/src/test/resources/sql/clean.sql b/yudao-admin-server/src/test/resources/sql/clean.sql index f6d6f8a2d..dc76a59e1 100644 --- a/yudao-admin-server/src/test/resources/sql/clean.sql +++ b/yudao-admin-server/src/test/resources/sql/clean.sql @@ -29,4 +29,5 @@ DELETE FROM "sys_social_user"; DELETE FROM pay_merchant; DELETE FROM pay_app; DELETE FROM pay_channel; -delete from pay_order; +DELETE FROM pay_order; +DELETE FROM pay_refund; \ No newline at end of file diff --git a/yudao-admin-server/src/test/resources/sql/create_tables.sql b/yudao-admin-server/src/test/resources/sql/create_tables.sql index b74a015eb..8c5e1ff27 100644 --- a/yudao-admin-server/src/test/resources/sql/create_tables.sql +++ b/yudao-admin-server/src/test/resources/sql/create_tables.sql @@ -553,12 +553,47 @@ CREATE TABLE `pay_order` `channel_order_no` varchar(64) DEFAULT NULL, `creator` varchar(64) DEFAULT '', `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updater` varchar(64) DEFAULT '' , + `updater` varchar(64) DEFAULT '', `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted` bit(1) NOT NULL DEFAULT FALSE, + `deleted` bit(1) NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") ) COMMENT = '支付订单'; +CREATE TABLE `pay_refund` +( + "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, + `req_no` varchar(64) NOT NULL, + `merchant_id` bigint(20) NOT NULL, + `app_id` bigint(20) NOT NULL, + `channel_id` bigint(20) NOT NULL, + `channel_code` varchar(32) NOT NULL, + `order_id` bigint(20) NOT NULL, + `trade_no` varchar(64) NOT NULL, + `merchant_order_id` varchar(64) NOT NULL, + `merchant_refund_no` varchar(64) NOT NULL, + `notify_url` varchar(1024) NOT NULL, + `notify_status` tinyint(4) NOT NULL, + `status` tinyint(4) NOT NULL, + `type` tinyint(4) NOT NULL, + `pay_amount` bigint(20) NOT NULL, + `refund_amount` bigint(20) NOT NULL, + `reason` varchar(256) NOT NULL, + `user_ip` varchar(50) NULL DEFAULT NULL, + `channel_order_no` varchar(64) NOT NULL, + `channel_refund_no` varchar(64) NULL DEFAULT NULL, + `channel_error_code` varchar(128) NULL DEFAULT NULL, + `channel_error_msg` varchar(256) NULL DEFAULT NULL, + `channel_extras` varchar(1024) NULL DEFAULT NULL, + `expire_time` datetime(0) NULL DEFAULT NULL, + `success_time` datetime(0) NULL DEFAULT NULL, + `notify_time` datetime(0) NULL DEFAULT NULL, + `creator` varchar(64) NULL DEFAULT '', + `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updater` varchar(64) NULL DEFAULT '', + `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted` bit(1) NOT NULL DEFAULT FALSE, + PRIMARY KEY ("id") +) COMMENT = '退款订单'; diff --git a/yudao-admin-ui/src/api/pay/refund.js b/yudao-admin-ui/src/api/pay/refund.js new file mode 100755 index 000000000..09b64d5e0 --- /dev/null +++ b/yudao-admin-ui/src/api/pay/refund.js @@ -0,0 +1,54 @@ +import request from '@/utils/request' + +// 创建退款订单 +export function createRefund(data) { + return request({ + url: '/pay/refund/create', + method: 'post', + data: data + }) +} + +// 更新退款订单 +export function updateRefund(data) { + return request({ + url: '/pay/refund/update', + method: 'put', + data: data + }) +} + +// 删除退款订单 +export function deleteRefund(id) { + return request({ + url: '/pay/refund/delete?id=' + id, + method: 'delete' + }) +} + +// 获得退款订单 +export function getRefund(id) { + return request({ + url: '/pay/refund/get?id=' + id, + method: 'get' + }) +} + +// 获得退款订单分页 +export function getRefundPage(query) { + return request({ + url: '/pay/refund/page', + method: 'get', + params: query + }) +} + +// 导出退款订单 Excel +export function exportRefundExcel(query) { + return request({ + url: '/pay/refund/export-excel', + method: 'get', + params: query, + responseType: 'blob' + }) +} diff --git a/yudao-admin-ui/src/utils/constants.js b/yudao-admin-ui/src/utils/constants.js index 80411ea13..87ca6e8cc 100644 --- a/yudao-admin-ui/src/utils/constants.js +++ b/yudao-admin-ui/src/utils/constants.js @@ -187,3 +187,41 @@ export const payOrderRefundStatusEnum = { } } +/** + * 支付退款订单状态枚举 + */ +export const payRefundStatusEnum = { + CREATE:{ + status:0, + name: '退款订单生成' + }, + SUCCESS:{ + status:1, + name: '退款成功' + }, + FAILURE:{ + status:2, + name: '退款失败' + }, + PROCESSING_NOTIFY:{ + status:3, + name: '退款中,渠道通知结果' + }, + PROCESSING_QUERY:{ + status:4, + name: '退款中,系统查询结果' + }, + UNKNOWN_RETRY:{ + status:5, + name: '状态未知,请重试' + }, + UNKNOWN_QUERY:{ + status:6, + name: '状态未知,系统查询结果' + }, + CLOSE:{ + status:99, + name: '退款关闭' + } +} + diff --git a/yudao-admin-ui/src/utils/dict.js b/yudao-admin-ui/src/utils/dict.js index 1e00c1167..1fa48fc05 100644 --- a/yudao-admin-ui/src/utils/dict.js +++ b/yudao-admin-ui/src/utils/dict.js @@ -53,6 +53,10 @@ export const DICT_TYPE = { PAY_ORDER_STATUS: 'pay_order_status', // 商户支付订单退款状态 PAY_ORDER_REFUND_STATUS: 'pay_order_refund_status', + // 退款订单状态 + PAY_REFUND_ORDER_STATUS: 'pay_refund_order_status', + // 退款订单类别 + PAY_REFUND_ORDER_TYPE: 'pay_refund_order_type', } /** diff --git a/yudao-admin-ui/src/views/pay/order/index.vue b/yudao-admin-ui/src/views/pay/order/index.vue index 9d7fd23e7..25dfd6e13 100755 --- a/yudao-admin-ui/src/views/pay/order/index.vue +++ b/yudao-admin-ui/src/views/pay/order/index.vue @@ -95,11 +95,28 @@ - - - - - + + + + + + + + + + - - - + + + + + - - + @@ -385,7 +395,6 @@ export default { /** 取消按钮 */ cancel() { this.open = false; - this.reset(); }, /** 搜索按钮操作 */ handleQuery() { @@ -458,7 +467,7 @@ export default { this.addBeginAndEndTime(params, this.dateRangeExpireTime, 'expireTime'); this.addBeginAndEndTime(params, this.dateRangeSuccessTime, 'successTime'); this.addBeginAndEndTime(params, this.dateRangeNotifyTime, 'notifyTime'); - this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); + this.addDateRange(params, this.dateRangeCreateTime, 'CreateTime'); // 执行导出 this.$confirm('是否确认导出所有支付订单数据项?', "警告", { confirmButtonText: "确定", @@ -515,4 +524,9 @@ export default { background: #fff0f6; border-color: #ffadd2; } + +.order-font{ + font-size: 12px; + padding: 2px 0; +} diff --git a/yudao-admin-ui/src/views/pay/refund/index.vue b/yudao-admin-ui/src/views/pay/refund/index.vue new file mode 100755 index 000000000..7289a0703 --- /dev/null +++ b/yudao-admin-ui/src/views/pay/refund/index.vue @@ -0,0 +1,550 @@ + + + + diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayRefundMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayRefundCoreMapper.java similarity index 85% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayRefundMapper.java rename to yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayRefundCoreMapper.java index 150372837..dba8dd86b 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayRefundMapper.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayRefundCoreMapper.java @@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Mapper; * */ @Mapper -public interface PayRefundMapper extends BaseMapperX { +public interface PayRefundCoreMapper extends BaseMapperX { default PayRefundDO selectByReqNo(String reqNo) { return selectOne("req_no", reqNo); diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/impl/PayNotifyCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/impl/PayNotifyCoreServiceImpl.java index 15857e35b..dff6de7fc 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/impl/PayNotifyCoreServiceImpl.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/impl/PayNotifyCoreServiceImpl.java @@ -8,7 +8,7 @@ import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.notify.PayNotifyLogCoreMapper; import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.notify.PayNotifyTaskCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundMapper; +import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundCoreMapper; import cn.iocoder.yudao.coreservice.modules.pay.dal.redis.notify.PayNotifyLockCoreRedisDAO; import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyStatusEnum; import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyTypeEnum; @@ -75,7 +75,7 @@ public class PayNotifyCoreServiceImpl implements PayNotifyCoreService { private PayNotifyLockCoreRedisDAO payNotifyLockCoreRedisDAO; @Resource - private PayRefundMapper payRefundMapper; + private PayRefundCoreMapper payRefundCoreMapper; @Resource @Lazy // 循环依赖(自己依赖自己),避免报错 @@ -94,7 +94,7 @@ public class PayNotifyCoreServiceImpl implements PayNotifyCoreService { setMerchantOrderId(order.getMerchantOrderId()).setNotifyUrl(order.getNotifyUrl()); } else if (Objects.equals(task.getType(), PayNotifyTypeEnum.REFUND.getType())) { // TODO 芋艿,需要实现下哈 - PayRefundDO refundDO = payRefundMapper.selectById(task.getDataId()); + PayRefundDO refundDO = payRefundCoreMapper.selectById(task.getDataId()); task.setMerchantId(refundDO.getMerchantId()).setAppId(refundDO.getAppId()) .setMerchantOrderId(refundDO.getMerchantOrderId()).setNotifyUrl(refundDO.getNotifyUrl()); } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/PayRefundAbstractChannelPostHandler.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/PayRefundAbstractChannelPostHandler.java index db27bcadc..47ded02b0 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/PayRefundAbstractChannelPostHandler.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/PayRefundAbstractChannelPostHandler.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.coreservice.modules.pay.service.order; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundMapper; +import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundCoreMapper; /** * 支付退款订单渠道返回后 , 后置处理抽象类, 处理公用的逻辑 @@ -12,10 +12,10 @@ import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundMapper; public abstract class PayRefundAbstractChannelPostHandler implements PayRefundChannelPostHandler { private final PayOrderCoreMapper payOrderCoreMapper; - private final PayRefundMapper payRefundMapper; + private final PayRefundCoreMapper payRefundMapper; public PayRefundAbstractChannelPostHandler(PayOrderCoreMapper payOrderCoreMapper, - PayRefundMapper payRefundMapper){ + PayRefundCoreMapper payRefundMapper){ this.payOrderCoreMapper = payOrderCoreMapper; this.payRefundMapper = payRefundMapper; } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelFailedHandler.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelFailedHandler.java index 4447f4930..86110e76b 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelFailedHandler.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelFailedHandler.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.coreservice.modules.pay.service.order.impl; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundMapper; +import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundCoreMapper; import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyTypeEnum; import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundStatusEnum; import cn.iocoder.yudao.coreservice.modules.pay.service.notify.PayNotifyCoreService; @@ -27,7 +27,7 @@ public class PayRefundChannelFailedHandler extends PayRefundAbstractChannelPostH @Resource private PayNotifyCoreService payNotifyCoreService; - public PayRefundChannelFailedHandler(PayOrderCoreMapper payOrderCoreMapper, PayRefundMapper payRefundMapper) { + public PayRefundChannelFailedHandler(PayOrderCoreMapper payOrderCoreMapper, PayRefundCoreMapper payRefundMapper) { super(payOrderCoreMapper, payRefundMapper); } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelNotifyHandler.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelNotifyHandler.java index 3cced50f4..6b994defd 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelNotifyHandler.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelNotifyHandler.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.coreservice.modules.pay.service.order.impl; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundMapper; +import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundCoreMapper; import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundStatusEnum; import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayRefundAbstractChannelPostHandler; import cn.iocoder.yudao.coreservice.modules.pay.service.order.bo.PayRefundPostReqBO; @@ -18,7 +18,7 @@ import org.springframework.stereotype.Service; public class PayRefundChannelNotifyHandler extends PayRefundAbstractChannelPostHandler { public PayRefundChannelNotifyHandler(PayOrderCoreMapper payOrderCoreMapper, - PayRefundMapper payRefundMapper) { + PayRefundCoreMapper payRefundMapper) { super(payOrderCoreMapper, payRefundMapper); } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelQueryHandler.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelQueryHandler.java index b64c20003..6464341b3 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelQueryHandler.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelQueryHandler.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.coreservice.modules.pay.service.order.impl; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundMapper; +import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundCoreMapper; import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundStatusEnum; import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayRefundAbstractChannelPostHandler; import cn.iocoder.yudao.coreservice.modules.pay.service.order.bo.PayRefundPostReqBO; @@ -22,7 +22,7 @@ public class PayRefundChannelQueryHandler extends PayRefundAbstractChannelPostHa public PayRefundChannelQueryHandler(PayOrderCoreMapper payOrderCoreMapper, - PayRefundMapper payRefundMapper) { + PayRefundCoreMapper payRefundMapper) { super(payOrderCoreMapper, payRefundMapper); } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelRetryHandler.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelRetryHandler.java index e6ee5967e..874dc659e 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelRetryHandler.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelRetryHandler.java @@ -3,15 +3,13 @@ package cn.iocoder.yudao.coreservice.modules.pay.service.order.impl; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundMapper; +import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundCoreMapper; import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundStatusEnum; import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayRefundAbstractChannelPostHandler; import cn.iocoder.yudao.coreservice.modules.pay.service.order.bo.PayRefundPostReqBO; import cn.iocoder.yudao.framework.pay.core.enums.PayChannelRespEnum; import org.springframework.stereotype.Service; -import java.util.Optional; - /** * 支付退款订单渠道返回重试的后置处理类 * {@link PayChannelRespEnum#RETRY_FAILURE} @@ -21,7 +19,7 @@ public class PayRefundChannelRetryHandler extends PayRefundAbstractChannelPostHa public PayRefundChannelRetryHandler(PayOrderCoreMapper payOrderCoreMapper, - PayRefundMapper payRefundMapper) { + PayRefundCoreMapper payRefundMapper) { super(payOrderCoreMapper, payRefundMapper); } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelSuccessHandler.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelSuccessHandler.java index ca6fad3a0..f41edcb3f 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelSuccessHandler.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundChannelSuccessHandler.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.coreservice.modules.pay.service.order.impl; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundMapper; +import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundCoreMapper; import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyTypeEnum; import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundStatusEnum; import cn.iocoder.yudao.coreservice.modules.pay.service.notify.PayNotifyCoreService; @@ -28,7 +28,7 @@ public class PayRefundChannelSuccessHandler extends PayRefundAbstractChannelPost public PayRefundChannelSuccessHandler(PayOrderCoreMapper payOrderCoreMapper, - PayRefundMapper payRefundMapper) { + PayRefundCoreMapper payRefundMapper) { super(payOrderCoreMapper, payRefundMapper); } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundCoreServiceImpl.java index 3b2b4fbb0..b7eae8bd4 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundCoreServiceImpl.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundCoreServiceImpl.java @@ -9,7 +9,7 @@ import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExt import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderCoreMapper; import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderExtensionCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundMapper; +import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundCoreMapper; import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyTypeEnum; import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderNotifyStatusEnum; import cn.iocoder.yudao.coreservice.modules.pay.service.notify.PayNotifyCoreService; @@ -52,7 +52,7 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { private PayOrderCoreMapper payOrderCoreMapper; @Resource - private PayRefundMapper payRefundMapper; + private PayRefundCoreMapper payRefundCoreMapper; @Resource private PayOrderExtensionCoreMapper payOrderExtensionCoreMapper; @@ -145,7 +145,7 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { .type(refundType.getStatus()) .build(); - payRefundMapper.insert(refundDO); + payRefundCoreMapper.insert(refundDO); PayRefundUnifiedReqDTO unifiedReqDTO = PayRefundUnifiedReqDTO.builder() .userIp(reqBO.getUserIp()) @@ -197,7 +197,7 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { if(Objects.equals(PayNotifyRefundStatusEnum.SUCCESS,refundNotify.getStatus())){ //退款成功。 支付宝只有退款成功才会发通知 - PayRefundDO refundDO = payRefundMapper.selectByReqNo(refundNotify.getReqNo()); + PayRefundDO refundDO = payRefundCoreMapper.selectByReqNo(refundNotify.getReqNo()); if (refundDO == null) { log.error("不存在 seqNo 为{} 的支付退款单",refundNotify.getReqNo()); throw exception(PAY_REFUND_NOT_FOUND); @@ -227,7 +227,7 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { .setTradeNo(refundNotify.getTradeNo()) .setNotifyTime(new Date()) .setStatus(PayRefundStatusEnum.SUCCESS.getStatus()); - payRefundMapper.updateById(updateRefundDO); + payRefundCoreMapper.updateById(updateRefundDO); //插入退款通知记录 // TODO 通知商户成功或者失败. 现在通知似乎没有实现, 只是回调