|
@@ -991,14 +991,44 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
orderGoods.setCompany(bo.getOrderStudent().getCompany());*/
|
|
|
//成交价
|
|
|
orderGoods.setStatus(1);
|
|
|
- orderGoods.setGoodsRealPrice(goods.getStandPrice());
|
|
|
- orderGoods.setGoodsPrice(goods.getStandPrice());
|
|
|
orderGoods.setCreateTime(DateUtils.getNowTime());
|
|
|
orderGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
- //订单价格不计算优惠
|
|
|
- totalPrice = totalPrice.add(goods.getStandPrice());
|
|
|
- //暂不计算优惠券
|
|
|
- payPrice = payPrice.add(goods.getStandPrice());
|
|
|
+ if (StringUtils.isNotBlank(g.getDistributionCode())){
|
|
|
+ //分销订单
|
|
|
+ DistributionActivity activity = iDistributionActivityService
|
|
|
+ .getOne(new LambdaQueryWrapper<DistributionActivity>()
|
|
|
+ .eq(DistributionActivity::getCode, g.getDistributionCode())
|
|
|
+ .eq(DistributionActivity::getStatus, 1));
|
|
|
+ if (ObjectUtils.isNull(activity)){
|
|
|
+ throw new CustomException(String.format("分销订单创建失败【%s】",g.getDistributionCode()));
|
|
|
+ }
|
|
|
+ if (DateUtils.getNowTime() < activity.getStartTime() || DateUtils.getNowTime() > activity.getEndTime()){
|
|
|
+ throw new CustomException(String.format("分销活动已结束【%s】",g.getDistributionCode()));
|
|
|
+ }
|
|
|
+ //活动价格
|
|
|
+ ActivityGoodsPrice goodsPrice = iActivityGoodsPriceService
|
|
|
+ .getOne(new LambdaQueryWrapper<ActivityGoodsPrice>()
|
|
|
+ .eq(ActivityGoodsPrice::getGoodsId, g.getGoodsId())
|
|
|
+ .eq(ActivityGoodsPrice::getActivityCode, activity.getCode()));
|
|
|
+ if (ObjectUtils.isNull(goodsPrice)){
|
|
|
+ throw new CustomException(String.format("分销活动价格拉取失败【%s】",g.getDistributionCode()));
|
|
|
+ }
|
|
|
+ orderGoods.setDistributionCode(activity.getCode());
|
|
|
+ orderGoods.setDistributionLinkCode(g.getDistributionLinkCode());
|
|
|
+ orderGoods.setGoodsRealPrice(goodsPrice.getGoodsPrice());
|
|
|
+ orderGoods.setGoodsPrice(goodsPrice.getGoodsPrice());
|
|
|
+ //订单价格不计算优惠
|
|
|
+ totalPrice = totalPrice.add(goodsPrice.getGoodsPrice());
|
|
|
+ //暂不计算优惠券
|
|
|
+ payPrice = payPrice.add(goodsPrice.getGoodsPrice());
|
|
|
+ }else{
|
|
|
+ orderGoods.setGoodsRealPrice(goods.getStandPrice());
|
|
|
+ orderGoods.setGoodsPrice(goods.getStandPrice());
|
|
|
+ //订单价格不计算优惠
|
|
|
+ totalPrice = totalPrice.add(goods.getStandPrice());
|
|
|
+ //暂不计算优惠券
|
|
|
+ payPrice = payPrice.add(goods.getStandPrice());
|
|
|
+ }
|
|
|
boolean orderGoodsRs = iOrderGoodsService.save(orderGoods);
|
|
|
|
|
|
boolean canRepeatBuy = false;
|