|
@@ -1,103 +1,96 @@
|
|
|
package cn.com.qmth.examcloud.exchange.outer.api.controller.sydx;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
-import org.springframework.util.StringUtils;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
|
import cn.com.qmth.examcloud.exchange.base.response.FailureBaseResponse;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.controller.sydx.bean.SydxExamScoreDomain;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.service.OutletScoreService;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.service.bean.OutletScore;
|
|
|
import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 石油大学专用-获取成绩接口
|
|
|
- * @author chenken
|
|
|
- * @date 2018年4月3日 下午3:57:26
|
|
|
- * @company QMTH
|
|
|
+ *
|
|
|
+ * @author chenken
|
|
|
+ * @date 2018年4月3日 下午3:57:26
|
|
|
+ * @company QMTH
|
|
|
* @description ScoreController.java
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/api/ecs_outlet/sydx/score")
|
|
|
-public class SydxScoreController extends ControllerSupport{
|
|
|
+public class SydxScoreController extends ControllerSupport {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OutletScoreService outletScoreService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询成绩:根据考试名称、机构ID和学生考试方式查询")
|
|
|
+ @GetMapping
|
|
|
+ public ResponseEntity<?> query(@RequestParam(name = "examRemark") String examRemark,
|
|
|
+ @RequestParam(name = "examStuRemark", required = false) String examStuRemark,
|
|
|
+ HttpServletRequest request) {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isEmpty(examRemark)) {
|
|
|
+ return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("examRemark不能为空"), HttpStatus.BAD_REQUEST);
|
|
|
+ }
|
|
|
+ User accessUser = getAccessUser();
|
|
|
+ Long orgId = accessUser.getRootOrgId();
|
|
|
+ List<OutletScore> outletScoreList = outletScoreService.queryExamScore(examRemark, examStuRemark, orgId);
|
|
|
+
|
|
|
+ return new ResponseEntity<List<OutletScore>>(outletScoreList, HttpStatus.OK);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("请求失败"), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- @Autowired
|
|
|
- private OutletScoreService outletScoreService;
|
|
|
+ @ApiOperation(value = "查询成绩:按考生身份证号、机构ID查询成绩")
|
|
|
+ @GetMapping("/identityNumber")
|
|
|
+ public ResponseEntity<?> queryByIdentityNumber(@RequestParam(name = "identityNumberList") List<String> identityNumberList, HttpServletRequest request) {
|
|
|
+ try {
|
|
|
+ if (identityNumberList == null || identityNumberList.size() == 0) {
|
|
|
+ return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("身份证号不能为空"), HttpStatus.BAD_REQUEST);
|
|
|
+ }
|
|
|
+ User accessUser = getAccessUser();
|
|
|
+ List<OutletScore> outletScoreList = outletScoreService.queryExamScoreByIdentityNumbers(identityNumberList, accessUser.getRootOrgId());
|
|
|
+ return new ResponseEntity<List<OutletScore>>(outletScoreList, HttpStatus.OK);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("请求失败"), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- @ApiOperation(value = "查询成绩:根据考试名称、机构ID和学生考试方式查询")
|
|
|
- @GetMapping
|
|
|
- public ResponseEntity<?> query(@RequestParam(name = "examRemark") String examRemark,
|
|
|
- @RequestParam(name = "examStuRemark",required=false) String examStuRemark,
|
|
|
- HttpServletRequest request) {
|
|
|
- try{
|
|
|
- if (StringUtils.isEmpty(examRemark)) {
|
|
|
- return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("examRemark不能为空"),HttpStatus.BAD_REQUEST);
|
|
|
- }
|
|
|
- User accessUser = getAccessUser();
|
|
|
- Long orgId = accessUser.getRootOrgId();
|
|
|
- List<OutletScore> outletScoreList = outletScoreService.queryExamScore(examRemark, examStuRemark, orgId);
|
|
|
+ @ApiOperation(value = "查询成绩:按考试名称、机构ID、学号、课程code查询成绩")
|
|
|
+ @PostMapping("/getExamScores")
|
|
|
+ public ResponseEntity<?> queryExamScores(@RequestBody SydxExamScoreDomain sydxExamScoreDomain) {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isEmpty(sydxExamScoreDomain.getBatchName())) {
|
|
|
+ return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("考试批次名称不能为空"), HttpStatus.BAD_REQUEST);
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(sydxExamScoreDomain.getCourseCode())) {
|
|
|
+ return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("课程不能为空"), HttpStatus.BAD_REQUEST);
|
|
|
+ }
|
|
|
+ if (sydxExamScoreDomain.getStudentCodes() == null || sydxExamScoreDomain.getStudentCodes().size() == 0) {
|
|
|
+ return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("学号不能为空"), HttpStatus.BAD_REQUEST);
|
|
|
+ }
|
|
|
+ if (sydxExamScoreDomain.getStudentCodes().size() > 1000) {
|
|
|
+ return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("单次查询,学号数量不能大于1000"), HttpStatus.BAD_REQUEST);
|
|
|
+ }
|
|
|
+ User accessUser = getAccessUser();
|
|
|
+ List<OutletScore> outletScoreList = outletScoreService.queryExamScoreBy(accessUser.getRootOrgId(), sydxExamScoreDomain.getBatchName(), sydxExamScoreDomain.getCourseCode(), sydxExamScoreDomain.getStudentCodes());
|
|
|
+ return new ResponseEntity<List<OutletScore>>(outletScoreList, HttpStatus.OK);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("请求失败"), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- return new ResponseEntity<List<OutletScore>>(outletScoreList, HttpStatus.OK);
|
|
|
- }catch(Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("请求失败"), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "查询成绩:按考生身份证号、机构ID查询成绩")
|
|
|
- @GetMapping("/identityNumber")
|
|
|
- public ResponseEntity<?> queryByIdentityNumber(@RequestParam(name = "identityNumberList") List<String> identityNumberList,HttpServletRequest request) {
|
|
|
- try{
|
|
|
- if (identityNumberList==null||identityNumberList.size()==0) {
|
|
|
- return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("身份证号不能为空"),HttpStatus.BAD_REQUEST);
|
|
|
- }
|
|
|
- User accessUser = getAccessUser();
|
|
|
- List<OutletScore> outletScoreList = outletScoreService.queryExamScoreByIdentityNumbers(identityNumberList, accessUser.getRootOrgId());
|
|
|
- return new ResponseEntity<List<OutletScore>>(outletScoreList, HttpStatus.OK);
|
|
|
- }catch(Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("请求失败"), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "查询成绩:按考试名称、机构ID、学号、课程code查询成绩")
|
|
|
- @GetMapping("/batchNameAndCourseCodeAndStudentCodes")
|
|
|
- public ResponseEntity<?> queryExamScores(
|
|
|
- @RequestParam(name = "batchName") String batchName,
|
|
|
- @RequestParam(name = "courseCode") String courseCode,
|
|
|
- @RequestParam(name = "studentCodes") List<String> studentCodes,
|
|
|
- HttpServletRequest request){
|
|
|
- try{
|
|
|
- if(StringUtils.isEmpty(batchName)){
|
|
|
- return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("考试批次名称不能为空"),HttpStatus.BAD_REQUEST);
|
|
|
- }
|
|
|
- if(StringUtils.isEmpty(courseCode)){
|
|
|
- return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("课程不能为空"),HttpStatus.BAD_REQUEST);
|
|
|
- }
|
|
|
- if(studentCodes == null || studentCodes.size()==0){
|
|
|
- return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("学号不能为空"),HttpStatus.BAD_REQUEST);
|
|
|
- }
|
|
|
- if(studentCodes.size()>1000){
|
|
|
- return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("单次查询,学号数量不能大于1000"),HttpStatus.BAD_REQUEST);
|
|
|
- }
|
|
|
- User accessUser = getAccessUser();
|
|
|
- List<OutletScore> outletScoreList = outletScoreService.queryExamScoreBy(accessUser.getRootOrgId(),batchName,courseCode,studentCodes);
|
|
|
- return new ResponseEntity<List<OutletScore>>(outletScoreList, HttpStatus.OK);
|
|
|
- }catch(Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("请求失败"), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
}
|