|
@@ -18,6 +18,7 @@ import com.qmth.teachcloud.common.service.SysOrgService;
|
|
|
import com.qmth.teachcloud.common.service.SysRoleService;
|
|
|
import com.qmth.teachcloud.common.service.SysUserService;
|
|
|
import com.qmth.teachcloud.common.util.ExcelUtil;
|
|
|
+import com.qmth.teachcloud.common.util.JacksonUtil;
|
|
|
import com.qmth.teachcloud.common.util.Result;
|
|
|
import com.qmth.teachcloud.common.util.ResultUtil;
|
|
|
import com.qmth.teachcloud.report.business.bean.dto.excel.*;
|
|
@@ -459,7 +460,7 @@ public class BasicDatasourceController {
|
|
|
List<TBExamCourse> tbExamCourseList = tbExamCourseService.list(new QueryWrapper<TBExamCourse>().lambda().eq(TBExamCourse::getExamId, examId));
|
|
|
|
|
|
List<Map> finalList = newCallApiService.callStudentScore(id, cloudExamCode);
|
|
|
-// System.out.println("------------------map : --------------------- \n" + JacksonUtil.parseJson(finalList));
|
|
|
+ System.out.println("------------------map : --------------------- \n" + JacksonUtil.parseJson(finalList));
|
|
|
|
|
|
// 根据云阅卷数据源筛选并保存班级、学院、教师数据源
|
|
|
// TODO: 2021/6/2 筛选并创建学校班级表
|
|
@@ -498,18 +499,37 @@ public class BasicDatasourceController {
|
|
|
.map(e -> String.valueOf(e.get(ExamCloudDataEnum.TEACHER.getName())))
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
for (String teacherInfo : teacherList) {
|
|
|
- List<String> teacherCodeList = tbExaminationRelationList.stream()
|
|
|
+ List<TBExaminationRelation> tbExaminationRelations = tbExaminationRelationList.stream()
|
|
|
.filter(e -> teacherInfo.equals(e.getTeacherName()))
|
|
|
- .map(TBExaminationRelation::getTeacherCode)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
- if (teacherCodeList.size() != 1){
|
|
|
- throw ExceptionResultEnum.ERROR.exception("不能通过云阅卷中教师名称找到对应考务数据的教师");
|
|
|
+
|
|
|
+ String teacherCode;
|
|
|
+ Long orgId = null;
|
|
|
+ if (tbExaminationRelations.size() != 1){
|
|
|
+ teacherCode = teacherInfo;
|
|
|
+ }else {
|
|
|
+ List<String> teacherCodeList = tbExaminationRelations.stream().map(TBExaminationRelation::getTeacherCode).distinct().collect(Collectors.toList());
|
|
|
+ if (teacherCodeList.size() != 1){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("考务数据-教师对应的教师编号有误");
|
|
|
+ }
|
|
|
+ List<String> teachCollegeNameList = tbExaminationRelations.stream().map(TBExaminationRelation::getTeachCollegeName).distinct().collect(Collectors.toList());
|
|
|
+ if (teachCollegeNameList.size() != 1){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("考务数据-教师对应的开课学院有误");
|
|
|
+ }
|
|
|
+ teacherCode = teacherCodeList.get(0);
|
|
|
+ String teachCollegeName = teachCollegeNameList.get(0);
|
|
|
+ List<SysOrg> sysOrgList = sysOrgService.list(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getName,teachCollegeName).eq(SysOrg::getSchoolId,schoolId));
|
|
|
+ if (sysOrgList.size() != 1){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未能找到考务数据中学院名称的学院");
|
|
|
+ }
|
|
|
+ orgId = sysOrgList.get(0).getId();
|
|
|
}
|
|
|
|
|
|
TBSchoolTeacherDto tbSchoolTeacherDto = new TBSchoolTeacherDto();
|
|
|
tbSchoolTeacherDto.setSchoolId(schoolId);
|
|
|
- tbSchoolTeacherDto.setTeacherCode(teacherCodeList.get(0));
|
|
|
+ tbSchoolTeacherDto.setTeacherCode(teacherCode);
|
|
|
tbSchoolTeacherDto.setTeacherName(teacherInfo);
|
|
|
+ tbSchoolTeacherDto.setOrgId(orgId);
|
|
|
tbSchoolTeacherDtoList.add(tbSchoolTeacherDto);
|
|
|
}
|
|
|
this.saveTeacherInfo(tbSchoolTeacherDtoList);
|
|
@@ -598,7 +618,7 @@ public class BasicDatasourceController {
|
|
|
// 获取关联的基础表主键
|
|
|
SysOrg tbSchoolCollege = sysOrgService.findByForeignKey(schoolId, college, college);
|
|
|
TBSchoolClazz tbSchoolClazz = tbSchoolClazzService.findByForeignKey(schoolId, className, className);
|
|
|
- SysUser tbSchoolTeacher = sysUserService.findByForeignKey(schoolId, teacher, teacher);
|
|
|
+ SysUser tbSchoolTeacher = sysUserService.findByForeignKey(schoolId, teacher);
|
|
|
|
|
|
TBExamStudent tbExamStudent = new TBExamStudent();
|
|
|
Long examStudentId = SystemConstant.getDbUuid();
|
|
@@ -960,6 +980,48 @@ public class BasicDatasourceController {
|
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "异常考生-批量处理")
|
|
|
+ @RequestMapping(value = "/exception_student/batch_dispose", method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ public Result exceptionStudentBatchDispose(@RequestParam String schoolId, @RequestParam String examId, @RequestParam(required = false) String courseCode) {
|
|
|
+ String courseName = basicCourseService.findByCourseCode(courseCode).getName();
|
|
|
+ if (tbExamCourseService.verifyExamCourseCantRun(SystemConstant.convertIdToLong(examId), SystemConstant.convertIdToLong(schoolId), courseCode, courseName)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("课程编号[" + courseCode + "]的课程分析数据已测试或发布,不能变更基础数据");
|
|
|
+ }
|
|
|
+ List<TBExamination> tbExaminationList = tbExaminationService.list(new QueryWrapper<TBExamination>().lambda()
|
|
|
+ .eq(TBExamination::getExamId,SystemConstant.convertIdToLong(examId))
|
|
|
+ .eq(TBExamination::getSchoolId,SystemConstant.convertIdToLong(schoolId))
|
|
|
+ .eq(TBExamination::getExaminationCourseCode,tbExamCourseService.getOne(new QueryWrapper<TBExamCourse>().lambda()
|
|
|
+ .eq(TBExamCourse::getExamId,examId)
|
|
|
+ .eq(TBExamCourse::getCourseCode,courseCode)
|
|
|
+ .eq(TBExamCourse::getSchoolId,schoolId))
|
|
|
+ .getExaminationCourseCode())
|
|
|
+ .eq(TBExamination::getCourseName,courseName)
|
|
|
+ .ne(TBExamination::getStudyType,"普通"));
|
|
|
+ int count = tbExaminationList.size();
|
|
|
+ if (count > 0) {
|
|
|
+ List<TBExamStudent> tbExamStudentList = tbExamStudentService.list(new QueryWrapper<TBExamStudent>().lambda()
|
|
|
+ .eq(TBExamStudent::getExamId, examId)
|
|
|
+ .eq(TBExamStudent::getSchoolId, schoolId)
|
|
|
+ .eq(TBExamStudent::getCourseCode, courseCode));
|
|
|
+
|
|
|
+ List<TBExamStudent> willUpdate = new ArrayList<>();
|
|
|
+ for (TBExamination tbExamination : tbExaminationList) {
|
|
|
+ String studentCode = tbExamination.getStudentCode();
|
|
|
+ List<TBExamStudent> cellList = tbExamStudentList.stream().filter(e -> studentCode.equals(e.getStudentCode())).collect(Collectors.toList());
|
|
|
+ if (cellList.size() != 1) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("数据异常");
|
|
|
+ }
|
|
|
+ TBExamStudent cell = cellList.get(0);
|
|
|
+ cell.setStudentCurrent(false);
|
|
|
+ willUpdate.add(cell);
|
|
|
+ }
|
|
|
+ tbExamStudentService.saveOrUpdateBatch(willUpdate);
|
|
|
+ }
|
|
|
+ return ResultUtil.ok("有【" + count + "】条缺考学生数据被更新");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -1066,7 +1128,7 @@ public class BasicDatasourceController {
|
|
|
userSaveParams.setLoginName(tbSchoolTeacherDto.getTeacherCode());
|
|
|
userSaveParams.setRealName(tbSchoolTeacherDto.getTeacherName());
|
|
|
userSaveParams.setPassword(SystemConstant.DEFAULT_PASSWORD);
|
|
|
- userSaveParams.setMobileNumber(SystemConstant.DEFAULT_MOBILE_NUMBER);
|
|
|
+ userSaveParams.setOrgId(tbSchoolTeacherDto.getOrgId());
|
|
|
userSaveParams.setEnable(true);
|
|
|
userSaveParams.setRoleIds(roleIds.toArray(new Long[0]));
|
|
|
sysUserService.saveUserNoAuth(userSaveParams);
|