|
@@ -1,14 +1,21 @@
|
|
package com.qmth.distributed.print.api;
|
|
package com.qmth.distributed.print.api;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
import com.qmth.boot.api.annotation.BOOL;
|
|
import com.qmth.boot.api.annotation.BOOL;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.distributed.print.business.bean.params.open.GradeOpenPageParams;
|
|
import com.qmth.distributed.print.business.bean.params.open.GradeOpenPageParams;
|
|
import com.qmth.distributed.print.business.bean.params.open.GradeOpenParams;
|
|
import com.qmth.distributed.print.business.bean.params.open.GradeOpenParams;
|
|
import com.qmth.distributed.print.business.service.OpenApiService;
|
|
import com.qmth.distributed.print.business.service.OpenApiService;
|
|
|
|
+import com.qmth.teachcloud.common.bean.params.OpenParams;
|
|
|
|
+import com.qmth.teachcloud.common.bean.result.LoginResult;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.entity.BasicSchool;
|
|
import com.qmth.teachcloud.common.entity.BasicSchool;
|
|
|
|
+import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
|
+import com.qmth.teachcloud.common.enums.AppSourceEnum;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
|
+import com.qmth.teachcloud.common.service.SysUserService;
|
|
|
|
+import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
import com.qmth.teachcloud.common.util.AuthThirdUtil;
|
|
import com.qmth.teachcloud.common.util.AuthThirdUtil;
|
|
import com.qmth.teachcloud.common.util.JacksonUtil;
|
|
import com.qmth.teachcloud.common.util.JacksonUtil;
|
|
import com.qmth.teachcloud.common.util.Result;
|
|
import com.qmth.teachcloud.common.util.Result;
|
|
@@ -17,14 +24,13 @@ import io.swagger.annotations.*;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
-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.annotation.Resource;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.net.URLDecoder;
|
|
import java.net.URLDecoder;
|
|
|
|
+import java.security.NoSuchAlgorithmException;
|
|
|
|
+import java.util.Objects;
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -45,6 +51,12 @@ public class OpenApiController {
|
|
@Resource
|
|
@Resource
|
|
private OpenApiService openApiService;
|
|
private OpenApiService openApiService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ SysUserService sysUserService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TeachcloudCommonService teachcloudCommonService;
|
|
|
|
+
|
|
@ApiOperation(value = "试卷基础配置查询")
|
|
@ApiOperation(value = "试卷基础配置查询")
|
|
@ApiResponses({@ApiResponse(code = 200, message = "试卷基础配置查询", response = Object.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "试卷基础配置查询", response = Object.class)})
|
|
@PostMapping("/paper_config")
|
|
@PostMapping("/paper_config")
|
|
@@ -120,4 +132,47 @@ public class OpenApiController {
|
|
BasicSchool basicSchool = AuthThirdUtil.hasPermission();
|
|
BasicSchool basicSchool = AuthThirdUtil.hasPermission();
|
|
return ResultUtil.ok(openApiService.listExamStudentScore(basicSchool, gradeOpenPageParams.getThirdExamId(), gradeOpenPageParams.getGradeCourseCode(), gradeOpenPageParams.getPageNumber(), gradeOpenPageParams.getPageSize()));
|
|
return ResultUtil.ok(openApiService.listExamStudentScore(basicSchool, gradeOpenPageParams.getThirdExamId(), gradeOpenPageParams.getGradeCourseCode(), gradeOpenPageParams.getPageNumber(), gradeOpenPageParams.getPageSize()));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "单点登录")
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "返回消息", response = Result.class)})
|
|
|
|
+ @RequestMapping(value = "/account/login", method = RequestMethod.POST)
|
|
|
|
+ @Aac(auth = BOOL.FALSE)
|
|
|
|
+ public Result accountLogin(@ApiParam(value = "时间", required = true) @RequestParam String time,
|
|
|
|
+ @ApiParam(value = "地址", required = true) @RequestParam String path,
|
|
|
|
+ @ApiParam(value = "鉴权信息", required = true) @RequestParam String signature,
|
|
|
|
+ @ApiParam(value = "工号", required = true) @RequestParam String account,
|
|
|
|
+ @ApiParam(value = "返回url") @RequestParam(required = false) String returnUrl,
|
|
|
|
+ @ApiParam(value = "其它参数") @RequestParam(required = false) String params) throws UnsupportedEncodingException, NoSuchAlgorithmException {
|
|
|
|
+ if (Objects.isNull(time) || Objects.equals(time, "")) {
|
|
|
|
+ throw ExceptionResultEnum.PARAMS_ERROR.exception("时间不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (Objects.isNull(path) || Objects.equals(path, "")) {
|
|
|
|
+ throw ExceptionResultEnum.PARAMS_ERROR.exception("路径不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (Objects.isNull(signature) || Objects.equals(signature, "")) {
|
|
|
|
+ throw ExceptionResultEnum.PARAMS_ERROR.exception("鉴权信息不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (Objects.isNull(account) || Objects.equals(account, "")) {
|
|
|
|
+ throw ExceptionResultEnum.PARAMS_ERROR.exception("工号不能为空");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BasicSchool basicSchool = AuthThirdUtil.hasPermissionCas(time, path, signature);
|
|
|
|
+ OpenParams openParams = null;
|
|
|
|
+ if (Objects.nonNull(params) && !Objects.equals(params, "")) {
|
|
|
|
+ String decodeJson = URLDecoder.decode(params, SystemConstant.CHARSET_NAME);
|
|
|
|
+ openParams = JacksonUtil.readJson(decodeJson, OpenParams.class);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //查询用户是否存在
|
|
|
|
+ QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ sysUserQueryWrapper.lambda().eq(SysUser::getSchoolId, basicSchool.getId())
|
|
|
|
+ .eq(SysUser::getLoginName, account)
|
|
|
|
+ .eq(SysUser::getEnable, true);
|
|
|
|
+ SysUser sysUser = sysUserService.getOne(sysUserQueryWrapper);
|
|
|
|
+ Optional.ofNullable(sysUser).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("用户不存在"));
|
|
|
|
+
|
|
|
|
+ LoginResult loginResult = teachcloudCommonService.login(sysUser.getPassword(), sysUser, AppSourceEnum.CAS_THIRD);
|
|
|
|
+ loginResult.setReturnUrl(returnUrl);
|
|
|
|
+ return ResultUtil.ok(loginResult);
|
|
|
|
+ }
|
|
}
|
|
}
|