|
@@ -232,7 +232,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
orderGoods.setCreateTime(DateUtils.getNowTime());
|
|
|
orderGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
- boolean orderGoodsRs = iOrderGoodsService.save(orderGoods);
|
|
|
+
|
|
|
//订单价格不计算优惠
|
|
|
totalPrice = totalPrice.add(g.getGoodsPrice());
|
|
|
//暂不计算优惠券
|
|
@@ -240,13 +240,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
boolean canRepeatBuy = false;
|
|
|
//视频商品安排班级
|
|
|
- if(goods.getGoodsType()==1&&orderGoodsRs){
|
|
|
+ if(goods.getGoodsType()==1){
|
|
|
Long gradeId = null;
|
|
|
+ //判断是否购买历史班级都过期
|
|
|
+ canRepeatBuy =this.canBuyRepeatGoods(g.getGoodsId(),bo.getUserId());
|
|
|
if(g.getGoodsInputData()!=null){
|
|
|
gradeId = g.getGoodsInputData().getGradeId();
|
|
|
+ if(getHaveBuyGoods(g.getGoodsId(),bo.getUserId())){
|
|
|
+ //有指定选班模板且视频商品班级已过期,记录复购状态
|
|
|
+ orderGoods.setRebuy(1);
|
|
|
+ }
|
|
|
}
|
|
|
- //判断是否购买历史班级都过期
|
|
|
- canRepeatBuy =this.canBuyRepeatGoods(g.getGoodsId(),bo.getUserId());
|
|
|
String requestId = IdUtil.simpleUUID();
|
|
|
RedisLockEntity redisLockEntity = new RedisLockEntity();
|
|
|
redisLockEntity.setLockKey(RedisLockEntity.KEY_LOCK_GRADE);
|
|
@@ -257,6 +261,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ boolean orderGoodsRs = iOrderGoodsService.save(orderGoods);
|
|
|
if(!canRepeatBuy&&goods.getGoodsType()!=3&&goods.getGoodsType()!=4){
|
|
|
this.checkBuyGoods(g.getGoodsId(),bo.getUserId());
|
|
|
}
|
|
@@ -319,7 +324,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
orderGoods.setGoodsPrice(goods.getStandPrice());
|
|
|
orderGoods.setCreateTime(DateUtils.getNowTime());
|
|
|
orderGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
- boolean orderGoodsRs = iOrderGoodsService.save(orderGoods);
|
|
|
//订单价格不计算优惠
|
|
|
totalPrice = totalPrice.add(goods.getStandPrice());
|
|
|
//暂不计算优惠券
|
|
@@ -328,13 +332,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
boolean canRepeatBuy = false;
|
|
|
//视频商品安排班级
|
|
|
- if(goods.getGoodsType()==1&&orderGoodsRs){
|
|
|
+ if(goods.getGoodsType()==1){
|
|
|
Long gradeId = null;
|
|
|
+ //判断是否购买历史班级都过期
|
|
|
+ canRepeatBuy =this.canBuyRepeatGoods(g.getGoodsId(),bo.getUserId());
|
|
|
if(g.getGoodsInputData()!=null){
|
|
|
gradeId = g.getGoodsInputData().getGradeId();
|
|
|
+ if(getHaveBuyGoods(g.getGoodsId(),bo.getUserId())){
|
|
|
+ //有指定选班模板且视频商品班级已过期,记录复购状态
|
|
|
+ orderGoods.setRebuy(1);
|
|
|
+ }
|
|
|
}
|
|
|
- //判断是否购买历史班级都过期
|
|
|
- canRepeatBuy =this.canBuyRepeatGoods(g.getGoodsId(),bo.getUserId());
|
|
|
String requestId = IdUtil.simpleUUID();
|
|
|
RedisLockEntity redisLockEntity = new RedisLockEntity();
|
|
|
redisLockEntity.setLockKey(RedisLockEntity.KEY_LOCK_GRADE);
|
|
@@ -344,6 +352,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
redisCache.unlockLua(redisLockEntity);
|
|
|
}
|
|
|
}
|
|
|
+ boolean orderGoodsRs = iOrderGoodsService.save(orderGoods);
|
|
|
if(!canRepeatBuy&&goods.getGoodsType()!=3&&goods.getGoodsType()!=4){
|
|
|
this.checkBuyGoods(g.getGoodsId(),bo.getUserId());
|
|
|
}
|
|
@@ -471,6 +480,22 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
return orderListVos;
|
|
|
}
|
|
|
|
|
|
+ //判断视频商品是否购买过
|
|
|
+ public boolean getHaveBuyGoods(Long goodsId,Long userId){
|
|
|
+ OrderGoodsQueryBo orderGoodsQueryBo = new OrderGoodsQueryBo();
|
|
|
+ orderGoodsQueryBo.setUserId(userId);
|
|
|
+ orderGoodsQueryBo.setGoodsId(goodsId);
|
|
|
+ List<Integer> payStatusList = new ArrayList<>();
|
|
|
+ payStatusList.add(2);
|
|
|
+ payStatusList.add(3);
|
|
|
+ orderGoodsQueryBo.setPayStatusList(payStatusList);
|
|
|
+ List<OrderGoodsVo> list1 = iOrderGoodsService.queryList(orderGoodsQueryBo);
|
|
|
+ if(list1!=null&&list1.size()>0){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
//检查是否允许重复购买商品
|
|
|
public boolean canBuyRepeatGoods(Long goodsId,Long userId){
|
|
|
//判断是否还有未过期的班级
|