diff --git a/src/main/java/com/sztzjy/money_management/controller/GradeController.java b/src/main/java/com/sztzjy/money_management/controller/GradeController.java index ead481e..fed6332 100644 --- a/src/main/java/com/sztzjy/money_management/controller/GradeController.java +++ b/src/main/java/com/sztzjy/money_management/controller/GradeController.java @@ -239,10 +239,10 @@ public class GradeController { @AnonymousAccess @ApiOperation("学生端-成绩中心-综合规划成绩展示") @PostMapping("selectStuSynthesisPlanScoreList") - public ResultEntity> selectStuSynthesisPlanScoreList(@RequestParam String userId, + public ResultEntity selectStuSynthesisPlanScoreList(@RequestParam String userId, @RequestParam String schoolId) { - List list = trainingService.selectStuSynthesisPlanScoreList(userId, schoolId); - return new ResultEntity<>(HttpStatus.OK, "学生端-成绩中心-综合规划成绩展示", list); + StuSynthesisPlanScoreAndAvgScoreDto dto = trainingService.selectStuSynthesisPlanScoreList(userId, schoolId); + return new ResultEntity<>(HttpStatus.OK, "学生端-成绩中心-综合规划成绩展示", dto); } //学生端 综合规划审核报告展示 同综合规划-规划报告-审核报告 diff --git a/src/main/java/com/sztzjy/money_management/entity/dto/StuSynthesisPlanScoreAndAvgScoreDto.java b/src/main/java/com/sztzjy/money_management/entity/dto/StuSynthesisPlanScoreAndAvgScoreDto.java new file mode 100644 index 0000000..24cda3f --- /dev/null +++ b/src/main/java/com/sztzjy/money_management/entity/dto/StuSynthesisPlanScoreAndAvgScoreDto.java @@ -0,0 +1,17 @@ +package com.sztzjy.money_management.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.List; + +@Data +@NoArgsConstructor +public class StuSynthesisPlanScoreAndAvgScoreDto { + @ApiModelProperty("平均成绩") + private BigDecimal avgScore; + + List list; +} diff --git a/src/main/java/com/sztzjy/money_management/entity/dto/StuSynthesisPlanScoreDto.java b/src/main/java/com/sztzjy/money_management/entity/dto/StuSynthesisPlanScoreDto.java index 9da5c7d..308db00 100644 --- a/src/main/java/com/sztzjy/money_management/entity/dto/StuSynthesisPlanScoreDto.java +++ b/src/main/java/com/sztzjy/money_management/entity/dto/StuSynthesisPlanScoreDto.java @@ -15,10 +15,10 @@ public class StuSynthesisPlanScoreDto { @ApiModelProperty("实训时长") private BigDecimal useTime; - @ApiModelProperty("实训总分") + @ApiModelProperty("实训总分/暂不用") private BigDecimal trainingTotalScore; - @ApiModelProperty("成绩权重") + @ApiModelProperty("成绩权重/暂不用") private BigDecimal scoreWight; @ApiModelProperty("完成情况") @@ -27,6 +27,12 @@ public class StuSynthesisPlanScoreDto { @ApiModelProperty("实训得分") private BigDecimal trainingScore; + @ApiModelProperty("实训满分") + private BigDecimal trainingFullScore; + + @ApiModelProperty("实训成绩") + private BigDecimal stuScore; + @ApiModelProperty("caseId") private String caseId; diff --git a/src/main/java/com/sztzjy/money_management/service/TrainingService.java b/src/main/java/com/sztzjy/money_management/service/TrainingService.java index dc39921..224b7fd 100644 --- a/src/main/java/com/sztzjy/money_management/service/TrainingService.java +++ b/src/main/java/com/sztzjy/money_management/service/TrainingService.java @@ -2,6 +2,7 @@ package com.sztzjy.money_management.service; import com.sztzjy.money_management.entity.StudentScoreWeight; import com.sztzjy.money_management.entity.dto.StuClientCaseScoreDto; +import com.sztzjy.money_management.entity.dto.StuSynthesisPlanScoreAndAvgScoreDto; import com.sztzjy.money_management.entity.dto.StuSynthesisPlanScoreDto; import java.math.BigDecimal; @@ -12,7 +13,7 @@ public interface TrainingService { List selectStuClientCaseScoreList(String userId, String schoolId); - List selectStuSynthesisPlanScoreList(String userId, String schoolId); + StuSynthesisPlanScoreAndAvgScoreDto selectStuSynthesisPlanScoreList(String userId, String schoolId); Map getClientWeight(String schoolId); diff --git a/src/main/java/com/sztzjy/money_management/service/impl/ScoreRankServiceImpl.java b/src/main/java/com/sztzjy/money_management/service/impl/ScoreRankServiceImpl.java index 0777812..7f1550e 100644 --- a/src/main/java/com/sztzjy/money_management/service/impl/ScoreRankServiceImpl.java +++ b/src/main/java/com/sztzjy/money_management/service/impl/ScoreRankServiceImpl.java @@ -1,6 +1,7 @@ package com.sztzjy.money_management.service.impl; import com.sztzjy.money_management.entity.*; +import com.sztzjy.money_management.entity.dto.StuSynthesisPlanScoreAndAvgScoreDto; import com.sztzjy.money_management.mapper.*; import com.sztzjy.money_management.service.ScoreRankService; import com.sztzjy.money_management.service.TrainingService; @@ -34,6 +35,8 @@ public class ScoreRankServiceImpl implements ScoreRankService { TotalWeightMapper totalWeightMapper; @Autowired StuTheoryRecordMapper stuTheoryRecordMapper; + @Autowired + TrainingReportMapper trainingReportMapper; @Override @Scheduled(cron = "0 0 1 * * ?") @@ -136,7 +139,16 @@ public class ScoreRankServiceImpl implements ScoreRankService { experimentalScore= BigDecimal.valueOf(stuTraining.getExpTrainingCompleteStatus()).multiply(studentScoreWeight.getExperimentalTrainingWeight()); } } - BigDecimal sum = summaryScore.add(resourceScore).add(learningScore).add(experimentalScore); + //计算报告分数 + String chapterId = stuTraining.getChapterId(); + TrainingReportExample trainingReportExample = new TrainingReportExample(); + trainingReportExample.createCriteria().andChapterIdEqualTo(chapterId).andUserIdEqualTo(userId); + List trainingReports = trainingReportMapper.selectByExample(trainingReportExample); + BigDecimal reportScore=BigDecimal.ZERO; + if (!trainingReports.isEmpty()) { + reportScore=trainingReports.get(0).getTeacherScore().multiply(studentScoreWeight.getReportWeight()); + } + BigDecimal sum = summaryScore.add(resourceScore).add(learningScore).add(experimentalScore).add(reportScore); if ("风险测评".equals(stuTraining.getChapterName())) { scoreRank.setFxcp(sum); } else if ("财务分析".equals(stuTraining.getChapterName())) { @@ -186,17 +198,12 @@ public class ScoreRankServiceImpl implements ScoreRankService { long countCase = synthesisPlanClientMapper.countByExample(synthesisPlanClientExample); scoreRank.setCountCase((int) countCase); - BigDecimal zhghScore = synthesisPlanScoreMapper.selectTotalScoreByUserId(userId); - if (zhghScore==null){ + StuSynthesisPlanScoreAndAvgScoreDto dto = trainingService.selectStuSynthesisPlanScoreList(userId,schoolId); + if(dto==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(dto.getAvgScore()); } - scoreRank.setZhghScore(zhghScore); //设置理论考核平均分成绩 StuTheoryRecord stuTheoryRecord = theoryRecordMapper.selectByPrimaryKey(userId); @@ -415,7 +422,17 @@ public class ScoreRankServiceImpl implements ScoreRankService { experimentalScore= BigDecimal.valueOf(stuTraining.getExpTrainingCompleteStatus()).multiply(studentScoreWeight.getExperimentalTrainingWeight()); } } - BigDecimal sum = summaryScore.add(resourceScore).add(learningScore).add(experimentalScore); + //计算报告分数 + String chapterId = stuTraining.getChapterId(); + TrainingReportExample trainingReportExample = new TrainingReportExample(); + trainingReportExample.createCriteria().andChapterIdEqualTo(chapterId).andUserIdEqualTo(userId); + List trainingReports = trainingReportMapper.selectByExample(trainingReportExample); + BigDecimal reportScore=BigDecimal.ZERO; + if (!trainingReports.isEmpty()) { + reportScore=trainingReports.get(0).getTeacherScore().multiply(studentScoreWeight.getReportWeight()); + } + + BigDecimal sum = summaryScore.add(resourceScore).add(learningScore).add(experimentalScore).add(reportScore); if ("风险测评".equals(stuTraining.getChapterName())) { scoreRank.setFxcp(sum); } else if ("财务分析".equals(stuTraining.getChapterName())) { @@ -465,18 +482,13 @@ public class ScoreRankServiceImpl implements ScoreRankService { long countCase = synthesisPlanClientMapper.countByExample(synthesisPlanClientExample); scoreRank.setCountCase((int) countCase); - BigDecimal zhghScore = synthesisPlanScoreMapper.selectTotalScoreByUserId(userId); - if (zhghScore==null){ + StuSynthesisPlanScoreAndAvgScoreDto dto = trainingService.selectStuSynthesisPlanScoreList(userId,schoolId); + if(dto==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(dto.getAvgScore()); } - //设置理论考核平均分成绩 StuTheoryRecord stuTheoryRecord = theoryRecordMapper.selectByPrimaryKey(userId); if (stuTheoryRecord == null) { diff --git a/src/main/java/com/sztzjy/money_management/service/impl/TrainingServiceImpl.java b/src/main/java/com/sztzjy/money_management/service/impl/TrainingServiceImpl.java index dca4040..669b463 100644 --- a/src/main/java/com/sztzjy/money_management/service/impl/TrainingServiceImpl.java +++ b/src/main/java/com/sztzjy/money_management/service/impl/TrainingServiceImpl.java @@ -2,6 +2,7 @@ package com.sztzjy.money_management.service.impl; import com.sztzjy.money_management.entity.*; import com.sztzjy.money_management.entity.dto.StuClientCaseScoreDto; +import com.sztzjy.money_management.entity.dto.StuSynthesisPlanScoreAndAvgScoreDto; import com.sztzjy.money_management.entity.dto.StuSynthesisPlanScoreDto; import com.sztzjy.money_management.entity.dto.StuTrainingDto; import com.sztzjy.money_management.mapper.*; @@ -39,7 +40,7 @@ public class TrainingServiceImpl implements TrainingService { StuTrainingExample stuTrainingExample = new StuTrainingExample(); stuTrainingExample.createCriteria().andUserIdEqualTo(userId); List stuTrainingList = trainingMapper.selectByExample(stuTrainingExample); - if(stuTrainingList.isEmpty()){ + if (stuTrainingList.isEmpty()) { return null; } @@ -47,53 +48,53 @@ public class TrainingServiceImpl implements TrainingService { Map studentScoreWeightMap = getStudentScoreWeightMap(schoolId); //获取客户案例权重 Map clientWeightMap = getClientWeight(schoolId); - List returnList=new ArrayList<>(); + List returnList = new ArrayList<>(); for (int i = 0; i < stuTrainingList.size(); i++) { StuClientCaseScoreDto stuClientCaseScoreDto = new StuClientCaseScoreDto(); StuTraining stuTraining = stuTrainingList.get(i); Integer knowledgeStatus = stuTraining.getKnowledgeSummaryCompleteStatus() == null ? 0 : stuTraining.getKnowledgeSummaryCompleteStatus(); - Integer resourceStatus = stuTraining.getResourceLearningCompleteStatus()== null ? 0 : stuTraining.getResourceLearningCompleteStatus(); - Integer learningEvalCompleteStatus = stuTraining.getLearningEvalCompleteStatus()== null ? 9999 : stuTraining.getLearningEvalCompleteStatus(); - Integer expStatus = stuTraining.getExpTrainingCompleteStatus()==null?9999:stuTraining.getExpTrainingCompleteStatus(); + Integer resourceStatus = stuTraining.getResourceLearningCompleteStatus() == null ? 0 : stuTraining.getResourceLearningCompleteStatus(); + Integer learningEvalCompleteStatus = stuTraining.getLearningEvalCompleteStatus() == null ? 9999 : stuTraining.getLearningEvalCompleteStatus(); + Integer expStatus = stuTraining.getExpTrainingCompleteStatus() == null ? 9999 : stuTraining.getExpTrainingCompleteStatus(); StudentScoreWeight studentScoreWeight = studentScoreWeightMap.get(stuTraining.getChapterName()); - if(studentScoreWeight==null){ + if (studentScoreWeight == null) { continue; } - if(knowledgeStatus>5){ - knowledgeStatus=5; + if (knowledgeStatus > 5) { + knowledgeStatus = 5; } - if(resourceStatus>5){ - resourceStatus=5; + if (resourceStatus > 5) { + resourceStatus = 5; } BigDecimal summaryScore = studentScoreWeight.getSummaryOfKnowledgeScore().multiply(BigDecimal.valueOf(knowledgeStatus)).multiply(studentScoreWeight.getSummaryOfKnowledgeWeight()); BigDecimal resourceScore = studentScoreWeight.getResourceLearningScore().multiply(BigDecimal.valueOf(resourceStatus)).multiply(studentScoreWeight.getResourceLearningWeight()); - BigDecimal learningScore= BigDecimal.valueOf(0); - BigDecimal experimentalScore= BigDecimal.valueOf(0); - if(learningEvalCompleteStatus!=9999){ - if(learningEvalCompleteStatus<=10){ + BigDecimal learningScore = BigDecimal.valueOf(0); + BigDecimal experimentalScore = BigDecimal.valueOf(0); + if (learningEvalCompleteStatus != 9999) { + if (learningEvalCompleteStatus <= 10) { learningScore = (BigDecimal.valueOf(100).subtract(studentScoreWeight.getLearningAssessmentScore().multiply(BigDecimal.valueOf(learningEvalCompleteStatus)))).multiply(studentScoreWeight.getLearningAssessmentWeight()); } } - if(expStatus!=9999){ - if(expStatus<=5){ - experimentalScore =BigDecimal.valueOf(100).subtract(studentScoreWeight.getExperimentalTrainingScore().multiply(BigDecimal.valueOf(expStatus))).multiply(studentScoreWeight.getExperimentalTrainingWeight()); + if (expStatus != 9999) { + if (expStatus <= 5) { + experimentalScore = BigDecimal.valueOf(100).subtract(studentScoreWeight.getExperimentalTrainingScore().multiply(BigDecimal.valueOf(expStatus))).multiply(studentScoreWeight.getExperimentalTrainingWeight()); } //财产分配特殊处理 - if("11".equals(stuTraining.getChapterId())){ - if(stuTraining.getExpTrainingCompleteStatus().compareTo(100)>0){ + if ("11".equals(stuTraining.getChapterId())) { + if (stuTraining.getExpTrainingCompleteStatus().compareTo(100) > 0) { stuTraining.setExpTrainingCompleteStatus(100); } - experimentalScore= BigDecimal.valueOf(stuTraining.getExpTrainingCompleteStatus()).multiply(studentScoreWeight.getExperimentalTrainingWeight()); + experimentalScore = BigDecimal.valueOf(stuTraining.getExpTrainingCompleteStatus()).multiply(studentScoreWeight.getExperimentalTrainingWeight()); } } //设置实验报告情况及得分 - BigDecimal reportScore=BigDecimal.ZERO; + BigDecimal reportScore = BigDecimal.ZERO; TrainingReportExample trainingReportExample = new TrainingReportExample(); trainingReportExample.createCriteria().andChapterIdEqualTo(stuTraining.getChapterName()).andUserIdEqualTo(userId); List trainingReports = trainingReportMapper.selectByExample(trainingReportExample); - if(!trainingReports.isEmpty()){ - reportScore=trainingReports.get(0).getTeacherScore().multiply(studentScoreWeight.getReportWeight()); + if (!trainingReports.isEmpty()) { + reportScore = trainingReports.get(0).getTeacherScore().multiply(studentScoreWeight.getReportWeight()); } stuClientCaseScoreDto.setChapterName(stuTraining.getChapterName()); stuClientCaseScoreDto.setTrainingTotalScore(summaryScore.add(resourceScore).add(learningScore).add(experimentalScore).add(reportScore)); @@ -108,8 +109,8 @@ public class TrainingServiceImpl implements TrainingService { //获取学习成绩权重对象 如果没设置 则用默认方式 map("风险测评" 权重对象) @Override - public Map getStudentScoreWeightMap(String schoolId){ - Map map=new HashMap<>(); + public Map getStudentScoreWeightMap(String schoolId) { + Map map = new HashMap<>(); List chapterNameList = getChapterNameList(); StudentScoreWeight studentScoreWeight = new StudentScoreWeight(); //计分规则 @@ -125,19 +126,19 @@ public class TrainingServiceImpl implements TrainingService { studentScoreWeight.setExperimentalTrainingWeight(BigDecimal.valueOf(0.4)); studentScoreWeight.setReportWeight(BigDecimal.valueOf(0.1)); for (int i = 0; i < chapterNameList.size(); i++) { //先将所有内置章节设置成默认章节 - map.put(chapterNameList.get(i),studentScoreWeight); + map.put(chapterNameList.get(i), studentScoreWeight); } //获取老师设置的权重 如果没有设置 则将map返回 如果设置了部分 则将map中设置过的章节替换成老师设置的章节 StudentScoreWeightExample studentScoreWeightExample = new StudentScoreWeightExample(); studentScoreWeightExample.createCriteria().andSchoolIdEqualTo(schoolId); List studentScoreWeightList = studentScoreWeightMapper.selectByExample(studentScoreWeightExample); - if(studentScoreWeightList.isEmpty()){ + if (studentScoreWeightList.isEmpty()) { return map; - }else { + } else { for (int i = 0; i < studentScoreWeightList.size(); i++) { StudentScoreWeight teaWeight = studentScoreWeightList.get(i); - map.put(studentScoreWeight.getChapterName(),teaWeight); + map.put(studentScoreWeight.getChapterName(), teaWeight); } return map; } @@ -145,44 +146,44 @@ public class TrainingServiceImpl implements TrainingService { //获取客户案例权重对象 map("风险测评" 权重数值) @Override - public Map getClientWeight(String schoolId){ - Map map=new HashMap<>(); + public Map getClientWeight(String schoolId) { + Map map = new HashMap<>(); ClientWeight clientWeight = clientWeightMapper.selectByPrimaryKey(schoolId); - if(clientWeight==null){ //设置默认权重 - map.put("风险测评",BigDecimal.valueOf(0.05)); - map.put("财务分析",BigDecimal.valueOf(0.20)); - map.put("现金规划",BigDecimal.valueOf(0.05)); - map.put("教育规划",BigDecimal.valueOf(0.1)); - map.put("消费规划",BigDecimal.valueOf(0.1)); - map.put("创业规划",BigDecimal.valueOf(0.05)); - map.put("退休规划",BigDecimal.valueOf(0.1)); - map.put("保险规划",BigDecimal.valueOf(0.15)); - map.put("投资规划",BigDecimal.valueOf(0.05)); - map.put("税务筹划",BigDecimal.valueOf(0.05)); - map.put("财产分配",BigDecimal.valueOf(0.05)); - map.put("财产传承",BigDecimal.valueOf(0.05)); + if (clientWeight == null) { //设置默认权重 + map.put("风险测评", BigDecimal.valueOf(0.05)); + map.put("财务分析", BigDecimal.valueOf(0.20)); + map.put("现金规划", BigDecimal.valueOf(0.05)); + map.put("教育规划", BigDecimal.valueOf(0.1)); + map.put("消费规划", BigDecimal.valueOf(0.1)); + map.put("创业规划", BigDecimal.valueOf(0.05)); + map.put("退休规划", BigDecimal.valueOf(0.1)); + map.put("保险规划", BigDecimal.valueOf(0.15)); + map.put("投资规划", BigDecimal.valueOf(0.05)); + map.put("税务筹划", BigDecimal.valueOf(0.05)); + map.put("财产分配", BigDecimal.valueOf(0.05)); + map.put("财产传承", BigDecimal.valueOf(0.05)); return map; - }else { - map.put("风险测评",clientWeight.getFxcp()); - map.put("财务分析",clientWeight.getCwfx()); - map.put("现金规划",clientWeight.getXjgh()); - map.put("教育规划",clientWeight.getJygh()); - map.put("消费规划",clientWeight.getXfgh()); - map.put("创业规划",clientWeight.getCygh()); - map.put("退休规划",clientWeight.getTxgh()); - map.put("保险规划",clientWeight.getBxgh()); - map.put("投资规划",clientWeight.getTzgh()); - map.put("税务筹划",clientWeight.getSwch()); - map.put("财产分配",clientWeight.getCcfp()); - map.put("财产传承",clientWeight.getCccc()); + } else { + map.put("风险测评", clientWeight.getFxcp()); + map.put("财务分析", clientWeight.getCwfx()); + map.put("现金规划", clientWeight.getXjgh()); + map.put("教育规划", clientWeight.getJygh()); + map.put("消费规划", clientWeight.getXfgh()); + map.put("创业规划", clientWeight.getCygh()); + map.put("退休规划", clientWeight.getTxgh()); + map.put("保险规划", clientWeight.getBxgh()); + map.put("投资规划", clientWeight.getTzgh()); + map.put("税务筹划", clientWeight.getSwch()); + map.put("财产分配", clientWeight.getCcfp()); + map.put("财产传承", clientWeight.getCccc()); return map; } } //设置所有的章节名称 @Override - public List getChapterNameList(){ - List list=new ArrayList<>(); + public List getChapterNameList() { + List list = new ArrayList<>(); list.add("风险测评"); list.add("财务分析"); list.add("现金规划"); @@ -199,7 +200,6 @@ public class TrainingServiceImpl implements TrainingService { } - //学生端 综合规划成绩查询 // 学习项目(案例名称)-》综合规划表中查询用户姓名 // 实训时长 -》综合规划表中查询 @@ -209,44 +209,45 @@ public class TrainingServiceImpl implements TrainingService { // 实训得分 -》总分*权重 @Override - public List selectStuSynthesisPlanScoreList(String userId, String schoolId) { + public StuSynthesisPlanScoreAndAvgScoreDto selectStuSynthesisPlanScoreList(String userId, String schoolId) { SynthesisPlanClientExample clientExample = new SynthesisPlanClientExample(); clientExample.createCriteria().andUseridEqualTo(userId).andSubmitStatusEqualTo("已审核"); //获取该用户所有审核通过的综合规划数据 List synthesisPlanClientList = synthesisPlanClientMapper.selectByExample(clientExample); clientExample.setOrderByClause("get_time desc"); - if(synthesisPlanClientList.isEmpty()){ + if (synthesisPlanClientList.isEmpty()) { return null; } - //获取该学校的成绩总览权重数据 - TotalWeight totalWeight = totalWeightMapper.selectByPrimaryKey(schoolId); - BigDecimal zhghWeight= BigDecimal.valueOf(0.4); - if(totalWeight!=null){ - zhghWeight = totalWeight.getZhgh(); - } - List returnList=new ArrayList<>(); + List returnList = new ArrayList<>(); + BigDecimal fenzi = BigDecimal.ZERO; + BigDecimal fenmu = BigDecimal.ZERO; for (int i = 0; i < synthesisPlanClientList.size(); i++) { + fenmu = fenmu.add(BigDecimal.valueOf(100)); StuSynthesisPlanScoreDto returnDto = new StuSynthesisPlanScoreDto(); SynthesisPlanClient client = synthesisPlanClientList.get(i); returnDto.setCaseId(client.getCaseid()); returnDto.setName(client.getName()); returnDto.setUseTime(client.getUseTime()); - //获取实训总分 - BigDecimal trainingTotalScore=synthesisPlanScoreMapper.selectTotalScoreByUserIdAndCaseId(userId,client.getCaseid()); - if(trainingTotalScore==null){ - trainingTotalScore=BigDecimal.ZERO; - }else { - //查询zhgh考核点数量 - Integer zhghSize=synthesisPlanScoreMapper.CountScoreSizeByUserIdAndCaseId(userId,client.getCaseid()); - BigDecimal zhghTotalScore=BigDecimal.valueOf(zhghSize).multiply(BigDecimal.valueOf(2)); - trainingTotalScore = trainingTotalScore.divide(zhghTotalScore, 2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)); - } - returnDto.setTrainingTotalScore(trainingTotalScore); - returnDto.setScoreWight(zhghWeight); + returnDto.setTrainingFullScore(BigDecimal.valueOf(0)); + //获取学生实训得分 + BigDecimal trainingScore = synthesisPlanScoreMapper.selectTotalScoreByUserIdAndCaseId(userId, client.getCaseid()); + + //查询zhgh考核点数量 + Integer zhghSize = synthesisPlanScoreMapper.CountScoreSizeByUserIdAndCaseId(userId, client.getCaseid()); + //案例题zhgh实训满分 + BigDecimal trainingFullScore = BigDecimal.valueOf(zhghSize).multiply(BigDecimal.valueOf(2)); + //实训成绩 + BigDecimal stuScore = trainingScore.divide(trainingFullScore, 2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)); + returnDto.setTrainingScore(trainingScore); + returnDto.setTrainingFullScore(trainingFullScore); + returnDto.setStuScore(stuScore); returnDto.setFinishStatus("已完成"); - returnDto.setTrainingScore(trainingTotalScore.multiply(zhghWeight)); returnList.add(returnDto); + fenzi = fenzi.add(stuScore); } - return returnList; + StuSynthesisPlanScoreAndAvgScoreDto dto = new StuSynthesisPlanScoreAndAvgScoreDto(); + dto.setList(returnList); + dto.setAvgScore(fenzi.divide(fenmu).setScale(4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)); + return dto; } }