|
|
|
@ -5,14 +5,15 @@ import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.sztzjy.trade.config.Constant;
|
|
|
|
|
import com.sztzjy.trade.entity.*;
|
|
|
|
|
import com.sztzjy.trade.entity.dto.StuExpermentSubmitDTO;
|
|
|
|
|
import com.sztzjy.trade.entity.dto.StuScoreDetailsDTO;
|
|
|
|
|
import com.sztzjy.trade.entity.dto.StuTaskDetailDTO;
|
|
|
|
|
import com.sztzjy.trade.mapper.*;
|
|
|
|
|
import com.sztzjy.trade.service.StuExpermentTrainingService;
|
|
|
|
|
import com.sztzjy.trade.util.RedisUtil;
|
|
|
|
|
import com.sztzjy.trade.util.ResultEntity;
|
|
|
|
|
import com.sztzjy.trade.util.RsaUtil;
|
|
|
|
|
import com.sztzjy.trade.util.*;
|
|
|
|
|
import com.sztzjy.trade.util.compute.ScoringUtil;
|
|
|
|
|
import org.apache.poi.ss.formula.functions.T;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -63,6 +64,8 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
|
|
|
|
|
|
|
|
|
|
@Value("${file.url}")
|
|
|
|
|
public String url;
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuUserMapper stuUserMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@ -99,7 +102,7 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
|
|
|
|
|
//更新
|
|
|
|
|
stuTaskPracticeRecord.setId(practiceRecord.getId());
|
|
|
|
|
stuTaskPracticeRecordMapper.updateByPrimaryKeySelective(stuTaskPracticeRecord);
|
|
|
|
|
taskPracticeRecordList.forEach(item->{
|
|
|
|
|
taskPracticeRecordList.forEach(item -> {
|
|
|
|
|
if (practiceRecord.getId() == item.getId()) {
|
|
|
|
|
item.setSubState(1);
|
|
|
|
|
}
|
|
|
|
@ -128,7 +131,7 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
|
|
|
|
|
try {
|
|
|
|
|
RsaUtil.RsaKeyPair rsaKeyPair = RsaUtil.generateKeyPair();
|
|
|
|
|
|
|
|
|
|
return new ResultEntity(HttpStatus.OK,"生成密钥",rsaKeyPair);
|
|
|
|
|
return new ResultEntity(HttpStatus.OK, "生成密钥", rsaKeyPair);
|
|
|
|
|
} catch (NoSuchAlgorithmException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
@ -498,14 +501,14 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
|
|
|
|
|
uploadExperment.setModule(module);
|
|
|
|
|
uploadExperment.setUserId(userId);
|
|
|
|
|
stuUploadExpermentMapper.insertSelective(uploadExperment);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "上传成功!",url+filePath);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "上传成功!", url + filePath);
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
StuUploadExperment uploadExperment = stuUploadExpermentList.get(0);
|
|
|
|
|
uploadExperment.setUpdateTime(new Date());
|
|
|
|
|
uploadExperment.setFilePath(filePath);
|
|
|
|
|
stuUploadExpermentMapper.updateByPrimaryKeySelective(uploadExperment);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "上传成功!",url+filePath);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "上传成功!", url + filePath);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -527,7 +530,7 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// private synchronized void subQuestionRanking(String schoolId, String module, String classId, List<StuTaskDetailDTO> taskList, int state) {
|
|
|
|
|
// private synchronized void subQuestionRanking(String schoolId, String module, String classId, List<StuTaskDetailDTO> taskList, int state) {
|
|
|
|
|
//
|
|
|
|
|
// StuWrongQuestionRankingExample example = new StuWrongQuestionRankingExample();
|
|
|
|
|
// example.createCriteria().andSchoolIdEqualTo(schoolId).andModuleEqualTo(module);
|
|
|
|
@ -570,6 +573,494 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
@Resource
|
|
|
|
|
ScoringUtil scoringUtil;
|
|
|
|
|
@Resource
|
|
|
|
|
BigDecimalUtils bigDecimalUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<StuScoreDetails> getAcademicRecord(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 tchConceptualTechnologyWeights = getWeight(schoolId);
|
|
|
|
|
// if(tchConceptualTechnologyWeights.size()==0){
|
|
|
|
|
// TchConceptualTechnologyWeight tchConceptualTechnologyWeight = new TchConceptualTechnologyWeight(schoolId,module);
|
|
|
|
|
// tchConceptualTechnologyWeightMapper.insert(tchConceptualTechnologyWeight);
|
|
|
|
|
// tchConceptualTechnologyWeights.add(tchConceptualTechnologyWeight);
|
|
|
|
|
// }
|
|
|
|
|
//取到知识概要计分标准和权重
|
|
|
|
|
BigDecimal knowledgeScore = tchConceptualTechnologyWeights.getScoringCriteriaForLearningDuration();
|
|
|
|
|
BigDecimal summaryOfKnowledgeWeight = tchConceptualTechnologyWeights.getWeightStudyTime();
|
|
|
|
|
//取到资源学习计分标准和权重
|
|
|
|
|
BigDecimal resourceLearningScore = tchConceptualTechnologyWeights.getScoringCriteriaForStudyResource();
|
|
|
|
|
BigDecimal resourceLearningWeight = tchConceptualTechnologyWeights.getWeightStudyResource();
|
|
|
|
|
//取到学习测评计分标准和权重
|
|
|
|
|
BigDecimal learningAssessmentScore = tchConceptualTechnologyWeights.getScoringCriteriaForStudyEvaluation();
|
|
|
|
|
BigDecimal learningAssessmentWeight = tchConceptualTechnologyWeights.getWeightStudyEvaluation();
|
|
|
|
|
//取到实验实训计分标准和权重
|
|
|
|
|
BigDecimal experimentalTrainingScore = tchConceptualTechnologyWeights.getScoringCriteriaForExperimentalTraining();
|
|
|
|
|
BigDecimal experimentalTrainingWeight = tchConceptualTechnologyWeights.getWeightExperimentalTraining();
|
|
|
|
|
//取到实验报告权重
|
|
|
|
|
BigDecimal reportWeight = tchConceptualTechnologyWeights.getWeightExperimentalReport();
|
|
|
|
|
//查询成绩表
|
|
|
|
|
StuScoreDetailsExample example = new StuScoreDetailsExample();
|
|
|
|
|
example.createCriteria().andUserIdEqualTo(userId).andProjectEqualTo(module);
|
|
|
|
|
example.setOrderByClause("serial_number ASC");
|
|
|
|
|
List<StuScoreDetails> scoreDetailsList = stuScoreDetailsMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double score = 0;
|
|
|
|
|
int a=0;int b=0;int c=0;int d=0;int e=0;
|
|
|
|
|
for (int i = 0; i <scoreDetailsList.size(); i++) {
|
|
|
|
|
//根据所属模块更新计分标准和权重,并重新计算得分
|
|
|
|
|
if (scoreDetailsList.get(i).getSerialNumber()==1){
|
|
|
|
|
scoreDetailsList.get(i).setScoringCriteria(String.valueOf(knowledgeScore));
|
|
|
|
|
scoreDetailsList.get(i).setScoreWeight(Double.parseDouble(String.valueOf(summaryOfKnowledgeWeight)));
|
|
|
|
|
String completionStatus = scoreDetailsList.get(i).getCompletionStatus();
|
|
|
|
|
double stuKnowledgeSummaryScoring = scoringUtil.getStuKnowledgeSummaryScoring(Double.parseDouble(completionStatus), Double.parseDouble(String.valueOf(knowledgeScore)));
|
|
|
|
|
scoreDetailsList.get(i).setScoreProject(stuKnowledgeSummaryScoring);
|
|
|
|
|
|
|
|
|
|
Double info = 100 / Convert.toDouble(knowledgeScore);
|
|
|
|
|
|
|
|
|
|
Double complement = Convert.toDouble(completionStatus) / info ;
|
|
|
|
|
|
|
|
|
|
if (complement>=1)
|
|
|
|
|
{
|
|
|
|
|
//设置完成状态
|
|
|
|
|
scoreDetailsList.get(i).setSchedule(100.0);
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
|
info = Math.round(complement * 100.0) / 100.0;
|
|
|
|
|
//设置完成状态
|
|
|
|
|
scoreDetailsList.get(i).setSchedule(info*100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a++;
|
|
|
|
|
}
|
|
|
|
|
if(scoreDetailsList.get(i).getSerialNumber()==2){
|
|
|
|
|
scoreDetailsList.get(i).setScoringCriteria(String.valueOf(resourceLearningScore));
|
|
|
|
|
scoreDetailsList.get(i).setScoreWeight(Double.parseDouble(String.valueOf(resourceLearningWeight)));
|
|
|
|
|
String completionStatus = scoreDetailsList.get(i).getCompletionStatus();
|
|
|
|
|
double stuResourcesScoring = scoringUtil.getStuResourcesScoring(Double.parseDouble(completionStatus), Double.parseDouble(String.valueOf(resourceLearningScore)));
|
|
|
|
|
scoreDetailsList.get(i).setScoreProject(stuResourcesScoring);
|
|
|
|
|
|
|
|
|
|
Double info = 100 / Convert.toDouble(resourceLearningScore);
|
|
|
|
|
|
|
|
|
|
Double complement = Convert.toDouble(completionStatus) / info ;
|
|
|
|
|
|
|
|
|
|
if (complement>=1)
|
|
|
|
|
{
|
|
|
|
|
//设置完成状态
|
|
|
|
|
scoreDetailsList.get(i).setSchedule(100.0);
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
|
info = Math.round(complement * 100.0) / 100.0;
|
|
|
|
|
//设置完成状态
|
|
|
|
|
scoreDetailsList.get(i).setSchedule(info*100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b++;
|
|
|
|
|
}
|
|
|
|
|
if(scoreDetailsList.get(i).getSerialNumber()==3){
|
|
|
|
|
scoreDetailsList.get(i).setScoringCriteria(String.valueOf(learningAssessmentScore));
|
|
|
|
|
scoreDetailsList.get(i).setScoreWeight(Double.parseDouble(String.valueOf(learningAssessmentWeight)));
|
|
|
|
|
String completionStatus = scoreDetailsList.get(i).getCompletionStatus();
|
|
|
|
|
double stuLearningAssessmentScoring = scoringUtil.getStuLearningAssessmentScoring(Integer.parseInt(completionStatus), Double.parseDouble(String.valueOf(learningAssessmentScore)));
|
|
|
|
|
scoreDetailsList.get(i).setScoreProject(stuLearningAssessmentScoring);
|
|
|
|
|
//设置完成状态
|
|
|
|
|
scoreDetailsList.get(i).setSchedule(100.0);
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
if(scoreDetailsList.get(i).getSerialNumber()==4){
|
|
|
|
|
scoreDetailsList.get(i).setScoringCriteria(String.valueOf(experimentalTrainingScore));
|
|
|
|
|
scoreDetailsList.get(i).setScoreWeight(Double.parseDouble(String.valueOf(experimentalTrainingWeight)));
|
|
|
|
|
Double completionStatus = scoreDetailsList.get(i).getSchedule();
|
|
|
|
|
// double stuLearningAssessmentScoring = scoringUtil.getStuLearningAssessmentScoring(Convert.toInt(completionStatus), Double.parseDouble(String.valueOf(experimentalTrainingScore)));
|
|
|
|
|
scoreDetailsList.get(i).setScoreProject(scoreDetailsList.get(i).getScoreProject());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //判断该模块的实训任务是否已全部提交 全部提交则计算该模块的实训任务分数
|
|
|
|
|
// StuModuleDetailsExample stuModuleDetailsExample=new StuModuleDetailsExample();
|
|
|
|
|
// stuModuleDetailsExample.createCriteria().andModuleEqualTo(module);
|
|
|
|
|
// List<StuModuleDetails> stuModuleDetailsList = stuModuleDetailsMapper.selectByExample(stuModuleDetailsExample);
|
|
|
|
|
// if(stuModuleDetailsList.isEmpty()){ //设置默认数据
|
|
|
|
|
// StuModuleDetails stuModuleDetails=new StuModuleDetails(module);
|
|
|
|
|
// stuModuleDetailsMapper.insert(stuModuleDetails);
|
|
|
|
|
// stuModuleDetailsList.add(stuModuleDetails);
|
|
|
|
|
// }
|
|
|
|
|
// StuModuleDetails stuModuleDetails = stuModuleDetailsList.get(0);
|
|
|
|
|
//
|
|
|
|
|
// //总次数
|
|
|
|
|
// Integer taskNumber = stuModuleDetails.getTaskNumber();
|
|
|
|
|
//
|
|
|
|
|
// //查询该用户提交实训任务的次数
|
|
|
|
|
// StuTrainingTaskSubmissionDetailsExample stuTrainingTaskSubmissionDetailsExample1=new StuTrainingTaskSubmissionDetailsExample();
|
|
|
|
|
// stuTrainingTaskSubmissionDetailsExample1.createCriteria().andUserIdEqualTo(userId).andModuleEqualTo(module);
|
|
|
|
|
// List<StuTrainingTaskSubmissionDetails> stuTrainingTaskSubmissionDetails1 = stuTrainingTaskSubmissionDetailsMapper.selectByExample(stuTrainingTaskSubmissionDetailsExample1);
|
|
|
|
|
// if (stuTrainingTaskSubmissionDetails1.isEmpty())
|
|
|
|
|
// {
|
|
|
|
|
// scoreDetailsList.get(i).setSchedule(0.0);
|
|
|
|
|
// }else {
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// Double info = (double) stuTrainingTaskSubmissionDetails1.size() / taskNumber;
|
|
|
|
|
// info = Math.round(info * 100.0) / 100.0;
|
|
|
|
|
// scoreDetailsList.get(i).setSchedule(info*100);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
d++;
|
|
|
|
|
}
|
|
|
|
|
if(scoreDetailsList.get(i).getSerialNumber()==5){
|
|
|
|
|
scoreDetailsList.get(i).setScoreWeight(Double.parseDouble(String.valueOf(reportWeight)));
|
|
|
|
|
|
|
|
|
|
scoreDetailsList.get(i).setSchedule(100.0);
|
|
|
|
|
|
|
|
|
|
e++;
|
|
|
|
|
}
|
|
|
|
|
stuScoreDetailsMapper.updateByPrimaryKey(scoreDetailsList.get(i));
|
|
|
|
|
//根据权重计算所属总模块得分
|
|
|
|
|
Double scoreWeight = scoreDetailsList.get(i).getScoreWeight();
|
|
|
|
|
if(scoreDetailsList.get(i).getScoreProject()!=null){
|
|
|
|
|
Double scoreProject = scoreDetailsList.get(i).getScoreProject();
|
|
|
|
|
Double mul = bigDecimalUtils.mul(scoreWeight, scoreProject);
|
|
|
|
|
score += mul;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(a==0){
|
|
|
|
|
StuScoreDetails stuScoreDetails=new StuScoreDetails();
|
|
|
|
|
stuScoreDetails.setLearningProjects("知识概要");
|
|
|
|
|
stuScoreDetails.setAssessmentItems("阅读知识");
|
|
|
|
|
stuScoreDetails.setScoringCriteria(String.valueOf(knowledgeScore));
|
|
|
|
|
stuScoreDetails.setScoreWeight(Double.parseDouble(String.valueOf(summaryOfKnowledgeWeight)));
|
|
|
|
|
stuScoreDetails.setModule(module);
|
|
|
|
|
stuScoreDetails.setSerialNumber(1);
|
|
|
|
|
stuScoreDetails.setSchedule(0.0);
|
|
|
|
|
scoreDetailsList.add(stuScoreDetails);
|
|
|
|
|
}
|
|
|
|
|
if(b==0){
|
|
|
|
|
StuScoreDetails stuScoreDetails=new StuScoreDetails();
|
|
|
|
|
stuScoreDetails.setLearningProjects("资源学习");
|
|
|
|
|
stuScoreDetails.setAssessmentItems("观看资源");
|
|
|
|
|
stuScoreDetails.setScoringCriteria(String.valueOf(resourceLearningScore));
|
|
|
|
|
stuScoreDetails.setScoreWeight(Double.parseDouble(String.valueOf(resourceLearningWeight)));
|
|
|
|
|
stuScoreDetails.setModule(module);
|
|
|
|
|
stuScoreDetails.setSerialNumber(2);
|
|
|
|
|
stuScoreDetails.setSchedule(0.0);
|
|
|
|
|
scoreDetailsList.add(stuScoreDetails);
|
|
|
|
|
}
|
|
|
|
|
if(c==0){
|
|
|
|
|
StuScoreDetails stuScoreDetails=new StuScoreDetails();
|
|
|
|
|
stuScoreDetails.setLearningProjects("学习测评");
|
|
|
|
|
stuScoreDetails.setAssessmentItems("客观题测试");
|
|
|
|
|
stuScoreDetails.setScoringCriteria(String.valueOf(learningAssessmentScore));
|
|
|
|
|
stuScoreDetails.setScoreWeight(Double.parseDouble(String.valueOf(learningAssessmentWeight)));
|
|
|
|
|
stuScoreDetails.setModule(module);
|
|
|
|
|
stuScoreDetails.setSerialNumber(3);
|
|
|
|
|
stuScoreDetails.setSchedule(0.0);
|
|
|
|
|
scoreDetailsList.add(stuScoreDetails);
|
|
|
|
|
}
|
|
|
|
|
if(d==0){
|
|
|
|
|
StuScoreDetails stuScoreDetails=new StuScoreDetails();
|
|
|
|
|
stuScoreDetails.setLearningProjects("实验实训");
|
|
|
|
|
stuScoreDetails.setAssessmentItems("输错/选错次数");
|
|
|
|
|
stuScoreDetails.setScoringCriteria(String.valueOf(experimentalTrainingScore));
|
|
|
|
|
stuScoreDetails.setScoreWeight(Double.parseDouble(String.valueOf(experimentalTrainingWeight)));
|
|
|
|
|
stuScoreDetails.setModule(module);
|
|
|
|
|
stuScoreDetails.setSerialNumber(4);
|
|
|
|
|
stuScoreDetails.setSchedule(0.0);
|
|
|
|
|
scoreDetailsList.add(stuScoreDetails);
|
|
|
|
|
}
|
|
|
|
|
if(e==0){
|
|
|
|
|
StuScoreDetails stuScoreDetails=new StuScoreDetails();
|
|
|
|
|
stuScoreDetails.setLearningProjects("实训报告");
|
|
|
|
|
stuScoreDetails.setScoreWeight(Double.parseDouble(String.valueOf(reportWeight)));
|
|
|
|
|
stuScoreDetails.setModule(module);
|
|
|
|
|
stuScoreDetails.setSerialNumber(5);
|
|
|
|
|
stuScoreDetails.setCompletionStatus("未提交");
|
|
|
|
|
stuScoreDetails.setSchedule(0.0);
|
|
|
|
|
scoreDetailsList.add(stuScoreDetails);
|
|
|
|
|
}
|
|
|
|
|
//将成绩添加到学生信息
|
|
|
|
|
this.personalScoreEntry(userId,module);
|
|
|
|
|
return scoreDetailsList;
|
|
|
|
|
}
|
|
|
|
|
@Resource
|
|
|
|
|
ConvertUtil convertUtil;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 计算知识概要得分
|
|
|
|
|
*
|
|
|
|
|
* @param stuScoreDetailsDTO 知识概要DTO
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void hashReadingScore(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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal knowledgeScore = weight.getScoringCriteriaForLearningDuration();
|
|
|
|
|
|
|
|
|
|
double stuKnowledgeSummaryScoring = scoringUtil.getStuKnowledgeSummaryScoring(floor, Double.parseDouble(String.valueOf(knowledgeScore)));
|
|
|
|
|
//封装到实体类
|
|
|
|
|
stuScoreDetailsDTO.setScoringCriteria(String.valueOf(knowledgeScore));
|
|
|
|
|
|
|
|
|
|
stuScoreDetailsDTO.setScoreWeight(Double.parseDouble(String.valueOf(weight.getWeightStudyTime())));
|
|
|
|
|
StuScoreDetails stuScoreDetails = convertUtil.DTOToEntity(stuScoreDetailsDTO, StuScoreDetails.class);
|
|
|
|
|
stuScoreDetails.setScoreProject(stuKnowledgeSummaryScoring);
|
|
|
|
|
floor = floor >= 1 ? 1 : floor;
|
|
|
|
|
stuScoreDetails.setCompletionStatus(String.valueOf(floor));
|
|
|
|
|
stuScoreDetails.setSerialNumber(1);
|
|
|
|
|
stuScoreDetails.setLearningProjects("知识概要");
|
|
|
|
|
stuScoreDetails.setAssessmentItems("阅读知识");
|
|
|
|
|
stuScoreDetails.setProject(stuScoreDetailsDTO.getModule());
|
|
|
|
|
|
|
|
|
|
//查询有无数据
|
|
|
|
|
StuScoreDetailsExample example1 = new StuScoreDetailsExample();
|
|
|
|
|
StuScoreDetailsExample.Criteria criteria = example1.createCriteria();
|
|
|
|
|
criteria.andModuleEqualTo(stuScoreDetails.getModule())
|
|
|
|
|
.andLearningProjectsEqualTo(stuScoreDetails.getLearningProjects())
|
|
|
|
|
.andUserIdEqualTo(stuScoreDetails.getUserId());
|
|
|
|
|
List<StuScoreDetails> scoreDetailsList = stuScoreDetailsMapper.selectByExample(example1);
|
|
|
|
|
|
|
|
|
|
if (scoreDetailsList.size() == 0) {
|
|
|
|
|
stuScoreDetails.setId(UUID.randomUUID().toString());
|
|
|
|
|
stuScoreDetailsMapper.insert(stuScoreDetails);
|
|
|
|
|
} else {
|
|
|
|
|
//分数累加
|
|
|
|
|
Double scoreProject = scoreDetailsList.get(0).getScoreProject();
|
|
|
|
|
Double scoreProject1 = stuScoreDetails.getScoreProject();
|
|
|
|
|
BigDecimal add = bigDecimalUtils.add(scoreProject.toString(), scoreProject1.toString());
|
|
|
|
|
|
|
|
|
|
if(add.compareTo(BigDecimal.valueOf(100))==1){
|
|
|
|
|
add=BigDecimal.valueOf(100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//时间累加
|
|
|
|
|
String completionStatus = String.valueOf(scoreDetailsList.get(0).getCompletionStatus());
|
|
|
|
|
String completionStatus1 = String.valueOf(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());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 计算资源学习得分
|
|
|
|
|
*
|
|
|
|
|
* @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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|