From 5df01f51928b05fb5d907d5aedce5c12f0689c94 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 25 Dec 2025 18:40:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=20=E7=B4=AF=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/czg/controller/NotifyController.java | 28 ------------------- .../order/service/OrderPaymentService.java | 3 ++ .../impl/TbMemberConfigServiceImpl.java | 21 ++++---------- 3 files changed, 9 insertions(+), 43 deletions(-) diff --git a/cash-api/account-server/src/main/java/com/czg/controller/NotifyController.java b/cash-api/account-server/src/main/java/com/czg/controller/NotifyController.java index fd9fc6d1d..5d3cbf916 100644 --- a/cash-api/account-server/src/main/java/com/czg/controller/NotifyController.java +++ b/cash-api/account-server/src/main/java/com/czg/controller/NotifyController.java @@ -147,32 +147,4 @@ public class NotifyController { } return resultMap; } - - - - - public static void main(String[] args) { - String str = "1761095747"; - // 2. 解析 XML 为 Map(便于获取字段) - Map messageMap = new HashMap<>(); - try { - messageMap = parseXmlToMap(str); - } catch (DocumentException e) { - log.error("XML 解析失败,", e); - } - log.info("微信 POST 消息内容: {}", messageMap); - //携带参数 - String eventKey = messageMap.get("EventKey"); - Long userId = null; - if (eventKey != null && eventKey.startsWith("qrscene_")) { - try { - // 截取 "qrscene_" 前缀后的字符串(长度为 8),并转为 Long - String numberStr = eventKey.substring("qrscene_".length()); - userId = Long.parseLong(numberStr); - } catch (NumberFormatException e) { - log.error("EventKey 后缀不是有效数字,eventKey: {}", eventKey, e); - } - } - System.out.println("userId: " + userId); - } } diff --git a/cash-common/cash-common-service/src/main/java/com/czg/order/service/OrderPaymentService.java b/cash-common/cash-common-service/src/main/java/com/czg/order/service/OrderPaymentService.java index 73913384d..02d474bdd 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/order/service/OrderPaymentService.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/order/service/OrderPaymentService.java @@ -3,6 +3,8 @@ package com.czg.order.service; import com.mybatisflex.core.service.IService; import com.czg.order.entity.OrderPayment; +import java.math.BigDecimal; + /** * 支付详情 服务层。 * @@ -11,4 +13,5 @@ import com.czg.order.entity.OrderPayment; */ public interface OrderPaymentService extends IService { + BigDecimal countMemberInAmount(Long shopId, Long shopUserId); } diff --git a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java index 8348c23bc..578db82de 100644 --- a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java +++ b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java @@ -124,20 +124,16 @@ public class TbMemberConfigServiceImpl extends ServiceImpl= 0); - break; case "RECHARGE_AMOUNT": - conditionMap.put("RECHARGE_AMOUNT", paymentService.getOneAs(query().select("IFNULL(sum(amount), 0) as total_amount ") - .eq(OrderPayment::getShopId, shopId) - .eq(OrderPayment::getSourceType, PayTypeConstants.SourceType.MEMBER_IN) - .eq(OrderPayment::getPayType, PayTypeConstants.PayType.PAY) - .eq(OrderPayment::getSourceId, shopUserInfo.getId()) - .eq(OrderPayment::getPayStatus, PayTypeConstants.PayStatus.SUCCESS), BigDecimal.class) + conditionMap.put("RECHARGE_AMOUNT", paymentService.countMemberInAmount(shopId, shopUserInfo.getId()) .compareTo(new BigDecimal(item.getValue())) >= 0); - break; default: throw new CzgException("会员开通条件类型错误"); @@ -422,12 +418,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl= 0; case "RECHARGE_AMOUNT" -> - paymentService.getOneAs(query().select("IFNULL(sum(amount), 0) as total_amount") - .eq(OrderPayment::getShopId, shopId) - .eq(OrderPayment::getSourceType, PayTypeConstants.SourceType.MEMBER_IN) - .eq(OrderPayment::getPayType, PayTypeConstants.PayType.PAY) - .eq(OrderPayment::getSourceId, shopUser.getId()) - .eq(OrderPayment::getPayStatus, PayTypeConstants.PayStatus.SUCCESS), BigDecimal.class) + paymentService.countMemberInAmount(shopId, shopUser.getId()) .compareTo(new BigDecimal(item.getValue())) >= 0; default -> throw new CzgException("会员开通条件类型错误"); };