|
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.qmth.boot.api.annotation.Aac;
|
|
|
+import com.qmth.boot.api.annotation.BOOL;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
import com.qmth.teachcloud.common.bean.params.UserSaveParams;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
@@ -17,28 +19,32 @@ import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
|
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.common.util.*;
|
|
|
import com.qmth.teachcloud.report.business.bean.dto.CombineDto;
|
|
|
import com.qmth.teachcloud.report.business.bean.dto.excel.*;
|
|
|
import com.qmth.teachcloud.report.business.bean.dto.query.*;
|
|
|
+import com.qmth.teachcloud.report.business.bean.params.CollegeCombineParams;
|
|
|
import com.qmth.teachcloud.report.business.entity.*;
|
|
|
import com.qmth.teachcloud.report.business.enums.AssignEnum;
|
|
|
import com.qmth.teachcloud.report.business.enums.ExamCloudDataEnum;
|
|
|
import com.qmth.teachcloud.report.business.enums.NumberTypeEnum;
|
|
|
+import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
|
|
|
import com.qmth.teachcloud.report.business.service.*;
|
|
|
import io.swagger.annotations.*;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.ExecutionException;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
@@ -50,6 +56,7 @@ import java.util.stream.Stream;
|
|
|
@Api(tags = "数据源处理controller")
|
|
|
@RestController
|
|
|
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.datasource}")
|
|
|
+//@Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
|
|
|
public class BasicDatasourceController {
|
|
|
@Resource
|
|
|
private TBPaperService tbPaperService;
|
|
@@ -99,6 +106,10 @@ public class BasicDatasourceController {
|
|
|
private TBExaminationService tbExaminationService;
|
|
|
@Resource
|
|
|
private TBExaminationRelationService tbExaminationRelationService;
|
|
|
+ @Resource
|
|
|
+ private TBTeacherService tbTeacherService;
|
|
|
+ @Resource
|
|
|
+ private CourseUnitOperateService courseUnitOperateService;
|
|
|
|
|
|
@ApiOperation(value = "试卷数据导入")
|
|
|
@RequestMapping(value = "/paper/import", method = RequestMethod.POST)
|
|
@@ -177,8 +188,21 @@ public class BasicDatasourceController {
|
|
|
|
|
|
String paperType = paperStructDto.getPaperCode();
|
|
|
Long paperId = paperMap.get(paperType);
|
|
|
+
|
|
|
+ // 考察点去空格
|
|
|
+ String knowledgeDimension = paperStructDto.getKnowledgeDimension();
|
|
|
+ if (SystemConstant.strNotNull(knowledgeDimension)) {
|
|
|
+ knowledgeDimension = knowledgeDimension.trim().replaceAll(SystemConstant.COMMA_OF_CHINESE, SystemConstant.COMMA_OF_ENGLISH).replaceAll(SystemConstant.PAUSE_SIGN, SystemConstant.COMMA_OF_ENGLISH);
|
|
|
+ }
|
|
|
+ String abilityDimension = paperStructDto.getAbilityDimension();
|
|
|
+ if (SystemConstant.strNotNull(abilityDimension)) {
|
|
|
+ abilityDimension = abilityDimension.trim().replaceAll(SystemConstant.COMMA_OF_CHINESE, SystemConstant.COMMA_OF_ENGLISH).replaceAll(SystemConstant.PAUSE_SIGN, SystemConstant.COMMA_OF_ENGLISH);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 题号组合与匹配
|
|
|
String mainNumber = paperStructDto.getMainNumber();
|
|
|
String subNumber = paperStructDto.getSubNumber();
|
|
|
+
|
|
|
String questionType = paperStructDto.getQuestionType();
|
|
|
if (questionType == null) {
|
|
|
questionType = "";
|
|
@@ -197,8 +221,8 @@ public class BasicDatasourceController {
|
|
|
tbPaperStruct.setFullScore(BigDecimal.valueOf(Double.parseDouble(paperStructDto.getFullScore())));
|
|
|
tbPaperStruct.setScoreRules(paperStructDto.getScoreRules());
|
|
|
tbPaperStruct.setRulesDesc(paperStructDto.getRulesDesc());
|
|
|
- tbPaperStruct.setKnowledgeDimension(paperStructDto.getKnowledgeDimension());
|
|
|
- tbPaperStruct.setAbilityDimension(paperStructDto.getAbilityDimension());
|
|
|
+ tbPaperStruct.setKnowledgeDimension(knowledgeDimension);
|
|
|
+ tbPaperStruct.setAbilityDimension(abilityDimension);
|
|
|
tbPaperStructList.add(tbPaperStruct);
|
|
|
}
|
|
|
}
|
|
@@ -319,7 +343,7 @@ public class BasicDatasourceController {
|
|
|
|
|
|
String courseCode = moduleConfigDto.getCourseCode();
|
|
|
String courseName = basicCourseService.getOne(new QueryWrapper<BasicCourse>().lambda()
|
|
|
- .eq(BasicCourse::getSchoolId, schoolId).eq(BasicCourse::getCode, courseCode))
|
|
|
+ .eq(BasicCourse::getSchoolId, schoolId).eq(BasicCourse::getCode, courseCode))
|
|
|
.getName();
|
|
|
|
|
|
|
|
@@ -404,7 +428,7 @@ public class BasicDatasourceController {
|
|
|
|
|
|
String courseCode = dimensionDto.getCourseCode();
|
|
|
String courseName = basicCourseService.getOne(new QueryWrapper<BasicCourse>().lambda()
|
|
|
- .eq(BasicCourse::getSchoolId, schoolId).eq(BasicCourse::getCode, courseCode))
|
|
|
+ .eq(BasicCourse::getSchoolId, schoolId).eq(BasicCourse::getCode, courseCode))
|
|
|
.getName();
|
|
|
|
|
|
if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, courseCode, courseName)) {
|
|
@@ -442,15 +466,15 @@ public class BasicDatasourceController {
|
|
|
@RequestMapping(value = "/examAnswer/import", method = RequestMethod.POST)
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
- public Result examAnswerImport(@ApiParam(value = "云阅卷考试id", required = true) @RequestParam Long id, @ApiParam(value = "云阅卷考试编号", required = false)
|
|
|
- @RequestParam(required = false) String cloudExamCode,
|
|
|
- @ApiParam(value = "教研分析将AB卷分开分析时自定义科目和卷形的连接符(连接符必须和’t_e_course‘表中的科目名称中连接符对应)")
|
|
|
- @RequestParam(required = false) String linkSign, @RequestParam Long pSchoolId) throws IOException {
|
|
|
+ public Result examAnswerImport(@ApiParam(value = "云阅卷考试id", required = true) @RequestParam Long id,
|
|
|
+ @ApiParam(value = "云阅卷考试编号") @RequestParam(required = false) String cloudExamCode,
|
|
|
+ @ApiParam(value = "教研分析将AB卷分开分析时自定义科目和卷形的连接符(连接符必须和’t_e_course‘表中的科目名称中连接符对应)") @RequestParam(required = false) String linkSign,
|
|
|
+ @ApiParam(value = "学校id") @RequestParam Long pSchoolId) throws IOException {
|
|
|
TBExam tbExam = tbExamService.findByCloudExamId(id);
|
|
|
Long examId = tbExam.getId();
|
|
|
Long schoolId = tbExamService.getById(examId).getSchoolId();
|
|
|
|
|
|
- if (!schoolId.equals(pSchoolId)){
|
|
|
+ if (!schoolId.equals(pSchoolId)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("学校id不匹配");
|
|
|
}
|
|
|
|
|
@@ -490,34 +514,78 @@ public class BasicDatasourceController {
|
|
|
// TODO: 2021/6/2 筛选并创建学校教师表
|
|
|
// 查询考务关系
|
|
|
List<TBExaminationRelation> tbExaminationRelationList = tbExaminationRelationService.list(new QueryWrapper<TBExaminationRelation>().lambda()
|
|
|
- .eq(TBExaminationRelation::getExamId,examId));
|
|
|
+ .eq(TBExaminationRelation::getExamId, examId));
|
|
|
|
|
|
List<TBSchoolTeacherDto> tbSchoolTeacherDtoList = new ArrayList<>();
|
|
|
- List<String> teacherList = finalList.stream()
|
|
|
- .map(e -> String.valueOf(e.get(ExamCloudDataEnum.TEACHER.getName())))
|
|
|
- .distinct().collect(Collectors.toList());
|
|
|
- for (String teacherInfo : teacherList) {
|
|
|
+
|
|
|
+ List<Map<String, String>> teacherList = finalList.stream()
|
|
|
+ .flatMap(e -> {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("subjectName", String.valueOf(e.get(ExamCloudDataEnum.SUBJECT_NAME.getName())));
|
|
|
+ map.put("teacherInfo", String.valueOf(e.get(ExamCloudDataEnum.TEACHER.getName())));
|
|
|
+ return Stream.of(map);
|
|
|
+ }).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (Map<String, String> teacherPackage : teacherList) {
|
|
|
+
|
|
|
+ String teacherInfo = teacherPackage.get("teacherInfo");
|
|
|
+ String subjectName = teacherPackage.get("subjectName");
|
|
|
+
|
|
|
+ Long teacherCollegeId = null;
|
|
|
+ // 如果存在A、B卷
|
|
|
+ for (TBExamCourse tbExamCourse : tbExamCourseList) {
|
|
|
+ String courseName = tbExamCourse.getCourseName();
|
|
|
+ if (SystemConstant.strNotNull(linkSign) && courseName.contains(linkSign)) {
|
|
|
+ String[] cellArr = courseName.split(linkSign);
|
|
|
+ if (cellArr.length != 2) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("无法解析存在分隔符为 【" + linkSign + "】的课程 【" + courseName + "】");
|
|
|
+ }
|
|
|
+ if (cellArr[0].equals(subjectName)) {
|
|
|
+ teacherCollegeId = tbExamCourse.getTeachCollegeId();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (courseName.equals(subjectName)) {
|
|
|
+ teacherCollegeId = tbExamCourse.getTeachCollegeId();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 教师信息统一化处理逻辑
|
|
|
+ Map<String, String> map = this.disposeTeacherInfo(teacherInfo);
|
|
|
+ String teacherName = map.get("teacherName");
|
|
|
+ String teacherCode = map.get("teacherCode");
|
|
|
+
|
|
|
List<TBExaminationRelation> tbExaminationRelations = tbExaminationRelationList.stream()
|
|
|
- .filter(e -> teacherInfo.equals(e.getTeacherName()))
|
|
|
+ .filter(e -> teacherName.equals(e.getTeacherName()))
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
|
|
|
- String teacherCode;
|
|
|
+ // TODO: 2021/7/26 研究下面臃肿且被考务数据限制死的的教师机构获取方式是否可以使用上面的替代
|
|
|
Long orgId = null;
|
|
|
- if (tbExaminationRelations.size() == 0){
|
|
|
- teacherCode = teacherInfo;
|
|
|
- }else {
|
|
|
+ if (tbExaminationRelations.size() == 0) {
|
|
|
+ if (!SystemConstant.strNotNull(teacherCode)) {
|
|
|
+ List<TBTeacher> tbTeacherList = tbTeacherService.list(new QueryWrapper<TBTeacher>().lambda().eq(TBTeacher::getSchoolId, schoolId).eq(TBTeacher::getTeacherName, teacherName));
|
|
|
+ if (tbTeacherList.size() == 1) {
|
|
|
+ teacherCode = tbTeacherList.get(0).getTeacherCode();
|
|
|
+ } else {
|
|
|
+ teacherCode = teacherInfo;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ orgId = teacherCollegeId;
|
|
|
+ } else {
|
|
|
List<String> teacherCodeList = tbExaminationRelations.stream().map(TBExaminationRelation::getTeacherCode).distinct().collect(Collectors.toList());
|
|
|
- if (teacherCodeList.size() != 1){
|
|
|
+ if (teacherCodeList.size() != 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考务数据-教师对应的教师编号有误");
|
|
|
}
|
|
|
List<String> teachCollegeNameList = tbExaminationRelations.stream().map(TBExaminationRelation::getTeachCollegeName).distinct().collect(Collectors.toList());
|
|
|
- if (teachCollegeNameList.size() != 1){
|
|
|
+ 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){
|
|
|
+ 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();
|
|
@@ -526,7 +594,7 @@ public class BasicDatasourceController {
|
|
|
TBSchoolTeacherDto tbSchoolTeacherDto = new TBSchoolTeacherDto();
|
|
|
tbSchoolTeacherDto.setSchoolId(schoolId);
|
|
|
tbSchoolTeacherDto.setTeacherCode(teacherCode);
|
|
|
- tbSchoolTeacherDto.setTeacherName(teacherInfo);
|
|
|
+ tbSchoolTeacherDto.setTeacherName(teacherName);
|
|
|
tbSchoolTeacherDto.setOrgId(orgId);
|
|
|
tbSchoolTeacherDtoList.add(tbSchoolTeacherDto);
|
|
|
}
|
|
@@ -544,13 +612,15 @@ public class BasicDatasourceController {
|
|
|
int count = paperTypeList.size();
|
|
|
int i = 0;
|
|
|
|
|
|
+ Map<String, TBStudent> checkMap = new HashMap<>();
|
|
|
for (Map map : finalList) {
|
|
|
- String subjectCode = (String) map.get(ExamCloudDataEnum.SUBJECT_CODE.getName()); //科目代码
|
|
|
- String subjectName = (String) map.get(ExamCloudDataEnum.SUBJECT_NAME.getName()); //科目名称
|
|
|
- String examNumber = (String) map.get(ExamCloudDataEnum.EXAM_NUMBER.getName()); //准考证号
|
|
|
- String studentCode = (String) map.get(ExamCloudDataEnum.STUDENT_CODE.getName()); //学号
|
|
|
- String name = (String) map.get(ExamCloudDataEnum.NAME.getName()); //名称
|
|
|
- String paperType = (String) map.get(ExamCloudDataEnum.PAPER_TYPE.getName()); //试卷类型
|
|
|
+ String subjectCode = String.valueOf(map.get(ExamCloudDataEnum.SUBJECT_CODE.getName())); //科目代码
|
|
|
+ String subjectName = String.valueOf(map.get(ExamCloudDataEnum.SUBJECT_NAME.getName())); //科目名称
|
|
|
+ String examNumber = String.valueOf(map.get(ExamCloudDataEnum.EXAM_NUMBER.getName())); //准考证号
|
|
|
+ String studentCode = String.valueOf(map.get(ExamCloudDataEnum.STUDENT_CODE.getName())); //学号
|
|
|
+ String name = String.valueOf(map.get(ExamCloudDataEnum.NAME.getName())); //名称
|
|
|
+ String paperType = String.valueOf(map.get(ExamCloudDataEnum.PAPER_TYPE.getName())); //试卷类型
|
|
|
+ // 循环依次为#生成(分配)试卷编号为A、B、C......A、B、C......
|
|
|
if (count > 0 && paperType.equals(specialPaperType)) {
|
|
|
paperType = paperTypeList.get(i);
|
|
|
i++;
|
|
@@ -559,37 +629,46 @@ public class BasicDatasourceController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String college = (String) map.get(ExamCloudDataEnum.COLLEGE.getName()); //学院
|
|
|
- String className = (String) map.get(ExamCloudDataEnum.CLASS_NAME.getName()); //班级名称
|
|
|
- String teacher = (String) map.get(ExamCloudDataEnum.TEACHER.getName()); //教师
|
|
|
+ String college = String.valueOf(map.get(ExamCloudDataEnum.COLLEGE.getName())); //学院
|
|
|
+ String className = String.valueOf(map.get(ExamCloudDataEnum.CLASS_NAME.getName())); //班级名称
|
|
|
+ String teacher = String.valueOf(map.get(ExamCloudDataEnum.TEACHER.getName())); //教师
|
|
|
+ Map<String, String> teacherMap = this.disposeTeacherInfo(teacher);
|
|
|
+ String teacherName = teacherMap.get("teacherName");
|
|
|
+ String teacherCode = teacherMap.get("teacherCode");
|
|
|
+ // 缺考状态 2 -> 缺考 ; 3 -> 违纪
|
|
|
int status = (int) map.get(ExamCloudDataEnum.STATUS.getName()); //学生考试状态
|
|
|
- String totalScore = (String) map.get(ExamCloudDataEnum.TOTAL_SCORE.getName()); //考生总分
|
|
|
- String objectiveScore = (String) map.get(ExamCloudDataEnum.OBJECTIVE_SCORE.getName()); //客观题总分
|
|
|
- String subjectiveScore = (String) map.get(ExamCloudDataEnum.SUBJECTIVE_SCORE.getName()); //主观题总分
|
|
|
+ String totalScore = String.valueOf(map.get(ExamCloudDataEnum.TOTAL_SCORE.getName())); //考生总分
|
|
|
+ String objectiveScore = String.valueOf(map.get(ExamCloudDataEnum.OBJECTIVE_SCORE.getName())); //客观题总分
|
|
|
+ String subjectiveScore = String.valueOf(map.get(ExamCloudDataEnum.SUBJECTIVE_SCORE.getName())); //主观题总分
|
|
|
List<Map<Object, Object>> objectiveScoreDetailList = (List<Map<Object, Object>>) map.get(ExamCloudDataEnum.OBJECTIVE_SCORE_DETAIL.getName()); //客观题明细
|
|
|
List<Map<Object, Object>> subjectiveScoreDetailList = (List<Map<Object, Object>>) map.get(ExamCloudDataEnum.SUBJECTIVE_SCORE_DETAIL.getName()); //主观题答题明细
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/*
|
|
|
组建学生基础信息 student
|
|
|
*/
|
|
|
- TBStudent studentTemp = tbStudentService.getOne(new QueryWrapper<TBStudent>().lambda()
|
|
|
- .eq(TBStudent::getSchoolId, schoolId)
|
|
|
- .eq(TBStudent::getName, name)
|
|
|
- .eq(TBStudent::getStudentCode, studentCode));
|
|
|
- Long studentId;
|
|
|
- if (Objects.nonNull(studentTemp)) {
|
|
|
- studentId = studentTemp.getId();
|
|
|
+ if (checkMap.containsKey(studentCode)) {
|
|
|
+ if (!checkMap.get(studentCode).getName().equals(name)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("有学号【" + studentCode + "】的学生名称不统一");
|
|
|
+ }
|
|
|
} else {
|
|
|
- studentId = SystemConstant.getDbUuid();
|
|
|
+ TBStudent studentTemp = tbStudentService.getOne(new QueryWrapper<TBStudent>().lambda()
|
|
|
+ .eq(TBStudent::getSchoolId, schoolId)
|
|
|
+ .eq(TBStudent::getStudentCode, studentCode));
|
|
|
+ Long studentId;
|
|
|
+ if (Objects.nonNull(studentTemp)) {
|
|
|
+ studentId = studentTemp.getId();
|
|
|
+ } else {
|
|
|
+ studentId = SystemConstant.getDbUuid();
|
|
|
+ }
|
|
|
+ TBStudent tbStudent = new TBStudent();
|
|
|
+ tbStudent.setId(studentId);
|
|
|
+ tbStudent.setSchoolId(schoolId);
|
|
|
+ tbStudent.setName(name);
|
|
|
+ tbStudent.setStudentCode(studentCode);
|
|
|
+ checkMap.put(studentCode, tbStudent);
|
|
|
+ tbStudentList.add(tbStudent);
|
|
|
}
|
|
|
- TBStudent tbStudent = new TBStudent();
|
|
|
- tbStudent.setId(studentId);
|
|
|
- tbStudent.setSchoolId(schoolId);
|
|
|
- tbStudent.setName(name);
|
|
|
- tbStudent.setStudentCode(studentCode);
|
|
|
- tbStudentList.add(tbStudent);
|
|
|
+
|
|
|
|
|
|
/*
|
|
|
组建考生考试信息 exm_pap_tik
|
|
@@ -616,7 +695,7 @@ public class BasicDatasourceController {
|
|
|
// 获取关联的基础表主键
|
|
|
SysOrg tbSchoolCollege = sysOrgService.findByForeignKey(schoolId, college, college);
|
|
|
TBSchoolClazz tbSchoolClazz = tbSchoolClazzService.findByForeignKey(schoolId, className, className);
|
|
|
- SysUser tbSchoolTeacher = sysUserService.findByForeignKey(schoolId, teacher);
|
|
|
+ SysUser tbSchoolTeacher = sysUserService.findByForeignKey(schoolId, teacherName);
|
|
|
|
|
|
TBExamStudent tbExamStudent = new TBExamStudent();
|
|
|
Long examStudentId = SystemConstant.getDbUuid();
|
|
@@ -624,7 +703,7 @@ public class BasicDatasourceController {
|
|
|
tbExamStudent.setSchoolId(tbExamService.getById(examId).getSchoolId());
|
|
|
tbExamStudent.setExamId(examId);
|
|
|
tbExamStudent.setName(name);
|
|
|
- tbExamStudent.setStudentId(studentId);
|
|
|
+ tbExamStudent.setStudentId(checkMap.get(studentCode).getId());
|
|
|
tbExamStudent.setStudentCode(studentCode);
|
|
|
tbExamStudent.setCourseCode(courseCode);
|
|
|
tbExamStudent.setCourseName(courseName);
|
|
@@ -632,13 +711,13 @@ public class BasicDatasourceController {
|
|
|
tbExamStudent.setInspectCollegeId(tbSchoolCollege.getId());
|
|
|
tbExamStudent.setClazzId(tbSchoolClazz.getId());
|
|
|
tbExamStudent.setMajorId(0L);
|
|
|
- if (Objects.nonNull(tbSchoolTeacher)){
|
|
|
+ if (Objects.nonNull(tbSchoolTeacher)) {
|
|
|
tbExamStudent.setTeacherId(tbSchoolTeacher.getId());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
tbExamStudent.setTeacherId(0L);
|
|
|
}
|
|
|
tbExamStudent.setTicketNumber(examNumber);
|
|
|
- tbExamStudent.setAbsent(status == 2);
|
|
|
+ tbExamStudent.setAbsent(status == 2 || status == 3);
|
|
|
// 全部设置为本届
|
|
|
tbExamStudent.setStudentCurrent(true);
|
|
|
tbExamStudentList.add(tbExamStudent);
|
|
@@ -658,36 +737,38 @@ public class BasicDatasourceController {
|
|
|
tbExamRecordList.add(tbExamRecord);
|
|
|
|
|
|
// TODO: 2021/6/4 构建考生-详细作答记录表(全批次删除并新增)
|
|
|
- // 构建考生作答明细表(t_b_answer)
|
|
|
+ // 构建考生作答明细表(t_b_answer)正常考生才记录
|
|
|
// 客观题(选择)
|
|
|
- for (Map<Object, Object> objectObjectMap : objectiveScoreDetailList) {
|
|
|
- Long answerId = SystemConstant.getDbUuid();
|
|
|
- TBAnswer tbAnswer = new TBAnswer();
|
|
|
- tbAnswer.setId(answerId);
|
|
|
- tbAnswer.setExamRecordId(examRecordId);
|
|
|
- tbAnswer.setNumberType(NumberTypeEnum.OBJECTIVE.getValue());
|
|
|
- String cloudMainNumber = String.valueOf(objectObjectMap.get(ExamCloudDataEnum.MAIN_NUMBER.getName()));
|
|
|
- String cloudSubNumber = String.valueOf(objectObjectMap.get(ExamCloudDataEnum.SUB_NUMBER.getName()));
|
|
|
- tbAnswer.setMainNumber(cloudMainNumber);
|
|
|
- tbAnswer.setSubNumber(cloudSubNumber);
|
|
|
- tbAnswer.setScore(BigDecimal.valueOf(Double.parseDouble(String.valueOf(objectObjectMap.get(ExamCloudDataEnum.SCORE.getName())))));
|
|
|
- tbAnswer.setAnswer(String.valueOf(objectObjectMap.get(ExamCloudDataEnum.ANSWER.getName())));
|
|
|
- tbAnswerList.add(tbAnswer);
|
|
|
- }
|
|
|
- // 主观题
|
|
|
- for (Map<Object, Object> objectObjectMap : subjectiveScoreDetailList) {
|
|
|
- Long answerId = SystemConstant.getDbUuid();
|
|
|
- TBAnswer tbAnswer = new TBAnswer();
|
|
|
- tbAnswer.setId(answerId);
|
|
|
- tbAnswer.setExamRecordId(examRecordId);
|
|
|
- tbAnswer.setNumberType(NumberTypeEnum.SUBJECTIVE.getValue());
|
|
|
- String cloudMainNumber = String.valueOf(objectObjectMap.get(ExamCloudDataEnum.MAIN_NUMBER.getName()));
|
|
|
- String cloudSubNumber = String.valueOf(objectObjectMap.get(ExamCloudDataEnum.SUB_NUMBER.getName()));
|
|
|
- tbAnswer.setMainNumber(cloudMainNumber);
|
|
|
- tbAnswer.setSubNumber(cloudSubNumber);
|
|
|
- tbAnswer.setScore(BigDecimal.valueOf(Double.parseDouble(String.valueOf(objectObjectMap.get(ExamCloudDataEnum.SCORE.getName())))));
|
|
|
- tbAnswer.setAnswer(String.valueOf(objectObjectMap.get(ExamCloudDataEnum.ANSWER.getName())));
|
|
|
- tbAnswerList.add(tbAnswer);
|
|
|
+ if (status == 1) {
|
|
|
+ for (Map<Object, Object> objectObjectMap : objectiveScoreDetailList) {
|
|
|
+ Long answerId = SystemConstant.getDbUuid();
|
|
|
+ TBAnswer tbAnswer = new TBAnswer();
|
|
|
+ tbAnswer.setId(answerId);
|
|
|
+ tbAnswer.setExamRecordId(examRecordId);
|
|
|
+ tbAnswer.setNumberType(NumberTypeEnum.OBJECTIVE.getValue());
|
|
|
+ String cloudMainNumber = String.valueOf(objectObjectMap.get(ExamCloudDataEnum.MAIN_NUMBER.getName()));
|
|
|
+ String cloudSubNumber = String.valueOf(objectObjectMap.get(ExamCloudDataEnum.SUB_NUMBER.getName()));
|
|
|
+ tbAnswer.setMainNumber(cloudMainNumber);
|
|
|
+ tbAnswer.setSubNumber(cloudSubNumber);
|
|
|
+ tbAnswer.setScore(BigDecimal.valueOf(Double.parseDouble(String.valueOf(objectObjectMap.get(ExamCloudDataEnum.SCORE.getName())))));
|
|
|
+ tbAnswer.setAnswer(String.valueOf(objectObjectMap.get(ExamCloudDataEnum.ANSWER.getName())));
|
|
|
+ tbAnswerList.add(tbAnswer);
|
|
|
+ }
|
|
|
+ // 主观题
|
|
|
+ for (Map<Object, Object> objectObjectMap : subjectiveScoreDetailList) {
|
|
|
+ Long answerId = SystemConstant.getDbUuid();
|
|
|
+ TBAnswer tbAnswer = new TBAnswer();
|
|
|
+ tbAnswer.setId(answerId);
|
|
|
+ tbAnswer.setExamRecordId(examRecordId);
|
|
|
+ tbAnswer.setNumberType(NumberTypeEnum.SUBJECTIVE.getValue());
|
|
|
+ String cloudMainNumber = String.valueOf(objectObjectMap.get(ExamCloudDataEnum.MAIN_NUMBER.getName()));
|
|
|
+ String cloudSubNumber = String.valueOf(objectObjectMap.get(ExamCloudDataEnum.SUB_NUMBER.getName()));
|
|
|
+ tbAnswer.setMainNumber(cloudMainNumber);
|
|
|
+ tbAnswer.setSubNumber(cloudSubNumber);
|
|
|
+ tbAnswer.setScore(BigDecimal.valueOf(Double.parseDouble(String.valueOf(objectObjectMap.get(ExamCloudDataEnum.SCORE.getName())))));
|
|
|
+ tbAnswer.setAnswer(String.valueOf(objectObjectMap.get(ExamCloudDataEnum.ANSWER.getName())));
|
|
|
+ tbAnswerList.add(tbAnswer);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -700,7 +781,7 @@ public class BasicDatasourceController {
|
|
|
Set<Long> examStudentRemoveIdSet = new HashSet<>();
|
|
|
for (String s : courseInfoList) {
|
|
|
Set<Long> ids = tbExamStudentService.list(new QueryWrapper<TBExamStudent>().lambda()
|
|
|
- .eq(TBExamStudent::getCourseCode, s))
|
|
|
+ .eq(TBExamStudent::getCourseCode, s))
|
|
|
.stream().map(TBExamStudent::getId).collect(Collectors.toSet());
|
|
|
examStudentRemoveIdSet.addAll(ids);
|
|
|
}
|
|
@@ -730,7 +811,7 @@ public class BasicDatasourceController {
|
|
|
@RequestMapping(value = "/normal/assignScore", method = RequestMethod.POST)
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
- public Result normalAssignScore(@RequestParam Long examId, @RequestParam Long schoolId, @RequestParam String courseCode) throws IOException, NoSuchFieldException {
|
|
|
+ public Result normalAssignScore(@RequestParam Long examId, @RequestParam Long schoolId, @RequestParam String courseCode) {
|
|
|
analyzeForReportService.normalAssignScore(examId, schoolId, courseCode);
|
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
|
}
|
|
@@ -748,7 +829,7 @@ public class BasicDatasourceController {
|
|
|
List<BasicExamRecordDto> basicExamRecordDtoDatasource = tbExamRecordService.findByExamIdAndCourseCodeS(examId, courseCodeList);
|
|
|
Set<TAExamCourseRecord> taExamCourseRecordDatasource = new HashSet<>();
|
|
|
for (String s : courseCodeList) {
|
|
|
- if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, s, basicCourseService.findByCourseCode(s).getName())) {
|
|
|
+ if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, s, basicCourseService.findByCourseCode(s, schoolId).getName())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("课程编号[" + s + "]的课程分析数据已测试或发布,不能变更基础数据");
|
|
|
}
|
|
|
List<BasicExamRecordDto> basicExamRecordDtoList = basicExamRecordDtoDatasource.stream()
|
|
@@ -760,7 +841,7 @@ public class BasicDatasourceController {
|
|
|
// 迁移数据至't_a_exam_course_record'
|
|
|
List<TAExamCourseRecord> taExamCourseRecordList = new ArrayList<>();
|
|
|
for (BasicExamRecordDto basicExamRecordDto : basicExamRecordDtoList) {
|
|
|
- if (basicExamRecordDto.getStudentCode().equals("2020303041027")){
|
|
|
+ if (basicExamRecordDto.getStudentCode().equals("2020303041027")) {
|
|
|
System.out.println("进入");
|
|
|
}
|
|
|
// 正常公式赋分操作
|
|
@@ -774,7 +855,7 @@ public class BasicDatasourceController {
|
|
|
BigDecimal coefficient = tbPaper.getCoefficient();
|
|
|
BigDecimal assignScore;
|
|
|
if (coefficient != null && coefficient.compareTo(BigDecimal.ZERO) > 0 && !basicExamRecordDto.getAbsent()) {
|
|
|
- assignScore = myScore.add(fullScore.subtract(myScore).divide(coefficient, 4, BigDecimal.ROUND_HALF_UP)).setScale(0,BigDecimal.ROUND_HALF_UP);
|
|
|
+ assignScore = myScore.add(fullScore.subtract(myScore).divide(coefficient, 4, RoundingMode.HALF_UP)).setScale(0, RoundingMode.HALF_UP);
|
|
|
} else {
|
|
|
assignScore = myScore;
|
|
|
}
|
|
@@ -834,7 +915,7 @@ public class BasicDatasourceController {
|
|
|
.filter(e -> assExamId.equals(e.getExamId()) && s.equals(e.getCourseCode()) && assStudentCode.equals(e.getStudentCode()))
|
|
|
.collect(Collectors.toList());
|
|
|
if (taExamCourseRecordList.size() != 1) {
|
|
|
- if (taExamCourseRecordList.size() < 1){
|
|
|
+ if (taExamCourseRecordList.size() < 1) {
|
|
|
continue;
|
|
|
}
|
|
|
System.out.println("-----------------------");
|
|
@@ -858,7 +939,7 @@ public class BasicDatasourceController {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
public Result configImport(@RequestParam Long schoolId, @RequestParam Long examId, @RequestParam String courseCode) {
|
|
|
- String courseName = basicCourseService.findByCourseCode(courseCode).getName();
|
|
|
+ String courseName = basicCourseService.findByCourseCode(courseCode, schoolId).getName();
|
|
|
if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, courseCode, courseName)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("课程编号[" + courseCode + "]的课程分析数据已测试或发布,不能变更基础数据");
|
|
|
}
|
|
@@ -871,12 +952,12 @@ public class BasicDatasourceController {
|
|
|
@RequestMapping(value = "/course/create", method = RequestMethod.POST)
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
- public Result courseCreate(@RequestParam Long schoolId, @RequestParam String examId, @RequestParam String courseCode,@RequestParam String courseName,@RequestParam(required = false) String examinationCourseCode,@RequestParam(required = false) String teachCollegeName) {
|
|
|
- if ((!SystemConstant.strNotNull(examinationCourseCode) && !SystemConstant.strNotNull(teachCollegeName)) || (SystemConstant.strNotNull(examinationCourseCode) && SystemConstant.strNotNull(teachCollegeName))){
|
|
|
+ public Result courseCreate(@RequestParam Long schoolId, @RequestParam String examId, @RequestParam String courseCode, @RequestParam String courseName, @RequestParam(required = false) String examinationCourseCode, @RequestParam(required = false) String teachCollegeName) {
|
|
|
+ if ((!SystemConstant.strNotNull(examinationCourseCode) && !SystemConstant.strNotNull(teachCollegeName)) || (SystemConstant.strNotNull(examinationCourseCode) && SystemConstant.strNotNull(teachCollegeName))) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("参数异常 : 考务课程编号和课程授课学院不能全不传或全传");
|
|
|
}
|
|
|
- basicCourseService.createCourse(schoolId,courseCode,courseName);
|
|
|
- tbExamCourseService.createCourse(schoolId,SystemConstant.convertIdToLong(examId),courseCode,courseName,examinationCourseCode,teachCollegeName);
|
|
|
+ basicCourseService.createCourse(schoolId, courseCode, courseName);
|
|
|
+ tbExamCourseService.createCourse(schoolId, SystemConstant.convertIdToLong(examId), courseCode, courseName, examinationCourseCode, teachCollegeName);
|
|
|
|
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
|
}
|
|
@@ -885,7 +966,7 @@ public class BasicDatasourceController {
|
|
|
@RequestMapping(value = "/examination/sync", method = RequestMethod.POST)
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
- public Result examinationSync(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,@RequestParam Long schoolId, @RequestParam String examId) throws IOException, NoSuchFieldException {
|
|
|
+ public Result examinationSync(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @RequestParam Long schoolId, @RequestParam String examId) throws IOException, NoSuchFieldException {
|
|
|
if (Objects.isNull(file)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("附件不存在");
|
|
|
}
|
|
@@ -932,7 +1013,9 @@ public class BasicDatasourceController {
|
|
|
tbExamination.setTeacherCode(teacherCode);
|
|
|
tbExamination.setTeacherName(teacherName);
|
|
|
tbExamination.setTeachCollegeName(teachCollegeName);
|
|
|
- tbExamination.setCredit(credit);
|
|
|
+ if (SystemConstant.strNotNull(credit)) {
|
|
|
+ tbExamination.setCredit(credit);
|
|
|
+ }
|
|
|
tbExamination.setStudentCode(studentCode);
|
|
|
tbExamination.setStudentName(studentName);
|
|
|
tbExamination.setInspectCollegeName(inspectCollegeName);
|
|
@@ -944,15 +1027,15 @@ public class BasicDatasourceController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<Map<String,Object>> tbExaminationRelationMapList = tbExaminationList.stream().flatMap(e -> {
|
|
|
+ List<Map<String, Object>> tbExaminationRelationMapList = tbExaminationList.stream().flatMap(e -> {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("schoolId",e.getSchoolId());
|
|
|
- map.put("examId",e.getExamId());
|
|
|
- map.put("examinationCourseCode",e.getExaminationCourseCode());
|
|
|
- map.put("courseName",e.getCourseName());
|
|
|
- map.put("teachCollegeName",e.getTeachCollegeName());
|
|
|
- map.put("teacherCode",e.getTeacherCode());
|
|
|
- map.put("teacherName",e.getTeacherName());
|
|
|
+ map.put("schoolId", e.getSchoolId());
|
|
|
+ map.put("examId", e.getExamId());
|
|
|
+ map.put("examinationCourseCode", e.getExaminationCourseCode());
|
|
|
+ map.put("courseName", e.getCourseName());
|
|
|
+ map.put("teachCollegeName", e.getTeachCollegeName());
|
|
|
+ map.put("teacherCode", e.getTeacherCode());
|
|
|
+ map.put("teacherName", e.getTeacherName());
|
|
|
return Stream.of(map);
|
|
|
}).distinct().collect(Collectors.toList());
|
|
|
|
|
@@ -970,8 +1053,8 @@ public class BasicDatasourceController {
|
|
|
tbExaminationRelationList.add(tbExaminationRelation);
|
|
|
}
|
|
|
|
|
|
- tbExaminationService.remove(new QueryWrapper<TBExamination>().lambda().eq(TBExamination::getExamId,examId));
|
|
|
- tbExaminationRelationService.remove(new QueryWrapper<TBExaminationRelation>().lambda().eq(TBExaminationRelation::getExamId,examId));
|
|
|
+ tbExaminationService.remove(new QueryWrapper<TBExamination>().lambda().eq(TBExamination::getExamId, examId));
|
|
|
+ tbExaminationRelationService.remove(new QueryWrapper<TBExaminationRelation>().lambda().eq(TBExaminationRelation::getExamId, examId));
|
|
|
|
|
|
tbExaminationService.saveBatch(tbExaminationList);
|
|
|
tbExaminationRelationService.saveBatch(tbExaminationRelationList);
|
|
@@ -983,20 +1066,20 @@ public class BasicDatasourceController {
|
|
|
@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();
|
|
|
+ String courseName = basicCourseService.findByCourseCode(courseCode, SystemConstant.convertIdToLong(schoolId)).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))
|
|
|
+ .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,"普通"));
|
|
|
+ .eq(TBExamination::getCourseName, courseName)
|
|
|
+ .ne(TBExamination::getStudyType, "普通"));
|
|
|
int count = tbExaminationList.size();
|
|
|
if (count > 0) {
|
|
|
List<TBExamStudent> tbExamStudentList = tbExamStudentService.list(new QueryWrapper<TBExamStudent>().lambda()
|
|
@@ -1017,7 +1100,68 @@ public class BasicDatasourceController {
|
|
|
}
|
|
|
tbExamStudentService.saveOrUpdateBatch(willUpdate);
|
|
|
}
|
|
|
- return ResultUtil.ok("有【" + count + "】条缺考学生数据被更新");
|
|
|
+ return ResultUtil.ok("有【" + count + "】条非应届学生数据被更新");
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "异常考生-按学号处理")
|
|
|
+ @RequestMapping(value = "/exception_student/dispose_by_student_code", method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ public Result exceptionStudentDisposeByStudentCode(@RequestParam String schoolId, @RequestParam String examId, @RequestParam List<String> courseCodeList, @RequestParam String year) {
|
|
|
+ for (String courseCode : courseCodeList) {
|
|
|
+ TBExamCourse tbExamCourse = tbExamCourseService.getOne(new QueryWrapper<TBExamCourse>().lambda()
|
|
|
+ .eq(TBExamCourse::getExamId, examId)
|
|
|
+ .eq(TBExamCourse::getSchoolId, schoolId)
|
|
|
+ .eq(TBExamCourse::getCourseCode, courseCode));
|
|
|
+ if (tbExamCourse.getPublishStatus().equals(PublishStatusEnum.PUBLISH)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("已经发布的课程【" + tbExamCourse.getCourseName() + "】不能进行特殊处理");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 更改 ‘t_b_exam_student’表考生应届状态
|
|
|
+ List<TBExamStudent> tbExamStudentList = tbExamStudentService.list(new QueryWrapper<TBExamStudent>().lambda()
|
|
|
+ .eq(TBExamStudent::getSchoolId, schoolId)
|
|
|
+ .eq(TBExamStudent::getExamId, examId)
|
|
|
+ .in(TBExamStudent::getCourseCode, courseCodeList));
|
|
|
+ // 全部改为应届
|
|
|
+ for (TBExamStudent tbExamStudent : tbExamStudentList) {
|
|
|
+ tbExamStudent.setStudentCurrent(true);
|
|
|
+ }
|
|
|
+ tbExamStudentService.updateBatchById(tbExamStudentList);
|
|
|
+ // 非应届考生
|
|
|
+ tbExamStudentList = tbExamStudentList.stream()
|
|
|
+ .filter(e -> !e.getStudentCode().substring(0, 4).equals(year))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 更改 ‘t_a_exam_course_record’表考生应届状态
|
|
|
+ List<TAExamCourseRecord> taExamCourseRecordList = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
+ .eq(TAExamCourseRecord::getSchoolId, schoolId)
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId)
|
|
|
+ .in(TAExamCourseRecord::getCourseCode, courseCodeList));
|
|
|
+ // 全部改为应届
|
|
|
+ for (TAExamCourseRecord taExamCourseRecord : taExamCourseRecordList) {
|
|
|
+ taExamCourseRecord.setStudentCurrent(true);
|
|
|
+ }
|
|
|
+ taExamCourseRecordService.updateBatchById(taExamCourseRecordList);
|
|
|
+
|
|
|
+ // 非应届考生记录
|
|
|
+ taExamCourseRecordList = taExamCourseRecordList.stream()
|
|
|
+ .filter(e -> !e.getStudentCode().substring(0, 4).equals(year))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (tbExamStudentList.size() > 0) {
|
|
|
+ for (TBExamStudent tbExamStudent : tbExamStudentList) {
|
|
|
+ tbExamStudent.setStudentCurrent(false);
|
|
|
+ }
|
|
|
+ tbExamStudentService.updateBatchById(tbExamStudentList);
|
|
|
+
|
|
|
+ if (tbExamStudentList.size() == taExamCourseRecordList.size()) {
|
|
|
+ for (TAExamCourseRecord taExamCourseRecord : taExamCourseRecordList) {
|
|
|
+ taExamCourseRecord.setStudentCurrent(false);
|
|
|
+ }
|
|
|
+ taExamCourseRecordService.updateBatchById(taExamCourseRecordList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultUtil.ok("有【" + tbExamStudentList.size() + "】条非应届学生数据被更新");
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "特殊科目合并题目处理")
|
|
@@ -1035,18 +1179,18 @@ public class BasicDatasourceController {
|
|
|
String comMain = combineDto.getComMain();
|
|
|
String comSub = combineDto.getComSub();
|
|
|
// TODO: 2021/6/25 合题的检验
|
|
|
- TBPaper tbPaper = tbPaperService.getOne(new QueryWrapper<TBPaper>().lambda().eq(TBPaper::getExamId,examId).eq(TBPaper::getCourseCode,courseCode));
|
|
|
+ TBPaper tbPaper = tbPaperService.getOne(new QueryWrapper<TBPaper>().lambda().eq(TBPaper::getExamId, examId).eq(TBPaper::getCourseCode, courseCode));
|
|
|
Long paperId = tbPaper.getId();
|
|
|
- List<TBExamRecord> tbExamRecordList = tbExamRecordService.list(new QueryWrapper<TBExamRecord>().lambda().eq(TBExamRecord::getExamId,examId).eq(TBExamRecord::getPaperId,paperId));
|
|
|
+ List<TBExamRecord> tbExamRecordList = tbExamRecordService.list(new QueryWrapper<TBExamRecord>().lambda().eq(TBExamRecord::getExamId, examId).eq(TBExamRecord::getPaperId, paperId));
|
|
|
List<Long> examRecordIdList = tbExamRecordList.stream().map(TBExamRecord::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
- List<TBAnswer> tbAnswerList = tbAnswerService.list(new QueryWrapper<TBAnswer>().lambda().in(TBAnswer::getExamRecordId,examRecordIdList));
|
|
|
+ List<TBAnswer> tbAnswerList = tbAnswerService.list(new QueryWrapper<TBAnswer>().lambda().in(TBAnswer::getExamRecordId, examRecordIdList));
|
|
|
|
|
|
List<Long> willDeleteList = new ArrayList<>();
|
|
|
List<TBAnswer> willInsertList = new ArrayList<>();
|
|
|
for (Long examRecordId : examRecordIdList) {
|
|
|
List<TBAnswer> oneStudentAnswerList = tbAnswerList.stream().filter(e -> e.getExamRecordId().equals(examRecordId)).collect(Collectors.toList());
|
|
|
- if (oneStudentAnswerList.size() == 0){
|
|
|
+ if (oneStudentAnswerList.size() == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
// 原始1题
|
|
@@ -1063,7 +1207,7 @@ public class BasicDatasourceController {
|
|
|
|
|
|
Long org2Id = org2.getId();
|
|
|
BigDecimal org2Score = org2.getScore();
|
|
|
- if (!org1.getNumberType().equals(org2.getNumberType())){
|
|
|
+ if (!org1.getNumberType().equals(org2.getNumberType())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("题目类型不一致 合题失败");
|
|
|
}
|
|
|
|
|
@@ -1090,20 +1234,20 @@ public class BasicDatasourceController {
|
|
|
@RequestMapping(value = "/exception_answer/score_dispose", method = RequestMethod.POST)
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
- public Result exceptionAnswerScoreDispose(@RequestParam Long schoolId, @RequestParam String examId, @RequestParam String courseCode,@RequestParam String numberType,@RequestParam String mainNumber,@RequestParam String subNumber,@RequestParam String answer,@RequestParam BigDecimal score) {
|
|
|
+ public Result exceptionAnswerScoreDispose(@RequestParam Long schoolId, @RequestParam String examId, @RequestParam String courseCode, @RequestParam String numberType, @RequestParam String mainNumber, @RequestParam String subNumber, @RequestParam String answer, @RequestParam BigDecimal score) {
|
|
|
|
|
|
- TBPaper tbPaper = tbPaperService.getOne(new QueryWrapper<TBPaper>().lambda().eq(TBPaper::getCourseCode,courseCode).eq(TBPaper::getExamId,examId));
|
|
|
+ TBPaper tbPaper = tbPaperService.getOne(new QueryWrapper<TBPaper>().lambda().eq(TBPaper::getCourseCode, courseCode).eq(TBPaper::getExamId, examId));
|
|
|
Long paperId = tbPaper.getId();
|
|
|
- List<TBExamRecord> tbExamRecordList = tbExamRecordService.list(new QueryWrapper<TBExamRecord>().lambda().eq(TBExamRecord::getExamId,examId).eq(TBExamRecord::getPaperId,paperId));
|
|
|
+ List<TBExamRecord> tbExamRecordList = tbExamRecordService.list(new QueryWrapper<TBExamRecord>().lambda().eq(TBExamRecord::getExamId, examId).eq(TBExamRecord::getPaperId, paperId));
|
|
|
List<Long> examRecordIdList = tbExamRecordList.stream().map(TBExamRecord::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
// 要改分的作答记录
|
|
|
List<TBAnswer> tbAnswerList = tbAnswerService.list(new QueryWrapper<TBAnswer>().lambda()
|
|
|
- .in(TBAnswer::getExamRecordId,examRecordIdList)
|
|
|
- .eq(TBAnswer::getNumberType,numberType)
|
|
|
- .eq(TBAnswer::getMainNumber,mainNumber)
|
|
|
- .eq(TBAnswer::getSubNumber,subNumber)
|
|
|
- .eq(TBAnswer::getAnswer,answer));
|
|
|
+ .in(TBAnswer::getExamRecordId, examRecordIdList)
|
|
|
+ .eq(TBAnswer::getNumberType, numberType)
|
|
|
+ .eq(TBAnswer::getMainNumber, mainNumber)
|
|
|
+ .eq(TBAnswer::getSubNumber, subNumber)
|
|
|
+ .eq(TBAnswer::getAnswer, answer));
|
|
|
|
|
|
List<TBExamRecord> willUpdateRecordList = new ArrayList<>();
|
|
|
for (TBAnswer tbAnswer : tbAnswerList) {
|
|
@@ -1115,15 +1259,15 @@ public class BasicDatasourceController {
|
|
|
// 对该考生 总体考试成绩的得分修改
|
|
|
TBExamRecord tbExamRecord = tbExamRecordList.stream().filter(e -> e.getId().equals(tbAnswer.getExamRecordId())).collect(Collectors.toList()).get(0);
|
|
|
BigDecimal totalScore = tbExamRecord.getTotalScore();
|
|
|
- if (numberType.equals("客观题")){
|
|
|
+ if (numberType.equals("客观题")) {
|
|
|
BigDecimal objectiveScore = tbExamRecord.getObjectiveScore();
|
|
|
objectiveScore = objectiveScore.add(scoreGap);
|
|
|
tbExamRecord.setObjectiveScore(objectiveScore);
|
|
|
- }else if (numberType.equals("主观题")){
|
|
|
+ } else if (numberType.equals("主观题")) {
|
|
|
BigDecimal subjectiveScore = tbExamRecord.getSubjectiveScore();
|
|
|
subjectiveScore = subjectiveScore.add(scoreGap);
|
|
|
tbExamRecord.setSubjectiveScore(subjectiveScore);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
throw ExceptionResultEnum.ERROR.exception("题目类型有误");
|
|
|
}
|
|
|
totalScore = totalScore.add(scoreGap);
|
|
@@ -1135,16 +1279,16 @@ public class BasicDatasourceController {
|
|
|
tbExamRecordService.updateBatchById(willUpdateRecordList);
|
|
|
|
|
|
// 成绩核对
|
|
|
- List<TBExamRecord> verifyExamRecordList = tbExamRecordService.list(new QueryWrapper<TBExamRecord>().lambda().eq(TBExamRecord::getExamId,examId).eq(TBExamRecord::getPaperId,paperId));
|
|
|
+ List<TBExamRecord> verifyExamRecordList = tbExamRecordService.list(new QueryWrapper<TBExamRecord>().lambda().eq(TBExamRecord::getExamId, examId).eq(TBExamRecord::getPaperId, paperId));
|
|
|
for (TBExamRecord verifyRecord : verifyExamRecordList) {
|
|
|
BigDecimal totalScore = verifyRecord.getTotalScore();
|
|
|
Long examRecordId = verifyRecord.getId();
|
|
|
- List<TBAnswer> oneStudentAnswer = tbAnswerService.list(new QueryWrapper<TBAnswer>().lambda().eq(TBAnswer::getExamRecordId,examRecordId));
|
|
|
- if (oneStudentAnswer.size() == 0 && totalScore.compareTo(BigDecimal.ZERO) != 0){
|
|
|
+ List<TBAnswer> oneStudentAnswer = tbAnswerService.list(new QueryWrapper<TBAnswer>().lambda().eq(TBAnswer::getExamRecordId, examRecordId));
|
|
|
+ if (oneStudentAnswer.size() == 0 && totalScore.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("计算数据异常");
|
|
|
} else {
|
|
|
double scoreSum = oneStudentAnswer.stream().collect(Collectors.summarizingDouble(e -> e.getScore().doubleValue())).getSum();
|
|
|
- if (totalScore.compareTo(BigDecimal.valueOf(scoreSum)) != 0){
|
|
|
+ if (totalScore.compareTo(BigDecimal.valueOf(scoreSum)) != 0) {
|
|
|
System.out.println("考试总分 : " + totalScore + ",作答总分 : " + scoreSum);
|
|
|
throw ExceptionResultEnum.ERROR.exception("考试总分和作答总分不一致");
|
|
|
}
|
|
@@ -1160,17 +1304,17 @@ public class BasicDatasourceController {
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
public Result exceptionStudentDispose(@RequestParam String schoolId, @RequestParam String examId, @RequestParam String courseCode) {
|
|
|
|
|
|
- String courseName = basicCourseService.findByCourseCode(courseCode).getName();
|
|
|
+ String courseName = basicCourseService.findByCourseCode(courseCode, SystemConstant.convertIdToLong(schoolId)).getName();
|
|
|
if (tbExamCourseService.verifyExamCourseCantRun(SystemConstant.convertIdToLong(examId), SystemConstant.convertIdToLong(schoolId), courseCode, courseName)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("课程编号[" + courseCode + "]的课程分析数据已测试或发布,不能变更基础数据");
|
|
|
}
|
|
|
// 查找留学生
|
|
|
List<TAExamCourseRecord> taExamCourseRecordList = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
- .eq(TAExamCourseRecord::getCourseCode,courseCode)
|
|
|
- .eq(TAExamCourseRecord::getExamId,examId)
|
|
|
- .eq(TAExamCourseRecord::getTotalScore,0)
|
|
|
- .gt(TAExamCourseRecord::getAssignedScore,0));
|
|
|
- if (taExamCourseRecordList.size() > 0){
|
|
|
+ .eq(TAExamCourseRecord::getCourseCode, courseCode)
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId)
|
|
|
+ .eq(TAExamCourseRecord::getTotalScore, 0)
|
|
|
+ .gt(TAExamCourseRecord::getAssignedScore, 0));
|
|
|
+ if (taExamCourseRecordList.size() > 0) {
|
|
|
List<Long> willDeleteTAExamCourseRecordIds = taExamCourseRecordList.stream().map(TAExamCourseRecord::getId).distinct().collect(Collectors.toList());
|
|
|
List<String> willDeleteStudentCodeList = taExamCourseRecordList.stream().map(TAExamCourseRecord::getStudentCode).distinct().collect(Collectors.toList());
|
|
|
List<Long> willDeleteExamRecordIdList = taExamCourseRecordList.stream().map(TAExamCourseRecord::getExamRecordId).distinct().collect(Collectors.toList());
|
|
@@ -1179,16 +1323,16 @@ public class BasicDatasourceController {
|
|
|
taExamCourseRecordService.removeByIds(willDeleteTAExamCourseRecordIds);
|
|
|
|
|
|
// 删除‘t_b_exam_student’
|
|
|
- if (willDeleteStudentCodeList.size() > 0){
|
|
|
- tbExamStudentService.remove(new QueryWrapper<TBExamStudent>().lambda().eq(TBExamStudent::getExamId,examId).eq(TBExamStudent::getCourseCode,courseCode).in(TBExamStudent::getStudentCode,willDeleteStudentCodeList).gt(TBExamStudent::getId,0));
|
|
|
+ if (willDeleteStudentCodeList.size() > 0) {
|
|
|
+ tbExamStudentService.remove(new QueryWrapper<TBExamStudent>().lambda().eq(TBExamStudent::getExamId, examId).eq(TBExamStudent::getCourseCode, courseCode).in(TBExamStudent::getStudentCode, willDeleteStudentCodeList).gt(TBExamStudent::getId, 0));
|
|
|
}
|
|
|
|
|
|
- if (willDeleteExamRecordIdList.size() > 0){
|
|
|
+ if (willDeleteExamRecordIdList.size() > 0) {
|
|
|
// 删除't_b_exam_record'
|
|
|
tbExamRecordService.removeByIds(willDeleteExamRecordIdList);
|
|
|
|
|
|
// 删除‘t_b_answer’
|
|
|
- tbAnswerService.remove(new QueryWrapper<TBAnswer>().lambda().in(TBAnswer::getExamRecordId,willDeleteExamRecordIdList).gt(TBAnswer::getId,0));
|
|
|
+ tbAnswerService.remove(new QueryWrapper<TBAnswer>().lambda().in(TBAnswer::getExamRecordId, willDeleteExamRecordIdList).gt(TBAnswer::getId, 0));
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1196,7 +1340,137 @@ public class BasicDatasourceController {
|
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "教师用户删除")
|
|
|
+ @RequestMapping(value = "/user_teacher/delete", method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
|
|
|
+ public Result userTeacherDelete(@ApiParam(value = "用户id", required = true) @RequestParam List<String> idList) {
|
|
|
+ if (CollectionUtils.isEmpty(idList)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("请选择要删除的用户");
|
|
|
+ }
|
|
|
+ Set<Long> idSet = idList.stream().map(SystemConstant::convertIdToLong).collect(Collectors.toSet());
|
|
|
+ tbTeacherService.deleteSysUserByIdSet(idSet);
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "基础教师导入")
|
|
|
+ @RequestMapping(value = "/basic_teacher/import", method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
|
|
|
+ public Result basicTeacherImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
|
|
|
+ @ApiParam(value = "学校id", required = true) @RequestParam String schoolId) throws Exception {
|
|
|
+ return ResultUtil.ok(tbTeacherService.importBasicTeacherInfo(file, SystemConstant.convertIdToLong(schoolId)));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "同步基础教师表数据到用户表")
|
|
|
+ @RequestMapping(value = "/sync/teacher", method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
|
|
|
+ public Result syncTeacherInfo(@ApiParam(value = "学校id", required = true) @RequestParam String schoolId) {
|
|
|
+ tbTeacherService.syncTeacherInfoToSysUser(SystemConstant.convertIdToLong(schoolId));
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "特殊科目赋分检查")
|
|
|
+ @RequestMapping(value = "/special/assignCheck", method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
|
|
|
+ public Result assignCheck(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @RequestParam Long examId, @RequestParam Long schoolId,
|
|
|
+ @ApiParam(value = "该Excel中包含多科目赋分时,各科目编号用','隔开", required = true) @RequestParam String courseCodeS) throws IOException, NoSuchFieldException {
|
|
|
+
|
|
|
+ int count = 0;
|
|
|
+ List<AssignCheckDto> result = new ArrayList<>();
|
|
|
+ List<String> courseCodeList = Arrays.asList(courseCodeS.split(","));
|
|
|
+ // 数据同步操作
|
|
|
+ // 获取当前课程下所有学生考试成绩记录
|
|
|
+ List<BasicExamRecordDto> basicExamRecordDtoDatasource = tbExamRecordService.findByExamIdAndCourseCodeS(examId, courseCodeList);
|
|
|
+ Set<TAExamCourseRecord> taExamCourseRecordDatasource = new HashSet<>();
|
|
|
+ for (String s : courseCodeList) {
|
|
|
+ taExamCourseRecordDatasource.addAll(taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>()
|
|
|
+ .lambda().eq(TAExamCourseRecord::getExamId, examId).eq(TAExamCourseRecord::getCourseCode, s)));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(file.getInputStream(), Lists.newArrayList(AssignCheckDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
|
+ if (finalExcelErrorList.size() > 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(finalExcelErrorList));
|
|
|
+ }
|
|
|
+ return finalExcelList;
|
|
|
+ });
|
|
|
+
|
|
|
+ //保存到数据库
|
|
|
+ if (Objects.nonNull(finalList) && finalList.size() > 0) {
|
|
|
+ for (int i = 0; i < finalList.size(); i++) {
|
|
|
+ LinkedMultiValueMap<Integer, Object> map = finalList.get(i);
|
|
|
+ List<Object> assignCheckList = map.get(i);
|
|
|
+ for (int y = 0; y < Objects.requireNonNull(assignCheckList).size(); y++) {
|
|
|
+ if (assignCheckList.get(y) instanceof AssignCheckDto) {
|
|
|
+ AssignCheckDto assignCheckDto = (AssignCheckDto) assignCheckList.get(y);
|
|
|
+ Long assExamId = Long.parseLong(assignCheckDto.getExamId());
|
|
|
+ if (!examId.equals(assExamId)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("excel考试数据异常");
|
|
|
+ }
|
|
|
+ String assCourseCodeS = assignCheckDto.getPaperCodeS();
|
|
|
+ String assStudentCode = assignCheckDto.getStudentCode();
|
|
|
+ String assAssignScore = assignCheckDto.getAssignScore();
|
|
|
+ String assStudentName = assignCheckDto.getStudentName();
|
|
|
+ String[] courseCodeArr = assCourseCodeS.split(",");
|
|
|
+ for (String s : courseCodeArr) {
|
|
|
+ List<TAExamCourseRecord> taExamCourseRecordList = taExamCourseRecordDatasource.stream()
|
|
|
+ .filter(e -> assExamId.equals(e.getExamId()) && s.equals(e.getCourseCode()) && assStudentCode.equals(e.getStudentCode()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (taExamCourseRecordList.size() != 1) {
|
|
|
+ if (taExamCourseRecordList.size() < 1) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ System.out.println("-----------------------");
|
|
|
+ System.out.println(JSON.toJSONString(taExamCourseRecordList));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("赋分异常,考生记录分析表数据异常");
|
|
|
+ }
|
|
|
+ TAExamCourseRecord taExamCourseRecord = taExamCourseRecordList.get(0);
|
|
|
+ TBStudent tbStudent = tbStudentService.getById(taExamCourseRecord.getStudentId());
|
|
|
+ if (!assStudentName.equals(tbStudent.getName())) {
|
|
|
+ result.add(assignCheckDto);
|
|
|
+ } else {
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println(JSON.toJSONString(result));
|
|
|
+
|
|
|
+ return ResultUtil.ok(result.size() == 0 ? count : result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "制作演示数据表")
|
|
|
+ @RequestMapping(value = "/build/demo_table", method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
|
|
|
+ public Result buildDemoTable() throws ExecutionException, InterruptedException {
|
|
|
+ courseUnitOperateService.createDemoData();
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
|
|
|
+ @ApiOperation(value = "将考察学院数据迁移至开课学院")
|
|
|
+ @RequestMapping(value = "/build/migrate_org", method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
|
|
|
+ public Result migrateOrg(@Valid @RequestBody List<CollegeCombineParams> collegeCombineParamsListList, BindingResult bindingResult){
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
+ }
|
|
|
+ Long schoolId = SystemConstant.convertIdToLong(String.valueOf(ServletUtil.getRequestHeaderSchoolId()));
|
|
|
+ courseUnitOperateService.combineCollegeInspectToTeach(schoolId,collegeCombineParamsListList);
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 更新或新增专业信息
|
|
@@ -1269,7 +1543,7 @@ public class BasicDatasourceController {
|
|
|
*/
|
|
|
private void saveCollegeInfo(List<TBSchoolCollegeDto> tbSchoolCollegeDtoList) {
|
|
|
for (TBSchoolCollegeDto tbSchoolCollegeDto : tbSchoolCollegeDtoList) {
|
|
|
- sysOrgService.searchOrInsert(tbSchoolCollegeDto.getSchoolId(),tbSchoolCollegeDto.getCollegeName());
|
|
|
+ sysOrgService.searchOrInsert(tbSchoolCollegeDto.getSchoolId(), tbSchoolCollegeDto.getCollegeName());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1279,15 +1553,21 @@ public class BasicDatasourceController {
|
|
|
* @param tbSchoolTeacherDtoList 基础教师数据源
|
|
|
*/
|
|
|
private void saveTeacherInfo(List<TBSchoolTeacherDto> tbSchoolTeacherDtoList) {
|
|
|
+ Map<String, String> checkMap = new HashMap<>();
|
|
|
for (TBSchoolTeacherDto tbSchoolTeacherDto : tbSchoolTeacherDtoList) {
|
|
|
+ if (checkMap.containsKey(tbSchoolTeacherDto.getTeacherCode())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
SysUser old = sysUserService.getOne(new QueryWrapper<SysUser>().lambda()
|
|
|
.eq(SysUser::getSchoolId, tbSchoolTeacherDto.getSchoolId())
|
|
|
.eq(SysUser::getLoginName, tbSchoolTeacherDto.getTeacherCode())
|
|
|
.eq(SysUser::getRealName, tbSchoolTeacherDto.getTeacherName()));
|
|
|
+ checkMap.put(tbSchoolTeacherDto.getTeacherCode(), tbSchoolTeacherDto.getTeacherName());
|
|
|
Long id = 0L;
|
|
|
if (Objects.nonNull(old)) {
|
|
|
id = old.getId();
|
|
|
}
|
|
|
+
|
|
|
SysRole teacherRole = sysRoleService.list(new QueryWrapper<SysRole>().lambda().eq(SysRole::getType, RoleTypeEnum.TEACHER)).get(0);
|
|
|
List<Long> roleIds = new ArrayList<>();
|
|
|
roleIds.add(teacherRole.getId());
|
|
@@ -1308,4 +1588,52 @@ public class BasicDatasourceController {
|
|
|
sysUserService.saveUserNoAuth(userSaveParams);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 由于不同大学的教师数据在云阅卷中出现了不同的储存样式,为了解决这种问题进行统一处理
|
|
|
+ * 1.武汉大学:教师名称A
|
|
|
+ * 2.山东师范大学:教师编号A/教师名称A;教师编号B/教师名称B......
|
|
|
+ * 将教师信息统一处理成如下格式:
|
|
|
+ * teacherCode(教师编号):教师编号A;教师编号B......
|
|
|
+ * teacherName(教师名称):教师名称A:教师名称B......
|
|
|
+ *
|
|
|
+ * @param teacherInfo 教师信息
|
|
|
+ * @return 键值对
|
|
|
+ */
|
|
|
+ private Map<String, String> disposeTeacherInfo(String teacherInfo) {
|
|
|
+ StringBuilder teacherName = new StringBuilder();
|
|
|
+ StringBuilder teacherCode = new StringBuilder();
|
|
|
+ teacherInfo = teacherInfo.trim().replaceAll(";", ";").replaceAll("\\\\", "/");
|
|
|
+ String[] teacherInfoArr = teacherInfo.split(";");
|
|
|
+ for (String teacher : teacherInfoArr) {
|
|
|
+ String cellName = "";
|
|
|
+ String cellCode = "";
|
|
|
+ String[] cellArr = teacher.split("/");
|
|
|
+ if (cellArr.length == 1) {
|
|
|
+ cellName = cellArr[0];
|
|
|
+ } else if (cellArr.length == 2) {
|
|
|
+ cellCode = cellArr[0];
|
|
|
+ cellName = cellArr[1];
|
|
|
+ } else {
|
|
|
+ System.out.println("error");
|
|
|
+ }
|
|
|
+ if (SystemConstant.strNotNull(cellName)) {
|
|
|
+ teacherName.append(cellName).append(";");
|
|
|
+ }
|
|
|
+ if (SystemConstant.strNotNull(cellCode)) {
|
|
|
+ teacherCode.append(cellCode).append(";");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (SystemConstant.strNotNull(teacherName.toString())) {
|
|
|
+ teacherName = new StringBuilder(teacherName.substring(0, teacherName.length() - 1));
|
|
|
+ }
|
|
|
+ if (SystemConstant.strNotNull(teacherCode.toString())) {
|
|
|
+ teacherCode = new StringBuilder(teacherCode.substring(0, teacherCode.length() - 1));
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("teacherName", teacherName.toString());
|
|
|
+ map.put("teacherCode", teacherCode.toString());
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|