|
|
|
@@ -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; |
|
|
|
|