新增总成绩字段,以及部分接口

master
xiaoCJ 1 year ago
parent 42e6544abe
commit 900e12c5d6

@ -222,7 +222,7 @@ public class TrainingScoreController {
@RequestParam(required = false) String keyWord,
@RequestParam(required = false) String stuClass,
@RequestParam Long deptId) {
return trainingScoreService.teacherGetReport(index, size, reportWeight, operatorWeight, keyWord, stuClass,deptId);
return trainingScoreService.teacherGetReport(index, size, reportWeight, operatorWeight, keyWord, stuClass, deptId);
}
@ -255,7 +255,8 @@ public class TrainingScoreController {
public void reportGrade(@RequestBody JSONObject jsonObject) {
Integer reportScore = jsonObject.getInteger("reportScore");
Long userId = jsonObject.getLong("userId");
trainingScoreService.reportGrade(reportScore, userId);
Long deptId = jsonObject.getLong("deptId");
trainingScoreService.reportGrade(reportScore, userId, deptId);
}

@ -36,5 +36,5 @@ public interface ISysTrainingScoreService {
AjaxResult downloadReport(HttpServletResponse response, Long id);
void reportGrade(Integer reportScore, Long userId);
void reportGrade(Integer reportScore, Long userId,Long deptId);
}

@ -134,6 +134,8 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
@Override
public PageInfo<ReportDto> teacherGetReport(Integer index, Integer size, Double reportWeight, Double operatorWeight, String keyWord, String stuClass,Long deptId) {
SysDept sysDept = sysDeptMapper.selectDeptById(deptId);
Long parentId = sysDept.getParentId();
List<SysUser> userList1;
List<SysUser> users1;
if (deptId==103){
@ -263,24 +265,26 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
reportDto.setStuClass(user.getStuClass());
reportDto.setStuNumber(user.getStudentNumber());
reportDto.setUserId(user.getUserId());
SysGradeWeight sysGradeWeight = gradeWeightMapper.selectByPrimaryKey(1L);
Double oldReportWeight = sysGradeWeight.getReportWeight();
Double oldOperatorWeight = sysGradeWeight.getOperatorWeight();
if (reportWeight != null) {
sysGradeWeight.setReportWeight(reportWeight);
} else if (oldReportWeight != null) {
reportWeight = oldReportWeight;
} else {
reportWeight = 0.1; // 设置默认权重
}
// SysGradeWeight sysGradeWeight = gradeWeightMapper.selectByPrimaryKey(1L);
// SysGradeWeight sysGradeWeight = gradeWeightMapper.selectByPrimaryKey(deptId);
if (operatorWeight != null) {
sysGradeWeight.setOperatorWeight(operatorWeight);
} else if (oldOperatorWeight != null) {
operatorWeight = oldOperatorWeight;
} else {
operatorWeight = 0.9; // 设置默认权重
}
// Double oldReportWeight = sysGradeWeight.getReportWeight();
// Double oldOperatorWeight = sysGradeWeight.getOperatorWeight();
// if (reportWeight != null) {
// sysGradeWeight.setReportWeight(reportWeight);
// } else if (oldReportWeight != null) {
// reportWeight = oldReportWeight;
// } else {
// reportWeight = 0.1; // 设置默认权重
// }
//
// if (operatorWeight != null) {
// sysGradeWeight.setOperatorWeight(operatorWeight);
// } else if (oldOperatorWeight != null) {
// operatorWeight = oldOperatorWeight;
// } else {
// operatorWeight = 0.9; // 设置默认权重
// }
if (reportScore != null && trainingOperationScore != null) {
Double resultReportScore = reportScore * reportWeight; //报告成绩 加权重后
Double resultOperationScore = trainingOperationScore * operatorWeight; //操作成绩 加权重后
@ -297,7 +301,7 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
// sysTrainingScore.setTrainingOperationScore(resultOperationScore.intValue());
sysTrainingScore.setPreTrainingReportScore(reportScore);
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
gradeWeightMapper.updateByPrimaryKeySelective(sysGradeWeight);
// gradeWeightMapper.updateByPrimaryKeySelective(sysGradeWeight);
return reportDto;
} //当两个成绩有一个时,也需要查询返回已有的 (不能算权重) 只有一个时不计算权重 否则查询一次就会算一次哦
else if (reportScore != null) { // 当只有报告成绩可用时
@ -438,7 +442,9 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
//修改实训报告分数,并重新算分
@Override
public void reportGrade(Integer reportScore, Long userId) {
public void reportGrade(Integer reportScore, Long userId,Long deptId) {
SysDept sysDept = sysDeptMapper.selectDeptById(deptId);
Long parentId = sysDept.getParentId();
SysTrainingScoreExample trainingScoreExample = new SysTrainingScoreExample();
trainingScoreExample.createCriteria().andUseridEqualTo(userId);
List<SysTrainingScoreWithBLOBs> sysTrainingScores = trainingScoreMapper.selectByExampleWithBLOBs(trainingScoreExample);
@ -449,7 +455,7 @@ public class SysTrainingScoreServiceImpl implements ISysTrainingScoreService {
trainingScoreMapper.updateByPrimaryKeySelective(sysTrainingScore);
// 调用重新计算分数和总成绩的逻辑
SysUser user = sysUserMapper.selectUserById(userId);
SysGradeWeight sysGradeWeight = gradeWeightMapper.selectByPrimaryKey(1L);
SysGradeWeight sysGradeWeight = gradeWeightMapper.selectByPrimaryKey(parentId);
Double operatorWeight = sysGradeWeight.getOperatorWeight();
Double reportWeight = sysGradeWeight.getReportWeight();
//修改完调用算分方法重新算分

Loading…
Cancel
Save