|
@@ -5,7 +5,6 @@ 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;
|
|
@@ -57,7 +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)
|
|
|
+//@Aac(strict = false, auth = false)
|
|
|
public class BasicDatasourceController {
|
|
|
@Resource
|
|
|
private TBPaperService tbPaperService;
|
|
@@ -1084,37 +1083,48 @@ public class BasicDatasourceController {
|
|
|
if (tbExamCourseService.verifyExamCourseCantRun(SystemConstant.convertIdToLong(examId), SystemConstant.convertIdToLong(schoolId), courseCode, courseName)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("课程编号[" + courseCode + "]的课程分析数据已测试或发布,不能变更基础数据");
|
|
|
}
|
|
|
+ String courseNameTemp = courseName;
|
|
|
+ boolean ABType = false;
|
|
|
+ if (courseNameTemp.contains("-")) {
|
|
|
+ courseNameTemp = courseNameTemp.split("-")[0];
|
|
|
+ ABType = true;
|
|
|
+ }
|
|
|
+
|
|
|
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)
|
|
|
+ .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, courseNameTemp)
|
|
|
.ne(TBExamination::getStudyType, "普通"));
|
|
|
int count = tbExaminationList.size();
|
|
|
+ int actualCount = 0;
|
|
|
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> 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) {
|
|
|
+ if (cellList.size() > 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("数据异常");
|
|
|
+ } else if (cellList.size() == 0) {
|
|
|
+ if (ABType) {
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("数据异常");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
TBExamStudent cell = cellList.get(0);
|
|
|
cell.setStudentCurrent(false);
|
|
|
willUpdate.add(cell);
|
|
|
+ actualCount++;
|
|
|
}
|
|
|
tbExamStudentService.saveOrUpdateBatch(willUpdate);
|
|
|
}
|
|
|
- return ResultUtil.ok("有【" + count + "】条非应届学生数据被更新");
|
|
|
+ return ResultUtil.ok("有【" + actualCount + "】条非应届学生数据被更新");
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "异常考生-按学号处理")
|
|
@@ -1358,7 +1368,7 @@ public class BasicDatasourceController {
|
|
|
@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)
|
|
|
+ @Aac(strict = false, auth = false)
|
|
|
public Result userTeacherDelete(@ApiParam(value = "用户id", required = true) @RequestParam List<String> idList) {
|
|
|
if (CollectionUtils.isEmpty(idList)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("请选择要删除的用户");
|
|
@@ -1372,7 +1382,7 @@ public class BasicDatasourceController {
|
|
|
@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)
|
|
|
+ @Aac(strict = false, auth = 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)));
|
|
@@ -1382,7 +1392,7 @@ public class BasicDatasourceController {
|
|
|
@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)
|
|
|
+ @Aac(strict = false, auth = false)
|
|
|
public Result syncTeacherInfo(@ApiParam(value = "学校id", required = true) @RequestParam String schoolId) {
|
|
|
tbTeacherService.syncTeacherInfoToSysUser(SystemConstant.convertIdToLong(schoolId));
|
|
|
return ResultUtil.ok();
|
|
@@ -1392,7 +1402,7 @@ public class BasicDatasourceController {
|
|
|
@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)
|
|
|
+ @Aac(strict = false, auth = 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 {
|
|
|
|
|
@@ -1466,7 +1476,7 @@ public class BasicDatasourceController {
|
|
|
@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)
|
|
|
+ @Aac(strict = false, auth = false)
|
|
|
public Result buildDemoTable() throws ExecutionException, InterruptedException {
|
|
|
courseUnitOperateService.createDemoData();
|
|
|
return ResultUtil.ok();
|
|
@@ -1476,7 +1486,7 @@ public class BasicDatasourceController {
|
|
|
@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)
|
|
|
+ @Aac(strict = false, auth = false)
|
|
|
public Result migrateOrg(@Valid @RequestBody List<CollegeCombineParams> collegeCombineParamsListList, BindingResult bindingResult){
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|