|
@@ -3,6 +3,7 @@ package com.zhongzheng.modules.course.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
@@ -17,7 +18,10 @@ import com.zhongzheng.modules.course.service.ICourseSectionBusinessService;
|
|
|
import com.zhongzheng.modules.course.service.ICourseService;
|
|
|
import com.zhongzheng.modules.course.vo.CourseVo;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsPeriodVo;
|
|
|
+import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
|
|
|
import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
|
|
|
+import com.zhongzheng.modules.user.service.IUserStudyRecordService;
|
|
|
+import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -25,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
@@ -42,6 +47,9 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
|
@Autowired
|
|
|
private CourseMapper courseMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserStudyRecordService iUserStudyRecordService;
|
|
|
+
|
|
|
@Override
|
|
|
public CourseVo queryById(Long courseId){
|
|
|
Course db = this.baseMapper.selectById(courseId);
|
|
@@ -140,7 +148,34 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
|
|
|
|
@Override
|
|
|
public List<GoodsPeriodVo> listGoodsPeriodVo(UserPlanQueryBo bo) {
|
|
|
- return baseMapper.listGoodsPeriodVo(bo);
|
|
|
+ List<GoodsPeriodVo> goodsPeriodVos = baseMapper.listGoodsPeriodVo(bo);
|
|
|
+ for (GoodsPeriodVo goodsPeriodVo : goodsPeriodVos) {
|
|
|
+ Long secLong = 0L;
|
|
|
+ Long studyLong = 0L;
|
|
|
+ SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
|
|
|
+ subjectStudyRecordQueryBo.setGoodsId(goodsPeriodVo.getGoodsId());
|
|
|
+ subjectStudyRecordQueryBo.setUserId(bo.getUserId());
|
|
|
+ subjectStudyRecordQueryBo.setGradeId(goodsPeriodVo.getGradeId());
|
|
|
+ List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
|
|
|
+ if (!CollectionUtils.isEmpty(subjectStudyRecordVos)) {
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ if (secLong.equals(studyLong) && goodsPeriodVo.getExamNum().equals(goodsPeriodVo.getRecordNum())) {
|
|
|
+ if (goodsPeriodVo.getPending() != 0 || goodsPeriodVo.getExamPending() != 0) {
|
|
|
+ goodsPeriodVo.setPeriodStatus(2L);
|
|
|
+ } else if (goodsPeriodVo.getCheat() != 0 || goodsPeriodVo.getExamCheat() != 0) {
|
|
|
+ goodsPeriodVo.setPeriodStatus(3L);
|
|
|
+ } else {
|
|
|
+ goodsPeriodVo.setPeriodStatus(1L);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ goodsPeriodVo.setPeriodStatus(-1L);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return goodsPeriodVos;
|
|
|
}
|
|
|
|
|
|
private boolean checkNameUnique(Course entity) {
|