|
|
@ -24,6 +24,8 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.InputStream; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.text.DecimalFormat; |
|
|
|
import java.text.DecimalFormat; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
@ -92,12 +94,53 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj |
|
|
|
//练习统计
|
|
|
|
//练习统计
|
|
|
|
List<GetByUserRecordResp> sumByPracticeNum = this.baseMapper.sumByPracticeNum(userId); |
|
|
|
List<GetByUserRecordResp> sumByPracticeNum = this.baseMapper.sumByPracticeNum(userId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//练习总分
|
|
|
|
|
|
|
|
Integer practiceByScore = 0; |
|
|
|
|
|
|
|
//练习总耗时
|
|
|
|
|
|
|
|
Integer practiceByTime = 0; |
|
|
|
|
|
|
|
for (GetByUserRecordResp resp : sumByPracticeNum) { |
|
|
|
|
|
|
|
//累计总分
|
|
|
|
|
|
|
|
practiceByScore += resp.getScore(); |
|
|
|
|
|
|
|
//累计时间
|
|
|
|
|
|
|
|
practiceByTime += resp.getTimeSum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//考核统计
|
|
|
|
//考核统计
|
|
|
|
List<ProjectRecordVo> sumByAssessmentNum = this.baseMapper.sumByAssessmentNum(userId); |
|
|
|
List<ProjectRecordVo> sumByAssessmentNum = this.baseMapper.sumByAssessmentNum(userId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//练习总分
|
|
|
|
|
|
|
|
Integer assessmenteByScore = 0; |
|
|
|
|
|
|
|
//练习总耗时
|
|
|
|
|
|
|
|
double assessmentByTime = 0; |
|
|
|
|
|
|
|
for (ProjectRecordVo vo : sumByAssessmentNum) { |
|
|
|
|
|
|
|
//累计总分
|
|
|
|
|
|
|
|
assessmenteByScore += vo.getScore(); |
|
|
|
|
|
|
|
//累计时间
|
|
|
|
|
|
|
|
assessmentByTime += vo.getTimeSum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置实验次数
|
|
|
|
Integer numer = sumByPracticeNum.size() + sumByAssessmentNum.size(); |
|
|
|
Integer numer = sumByPracticeNum.size() + sumByAssessmentNum.size(); |
|
|
|
projectRecordVo.setExperimentNumber(numer); |
|
|
|
projectRecordVo.setExperimentNumber(numer); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//取平均分
|
|
|
|
|
|
|
|
//BigDecimal getSumByScore = (new BigDecimal(practiceByScore).add(new BigDecimal(assessmenteByScore))).divide(new BigDecimal(numer)).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (practiceByScore + assessmenteByScore != 0) { |
|
|
|
|
|
|
|
double getSumByScore = (practiceByScore + assessmenteByScore) / numer; |
|
|
|
|
|
|
|
projectRecordVo.setAvgScore(getSumByScore); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
projectRecordVo.setAvgScore(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获得总耗时
|
|
|
|
|
|
|
|
double getTime = practiceByTime + assessmentByTime; |
|
|
|
|
|
|
|
projectRecordVo.setTotalTime(new Double(getTime)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Double totalTime = projectRecordVo.getTotalTime(); |
|
|
|
Double totalTime = projectRecordVo.getTotalTime(); |
|
|
|
if (totalTime != null) { |
|
|
|
if (totalTime != null) { |
|
|
|
DecimalFormat df = new DecimalFormat("0.00"); |
|
|
|
DecimalFormat df = new DecimalFormat("0.00"); |
|
|
|