| @@ -0,0 +1,2 @@ | |||||
| INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (1103, '抖音类目佣金设置', 100, 'Y', NULL, 1, NULL, NULL, 'goodsCategory', 'icon-shenpiguanli', 0, 1103); | |||||
| @@ -72,6 +72,9 @@ public class WxPayAccount extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否抽成",name="isCommission") | @io.swagger.annotations.ApiModelProperty(value="是否抽成",name="isCommission") | ||||
| private Integer isCommission; | private Integer isCommission; | ||||
| /** | |||||
| * 微信适用。抖音通过类别获取 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="系统提点",name="systemRate") | @io.swagger.annotations.ApiModelProperty(value="系统提点",name="systemRate") | ||||
| private Integer systemRate; | private Integer systemRate; | ||||
| @io.swagger.annotations.ApiModelProperty(value="销售提点",name="sellRate") | @io.swagger.annotations.ApiModelProperty(value="销售提点",name="sellRate") | ||||
| @@ -49,4 +49,6 @@ public interface TtGoodsCategoryService { | |||||
| void updateFee(TtGoodsCategory record); | void updateFee(TtGoodsCategory record); | ||||
| int getTtServiceFee(Integer categoryId); | |||||
| } | } | ||||
| @@ -14,4 +14,6 @@ public interface TtMallGoodsCategoryService { | |||||
| void updateFee(TtMallGoodsCategoryVo record); | void updateFee(TtMallGoodsCategoryVo record); | ||||
| int getMallSoftwareFee(TenantEntity tenantEntity,Integer categoryId); | |||||
| } | } | ||||
| @@ -7,11 +7,7 @@ import javax.servlet.http.HttpServletResponse; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.TtCouponChannelPoi; | |||||
| import com.iformall.domain.po.WxAppinfo; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxMall; | |||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.TtCouponVo; | import com.iformall.domain.vo.TtCouponVo; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| @@ -303,4 +299,6 @@ public interface WxCouponService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| boolean isCouponMerchantValid(Long couponId,Integer couponType,TenantEntity couponTenantEntity); | boolean isCouponMerchantValid(Long couponId,Integer couponType,TenantEntity couponTenantEntity); | ||||
| Integer getCategoryId(TenantEntity tenantEntity, Long couponId); | |||||
| } | } | ||||
| @@ -19,6 +19,8 @@ import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.service.pay.PayServiceFactory; | |||||
| import com.iformall.service.pay.service.fee.ServiceFeeAdapterService; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import me.chanjar.weixin.common.error.WxErrorException; | import me.chanjar.weixin.common.error.WxErrorException; | ||||
| @@ -81,7 +83,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| TtPoiTakeRateMapper ttPoiTakeRateMapper; | TtPoiTakeRateMapper ttPoiTakeRateMapper; | ||||
| @Autowired | @Autowired | ||||
| TtGoodsCategoryMapper ttGoodsCategoryMapper; | |||||
| TtGoodsCategoryService ttGoodsCategoryService; | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| @@ -91,6 +93,9 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| @Autowired | @Autowired | ||||
| WxMerchantService wxMerchantService; | WxMerchantService wxMerchantService; | ||||
| @Autowired | |||||
| PayServiceFactory payServiceFactory; | |||||
| // @Override | // @Override | ||||
| // public ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { | // public ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { | ||||
| // PageInfo<TtCouponVo> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.ttCouponList(ttCouponVo)); | // PageInfo<TtCouponVo> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.ttCouponList(ttCouponVo)); | ||||
| @@ -940,13 +945,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * 删除定向计划里的达人,并处理达人数据 | |||||
| * 只能一个个删除,有可能删除失败 | |||||
| * @param ttWebService | |||||
| * @param takeRate | |||||
| * @return | |||||
| */ | |||||
| // /** | |||||
| // * 删除定向计划里的达人,并处理达人数据 | |||||
| // * 只能一个个删除,有可能删除失败 | |||||
| // * @param ttWebService | |||||
| // * @param takeRate | |||||
| // * @return | |||||
| // */ | |||||
| // private void poiOrientedPlanDeleteTalent(TtWebService ttWebService,TtPoiTakeRate takeRate){ | // private void poiOrientedPlanDeleteTalent(TtWebService ttWebService,TtPoiTakeRate takeRate){ | ||||
| // if(takeRate == null || takeRate.getId() == null | // if(takeRate == null || takeRate.getId() == null | ||||
| // || takeRate.getDouyinIdList() == null || takeRate.getDouyinIdList().isEmpty()){ | // || takeRate.getDouyinIdList() == null || takeRate.getDouyinIdList().isEmpty()){ | ||||
| @@ -1090,9 +1095,11 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| TtPoiTakeRate ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(tenantInfo.getTenantId(), couponId,EnumCpsPlanType.ALL.getCode()); | TtPoiTakeRate ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(tenantInfo.getTenantId(), couponId,EnumCpsPlanType.ALL.getCode()); | ||||
| Map<String,Object> map = new HashMap<>(); | Map<String,Object> map = new HashMap<>(); | ||||
| if(ttPoiTakeRate != null){ | |||||
| map.put("mallRate",ttPoiTakeRate.getTakeRate()); | |||||
| int mallRate = 0; | |||||
| if(ttPoiTakeRate != null && ttPoiTakeRate.getTakeRate() != null){ | |||||
| mallRate = ttPoiTakeRate.getTakeRate(); | |||||
| } | } | ||||
| map.put("mallRate",mallRate); | |||||
| WxAppinfo couponAppInfo = wxAppinfoService.getCouponAppInfo(wxCoupon); | WxAppinfo couponAppInfo = wxAppinfoService.getCouponAppInfo(wxCoupon); | ||||
| if(couponAppInfo == null || couponAppInfo.getPayId() == null){ | if(couponAppInfo == null || couponAppInfo.getPayId() == null){ | ||||
| @@ -1103,27 +1110,19 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| return new ResultData(ErrorCode.API_KEY_NOT_FOUND); | return new ResultData(ErrorCode.API_KEY_NOT_FOUND); | ||||
| } | } | ||||
| map.put("realRate",payAccount.getRealRate()); | |||||
| int rate = 0; | |||||
| if(EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ | |||||
| map.put("systemRate",payAccount.getSystemRate()+payAccount.getSellRate()); | |||||
| rate = payAccount.getRealRate()+payAccount.getSystemRate()+payAccount.getSellRate(); | |||||
| }else{ | |||||
| rate = payAccount.getRealRate(); | |||||
| } | |||||
| if(EnumAppPlat.TOUTIAO.getCode().equals(couponAppInfo.getPlat())){ | |||||
| if(wxCoupon.getCategoryId() == null){ | |||||
| return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误"); | |||||
| } | |||||
| TtGoodsCategory ttGoodsCategory = ttGoodsCategoryMapper.selectById(wxCoupon.getCategoryId()); | |||||
| map.put("serviceFeeRate",ttGoodsCategory.getServiceFee()-payAccount.getRealRate()); | |||||
| rate = rate-payAccount.getRealRate()+ttGoodsCategory.getServiceFee(); | |||||
| Integer maxTakeRate = ttPoiTakeRateMapper.getMaxTakeRate(wxCoupon.getTenantId(), wxCoupon.getId()); | |||||
| if(maxTakeRate != null){ | |||||
| rate += maxTakeRate; | |||||
| } | |||||
| ServiceFeeAdapterService serviceFeeService = payServiceFactory.getServiceFeeAdapterService(couponAppInfo.getPlat()); | |||||
| int realRate = serviceFeeService.getRealRate(payAccount); | |||||
| map.put("realRate",realRate); | |||||
| int systemCommission = serviceFeeService.getSystemCommission(wxCoupon.getCategoryId(),payAccount); | |||||
| int sellCommission = serviceFeeService.getSellCommission(payAccount); | |||||
| map.put("systemRate",systemCommission + sellCommission); | |||||
| int officialCommission = serviceFeeService.getOfficialCommission(wxCoupon.getCategoryId(), payAccount); | |||||
| map.put("serviceFeeRate",officialCommission); | |||||
| Integer maxTakeRate = ttPoiTakeRateMapper.getMaxTakeRate(wxCoupon.getTenantId(), wxCoupon.getId()); | |||||
| if(maxTakeRate == null){ | |||||
| maxTakeRate = 0; | |||||
| } | } | ||||
| int rate = realRate + systemCommission + sellCommission + officialCommission + maxTakeRate; | |||||
| map.put("mallMax",getAllMax()); | map.put("mallMax",getAllMax()); | ||||
| map.put("mallMin",rate); | map.put("mallMin",rate); | ||||
| @@ -1158,8 +1157,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); | throw new MallinkException(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); | ||||
| } | } | ||||
| TtPoiTakeRate ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(wxCoupon.getTenantId(), wxCoupon.getId(),EnumCpsPlanType.ALL.getCode()); | TtPoiTakeRate ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(wxCoupon.getTenantId(), wxCoupon.getId(),EnumCpsPlanType.ALL.getCode()); | ||||
| Integer takeRate = null; | |||||
| if(ttPoiTakeRate != null){ | |||||
| int takeRate = 0; | |||||
| if(ttPoiTakeRate != null && ttPoiTakeRate.getTakeRate() != null){ | |||||
| takeRate = ttPoiTakeRate.getTakeRate(); | takeRate = ttPoiTakeRate.getTakeRate(); | ||||
| }else{ | }else{ | ||||
| return getAllMax(); | return getAllMax(); | ||||
| @@ -1173,20 +1172,14 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| if(payAccount == null){ | if(payAccount == null){ | ||||
| throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); | throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); | ||||
| } | } | ||||
| int rate = 0; | |||||
| rate = payAccount.getRealRate()+payAccount.getSystemRate()+payAccount.getSellRate(); | |||||
| if(EnumAppPlat.TOUTIAO.getCode().equals(couponAppInfo.getPlat())){ | |||||
| if(wxCoupon.getCategoryId() == null){ | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误"); | |||||
| } | |||||
| TtGoodsCategory ttGoodsCategory = ttGoodsCategoryMapper.selectById(wxCoupon.getCategoryId()); | |||||
| rate = rate-payAccount.getRealRate()+ttGoodsCategory.getServiceFee(); | |||||
| } | |||||
| int rate = getOtherAllFee(couponAppInfo,payAccount,wxCoupon.getCategoryId()); | |||||
| if(takeRate > rate){ | if(takeRate > rate){ | ||||
| rate = takeRate - rate; | rate = takeRate - rate; | ||||
| return rate; | return rate; | ||||
| }else{ | }else{ | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"分佣率异常"); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"分佣率设置异常"); | |||||
| } | } | ||||
| } | } | ||||
| //达人分佣率最小值 | //达人分佣率最小值 | ||||
| @@ -1216,23 +1209,31 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| if(payAccount == null){ | if(payAccount == null){ | ||||
| throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); | throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); | ||||
| } | } | ||||
| int rate = 0; | |||||
| if(EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ | |||||
| rate = payAccount.getRealRate()+payAccount.getSystemRate()+payAccount.getSellRate(); | |||||
| }else{ | |||||
| rate = payAccount.getRealRate(); | |||||
| } | |||||
| if(EnumAppPlat.TOUTIAO.getCode().equals(couponAppInfo.getPlat())){ | |||||
| if(wxCoupon.getCategoryId() == null){ | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误"); | |||||
| } | |||||
| TtGoodsCategory ttGoodsCategory = ttGoodsCategoryMapper.selectById(wxCoupon.getCategoryId()); | |||||
| rate = rate-payAccount.getRealRate()+ttGoodsCategory.getServiceFee(); | |||||
| Integer maxTakeRate = ttPoiTakeRateMapper.getMaxTakeRate(wxCoupon.getTenantId(), wxCoupon.getId()); | |||||
| if(maxTakeRate != null){ | |||||
| rate += maxTakeRate; | |||||
| } | |||||
| int rate = getOtherAllFee(couponAppInfo,payAccount,wxCoupon.getCategoryId()); | |||||
| Integer maxTakeRate = ttPoiTakeRateMapper.getMaxTakeRate(wxCoupon.getTenantId(), wxCoupon.getId()); | |||||
| if(maxTakeRate == null){ | |||||
| maxTakeRate = 0; | |||||
| } | } | ||||
| return rate + maxTakeRate; | |||||
| } | |||||
| /** | |||||
| * 获取支付渠道费+系统服务费+销售抽成+平台服务费 | |||||
| * @param appinfo | |||||
| * @param payAccount | |||||
| * @param categoryId | |||||
| * @return | |||||
| */ | |||||
| private int getOtherAllFee(WxAppinfo appinfo,WxPayAccount payAccount,Integer categoryId){ | |||||
| ServiceFeeAdapterService serviceFeeService = payServiceFactory.getServiceFeeAdapterService(appinfo.getPlat()); | |||||
| int realRate = serviceFeeService.getRealRate(payAccount); | |||||
| int systemCommission = serviceFeeService.getSystemCommission(categoryId,payAccount); | |||||
| int sellCommission = serviceFeeService.getSellCommission(payAccount); | |||||
| int officialCommission = serviceFeeService.getOfficialCommission(categoryId, payAccount); | |||||
| int rate = realRate + systemCommission + sellCommission + officialCommission; | |||||
| return rate; | return rate; | ||||
| } | } | ||||
| @@ -552,6 +552,15 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public int getTtServiceFee(Integer categoryId) { | |||||
| TtGoodsCategory goodsCategory = ttGoodsCategoryMapper.selectById(categoryId); | |||||
| if(goodsCategory != null){ | |||||
| return goodsCategory.getServiceFee(); | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| /** | /** | ||||
| * 循环同步类目 | * 循环同步类目 | ||||
| * @param ttWebService | * @param ttWebService | ||||
| @@ -85,6 +85,23 @@ public class TtMallGoodsCategoryServiceImpl implements TtMallGoodsCategoryServic | |||||
| updateFeeByIds(record,record.getCategoryId(),record.getMallSoftwareFee(),new Date()); | updateFeeByIds(record,record.getCategoryId(),record.getMallSoftwareFee(),new Date()); | ||||
| } | } | ||||
| @Override | |||||
| public int getMallSoftwareFee(TenantEntity tenantEntity, Integer categoryId) { | |||||
| TtMallGoodsCategory mallGoodsCategory = new TtMallGoodsCategory(); | |||||
| mallGoodsCategory.setGoodsCategoryId(categoryId); | |||||
| mallGoodsCategory.updateTenantInfo(tenantEntity); | |||||
| mallGoodsCategory = ttMallGoodsCategoryMapper.selectByTenantAndCategoryId(mallGoodsCategory); | |||||
| if(mallGoodsCategory != null){ | |||||
| return mallGoodsCategory.getSoftwareFee(); | |||||
| }else{ | |||||
| TtGoodsCategory goodsCategory = ttGoodsCategoryMapper.selectById(categoryId); | |||||
| if(goodsCategory != null){ | |||||
| return goodsCategory.getSoftwareFee(); | |||||
| } | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| /** | /** | ||||
| * 循环修改费率 | * 循环修改费率 | ||||
| */ | */ | ||||
| @@ -1967,5 +1967,10 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| return false; | return false; | ||||
| } | } | ||||
| @Override | |||||
| public Integer getCategoryId(TenantEntity tenantEntity, Long couponId) { | |||||
| return wxCouponMapper.findCategoryIdById(couponId,tenantEntity.getTenantId()); | |||||
| } | |||||
| } | } | ||||
| @@ -25,6 +25,7 @@ import com.iformall.service.*; | |||||
| import com.iformall.service.order.entity.WxComposeChildOrderShare; | import com.iformall.service.order.entity.WxComposeChildOrderShare; | ||||
| import com.iformall.service.order.util.OrderHelper; | import com.iformall.service.order.util.OrderHelper; | ||||
| import com.iformall.service.pay.PayServiceFactory; | import com.iformall.service.pay.PayServiceFactory; | ||||
| import com.iformall.service.pay.service.fee.ServiceFeeAdapterService; | |||||
| import com.iformall.service.pay.service.pay.douyin.v1.miniApp.EnumTtPayChannel; | import com.iformall.service.pay.service.pay.douyin.v1.miniApp.EnumTtPayChannel; | ||||
| import com.iformall.service.pay.service.share.PayShareAdapterService; | import com.iformall.service.pay.service.share.PayShareAdapterService; | ||||
| import com.iformall.service.pay.service.share.entity.PayShareCalculateAmount; | import com.iformall.service.pay.service.share.entity.PayShareCalculateAmount; | ||||
| @@ -217,6 +218,8 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(sharingOrder, enumPlat); | WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(sharingOrder, enumPlat); | ||||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(cAppInfo.getPayId()); | WxPayAccount payAccount = wxPayAccountMapper.selectById(cAppInfo.getPayId()); | ||||
| ServiceFeeAdapterService serviceFeeService = payServiceFactory.getServiceFeeAdapterService(enumPlat.getCode()); | |||||
| WxComposeChildOrderShare wxComposeChildOrderShare = null; | WxComposeChildOrderShare wxComposeChildOrderShare = null; | ||||
| if(sharingOrder.getSingleOrderId() != null){ | if(sharingOrder.getSingleOrderId() != null){ | ||||
| wxComposeChildOrderShare = payOrder.getChildOrderShare(sharingOrder.getSingleOrderId()); | wxComposeChildOrderShare = payOrder.getChildOrderShare(sharingOrder.getSingleOrderId()); | ||||
| @@ -225,24 +228,27 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| } | } | ||||
| wxComposeChildOrderShare.setCpsCommission(cpsCommission); | wxComposeChildOrderShare.setCpsCommission(cpsCommission); | ||||
| //官方手续费千6 | |||||
| int realRateAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), payAccount.getRealRate(), true); | |||||
| //官方手续费---千6 | |||||
| int realRate = serviceFeeService.getRealRate(payAccount); | |||||
| int realRateAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), realRate, true); | |||||
| wxComposeChildOrderShare.setRealRateAmount(realRateAmount); | wxComposeChildOrderShare.setRealRateAmount(realRateAmount); | ||||
| //官方平台抽佣 | //官方平台抽佣 | ||||
| int rate = payShareAdapterService.getOfficialCommission(wxComposeChildOrderShare.getOrderId(),payAccount); | |||||
| int rate = serviceFeeService.getOfficialCommissionByOrder(wxComposeChildOrderShare.getOrderId(),payAccount); | |||||
| int commissionAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), rate, true); | int commissionAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), rate, true); | ||||
| wxComposeChildOrderShare.setCommissionAmount(commissionAmount); | wxComposeChildOrderShare.setCommissionAmount(commissionAmount); | ||||
| int surplus = 0;//当广场抽成帐号与收款帐号相等,无法添加分账方,计入商管商户中 | int surplus = 0;//当广场抽成帐号与收款帐号相等,无法添加分账方,计入商管商户中 | ||||
| //只有抖音直连才有分账 | |||||
| //只有抖音才有抽成 | |||||
| //微信缺少流程(分账帐号绑定) 无法抽成 | |||||
| if(EnumPayWay.PAY_WAY_TT.getCode().equals(payOrder.getPayVendor()) | if(EnumPayWay.PAY_WAY_TT.getCode().equals(payOrder.getPayVendor()) | ||||
| && EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType()) | |||||
| && EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ | && EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ | ||||
| //销售抽点+系统抽点 | //销售抽点+系统抽点 | ||||
| int selSysAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), payAccount.getSellRate()+payAccount.getSystemRate(), false); | |||||
| int systemCommission = serviceFeeService.getSystemCommissionByOrder(wxComposeChildOrderShare.getOrderId(), payAccount); | |||||
| int sellCommission = serviceFeeService.getSellCommission(payAccount); | |||||
| int selSysAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), systemCommission+sellCommission, false); | |||||
| //销售抽点 | //销售抽点 | ||||
| int sellerAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), payAccount.getSellRate(), false); | |||||
| int sellerAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), sellCommission, false); | |||||
| wxComposeChildOrderShare.setSellerAmount(sellerAmount); | wxComposeChildOrderShare.setSellerAmount(sellerAmount); | ||||
| boolean isSeller = false; | boolean isSeller = false; | ||||
| if(sellerAmount > 0){ | if(sellerAmount > 0){ | ||||
| @@ -318,7 +324,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| wxComposeChildOrderShare.setServiceAmount(null); | wxComposeChildOrderShare.setServiceAmount(null); | ||||
| } | } | ||||
| //商户所得 | //商户所得 | ||||
| int shareAmount = wxComposeChildOrderShare.getShareAmount() + surplus; | |||||
| int shareAmount = wxComposeChildOrderShare.getShareAmount(); | |||||
| boolean isCallSharing = false;//是否调用分账 | boolean isCallSharing = false;//是否调用分账 | ||||
| boolean isCreateSubsidy = false;//是否需要记账 | boolean isCreateSubsidy = false;//是否需要记账 | ||||
| @@ -424,12 +430,13 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| } | } | ||||
| if(isSharingResult){ | if(isSharingResult){ | ||||
| int sharingSubsidyAmount = shareAmount+surplus; | |||||
| if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType())){ | if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType())){ | ||||
| //解冻给收款方(广场) | |||||
| //解冻给收款方(广场) +抽成没抽过去的。surplus | |||||
| JSONObject jo = new JSONObject(); | JSONObject jo = new JSONObject(); | ||||
| // jo.put("type",EnumProfitPaymentReceiverType.wx_special_merchant_number.getMessage()); | // jo.put("type",EnumProfitPaymentReceiverType.wx_special_merchant_number.getMessage()); | ||||
| jo.put("account",payAccount.getSubMchId()); | jo.put("account",payAccount.getSubMchId()); | ||||
| jo.put("amount", shareAmount); | |||||
| jo.put("amount", sharingSubsidyAmount); | |||||
| jo.put("merchantId",0); | jo.put("merchantId",0); | ||||
| jo.put("bTenantId",payOrder.getTenantId()); | jo.put("bTenantId",payOrder.getTenantId()); | ||||
| jo.put("description",0); | jo.put("description",0); | ||||
| @@ -441,13 +448,13 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| if(receiver != null && receiver.getReceiverAccount().equals(wxComposeChildOrderShare.getMerchantUid())){ | if(receiver != null && receiver.getReceiverAccount().equals(wxComposeChildOrderShare.getMerchantUid())){ | ||||
| jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | ||||
| jo.put("account",receiver.getReceiverAccount()); | jo.put("account",receiver.getReceiverAccount()); | ||||
| jo.put("amount", shareAmount); | |||||
| jo.put("amount", sharingSubsidyAmount); | |||||
| jo.put("merchantId",receiver.getMerchantId()); | jo.put("merchantId",receiver.getMerchantId()); | ||||
| jo.put("bTenantId",receiver.getTenantId()); | jo.put("bTenantId",receiver.getTenantId()); | ||||
| jo.put("description",receiver.getId()); | jo.put("description",receiver.getId()); | ||||
| }else{ | }else{ | ||||
| jo.put("account",wxComposeChildOrderShare.getMerchantUid()); | jo.put("account",wxComposeChildOrderShare.getMerchantUid()); | ||||
| jo.put("amount", shareAmount); | |||||
| jo.put("amount", sharingSubsidyAmount); | |||||
| jo.put("merchantId",wxComposeChildOrderShare.getMerchantId()); | jo.put("merchantId",wxComposeChildOrderShare.getMerchantId()); | ||||
| jo.put("bTenantId",payOrder.getTenantId()); | jo.put("bTenantId",payOrder.getTenantId()); | ||||
| jo.put("description",0); | jo.put("description",0); | ||||
| @@ -75,27 +75,27 @@ public class WxComposeChildOrderShare { | |||||
| if(this.realRateAmount == null){ | if(this.realRateAmount == null){ | ||||
| return; | return; | ||||
| } | } | ||||
| int sumAmount = this.realRateAmount.intValue(); | |||||
| int sumAmount = this.realRateAmount.intValue();//支付通道费 | |||||
| if(this.commissionAmount != null){ | if(this.commissionAmount != null){ | ||||
| sumAmount += this.commissionAmount.intValue(); | |||||
| sumAmount += this.commissionAmount.intValue();//平台服务费 | |||||
| } | } | ||||
| if(this.cpsCommission != null){ | if(this.cpsCommission != null){ | ||||
| sumAmount += this.cpsCommission.intValue(); | |||||
| sumAmount += this.cpsCommission.intValue();//达人佣金 | |||||
| } | } | ||||
| if(this.systemAmount != null){ | if(this.systemAmount != null){ | ||||
| sumAmount += this.systemAmount; | |||||
| sumAmount += this.systemAmount;//系统扣点 | |||||
| } | } | ||||
| if(this.sellerAmount != null){ | if(this.sellerAmount != null){ | ||||
| sumAmount += this.sellerAmount; | |||||
| sumAmount += this.sellerAmount;//销售扣点 | |||||
| } | } | ||||
| if(serviceAmount == null || serviceAmount.intValue() < sumAmount){ | if(serviceAmount == null || serviceAmount.intValue() < sumAmount){ | ||||
| this.serviceAmount = sumAmount; | this.serviceAmount = sumAmount; | ||||
| }else{ | }else{ | ||||
| this.serviceAmount = serviceAmount; | |||||
| this.serviceAmount = serviceAmount;//一笔订单总扣除手续费 | |||||
| } | } | ||||
| this.rateAmount = this.serviceAmount.intValue() - sumAmount; | |||||
| this.shareAmount = this.realPayMent.intValue() - this.serviceAmount.intValue(); | |||||
| this.rateAmount = this.serviceAmount.intValue() - sumAmount;//剩下的就是给商场的 | |||||
| this.shareAmount = this.realPayMent.intValue() - this.serviceAmount.intValue();//这就是给商户的 | |||||
| } | } | ||||
| } | } | ||||
| @@ -4,6 +4,9 @@ import java.util.Map; | |||||
| import java.util.concurrent.ConcurrentHashMap; | import java.util.concurrent.ConcurrentHashMap; | ||||
| import com.iformall.enums.EnumAppPlat; | import com.iformall.enums.EnumAppPlat; | ||||
| import com.iformall.enums.EnumPayVersion; | import com.iformall.enums.EnumPayVersion; | ||||
| import com.iformall.service.pay.service.fee.ServiceFeeAdapterService; | |||||
| import com.iformall.service.pay.service.fee.TtServiceFeeService; | |||||
| import com.iformall.service.pay.service.fee.WxServiceFeeService; | |||||
| import com.iformall.service.pay.service.refund.douyin.TtRefundAdapterService; | import com.iformall.service.pay.service.refund.douyin.TtRefundAdapterService; | ||||
| import com.iformall.service.pay.service.refund.wx.v2.WxRefundAdapterService; | import com.iformall.service.pay.service.refund.wx.v2.WxRefundAdapterService; | ||||
| import com.iformall.service.pay.service.refund.wx.v3.WxRefundV3AdapterService; | import com.iformall.service.pay.service.refund.wx.v3.WxRefundV3AdapterService; | ||||
| @@ -45,6 +48,7 @@ public class PayServiceFactory { | |||||
| private Map<String,PayShareAdapterService> shareMap = null; | private Map<String,PayShareAdapterService> shareMap = null; | ||||
| private Map<String,RefundPayAdapterService> refundMap = null; | private Map<String,RefundPayAdapterService> refundMap = null; | ||||
| private Map<String,CashOutAdapterService> cashoutMap = null; | private Map<String,CashOutAdapterService> cashoutMap = null; | ||||
| private Map<String,ServiceFeeAdapterService> serviceFeeMap = null; | |||||
| @Autowired | @Autowired | ||||
| WxMiniAppPayAdapterService wxMiniAppPayService; | WxMiniAppPayAdapterService wxMiniAppPayService; | ||||
| @@ -86,6 +90,11 @@ public class PayServiceFactory { | |||||
| WxCashOutQYFKAdapterService wxCashOutService; | WxCashOutQYFKAdapterService wxCashOutService; | ||||
| @Autowired | @Autowired | ||||
| WxCashOutSFTAdapterService wxCashOutSFTAdapterService; | WxCashOutSFTAdapterService wxCashOutSFTAdapterService; | ||||
| @Autowired | |||||
| TtServiceFeeService ttServiceFeeService; | |||||
| @Autowired | |||||
| WxServiceFeeService wxServiceFeeService; | |||||
| @@ -193,6 +202,15 @@ public class PayServiceFactory { | |||||
| } | } | ||||
| return cashoutMap; | return cashoutMap; | ||||
| } | } | ||||
| private Map<String,ServiceFeeAdapterService> getServiceFeeMap() { | |||||
| if (null == serviceFeeMap ) { | |||||
| serviceFeeMap = new ConcurrentHashMap<String, ServiceFeeAdapterService>(); | |||||
| serviceFeeMap.put(EnumAppPlat.WX.getCode()+"_", wxServiceFeeService); | |||||
| serviceFeeMap.put(EnumAppPlat.TOUTIAO.getCode()+"_", ttServiceFeeService); | |||||
| } | |||||
| return serviceFeeMap; | |||||
| } | |||||
| public PayAdapterService getPayAdapterService(Integer type,Integer payVersion) throws MallinkException{ | public PayAdapterService getPayAdapterService(Integer type,Integer payVersion) throws MallinkException{ | ||||
| PayAdapterService service = getServiceMap().get(type+"_"+payVersion); | PayAdapterService service = getServiceMap().get(type+"_"+payVersion); | ||||
| @@ -257,4 +275,12 @@ public class PayServiceFactory { | |||||
| } | } | ||||
| return cashOutService; | return cashOutService; | ||||
| } | } | ||||
| public ServiceFeeAdapterService getServiceFeeAdapterService(Integer plat)throws MallinkException { | |||||
| ServiceFeeAdapterService serviceFeeService = getServiceFeeMap().get(plat+"_"); | |||||
| if (null == serviceFeeService) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"payWay["+plat+"] 费率service未找到"); | |||||
| } | |||||
| return serviceFeeService; | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,61 @@ | |||||
| package com.iformall.service.pay.service.fee; | |||||
| import com.iformall.domain.po.WxAppinfo; | |||||
| import com.iformall.domain.po.WxCashOut; | |||||
| import com.iformall.domain.po.WxPayAccount; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.service.pay.service.cashout.entity.CashOutAdapterResult; | |||||
| /** | |||||
| * 费率接口 | |||||
| * @author | |||||
| */ | |||||
| public interface ServiceFeeAdapterService { | |||||
| /** | |||||
| * 获取实际支付通道费率 | |||||
| * @param payAccount | |||||
| * @return | |||||
| */ | |||||
| public int getRealRate(WxPayAccount payAccount); | |||||
| /** | |||||
| * 获取平台(微信,抖音等)抽佣手续费率(不包含支付通道费率) | |||||
| * @return | |||||
| */ | |||||
| public int getOfficialCommission(Integer categoryId, WxPayAccount payAccount); | |||||
| public int getOfficialCommissionByOrder(Long orderId, WxPayAccount payAccount); | |||||
| /** | |||||
| * 获取系统(富茂)抽佣手续费率 | |||||
| * @return | |||||
| */ | |||||
| public int getSystemCommission(Integer categoryId, WxPayAccount payAccount); | |||||
| public int getSystemCommissionByOrder(Long orderId, WxPayAccount payAccount); | |||||
| /** | |||||
| * 获取第三方(销售)抽佣 | |||||
| */ | |||||
| public int getSellCommission(WxPayAccount payAccount); | |||||
| /** | |||||
| * 获取达人佣金费率 | |||||
| * 多条数据 无法获取 | |||||
| * @return | |||||
| */ | |||||
| // public int getCPSCommission(TenantEntity tenantEntity, Long couponId); | |||||
| /** | |||||
| * 获取所有的总抽佣费率 | |||||
| * 如过设置了就返回,没设置返回0 | |||||
| */ | |||||
| public int getAllCommission(Long couponId, WxPayAccount payAccount); | |||||
| /** | |||||
| * 获取商场抽佣费率 | |||||
| * 无法获取准确的达人拥挤费率, 无法计算 | |||||
| */ | |||||
| // public int getMallCommission(Long couponId, WxPayAccount payAccount); | |||||
| } | |||||
| @@ -0,0 +1,127 @@ | |||||
| package com.iformall.service.pay.service.fee; | |||||
| import com.iformall.domain.po.TtPoiTakeRate; | |||||
| 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.EnumOrderType; | |||||
| import com.iformall.enums.EnumYesOrNo; | |||||
| 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 lombok.extern.slf4j.Slf4j; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| @Slf4j | |||||
| @Service | |||||
| public class TtServiceFeeService implements ServiceFeeAdapterService{ | |||||
| @Autowired | |||||
| WxOrderMapper wxOrderMapper; | |||||
| @Autowired | |||||
| TtPoiTakeRateMapper ttPoiTakeRateMapper; | |||||
| @Autowired | |||||
| WxCouponService wxCouponService; | |||||
| @Autowired | |||||
| TtGoodsCategoryService ttGoodsCategoryService; | |||||
| @Autowired | |||||
| TtMallGoodsCategoryService ttMallGoodsCategoryService; | |||||
| @Override | |||||
| public int getRealRate(WxPayAccount payAccount) { | |||||
| Integer realRate = payAccount.getRealRate(); | |||||
| if(realRate == null){ | |||||
| realRate = 60; | |||||
| } | |||||
| return realRate; | |||||
| } | |||||
| @Override | |||||
| public int getOfficialCommission(Integer categoryId, WxPayAccount payAccount) { | |||||
| if(categoryId != null){ | |||||
| int ttServiceFee = ttGoodsCategoryService.getTtServiceFee(categoryId); | |||||
| int realRate = this.getRealRate(payAccount); | |||||
| if(ttServiceFee > realRate){ | |||||
| return ttServiceFee - realRate; | |||||
| } | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| @Override | |||||
| public int getOfficialCommissionByOrder(Long orderId, WxPayAccount payAccount) { | |||||
| return getOfficialCommission(getCategoryIdByOrder(orderId,payAccount),payAccount); | |||||
| } | |||||
| @Override | |||||
| public int getSystemCommission(Integer categoryId, WxPayAccount payAccount) { | |||||
| if(categoryId != null){ | |||||
| if(EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ | |||||
| int mallSoftwareFee = ttMallGoodsCategoryService.getMallSoftwareFee(payAccount, categoryId); | |||||
| return mallSoftwareFee; | |||||
| } | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| @Override | |||||
| public int getSystemCommissionByOrder(Long orderId, WxPayAccount payAccount) { | |||||
| return getSystemCommission(getCategoryIdByOrder(orderId,payAccount),payAccount); | |||||
| } | |||||
| @Override | |||||
| public int getSellCommission(WxPayAccount payAccount) { | |||||
| if(EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ | |||||
| Integer sellRate = payAccount.getSellRate(); | |||||
| if(sellRate != null){ | |||||
| return sellRate; | |||||
| } | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| // @Override | |||||
| // public int getCPSCommission(TenantEntity tenantEntity, Long couponId) { | |||||
| // return 0; | |||||
| // } | |||||
| @Override | |||||
| public int getAllCommission(Long couponId, WxPayAccount payAccount) { | |||||
| int allRate = 0; | |||||
| if(EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ | |||||
| TtPoiTakeRate ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(payAccount.getTenantId(), couponId, EnumCpsPlanType.ALL.getCode()); | |||||
| if(ttPoiTakeRate != null && ttPoiTakeRate.getTakeRate() != null){ | |||||
| allRate = ttPoiTakeRate.getTakeRate().intValue(); | |||||
| } | |||||
| } | |||||
| return allRate; | |||||
| } | |||||
| // @Override | |||||
| // public int getMallCommission(Long couponId, WxPayAccount payAccount) { | |||||
| // return 0; | |||||
| // } | |||||
| private Integer getCategoryIdByOrder(Long orderId,TenantEntity tenantEntity){ | |||||
| WxOrder o = wxOrderMapper.selectById(orderId, tenantEntity.getTenantId()); | |||||
| if(!EnumOrderType.COUPON.getCode().equals(o.getType())){ | |||||
| return null; | |||||
| } | |||||
| Integer categoryId = wxCouponService.getCategoryId(tenantEntity,o.getProductId()); | |||||
| return categoryId; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,98 @@ | |||||
| package com.iformall.service.pay.service.fee; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxAppinfoMapper; | |||||
| import com.iformall.mapper.WxPayAccountMapper; | |||||
| import com.iformall.mapper.WxPayOrderMapper; | |||||
| import com.iformall.pay.*; | |||||
| import com.iformall.service.WxProfitPaymentReceiverService; | |||||
| import com.iformall.service.WxProfitSharingReceiverService; | |||||
| import com.iformall.service.pay.service.share.PayShareBaseAdapterService; | |||||
| import com.iformall.service.pay.service.share.entity.PayShareQueryResult; | |||||
| import com.iformall.service.pay.service.share.entity.PayShareResult; | |||||
| import com.iformall.service.pay.service.share.entity.ShareAccountResult; | |||||
| import com.iformall.service.pay.service.share.entity.ShareNotifyAdapterResult; | |||||
| import com.iformall.utils.BeanUtils; | |||||
| import com.iformall.utils.Utility; | |||||
| import com.iformall.utils.XmlUtil; | |||||
| import lombok.extern.slf4j.Slf4j; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.text.ParseException; | |||||
| import java.util.*; | |||||
| @Slf4j | |||||
| @Service | |||||
| public class WxServiceFeeService implements ServiceFeeAdapterService{ | |||||
| @Override | |||||
| public int getRealRate(WxPayAccount payAccount) { | |||||
| Integer realRate = payAccount.getRealRate(); | |||||
| if(realRate == null){ | |||||
| realRate = 60; | |||||
| } | |||||
| return realRate; | |||||
| } | |||||
| @Override | |||||
| public int getOfficialCommission(Integer categoryId, WxPayAccount payAccount) { | |||||
| return 0; | |||||
| } | |||||
| @Override | |||||
| public int getOfficialCommissionByOrder(Long orderId, WxPayAccount payAccount) { | |||||
| return 0; | |||||
| } | |||||
| @Override | |||||
| public int getSystemCommission(Integer categoryId, WxPayAccount payAccount) { | |||||
| if(EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ | |||||
| Integer systemRate = payAccount.getSystemRate(); | |||||
| if(systemRate != null){ | |||||
| return systemRate; | |||||
| } | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| @Override | |||||
| public int getSystemCommissionByOrder(Long orderId, WxPayAccount payAccount) { | |||||
| return getSystemCommission(null,payAccount); | |||||
| } | |||||
| @Override | |||||
| public int getSellCommission(WxPayAccount payAccount) { | |||||
| if(EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ | |||||
| Integer sellRate = payAccount.getSellRate(); | |||||
| if(sellRate != null){ | |||||
| return sellRate; | |||||
| } | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| // @Override | |||||
| // public int getCPSCommission(TenantEntity tenantEntity, Long couponId) { | |||||
| // return 0; | |||||
| // } | |||||
| @Override | |||||
| public int getAllCommission(Long couponId, WxPayAccount payAccount) { | |||||
| return 0; | |||||
| } | |||||
| // @Override | |||||
| // public int getMallCommission(Long couponId, WxPayAccount payAccount) { | |||||
| // return 0; | |||||
| // } | |||||
| } | |||||
| @@ -120,12 +120,4 @@ public interface PayShareAdapterService { | |||||
| */ | */ | ||||
| int getCPSCommission(TenantEntity tenantEntity, Long orderId); | int getCPSCommission(TenantEntity tenantEntity, Long orderId); | ||||
| /** | |||||
| * 获取官方佣金率 | |||||
| * @param o | |||||
| * @param payAccount | |||||
| * @return | |||||
| */ | |||||
| int getOfficialCommission(Long orderId, WxPayAccount payAccount); | |||||
| } | } | ||||
| @@ -22,6 +22,7 @@ import com.iformall.douyin.payv2.result.ProfitSharingResult; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.TtGoodsCategoryService; | |||||
| import com.iformall.service.WxProfitPaymentReceiverService; | import com.iformall.service.WxProfitPaymentReceiverService; | ||||
| import com.iformall.service.WxProfitSharingReceiverService; | import com.iformall.service.WxProfitSharingReceiverService; | ||||
| import com.iformall.service.order.entity.WxComposeChildOrderShare; | import com.iformall.service.order.entity.WxComposeChildOrderShare; | ||||
| @@ -70,10 +71,10 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||||
| WxProfitSharingOrderMapper wxProfitSharingOrderMapper; | WxProfitSharingOrderMapper wxProfitSharingOrderMapper; | ||||
| @Autowired | @Autowired | ||||
| TtGoodsCategoryMapper ttGoodsCategoryMapper; | |||||
| OrderCpsMapper orderCpsMapper; | |||||
| @Autowired | @Autowired | ||||
| OrderCpsMapper orderCpsMapper; | |||||
| TtGoodsCategoryService ttGoodsCategoryService; | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| @@ -85,7 +86,7 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||||
| /** | /** | ||||
| * 做为分账的扩展数据 | * 做为分账的扩展数据 | ||||
| * @param payOrder | |||||
| * @param | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| protected String getCpExtra(WxProfitSharingOrder record) { | protected String getCpExtra(WxProfitSharingOrder record) { | ||||
| @@ -290,29 +291,6 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public int getOfficialCommission(Long orderId, WxPayAccount payAccount) { | |||||
| WxOrder o = wxOrderMapper.selectById(orderId, payAccount.getTenantId()); | |||||
| if(!EnumOrderType.COUPON.getCode().equals(o.getType())){ | |||||
| return 0; | |||||
| } | |||||
| Integer categoryId = wxCouponMapper.findCategoryIdById(o.getProductId(),o.getTenantId()); | |||||
| if(categoryId != null){ | |||||
| TtGoodsCategory ttGoodsCategory = ttGoodsCategoryMapper.selectById(categoryId); | |||||
| if(ttGoodsCategory != null && ttGoodsCategory.getServiceFee() != null){ | |||||
| if(ttGoodsCategory.getServiceFee().intValue() == 0){ | |||||
| return 0; | |||||
| } | |||||
| Integer realRate = payAccount.getRealRate(); | |||||
| if(realRate==null){ | |||||
| realRate = 60; | |||||
| } | |||||
| return ttGoodsCategory.getServiceFee().intValue() - realRate; | |||||
| } | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public WxProfitSharingReceiver getSharingReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | public WxProfitSharingReceiver getSharingReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | ||||
| if(merchantId == null || merchantId.equals(0L)){ | if(merchantId == null || merchantId.equals(0L)){ | ||||
| @@ -150,11 +150,6 @@ public class WxPayShareSFTService extends PayShareBaseAdapterService{ | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @Override | |||||
| public int getOfficialCommission(Long orderId, WxPayAccount payAccount) { | |||||
| return 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public WxProfitSharingReceiver getSharingReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | public WxProfitSharingReceiver getSharingReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | ||||
| return null; | return null; | ||||
| @@ -355,11 +355,6 @@ public class WxPayShareService extends PayShareBaseAdapterService{ | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @Override | |||||
| public int getOfficialCommission(Long orderId, WxPayAccount payAccount) { | |||||
| return 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public WxProfitSharingReceiver getSharingReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | public WxProfitSharingReceiver getSharingReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | ||||
| if(merchantId == null || merchantId.equals(0L)){ | if(merchantId == null || merchantId.equals(0L)){ | ||||
| @@ -326,11 +326,6 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ | |||||
| public int getCPSCommission(TenantEntity tenantEntity, Long orderId) { | public int getCPSCommission(TenantEntity tenantEntity, Long orderId) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| @Override | |||||
| public int getOfficialCommission(Long orderId, WxPayAccount payAccount) { | |||||
| return 0; | |||||
| } | |||||
| } | } | ||||
| @@ -16,6 +16,9 @@ public class PayUtils { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| public static int getPayRate(int payAmount, int rate, boolean isReal) { | public static int getPayRate(int payAmount, int rate, boolean isReal) { | ||||
| if(rate <= 0){ | |||||
| return 0; | |||||
| } | |||||
| Double dBaseAmount = 5.0D * 1000 / rate; | Double dBaseAmount = 5.0D * 1000 / rate; | ||||
| // 基础分 千分之6 83分 | // 基础分 千分之6 83分 | ||||
| if (isReal) { | if (isReal) { | ||||