WANG vor 6 Jahren
Ursprung
Commit
9b1becab64

+ 7 - 1
examcloud-exchange-outer-api-provider/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/provider/ExamStudentOuterServiceProvider.java

@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.web.support.StatusResponse;
 import cn.com.qmth.examcloud.examwork.api.ExamStudentCloudService;
 import cn.com.qmth.examcloud.examwork.api.bean.ExamStudentBean;
 import cn.com.qmth.examcloud.examwork.api.request.SaveExamStudentReq;
@@ -18,6 +19,8 @@ import cn.com.qmth.examcloud.exchange.outer.api.response.OuterSaveExamStudentRes
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
 
 /**
  * 考生服务
@@ -38,7 +41,10 @@ public class ExamStudentOuterServiceProvider extends ControllerSupport
 	@Autowired
 	ExamStudentCloudService examStudentCloudService;
 
-	@ApiOperation(value = "保存考生信息", httpMethod = "POST", response = OuterSaveExamStudentResp.class)
+	@ApiOperation(value = "保存考生信息", httpMethod = "POST")
+	@ApiResponses({
+			@ApiResponse(code = 200, message = "成功", response = OuterSaveExamStudentResp.class),
+			@ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
 	@PostMapping("saveExamStudent")
 	@Override
 	public OuterSaveExamStudentResp saveExamStudent(

+ 6 - 6
examcloud-exchange-starter/src/main/java/cn/com/qmth/examcloud/exchange/config/ThirdPartyAccessInterceptor.java

@@ -17,7 +17,7 @@ import cn.com.qmth.examcloud.commons.base.util.StringUtil;
 import cn.com.qmth.examcloud.commons.web.cloud.api.OuterService;
 import cn.com.qmth.examcloud.commons.web.redis.RedisClient;
 import cn.com.qmth.examcloud.commons.web.support.ServletUtil;
-import cn.com.qmth.examcloud.commons.web.support.StatusResponseEntity;
+import cn.com.qmth.examcloud.commons.web.support.StatusResponse;
 import cn.com.qmth.examcloud.core.basic.api.CommonCloudService;
 import cn.com.qmth.examcloud.core.basic.api.bean.ThirdPartyAccessBean;
 import cn.com.qmth.examcloud.core.basic.api.request.GetThirdPartyAccessInfoReq;
@@ -67,7 +67,7 @@ public final class ThirdPartyAccessInterceptor implements HandlerInterceptor {
 				|| StringUtils.isBlank(appId) || StringUtils.isBlank(timestamp)) {
 			response.setStatus(HttpStatus.FORBIDDEN.value());
 			ServletUtil.returnJson(
-					new StatusResponseEntity("403",
+					new StatusResponse("403",
 							"第三方接入请求必须包含请求头['access_token','rootOrgId','appId','timestamp']"),
 					response);
 			return false;
@@ -81,7 +81,7 @@ public final class ThirdPartyAccessInterceptor implements HandlerInterceptor {
 		if (!(StringUtil.isLong(rootOrgId) && StringUtil.isLong(timestamp))) {
 			response.setStatus(HttpStatus.FORBIDDEN.value());
 			ServletUtil.returnJson(
-					new StatusResponseEntity("403", "第三方接入请求头['rootOrgId','timestamp']必须是整数"),
+					new StatusResponse("403", "第三方接入请求头['rootOrgId','timestamp']必须是整数"),
 					response);
 			return false;
 		}
@@ -96,11 +96,11 @@ public final class ThirdPartyAccessInterceptor implements HandlerInterceptor {
 				thirdPartyAccessBean = getThirdPartyAccessInfo(rootOrgId, appId);
 			} catch (StatusException e) {
 				response.setStatus(HttpStatus.FORBIDDEN.value());
-				ServletUtil.returnJson(new StatusResponseEntity("403", e.getDesc()), response);
+				ServletUtil.returnJson(new StatusResponse("403", e.getDesc()), response);
 				return false;
 			} catch (Exception e) {
 				response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
-				ServletUtil.returnJson(new StatusResponseEntity("500", "获取第三方接入信息异常"), response);
+				ServletUtil.returnJson(new StatusResponse("500", "获取第三方接入信息异常"), response);
 				return false;
 			}
 			redisClient.set(key, thirdPartyAccessBean, 60000);
@@ -121,7 +121,7 @@ public final class ThirdPartyAccessInterceptor implements HandlerInterceptor {
 
 		if (!hexAscii.equalsIgnoreCase(accessToken)) {
 			response.setStatus(HttpStatus.FORBIDDEN.value());
-			ServletUtil.returnJson(new StatusResponseEntity("403", "access_token校验失败"), response);
+			ServletUtil.returnJson(new StatusResponse("403", "access_token校验失败"), response);
 			return false;
 		}