...
|
...
|
@@ -3333,23 +3333,27 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
insertReq.setIsNew((byte)2);
|
|
|
}
|
|
|
//返利金额计算小数位两位后舍弃
|
|
|
BigDecimal orderAmount = new BigDecimal("0");
|
|
|
BigDecimal orderAmount = new BigDecimal(0);
|
|
|
//新增订单商品信息
|
|
|
bo.getProductList().forEach(p->{
|
|
|
for(ShareOrdersProductBo p : bo.getProductList()){
|
|
|
try {
|
|
|
UnionShareOrdersProduct insertPro = new UnionShareOrdersProduct();
|
|
|
BeanUtils.copyProperties(p, insertPro);
|
|
|
insertPro.setOrderCode(bo.getOrderCode());
|
|
|
//获取商品单品返佣
|
|
|
getProductRebates(insertPro,rebatesRatio);
|
|
|
orderAmount.add(insertPro.getAmount().multiply(new BigDecimal(p.getNum())));
|
|
|
orderAmount=orderAmount.add(insertPro.getAmount().multiply(new BigDecimal(p.getNum())));
|
|
|
unionShareOrdersProductMapper.insertSelective(insertPro);
|
|
|
} catch (BeansException e) {
|
|
|
logger.info("insertOrder product error,orderCode is {},product is {}",bo.getOrderCode(), p);
|
|
|
}
|
|
|
});
|
|
|
// insertReq.setAmount((bo.getLastOrderAmount().multiply(new BigDecimal(rebatesRatio).divide(new BigDecimal(100)))).setScale(2,BigDecimal.ROUND_DOWN));
|
|
|
}
|
|
|
|
|
|
insertReq.setAmount(orderAmount);
|
|
|
//对0元返佣订单的处理
|
|
|
if (orderAmount.compareTo(new BigDecimal(0)) < 1) {
|
|
|
insertReq.setStatus(ShareOrdersStatusEnum.ORDER_ZERO.getCode());
|
|
|
}
|
|
|
insertReq.setOrderAmount(orderAmount);
|
|
|
logger.info("insertOrder,orderCode is {},orderAmount is {},default rebatesRatio is {},rebates is {}",bo.getOrderCode(),bo.getLastOrderAmount(),rebatesRatio,insertReq.getAmount());
|
|
|
bo.setAmount(insertReq.getAmount());
|
...
|
...
|
@@ -3390,7 +3394,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
|
|
|
private BigDecimal getProductRebates(UnionShareOrdersProduct product,String rebatesRatioDefault) {
|
|
|
|
|
|
int rebatesRatio = Integer.getInteger(rebatesRatioDefault)*100;//默认设置是百分点
|
|
|
int rebatesRatio = Integer.valueOf(rebatesRatioDefault)*100;//默认设置是百分点
|
|
|
UnionShareRebateSkn shareRebateSkn = unionShareRebateSknMapper.selectBySkn(product.getProductSkn());
|
|
|
boolean rebateState = true;
|
|
|
boolean brandStateCheck = false;
|
...
|
...
|
|