|
@@ -9,6 +9,7 @@ import com.qmth.teachcloud.common.service.SysOrgService;
|
|
|
import com.qmth.teachcloud.common.service.SysUserService;
|
|
|
import com.qmth.teachcloud.report.business.bean.dto.AnswerDetailBean;
|
|
|
import com.qmth.teachcloud.report.business.bean.dto.query.BasicAnswerDto;
|
|
|
+import com.qmth.teachcloud.report.business.bean.dto.query.BasicExamRecordDto;
|
|
|
import com.qmth.teachcloud.report.business.bean.dto.query.ValidAnswerDetailDto;
|
|
|
import com.qmth.teachcloud.report.business.entity.*;
|
|
|
import com.qmth.teachcloud.report.business.enums.LevelRuleEnum;
|
|
@@ -96,6 +97,8 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
|
|
|
private TAExamCourseTeacherDifficultService taExamCourseTeacherDifficultService;
|
|
|
@Resource
|
|
|
private TAExamCourseTeacherDioService taExamCourseTeacherDioService;
|
|
|
+ @Resource
|
|
|
+ private TBExamRecordService tbExamRecordService;
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -1454,6 +1457,71 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
|
|
|
tbExamCourseService.updateById(tbExamCourse);
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public void normalAssignScore(Long examId, Long schoolId, String courseCode) {
|
|
|
+ List<String> courseCodeList = new ArrayList<>();
|
|
|
+ courseCodeList.add(courseCode);
|
|
|
+
|
|
|
+ // 数据同步操作
|
|
|
+ // 获取当前课程下所有学生考试成绩记录
|
|
|
+ List<BasicExamRecordDto> basicExamRecordDtoDatasource = tbExamRecordService.findByExamIdAndCourseCodeS(examId, courseCodeList);
|
|
|
+ for (String s : courseCodeList) {
|
|
|
+ if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, s, basicCourseService.findByCourseCode(s).getName())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("课程编号[" + s + "]的课程分析数据已测试或发布,不能变更基础数据");
|
|
|
+ }
|
|
|
+ List<BasicExamRecordDto> basicExamRecordDtoList = basicExamRecordDtoDatasource.stream()
|
|
|
+ .filter(e -> s.equals(e.getCourseCode())).collect(Collectors.toList());
|
|
|
+ if (basicExamRecordDtoList.size() > 0) {
|
|
|
+ // 删除源数据
|
|
|
+ taExamCourseRecordService.remove(new QueryWrapper<TAExamCourseRecord>()
|
|
|
+ .lambda().eq(TAExamCourseRecord::getExamId, examId).eq(TAExamCourseRecord::getCourseCode, s));
|
|
|
+ // 迁移数据至't_a_exam_course_record'
|
|
|
+ List<TAExamCourseRecord> taExamCourseRecordList = new ArrayList<>();
|
|
|
+ for (BasicExamRecordDto basicExamRecordDto : basicExamRecordDtoList) {
|
|
|
+ boolean absent = basicExamRecordDto.getAbsent();
|
|
|
+ // 正常公式赋分操作
|
|
|
+ Long paperId = basicExamRecordDto.getPaperId();
|
|
|
+ TBPaper tbPaper = tbPaperService.getById(paperId);
|
|
|
+ if (Objects.isNull(tbPaper)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("试卷信息数据异常");
|
|
|
+ }
|
|
|
+ BigDecimal fullScore = tbPaper.getTotalScore();
|
|
|
+ BigDecimal myScore = basicExamRecordDto.getTotalScore();
|
|
|
+ BigDecimal coefficient = tbPaper.getCoefficient();
|
|
|
+ BigDecimal assignScore;
|
|
|
+ // 当该试卷的赋分系数不为0时赋分
|
|
|
+ if (coefficient != null && coefficient.compareTo(BigDecimal.ZERO) > 0 && !absent) {
|
|
|
+ assignScore = myScore.add((fullScore.subtract(myScore)).divide(coefficient, 4, BigDecimal.ROUND_HALF_UP)).setScale(0,BigDecimal.ROUND_HALF_UP);
|
|
|
+ } else {
|
|
|
+ assignScore = myScore;
|
|
|
+ }
|
|
|
+ TAExamCourseRecord taExamCourseRecord = new TAExamCourseRecord();
|
|
|
+ taExamCourseRecord.setId(SystemConstant.getDbUuid());
|
|
|
+ taExamCourseRecord.setExamRecordId(basicExamRecordDto.getTbExamRecordId());
|
|
|
+ // 数据同步默认赋分成绩为卷面成绩
|
|
|
+ taExamCourseRecord.setSchoolId(tbExamService.getById(examId).getSchoolId());
|
|
|
+ taExamCourseRecord.setAssignedScore(assignScore);
|
|
|
+ taExamCourseRecord.setExamId(examId);
|
|
|
+ taExamCourseRecord.setCourseCode(basicExamRecordDto.getCourseCode());
|
|
|
+ taExamCourseRecord.setPaperId(basicExamRecordDto.getPaperId());
|
|
|
+ taExamCourseRecord.setPaperType(basicExamRecordDto.getPaperType());
|
|
|
+ taExamCourseRecord.setStudentId(basicExamRecordDto.getStudentId());
|
|
|
+ taExamCourseRecord.setStudentCode(basicExamRecordDto.getStudentCode());
|
|
|
+ taExamCourseRecord.setTeacherId(basicExamRecordDto.getTeacherId());
|
|
|
+ taExamCourseRecord.setClazzId(basicExamRecordDto.getClazzId());
|
|
|
+ taExamCourseRecord.setTeachCollegeId(basicExamRecordDto.getTeachCollegeId());
|
|
|
+ taExamCourseRecord.setInspectCollegeId(basicExamRecordDto.getInspectCollegeId());
|
|
|
+ taExamCourseRecord.setMajorId(basicExamRecordDto.getMajorId());
|
|
|
+ taExamCourseRecord.setTotalScore(myScore);
|
|
|
+ taExamCourseRecord.setAbsent(absent);
|
|
|
+ taExamCourseRecord.setStudentCurrent(basicExamRecordDto.getStudentCurrent());
|
|
|
+ taExamCourseRecordList.add(taExamCourseRecord);
|
|
|
+ }
|
|
|
+ taExamCourseRecordService.saveBatch(taExamCourseRecordList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
private void verifyComputing(Long examId,String courseCode){
|