| @@ -56,6 +56,7 @@ public class WxPayAccountController extends BaseController { | |||||
| returnPayAccount.setOpenPay(payAccount.getOpenPay()); | returnPayAccount.setOpenPay(payAccount.getOpenPay()); | ||||
| returnPayAccount.setPayVersion(payAccount.getPayVersion()); | returnPayAccount.setPayVersion(payAccount.getPayVersion()); | ||||
| returnPayAccount.setShare(payAccount.getShare()); | returnPayAccount.setShare(payAccount.getShare()); | ||||
| returnPayAccount.setIsCommission(payAccount.getIsCommission()); | |||||
| return new ResultData(returnPayAccount); | return new ResultData(returnPayAccount); | ||||
| } | } | ||||
| @@ -1,2 +1,5 @@ | |||||
| ALTER TABLE `mallink`.`wx_pay_account` | ALTER TABLE `mallink`.`wx_pay_account` | ||||
| ADD COLUMN `sell_rate` int(6) NOT NULL DEFAULT 0 COMMENT '销售提点' AFTER `system_rate`; | |||||
| ADD COLUMN `sell_rate` int(6) NOT NULL DEFAULT 0 COMMENT '销售提点' AFTER `system_rate`; | |||||
| ALTER TABLE `mallink`.`wx_pay_account` | |||||
| ADD COLUMN `is_commission` smallint(2) NOT NULL DEFAULT 0 COMMENT '是否抽佣' AFTER `real_rate`; | |||||
| @@ -66,6 +66,7 @@ public class WxPayAccountController extends BaseController { | |||||
| returnPayAccount.setOpenPay(payAccount.getOpenPay()); | returnPayAccount.setOpenPay(payAccount.getOpenPay()); | ||||
| returnPayAccount.setPayVersion(payAccount.getPayVersion()); | returnPayAccount.setPayVersion(payAccount.getPayVersion()); | ||||
| returnPayAccount.setShare(payAccount.getShare()); | returnPayAccount.setShare(payAccount.getShare()); | ||||
| returnPayAccount.setIsCommission(payAccount.getIsCommission()); | |||||
| return new ResultData(returnPayAccount); | return new ResultData(returnPayAccount); | ||||
| } | } | ||||
| @@ -56,6 +56,8 @@ public class WxPayAccount extends TenantEntity { | |||||
| private Integer rate; | private Integer rate; | ||||
| @io.swagger.annotations.ApiModelProperty(value="实际手续费(万分之几,默认60)",name="realRate") | @io.swagger.annotations.ApiModelProperty(value="实际手续费(万分之几,默认60)",name="realRate") | ||||
| private Integer realRate; | private Integer realRate; | ||||
| @io.swagger.annotations.ApiModelProperty(value="是否抽成",name="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") | ||||
| @@ -693,7 +693,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| map.put("realRate",payAccount.getRealRate()); | map.put("realRate",payAccount.getRealRate()); | ||||
| map.put("systemRate",payAccount.getSystemRate()+payAccount.getSellRate()); | map.put("systemRate",payAccount.getSystemRate()+payAccount.getSellRate()); | ||||
| int rate = payAccount.getRealRate()+payAccount.getSystemRate()+payAccount.getSellRate(); | |||||
| 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(EnumAppPlat.TOUTIAO.getCode().equals(couponAppInfo.getPlat())){ | ||||
| if(wxCoupon.getCategoryId() == null){ | if(wxCoupon.getCategoryId() == null){ | ||||
| return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误"); | return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误"); | ||||
| @@ -705,7 +711,6 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| if(maxTakeRate != null){ | if(maxTakeRate != null){ | ||||
| rate += maxTakeRate; | rate += maxTakeRate; | ||||
| } | } | ||||
| rate += getRateMin(); | |||||
| } | } | ||||
| map.put("mallMax",getAllMax()); | map.put("mallMax",getAllMax()); | ||||
| @@ -745,7 +750,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| if(ttPoiTakeRate != null){ | if(ttPoiTakeRate != null){ | ||||
| takeRate = ttPoiTakeRate.getTakeRate(); | takeRate = ttPoiTakeRate.getTakeRate(); | ||||
| }else{ | }else{ | ||||
| takeRate = 2900; | |||||
| takeRate = getAllMax(); | |||||
| } | } | ||||
| WxAppinfo couponAppInfo = wxAppinfoService.getCouponAppInfo(wxCoupon); | WxAppinfo couponAppInfo = wxAppinfoService.getCouponAppInfo(wxCoupon); | ||||
| @@ -756,7 +761,12 @@ 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 = payAccount.getRealRate()+payAccount.getSystemRate()+payAccount.getSellRate(); | |||||
| int rate = 0; | |||||
| if(EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ | |||||
| rate = payAccount.getRealRate()+payAccount.getSystemRate()+payAccount.getSellRate(); | |||||
| }else{ | |||||
| return getAllMax(); | |||||
| } | |||||
| if(EnumAppPlat.TOUTIAO.getCode().equals(couponAppInfo.getPlat())){ | if(EnumAppPlat.TOUTIAO.getCode().equals(couponAppInfo.getPlat())){ | ||||
| if(wxCoupon.getCategoryId() == null){ | if(wxCoupon.getCategoryId() == null){ | ||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误"); | throw new MallinkException(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误"); | ||||
| @@ -764,8 +774,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| TtGoodsCategory ttGoodsCategory = ttGoodsCategoryMapper.selectById(wxCoupon.getCategoryId()); | TtGoodsCategory ttGoodsCategory = ttGoodsCategoryMapper.selectById(wxCoupon.getCategoryId()); | ||||
| rate = rate+payAccount.getRealRate()-ttGoodsCategory.getServiceFee(); | rate = rate+payAccount.getRealRate()-ttGoodsCategory.getServiceFee(); | ||||
| } | } | ||||
| if(ttPoiTakeRate.getTakeRate().intValue() > rate){ | |||||
| rate = ttPoiTakeRate.getTakeRate().intValue() - rate; | |||||
| if(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(),"分佣率异常"); | ||||
| @@ -778,7 +788,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| //总分佣率最大值 | //总分佣率最大值 | ||||
| private int getAllMax(){ | private int getAllMax(){ | ||||
| return 3000; | |||||
| return 2900; | |||||
| } | } | ||||
| //总分佣率最小值 | //总分佣率最小值 | ||||
| private int getAllMin(WxCoupon wxCoupon){ | private int getAllMin(WxCoupon wxCoupon){ | ||||
| @@ -793,7 +803,12 @@ 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 = payAccount.getRealRate()+payAccount.getSystemRate()+payAccount.getSellRate(); | |||||
| 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(EnumAppPlat.TOUTIAO.getCode().equals(couponAppInfo.getPlat())){ | ||||
| if(wxCoupon.getCategoryId() == null){ | if(wxCoupon.getCategoryId() == null){ | ||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误"); | throw new MallinkException(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误"); | ||||
| @@ -804,7 +819,6 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| if(maxTakeRate != null){ | if(maxTakeRate != null){ | ||||
| rate += maxTakeRate; | rate += maxTakeRate; | ||||
| } | } | ||||
| rate += getRateMin(); | |||||
| } | } | ||||
| return rate; | return rate; | ||||
| } | } | ||||
| @@ -219,7 +219,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| 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(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ | |||||
| if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType()) && EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ | |||||
| //销售抽点+系统抽点 | //销售抽点+系统抽点 | ||||
| int selSysAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), payAccount.getSellRate()+payAccount.getSystemRate(), false); | int selSysAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), payAccount.getSellRate()+payAccount.getSystemRate(), false); | ||||
| //销售抽点 | //销售抽点 | ||||
| @@ -24,6 +24,7 @@ | |||||
| <result column="share" jdbcType="INTEGER" property="share"/> | <result column="share" jdbcType="INTEGER" property="share"/> | ||||
| <result column="rate" jdbcType="INTEGER" property="rate"/> | <result column="rate" jdbcType="INTEGER" property="rate"/> | ||||
| <result column="real_rate" jdbcType="INTEGER" property="realRate"/> | <result column="real_rate" jdbcType="INTEGER" property="realRate"/> | ||||
| <result column="is_commission" jdbcType="INTEGER" property="isCommission"/> | |||||
| <result column="system_rate" jdbcType="INTEGER" property="systemRate"/> | <result column="system_rate" jdbcType="INTEGER" property="systemRate"/> | ||||
| <result column="sell_rate" jdbcType="INTEGER" property="sellRate"/> | <result column="sell_rate" jdbcType="INTEGER" property="sellRate"/> | ||||
| @@ -37,7 +38,7 @@ | |||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`mch_id`,`sub_mch_id`,`sub_app_id`,`api_key`,`merchant_api_key`,`notify_url`,`notify_token`,`cert_path`, | `id`,`tenant_id`,`parent_tenant_id`,`mch_id`,`sub_mch_id`,`sub_app_id`,`api_key`,`merchant_api_key`,`notify_url`,`notify_token`,`cert_path`, | ||||
| `merchant_cert_path`,`type`,`mch_type`,`open_pay`,`share`,`rate`,`real_rate`,`system_rate`,`sell_rate`, | |||||
| `merchant_cert_path`,`type`,`mch_type`,`open_pay`,`share`,`rate`,`real_rate`,`is_commission`,`system_rate`,`sell_rate`, | |||||
| `service_id`,`pay_score_notify_url`,`api_v3_key`,`cert_serial_no`,`private_key_path`,`private_cert_pem_path`, | `service_id`,`pay_score_notify_url`,`api_v3_key`,`cert_serial_no`,`private_key_path`,`private_cert_pem_path`, | ||||
| `merchant_key_path`,`merchant_apiv3_key`,`merchant_cert_pem_path` | `merchant_key_path`,`merchant_apiv3_key`,`merchant_cert_pem_path` | ||||
| </sql> | </sql> | ||||
| @@ -83,6 +84,9 @@ | |||||
| <if test=" null != realRate "> | <if test=" null != realRate "> | ||||
| and `real_rate` = #{realRate} | and `real_rate` = #{realRate} | ||||
| </if> | </if> | ||||
| <if test=" null != isCommission "> | |||||
| and `is_commission` = #{isCommission} | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||