|
|
@ -132,6 +132,7 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public PageInfo<ReportDto> teacherGetReport(Integer index, Integer size, Double reportWeight, Double operatorWeight, String keyWord, String stuClass) {
|
|
|
|
public PageInfo<ReportDto> teacherGetReport(Integer index, Integer size, Double reportWeight, Double operatorWeight, String keyWord, String stuClass) {
|
|
|
|
|
|
|
|
DecimalFormat df = new DecimalFormat("#.##"); // 指定保留两位小数
|
|
|
|
List<SysUser> userList1 = sysUserMapper.selectClassStuNumberName();
|
|
|
|
List<SysUser> userList1 = sysUserMapper.selectClassStuNumberName();
|
|
|
|
long total = userList1.size();
|
|
|
|
long total = userList1.size();
|
|
|
|
List<SysUser> users1 = sysUserMapper.selectByNameStuNum(stuClass, keyWord);
|
|
|
|
List<SysUser> users1 = sysUserMapper.selectByNameStuNum(stuClass, keyWord);
|
|
|
@ -152,6 +153,8 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
sysTrainingScore.getTrainingOperationScore() != null) {
|
|
|
|
sysTrainingScore.getTrainingOperationScore() != null) {
|
|
|
|
double reportScore = (sysTrainingScore.getTrainingReportScore().doubleValue()) * reportWeight;
|
|
|
|
double reportScore = (sysTrainingScore.getTrainingReportScore().doubleValue()) * reportWeight;
|
|
|
|
double operatorScore = (sysTrainingScore.getTrainingOperationScore().doubleValue()) * operatorWeight;
|
|
|
|
double operatorScore = (sysTrainingScore.getTrainingOperationScore().doubleValue()) * operatorWeight;
|
|
|
|
|
|
|
|
reportScore = Double.parseDouble(df.format(reportScore)); // 格式化结果
|
|
|
|
|
|
|
|
operatorScore = Double.parseDouble(df.format(operatorScore));
|
|
|
|
double totalScore = reportScore + operatorScore;
|
|
|
|
double totalScore = reportScore + operatorScore;
|
|
|
|
// 使用数据库中的分数创建ReportDto
|
|
|
|
// 使用数据库中的分数创建ReportDto
|
|
|
|
ReportDto reportDto = new ReportDto(
|
|
|
|
ReportDto reportDto = new ReportDto(
|
|
|
@ -186,8 +189,11 @@ 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) {
|
|
|
|
double reportScore = (sysTrainingScore.getTrainingReportScore().doubleValue()) * reportWeight;
|
|
|
|
double reportScore = sysTrainingScore.getTrainingReportScore().doubleValue() * reportWeight;
|
|
|
|
double operatorScore = (sysTrainingScore.getTrainingOperationScore().doubleValue()) * operatorWeight;
|
|
|
|
double operatorScore = sysTrainingScore.getTrainingOperationScore().doubleValue() * operatorWeight;
|
|
|
|
|
|
|
|
reportScore = Double.parseDouble(df.format(reportScore)); // 格式化结果
|
|
|
|
|
|
|
|
operatorScore = Double.parseDouble(df.format(operatorScore));
|
|
|
|
|
|
|
|
|
|
|
|
double totalScore = reportScore + operatorScore;
|
|
|
|
double totalScore = reportScore + operatorScore;
|
|
|
|
// 使用数据库中的分数创建ReportDto
|
|
|
|
// 使用数据库中的分数创建ReportDto
|
|
|
|
ReportDto reportDto = new ReportDto(
|
|
|
|
ReportDto reportDto = new ReportDto(
|
|
|
@ -296,7 +302,7 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
if (!sysTrainingScores.isEmpty()) {
|
|
|
|
if (!sysTrainingScores.isEmpty()) {
|
|
|
|
SysTrainingScore sysTrainingScore = sysTrainingScores.get(0);
|
|
|
|
SysTrainingScore sysTrainingScore = sysTrainingScores.get(0);
|
|
|
|
if (sysTrainingScore != null && sysTrainingScore.getReportContent() != null && !sysTrainingScore.getReportContent().isEmpty()) {
|
|
|
|
if (sysTrainingScore != null && sysTrainingScore.getReportContent() != null && !sysTrainingScore.getReportContent().isEmpty()) {
|
|
|
|
return AjaxResult.error("报告已提交,不允许上传和修改");
|
|
|
|
return AjaxResult.error(400,"报告已提交,不允许上传和修改");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sysTrainingScore != null && StringUtils.hasText(sysTrainingScore.getReportUploadPath())) {
|
|
|
|
if (sysTrainingScore != null && StringUtils.hasText(sysTrainingScore.getReportUploadPath())) {
|
|
|
|
fileUtil.remove(sysTrainingScore.getReportUploadPath());
|
|
|
|
fileUtil.remove(sysTrainingScore.getReportUploadPath());
|
|
|
@ -329,11 +335,11 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
sysTrainingScore.setReportstatus("未提交"); // 设置默认值为"未提交"
|
|
|
|
sysTrainingScore.setReportstatus("未提交"); // 设置默认值为"未提交"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sysTrainingScore.getReportstatus().equals("已提交")) { // 检查报告状态,如果已提交,则不允许再次提交
|
|
|
|
if (sysTrainingScore.getReportstatus().equals("已提交")) { // 检查报告状态,如果已提交,则不允许再次提交
|
|
|
|
return AjaxResult.error("报告已提交,不可重复提交,如需再次提交,请点击重新实训");
|
|
|
|
return AjaxResult.error(400,"报告已提交,不可重复提交,如需再次提交,请点击重新实训");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isSubmit) {
|
|
|
|
if (isSubmit) {
|
|
|
|
if (sysTrainingScore.getReportUploadPath() == null) {
|
|
|
|
if (sysTrainingScore.getReportUploadPath() == null) {
|
|
|
|
return AjaxResult.error("请先上传再提交");
|
|
|
|
return AjaxResult.error(400,"请先上传再提交");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sysTrainingScore.setReportContent(content);
|
|
|
|
sysTrainingScore.setReportContent(content);
|
|
|
|
sysTrainingScore.setReportstatus("已提交");
|
|
|
|
sysTrainingScore.setReportstatus("已提交");
|
|
|
@ -341,7 +347,7 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
|
|
|
|
return AjaxResult.success("提交成功");
|
|
|
|
return AjaxResult.success("提交成功");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (sysTrainingScore.getReportstatus().equals("已提交")) {
|
|
|
|
if (sysTrainingScore.getReportstatus().equals("已提交")) {
|
|
|
|
return AjaxResult.error("报告已提交,无法修改");
|
|
|
|
return AjaxResult.error(400,"报告已提交,无法修改");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sysTrainingScore.setReportContent(content);
|
|
|
|
sysTrainingScore.setReportContent(content);
|
|
|
|
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|