|
@@ -2174,11 +2174,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
private Boolean validUserBeforeBuy(Goods goods, Long userId) {
|
|
|
if (goods.getGoodsType() == 3 || goods.getGoodsType() == 4) {
|
|
|
Long makeGoodsId = goods.getMakeGoodsId();
|
|
|
- UserExamGoods entity = userExamGoodsService.getOne(new LambdaQueryWrapper<UserExamGoods>().eq(UserExamGoods::getUserId, userId).eq(UserExamGoods::getGoodsId, makeGoodsId).last("limit 1"));
|
|
|
- if (Validator.isEmpty(entity)) {
|
|
|
- throw new CustomException("请先购买此补考前培商品的绑定商品", 510);
|
|
|
+ String makeGoodsIds = goods.getMakeGoodsIds();
|
|
|
+ if(Validator.isNotEmpty(makeGoodsIds)){
|
|
|
+ List<String> makeGoodsIdList = Arrays.stream(makeGoodsIds.toString().split(",")).collect(Collectors.toList());
|
|
|
+ UserExamGoods entity = userExamGoodsService.getOne(new LambdaQueryWrapper<UserExamGoods>().eq(UserExamGoods::getUserId, userId)
|
|
|
+ .in(UserExamGoods::getGoodsId,makeGoodsIdList).last("limit 1"));
|
|
|
+ if (Validator.isEmpty(entity)) {
|
|
|
+ throw new CustomException("请先购买此补考前培商品的绑定商品", 510);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new CustomException("补考商品未关联商品", 510);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
return true;
|
|
|
}
|