|
|
@ -20,10 +20,7 @@ import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
@ -215,25 +212,25 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
reportDto.setStuClass(user.getStuClass());
|
|
|
|
reportDto.setStuClass(user.getStuClass());
|
|
|
|
reportDto.setStuNumber(user.getStudentNumber());
|
|
|
|
reportDto.setStuNumber(user.getStudentNumber());
|
|
|
|
reportDto.setUserId(user.getUserId());
|
|
|
|
reportDto.setUserId(user.getUserId());
|
|
|
|
if (reportScore != null && trainingOperationScore != null) {
|
|
|
|
SysGradeWeight sysGradeWeight = gradeWeightMapper.selectByPrimaryKey(1L);
|
|
|
|
SysGradeWeight sysGradeWeight = gradeWeightMapper.selectByPrimaryKey(1L);
|
|
|
|
Double oldReportWeight = sysGradeWeight.getReportWeight();
|
|
|
|
Double oldReportWeight = sysGradeWeight.getReportWeight();
|
|
|
|
Double oldOperatorWeight = sysGradeWeight.getOperatorWeight();
|
|
|
|
Double oldOperatorWeight = sysGradeWeight.getOperatorWeight();
|
|
|
|
if (reportWeight != null) {
|
|
|
|
if (reportWeight != null) {
|
|
|
|
sysGradeWeight.setReportWeight(reportWeight);
|
|
|
|
sysGradeWeight.setReportWeight(reportWeight);
|
|
|
|
} else if (oldReportWeight != null) {
|
|
|
|
} else if (oldReportWeight != null) {
|
|
|
|
reportWeight = oldReportWeight;
|
|
|
|
reportWeight = oldReportWeight;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
reportWeight = 0.1; // 设置默认权重
|
|
|
|
reportWeight = 0.1; // 设置默认权重
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (operatorWeight != null) {
|
|
|
|
if (operatorWeight != null) {
|
|
|
|
sysGradeWeight.setOperatorWeight(operatorWeight);
|
|
|
|
sysGradeWeight.setOperatorWeight(operatorWeight);
|
|
|
|
} else if (oldOperatorWeight != null) {
|
|
|
|
} else if (oldOperatorWeight != null) {
|
|
|
|
operatorWeight = oldOperatorWeight;
|
|
|
|
operatorWeight = oldOperatorWeight;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operatorWeight = 0.9; // 设置默认权重
|
|
|
|
operatorWeight = 0.9; // 设置默认权重
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reportScore != null && trainingOperationScore != null) {
|
|
|
|
Double resultReportScore = reportScore * reportWeight; //报告成绩 加权重后
|
|
|
|
Double resultReportScore = reportScore * reportWeight; //报告成绩 加权重后
|
|
|
|
Double resultOperationScore = trainingOperationScore * operatorWeight; //操作成绩 加权重后
|
|
|
|
Double resultOperationScore = trainingOperationScore * operatorWeight; //操作成绩 加权重后
|
|
|
|
Double totalScore = resultReportScore + resultOperationScore; //总成绩
|
|
|
|
Double totalScore = resultReportScore + resultOperationScore; //总成绩
|
|
|
@ -249,11 +246,11 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
return reportDto;
|
|
|
|
return reportDto;
|
|
|
|
} //当两个成绩有一个时,也需要查询返回已有的 (不能算权重) 只有一个时不计算权重 否则查询一次就会算一次哦
|
|
|
|
} //当两个成绩有一个时,也需要查询返回已有的 (不能算权重) 只有一个时不计算权重 否则查询一次就会算一次哦
|
|
|
|
else if (reportScore != null) { // 当只有报告成绩可用时
|
|
|
|
else if (reportScore != null) { // 当只有报告成绩可用时
|
|
|
|
reportDto.setTrainingReportScore(reportScore.doubleValue());
|
|
|
|
reportDto.setTrainingReportScore(reportScore.doubleValue() * reportWeight);
|
|
|
|
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
return reportDto;
|
|
|
|
return reportDto;
|
|
|
|
} else if (trainingOperationScore != null) { // 当只有操作成绩可用时
|
|
|
|
} else if (trainingOperationScore != null) { // 当只有操作成绩可用时
|
|
|
|
reportDto.setTrainingOperationScore(trainingOperationScore.doubleValue());
|
|
|
|
reportDto.setTrainingOperationScore(trainingOperationScore.doubleValue() * operatorWeight);
|
|
|
|
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
return reportDto;
|
|
|
|
return reportDto;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -367,4 +364,29 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return AjaxResult.success("下载成功");
|
|
|
|
return AjaxResult.success("下载成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//修改实训报告分数,并重新算分
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Map<Long,Integer> reportGrade(Integer reportScore, Long userId) {
|
|
|
|
|
|
|
|
Map<Long,Integer> resultMap = new HashMap<>();
|
|
|
|
|
|
|
|
SysTrainingScoreExample trainingScoreExample = new SysTrainingScoreExample();
|
|
|
|
|
|
|
|
trainingScoreExample.createCriteria().andUseridEqualTo(userId);
|
|
|
|
|
|
|
|
List<SysTrainingScore> sysTrainingScores = trainingScoreMapper.selectByExample(trainingScoreExample);
|
|
|
|
|
|
|
|
if (!sysTrainingScores.isEmpty()) {
|
|
|
|
|
|
|
|
SysTrainingScore sysTrainingScore = sysTrainingScores.get(0);
|
|
|
|
|
|
|
|
sysTrainingScore.setTrainingReportScore(reportScore);
|
|
|
|
|
|
|
|
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
|
|
|
|
// 调用重新计算分数和总成绩的逻辑
|
|
|
|
|
|
|
|
SysUser user = sysUserMapper.selectUserById(userId);
|
|
|
|
|
|
|
|
SysGradeWeight sysGradeWeight = gradeWeightMapper.selectByPrimaryKey(1L);
|
|
|
|
|
|
|
|
Double operatorWeight = sysGradeWeight.getOperatorWeight();
|
|
|
|
|
|
|
|
Double reportWeight = sysGradeWeight.getReportWeight();
|
|
|
|
|
|
|
|
//修改完调用算分方法重新算分
|
|
|
|
|
|
|
|
createReportDto(sysTrainingScore, user, reportWeight, operatorWeight);
|
|
|
|
|
|
|
|
resultMap.put(userId,reportScore);
|
|
|
|
|
|
|
|
return resultMap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|