|
@@ -1,6 +1,8 @@
|
|
package com.qmth.themis.exam.api;
|
|
package com.qmth.themis.exam.api;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.qmth.themis.business.annotation.ApiJsonObject;
|
|
|
|
+import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
import com.qmth.themis.business.entity.TBSession;
|
|
import com.qmth.themis.business.entity.TBSession;
|
|
@@ -74,29 +76,33 @@ public class TEStudentController {
|
|
@ApiOperation(value = "学生登录接口")
|
|
@ApiOperation(value = "学生登录接口")
|
|
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
|
@ApiResponses({@ApiResponse(code = 200, message = "学生信息", response = TEStudent.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "学生信息", response = TEStudent.class)})
|
|
- public Result login(@ApiParam(value = "学生信息", required = true) @RequestBody Map map) throws NoSuchAlgorithmException {
|
|
|
|
- if (Objects.isNull(map)) {
|
|
|
|
|
|
+ public Result login(@ApiJsonObject(name = "loginAccount", value = {
|
|
|
|
+ @ApiJsonProperty(key = "identity", description = "证件号"),
|
|
|
|
+ @ApiJsonProperty(key = "password", description = "密码"),
|
|
|
|
+ @ApiJsonProperty(key = "orgId",type = "long",example = "1",description = "机构id")
|
|
|
|
+ }) @ApiParam(value = "学生信息", required = true) @RequestBody Map<String, Object> mapParameter) throws NoSuchAlgorithmException {
|
|
|
|
+ if (Objects.isNull(mapParameter)) {
|
|
throw new BusinessException(ExceptionResultEnum.STUDENT_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.STUDENT_IS_NULL);
|
|
}
|
|
}
|
|
- if (Objects.isNull(map.get("identity")) || Objects.equals(map.get("identity"), "")) {
|
|
|
|
|
|
+ if (Objects.isNull(mapParameter.get("identity")) || Objects.equals(mapParameter.get("identity"), "")) {
|
|
throw new BusinessException(ExceptionResultEnum.LOGIN_NAME_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.LOGIN_NAME_IS_NULL);
|
|
}
|
|
}
|
|
- if (Objects.isNull(map.get("password")) || Objects.equals(map.get("password"), "")) {
|
|
|
|
|
|
+ if (Objects.isNull(mapParameter.get("password")) || Objects.equals(mapParameter.get("password"), "")) {
|
|
throw new BusinessException(ExceptionResultEnum.PASSWORD_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.PASSWORD_IS_NULL);
|
|
}
|
|
}
|
|
Long orgId = null;
|
|
Long orgId = null;
|
|
- if (Objects.nonNull(map.get("orgId"))) {
|
|
|
|
- orgId = Long.parseLong(String.valueOf(map.get("orgId")));
|
|
|
|
|
|
+ if (Objects.nonNull(mapParameter.get("orgId"))) {
|
|
|
|
+ orgId = Long.parseLong(String.valueOf(mapParameter.get("orgId")));
|
|
}
|
|
}
|
|
Long examId = null;
|
|
Long examId = null;
|
|
- if (Objects.nonNull(map.get("examId"))) {
|
|
|
|
- examId = Long.parseLong(String.valueOf(map.get("examId")));
|
|
|
|
|
|
+ if (Objects.nonNull(mapParameter.get("examId"))) {
|
|
|
|
+ examId = Long.parseLong(String.valueOf(mapParameter.get("examId")));
|
|
}
|
|
}
|
|
if (Objects.isNull(orgId) && Objects.isNull(examId)) {
|
|
if (Objects.isNull(orgId) && Objects.isNull(examId)) {
|
|
throw new BusinessException("机构id或考试id必须有一个");
|
|
throw new BusinessException("机构id或考试id必须有一个");
|
|
}
|
|
}
|
|
- String identity = String.valueOf(map.get("identity"));
|
|
|
|
- String password = String.valueOf(map.get("password"));
|
|
|
|
|
|
+ String identity = String.valueOf(mapParameter.get("identity"));
|
|
|
|
+ String password = String.valueOf(mapParameter.get("password"));
|
|
|
|
|
|
QueryWrapper<TEStudent> wrapper = new QueryWrapper<>();
|
|
QueryWrapper<TEStudent> wrapper = new QueryWrapper<>();
|
|
wrapper.lambda().eq(TEStudent::getIdentity, identity);
|
|
wrapper.lambda().eq(TEStudent::getIdentity, identity);
|