|
@@ -5,28 +5,30 @@ import com.qmth.boot.api.annotation.Aac;
|
|
|
import com.qmth.boot.api.annotation.BOOL;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
import com.qmth.eds.bean.params.LoginParam;
|
|
|
-import com.qmth.eds.bean.result.EditResult;
|
|
|
-import com.qmth.eds.bean.result.LoginResult;
|
|
|
+import com.qmth.eds.bean.result.*;
|
|
|
+import com.qmth.eds.common.entity.CloudMarkingScore;
|
|
|
+import com.qmth.eds.common.entity.ExamSyncStudent;
|
|
|
import com.qmth.eds.common.entity.SysUser;
|
|
|
import com.qmth.eds.common.enums.AppSourceEnum;
|
|
|
import com.qmth.eds.common.enums.ExceptionResultEnum;
|
|
|
-import com.qmth.eds.service.SysUserService;
|
|
|
-import com.qmth.eds.service.TeachcloudCommonService;
|
|
|
import com.qmth.eds.common.util.Result;
|
|
|
import com.qmth.eds.common.util.ResultUtil;
|
|
|
import com.qmth.eds.common.util.ServletUtil;
|
|
|
+import com.qmth.eds.service.CloudMarkingScoreService;
|
|
|
+import com.qmth.eds.service.ExamSyncStudentService;
|
|
|
+import com.qmth.eds.service.SysUserService;
|
|
|
+import com.qmth.eds.service.TeachcloudCommonService;
|
|
|
import io.swagger.annotations.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 系统公共Controller
|
|
@@ -35,12 +37,19 @@ import java.util.List;
|
|
|
@RestController
|
|
|
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/common")
|
|
|
public class SysController {
|
|
|
+
|
|
|
@Resource
|
|
|
SysUserService sysUserService;
|
|
|
|
|
|
@Resource
|
|
|
TeachcloudCommonService teachcloudCommonService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ CloudMarkingScoreService cloudMarkingScoreService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ ExamSyncStudentService examSyncStudentService;
|
|
|
+
|
|
|
/**
|
|
|
* 登录
|
|
|
*
|
|
@@ -99,4 +108,85 @@ public class SysController {
|
|
|
return ResultUtil.ok();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "查询考查学院列表")
|
|
|
+ @PostMapping("/examine/college/list")
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = ExamineCollegeResult.class)})
|
|
|
+ public Result examineCollegeList(@ApiParam(value = "学期id") @RequestParam(required = false) Long semesterId,
|
|
|
+ @ApiParam(value = "考试id") @RequestParam(required = false) Long examId,
|
|
|
+ @ApiParam(value = "科目代码") @RequestParam(required = false) String subjectCode) {
|
|
|
+ List<ExamSyncStudent> examSyncStudentList = this.conditionCommonQuery(semesterId, examId, subjectCode);
|
|
|
+ List<ExamineCollegeResult> examineCollegeResultList = null;
|
|
|
+ if (!CollectionUtils.isEmpty(examSyncStudentList)) {
|
|
|
+ examineCollegeResultList = new ArrayList<>(examSyncStudentList.size());
|
|
|
+ for (ExamSyncStudent e : examSyncStudentList) {
|
|
|
+ if (Objects.nonNull(e.getJgmc()) && !Objects.equals(e.getJgmc().trim(), "")) {
|
|
|
+ examineCollegeResultList.add(new ExamineCollegeResult(e.getJgmc(), e.getJgmc()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(examineCollegeResultList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询班级列表")
|
|
|
+ @PostMapping("/clazz/list")
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = ClazzResult.class)})
|
|
|
+ public Result clazzList(@ApiParam(value = "学期id") @RequestParam(required = false) Long semesterId,
|
|
|
+ @ApiParam(value = "考试id") @RequestParam(required = false) Long examId,
|
|
|
+ @ApiParam(value = "科目代码") @RequestParam(required = false) String subjectCode) {
|
|
|
+ List<ExamSyncStudent> examSyncStudentList = this.conditionCommonQuery(semesterId, examId, subjectCode);
|
|
|
+ List<ClazzResult> clazzResultList = null;
|
|
|
+ if (!CollectionUtils.isEmpty(examSyncStudentList)) {
|
|
|
+ clazzResultList = new ArrayList<>(examSyncStudentList.size());
|
|
|
+ for (ExamSyncStudent e : examSyncStudentList) {
|
|
|
+ if ((Objects.nonNull(e.getJxbId()) && !Objects.equals(e.getJxbId().trim(), ""))
|
|
|
+ && (Objects.nonNull(e.getJxbmc()) && !Objects.equals(e.getJxbmc().trim(), ""))) {
|
|
|
+ clazzResultList.add(new ClazzResult(e.getJxbId(), e.getJxbmc()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(clazzResultList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询任课老师列表")
|
|
|
+ @PostMapping("/teacher/list")
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = TeacherResult.class)})
|
|
|
+ public Result teacherList(@ApiParam(value = "学期id") @RequestParam(required = false) Long semesterId,
|
|
|
+ @ApiParam(value = "考试id") @RequestParam(required = false) Long examId,
|
|
|
+ @ApiParam(value = "科目代码") @RequestParam(required = false) String subjectCode) {
|
|
|
+ List<ExamSyncStudent> examSyncStudentList = this.conditionCommonQuery(semesterId, examId, subjectCode);
|
|
|
+ List<TeacherResult> teacherResultList = null;
|
|
|
+ if (!CollectionUtils.isEmpty(examSyncStudentList)) {
|
|
|
+ teacherResultList = new ArrayList<>(examSyncStudentList.size());
|
|
|
+ for (ExamSyncStudent e : examSyncStudentList) {
|
|
|
+ if ((Objects.nonNull(e.getJgh()) && !Objects.equals(e.getJgh().trim(), ""))
|
|
|
+ && (Objects.nonNull(e.getXm()) && !Objects.equals(e.getXm().trim(), ""))) {
|
|
|
+ teacherResultList.add(new TeacherResult(e.getJgh(), e.getXm()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(teacherResultList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询条件公用
|
|
|
+ *
|
|
|
+ * @param semesterId
|
|
|
+ * @param examId
|
|
|
+ * @param subjectCode
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<ExamSyncStudent> conditionCommonQuery(Long semesterId,
|
|
|
+ Long examId,
|
|
|
+ String subjectCode) {
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
+ //先查询云阅卷科目代码
|
|
|
+ List<CloudMarkingScore> cloudMarkingScoreList = cloudMarkingScoreService.queryBySyncCourseCode(schoolId, sysUser.getOrgId(), subjectCode);
|
|
|
+ Set<String> subjectCodeSet = null;
|
|
|
+ if (!CollectionUtils.isEmpty(cloudMarkingScoreList)) {
|
|
|
+ subjectCodeSet = new HashSet<>(cloudMarkingScoreList.size());
|
|
|
+ subjectCodeSet = cloudMarkingScoreList.stream().map(s -> s.getSubjectCode()).collect(Collectors.toSet());
|
|
|
+ }
|
|
|
+ return examSyncStudentService.queryByExamineCollegeList(schoolId, sysUser.getOrgId(), examId, subjectCode, subjectCodeSet);
|
|
|
+ }
|
|
|
}
|