Merge remote-tracking branch 'origin/master'

This commit is contained in:
张松 2025-03-04 16:52:00 +08:00
commit 615f32d32d
2 changed files with 8 additions and 5 deletions

View File

@ -694,7 +694,11 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
//折扣信息
orderInfo.setDiscountInfo(buildDiscountInfo(orderInfo));
//最终折扣
orderInfo.setDiscountRatio(orderInfo.getOriginAmount().divide(param.getOrderAmount(), 2, RoundingMode.UP));
if (param.getOrderAmount().compareTo(BigDecimal.ZERO) != 0) {
orderInfo.setDiscountRatio(orderInfo.getOriginAmount().divide(param.getOrderAmount(), 2, RoundingMode.UP));
} else {
orderInfo.setDiscountRatio(BigDecimal.ZERO);
}
saveOrUpdate(orderInfo);
}

View File

@ -3,6 +3,7 @@ package com.czg.service.product.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.NumberUtil;
import com.czg.config.RabbitPublisher;
import com.czg.constant.CacheConstant;
@ -108,11 +109,9 @@ public class ProductRpcServiceImpl implements ProductRpcService {
consStockFlowMapper.insert(consStockFlow);
}
}
/*try {
ThreadUtil.execAsync(() -> {
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
} catch (Exception e) {
log.error("发送商品信息变更Mq消息失败", e);
}*/
});
log.info("ProductService.--------------------------------------------库存更新成功");
}