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

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

Loading…
Cancel
Save