完善分数计算

main
whb 2 months ago
parent 36c41d49a6
commit 13b624f861

@ -36,7 +36,11 @@ public class Constant {
public static final String BROWSE_NUMBER="被浏览数"; public static final String BROWSE_NUMBER="被浏览数";
public static final String ZSGY_TCHMODULE = "知识概要";
public static final String ZYXX_TCHMODULE = "资源学习";
public static final String XXCP_TCHMODULE = "学习测评";
public static final String SYSX_TCHMODULE = "实验实训";
public static final String SYBG_TCHMODULE = "实验报告";
public static final String PRO_XXMB="学习目标"; public static final String PRO_XXMB="学习目标";

@ -188,10 +188,6 @@ public class StuExpermentTrainingController {
@PostMapping("/getAcademicRecord") @PostMapping("/getAcademicRecord")
@AnonymousAccess @AnonymousAccess
@ApiOperation("学习成绩查询") @ApiOperation("学习成绩查询")
@ -212,4 +208,16 @@ public class StuExpermentTrainingController {
@AnonymousAccess
@ApiOperation("哈希函数资源学习分数统计")
@PostMapping("/hashWatchScore")
public ResultDataEntity<StuScoreDetails> hashWatchScore(@RequestBody JSONObject jsonObject) {
StuScoreDetailsDTO stuScoreDetailsDTO = jsonObject.getObject("stuScoreDetailsDTO", StuScoreDetailsDTO.class);
service.hashWatchScore(stuScoreDetailsDTO);
return new ResultDataEntity<>(HttpStatus.OK);
}
} }

@ -71,6 +71,10 @@ public interface StuExpermentTrainingService {
ResultEntity keyGeneration(); ResultEntity keyGeneration();
List<StuScoreDetails> getAcademicRecord(String userId, String module); List<StuScoreDetails> getAcademicRecord(String userId, String module);
void hashReadingScore(StuScoreDetailsDTO stuScoreDetailsDTO); void hashReadingScore(StuScoreDetailsDTO stuScoreDetailsDTO);
//哈希函数资源学习分数统计
void hashWatchScore(StuScoreDetailsDTO stuScoreDetailsDTO);
} }

