修复老师成绩方面的问题,新增饼状图接口等

master
yz 4 months ago
parent 95e813fc76
commit 3a9d852d83

@ -56,6 +56,11 @@ public class ChapterController {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "schoolId不能为空"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "schoolId不能为空");
} }
List<Chapter> list=chapterService.chapterSelect(schoolId,familes); List<Chapter> list=chapterService.chapterSelect(schoolId,familes);
for (int i = 0; i < list.size(); i++) {
if(list.get(i).getChapterName().equals("财务分析")){
list.get(i).setChapterName("家庭财务报表的编制与分析");
}
}
return new ResultEntity<>(HttpStatus.OK, "章节查询成功",list); return new ResultEntity<>(HttpStatus.OK, "章节查询成功",list);
} }

@ -110,7 +110,7 @@ public class GradeController {
studentScoreWeight.setSummaryOfKnowledgeScore(BigDecimal.valueOf(20)); studentScoreWeight.setSummaryOfKnowledgeScore(BigDecimal.valueOf(20));
studentScoreWeight.setResourceLearningScore(BigDecimal.valueOf(2)); studentScoreWeight.setResourceLearningScore(BigDecimal.valueOf(2));
studentScoreWeight.setLearningAssessmentScore(BigDecimal.valueOf(10)); studentScoreWeight.setLearningAssessmentScore(BigDecimal.valueOf(10));
studentScoreWeight.setExperimentalTrainingScore(BigDecimal.valueOf(20)); studentScoreWeight.setExperimentalTrainingScore(BigDecimal.valueOf(10));
//权重 //权重
studentScoreWeight.setSummaryOfKnowledgeWeight(BigDecimal.valueOf(0.2)); studentScoreWeight.setSummaryOfKnowledgeWeight(BigDecimal.valueOf(0.2));

@ -23,9 +23,10 @@ import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.time.LocalDateTime;
import java.util.Date; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.*;
import java.util.logging.Handler;
@RestController @RestController
@RequestMapping("/api/statisticsController") @RequestMapping("/api/statisticsController")
@ -43,11 +44,12 @@ public class StatisticsController {
StuTheoryRecordMapper stuTheoryRecordMapper; StuTheoryRecordMapper stuTheoryRecordMapper;
@Autowired @Autowired
UserInfoMapper userInfoMapper; UserInfoMapper userInfoMapper;
//学生端 -我的成绩、有效时长、各模块用时 //学生端 -我的成绩、有效时长、各模块用时
@AnonymousAccess @AnonymousAccess
@GetMapping("/selectStuStatistics") @GetMapping("/selectStuStatistics")
@ApiOperation("学生端 -我的成绩、有效时长、各模块用时") @ApiOperation("学生端 -我的成绩、有效时长、各模块用时")
public ResultEntity<StuStatisticsDto> selectStuStatistics(@RequestParam String userId){ public ResultEntity<StuStatisticsDto> selectStuStatistics(@RequestParam String userId) {
ScoreRankExample scoreRankExample = new ScoreRankExample(); ScoreRankExample scoreRankExample = new ScoreRankExample();
scoreRankExample.createCriteria().andUseridEqualTo(userId).andUpdateDateEqualTo(scoreRankService.getNowDate()); scoreRankExample.createCriteria().andUseridEqualTo(userId).andUpdateDateEqualTo(scoreRankService.getNowDate());
List<ScoreRank> scoreRankList = scoreRankMapper.selectByExample(scoreRankExample); List<ScoreRank> scoreRankList = scoreRankMapper.selectByExample(scoreRankExample);
@ -59,43 +61,43 @@ public class StatisticsController {
stuStatisticsDto.setZhghTime(0); stuStatisticsDto.setZhghTime(0);
stuStatisticsDto.setKszxTime(BigDecimal.valueOf(0)); stuStatisticsDto.setKszxTime(BigDecimal.valueOf(0));
stuStatisticsDto.setZyzxTime(0); stuStatisticsDto.setZyzxTime(0);
if(!scoreRankList.isEmpty()){ if (!scoreRankList.isEmpty()) {
ScoreRank scoreRank = scoreRankList.get(0); ScoreRank scoreRank = scoreRankList.get(0);
stuStatisticsDto.setRank(scoreRank.getTotalRank()); stuStatisticsDto.setRank(scoreRank.getTotalRank());
stuStatisticsDto.setScore(scoreRank.getTotalScore()); stuStatisticsDto.setScore(scoreRank.getTotalScore());
//获取客户案例时长 //获取客户案例时长
Integer khanTime=stuTrainingMapper.selectTotalTrainingTimeByUserId(userId); Integer khanTime = stuTrainingMapper.selectTotalTrainingTimeByUserId(userId);
if (khanTime==null){ if (khanTime == null) {
khanTime = 0; khanTime = 0;
} }
stuStatisticsDto.setKhalTime(khanTime); stuStatisticsDto.setKhalTime(khanTime);
//获取综合规划时间 //获取综合规划时间
Integer zhghTime=synthesisPlanClientMapper.getTotalUseTime(userId); Integer zhghTime = synthesisPlanClientMapper.getTotalUseTime(userId);
if (zhghTime==null){ if (zhghTime == null) {
zhghTime = 0; zhghTime = 0;
} }
stuStatisticsDto.setZhghTime(zhghTime); stuStatisticsDto.setZhghTime(zhghTime);
//获取考试中心时间 //获取考试中心时间
StuTheoryRecord stuTheoryRecord = stuTheoryRecordMapper.selectByPrimaryKey(userId); StuTheoryRecord stuTheoryRecord = stuTheoryRecordMapper.selectByPrimaryKey(userId);
if(stuTheoryRecord!=null){ if (stuTheoryRecord != null) {
stuStatisticsDto.setKszxTime(stuTheoryRecord.getTotalDuration()); stuStatisticsDto.setKszxTime(stuTheoryRecord.getTotalDuration());
} }
stuStatisticsDto.setTotalTime(BigDecimal.valueOf(khanTime+zhghTime).add(stuTheoryRecord==null?BigDecimal.ZERO:stuTheoryRecord.getTotalDuration())); stuStatisticsDto.setTotalTime(BigDecimal.valueOf(khanTime + zhghTime).add(stuTheoryRecord == null ? BigDecimal.ZERO : stuTheoryRecord.getTotalDuration()));
} }
return new ResultEntity<>(HttpStatus.OK, "我的成绩、有效时长、各模块用时返回成功!",stuStatisticsDto); return new ResultEntity<>(HttpStatus.OK, "我的成绩、有效时长、各模块用时返回成功!", stuStatisticsDto);
} }
//学生端 -成绩走势 //学生端 -成绩走势
@AnonymousAccess @AnonymousAccess
@GetMapping("/getStuTrainingScoreTrend") @GetMapping("/getStuTrainingScoreTrend")
@ApiOperation("学生端 -成绩走势") @ApiOperation("学生端 -成绩走势")
public ResultEntity<List<StuTrainingScoreTrendDto>> getStuTrainingScoreTrend(@RequestParam String userId,@RequestParam String classId,@RequestParam String schoolId){ public ResultEntity<List<StuTrainingScoreTrendDto>> getStuTrainingScoreTrend(@RequestParam String userId, @RequestParam String classId, @RequestParam String schoolId) {
//根据schoolID 查询score_rank表第一名和最后一名 并根据userId 查询本学生的成绩 //根据schoolID 查询score_rank表第一名和最后一名 并根据userId 查询本学生的成绩
ScoreRankExample scoreRankExample = new ScoreRankExample(); ScoreRankExample scoreRankExample = new ScoreRankExample();
scoreRankExample.createCriteria().andClassIdEqualTo(classId).andUpdateDateEqualTo(scoreRankService.getNowDate().trim()); scoreRankExample.createCriteria().andClassIdEqualTo(classId).andUpdateDateEqualTo(scoreRankService.getNowDate().trim());
scoreRankExample.setOrderByClause("khal_score desc"); scoreRankExample.setOrderByClause("khal_score desc");
List<ScoreRank> scoreRankList = scoreRankMapper.selectByExample(scoreRankExample); List<ScoreRank> scoreRankList = scoreRankMapper.selectByExample(scoreRankExample);
if(scoreRankList.isEmpty()){ //代表成绩还没更新 if (scoreRankList.isEmpty()) { //代表成绩还没更新
scoreRankService.doRankOne(schoolId); scoreRankService.doRankOne(schoolId);
scoreRankList = scoreRankMapper.selectByExample(scoreRankExample); scoreRankList = scoreRankMapper.selectByExample(scoreRankExample);
} }
@ -103,7 +105,7 @@ public class StatisticsController {
String endUserId = scoreRankList.get(scoreRankList.size() - 1).getUserid();//最后一名UserId String endUserId = scoreRankList.get(scoreRankList.size() - 1).getUserid();//最后一名UserId
//根据传递的userId 查询最近的五条成绩 //根据传递的userId 查询最近的五条成绩
List<StuTrainingScoreTrendDto> returnDtoList=new ArrayList<>(); List<StuTrainingScoreTrendDto> returnDtoList = new ArrayList<>();
//获取自己的成绩 //获取自己的成绩
StuTrainingScoreTrendDto selfDto = getTrendDto(userId, "我"); StuTrainingScoreTrendDto selfDto = getTrendDto(userId, "我");
//获取第一名成绩 //获取第一名成绩
@ -113,16 +115,16 @@ public class StatisticsController {
returnDtoList.add(selfDto); returnDtoList.add(selfDto);
returnDtoList.add(firstDto); returnDtoList.add(firstDto);
returnDtoList.add(endDto); returnDtoList.add(endDto);
return new ResultEntity<>(HttpStatus.OK, "学生端 -成绩走势返回成功!",returnDtoList); return new ResultEntity<>(HttpStatus.OK, "学生端 -成绩走势返回成功!", returnDtoList);
} }
//获取成绩走势dto //获取成绩走势dto
private StuTrainingScoreTrendDto getTrendDto(String userId,String title){ private StuTrainingScoreTrendDto getTrendDto(String userId, String title) {
List<ScoreRank> scoreList=scoreRankMapper.selectFiveScoreByUserId(userId); List<ScoreRank> scoreList = scoreRankMapper.selectFiveScoreByUserId(userId);
StuTrainingScoreTrendDto trendDto = new StuTrainingScoreTrendDto(); StuTrainingScoreTrendDto trendDto = new StuTrainingScoreTrendDto();
trendDto.setTitle(title); trendDto.setTitle(title);
List<BigDecimal> scores=new ArrayList<>(); List<BigDecimal> scores = new ArrayList<>();
List<String> dateList=new ArrayList<>(); List<String> dateList = new ArrayList<>();
for (int i = 0; i < scoreList.size(); i++) { for (int i = 0; i < scoreList.size(); i++) {
ScoreRank scoreRank = scoreList.get(i); ScoreRank scoreRank = scoreList.get(i);
scores.add(scoreRank.getKhalScore()); scores.add(scoreRank.getKhalScore());
@ -148,8 +150,8 @@ public class StatisticsController {
scoreRank.setClassName(className); scoreRank.setClassName(className);
scoreRank.setSchoolId(schoolId); scoreRank.setSchoolId(schoolId);
List<TeaTrendVo> voList = scoreRankMapper.selectFiveAvgTotalScoreBySchoolIdAndClassName(scoreRank); List<TeaTrendVo> voList = scoreRankMapper.selectFiveAvgTotalScoreBySchoolIdAndClassName(scoreRank);
List<BigDecimal> classAverageScoreList=new ArrayList<>(); List<BigDecimal> classAverageScoreList = new ArrayList<>();
List<String> startTimeList=new ArrayList<>(); List<String> startTimeList = new ArrayList<>();
for (int j = 0; j < voList.size(); j++) { for (int j = 0; j < voList.size(); j++) {
TeaTrendVo teaTrendVo = voList.get(j); TeaTrendVo teaTrendVo = voList.get(j);
classAverageScoreList.add(teaTrendVo.getAvgScore()); classAverageScoreList.add(teaTrendVo.getAvgScore());
@ -182,52 +184,91 @@ public class StatisticsController {
formattedDate = sdf.format(time); formattedDate = sdf.format(time);
criteria.andClassIdEqualTo(classId).andUpdateDateEqualTo(formattedDate); criteria.andClassIdEqualTo(classId).andUpdateDateEqualTo(formattedDate);
} }
List<ScoreRank> scoreRankList = scoreRankMapper.selectByExample(scoreExample); List<ScoreRank> scoreRankList = scoreRankMapper.selectByExample(scoreExample);
int excellentCount = 0; int excellentCount = 0;
int goodCount = 0; int goodCount = 0;
int generalCount = 0; int generalCount = 0;
int failCount = 0; int failCount = 0;
BigDecimal maxScore = BigDecimal.ZERO; BigDecimal maxScore = BigDecimal.ZERO;
BigDecimal minScore = BigDecimal.valueOf(1000); BigDecimal minScore = BigDecimal.valueOf(1000);
BigDecimal avgScore = BigDecimal.ZERO; BigDecimal avgScore = BigDecimal.ZERO;
for (int i = 0; i < scoreRankList.size(); i++) { for (int i = 0; i < scoreRankList.size(); i++) {
ScoreRank scoreRank = scoreRankList.get(i); ScoreRank scoreRank = scoreRankList.get(i);
BigDecimal khalScore = scoreRank.getKhalScore(); BigDecimal khalScore = scoreRank.getKhalScore();
if(khalScore==null){ if (khalScore == null) {
khalScore=BigDecimal.ZERO; khalScore = BigDecimal.ZERO;
} }
if(khalScore.compareTo(maxScore)>0){ //设置最高分 if (khalScore.compareTo(maxScore) > 0) { //设置最高分
maxScore=khalScore; maxScore = khalScore;
} }
if(khalScore.compareTo(minScore)<0){ //设置最低分 if (khalScore.compareTo(minScore) < 0) { //设置最低分
minScore=khalScore; minScore = khalScore;
} }
avgScore=avgScore.add(khalScore); avgScore = avgScore.add(khalScore);
if(khalScore.compareTo(BigDecimal.valueOf(90))>=0){ //设置优秀、良好、一般、不及格人数 if (khalScore.compareTo(BigDecimal.valueOf(90)) >= 0) { //设置优秀、良好、一般、不及格人数
excellentCount = excellentCount+1; excellentCount = excellentCount + 1;
}else if(khalScore.compareTo(BigDecimal.valueOf(90))<0 && khalScore.compareTo(BigDecimal.valueOf(80))>=0){ } else if (khalScore.compareTo(BigDecimal.valueOf(90)) < 0 && khalScore.compareTo(BigDecimal.valueOf(80)) >= 0) {
goodCount= goodCount+1; goodCount = goodCount + 1;
}else if(khalScore.compareTo(BigDecimal.valueOf(80))<0 && khalScore.compareTo(BigDecimal.valueOf(60))>=0){ } else if (khalScore.compareTo(BigDecimal.valueOf(80)) < 0 && khalScore.compareTo(BigDecimal.valueOf(60)) >= 0) {
generalCount=generalCount+1; generalCount = generalCount + 1;
}else { } else {
failCount = failCount +1; failCount = failCount + 1;
}
} }
if(!scoreRankList.isEmpty()){ }
avgScore = avgScore.divide(BigDecimal.valueOf(scoreRankList.size()), 2, BigDecimal.ROUND_HALF_UP); if (!scoreRankList.isEmpty()) {
avgScore = avgScore.divide(BigDecimal.valueOf(scoreRankList.size()), 2, BigDecimal.ROUND_HALF_UP);
}
if (minScore.compareTo(BigDecimal.valueOf(1000)) == 0) {
minScore = BigDecimal.ZERO;
}
TeaClassScoreDto teaClassScoreDto = new TeaClassScoreDto();
teaClassScoreDto.setExcellentCount(excellentCount);
teaClassScoreDto.setGoodCount(goodCount);
teaClassScoreDto.setGeneralCount(generalCount);
teaClassScoreDto.setFailCount(failCount);
teaClassScoreDto.setMaxScore(maxScore);
teaClassScoreDto.setMinScore(minScore);
teaClassScoreDto.setAverageScore(avgScore);
teaClassScoreDto.setStartTime(formattedDate);
return teaClassScoreDto;
}
@AnonymousAccess
@GetMapping("/getStuPieChart")
@ApiOperation("学生端 -我的成绩饼状图")
public Map<String,Integer> getStuPieChart(String schoolId) {
//根据schoolId查询当日scoreRank.totalScore 进行分类
Map<String,Integer> map=new HashMap<>();
map.put("great",0);
map.put("good",0);
map.put("poor",0);
ScoreRankExample scoreRankExample = new ScoreRankExample();
scoreRankExample.createCriteria().andSchoolIdEqualTo(schoolId).andUpdateDateEqualTo(getNowDate());
List<ScoreRank> scoreRankList = scoreRankMapper.selectByExample(scoreRankExample);
for (int i = 0; i < scoreRankList.size(); i++) {
if(scoreRankList.get(i).getTotalScore().compareTo(BigDecimal.valueOf(80))>=0){
Integer great = map.get("great");
map.put("great",great+1);
continue;
} }
if(minScore.compareTo(BigDecimal.valueOf(1000))==0){ if(scoreRankList.get(i).getTotalScore().compareTo(BigDecimal.valueOf(60))<0){
minScore=BigDecimal.ZERO; Integer poor = map.get("poor");
map.put("poor",poor+1);
continue;
}else {
Integer good = map.get("good");
map.put("good",good+1);
continue;
} }
TeaClassScoreDto teaClassScoreDto = new TeaClassScoreDto();
teaClassScoreDto.setExcellentCount(excellentCount);
teaClassScoreDto.setGoodCount(goodCount);
teaClassScoreDto.setGeneralCount(generalCount);
teaClassScoreDto.setFailCount(failCount);
teaClassScoreDto.setMaxScore(maxScore);
teaClassScoreDto.setMinScore(minScore);
teaClassScoreDto.setAverageScore(avgScore);
teaClassScoreDto.setStartTime(formattedDate);
return teaClassScoreDto;
} }
return map;
}
public String getNowDate() {
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String nowDate = now.format(formatter);
return nowDate;
}
} }

@ -52,4 +52,7 @@ public interface SynthesisPlanScoreMapper {
BigDecimal selectTotalScoreByUserId(@Param("userId")String userId); BigDecimal selectTotalScoreByUserId(@Param("userId")String userId);
int batchInsert(@Param("list") List<SynthesisPlanScoreWithBLOBs> synthesisPlanScore); int batchInsert(@Param("list") List<SynthesisPlanScoreWithBLOBs> synthesisPlanScore);
@Select("SELECT count(userid) from synthesis_plan_score where userid=#{userId}")
Integer CountScoreSizeByUserId(String userId);
} }

@ -12,6 +12,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -31,6 +32,7 @@ public class ResourceCenterServiceImpl implements ResourceCenterService {
resourceCenter.setResourceUrl(uploadUrl); resourceCenter.setResourceUrl(uploadUrl);
resourceCenter.setChapterId(chapterId); resourceCenter.setChapterId(chapterId);
resourceCenter.setSource(schoolId); resourceCenter.setSource(schoolId);
resourceCenter.setAddTime(new Date());
resourceCenter.setType(type); resourceCenter.setType(type);
int insert = resourceCenterMapper.insert(resourceCenter); int insert = resourceCenterMapper.insert(resourceCenter);
return insert==1; return insert==1;
@ -49,7 +51,8 @@ public class ResourceCenterServiceImpl implements ResourceCenterService {
criteria.andSourceIn(schoolIds); criteria.andSourceIn(schoolIds);
} }
criteria.andChapterIdEqualTo(chapterId); criteria.andChapterIdEqualTo(chapterId);
List<ResourceCenter> resourceCenterList = resourceCenterMapper.selectByExample(example); example.setOrderByClause("add_time asc");
List<ResourceCenter> resourceCenterList = resourceCenterMapper.selectByExampleWithBLOBs(example);
return resourceCenterList; return resourceCenterList;
} }

