|
@@ -6,15 +6,29 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
|
|
+import com.zhongzheng.common.core.page.TableDataInfo;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
|
|
+import com.zhongzheng.modules.activity.domain.ActivityRecommend;
|
|
|
|
|
+import com.zhongzheng.modules.activity.domain.ActivityRecommendGoods;
|
|
|
|
|
+import com.zhongzheng.modules.activity.service.IActivityRecommendGoodsService;
|
|
|
|
|
+import com.zhongzheng.modules.activity.service.IActivityRecommendService;
|
|
|
|
|
+import com.zhongzheng.modules.bank.domain.Exam;
|
|
|
|
|
+import com.zhongzheng.modules.bank.domain.QuestionBusiness;
|
|
|
|
|
+import com.zhongzheng.modules.bank.service.IExamService;
|
|
|
|
|
+import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
|
|
|
import com.zhongzheng.modules.course.domain.Course;
|
|
import com.zhongzheng.modules.course.domain.Course;
|
|
|
import com.zhongzheng.modules.exam.bo.*;
|
|
import com.zhongzheng.modules.exam.bo.*;
|
|
|
import com.zhongzheng.modules.exam.domain.ExamBefore;
|
|
import com.zhongzheng.modules.exam.domain.ExamBefore;
|
|
|
import com.zhongzheng.modules.exam.vo.*;
|
|
import com.zhongzheng.modules.exam.vo.*;
|
|
|
|
|
+import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
|
|
+import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
|
|
+import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.user.vo.CalendarStudyVo;
|
|
import com.zhongzheng.modules.user.vo.CalendarStudyVo;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -36,6 +50,17 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
@Service
|
|
|
public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply> implements IExamApplyService {
|
|
public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply> implements IExamApplyService {
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IQuestionBusinessService iQuestionBusinessService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IExamService iExamService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IActivityRecommendService iActivityRecommendService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IActivityRecommendGoodsService iActivityRecommendGoodsService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IGoodsService iGoodsService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public ExamApplyVo queryById(Long applyId){
|
|
public ExamApplyVo queryById(Long applyId){
|
|
|
ExamApplyVo examApplyVo = baseMapper.selectByApply(applyId);
|
|
ExamApplyVo examApplyVo = baseMapper.selectByApply(applyId);
|
|
@@ -295,6 +320,51 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
|
|
|
return baseMapper.countApplySubscribe(bo);
|
|
return baseMapper.countApplySubscribe(bo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public TableDataInfo<GoodsVo> getRecommendGoodsList(ExamRecommendGoodsQueryBo bo) {
|
|
|
|
|
+ TableDataInfo tableDataInfo = new TableDataInfo();
|
|
|
|
|
+ Exam exam = iExamService.getById(bo.getExamId());
|
|
|
|
|
+ if (ObjectUtils.isNull(exam)){
|
|
|
|
|
+ throw new CustomException("获取试卷信息失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ //获取试卷业务层次信息
|
|
|
|
|
+ QuestionBusiness business = iQuestionBusinessService.getOne(new LambdaQueryWrapper<QuestionBusiness>()
|
|
|
|
|
+ .eq(QuestionBusiness::getMajorId, bo.getExamId())
|
|
|
|
|
+ .eq(QuestionBusiness::getType, 2));
|
|
|
|
|
+ if (ObjectUtils.isNull(business)){
|
|
|
|
|
+ throw new CustomException("获取试卷业务层次信息失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ //获取推荐位信息
|
|
|
|
|
+ List<ActivityRecommend> list = iActivityRecommendService.list(new LambdaQueryWrapper<ActivityRecommend>()
|
|
|
|
|
+ .eq(ActivityRecommend::getEducationTypeId, business.getEducationTypeId())
|
|
|
|
|
+ .eq(ActivityRecommend::getBusinessId, business.getBusinessId())
|
|
|
|
|
+ .eq(ActivityRecommend::getType, 1)
|
|
|
|
|
+ .eq(ActivityRecommend::getStatus,1));
|
|
|
|
|
+ if (CollectionUtils.isEmpty(list)){
|
|
|
|
|
+ return tableDataInfo;
|
|
|
|
|
+ }
|
|
|
|
|
+ ActivityRecommend activityRecommend = list.stream().findFirst().get();
|
|
|
|
|
+ com.baomidou.mybatisplus.extension.plugins.pagination.Page<ActivityRecommendGoods> page =
|
|
|
|
|
+ iActivityRecommendGoodsService.page(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(bo.getPageNum(), bo.getPageSize()),
|
|
|
|
|
+ new LambdaQueryWrapper<ActivityRecommendGoods>()
|
|
|
|
|
+ .eq(ActivityRecommendGoods::getRecommendId, activityRecommend.getRecommendId())
|
|
|
|
|
+ .orderByAsc(ActivityRecommendGoods::getSort));
|
|
|
|
|
+ if (CollectionUtils.isEmpty(page.getRecords())){
|
|
|
|
|
+ return tableDataInfo;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<GoodsVo> result = page.getRecords().stream().map(item -> {
|
|
|
|
|
+ Goods goods = iGoodsService.getById(item.getGoodsId());
|
|
|
|
|
+ GoodsVo goodsVo = new GoodsVo();
|
|
|
|
|
+ BeanUtil.copyProperties(goods, goodsVo);
|
|
|
|
|
+ return goodsVo;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ tableDataInfo.setTotal(page.getTotal());
|
|
|
|
|
+ tableDataInfo.setRows(result);
|
|
|
|
|
+
|
|
|
|
|
+ return tableDataInfo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private boolean checkNameUnique(ExamApply entity) {
|
|
private boolean checkNameUnique(ExamApply entity) {
|
|
|
ExamApply info = getOne(new LambdaQueryWrapper<ExamApply>()
|
|
ExamApply info = getOne(new LambdaQueryWrapper<ExamApply>()
|
|
|
.eq(ExamApply::getApplyName,entity.getApplyName()).ne(ExamApply::getStatus,-1).last("limit 1"));
|
|
.eq(ExamApply::getApplyName,entity.getApplyName()).ne(ExamApply::getStatus,-1).last("limit 1"));
|