|
@@ -3,8 +3,11 @@ package com.zhongzheng.modules.grade.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
-import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
|
|
|
-import com.zhongzheng.modules.grade.vo.ClassPeriodStudentVo;
|
|
|
+import com.zhongzheng.modules.grade.vo.*;
|
|
|
+import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
|
|
|
+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;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -15,9 +18,9 @@ import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
|
|
|
import com.zhongzheng.modules.grade.bo.ClassGradeUserEditBo;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
import com.zhongzheng.modules.grade.mapper.ClassGradeUserMapper;
|
|
|
-import com.zhongzheng.modules.grade.vo.ClassGradeUserVo;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
@@ -32,6 +35,9 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper, ClassGradeUser> implements IClassGradeUserService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserStudyRecordService iUserStudyRecordService;
|
|
|
+
|
|
|
@Override
|
|
|
public ClassGradeUserVo queryById(Long id){
|
|
|
ClassGradeUser db = this.baseMapper.selectById(id);
|
|
@@ -104,6 +110,51 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
|
|
|
@Override
|
|
|
public List<ClassPeriodStudentVo> listUserPeriod(ClassGradeUserQueryBo bo) {
|
|
|
- return baseMapper.listUserPeriod(bo);
|
|
|
+ List<ClassPeriodStudentVo> classPeriodStudentVos = baseMapper.listUserPeriod(bo);
|
|
|
+ for (ClassPeriodStudentVo classPeriodStudentVo : classPeriodStudentVos) {
|
|
|
+ Long secLong = 0L;
|
|
|
+ Long studyLong = 0L;
|
|
|
+
|
|
|
+ SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
|
|
|
+ subjectStudyRecordQueryBo.setGoodsId(classPeriodStudentVo.getGoodsId());
|
|
|
+ subjectStudyRecordQueryBo.setUserId(bo.getUserId());
|
|
|
+ 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();
|
|
|
+
|
|
|
+ }
|
|
|
+ //BigDecimal divide = new BigDecimal(studyLong.toString()).divide(new BigDecimal(secLong.toString()),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ //classGradeStudentVo.setStudyNum(divide.multiply(new BigDecimal("100")).longValue());
|
|
|
+ classPeriodStudentVo.setSecAllNum(secLong);
|
|
|
+ classPeriodStudentVo.setStuAllNum(studyLong);
|
|
|
+ }
|
|
|
+ return classPeriodStudentVos;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ClassPeriodUserVo> listPeriod(ClassGradeUserQueryBo bo) {
|
|
|
+ List<ClassPeriodUserVo> classPeriodUserVos = baseMapper.listPeriod(bo);
|
|
|
+ for (ClassPeriodUserVo classPeriodUserVo : classPeriodUserVos) {
|
|
|
+ Long secLong = 0L;
|
|
|
+ Long studyLong = 0L;
|
|
|
+
|
|
|
+ SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
|
|
|
+ subjectStudyRecordQueryBo.setGoodsId(classPeriodUserVo.getGoodsId());
|
|
|
+ subjectStudyRecordQueryBo.setUserId(bo.getUserId());
|
|
|
+ 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();
|
|
|
+
|
|
|
+ }
|
|
|
+ //BigDecimal divide = new BigDecimal(studyLong.toString()).divide(new BigDecimal(secLong.toString()),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ //classGradeStudentVo.setStudyNum(divide.multiply(new BigDecimal("100")).longValue());
|
|
|
+ classPeriodUserVo.setSecAllNum(secLong);
|
|
|
+ classPeriodUserVo.setStuAllNum(studyLong);
|
|
|
+
|
|
|
+ classPeriodUserVo.setPending(classPeriodUserVo.getExamNum()+classPeriodUserVo.getSecAllNum()-classPeriodUserVo.getPass()-classPeriodUserVo.getCheat());
|
|
|
+ }
|
|
|
+ return classPeriodUserVos;
|
|
|
}
|
|
|
}
|