瀏覽代碼

修改获取分数接口

chenken 6 年之前
父節點
當前提交
c060bc43b0

+ 9 - 13
examcloud-exchange-outer-api-provider/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/controller/CommonGainScoreController.java

@@ -13,6 +13,7 @@ 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.commons.base.exception.StatusException;
 import cn.com.qmth.examcloud.commons.web.security.bean.User;
 import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
 import cn.com.qmth.examcloud.exchange.base.response.FailureBaseResponse;
@@ -119,30 +120,25 @@ public class CommonGainScoreController  extends ControllerSupport{
     
     @ApiOperation(value = "查询成绩明细:按考试名称、机构ID、学号、课程code查询成绩")
     @GetMapping("/batchQueryScoreDetail")
-    public ResponseEntity<?> batchQueryScoreDetail(@RequestParam(name = "examName")String examName,
+    public List<OutletScore> batchQueryScoreDetail(@RequestParam(name = "examName")String examName,
 						    		 @RequestParam(name = "studentCode")String studentCode,
 						    		 @RequestParam(name = "courseCode")String courseCode,
-						    		 HttpServletRequest request){
+						    		 HttpServletRequest request) throws Exception{
     	User accessUser = getAccessUser();
     	if(accessUser == null){
-			return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("请先登录"), HttpStatus.INTERNAL_SERVER_ERROR);
+    		throw new StatusException("batchQueryScoreDetail-exception", "请先登录");
 		}
 		if(examName == null){
-			return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("examName is not null"), HttpStatus.INTERNAL_SERVER_ERROR);
+			throw new StatusException("batchQueryScoreDetail-exception", "examName is not null");
 		}
 		if(studentCode == null){
-			return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("studentCode is not null"), HttpStatus.INTERNAL_SERVER_ERROR);
+			throw new StatusException("batchQueryScoreDetail-exception", "studentCode is not null");
 		}
 		if(courseCode == null){
-			return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("courseCode is not null"), HttpStatus.INTERNAL_SERVER_ERROR);
-		}
-    	try {
-			List<OutletScore> outletScores = outletScoreService.queryExamScoreBy(accessUser.getRootOrgId(), examName, studentCode, courseCode);
-			return new ResponseEntity<SuccessBaseResponse>(new SuccessBaseResponse("查询成功",outletScores), HttpStatus.OK);
-    	} catch (Exception e) {
-			e.printStackTrace();
-			return new ResponseEntity<FailureBaseResponse>(new FailureBaseResponse("查询失败"), HttpStatus.INTERNAL_SERVER_ERROR);
+			throw new StatusException("batchQueryScoreDetail-exception", "courseCode is not null");
 		}
+		List<OutletScore> outletScores = outletScoreService.queryExamScoreBy(accessUser.getRootOrgId(), examName, studentCode, courseCode);
+		return outletScores;
     }
     
 }