|
@@ -34,9 +34,11 @@ import com.zhongzheng.modules.goods.bo.GoodsBatchDelBo;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.domain.GoodsCourse;
|
|
|
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.GoodsPeriodStatusVo;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsPeriodVo;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsUserVo;
|
|
@@ -137,6 +139,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
|
private IGoodsService iGoodsService;
|
|
|
@Autowired
|
|
|
private IGoodsQuestionRelService iGoodsQuestionRelService;
|
|
|
+ @Autowired
|
|
|
+ private IQuestionMerchantService iQuestionMerchantService;
|
|
|
|
|
|
|
|
|
|
|
@@ -610,22 +614,42 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
|
goodsUserVo.setBeforeEndTime(examBefore.getBeforeEndTime());
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ //预约考试是否可以购买题库(该商品没有关联题库且预约考试的时间提前8天)
|
|
|
|
|
|
- //预约考试是否可以购买题库(该商品没有关联题库且预约考试的时间提前8天)
|
|
|
+ UserSubscribe userSubscribeTwo = iUserSubscribeService.getOne(new LambdaQueryWrapper<UserSubscribe>()
|
|
|
+ .eq(UserSubscribe::getOrderGoodsId,goodsUserVo.getOrderGoodsId())
|
|
|
+ .eq(UserSubscribe::getSubscribeStatus,1)
|
|
|
+ .eq(UserSubscribe::getExamStatus,0)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (ObjectUtils.isNotNull(userSubscribeTwo)){
|
|
|
Goods goods = iGoodsService.getById(goodsUserVo.getGoodsId());
|
|
|
if (ObjectUtils.isNull(goods.getQuestionGoodsId())){
|
|
|
//没有关联题库 是否购买过题库
|
|
|
int count = iGoodsQuestionRelService.count(new LambdaQueryWrapper<GoodsQuestionRel>()
|
|
|
- .eq(GoodsQuestionRel::getOrderGoodsId, userSubscribe.getOrderGoodsId())
|
|
|
- .eq(GoodsQuestionRel::getQuestionGoodsId, goods.getQuestionGoodsId())
|
|
|
+ .eq(GoodsQuestionRel::getOrderGoodsId, userSubscribeTwo.getOrderGoodsId())
|
|
|
.eq(GoodsQuestionRel::getStatus, 1)
|
|
|
.gt(GoodsQuestionRel::getQuestionDoNum, 0));
|
|
|
if (count <= 0){
|
|
|
//考试时间往前推8天
|
|
|
- Long appointTime = DateUtils.getDayBefore(userSubscribe.getApplySiteExamTime(), 8);
|
|
|
+ Long appointTime = DateUtils.getDayBefore(userSubscribeTwo.getApplySiteExamTime(), 8);
|
|
|
if (DateUtils.getNowTime() < appointTime){
|
|
|
goodsUserVo.setOpenQuestion(1);
|
|
|
- goodsUserVo.setQuestionGoodsId(goods.getQuestionGoodsId());
|
|
|
+ //获取默认题库商家商品
|
|
|
+ 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)){
|
|
|
+ goodsUserVo.setQuestionGoodsId(goodsOne.getGoodsId());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|