Authored by chenchao

reset service fee

... ... @@ -183,14 +183,21 @@ public class SellerOrderComputeService {
*/
private Optional<CouponPayResult> activityCouponUse(UserCouponsBo activityCouponsBo, SellerOrderRelatedBuyerOrderContext chargeContext) {
SellerOrderComputeResult chargeResult = chargeContext.getSellerOrderComputeResult();
PlatformFeeDto platformFeeDto = chargeResult.getPlatformFee();
BigDecimal couponPayAmount = BigDecimalHelper.min(platformFeeDto.getServiceFee(), activityCouponsBo.getCouponAmount());
BigDecimal oldServiceFee = platformFeeDto.getServiceFee();
//1. calculate coupon cut amount
BigDecimal couponPayAmount = BigDecimalHelper.min(oldServiceFee, activityCouponsBo.getCouponAmount());
BigDecimal oldIncome = chargeResult.getIncome();
//2. calculate income and set
//2.1
BigDecimal newIncome = BigDecimalHelper.add(oldIncome, couponPayAmount);
//set income
//2.2 set income
chargeResult.setIncome(newIncome);
//
//3. calculate serviceFee and set
BigDecimal newServiceFee = BigDecimalHelper.sub(oldServiceFee, couponPayAmount);
platformFeeDto.setServiceFee(newServiceFee);
BigDecimal oldFinalAmountOfCutCoupons = chargeResult.getCouponCutAmount();
BigDecimal newFinalAmountOfCutCoupons;
... ...