|
@@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
|
+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;
|
|
@@ -668,6 +671,219 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
return goodsUserVos;
|
|
return goodsUserVos;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public TableDataInfo<GoodsUserVo> goodsListPage(CourseQueryBo bo) {
|
|
|
|
+ TableDataInfo tableDataInfo = new TableDataInfo();
|
|
|
|
+ PageHelper.startPage(bo.getPageNum(), bo.getPageSize());
|
|
|
|
+ List<Long> page = baseMapper.getOrderGoodsIds(bo);
|
|
|
|
+ PageInfo<Long> pageInfo = new PageInfo<Long>(page);
|
|
|
|
+ if (CollectionUtils.isEmpty(pageInfo.getList())){
|
|
|
|
+ return tableDataInfo;
|
|
|
|
+ }
|
|
|
|
+ tableDataInfo.setTotal(pageInfo.getTotal());
|
|
|
|
+ bo.setOrderGoodsIds(pageInfo.getList());
|
|
|
|
+ List<GoodsUserVo> goodsUserVos = baseMapper.goodsList(bo);
|
|
|
|
+ //用户课程得详细信息
|
|
|
|
+ for (GoodsUserVo goodsUserVo : goodsUserVos) {
|
|
|
|
+ //获得当前所在班级
|
|
|
|
+ ClassGradeVo classGradeVo = baseMapper.gradeIdSelect(goodsUserVo.getUserId(),goodsUserVo.getGoodsId(),goodsUserVo.getGradeId(),goodsUserVo.getOrderGoodsId());
|
|
|
|
+ if(Validator.isEmpty(classGradeVo)){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String fullName = goodsUserVo.getEducationName()+goodsUserVo.getBusinessName()+goodsUserVo.getProjectName();
|
|
|
|
+ goodsUserVo.setErJianErZao(false);
|
|
|
|
+ goodsUserVo.setUserProfile(0);
|
|
|
|
+ if(Validator.isNotEmpty(fullName)){
|
|
|
|
+ if(fullName.equals("继续教育二级建造师")||fullName.equals("继续教育二级造价师")){
|
|
|
|
+ goodsUserVo.setErJianErZao(true);
|
|
|
|
+ }else if (goodsUserVo.getEducationName().equals("考前培训") && goodsUserVo.getProjectName().equals("施工现场专业人员")){
|
|
|
|
+ //七大员新考 判断是否提交学员资料
|
|
|
|
+ int count = iUserProfileService.count(new LambdaQueryWrapper<UserProfile>()
|
|
|
|
+ .notIn(UserProfile::getStatus, Arrays.asList(3, -1))
|
|
|
|
+ .eq(UserProfile::getUserId, goodsUserVo.getUserId())
|
|
|
|
+ .eq(UserProfile::getGoodsId, goodsUserVo.getGoodsId())
|
|
|
|
+// .eq(UserProfile::getCurrentStatus, 1)
|
|
|
|
+ );
|
|
|
|
+ if (count > 0){
|
|
|
|
+ goodsUserVo.setUserProfile(1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ goodsUserVo.setGradeId(classGradeVo.getGradeId());
|
|
|
|
+ goodsUserVo.setLearningStatus(classGradeVo.getLearningStatus());
|
|
|
|
+ goodsUserVo.setLearningTimeStart(classGradeVo.getLearningTimeStart());
|
|
|
|
+ goodsUserVo.setGradeStatus(classGradeVo.getStatus());
|
|
|
|
+ goodsUserVo.setClassStartTime(classGradeVo.getClassStartTime());
|
|
|
|
+ goodsUserVo.setClassEndTime(classGradeVo.getClassEndTime());
|
|
|
|
+ goodsUserVo.setPeriodStatus(classGradeVo.getPeriodStatus());
|
|
|
|
+ goodsUserVo.setClassStatus(classGradeVo.getClassStatus());
|
|
|
|
+ goodsUserVo.setRecordNum(classGradeVo.getRecordNum());
|
|
|
|
+ goodsUserVo.setExamNum(classGradeVo.getExamNum());
|
|
|
|
+ goodsUserVo.setInterfaceAccountId(classGradeVo.getInterfaceAccountId());
|
|
|
|
+ goodsUserVo.setInterfacePushId(classGradeVo.getInterfacePushId());
|
|
|
|
+ goodsUserVo.setOfficialLearningUrl(classGradeVo.getOfficialLearningUrl());
|
|
|
|
+ goodsUserVo.setOfficialStatus(classGradeVo.getOfficialStatus());
|
|
|
|
+ goodsUserVo.setLearnStatus(classGradeVo.getLearnStatus());
|
|
|
|
+ goodsUserVo.setPeriodPlush(classGradeVo.getPeriodPlush());
|
|
|
|
+ goodsUserVo.setOfficialName(classGradeVo.getOfficialName());
|
|
|
|
+ goodsUserVo.setPeriodWaitTime(classGradeVo.getPeriodWaitTime());
|
|
|
|
+ goodsUserVo.setOpenQuestion(0);
|
|
|
|
+ Long secLong = 0L;
|
|
|
|
+ Long studyLong = 0L;
|
|
|
|
+ SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
|
|
|
|
+ subjectStudyRecordQueryBo.setGoodsId(goodsUserVo.getGoodsId());
|
|
|
|
+ subjectStudyRecordQueryBo.setUserId(bo.getUserId());
|
|
|
|
+ subjectStudyRecordQueryBo.setGradeId(goodsUserVo.getGradeId());
|
|
|
|
+ subjectStudyRecordQueryBo.setOrderGoodsId(goodsUserVo.getOrderGoodsId());
|
|
|
|
+// List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
|
|
|
|
+// for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
|
|
|
|
+// secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
|
|
|
|
+// studyLong = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordNum().toString())).longValue();
|
|
|
|
+// }
|
|
|
|
+ GoodsSectionNumVo vo = iUserStudyRecordService.getGoodsSectionNum(subjectStudyRecordQueryBo);
|
|
|
|
+ if (ObjectUtils.isNotNull(vo)){
|
|
|
|
+ secLong = vo.getSectionNum();
|
|
|
|
+ studyLong = vo.getRecordNum();
|
|
|
|
+ }
|
|
|
|
+ goodsUserVo.setSecAllNum(secLong);
|
|
|
|
+ goodsUserVo.setStuAllNum(studyLong);
|
|
|
|
+ goodsUserVo.setSubscribeSign(2);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //查询对应考试安排
|
|
|
|
+ List<ExamApplyGoodsVo> examApplyGoodsVoList = iExamApplyGoodsService.listByGoodsId(goodsUserVo.getGoodsId());
|
|
|
|
+ if (examApplyGoodsVoList != null && examApplyGoodsVoList.size() > 0) {
|
|
|
|
+ //是否满足预约考试条件
|
|
|
|
+ if (ObjectUtils.isNotNull(classGradeVo.getPeriodStatus())
|
|
|
|
+ && classGradeVo.getPeriodStatus() == 1
|
|
|
|
+ && (DateUtils.getNowTime() >= goodsUserVo.getServiceStartTime() && DateUtils.getNowTime() <= goodsUserVo.getServiceEndTime())){
|
|
|
|
+ UserSubscribe userSubscribe = iUserSubscribeService.getOne(new LambdaQueryWrapper<UserSubscribe>()
|
|
|
|
+ .eq(UserSubscribe::getUserId, bo.getUserId())
|
|
|
|
+ .eq(UserSubscribe::getGoodsId, goodsUserVo.getGoodsId())
|
|
|
|
+ .eq(UserSubscribe::getSubscribeStatus, 1)
|
|
|
|
+ .orderByDesc(UserSubscribe::getCreateTime)
|
|
|
|
+ .last("limit 1"));
|
|
|
|
+ if (ObjectUtils.isNull(userSubscribe)){
|
|
|
|
+ goodsUserVo.setSubscribeSign(1);
|
|
|
|
+ }else if (ObjectUtils.isNotNull(userSubscribe.getResult()) && userSubscribe.getResult() == 0){
|
|
|
|
+ goodsUserVo.setSubscribeSign(3);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<ExamApplyGoodsVo> examApplyGoodsVos = new ArrayList<>();
|
|
|
|
+ List<ExamApplyGoodsVo> examApplyGoodsVos2 = new ArrayList<>();
|
|
|
|
+ examApplyGoodsVoList.forEach(examApplyGoodsVo -> {
|
|
|
|
+ ExamApply examApply = iExamApplyService.getById(examApplyGoodsVo.getApplyId());
|
|
|
|
+ List<ExamApplySiteTime> siteTimes = iExamApplySiteTimeService.list(new LambdaQueryWrapper<ExamApplySiteTime>()
|
|
|
|
+ .eq(ExamApplySiteTime::getApplyId, examApplyGoodsVo.getApplyId()));
|
|
|
|
+ if (CollectionUtils.isNotEmpty(siteTimes)){
|
|
|
|
+ ExamApplySiteTime timeTime = siteTimes.get(0);
|
|
|
|
+ List<ExamApplySiteTimeTwoAddBo> siteTimeTwoAddBos = JSONArray.parseArray(timeTime.getSiteTime(), ExamApplySiteTimeTwoAddBo.class);
|
|
|
|
+ ExamApplySiteTimeTwoAddBo twoAddBo = siteTimeTwoAddBos.get(0);
|
|
|
|
+ if (ObjectUtils.isNotNull(twoAddBo)){
|
|
|
|
+ Long time = timeTime.getExamTime()+28800L;
|
|
|
|
+ String format = String.format("%s-%s", twoAddBo.getStartTime(), twoAddBo.getEndTime());
|
|
|
|
+ examApplyGoodsVo.setApplyTime(time);
|
|
|
|
+ examApplyGoodsVo.setApplyMoment(format);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ switch (examApply.getApplyNature()){
|
|
|
|
+ case 1: //普通场
|
|
|
|
+ LambdaQueryWrapper<ExamApplyUser> lqw = Wrappers.lambdaQuery();
|
|
|
|
+ lqw.eq(ExamApplyUser::getApplyId, examApplyGoodsVo.getApplyId());
|
|
|
|
+ List<ExamApplyUser> examApplyUserList = iExamApplyUserService.list(lqw);
|
|
|
|
+ if (examApplyUserList != null && examApplyUserList.size() > 0) {
|
|
|
|
+ ArrayList<Long> userIds = new ArrayList<>();
|
|
|
|
+ examApplyUserList.forEach(examApplyUser -> {
|
|
|
|
+ userIds.add(examApplyUser.getUserId());
|
|
|
|
+ });
|
|
|
|
+ if (userIds.contains(bo.getUserId())) {
|
|
|
|
+ examApplyGoodsVos.add(examApplyGoodsVo);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ examApplyGoodsVos2.add(examApplyGoodsVo);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case 2://专场
|
|
|
|
+ List<ExamApplyUser> applyUsers = iExamApplyUserService
|
|
|
|
+ .list(new LambdaQueryWrapper<ExamApplyUser>().eq(ExamApplyUser::getApplyId, examApply.getApplyId()));
|
|
|
|
+ if (CollectionUtils.isNotEmpty(applyUsers) &&
|
|
|
|
+ applyUsers.stream().anyMatch(x -> x.getUserId().equals(bo.getUserId()))){
|
|
|
|
+ examApplyGoodsVos.add(examApplyGoodsVo);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ examApplyGoodsVos.addAll(examApplyGoodsVos2);
|
|
|
|
+ goodsUserVo.setExamApplyGoodsList(examApplyGoodsVos);
|
|
|
|
+ }
|
|
|
|
+ LambdaQueryWrapper<UserSubscribe> lq = Wrappers.lambdaQuery();
|
|
|
|
+ lq.eq(UserSubscribe::getOrderGoodsId, goodsUserVo.getOrderGoodsId());
|
|
|
|
+ lq.eq(UserSubscribe::getSubscribeStatus, 1);
|
|
|
|
+ lq.eq(UserSubscribe::getBeforeStatus, 1);
|
|
|
|
+ lq.last("limit 1");
|
|
|
|
+ UserSubscribe userSubscribe = iUserSubscribeService.getOne(lq);
|
|
|
|
+ if (userSubscribe != null) {
|
|
|
|
+ LambdaQueryWrapper<ExamBefore> lqw1 = Wrappers.lambdaQuery();
|
|
|
|
+ lqw1.eq(ExamBefore::getBeforeId, userSubscribe.getBeforeId());
|
|
|
|
+ lqw1.eq(ExamBefore::getStatus, 1);
|
|
|
|
+ ExamBefore examBefore = iExamBeforeService.getOne(lqw1);
|
|
|
|
+ if (examBefore != null) {
|
|
|
|
+ if ((System.currentTimeMillis()/1000) > examBefore.getBeforeStartTime().longValue() && (System.currentTimeMillis()/1000) < examBefore.getBeforeEndTime().longValue()) {
|
|
|
|
+ goodsUserVo.setBeforeStatus(1L);
|
|
|
|
+ goodsUserVo.setBeforeName(examBefore.getBeforeName());
|
|
|
|
+ goodsUserVo.setBeforeStartTime(examBefore.getBeforeStartTime());
|
|
|
|
+ goodsUserVo.setBeforeEndTime(examBefore.getBeforeEndTime());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //预约考试是否可以购买题库(该商品没有关联题库且预约考试的时间提前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, userSubscribeTwo.getOrderGoodsId())
|
|
|
|
+ .gt(GoodsQuestionRel::getQuestionDoNum, 0));
|
|
|
|
+ if (count <= 0){
|
|
|
|
+ //考试时间往前推8天
|
|
|
|
+ Long appointTime = DateUtils.getDayBefore(userSubscribeTwo.getApplySiteExamTime(), 8);
|
|
|
|
+ if (DateUtils.getNowTime() < appointTime){
|
|
|
|
+ goodsUserVo.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)){
|
|
|
|
+ goodsUserVo.setQuestionGoodsId(goodsOne.getGoodsId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ tableDataInfo.setRows(goodsUserVos.stream().sorted(Comparator.comparing(GoodsUserVo::getOgCreateTime).reversed()).collect(Collectors.toList()));
|
|
|
|
+ return tableDataInfo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<GoodsUserVo> goodsStudyProgressList(CourseQueryBo bo) {
|
|
public List<GoodsUserVo> goodsStudyProgressList(CourseQueryBo bo) {
|
|
List<GoodsUserVo> goodsUserVos = baseMapper.goodsStudyProgressList(bo);
|
|
List<GoodsUserVo> goodsUserVos = baseMapper.goodsStudyProgressList(bo);
|