Authored by gemingdan

0元佣金处理

... ... @@ -17,6 +17,7 @@ public enum ShareOrdersStatusEnum {
ORDER_RETURN(2,"92","不可结算退货","未达成"),
ORDER_EXCHANGE(2,"93","不可结算换货","未达成"),
ORDER_DISCARD(2,"100","因拆单作废","未达成"),//前台不展示100类
ORDER_ZERO(2,"150","0元佣金无效","未达成"),//前台不展示150类
ACTIVITY_DISCARD(2,"200","活动作废","未达成");//前台不展示200类
private int level;//低level可以变为高level
... ...
... ... @@ -85,7 +85,7 @@
select
<include refid="Base_Column_List" />
from union_share_orders
where status !=100 and order_code in
where status not in (100,150) and order_code in
<foreach collection="orderCodes" open="(" close=")" item="ordercode" separator=",">
#{ordercode}
</foreach>
... ... @@ -559,7 +559,7 @@
<include refid="Base_Column_List" />
from union_share_orders
where promote_uid = #{uid,jdbcType=INTEGER} and order_code is not null
AND status != 100
AND status not in (100,150)
order by order_time desc
limit 0,10
</select>
... ... @@ -576,7 +576,7 @@
and activity_id &gt;0
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 0">
AND status != 100
AND status not in (100,150)
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 1">
AND status = 10
... ... @@ -618,7 +618,7 @@
and activity_id &gt;0
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 0">
AND status != 100
AND status not in (100,150)
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 1">
AND status = 10
... ...
... ... @@ -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;
... ...