@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sztzjy.trade.config.Constant;
import com.sztzjy.trade.entity.*; import com.sztzjy.trade.entity.*;
import com.sztzjy.trade.entity.dto.StuExpermentSubmitDTO; import com.sztzjy.trade.entity.dto.StuExpermentSubmitDTO;
import com.sztzjy.trade.entity.dto.StuScoreDetailsDTO; import com.sztzjy.trade.entity.dto.StuScoreDetailsDTO;
@ -785,7 +786,7 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
scoreDetailsList.add(stuScoreDetails); scoreDetailsList.add(stuScoreDetails);
} }
//将成绩添加到学生信息 //将成绩添加到学生信息
//this.personalScoreEntry(userId,module); this.personalScoreEntry(userId,module);
return scoreDetailsList; return scoreDetailsList;
} }
@Resource @Resource
@ -808,7 +809,9 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
//将时间转换为分钟 //将时间转换为分钟
double i = (double) stuScoreDetailsDTO.getViewingTime() / 60; double i = (double) stuScoreDetailsDTO.getViewingTime() / 60;
int floor = (int) Math.floor(i); Double floor = Math.floor(i);
BigDecimal knowledgeScore = weight.getScoringCriteriaForLearningDuration(); BigDecimal knowledgeScore = weight.getScoringCriteriaForLearningDuration();
@ -819,10 +822,12 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
stuScoreDetailsDTO.setScoreWeight(Double.parseDouble(String.valueOf(weight.getWeightStudyTime()))); stuScoreDetailsDTO.setScoreWeight(Double.parseDouble(String.valueOf(weight.getWeightStudyTime())));
StuScoreDetails stuScoreDetails = convertUtil.DTOToEntity(stuScoreDetailsDTO, StuScoreDetails.class); StuScoreDetails stuScoreDetails = convertUtil.DTOToEntity(stuScoreDetailsDTO, StuScoreDetails.class);
stuScoreDetails.setScoreProject(stuKnowledgeSummaryScoring); stuScoreDetails.setScoreProject(stuKnowledgeSummaryScoring);
floor = floor >= 1 ? 1 : floor;
stuScoreDetails.setCompletionStatus(String.valueOf(floor)); stuScoreDetails.setCompletionStatus(String.valueOf(floor));
stuScoreDetails.setSerialNumber(1); stuScoreDetails.setSerialNumber(1);
stuScoreDetails.setLearningProjects("知识概要"); stuScoreDetails.setLearningProjects("知识概要");
stuScoreDetails.setAssessmentItems("阅读知识"); stuScoreDetails.setAssessmentItems("阅读知识");
stuScoreDetails.setProject(stuScoreDetailsDTO.getModule());
//查询有无数据 //查询有无数据
StuScoreDetailsExample example1 = new StuScoreDetailsExample(); StuScoreDetailsExample example1 = new StuScoreDetailsExample();
@ -846,8 +851,8 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
} }
//时间累加 //时间累加
String completionStatus = scoreDetailsList.get(0).getCompletionStatus(); String completionStatus = String.valueOf(scoreDetailsList.get(0).getCompletionStatus());
String completionStatus1 = stuScoreDetails.getCompletionStatus(); String completionStatus1 = String.valueOf(stuScoreDetails.getCompletionStatus());
BigDecimal add1 = bigDecimalUtils.add(completionStatus, completionStatus1); BigDecimal add1 = bigDecimalUtils.add(completionStatus, completionStatus1);
stuScoreDetails.setScoreProject(Double.parseDouble(add.toString())); stuScoreDetails.setScoreProject(Double.parseDouble(add.toString()));
@ -857,7 +862,205 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
stuScoreDetailsMapper.updateByExampleSelective(stuScoreDetails, example1); stuScoreDetailsMapper.updateByExampleSelective(stuScoreDetails, example1);
} }
//将分数统计到学生表中 //将分数统计到学生表中
// this.personalScoreEntry(stuScoreDetailsDTO.getUserId(),stuScoreDetailsDTO.getModule()); this.personalScoreEntry(stuScoreDetailsDTO.getUserId(),stuScoreDetailsDTO.getModule());
}
/**
*
*
* @param stuScoreDetailsDTO DTO
*/
@Override
public void hashWatchScore(StuScoreDetailsDTO stuScoreDetailsDTO) {
StuUserExample stuUserExample = new StuUserExample();
stuUserExample.createCriteria().andUserIdEqualTo(stuScoreDetailsDTO.getUserId());
List<StuUser> stuUsers = stuUserMapper.selectByExample(stuUserExample);
StuUser stuUser = stuUsers.get(0);
TchDigitalTradeWeight weight = getWeight(stuUser.getSchoolId());
//时间转换成分钟
double i = (double) stuScoreDetailsDTO.getViewingTime() / 60;
double floor = Math.floor(i);
double stuResourcesScoring = scoringUtil.getStuResourcesScoring(floor, Double.parseDouble(String.valueOf(weight.getScoringCriteriaForStudyResource())));
stuScoreDetailsDTO.setScoringCriteria(String.valueOf(weight.getScoringCriteriaForStudyResource()));
stuScoreDetailsDTO.setScoreWeight(Double.parseDouble(String.valueOf(weight.getWeightStudyResource())));
//将DTO转为Entity
StuScoreDetails stuScoreDetails = convertUtil.DTOToEntity(stuScoreDetailsDTO, StuScoreDetails.class);
stuScoreDetails.setScoreProject(stuResourcesScoring);
stuScoreDetails.setCompletionStatus(String.valueOf(floor));
stuScoreDetails.setSerialNumber(2);
stuScoreDetails.setLearningProjects("资源学习");
stuScoreDetails.setAssessmentItems("观看资源");
//判断数据是否存在
StuScoreDetailsExample example1 = new StuScoreDetailsExample();
StuScoreDetailsExample.Criteria criteria1 = example1.createCriteria();
criteria1.andUserIdEqualTo(stuScoreDetailsDTO.getUserId())
.andModuleEqualTo(stuScoreDetailsDTO.getModule())
.andLearningProjectsEqualTo(stuScoreDetails.getLearningProjects());
List<StuScoreDetails> scoreDetailsList1 = stuScoreDetailsMapper.selectByExample(example1);
if (scoreDetailsList1.size() == 0) {
//不存在则添加数据
stuScoreDetails.setId(UUID.randomUUID().toString());
stuScoreDetailsMapper.insert(stuScoreDetails);
} else {
//分数累加
Double scoreProject = scoreDetailsList1.get(0).getScoreProject();
Double scoreProject1 = stuScoreDetails.getScoreProject();
BigDecimal add = bigDecimalUtils.add(scoreProject.toString(), scoreProject1.toString());
//时间累加
String completionStatus = scoreDetailsList1.get(0).getCompletionStatus();
String completionStatus1 = stuScoreDetails.getCompletionStatus();
BigDecimal add1 = bigDecimalUtils.add(completionStatus, completionStatus1);
stuScoreDetails.setScoreProject(Double.parseDouble(add.toString()));
stuScoreDetails.setCompletionStatus(add1.toString());
stuScoreDetailsMapper.updateByExampleSelective(stuScoreDetails, example1);
}
//将分数统计到学生表中
this.personalScoreEntry(stuScoreDetailsDTO.getUserId(),stuScoreDetailsDTO.getModule());
}
public void personalScoreEntry(String userId,String module){
// StuUserExample stuUserExample=new StuUserExample();
// stuUserExample.createCriteria().andUserIdEqualTo(userId);
// List<StuUser> stuUsers = stuUserMapper.selectByExample(stuUserExample);
// String schoolId = stuUsers.get(0).getSchoolId();
// TchDigitalTradeWeight weight = getWeight(schoolId);
// //取到知识概要计分标准和权重
// BigDecimal knowledgeScore = weight.getScoringCriteriaForLearningDuration();
// BigDecimal summaryOfKnowledgeWeight = weight.getWeightStudyTime();
// //取到资源学习计分标准和权重
// BigDecimal resourceLearningScore = weight.getScoringCriteriaForStudyResource();
// BigDecimal resourceLearningWeight = weight.getWeightStudyResource();
// //取到学习测评计分标准和权重
// BigDecimal learningAssessmentScore = weight.getScoringCriteriaForStudyEvaluation();
// BigDecimal learningAssessmentWeight = weight.getWeightStudyEvaluation();
// //取到实验实训计分标准和权重
// BigDecimal experimentalTrainingScore = weight.getScoringCriteriaForExperimentalTraining();
// BigDecimal experimentalTrainingWeight = weight.getWeightExperimentalTraining();
// //取到实验报告权重
// BigDecimal reportWeight = weight.getWeightExperimentalReport();
StuScoreDetailsExample stuScoreDetailsExample=new StuScoreDetailsExample();
stuScoreDetailsExample.createCriteria().andUserIdEqualTo(userId).andProjectEqualTo(module);
stuScoreDetailsExample.setOrderByClause("serial_number ASC");
List<StuScoreDetails> scoreDetailsList = stuScoreDetailsMapper.selectByExample(stuScoreDetailsExample);
double score=0;
for (int i = 0; i < scoreDetailsList.size(); i++) {
// StuScoreDetails stuScoreDetails = scoreDetailsList.get(i);
// if(stuScoreDetails.getLearningProjects().equals(Constant.ZSGY_TCHMODULE)){
// stuScoreDetails.setScoringCriteria(String.valueOf(knowledgeScore));
// stuScoreDetails.setScoreWeight(Double.parseDouble(String.valueOf(summaryOfKnowledgeWeight)));
// }
// if(stuScoreDetails.getLearningProjects().equals(Constant.ZYXX_TCHMODULE)){
// stuScoreDetails.setScoringCriteria(String.valueOf(resourceLearningScore));
// stuScoreDetails.setScoreWeight(Double.parseDouble(String.valueOf(resourceLearningWeight)));
// }
// if(stuScoreDetails.getLearningProjects().equals(Constant.XXCP_TCHMODULE)){
// stuScoreDetails.setScoringCriteria(String.valueOf(learningAssessmentScore));
// stuScoreDetails.setScoreWeight(Double.parseDouble(String.valueOf(learningAssessmentWeight)));
// }
// if(stuScoreDetails.getLearningProjects().equals(Constant.SYSX_TCHMODULE)){
// stuScoreDetails.setScoringCriteria(String.valueOf(experimentalTrainingScore));
// stuScoreDetails.setScoreWeight(Double.parseDouble(String.valueOf(experimentalTrainingWeight)));
// }
// if(stuScoreDetails.getLearningProjects().equals(Constant.SYBG_TCHMODULE)){
// stuScoreDetails.setScoreWeight(Double.parseDouble(String.valueOf(reportWeight)));
// }
// stuScoreDetailsMapper.updateByPrimaryKey(stuScoreDetails);
Double scoreProject = scoreDetailsList.get(i).getScoreProject();
if (scoreProject==null)
{
scoreProject=0.0;
}
Double scoreWeight = scoreDetailsList.get(i).getScoreWeight();
Double mul = bigDecimalUtils.mul(scoreProject, scoreWeight);
score+=mul;
}
//将所属模块总成绩添加到学生表
StuUser stuUser = stuUserMapper.selectByPrimaryKey(userId);
// if (module.equals(Constant.five_G)) {
// stuUser.setFiveScore(BigDecimal.valueOf(score));
// }
// if (module.equals(Constant.ARTIFICIAL_INTELLIGENCE)) {
// stuUser.setArtificialIntelligenceScore(BigDecimal.valueOf(score));
// }
// if (module.equals(Constant.BIG_DATA)) {
// stuUser.setBigDataScore(BigDecimal.valueOf(score));
// }
// if (module.equals(Constant.CLOUD_COMPUTING)) {
// stuUser.setCloudComputeScore(BigDecimal.valueOf(score));
// }
// if (module.equals(Constant.INTERNET_OF_THINGS)) {
// stuUser.setInternetOfThingsSocre(BigDecimal.valueOf(score));
// }
// if (module.equals(Constant.VIRTUAL_REALITY)) {
// stuUser.setVirtualRealitySocre(BigDecimal.valueOf(score));
// }
// if (module.equals(Constant.INDUSTRIAL_INTERNET)) {
// stuUser.setIndustrialInternetSocre(BigDecimal.valueOf(score));
// }
// if (module.equals(Constant.DIGITAL_TRADE)) {
// stuUser.setDigitalTradeScore(BigDecimal.valueOf(score));
// }
// if (module.equals(Constant.DIGITAL_FINANCE)) {
// stuUser.setDigitalFinanceScore(BigDecimal.valueOf(score));
// }
// if (module.equals("碳金融")) {
// stuUser.setDigitalGoverSocre(BigDecimal.valueOf(score));
// }
if (score!=0) {
stuUser.setResultsOfPracticalCaseStudies(BigDecimal.valueOf(score));
}
stuUserMapper.updateByPrimaryKey(stuUser);
// //更新数据价值化和数字产业化成绩和产业数字化和数字治理化成绩
// Double mul;
// StuUser stuUser1 = stuUserMapper.selectByPrimaryKey(userId);
// if(module.equals(Constant.DIGITAL_TRADE)||module.equals(Constant.DIGITAL_FINANCE)){
// BigDecimal digitalTradeScore = stuUser1.getDigitalTradeScore();
// BigDecimal digitalFinanceScore = stuUser1.getDigitalFinanceScore();
//
// String mul1 = bigDecimalUtils.mul(String.valueOf(digitalTradeScore),String.valueOf(0.5),2);
// String mul2 = bigDecimalUtils.mul(String.valueOf(digitalFinanceScore), String.valueOf(0.5),2);
// mul=Double.parseDouble(mul1)+Double.parseDouble(mul2);
// stuUser1.setIndustryDigitalScore(BigDecimal.valueOf(mul));
//
// }
// if(module.equals(Constant.five_G)||module.equals(Constant.ARTIFICIAL_INTELLIGENCE)||module.equals(Constant.BIG_DATA)||
// module.equals(Constant.CLOUD_COMPUTING)|| module.equals(Constant.INTERNET_OF_THINGS)||
// module.equals(Constant.VIRTUAL_REALITY)||module.equals(Constant.INDUSTRIAL_INTERNET)) {
// BigDecimal fiveScore = stuUser1.getFiveScore();
// BigDecimal artificialIntelligenceScore = stuUser1.getArtificialIntelligenceScore();
// BigDecimal bigDataScore = stuUser1.getBigDataScore();
// BigDecimal cloudComputeScore = stuUser1.getCloudComputeScore();
// BigDecimal internetOfThingsSocre = stuUser1.getInternetOfThingsSocre();
// BigDecimal virtualRealitySocre = stuUser1.getVirtualRealitySocre();
// BigDecimal industrialInternetSocre = stuUser1.getIndustrialInternetSocre();
// String mul1 = bigDecimalUtils.mul(String.valueOf(fiveScore),String.valueOf(0.1),2);
// String mul2 = bigDecimalUtils.mul(String.valueOf(artificialIntelligenceScore), String.valueOf(0.3),2);
// String mul3 = bigDecimalUtils.mul(String.valueOf(bigDataScore),String.valueOf(0.2),2);
// String mul4 = bigDecimalUtils.mul(String.valueOf(cloudComputeScore), String.valueOf(0.1),2);
// String mul5 = bigDecimalUtils.mul(String.valueOf(internetOfThingsSocre),String.valueOf(0.1),2);
// String mul6 = bigDecimalUtils.mul(String.valueOf(virtualRealitySocre),String.valueOf(0.1),2);
// String mul7 = bigDecimalUtils.mul(String.valueOf(industrialInternetSocre),String.valueOf(0.1),2);
// mul=Double.parseDouble(mul1)+Double.parseDouble(mul2)+Double.parseDouble(mul3)+Double.parseDouble(mul4)+
// Double.parseDouble(mul5)+Double.parseDouble(mul6)+Double.parseDouble(mul7);
// stuUser1.setDigitalIndustryScore(BigDecimal.valueOf(mul));
// }
// stuUserMapper.updateByPrimaryKey(stuUser1);
} }
} }

Loading…
Cancel
Save