|
|
@@ -58,6 +58,8 @@ public class LifeCouponServiceImpl extends ServiceImpl<LifeCouponMapper, LifeCou
|
|
|
|
|
|
private final LifeGroupBuyMainMapper lifeGroupBuyMainMapper;
|
|
|
|
|
|
+ private final StoreInfoMapper storeInfoMapper;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public LifeCoupon addOrUpdateCoupon(LifeCoupon lifeCoupon) {
|
|
|
@@ -243,12 +245,18 @@ public class LifeCouponServiceImpl extends ServiceImpl<LifeCouponMapper, LifeCou
|
|
|
.allMatch(str -> str.getStatus()==2);
|
|
|
if(isExist){
|
|
|
lifeUserOrder.setStatus(2);
|
|
|
+ lifeUserOrder.setFinishTime(new Date());
|
|
|
+ lifeUserOrder.setCreatedTime(new Date());
|
|
|
lifeUserOrderMapper.updateById(lifeUserOrder);
|
|
|
}
|
|
|
|
|
|
+ StoreInfo storeInfo = storeInfoMapper.selectOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId,lifeUserOrder.getStoreId()));
|
|
|
// TODO 抽成比例应该从商户里取
|
|
|
BigDecimal amounts = new BigDecimal(lifeUserOrder.getFinalPrice()).multiply(new BigDecimal(100));
|
|
|
- BigDecimal commission = amounts.multiply(new BigDecimal(0.04)).setScale(0, RoundingMode.HALF_UP);
|
|
|
+ // 先将抽成比例转换为BigDecimal,再除以100
|
|
|
+ BigDecimal commissionRate = new BigDecimal(storeInfo.getCommissionRate())
|
|
|
+ .divide(new BigDecimal(100));
|
|
|
+ BigDecimal commission = amounts.multiply(commissionRate).setScale(0, RoundingMode.HALF_UP);
|
|
|
BigDecimal money = amounts.subtract(commission);
|
|
|
|
|
|
// 插入收入明细表数据
|