|
@@ -325,10 +325,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
Long gradeId = null;
|
|
|
//判断是否购买历史班级都过期
|
|
|
canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId());
|
|
|
+ //判断是否有购买过,服务期是否过期
|
|
|
+ Long oldOrderGoodsId = getHaveBuyGoods(g.getGoodsId(), bo.getUserId());
|
|
|
if (g.getGoodsInputData() != null) {
|
|
|
gradeId = g.getGoodsInputData().getGradeId();
|
|
|
- //判断是否有购买过
|
|
|
- Long oldOrderGoodsId = getHaveBuyGoods(g.getGoodsId(), bo.getUserId());
|
|
|
if (Validator.isNotEmpty(oldOrderGoodsId)) {
|
|
|
//有指定选班模板且视频商品班级已过期,记录复购状态
|
|
|
orderGoods.setRebuyOrderGoodsId(oldOrderGoodsId);
|
|
@@ -1027,7 +1027,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
return payResult;
|
|
|
}
|
|
|
|
|
|
- //判断视频商品是否购买过
|
|
|
+ //判断视频商品是否购买过且服务期是否过期
|
|
|
public Long getHaveBuyGoods(Long goodsId, Long userId) {
|
|
|
OrderGoodsQueryBo orderGoodsQueryBo = new OrderGoodsQueryBo();
|
|
|
orderGoodsQueryBo.setUserId(userId);
|
|
@@ -1040,15 +1040,21 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
List<Integer> payStatusList = new ArrayList<>();
|
|
|
payStatusList.add(2);
|
|
|
payStatusList.add(3);
|
|
|
+ payStatusList.add(4);
|
|
|
orderGoodsQueryBo.setPayStatusList(payStatusList);
|
|
|
List<OrderGoodsVo> list1 = iOrderGoodsService.selectList(orderGoodsQueryBo);
|
|
|
+ for(OrderGoodsVo goodsVo : list1){
|
|
|
+ if(Validator.isNotEmpty(goodsVo.getServiceEndTime())&&(goodsVo.getServiceEndTime().longValue()>(System.currentTimeMillis()/1000))){
|
|
|
+ throw new CustomException("存在已购买【班级学习服务期未过期】的商品,不可以重复购买商品", 511);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (list1 != null && list1.size() > 0) {
|
|
|
return list1.get(0).getOrderGoodsId();
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- //检查是否允许重复购买商品
|
|
|
+ //检查是否允许重复购买视频商品
|
|
|
public boolean canBuyRepeatGoods(Long goodsId, Long userId) {
|
|
|
//判断是否还有未过期的班级
|
|
|
ClassGradeQueryBo bo = new ClassGradeQueryBo();
|
|
@@ -1080,7 +1086,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
Long num = iOrderGoodsService.getBuyGoodsHistory(bo);
|
|
|
if (num.longValue() > 0) {
|
|
|
if (goodsType.equals(2)) {
|
|
|
- throw new CustomException("不可以重复购买题库商品", 511);
|
|
|
+ throw new CustomException("存在已购买的题库商品,不可以重复购买商品", 511);
|
|
|
}
|
|
|
throw new CustomException("不可以重复购买商品", 511);
|
|
|
}
|