| @@ -28,13 +28,6 @@ public class DouyinBaseController extends BaseController{ | |||||
| public boolean isGoodLifeSaas() throws Exception{ | public boolean isGoodLifeSaas() throws Exception{ | ||||
| Integer _e = getCurrentApplicationVersion(); | 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); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,7 @@ | |||||
| package com.iformall.enums; | package com.iformall.enums; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.exception.MallinkException; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| @@ -34,4 +36,14 @@ public enum EnumDouyinApplicationVersion { | |||||
| return message; | 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]配置错误"); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.TtGoodsCategoryNew; | |||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.po.base.TenantEntity; | 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.api.web.TtWebService; | ||||
| import com.iformall.douyin.web.bean.GoodsCategory; | import com.iformall.douyin.web.bean.GoodsCategory; | ||||
| import com.iformall.douyin.web.bean.GoodsTemplateGet; | import com.iformall.douyin.web.bean.GoodsTemplateGet; | ||||
| @@ -588,7 +589,7 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { | |||||
| }else { | }else { | ||||
| TenantEntity defaultEntity = new TenantEntity(); | TenantEntity defaultEntity = new TenantEntity(); | ||||
| defaultEntity.setTenantId("789"); | defaultEntity.setTenantId("789"); | ||||
| TtWebService ttWebService = ttMerchantPoiService.getTtMiniAppService(defaultEntity); | |||||
| TtGoodLifeSaasService ttWebService = ttMerchantPoiService.getTtGoodLifeSassService(defaultEntity); | |||||
| handSyncCategoryForNew(ttWebService,0,new Date()); | handSyncCategoryForNew(ttWebService,0,new Date()); | ||||
| } | } | ||||
| } | } | ||||
| @@ -605,7 +606,7 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { | |||||
| if (isNew) { | if (isNew) { | ||||
| TenantEntity defaultEntity = new TenantEntity(); | TenantEntity defaultEntity = new TenantEntity(); | ||||
| defaultEntity.setTenantId("789"); | defaultEntity.setTenantId("789"); | ||||
| TtWebService ttWebService = ttMerchantPoiService.getTtMiniAppService(defaultEntity); | |||||
| TtGoodLifeSaasService ttWebService = ttMerchantPoiService.getTtGoodLifeSassService(defaultEntity); | |||||
| goodsCategories = ttWebService.getGoodLifeSaasGoodsService().categoryGet(categoryId, null); | goodsCategories = ttWebService.getGoodLifeSaasGoodsService().categoryGet(categoryId, null); | ||||
| }else { | }else { | ||||
| TtWebService ttWebService = ttMerchantPoiService.getTtWebService(null); | 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 { | try { | ||||
| List<GoodsCategory> goodsCategories = ttWebService.getGoodLifeSaasGoodsService().categoryGet(category_id, null); | List<GoodsCategory> goodsCategories = ttWebService.getGoodLifeSaasGoodsService().categoryGet(category_id, null); | ||||
| if(goodsCategories != null){ | if(goodsCategories != null){ | ||||
| @@ -1,20 +1,27 @@ | |||||
| package com.iformall.service.pay.service.fee; | package com.iformall.service.pay.service.fee; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.domain.po.TtPoiTakeRate; | import com.iformall.domain.po.TtPoiTakeRate; | ||||
| import com.iformall.domain.po.WxMallVersion; | |||||
| import com.iformall.domain.po.WxOrder; | import com.iformall.domain.po.WxOrder; | ||||
| import com.iformall.domain.po.WxPayAccount; | import com.iformall.domain.po.WxPayAccount; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumCpsPlanType; | import com.iformall.enums.EnumCpsPlanType; | ||||
| import com.iformall.enums.EnumDouyinApplicationVersion; | |||||
| import com.iformall.enums.EnumOrderType; | import com.iformall.enums.EnumOrderType; | ||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.TtPoiTakeRateMapper; | import com.iformall.mapper.TtPoiTakeRateMapper; | ||||
| import com.iformall.mapper.WxCouponMapper; | import com.iformall.mapper.WxCouponMapper; | ||||
| import com.iformall.mapper.WxOrderMapper; | import com.iformall.mapper.WxOrderMapper; | ||||
| import com.iformall.service.TtGoodsCategoryService; | import com.iformall.service.TtGoodsCategoryService; | ||||
| import com.iformall.service.TtMallGoodsCategoryService; | import com.iformall.service.TtMallGoodsCategoryService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.service.WxMallService; | |||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.context.annotation.Lazy; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @Slf4j | @Slf4j | ||||
| @@ -35,6 +42,10 @@ public class TtServiceFeeService implements ServiceFeeAdapterService{ | |||||
| @Autowired | @Autowired | ||||
| TtMallGoodsCategoryService ttMallGoodsCategoryService; | TtMallGoodsCategoryService ttMallGoodsCategoryService; | ||||
| @Lazy | |||||
| @Autowired | |||||
| WxMallService wxMallService; | |||||
| @Override | @Override | ||||
| @@ -49,7 +60,17 @@ public class TtServiceFeeService implements ServiceFeeAdapterService{ | |||||
| @Override | @Override | ||||
| public int getOfficialCommission(Integer categoryId, WxPayAccount payAccount) { | public int getOfficialCommission(Integer categoryId, WxPayAccount payAccount) { | ||||
| if(categoryId != null){ | 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); | int realRate = this.getRealRate(payAccount); | ||||
| if(ttServiceFee > realRate){ | if(ttServiceFee > realRate){ | ||||
| return ttServiceFee - realRate; | return ttServiceFee - realRate; | ||||