Authored by chenchao

reset service fee

@@ -183,14 +183,21 @@ public class SellerOrderComputeService { @@ -183,14 +183,21 @@ public class SellerOrderComputeService {
183 */ 183 */
184 private Optional<CouponPayResult> activityCouponUse(UserCouponsBo activityCouponsBo, SellerOrderRelatedBuyerOrderContext chargeContext) { 184 private Optional<CouponPayResult> activityCouponUse(UserCouponsBo activityCouponsBo, SellerOrderRelatedBuyerOrderContext chargeContext) {
185 SellerOrderComputeResult chargeResult = chargeContext.getSellerOrderComputeResult(); 185 SellerOrderComputeResult chargeResult = chargeContext.getSellerOrderComputeResult();
  186 +
186 PlatformFeeDto platformFeeDto = chargeResult.getPlatformFee(); 187 PlatformFeeDto platformFeeDto = chargeResult.getPlatformFee();
187 - BigDecimal couponPayAmount = BigDecimalHelper.min(platformFeeDto.getServiceFee(), activityCouponsBo.getCouponAmount()); 188 +
  189 + BigDecimal oldServiceFee = platformFeeDto.getServiceFee();
  190 + //1. calculate coupon cut amount
  191 + BigDecimal couponPayAmount = BigDecimalHelper.min(oldServiceFee, activityCouponsBo.getCouponAmount());
188 BigDecimal oldIncome = chargeResult.getIncome(); 192 BigDecimal oldIncome = chargeResult.getIncome();
  193 + //2. calculate income and set
  194 + //2.1
189 BigDecimal newIncome = BigDecimalHelper.add(oldIncome, couponPayAmount); 195 BigDecimal newIncome = BigDecimalHelper.add(oldIncome, couponPayAmount);
190 - //set income 196 + //2.2 set income
191 chargeResult.setIncome(newIncome); 197 chargeResult.setIncome(newIncome);
192 -  
193 - // 198 + //3. calculate serviceFee and set
  199 + BigDecimal newServiceFee = BigDecimalHelper.sub(oldServiceFee, couponPayAmount);
  200 + platformFeeDto.setServiceFee(newServiceFee);
194 201
195 BigDecimal oldFinalAmountOfCutCoupons = chargeResult.getCouponCutAmount(); 202 BigDecimal oldFinalAmountOfCutCoupons = chargeResult.getCouponCutAmount();
196 BigDecimal newFinalAmountOfCutCoupons; 203 BigDecimal newFinalAmountOfCutCoupons;