|
@@ -39,9 +39,11 @@ import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
|
|
|
import com.zhongzheng.modules.goods.bo.GoodsSectionListBo;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.domain.GoodsQuestionRel;
|
|
|
+import com.zhongzheng.modules.goods.domain.QuestionMerchant;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsCourseService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsQuestionRelService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
+import com.zhongzheng.modules.goods.service.IQuestionMerchantService;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsSectionListVo;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeGoods;
|
|
@@ -166,6 +168,8 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
private IOrderInputService iOrderInputService;
|
|
|
@Autowired
|
|
|
private IUserProfileService iUserProfileService;
|
|
|
+ @Autowired
|
|
|
+ private IQuestionMerchantService iQuestionMerchantService;
|
|
|
|
|
|
@Override
|
|
|
public OrderGoodsVo queryById(Long orderGoodsId) {
|
|
@@ -675,6 +679,43 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
examApplyGoodsVos.addAll(examApplyGoodsVos2);
|
|
|
goodsVo.setExamApplyGoodsList(examApplyGoodsVos);
|
|
|
}
|
|
|
+
|
|
|
+ //预约考试是否可以购买题库(该商品没有关联题库且预约考试的时间提前8天)
|
|
|
+ UserSubscribe userSubscribeTwo = iUserSubscribeService.getOne(new LambdaQueryWrapper<UserSubscribe>()
|
|
|
+ .eq(UserSubscribe::getOrderGoodsId,goodsVo.getOrderGoodsId())
|
|
|
+ .eq(UserSubscribe::getSubscribeStatus,1)
|
|
|
+ .eq(UserSubscribe::getExamStatus,0)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (ObjectUtils.isNotNull(userSubscribeTwo)){
|
|
|
+ Goods goods = iGoodsService.getById(goodsVo.getGoodsId());
|
|
|
+ if (ObjectUtils.isNull(goods.getQuestionGoodsId())){
|
|
|
+ //没有关联题库 是否购买过题库
|
|
|
+ int count = iGoodsQuestionRelService.count(new LambdaQueryWrapper<GoodsQuestionRel>()
|
|
|
+ .eq(GoodsQuestionRel::getOrderGoodsId, userSubscribeTwo.getOrderGoodsId())
|
|
|
+ .gt(GoodsQuestionRel::getQuestionDoNum, 0));
|
|
|
+ if (count <= 0){
|
|
|
+ //考试时间往前推8天
|
|
|
+ Long appointTime = DateUtils.getDayBefore(userSubscribeTwo.getApplySiteExamTime(), 8);
|
|
|
+ if (DateUtils.getNowTime() < appointTime){
|
|
|
+ goodsVo.setOpenQuestion(1);
|
|
|
+ //获取默认题库商家商品
|
|
|
+ QuestionMerchant one = iQuestionMerchantService.getOne(new LambdaQueryWrapper<QuestionMerchant>()
|
|
|
+ .eq(QuestionMerchant::getSign, 1)
|
|
|
+ .eq(QuestionMerchant::getStatus, 1)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (ObjectUtils.isNotNull(one)){
|
|
|
+ Goods goodsOne = iGoodsService.getOne(new LambdaQueryWrapper<Goods>()
|
|
|
+ .eq(Goods::getQuestionMerchantId, one.getMerchantId())
|
|
|
+ .eq(Goods::getStatus, 1)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (ObjectUtils.isNotNull(goodsOne)){
|
|
|
+ goodsVo.setQuestionGoodsId(goodsOne.getGoodsId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return list;
|