From 3f716c3036726a65ff9aa5fa86d52a549969ecf0 Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Tue, 23 Sep 2025 01:31:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E9=A9=BB=E5=88=86=E8=B4=A6=E6=AF=94?= =?UTF-8?q?=E4=BE=8B=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=9C=89=E5=80=BC=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/LakalaApiServiceImpl.java | 3 +- .../service/impl/SFExpressApiServiceImpl.java | 2 +- .../store/service/ShopMchEntryService.java | 2 +- .../service/impl/ShopMchEntryServiceImpl.java | 7 +- .../impl/ShopStoreBaseServiceImpl.java | 114 +++++++++++++++--- 5 files changed, 107 insertions(+), 21 deletions(-) diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LakalaApiServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LakalaApiServiceImpl.java index 2b4bda18..37c7dcde 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LakalaApiServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LakalaApiServiceImpl.java @@ -11,7 +11,6 @@ package com.suisung.mall.shop.lakala.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.convert.Convert; -import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONArray; @@ -502,7 +501,7 @@ public class LakalaApiServiceImpl implements LakalaApiService { } ecParams.put("E3", "1"); - ecParams.put("E4", NumberUtil.toStr(shopMchEntry.getSplit_ratio(), splitLowestRatio)); + ecParams.put("E4", splitLowestRatio); // 商家签合同最低比例,直接分账根据入驻时平台给的比例来计算。 ecParams.put("E7", signDate); ecParams.put("E8", shopMchEntry.getAccount_holder_name()); diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/sfexpress/service/impl/SFExpressApiServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/sfexpress/service/impl/SFExpressApiServiceImpl.java index 9b5df0e2..76bb25a3 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/sfexpress/service/impl/SFExpressApiServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/sfexpress/service/impl/SFExpressApiServiceImpl.java @@ -118,7 +118,7 @@ public class SFExpressApiServiceImpl implements SFExpressApiService { ShopMchEntry shopMchEntry; if (ObjectUtil.isEmpty(mchId)) { - shopMchEntry = shopMchEntryService.shopMerchEntryByStoreId(storeId); + shopMchEntry = shopMchEntryService.getShopMerchEntryByStoreId(storeId); } else { shopMchEntry = shopMchEntryService.shopMerchEntryById(mchId); } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java index 387d8e0b..c01cb824 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java @@ -114,7 +114,7 @@ public interface ShopMchEntryService { * @param storeId * @return */ - ShopMchEntry shopMerchEntryByStoreId(Integer storeId); + ShopMchEntry getShopMerchEntryByStoreId(Integer storeId); /** diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java index 90dad086..189b1470 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java @@ -912,12 +912,15 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl= 0 || record.getSplit_ratio().compareTo(new BigDecimal(100)) >= 0) { // 自动计算商家分成比例 splitRatio = shopBaseStoreCategoryService.getStoreCategoryRatio(record.getBiz_category()); - if (splitRatio == null || splitRatio.compareTo(BigDecimal.ZERO) <= 0) { + if (splitRatio == null + || splitRatio.compareTo(BigDecimal.ZERO) <= 0 + || splitRatio.compareTo(new BigDecimal(100)) >= 0) { splitRatio = new BigDecimal(94); } } @@ -1173,7 +1176,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl 0) { - splitRatio = defaultSplitRatio; + log.warn("店铺分类分账比例为空,使用默认分账比例: {}", defaultSplitRatio); + splitRatio = defaultSplitRatio; // 默认 94% } } + // 确保比例在有效范围内 (0%, 100%) + if (splitRatio != null && (splitRatio.compareTo(BigDecimal.ZERO) <= 0 || splitRatio.compareTo(BigDecimal.valueOf(100)) >= 0)) { + log.warn("分账比例超出有效范围 (0, 100),使用默认分账比例: {},当前比例: {}", defaultSplitRatio, splitRatio); + splitRatio = defaultSplitRatio; + } + + log.info("获取店铺分账比例完成,storeId={}, splitRatio={}", storeId, splitRatio); return splitRatio; } + /** * 修改店铺的营业状态 * @@ -4090,6 +4132,48 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl= 0) { + log.warn("更新店铺分账比例参数校验失败,splitRatio 值无效"); + return false; + } + + try { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("store_id", storeId); + updateWrapper.set("split_ratio", splitRatio); + + boolean result = update(updateWrapper); + if (result) { + log.info("店铺分账比例更新成功,storeId={}, splitRatio={}", storeId, splitRatio); + } else { + log.warn("店铺分账比例更新失败,storeId={}, splitRatio={}", storeId, splitRatio); + } + + return result; + } catch (Exception e) { + log.error("更新店铺分账比例时发生异常,storeId={}, splitRatio={}", storeId, splitRatio, e); + return false; + } + } + + // @Override // public Page getMobileStoreList(Integer page, Integer rows) { // QueryWrapper queryWrapper=new QueryWrapper<>();