From 4572de1f83947d9f0b7480c28a34a7617d5e7fdf Mon Sep 17 00:00:00 2001 From: winter <664946893@qq.com> Date: Sat, 27 May 2023 18:26:57 +0800 Subject: [PATCH] fix --- .../controller/base/DouyinBaseController.java | 9 +------- .../enums/EnumDouyinApplicationVersion.java | 12 ++++++++++ .../impl/TtGoodsCategoryServiceImpl.java | 7 +++--- .../pay/service/fee/TtServiceFeeService.java | 23 ++++++++++++++++++- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/base/DouyinBaseController.java b/mallinkAdmin/src/main/java/com/iformall/controller/base/DouyinBaseController.java index d436c20ec..e11a3f191 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/base/DouyinBaseController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/base/DouyinBaseController.java @@ -28,13 +28,6 @@ public class DouyinBaseController extends BaseController{ public boolean isGoodLifeSaas() throws Exception{ Integer _e = getCurrentApplicationVersion(); - if (_e.intValue() == EnumDouyinApplicationVersion.GOODLIFE_SAAS.getCode().intValue()) { - return true; - }else if (_e.intValue() == EnumDouyinApplicationVersion.WEB.getCode().intValue()) { - return false; - }else { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"mallVersion[douyinApplicationVersion]配置错误"); - } + return EnumDouyinApplicationVersion.isSaas(_e); } - } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumDouyinApplicationVersion.java b/mallinkService/src/main/java/com/iformall/enums/EnumDouyinApplicationVersion.java index 43949b7f5..bb95abd98 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumDouyinApplicationVersion.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumDouyinApplicationVersion.java @@ -1,5 +1,7 @@ package com.iformall.enums; +import com.iformall.common.ErrorCode; +import com.iformall.exception.MallinkException; /** * @author gongbiao @@ -34,4 +36,14 @@ public enum EnumDouyinApplicationVersion { return message; } + public static boolean isSaas(Integer code) throws Exception{ + if (code.intValue() == EnumDouyinApplicationVersion.GOODLIFE_SAAS.getCode().intValue()) { + return true; + }else if (code.intValue() == EnumDouyinApplicationVersion.WEB.getCode().intValue()) { + return false; + }else { + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"mallVersion[douyinApplicationVersion]配置错误"); + } + } + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java index c92222d2c..580add406 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java @@ -10,6 +10,7 @@ import com.iformall.domain.po.TtGoodsCategoryNew; import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.po.base.TenantEntity; +import com.iformall.douyin.web.api.goodlifesaas.TtGoodLifeSaasService; import com.iformall.douyin.web.api.web.TtWebService; import com.iformall.douyin.web.bean.GoodsCategory; import com.iformall.douyin.web.bean.GoodsTemplateGet; @@ -588,7 +589,7 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { }else { TenantEntity defaultEntity = new TenantEntity(); defaultEntity.setTenantId("789"); - TtWebService ttWebService = ttMerchantPoiService.getTtMiniAppService(defaultEntity); + TtGoodLifeSaasService ttWebService = ttMerchantPoiService.getTtGoodLifeSassService(defaultEntity); handSyncCategoryForNew(ttWebService,0,new Date()); } } @@ -605,7 +606,7 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { if (isNew) { TenantEntity defaultEntity = new TenantEntity(); defaultEntity.setTenantId("789"); - TtWebService ttWebService = ttMerchantPoiService.getTtMiniAppService(defaultEntity); + TtGoodLifeSaasService ttWebService = ttMerchantPoiService.getTtGoodLifeSassService(defaultEntity); goodsCategories = ttWebService.getGoodLifeSaasGoodsService().categoryGet(categoryId, null); }else { TtWebService ttWebService = ttMerchantPoiService.getTtWebService(null); @@ -712,7 +713,7 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { } - private void handSyncCategoryForNew(TtWebService ttWebService,Integer category_id,Date now){ + private void handSyncCategoryForNew(TtGoodLifeSaasService ttWebService,Integer category_id,Date now){ try { List goodsCategories = ttWebService.getGoodLifeSaasGoodsService().categoryGet(category_id, null); if(goodsCategories != null){ diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/fee/TtServiceFeeService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/fee/TtServiceFeeService.java index 613bf15ae..6457b89b7 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/fee/TtServiceFeeService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/fee/TtServiceFeeService.java @@ -1,20 +1,27 @@ package com.iformall.service.pay.service.fee; +import com.iformall.common.ErrorCode; import com.iformall.domain.po.TtPoiTakeRate; +import com.iformall.domain.po.WxMallVersion; import com.iformall.domain.po.WxOrder; import com.iformall.domain.po.WxPayAccount; import com.iformall.domain.po.base.TenantEntity; import com.iformall.enums.EnumCpsPlanType; +import com.iformall.enums.EnumDouyinApplicationVersion; import com.iformall.enums.EnumOrderType; import com.iformall.enums.EnumYesOrNo; +import com.iformall.exception.MallinkException; import com.iformall.mapper.TtPoiTakeRateMapper; import com.iformall.mapper.WxCouponMapper; import com.iformall.mapper.WxOrderMapper; import com.iformall.service.TtGoodsCategoryService; import com.iformall.service.TtMallGoodsCategoryService; import com.iformall.service.WxCouponService; +import com.iformall.service.WxMallService; + import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @Slf4j @@ -35,6 +42,10 @@ public class TtServiceFeeService implements ServiceFeeAdapterService{ @Autowired TtMallGoodsCategoryService ttMallGoodsCategoryService; + + @Lazy + @Autowired + WxMallService wxMallService; @Override @@ -49,7 +60,17 @@ public class TtServiceFeeService implements ServiceFeeAdapterService{ @Override public int getOfficialCommission(Integer categoryId, WxPayAccount payAccount) { if(categoryId != null){ - int ttServiceFee = ttGoodsCategoryService.getTtServiceFee(categoryId); + WxMallVersion mv = wxMallService.getMallVersion(payAccount); + if (null == mv || null == mv.getDouyinApplicationVersion()) { + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"mallVersion[douyinApplicationVersion]未配置"); + } + boolean isSaas; + try { + isSaas = EnumDouyinApplicationVersion.isSaas(mv.getDouyinApplicationVersion()); + } catch (Exception e) { + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + int ttServiceFee = ttGoodsCategoryService.getTtServiceFee(categoryId,isSaas); int realRate = this.getRealRate(payAccount); if(ttServiceFee > realRate){ return ttServiceFee - realRate;