From 02a33fbf0823713b7ddef31cef259689cd364419 Mon Sep 17 00:00:00 2001 From: tangqian Date: Wed, 24 May 2023 10:23:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=88=AA=E8=87=B3=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/service/order/impl/OrderPayServiceImpl.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java index 09a5b7e22..6de13cf77 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java @@ -37,6 +37,8 @@ import org.springframework.transaction.support.TransactionTemplate; import org.springframework.util.Assert; import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -333,15 +335,17 @@ public class OrderPayServiceImpl implements OrderPayService { WxPayService wxPayService = wxPayOneAutoConfiguration.wxPayOneService(); Assert.notNull(wxPayService, "获取微信支付配置失败!"); WxPayUnifiedOrderV3Request wxPayRequest = new WxPayUnifiedOrderV3Request(); - int sum = storeOrder.getPayPrice().multiply(new BigDecimal("100")).intValue(); +// int sum = storeOrder.getPayPrice().multiply(new BigDecimal("100")).intValue(); + int sum = 1; wxPayRequest.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(sum)); - wxPayRequest.setDescription("会员充值"); + wxPayRequest.setDescription("商城消费"); wxPayRequest.setOutTradeNo(storeOrder.getOrderId()); wxPayRequest.setNotifyUrl(payProperties.getNotifyUrl()); wxPayRequest.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(openid)); wxPayRequest.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(ip)); wxPayRequest.setAppid(payProperties.getAppId()); wxPayRequest.setMchid(payProperties.getMchId()); + wxPayRequest.setTimeExpire(formatLocalDateTime(LocalDateTime.now().plusMinutes(30), "yyyyMMddHHmmss")); try { WxPayUnifiedOrderV3Result wxPayUnifiedOrderV3Result = wxPayService.unifiedOrderV3(TradeTypeEnum.JSAPI, wxPayRequest); map.put("mweb_url",wxPayUnifiedOrderV3Result.getH5Url()); @@ -350,4 +354,8 @@ public class OrderPayServiceImpl implements OrderPayService { } return map; } + public static String formatLocalDateTime(LocalDateTime localDateTime, String pattern) { + return localDateTime.format(DateTimeFormatter.ofPattern(pattern)); + } + } From 9c626bcbbcb8cd2bf5d87b2765d26818b76c20e0 Mon Sep 17 00:00:00 2001 From: tangqian Date: Wed, 24 May 2023 10:35:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=88=AA=E8=87=B3=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/recharge/RechargeOrderServiceImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java index dc0ab8d08..0169f12e2 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java @@ -62,14 +62,16 @@ public class RechargeOrderServiceImpl implements RechargeOrderService { RechargeOrderDO updateObj = RechargeOrderConvert.INSTANCE.convert(updateReqVO); rechargeOrderMapper.updateById(updateObj); } + @Override public void updateRechargeOrderStatus(RechargeOrderUpdateReqVO updateReqVO) { // 校验存在 validateRechargeOrderExists(updateReqVO.getId()); // 更新 - RechargeOrderDO updateObj = RechargeOrderConvert.INSTANCE.convert(updateReqVO); + RechargeOrderDO updateObj = RechargeOrderConvert.INSTANCE.convert(updateReqVO); rechargeOrderMapper.updateById(updateObj); } + @Override public void deleteRechargeOrder(Long id) { // 校验存在 @@ -97,7 +99,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService { @Override public PageResult getRechargeOrderPage(RechargeOrderPageReqVO pageReqVO) { Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); - rechargeOrderMapper.findListPage(page,pageReqVO); + rechargeOrderMapper.findListPage(page, pageReqVO); return new PageResult<>(page.getRecords(), page.getTotal()); } @@ -149,7 +151,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService { MemberHeadResponse response = new MemberHeadResponse(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); Assert.notNull(loginUser, "登录失效,请重新登录!"); - List orderDOS = rechargeOrderMapper.selectList(Wrappers.lambdaQuery().eq(RechargeOrderDO::getUid, loginUser.getId())); + List orderDOS = rechargeOrderMapper.selectList(Wrappers.lambdaQuery().eq(RechargeOrderDO::getUid, loginUser.getId()).eq(RechargeOrderDO::getPaid, 1)); if (!CollectionUtils.isEmpty(orderDOS)) { BigDecimal amount = new BigDecimal("0"); for (RechargeOrderDO orderDO : orderDOS) { @@ -158,7 +160,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService { if (amount.compareTo(new BigDecimal("640")) < 0) { response.setGrade("普通会员"); response.setIntegral(amount.stripTrailingZeros().toPlainString() + "/" + "640"); - } else if (amount.compareTo(new BigDecimal("640")) >= 0) { + } else if (amount.compareTo(new BigDecimal("1040")) >= 0) { response.setGrade("高级会员"); response.setIntegral(amount.stripTrailingZeros().toPlainString() + "/" + "1040"); } else {