Commit 8ff710e49dabf826b8c8cfd3c2ccdc17a8bc9104
1 parent
8b6bc7c5
✨ 同步 master 的一些 pr 代码变更
Showing
7 changed files
with
76 additions
and
4 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractServiceImpl.java
| ... | ... | @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.crm.service.contract; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | 5 | import cn.hutool.core.lang.Assert; |
| 6 | -import cn.hutool.core.lang.Validator; | |
| 7 | 6 | import cn.hutool.core.util.ObjUtil; |
| 8 | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | 8 | import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; |
| ... | ... | @@ -346,8 +345,8 @@ public class CrmContractServiceImpl implements CrmContractService { |
| 346 | 345 | if (config != null && Boolean.FALSE.equals(config.getNotifyEnabled())) { |
| 347 | 346 | config = null; |
| 348 | 347 | } |
| 349 | - if(Validator.isNull(config)){ | |
| 350 | - return new PageResult<>(); | |
| 348 | + if (config == null) { | |
| 349 | + return PageResult.empty(); | |
| 351 | 350 | } |
| 352 | 351 | } |
| 353 | 352 | // 2. 查询分页 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/AfterSaleServiceImpl.java
| ... | ... | @@ -245,7 +245,7 @@ public class AfterSaleServiceImpl implements AfterSaleService { |
| 245 | 245 | @AfterSaleLog(operateType = AfterSaleOperateTypeEnum.MEMBER_DELIVERY) |
| 246 | 246 | public void deliveryAfterSale(Long userId, AppAfterSaleDeliveryReqVO deliveryReqVO) { |
| 247 | 247 | // 校验售后单存在,并状态未退货 |
| 248 | - AfterSaleDO afterSale = tradeAfterSaleMapper.selectById(deliveryReqVO.getId()); | |
| 248 | + AfterSaleDO afterSale = tradeAfterSaleMapper.selectByIdAndUserId(deliveryReqVO.getId(), userId); | |
| 249 | 249 | if (afterSale == null) { |
| 250 | 250 | throw exception(AFTER_SALE_NOT_FOUND); |
| 251 | 251 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
| ... | ... | @@ -477,6 +477,14 @@ public class PayOrderServiceImpl implements PayOrderService { |
| 477 | 477 | return false; |
| 478 | 478 | } |
| 479 | 479 | PayOrderRespDTO respDTO = payClient.getOrder(orderExtension.getNo()); |
| 480 | + // 如果查询到订单不存在,PayClient 返回的状态为关闭。但此时不能关闭订单。存在以下一种场景: | |
| 481 | + // 拉起渠道支付后,短时间内用户未及时完成支付,但是该订单同步定时任务恰巧自动触发了,主动查询结果为订单不存在。 | |
| 482 | + // 当用户支付成功之后,该订单状态在渠道的回调中无法从已关闭改为已支付,造成重大影响。 | |
| 483 | + // 考虑此定时任务是异常场景的兜底操作,因此这里不做变更,优先以回调为准。 | |
| 484 | + // 让订单自动随着支付渠道那边一起等到过期,确保渠道先过期关闭支付入口,而后通过订单过期定时任务关闭自己的订单。 | |
| 485 | + if (PayOrderStatusRespEnum.isClosed(respDTO.getStatus())) { | |
| 486 | + return false; | |
| 487 | + } | |
| 480 | 488 | // 1.2 回调支付结果 |
| 481 | 489 | notifyOrder(orderExtension.getChannelId(), respDTO); |
| 482 | 490 | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java
| ... | ... | @@ -44,6 +44,7 @@ public class PayClientFactoryImpl implements PayClientFactory { |
| 44 | 44 | clientClass.put(WX_APP, WxAppPayClient.class); |
| 45 | 45 | clientClass.put(WX_BAR, WxBarPayClient.class); |
| 46 | 46 | clientClass.put(WX_NATIVE, WxNativePayClient.class); |
| 47 | + clientClass.put(WX_WAP, WxWapPayClient.class); | |
| 47 | 48 | // 支付包支付客户端 |
| 48 | 49 | clientClass.put(ALIPAY_WAP, AlipayWapPayClient.class); |
| 49 | 50 | clientClass.put(ALIPAY_QR, AlipayQrPayClient.class); | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayWapPayClient.java
| ... | ... | @@ -45,6 +45,7 @@ public class AlipayWapPayClient extends AbstractAlipayPayClient { |
| 45 | 45 | request.setNotifyUrl(reqDTO.getNotifyUrl()); |
| 46 | 46 | request.setReturnUrl(reqDTO.getReturnUrl()); |
| 47 | 47 | model.setQuitUrl(reqDTO.getReturnUrl()); |
| 48 | + model.setTimeExpire(formatTime(reqDTO.getExpireTime())); | |
| 48 | 49 | |
| 49 | 50 | // 2.1 执行请求 |
| 50 | 51 | AlipayTradeWapPayResponse response = client.pageExecute(request, Method.GET.name()); | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxWapPayClient.java
0 → 100644
| 1 | +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 5 | +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 6 | +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 7 | +import com.github.binarywang.wxpay.bean.order.WxPayMwebOrderResult; | |
| 8 | +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; | |
| 9 | +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request; | |
| 10 | +import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum; | |
| 11 | +import com.github.binarywang.wxpay.constant.WxPayConstants; | |
| 12 | +import com.github.binarywang.wxpay.exception.WxPayException; | |
| 13 | +import lombok.extern.slf4j.Slf4j; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 微信支付(H5 网页)的 PayClient 实现类 | |
| 17 | + * | |
| 18 | + * 文档:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_1.shtml">H5下单API</> | |
| 19 | + * | |
| 20 | + * @author YYQ | |
| 21 | + */ | |
| 22 | +@Slf4j | |
| 23 | +public class WxWapPayClient extends AbstractWxPayClient { | |
| 24 | + | |
| 25 | + public WxWapPayClient(Long channelId, WxPayClientConfig config) { | |
| 26 | + super(channelId, PayChannelEnum.WX_WAP.getCode(), config); | |
| 27 | + } | |
| 28 | + | |
| 29 | + protected WxWapPayClient(Long channelId, String channelCode, WxPayClientConfig config) { | |
| 30 | + super(channelId, channelCode, config); | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + protected void doInit() { | |
| 35 | + super.doInit(WxPayConstants.TradeType.MWEB); | |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + protected PayOrderRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { | |
| 40 | + // 构建 WxPayUnifiedOrderRequest 对象 | |
| 41 | + WxPayUnifiedOrderRequest request = buildPayUnifiedOrderRequestV2(reqDTO); | |
| 42 | + // 执行请求 | |
| 43 | + WxPayMwebOrderResult response = client.createOrder(request); | |
| 44 | + | |
| 45 | + // 转换结果 | |
| 46 | + return PayOrderRespDTO.waitingOf(PayOrderDisplayModeEnum.URL.getMode(), response.getMwebUrl(), | |
| 47 | + reqDTO.getOutTradeNo(), response); | |
| 48 | + } | |
| 49 | + | |
| 50 | + @Override | |
| 51 | + protected PayOrderRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { | |
| 52 | + // 构建 WxPayUnifiedOrderRequest 对象 | |
| 53 | + WxPayUnifiedOrderV3Request request = buildPayUnifiedOrderRequestV3(reqDTO); | |
| 54 | + // 执行请求 | |
| 55 | + String response = client.createOrderV3(TradeTypeEnum.H5, request); | |
| 56 | + | |
| 57 | + // 转换结果 | |
| 58 | + return PayOrderRespDTO.waitingOf(PayOrderDisplayModeEnum.URL.getMode(), response, | |
| 59 | + reqDTO.getOutTradeNo(), response); | |
| 60 | + } | |
| 61 | + | |
| 62 | +} | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/channel/PayChannelEnum.java
| ... | ... | @@ -21,6 +21,7 @@ public enum PayChannelEnum { |
| 21 | 21 | WX_LITE("wx_lite", "微信小程序支付", WxPayClientConfig.class), |
| 22 | 22 | WX_APP("wx_app", "微信 App 支付", WxPayClientConfig.class), |
| 23 | 23 | WX_NATIVE("wx_native", "微信 Native 支付", WxPayClientConfig.class), |
| 24 | + WX_WAP("wx_wap", "微信 Wap 网站支付", WxPayClientConfig.class), // H5 网页 | |
| 24 | 25 | WX_BAR("wx_bar", "微信付款码支付", WxPayClientConfig.class), |
| 25 | 26 | |
| 26 | 27 | ALIPAY_PC("alipay_pc", "支付宝 PC 网站支付", AlipayPayClientConfig.class), | ... | ... |