|
@@ -2320,6 +2320,37 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
return payResult;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean studyCheck(Long orderGoodsId, Long userId) {
|
|
|
+ OrderGoods orderGoods = iOrderGoodsService.getById(orderGoodsId);
|
|
|
+ if (ObjectUtils.isNull(orderGoods)){
|
|
|
+ throw new CustomException("数据错误");
|
|
|
+ }
|
|
|
+ Order order = getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderSn, orderGoods.getOrderSn()));
|
|
|
+ if (!order.getUserId().equals(userId)){
|
|
|
+ throw new CustomException("订单数据不匹配");
|
|
|
+ }
|
|
|
+ //校验是否有正在学习的七大员继教课程
|
|
|
+ List<ClassGradeUser> classGradeUser = iClassGradeUserService.getClassInfoByUser(userId);
|
|
|
+ if (CollectionUtils.isEmpty(classGradeUser)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (!classGradeUser.stream().noneMatch(x -> x.getOrderGoodsId().equals(orderGoodsId))){
|
|
|
+ ClassGradeUser gradeUser = classGradeUser.stream().findFirst().orElse(null);
|
|
|
+ OrderGoods orderGoodsTwo = iOrderGoodsService.getById(gradeUser.getOrderGoodsId());
|
|
|
+ Goods goods = iGoodsService.getById(orderGoodsTwo.getGoodsId());
|
|
|
+ throw new CustomException(String.format("请先学完【%s】课程!",goods.getGoodsName()));
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5);
|
|
|
+ boolean b = integers.stream().noneMatch(x -> x == 3);
|
|
|
+ System.out.println("b = " + b);
|
|
|
+ }
|
|
|
+
|
|
|
private String createGradeCode(Long goodsId, CourseBusinessVo business) {
|
|
|
|
|
|
Goods goods = iGoodsService.getById(goodsId);
|