@ -174,6 +174,15 @@ public class ScoreRankServiceImpl implements ScoreRankService {
scoreRank.setCountCase((int) countCase); scoreRank.setCountCase((int) countCase);
BigDecimal zhghScore = synthesisPlanScoreMapper.selectTotalScoreByUserId(userId); BigDecimal zhghScore = synthesisPlanScoreMapper.selectTotalScoreByUserId(userId);
if (zhghScore==null){
scoreRank.setZhghScore(BigDecimal.ZERO);
}else {
//查询zhgh考核点数量
Integer zhghSize=synthesisPlanScoreMapper.CountScoreSizeByUserId(userId);
//考核点所有分数
BigDecimal zhghTotalScore=BigDecimal.valueOf(zhghSize).multiply(BigDecimal.valueOf(2));
scoreRank.setZhghScore(zhghScore.divide(zhghTotalScore,2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).divide(BigDecimal.valueOf(countCase),2,BigDecimal.ROUND_HALF_UP));
}
scoreRank.setZhghScore(zhghScore); scoreRank.setZhghScore(zhghScore);
//设置理论考核平均分成绩 //设置理论考核平均分成绩
@ -431,7 +440,16 @@ public class ScoreRankServiceImpl implements ScoreRankService {
scoreRank.setCountCase((int) countCase); scoreRank.setCountCase((int) countCase);
BigDecimal zhghScore = synthesisPlanScoreMapper.selectTotalScoreByUserId(userId); BigDecimal zhghScore = synthesisPlanScoreMapper.selectTotalScoreByUserId(userId);
scoreRank.setZhghScore(zhghScore); if (zhghScore==null){
scoreRank.setZhghScore(BigDecimal.ZERO);
}else {
//查询zhgh考核点数量
Integer zhghSize=synthesisPlanScoreMapper.CountScoreSizeByUserId(userId);
//考核点所有分数
BigDecimal zhghTotalScore=BigDecimal.valueOf(zhghSize).multiply(BigDecimal.valueOf(2));
scoreRank.setZhghScore(zhghScore.divide(zhghTotalScore,2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).divide(BigDecimal.valueOf(countCase),2,BigDecimal.ROUND_HALF_UP));
}
//设置理论考核平均分成绩 //设置理论考核平均分成绩
StuTheoryRecord stuTheoryRecord = theoryRecordMapper.selectByPrimaryKey(userId); StuTheoryRecord stuTheoryRecord = theoryRecordMapper.selectByPrimaryKey(userId);

Loading…
Cancel
Save