|
|
@ -23,6 +23,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.text.DecimalFormat;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
@ -149,13 +150,9 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
if (sysTrainingScore.getTotalscore() != null &&
|
|
|
|
if (sysTrainingScore.getTotalscore() != null &&
|
|
|
|
sysTrainingScore.getTrainingReportScore() != null &&
|
|
|
|
sysTrainingScore.getTrainingReportScore() != null &&
|
|
|
|
sysTrainingScore.getTrainingOperationScore() != null) {
|
|
|
|
sysTrainingScore.getTrainingOperationScore() != null) {
|
|
|
|
if (reportWeight==null){
|
|
|
|
double reportScore = (sysTrainingScore.getTrainingReportScore().doubleValue()) * reportWeight;
|
|
|
|
reportWeight=0.1;
|
|
|
|
|
|
|
|
}if (operatorWeight==null){
|
|
|
|
|
|
|
|
operatorWeight=0.9;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
double reportScore = (sysTrainingScore.getTrainingReportScore().doubleValue() )* reportWeight;
|
|
|
|
|
|
|
|
double operatorScore = (sysTrainingScore.getTrainingOperationScore().doubleValue()) * operatorWeight;
|
|
|
|
double operatorScore = (sysTrainingScore.getTrainingOperationScore().doubleValue()) * operatorWeight;
|
|
|
|
|
|
|
|
double totalScore = reportScore + operatorScore;
|
|
|
|
// 使用数据库中的分数创建ReportDto
|
|
|
|
// 使用数据库中的分数创建ReportDto
|
|
|
|
ReportDto reportDto = new ReportDto(
|
|
|
|
ReportDto reportDto = new ReportDto(
|
|
|
|
user.getStuClass(),
|
|
|
|
user.getStuClass(),
|
|
|
@ -163,7 +160,7 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
user.getUserName(),
|
|
|
|
user.getUserName(),
|
|
|
|
reportScore,
|
|
|
|
reportScore,
|
|
|
|
operatorScore,
|
|
|
|
operatorScore,
|
|
|
|
sysTrainingScore.getTotalscore(),
|
|
|
|
totalScore,
|
|
|
|
sysTrainingScore.getReportFilename()
|
|
|
|
sysTrainingScore.getReportFilename()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
reportDto.setUserId(user.getUserId());
|
|
|
|
reportDto.setUserId(user.getUserId());
|
|
|
@ -189,13 +186,9 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
if (sysTrainingScore.getTotalscore() != null &&
|
|
|
|
if (sysTrainingScore.getTotalscore() != null &&
|
|
|
|
sysTrainingScore.getTrainingReportScore() != null &&
|
|
|
|
sysTrainingScore.getTrainingReportScore() != null &&
|
|
|
|
sysTrainingScore.getTrainingOperationScore() != null) {
|
|
|
|
sysTrainingScore.getTrainingOperationScore() != null) {
|
|
|
|
if (reportWeight==null){
|
|
|
|
double reportScore = (sysTrainingScore.getTrainingReportScore().doubleValue()) * reportWeight;
|
|
|
|
reportWeight=0.1;
|
|
|
|
|
|
|
|
}if (operatorWeight==null){
|
|
|
|
|
|
|
|
operatorWeight=0.9;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
double reportScore = (sysTrainingScore.getTrainingReportScore().doubleValue() )* reportWeight;
|
|
|
|
|
|
|
|
double operatorScore = (sysTrainingScore.getTrainingOperationScore().doubleValue()) * operatorWeight;
|
|
|
|
double operatorScore = (sysTrainingScore.getTrainingOperationScore().doubleValue()) * operatorWeight;
|
|
|
|
|
|
|
|
double totalScore = reportScore + operatorScore;
|
|
|
|
// 使用数据库中的分数创建ReportDto
|
|
|
|
// 使用数据库中的分数创建ReportDto
|
|
|
|
ReportDto reportDto = new ReportDto(
|
|
|
|
ReportDto reportDto = new ReportDto(
|
|
|
|
sysUser.getStuClass(),
|
|
|
|
sysUser.getStuClass(),
|
|
|
@ -203,7 +196,7 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
sysUser.getUserName(),
|
|
|
|
sysUser.getUserName(),
|
|
|
|
reportScore,
|
|
|
|
reportScore,
|
|
|
|
operatorScore,
|
|
|
|
operatorScore,
|
|
|
|
sysTrainingScore.getTotalscore(),
|
|
|
|
totalScore,
|
|
|
|
sysTrainingScore.getReportFilename()
|
|
|
|
sysTrainingScore.getReportFilename()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
reportDto.setUserId(sysUser.getUserId());
|
|
|
|
reportDto.setUserId(sysUser.getUserId());
|
|
|
@ -215,7 +208,7 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PageInfo<ReportDto> pageInfo= new PageInfo<>(reportDtoList);
|
|
|
|
PageInfo<ReportDto> pageInfo = new PageInfo<>(reportDtoList);
|
|
|
|
pageInfo.setTotal(total);
|
|
|
|
pageInfo.setTotal(total);
|
|
|
|
return pageInfo;
|
|
|
|
return pageInfo;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -229,6 +222,7 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
|
|
|
|
|
|
|
|
// 算分
|
|
|
|
// 算分
|
|
|
|
private ReportDto createReportDto(SysTrainingScore sysTrainingScore, SysUser user, Double reportWeight, Double operatorWeight) {
|
|
|
|
private ReportDto createReportDto(SysTrainingScore sysTrainingScore, SysUser user, Double reportWeight, Double operatorWeight) {
|
|
|
|
|
|
|
|
DecimalFormat df = new DecimalFormat("#.##"); // 指定保留两位小数
|
|
|
|
ReportDto reportDto = new ReportDto();
|
|
|
|
ReportDto reportDto = new ReportDto();
|
|
|
|
reportDto.setFileName(sysTrainingScore.getReportFilename());
|
|
|
|
reportDto.setFileName(sysTrainingScore.getReportFilename());
|
|
|
|
Integer reportScore = sysTrainingScore.getTrainingReportScore(); // 报告成绩
|
|
|
|
Integer reportScore = sysTrainingScore.getTrainingReportScore(); // 报告成绩
|
|
|
@ -258,6 +252,9 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
if (reportScore != null && trainingOperationScore != null) {
|
|
|
|
if (reportScore != null && trainingOperationScore != null) {
|
|
|
|
Double resultReportScore = reportScore * reportWeight; //报告成绩 加权重后
|
|
|
|
Double resultReportScore = reportScore * reportWeight; //报告成绩 加权重后
|
|
|
|
Double resultOperationScore = trainingOperationScore * operatorWeight; //操作成绩 加权重后
|
|
|
|
Double resultOperationScore = trainingOperationScore * operatorWeight; //操作成绩 加权重后
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resultReportScore = Double.valueOf(df.format(resultReportScore)); // 格式化结果
|
|
|
|
|
|
|
|
resultOperationScore = Double.valueOf(df.format(resultOperationScore));
|
|
|
|
Double totalScore = resultReportScore + resultOperationScore; //总成绩
|
|
|
|
Double totalScore = resultReportScore + resultOperationScore; //总成绩
|
|
|
|
|
|
|
|
|
|
|
|
reportDto.setTrainingReportScore(resultReportScore);
|
|
|
|
reportDto.setTrainingReportScore(resultReportScore);
|
|
|
@ -272,12 +269,16 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
return reportDto;
|
|
|
|
return reportDto;
|
|
|
|
} //当两个成绩有一个时,也需要查询返回已有的 (不能算权重) 只有一个时不计算权重 否则查询一次就会算一次哦
|
|
|
|
} //当两个成绩有一个时,也需要查询返回已有的 (不能算权重) 只有一个时不计算权重 否则查询一次就会算一次哦
|
|
|
|
else if (reportScore != null) { // 当只有报告成绩可用时
|
|
|
|
else if (reportScore != null) { // 当只有报告成绩可用时
|
|
|
|
reportDto.setTrainingReportScore(reportScore.doubleValue() * reportWeight);
|
|
|
|
double resultReportScore = reportScore.doubleValue() * reportWeight;
|
|
|
|
|
|
|
|
resultReportScore = Double.parseDouble(df.format(resultReportScore));
|
|
|
|
|
|
|
|
reportDto.setTrainingReportScore(resultReportScore);
|
|
|
|
sysTrainingScore.setPreTrainingReportScore(reportScore);
|
|
|
|
sysTrainingScore.setPreTrainingReportScore(reportScore);
|
|
|
|
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
return reportDto;
|
|
|
|
return reportDto;
|
|
|
|
} else if (trainingOperationScore != null) { // 当只有操作成绩可用时
|
|
|
|
} else if (trainingOperationScore != null) { // 当只有操作成绩可用时
|
|
|
|
reportDto.setTrainingOperationScore(trainingOperationScore.doubleValue() * operatorWeight);
|
|
|
|
double resultOperationScore = trainingOperationScore.doubleValue() * operatorWeight;
|
|
|
|
|
|
|
|
resultOperationScore = Double.parseDouble(df.format(resultOperationScore));
|
|
|
|
|
|
|
|
reportDto.setTrainingOperationScore(resultOperationScore);
|
|
|
|
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
return reportDto;
|
|
|
|
return reportDto;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|