From 18e2c898911d580ec04dafee4ba6b49a20ebe218 Mon Sep 17 00:00:00 2001 From: misworga831 Date: Fri, 13 Sep 2024 17:27:39 +0800 Subject: [PATCH 1/8] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=95=86=E5=93=81=E9=85=8D=E9=80=81=E6=A8=A1?= =?UTF-8?q?=E7=89=88=EF=BC=8C=E6=B2=A1=E6=9C=89=E6=9B=B4=E6=96=B0sku?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/modules/goods/service/GoodsSkuService.java | 9 +++++++++ .../modules/goods/serviceimpl/GoodsServiceImpl.java | 1 + .../goods/serviceimpl/GoodsSkuServiceImpl.java | 11 +++++++++++ 3 files changed, 21 insertions(+) diff --git a/framework/src/main/java/cn/lili/modules/goods/service/GoodsSkuService.java b/framework/src/main/java/cn/lili/modules/goods/service/GoodsSkuService.java index dbea9b24..61b555e8 100644 --- a/framework/src/main/java/cn/lili/modules/goods/service/GoodsSkuService.java +++ b/framework/src/main/java/cn/lili/modules/goods/service/GoodsSkuService.java @@ -296,4 +296,13 @@ public interface GoodsSkuService extends IService { * @return 库存数量 */ Integer getGoodsStock(String goodsId); + + /** + * 更新sku运费模版 + * + * @param goodsId 商品id + * @param templateId 运费模版id + * @return 操作结果 + */ + Boolean freight(List goodsId, String templateId); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index b3c9e18e..6909add2 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -437,6 +437,7 @@ public class GoodsServiceImpl extends ServiceImpl implements lambdaUpdateWrapper.in(Goods::getId, goodsIds); List goodsCache = goodsIds.stream().map(item -> CachePrefix.GOODS.getPrefix() + item).collect(Collectors.toList()); cache.multiDel(goodsCache); + goodsSkuService.freight(goodsIds, templateId); return this.update(lambdaUpdateWrapper); } diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java index d67639ff..b71b1eae 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java @@ -888,6 +888,17 @@ public class GoodsSkuServiceImpl extends ServiceImpl i } + @Override + public Boolean freight(List goodsId, String templateId) { + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.in(GoodsSku::getGoodsId, goodsId); + updateWrapper.set(GoodsSku::getFreightTemplateId, templateId); + updateWrapper.set(GoodsSku::getUpdateTime, new Date()); + List skuIds = this.list(updateWrapper).stream().map(GoodsSku::getId).collect(Collectors.toList()); + skuIds.forEach(this::clearCache); + return this.update(updateWrapper); + } + /** * 渲染商品sku * From b3bb771066021649e5172a5fdc1afccc16ad9e38 Mon Sep 17 00:00:00 2001 From: misworga831 Date: Sat, 14 Sep 2024 01:39:19 +0800 Subject: [PATCH 2/8] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E4=BC=9A=E5=87=BA=E7=8E=B0=E5=9C=A8=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E5=86=85=E5=A4=9A=E4=BF=83=E9=94=80=E6=B4=BB=E5=8A=A8=E5=A4=9A?= =?UTF-8?q?=E5=95=86=E5=93=81=E7=9A=84=E6=B8=85=E7=A9=BA=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E4=BF=83=E9=94=80=E9=87=91=E9=A2=9D=E5=88=86=E9=85=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cart/render/util/PromotionPriceUtil.java | 176 +++++++++++------- 1 file changed, 113 insertions(+), 63 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/util/PromotionPriceUtil.java b/framework/src/main/java/cn/lili/modules/order/cart/render/util/PromotionPriceUtil.java index d375c16f..f3dedc37 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/util/PromotionPriceUtil.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/util/PromotionPriceUtil.java @@ -1,5 +1,6 @@ package cn.lili.modules.order.cart.render.util; +import cn.hutool.core.map.MapUtil; import cn.lili.common.enums.PromotionTypeEnum; import cn.lili.common.utils.CurrencyUtil; import cn.lili.modules.order.cart.entity.dto.TradeDTO; @@ -10,7 +11,8 @@ import lombok.extern.slf4j.Slf4j; import java.util.Date; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; /** * 促销价格计算业务层实现 @@ -33,7 +35,7 @@ public class PromotionPriceUtil { PromotionTypeEnum promotionTypeEnum, String activityId) { // sku 促销信息非空判定 - if (skuPromotionDetail == null || skuPromotionDetail.size() == 0) { + if (skuPromotionDetail == null || skuPromotionDetail.isEmpty()) { return; } @@ -68,40 +70,39 @@ public class PromotionPriceUtil { List skuVOList = tradeDTO.getSkuList(); // 获取map分配sku的总数,如果是最后一个商品分配金额,则将金额从百分比改为总金额扣减,避免出现小数除不尽 - int count = skuPromotionDetail.size(); + AtomicInteger count = new AtomicInteger(skuPromotionDetail.size()); //已优惠金额 - Double deducted = 0D; + AtomicReference deducted = new AtomicReference<>(0D); for (String skuId : skuPromotionDetail.keySet()) { //获取对应商品进行计算 - for (CartSkuVO cartSkuVO : skuVOList) { - if (cartSkuVO.getGoodsSku().getId().equals(skuId)) { + Double finalDiscountPrice = discountPrice; + Double finalTotalPrice = totalPrice; + skuVOList.stream().filter(l -> l.getGoodsSku().getId().equals(skuId)).findFirst().ifPresent(cartSkuVO -> { + //sku 优惠金额 + Double skuDiscountPrice; + count.getAndDecrement(); - count--; - - //sku 优惠金额 - Double skuDiscountPrice; - - //非最后一个商品,则按照比例计算 - if (count > 0) { - //商品金额占比 - double point = CurrencyUtil.div(cartSkuVO.getPriceDetailDTO().getGoodsPrice(), totalPrice, 4); - //商品优惠金额 - skuDiscountPrice = CurrencyUtil.mul(discountPrice, point); - //累加已优惠金额 - deducted = CurrencyUtil.add(deducted, skuDiscountPrice); - } - // 如果是最后一个商品 则减去之前优惠的金额来进行计算 - else { - skuDiscountPrice = CurrencyUtil.sub(discountPrice, deducted); - } - - calculateCartSkuPromotionsPrice(cartSkuVO, skuDiscountPrice, promotionTypeEnum, activityId); + //非最后一个商品,则按照比例计算 + if (count.get() > 0) { + //商品金额占比 + double point = CurrencyUtil.div(cartSkuVO.getPriceDetailDTO().getGoodsPrice(), finalTotalPrice, 4); + //商品优惠金额 + skuDiscountPrice = CurrencyUtil.mul(finalDiscountPrice, point); + //累加已优惠金额 + deducted.set(CurrencyUtil.add(deducted.get(), skuDiscountPrice)); } - } + // 如果是最后一个商品 则减去之前优惠的金额来进行计算 + else { + skuDiscountPrice = CurrencyUtil.sub(finalDiscountPrice, deducted.get()); + } + + calculateCartSkuPromotionsPrice(cartSkuVO, skuDiscountPrice, promotionTypeEnum, activityId); + }); + } calculateNotEnoughPromotionsPrice(skuVOList, skuPromotionDetail, discountPrice, totalPrice, promotionTypeEnum, activityId); @@ -186,51 +187,100 @@ public class PromotionPriceUtil { // 特殊情况处理,如参与多个促销活动,部分商品在其他促销计算后的金额不足以满足与当前参与的促销活动的优惠金额 // 但当前购物车内存在当前当前促销活动的其他商品且剩余金额也满足分摊不足商品的不足金额,则分摊到其他商品上 // 满足当前促销的总优惠金额 - if (skuPromotionDetail == null || skuPromotionDetail.isEmpty()) { + if (skuPromotionDetail == null || skuPromotionDetail.size() < 2) { return; } + + // clone skuPromotionDetail + Map skuPromotionDetailClone = MapUtil.sortByValue(skuPromotionDetail, false); + + // 未满足优惠金额的商品 long matchPromotionsZeroCount = - skuVOList.stream().filter(l -> l.getPriceDetailDTO().getFlowPrice() == 0 && skuPromotionDetail.containsKey(l.getGoodsSku().getId())).count(); - long matchPromotionsCount = skuVOList.stream().filter(l -> skuPromotionDetail.containsKey(l.getGoodsSku().getId())).count(); + skuVOList.stream().filter(l -> l.getPriceDetailDTO().getFlowPrice() == 0 && skuPromotionDetailClone.containsKey(l.getGoodsSku().getId())).count(); + // 参与当前促销活动的商品 + long matchPromotionsCount = skuVOList.stream().filter(l -> skuPromotionDetailClone.containsKey(l.getGoodsSku().getId())).count(); if (matchPromotionsZeroCount == matchPromotionsCount) { return; } - // 获取剩余金额不足优惠金额的商品 - List unEnoughSku = skuVOList.stream().filter(k -> { - if (skuPromotionDetail.containsKey(k.getGoodsSku().getId()) && skuPromotionDetail.size() >= 2) { - //商品金额占比 - double point = CurrencyUtil.div(k.getPriceDetailDTO().getGoodsPrice(), totalPrice, 4); - //商品优惠金额 - Double skuDiscountPrice = CurrencyUtil.mul(discountPrice, point); - return k.getPriceDetailDTO().getCouponPrice() > 0 && skuDiscountPrice > k.getPriceDetailDTO().getCouponPrice(); + // 分配到其他商品的优惠金额 + AtomicReference balance = new AtomicReference<>(0D); + StringBuilder lastSkuId = new StringBuilder(); + + // 计数器 + int count = 0; + + + // 检查是否有不满足优惠金额的商品 + filterEnoughSku(skuVOList, skuPromotionDetailClone, discountPrice, totalPrice, balance, lastSkuId, promotionTypeEnum, activityId); + + // 循环 优惠金额分摊,直到所有商品都满足优惠金额 + while (true) { + // 如果还有剩余金额,则继续分摊 + if (balance.get() > 0) { + skuPromotionDetailClone.remove(lastSkuId.toString()); + double lastDiscountPrice = CurrencyUtil.sub(discountPrice, skuPromotionDetail.get(lastSkuId.toString())); + double lastTotalPrice = CurrencyUtil.sub(totalPrice, skuPromotionDetail.get(lastSkuId.toString())); + filterEnoughSku(skuVOList, skuPromotionDetailClone, lastDiscountPrice, lastTotalPrice, balance, lastSkuId, promotionTypeEnum, activityId); + } else { + break; } - return false; - }).collect(Collectors.toList()); - if (!unEnoughSku.isEmpty()) { - if (unEnoughSku.size() == skuVOList.size()) { - return; + count++; + + // 防止死循环 + if (count > skuPromotionDetail.size()) { + break; } - for (CartSkuVO cartSkuVO : skuVOList) { - if (unEnoughSku.isEmpty()) { - break; - } - if (skuPromotionDetail.containsKey(cartSkuVO.getGoodsSku().getId()) && unEnoughSku.stream().noneMatch(k -> k.getGoodsSku().getId().equals(cartSkuVO.getGoodsSku().getId()))) { - // 商品金额占比 - double point = CurrencyUtil.div(cartSkuVO.getPriceDetailDTO().getGoodsPrice(), totalPrice, 4); - // 商品优惠金额 - Double skuDiscountPrice = CurrencyUtil.mul(discountPrice, point); - // 商品优惠金额 - 不足优惠金额 = 差额 - Double sub = CurrencyUtil.sub(skuDiscountPrice, unEnoughSku.get(0).getPriceDetailDTO().getCouponPrice()); - // 分摊到其他商品: 其他商品原优惠金额 + 差额 - calculateCartSkuPromotionsPrice(cartSkuVO, sub, promotionTypeEnum, activityId); - // 从不足商品列表中移除 - unEnoughSku.remove(0); - } - } - } else { - return; } - calculateNotEnoughPromotionsPrice(skuVOList, skuPromotionDetail, discountPrice, totalPrice, promotionTypeEnum, activityId); + } + + + private static void filterEnoughSku(List skuVOList, Map skuPromotionDetail, + Double discountPrice, Double totalPrice, + AtomicReference balance, StringBuilder lastSkuId, + PromotionTypeEnum promotionTypeEnum, String activityId) { + AtomicInteger count = new AtomicInteger(skuPromotionDetail.size()); + AtomicReference countPrice = new AtomicReference<>(0D); + for (String skuId : skuPromotionDetail.keySet()) { + skuVOList.forEach(l -> { + if (l.getGoodsSku().getId().equals(skuId)) { + count.getAndDecrement(); + + //商品金额占比 + double point = CurrencyUtil.div(l.getPriceDetailDTO().getGoodsPrice(), totalPrice, 4); + + //商品优惠金额 + Double skuDiscountPrice; + + if (count.get() > 0) { + //非最后一个商品,则按照比例计算 + skuDiscountPrice = CurrencyUtil.mul(discountPrice, point); + } else { + // 如果是最后一个商品 则减去之前优惠的金额来进行计算 + skuDiscountPrice = CurrencyUtil.sub(discountPrice, countPrice.get()); + + + } + + if (balance.get() > 0) { + // 分摊到其他商品: 其他商品原优惠金额 + 差额 + calculateCartSkuPromotionsPrice(l, balance.get(), promotionTypeEnum, activityId); + } + + // 如果商品优惠金额大于商品金额,则取商品金额。差额分摊到其他商品 + if (skuDiscountPrice > l.getPriceDetailDTO().getGoodsPrice()) { + balance.set(CurrencyUtil.sub(skuDiscountPrice, l.getPriceDetailDTO().getGoodsPrice())); + lastSkuId.append(skuId); + skuDiscountPrice = l.getPriceDetailDTO().getGoodsPrice(); + } else { + balance.set(0D); + } + + + countPrice.set(CurrencyUtil.add(countPrice.get(), skuDiscountPrice)); + + } + }); + } } /** From f2385c3ace613b4b8ec6c76e418be5f9850003aa Mon Sep 17 00:00:00 2001 From: Chopper711 Date: Sat, 14 Sep 2024 11:17:37 +0800 Subject: [PATCH 3/8] =?UTF-8?q?fix:=20=E8=AE=A2=E5=8D=95=E7=89=A9=E6=B5=81?= =?UTF-8?q?=E8=B4=B9=E7=94=A8=E5=B1=95=E7=A4=BA=E9=97=AE=E9=A2=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/lili/modules/order/order/entity/dos/Order.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java index f2fc6e88..0ffe52a0 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java @@ -243,7 +243,7 @@ public class Order extends BaseEntity { this.setDeliverStatus(DeliverStatusEnum.UNDELIVERED.name()); this.setTradeSn(tradeDTO.getSn()); this.setRemark(cartVO.getRemark()); - this.setFreightPrice(tradeDTO.getPriceDetailDTO().getFreightPrice()); + this.setFreightPrice(cartVO.getPriceDetailDTO().getFreightPrice()); //会员收件信息 if (tradeDTO.getMemberAddress() != null && DeliveryMethodEnum.LOGISTICS.name().equals(cartVO.getDeliveryMethod())) { this.setConsigneeAddressIdPath(tradeDTO.getMemberAddress().getConsigneeAddressIdPath()); From 30d6ab64f8aef7b120f444e1c9f1be39031bbc58 Mon Sep 17 00:00:00 2001 From: misworga831 Date: Sat, 14 Sep 2024 11:29:39 +0800 Subject: [PATCH 4/8] fix & improvement --- .../cn/lili/modules/member/serviceimpl/MemberServiceImpl.java | 2 +- .../modules/search/serviceimpl/EsGoodsSearchServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java index 04081748..469bfba7 100644 --- a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java @@ -233,7 +233,7 @@ public class MemberServiceImpl extends ServiceImpl impleme private Member findMember(String userName) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("username", userName).or().eq("mobile", userName); - return this.getOne(queryWrapper); + return this.getOne(queryWrapper, false); } @Override diff --git a/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsSearchServiceImpl.java b/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsSearchServiceImpl.java index 4f3dce1a..f752e4c5 100644 --- a/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsSearchServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsSearchServiceImpl.java @@ -88,7 +88,7 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService { cache.incrementScore(CachePrefix.HOT_WORD.getPrefix(), searchDTO.getKeyword()); } NativeSearchQueryBuilder searchQueryBuilder = createSearchQueryBuilder(searchDTO, pageVo); -// searchQueryBuilder.withCollapseField("goodsId"); +// searchQueryBuilder.withCollapseField("goodsId.keyword"); NativeSearchQuery searchQuery = searchQueryBuilder.build(); searchQuery.setTrackTotalHits(true); log.debug("searchGoods DSL:{}", searchQuery.getQuery()); From 42b3c72977aeab9b0d1d61bf184f1f1d3bd9c13b Mon Sep 17 00:00:00 2001 From: "pikachu1995@126.com" Date: Sat, 14 Sep 2024 16:11:05 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=8F=91=E8=B4=A7=E4=BF=A1=E6=81=AF=E5=BD=95=E5=85=A5?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF=EF=BC=8C=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E5=8F=91=E9=80=81=E4=BD=BF=E7=94=A8=E7=B3=BB=E7=BB=9F=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E9=85=8D=E7=BD=AE=E7=9A=84=E7=9F=AD=E4=BF=A1CODE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/impl/SmsUtilAliImplService.java | 18 +++++------------- .../serviceimpl/WechatMPServiceImpl.java | 4 ++-- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/sms/impl/SmsUtilAliImplService.java b/framework/src/main/java/cn/lili/modules/sms/impl/SmsUtilAliImplService.java index 5fb22310..1f994e7e 100644 --- a/framework/src/main/java/cn/lili/modules/sms/impl/SmsUtilAliImplService.java +++ b/framework/src/main/java/cn/lili/modules/sms/impl/SmsUtilAliImplService.java @@ -5,8 +5,6 @@ import cn.lili.cache.Cache; import cn.lili.cache.CachePrefix; import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; -import cn.lili.common.properties.SmsTemplateProperties; -import cn.lili.common.properties.SystemSettingProperties; import cn.lili.common.security.context.UserContext; import cn.lili.common.utils.CommonUtil; import cn.lili.modules.member.entity.dos.Member; @@ -48,12 +46,6 @@ public class SmsUtilAliImplService implements SmsUtil { @Autowired private SmsPluginFactory smsPluginFactory; - @Autowired - private SmsTemplateProperties smsTemplateProperties; - - @Autowired - private SystemSettingProperties systemSettingProperties; - @Override public void sendSmsCode(String mobile, VerificationEnums verificationEnums, String uuid) { //获取短信配置 @@ -78,18 +70,18 @@ public class SmsUtilAliImplService implements SmsUtil { switch (verificationEnums) { //登录 case LOGIN: { - templateCode = smsTemplateProperties.getLOGIN(); + templateCode = smsSetting.getLoginTemplateCode(); break; } //注册 case BIND_MOBILE: case REGISTER: { - templateCode = smsTemplateProperties.getREGISTER(); + templateCode = smsSetting.getRegisterTemplateCode(); break; } //找回密码 case FIND_USER: { - templateCode = smsTemplateProperties.getFIND_USER(); + templateCode = smsSetting.getFindPasswordTemplateCode(); break; } //修改密码 @@ -100,7 +92,7 @@ public class SmsUtilAliImplService implements SmsUtil { } //更新为用户最新手机号 mobile = member.getMobile(); - templateCode = smsTemplateProperties.getUPDATE_PASSWORD(); + templateCode = smsSetting.getFindPasswordTemplateCode(); break; } //设置支付密码 @@ -108,7 +100,7 @@ public class SmsUtilAliImplService implements SmsUtil { Member member = memberService.getById(UserContext.getCurrentUser().getId()); //更新为用户最新手机号 mobile = member.getMobile(); - templateCode = smsTemplateProperties.getWALLET_PASSWORD(); + templateCode = smsSetting.getWalletPasswordTemplateCode(); break; } //如果不是有效的验证码手段,则此处不进行短信操作 diff --git a/framework/src/main/java/cn/lili/modules/wechat/serviceimpl/WechatMPServiceImpl.java b/framework/src/main/java/cn/lili/modules/wechat/serviceimpl/WechatMPServiceImpl.java index 73cb6f91..4053e3a3 100644 --- a/framework/src/main/java/cn/lili/modules/wechat/serviceimpl/WechatMPServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/wechat/serviceimpl/WechatMPServiceImpl.java @@ -137,7 +137,7 @@ public class WechatMPServiceImpl implements WechatMPService { map.put("upload_time", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now())); //支付者,支付者信息 - Connect connect = connectService.queryConnect(ConnectQueryDTO.builder().userId(UserContext.getCurrentUser().getId()).unionType(SourceEnum.WECHAT_MP_OPEN_ID.name()).build()); + Connect connect = connectService.queryConnect(ConnectQueryDTO.builder().userId(order.getMemberId()).unionType(SourceEnum.WECHAT_MP_OPEN_ID.name()).build()); if (connect == null) { return; } @@ -263,7 +263,7 @@ public class WechatMPServiceImpl implements WechatMPService { private String out_trade_no; public OrderKey(Order order) { - this.order_number_type = 2; + this.order_number_type = 1; this.out_trade_no = order.getPayOrderNo(); this.transaction_id = order.getReceivableNo(); } From fd067d8abfdff47d12e5d14a34de5b2e8cca6e9a Mon Sep 17 00:00:00 2001 From: Chopper711 <1814994716@qq.com> Date: Wed, 18 Sep 2024 02:09:02 +0000 Subject: [PATCH 6/8] =?UTF-8?q?update=20DB/version4.3toMASTER.sql.=20?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E6=A0=87=E7=82=B9=E7=AC=A6=E5=8F=B7=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E6=97=A0=E6=B3=95=E4=B8=80=E6=AC=A1=E6=80=A7=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=20sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chopper711 <1814994716@qq.com> --- DB/version4.3toMASTER.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DB/version4.3toMASTER.sql b/DB/version4.3toMASTER.sql index eba294c6..84de6e6b 100644 --- a/DB/version4.3toMASTER.sql +++ b/DB/version4.3toMASTER.sql @@ -105,7 +105,7 @@ WHERE sf.flow_type = 'REFUND' AND sf.store_id=b.store_id AND sf.create_time BETWEEN b.start_time - AND b.end_time),0) + AND b.end_time),0); UPDATE li_bill b SET b.kanjia_refund_settlement_price =IFNULL(( From 16ae69ed06927aec83c77bd0aa16eef963c0e6f2 Mon Sep 17 00:00:00 2001 From: Chopper711 Date: Wed, 18 Sep 2024 12:24:11 +0800 Subject: [PATCH 7/8] =?UTF-8?q?fix:=20=E8=84=9A=E6=9C=AC=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E9=99=90=E6=B5=81=E8=84=9A=E6=9C=AC=E6=97=A0?= =?UTF-8?q?=E6=95=88=EF=BC=8C=E4=B8=8D=E7=A1=AE=E5=AE=9A=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=98=AF=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7=E5=B8=A6=E6=9D=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- framework/src/main/resources/script/limit.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/main/resources/script/limit.lua b/framework/src/main/resources/script/limit.lua index e9d5b41e..6fc7fd7e 100644 --- a/framework/src/main/resources/script/limit.lua +++ b/framework/src/main/resources/script/limit.lua @@ -2,7 +2,7 @@ local c c = redis.call('get',KEYS[1]) -- 调用不超过最大值,则直接返回 if c and tonumber(c) > tonumber(ARGV[1]) then - return c; + return tonumber(c); end -- 执行计算器自加 c = redis.call('incr',KEYS[1]) From 35739b64a345d1278e2ac7595b92e713ceb87861 Mon Sep 17 00:00:00 2001 From: Chopper711 Date: Wed, 18 Sep 2024 14:20:13 +0800 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20=E9=83=A8=E5=88=86=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ersion4.3toMASTER.sql => version4.3to4.4.sql} | 16 ---------------- 1 file changed, 16 deletions(-) rename DB/{version4.3toMASTER.sql => version4.3to4.4.sql} (96%) diff --git a/DB/version4.3toMASTER.sql b/DB/version4.3to4.4.sql similarity index 96% rename from DB/version4.3toMASTER.sql rename to DB/version4.3to4.4.sql index 84de6e6b..18f00388 100644 --- a/DB/version4.3toMASTER.sql +++ b/DB/version4.3to4.4.sql @@ -68,8 +68,6 @@ CREATE TABLE `li_order_package_item` ( */ ALTER TABLE li_order_item ADD `deliver_number` int DEFAULT NULL COMMENT '发货数量'; -ALTER TABLE li_goods_sku ADD `alert_quantity` int DEFAULT NULL COMMENT '预警库存'; - /* sku增加预警库存 */ @@ -119,20 +117,6 @@ SET b.kanjia_refund_settlement_price =IFNULL(( AND sf.create_time BETWEEN b.start_time AND b.end_time),0); - - -/** - 交易唤醒表,增加交易流水详情 - */ -ALTER TABLE li_order_item ADD `is_refund` varchar(255) DEFAULT NULL COMMENT '是否退款'; - -/** - 交易表增加订单状态字段 - */ -ALTER TABLE li_order_item ADD `refund_price` decimal(10,2) DEFAULT NULL COMMENT '退款金额'; - - - /** 文件表增加拥有者名称 */