|
@@ -3,6 +3,7 @@ package com.zhongzheng.modules.grade.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
@@ -15,6 +16,9 @@ import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeSysService;
|
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeStudentVo;
|
|
|
import com.zhongzheng.modules.system.domain.SysConfig;
|
|
|
+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;
|
|
@@ -26,6 +30,7 @@ import com.zhongzheng.modules.grade.mapper.ClassGradeMapper;
|
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeVo;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeService;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
@@ -49,6 +54,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
@Autowired
|
|
|
private IClassGradeGoodsService classGradeGoodsService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserStudyRecordService iUserStudyRecordService;
|
|
|
+
|
|
|
@Override
|
|
|
public ClassGradeVo queryById(Long gradeId){
|
|
|
ClassGradeQueryBo classGradeQueryBo = new ClassGradeQueryBo();
|
|
@@ -170,7 +178,26 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ClassGradeStudentVo> listGrade(ClassGradeQueryBo bo) {
|
|
|
- return baseMapper.listGrade(bo);
|
|
|
+ public List<ClassGradeStudentVo> listGrade(ClassGradeUserQueryBo bo) {
|
|
|
+ List<ClassGradeStudentVo> classGradeStudentVos = baseMapper.listGrade(bo);
|
|
|
+ for (ClassGradeStudentVo classGradeStudentVo : classGradeStudentVos) {
|
|
|
+ Long secLong = 0L;
|
|
|
+ Long studyLong = 0L;
|
|
|
+
|
|
|
+ SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
|
|
|
+ subjectStudyRecordQueryBo.setGoodsId(classGradeStudentVo.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());
|
|
|
+ classGradeStudentVo.setSecAllNum(secLong);
|
|
|
+ classGradeStudentVo.setStuAllNum(studyLong);
|
|
|
+ }
|
|
|
+ return classGradeStudentVos;
|
|
|
}
|
|
|
}
|