From 49e74b91c52831d930f61e981f4142c165741324 Mon Sep 17 00:00:00 2001 From: zt Date: Tue, 17 Jun 2025 15:49:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/api/activitypay/ActivityApi.java | 3 + .../activitypay/dto/ActivityPayRespDTO.java | 37 ++++++ .../api/activitypay/ActivityApiImpl.java | 9 ++ .../activitypay/vo/ActivityPayPageRVO.java | 8 +- .../activitypay/ActivityPayServiceImpl.java | 10 ++ .../module/pay/enums/ErrorCodeConstants.java | 1 + .../app/divide/AppDivideController.java | 10 +- ...dMoneyVO.java => ActivityRefundMoney.java} | 12 +- .../WxProfitsharingService.java | 4 +- .../WxProfitsharingServiceImpl.java | 123 +++++++++--------- 10 files changed, 138 insertions(+), 79 deletions(-) create mode 100644 yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/dto/ActivityPayRespDTO.java rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/divide/vo/{RefundMoneyVO.java => ActivityRefundMoney.java} (74%) diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/ActivityApi.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/ActivityApi.java index 26fe3e16..9d85fcd2 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/ActivityApi.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/ActivityApi.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.member.api.activitypay; import cn.iocoder.yudao.module.member.api.activitypay.dto.ActivityPayDTO; +import cn.iocoder.yudao.module.member.api.activitypay.dto.ActivityPayRespDTO; /** * 用户收件地址 API 接口 @@ -12,4 +13,6 @@ public interface ActivityApi { void createActivityPay(ActivityPayDTO createReqVO); + ActivityPayRespDTO getActivityPay(Long id); + } diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/dto/ActivityPayRespDTO.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/dto/ActivityPayRespDTO.java new file mode 100644 index 00000000..2a13ad77 --- /dev/null +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/dto/ActivityPayRespDTO.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.member.api.activitypay.dto; + +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + + +@Data + +public class ActivityPayRespDTO { + + + private Long id; + + + private Long activityId; + + + private String serialNumbers; + + + private BigDecimal price; + + + private Long userId; + + + private String mobile; + + private String transactionId; + + private String openid; + + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/ActivityApiImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/ActivityApiImpl.java index f412b638..3ee2edd6 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/ActivityApiImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/activitypay/ActivityApiImpl.java @@ -1,8 +1,11 @@ package cn.iocoder.yudao.module.member.api.activitypay; import cn.hutool.core.bean.BeanUtil; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.member.api.activitypay.dto.ActivityPayDTO; +import cn.iocoder.yudao.module.member.api.activitypay.dto.ActivityPayRespDTO; import cn.iocoder.yudao.module.member.controller.admin.activitypay.vo.ActivityPaySaveReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.activitypay.ActivityPayDO; import cn.iocoder.yudao.module.member.service.activitypay.ActivityPayService; import org.springframework.stereotype.Service; @@ -26,4 +29,10 @@ public class ActivityApiImpl implements ActivityApi { bean.setMenu(createReqVO.getMenu()); activityPayService.addActivityPay(bean); } + + @Override + public ActivityPayRespDTO getActivityPay(Long id) { + ActivityPayDO activityPay = activityPayService.getActivityPay(id); + return BeanUtils.toBean(activityPay, ActivityPayRespDTO.class); + } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/activitypay/vo/ActivityPayPageRVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/activitypay/vo/ActivityPayPageRVO.java index 805ece6e..610ec3d1 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/activitypay/vo/ActivityPayPageRVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/activitypay/vo/ActivityPayPageRVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.member.controller.admin.activitypay.vo; +import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -38,9 +39,14 @@ public class ActivityPayPageRVO { @ExcelProperty("预约就餐时间") private String reserveTime; - @ExcelProperty("电话") + @ExcelIgnore private String voucher; + @ExcelProperty("代金券使用数量") + private int voucherNum; + @ExcelProperty("创建时间") private LocalDateTime createTime; + + } \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/activitypay/ActivityPayServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/activitypay/ActivityPayServiceImpl.java index bd29fc1e..67a460c6 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/activitypay/ActivityPayServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/activitypay/ActivityPayServiceImpl.java @@ -24,6 +24,7 @@ import cn.iocoder.yudao.module.member.service.user.MemberUserService; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.yulichang.wrapper.MPJLambdaWrapper; +import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -325,6 +326,15 @@ public class ActivityPayServiceImpl implements ActivityPayService { queryDTOPage.setSize(pageVO.getPageSize()); Page activityAwardsUserRespVOPage = activityPayMapper.getPage1(queryDTOPage, pageVO); + + activityAwardsUserRespVOPage.getRecords().forEach(activityPayPageRVO -> { + if(StringUtils.isNotBlank(activityPayPageRVO.getVoucher())){ + int length = activityPayPageRVO.getVoucher().split(",").length; + activityPayPageRVO.setVoucherNum(length); + }else{ + activityPayPageRVO.setVoucherNum(0); + } + }); return new PageResult<>(activityAwardsUserRespVOPage.getRecords(), activityAwardsUserRespVOPage.getTotal()); } } \ No newline at end of file diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java index 37720c9f..d4235892 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java @@ -94,6 +94,7 @@ public interface ErrorCodeConstants { ErrorCode ORDER_NOT_COMPLETE = new ErrorCode(1_007_902_002, "还有订单尚未结算"); ErrorCode WX_ACCOUNT_NO = new ErrorCode(1_007_902_002, "微信充值金额不足"); ErrorCode REFUND_NOT_COMPLETE = new ErrorCode(1_007_902_002, "还有退款正在进行"); + ErrorCode REFUND_MOBILE_ERROR = new ErrorCode(1_007_902_002, "手机号错误"); ErrorCode DIVIDE_COMPANY_NOT_EXISTS = new ErrorCode(1_007_903_001, "分账公司不存在"); diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/divide/AppDivideController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/divide/AppDivideController.java index 26f28bdb..f33baa91 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/divide/AppDivideController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/divide/AppDivideController.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.pay.controller.app.divide; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.pay.controller.app.divide.vo.DrawMoneyVO; -import cn.iocoder.yudao.module.pay.controller.app.divide.vo.RefundMoneyVO; +import cn.iocoder.yudao.module.pay.controller.app.divide.vo.ActivityRefundMoney; import cn.iocoder.yudao.module.pay.service.wxprofitsharing.WxProfitsharingService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -31,10 +31,10 @@ public class AppDivideController { return success(profitsharingService.drawMoney(drawMoneyVO)); } - @PostMapping("/refundMoney") - @Operation(summary = "退款") - public CommonResult refundMoney(@RequestBody RefundMoneyVO refundMoney) { - return success(profitsharingService.refundMoney(refundMoney)); + @PostMapping("/activityRefundMoney") + @Operation(summary = "活动退款") + public CommonResult activityRefundMoney(@RequestBody ActivityRefundMoney refundMoney) { + return success(profitsharingService.activityRefundMoney(refundMoney)); } } \ No newline at end of file diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/divide/vo/RefundMoneyVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/divide/vo/ActivityRefundMoney.java similarity index 74% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/divide/vo/RefundMoneyVO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/divide/vo/ActivityRefundMoney.java index a73e1591..b1309d90 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/divide/vo/RefundMoneyVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/divide/vo/ActivityRefundMoney.java @@ -5,11 +5,14 @@ import lombok.Data; @Schema(description = "管理后台 - 分账单新增/修改 Request VO") @Data -public class RefundMoneyVO { +public class ActivityRefundMoney { @Schema(description = "用户编号") private Long userId; + @Schema(description = "订单编号") + private Long orderId; + @Schema(description = "总金额,单位:分") //@NotNull(message = "总金额,单位:分不能为空") private Integer totalPrice; @@ -18,11 +21,8 @@ public class RefundMoneyVO { */ private String channelUserId; - /** - * 1-用户退款 2-商家退款 - */ - private String type; - private String transactionId; + @Schema(description = "电话号码") + private String mobile; } \ No newline at end of file diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wxprofitsharing/WxProfitsharingService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wxprofitsharing/WxProfitsharingService.java index bfc73e50..e976a478 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wxprofitsharing/WxProfitsharingService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wxprofitsharing/WxProfitsharingService.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.controller.admin.wxprofitsharing.vo.WxProfitsharingPageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wxprofitsharing.vo.WxProfitsharingSaveReqVO; import cn.iocoder.yudao.module.pay.controller.app.divide.vo.DrawMoneyVO; -import cn.iocoder.yudao.module.pay.controller.app.divide.vo.RefundMoneyVO; +import cn.iocoder.yudao.module.pay.controller.app.divide.vo.ActivityRefundMoney; import cn.iocoder.yudao.module.pay.dal.dataobject.wxprofitsharing.WxProfitsharingDO; import javax.validation.Valid; @@ -77,5 +77,5 @@ public interface WxProfitsharingService { /** * 活动退款 */ - Boolean refundMoney(RefundMoneyVO refundMoney); + void activityRefundMoney(ActivityRefundMoney refundMoney); } \ No newline at end of file diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wxprofitsharing/WxProfitsharingServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wxprofitsharing/WxProfitsharingServiceImpl.java index 7b943d7d..7bd7cab3 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wxprofitsharing/WxProfitsharingServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wxprofitsharing/WxProfitsharingServiceImpl.java @@ -15,10 +15,12 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.divide.PayDivideUnifiedDto import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; import cn.iocoder.yudao.framework.pay.core.enums.divide.PayDivideRefundStatusRespEnum; +import cn.iocoder.yudao.module.member.api.activitypay.ActivityApi; +import cn.iocoder.yudao.module.member.api.activitypay.dto.ActivityPayRespDTO; import cn.iocoder.yudao.module.pay.controller.admin.wxprofitsharing.vo.WxProfitsharingPageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wxprofitsharing.vo.WxProfitsharingSaveReqVO; +import cn.iocoder.yudao.module.pay.controller.app.divide.vo.ActivityRefundMoney; import cn.iocoder.yudao.module.pay.controller.app.divide.vo.DrawMoneyVO; -import cn.iocoder.yudao.module.pay.controller.app.divide.vo.RefundMoneyVO; import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; import cn.iocoder.yudao.module.pay.dal.dataobject.dividecompany.DivideCompanyDO; import cn.iocoder.yudao.module.pay.dal.dataobject.refundlog.PayRefundLogDO; @@ -92,6 +94,8 @@ public class WxProfitsharingServiceImpl implements WxProfitsharingService { private WxRefundMapper wxRefundMapper; @Resource private PayRefundLogMapper payRefundLogMapper; + @Resource + private ActivityApi activityApi; @Override public Long createWxProfitsharing(WxProfitsharingSaveReqVO createReqVO) { @@ -847,7 +851,7 @@ public class WxProfitsharingServiceImpl implements WxProfitsharingService { } @Override - public Boolean refundMoney(RefundMoneyVO refundMoney) { + public void activityRefundMoney(ActivityRefundMoney refundMoney) { //判断用户是否正在退款 List refundDOList1 = wxRefundMapper.selectList(Wrappers.lambdaQuery() @@ -857,91 +861,80 @@ public class WxProfitsharingServiceImpl implements WxProfitsharingService { throw new ServiceException(REFUND_NOT_COMPLETE); } - //判断是否有金额可退款 - int money = refundMoney.getTotalPrice(); + //判断退款金额是否正确 + + ActivityPayRespDTO activityPay = activityApi.getActivityPay(refundMoney.getOrderId()); + if (activityPay == null) { + throw new ServiceException(new ErrorCode(1_007_902_002, "未查询到付款订单")); + } + if (!activityPay.getMobile().equals(refundMoney.getMobile())) { + throw new ServiceException(REFUND_MOBILE_ERROR); + } + int money = activityPay.getPrice().multiply(new BigDecimal(100)).intValue(); + //交易时间超过一年的订单无法提交退款(按支付成功时间+365天计算) LocalDateTime now = LocalDateTime.now(); // 获取当前时间 - LocalDateTime threeYearsAgo = now.minusDays(364); - - //查询最近的充值订单,时间倒序退款 - List wxOrderDOList = wxOrderMapper.selectList(Wrappers.lambdaQuery() - .eq(WxOrderDO::getOpenId, refundMoney.getChannelUserId()) - .eq(WxOrderDO::getTransactionId, refundMoney.getTransactionId()) - .gt(WxOrderDO::getRefundPrice, 0) - .ge(WxOrderDO::getCreateTime, threeYearsAgo) - .orderByDesc(WxOrderDO::getCreateTime)); - - if(wxOrderDOList.isEmpty()){ - throw new ServiceException(new ErrorCode(1_007_902_002, "未查询到付款订单")); + LocalDateTime oneYearAgo = now.minusDays(364); + if (activityPay.getCreateTime().isBefore(oneYearAgo)) { + throw new ServiceException(new ErrorCode(1_007_902_002, "订单已超退款时限")); } - Map orderMap = wxOrderDOList.stream().collect(Collectors.toMap(WxOrderDO::getId, vo -> vo)); - - //筛选出未分账的订单 - List unDivideList = wxOrderDOList.stream().filter(vo -> vo.getRefundPrice().equals(vo.getProfitsharingPrice())).collect(Collectors.toList()); - - //筛选出已分账的订单 - List divideList = wxOrderDOList.stream().filter(vo -> !vo.getRefundPrice().equals(vo.getProfitsharingPrice())).collect(Collectors.toList()); - - //筛选出分账完的订单 - List divideCpList = divideList.stream().filter(vo -> vo.getProfitsharingPrice() == 0).collect(Collectors.toList()); - - //剩下的是未分账完的订单 - List divideUnCpList = divideList.stream().filter(vo -> vo.getProfitsharingPrice() != 0).collect(Collectors.toList()); + //查询充值订单 + WxOrderDO wxOrderDO = wxOrderMapper.selectOne(Wrappers.lambdaQuery() + .eq(WxOrderDO::getOpenId, refundMoney.getChannelUserId()) + .eq(WxOrderDO::getTransactionId, activityPay.getTransactionId()) + .last("limit 1")); + if (wxOrderDO == null) { + throw new ServiceException(new ErrorCode(1_007_902_002, "充值订单不存在")); + } //生成退款订单 - List refundDOList = createRefund(unDivideList, divideCpList, divideUnCpList, money, refundMoney.getUserId()); + WxRefundDO refundDO = createActivityRefund(wxOrderDO, money, refundMoney.getUserId()); - int failNum = 0; //调用微信退款接口 - if (CollectionUtil.isNotEmpty(refundDOList)) { - for (WxRefundDO wxRefundDO : refundDOList) { - WxOrderDO wxOrderDO = orderMap.get(wxRefundDO.getPayWxOrderId()); + PayChannelDO channel = channelService.validPayChannel(wxOrderDO.getChannelId()); - PayChannelDO channel = channelService.validPayChannel(wxOrderDO.getChannelId()); + PayClient client = channelService.getPayClient(wxOrderDO.getChannelId()); + PayRefundUnifiedReqDTO payRefundUnifiedReqDTO = new PayRefundUnifiedReqDTO(); + payRefundUnifiedReqDTO.setTransactionId(activityPay.getTransactionId()) + .setReason("预定退款") + .setRefundPrice(refundDO.getTotalPrice()) + .setOutRefundNo(refundDO.getOutRefundNo()) + .setPayPrice(refundDO.getTotalPrice()) + .setNotifyUrl(genChannelRefundNotifyUrlActivity(channel,"1")); + PayRefundRespDTO payRefundRespDTO = client.unifiedRefund(payRefundUnifiedReqDTO); - PayClient client = channelService.getPayClient(wxOrderDO.getChannelId()); - PayRefundUnifiedReqDTO payRefundUnifiedReqDTO = new PayRefundUnifiedReqDTO(); - payRefundUnifiedReqDTO.setTransactionId(wxOrderDO.getTransactionId()) - .setReason("预定退款") - .setRefundPrice(wxRefundDO.getTotalPrice()) - .setOutRefundNo(wxRefundDO.getOutRefundNo()) - .setPayPrice(wxOrderDO.getTotalPrice()) - .setNotifyUrl(genChannelRefundNotifyUrl(channel)); - PayRefundRespDTO payRefundRespDTO = client.unifiedRefund(payRefundUnifiedReqDTO); - - String channelRefundNo = payRefundRespDTO.getChannelRefundNo(); - wxRefundDO.setRefundId(channelRefundNo); - if (cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum.WAITING.getStatus().equals(payRefundRespDTO.getStatus())) { - wxRefundDO.setStatus(PayDivideRefundStatusRespEnum.PROCESSING.getStatus()); - } else if (cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum.SUCCESS.getStatus().equals(payRefundRespDTO.getStatus())) { - wxRefundDO.setStatus(PayDivideRefundStatusRespEnum.SUCCESS.getStatus()); - } else { - failNum++; - wxRefundDO.setStatus(PayDivideRefundStatusRespEnum.ABNORMAL.getStatus()); - } - - wxRefundMapper.insert(wxRefundDO); - } + String channelRefundNo = payRefundRespDTO.getChannelRefundNo(); + refundDO.setRefundId(channelRefundNo); + if (cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum.WAITING.getStatus().equals(payRefundRespDTO.getStatus())) { + refundDO.setStatus(PayDivideRefundStatusRespEnum.PROCESSING.getStatus()); + } else if (cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum.SUCCESS.getStatus().equals(payRefundRespDTO.getStatus())) { + refundDO.setStatus(PayDivideRefundStatusRespEnum.SUCCESS.getStatus()); + } else { + refundDO.setStatus(PayDivideRefundStatusRespEnum.ABNORMAL.getStatus()); } - - return failNum <= 0; + wxRefundMapper.insert(refundDO); } - public WxRefundDO createRefundOne(WxOrderDO wxOrderDO, int money, Long userId) { - + public WxRefundDO createActivityRefund(WxOrderDO wxOrderDO, int money, Long userId) { //退款订单 - List backList = new ArrayList<>(); - WxRefundDO wxRefundDO = new WxRefundDO(); wxRefundDO.setPayWxOrderId(wxOrderDO.getId()); wxRefundDO.setUserId(userId); wxRefundDO.setOutRefundNo(noRedisDAO.generate(payProperties.getRefundNoPrefix())); wxRefundDO.setTotalPrice(money); - + String jsonString = JsonUtils.toJsonString(wxOrderDO); + divideRedisTemplate.opsForValue().set("RA" + wxOrderDO.getId(), jsonString); return wxRefundDO; } + + private String genChannelRefundNotifyUrlActivity(PayChannelDO channel,String type) { + if("1".equals(type)){ + return payProperties.getRefundNotifyUrl() + "/" + channel.getId(); + } + return payProperties.getRefundNotifyUrl() + "/" + channel.getId(); + } } \ No newline at end of file