|
@@ -58,17 +58,19 @@ public class CommonOpenApiController {
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回消息", response = Result.class)})
|
|
|
@RequestMapping(value = "/authentication/teachcloud", method = RequestMethod.GET)
|
|
|
@Aac(auth = BOOL.FALSE)
|
|
|
- public void authenticationTeachcloud(@ApiParam(value = "工号", required = true) @RequestParam String account,
|
|
|
- @ApiParam(value = "学校code", required = true) @RequestParam String schoolCode,
|
|
|
- @ApiParam(value = "返回url") @RequestParam(required = false) String returnUrl,
|
|
|
- @ApiParam(value = "其它参数") @RequestParam(required = false) String params) throws IOException {
|
|
|
- log.info("公用跳转接口进来了,account:{},schoolCode:{}", account, schoolCode);
|
|
|
+ public void authenticationTeachcloud(@ApiParam(value = "工号", required = true) @RequestParam String accountCommon,
|
|
|
+ @ApiParam(value = "学校code", required = true) @RequestParam String schoolCodeCommon,
|
|
|
+ @ApiParam(value = "返回url") @RequestParam(required = false) String returnUrlCommon,
|
|
|
+ @ApiParam(value = "其它参数") @RequestParam(required = false) String paramsCommon) throws IOException {
|
|
|
+ log.info("公用跳转接口进来了,account:{},schoolCode:{}", accountCommon, schoolCodeCommon);
|
|
|
Optional.ofNullable(teachcloudLoginUrl).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("知学登录跳转地址不存在"));
|
|
|
- Optional.ofNullable(account).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("工号不存在"));
|
|
|
- Optional.ofNullable(schoolCode).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("学校code不存在"));
|
|
|
+ Optional.ofNullable(accountCommon).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("工号不存在"));
|
|
|
+ Optional.ofNullable(schoolCodeCommon).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("学校code不存在"));
|
|
|
+
|
|
|
+// accountUser = URLDecoder.decode(accountUser, SystemConstant.CHARSET_NAME);
|
|
|
|
|
|
QueryWrapper<BasicSchool> basicSchoolQueryWrapper = new QueryWrapper<>();
|
|
|
- basicSchoolQueryWrapper.lambda().eq(BasicSchool::getCode, schoolCode);
|
|
|
+ basicSchoolQueryWrapper.lambda().eq(BasicSchool::getCode, schoolCodeCommon);
|
|
|
BasicSchool basicSchool = basicSchoolService.getOne(basicSchoolQueryWrapper);
|
|
|
Optional.ofNullable(basicSchool).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("学校信息不存在"));
|
|
|
|
|
@@ -84,21 +86,21 @@ public class CommonOpenApiController {
|
|
|
.add(teachcloudLoginUrl)
|
|
|
.add(SystemConstant.GET_UNKNOWN).add(SystemConstant.HEADER_TIME).add(SystemConstant.GET_EQUAL).add(String.valueOf(timestamp))
|
|
|
.add(SystemConstant.GET_SYMBOL).add(SystemConstant.SIGNATURE).add(SystemConstant.GET_EQUAL).add(signature)
|
|
|
- .add(SystemConstant.GET_SYMBOL).add(SystemConstant.USER).add(SystemConstant.GET_EQUAL).add(account);
|
|
|
+ .add(SystemConstant.GET_SYMBOL).add(SystemConstant.USER).add(SystemConstant.GET_EQUAL).add(accountCommon);
|
|
|
|
|
|
- if (Objects.nonNull(returnUrl) && !Objects.equals(returnUrl, "")) {
|
|
|
- stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.RETURN_URL).add(SystemConstant.GET_EQUAL).add(returnUrl);
|
|
|
+ if (Objects.nonNull(returnUrlCommon) && !Objects.equals(returnUrlCommon, "")) {
|
|
|
+ stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.RETURN_URL).add(SystemConstant.GET_EQUAL).add(returnUrlCommon);
|
|
|
}
|
|
|
- if (Objects.nonNull(params) && !Objects.equals(params, "")) {
|
|
|
- String decodeJson = URLDecoder.decode(params, SystemConstant.CHARSET_NAME);
|
|
|
+ if (Objects.nonNull(paramsCommon) && !Objects.equals(paramsCommon, "")) {
|
|
|
+ String decodeJson = URLDecoder.decode(paramsCommon, SystemConstant.CHARSET_NAME);
|
|
|
OpenParams openParams = JacksonUtil.readJson(decodeJson, OpenParams.class);
|
|
|
stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.PARAMS).add(SystemConstant.GET_EQUAL).add(JacksonUtil.parseJson(openParams));
|
|
|
}
|
|
|
String redirectUrl = URLEncoder.encode(stringJoiner.toString(), SystemConstant.CHARSET);
|
|
|
- log.info("path:{},timestamp:{},account:{},signature:{},redirectUrl:{},redirectUrl_urlencode:{}", path, timestamp, account, signature, stringJoiner.toString(), redirectUrl);
|
|
|
+ log.info("path:{},timestamp:{},account:{},signature:{},redirectUrl:{},redirectUrl_urlencode:{}", path, timestamp, accountCommon, signature, stringJoiner.toString(), redirectUrl);
|
|
|
|
|
|
HttpServletResponse response = ServletUtil.getResponse();
|
|
|
- response.setHeader("Access-Control-Allow-Origin", "*");
|
|
|
+ response.setHeader("Access-Control-Allow-Origin", SystemConstant.PATH_MATCH);
|
|
|
response.sendRedirect(redirectUrl);
|
|
|
}
|
|
|
}
|