|
@@ -37,10 +37,29 @@ public class UserAuthRestController {
|
|
|
private BaseInfoService baseInfoService;
|
|
|
|
|
|
@ApiOperation(value = "登录接口", notes = "参数accountType值说明:学生身份证号类型=STUDENT_IDENTITY_NUMBER,学生学号类型=STUDENT_CODE,学生手机号类型=STUDENT_PHONE")
|
|
|
- @RequestMapping(value = {"/user/login","/user/verify"}, method = {RequestMethod.GET, RequestMethod.POST})
|
|
|
+ @RequestMapping(value = "/user/login", method = {RequestMethod.GET, RequestMethod.POST})
|
|
|
public Result<UserInfo> login(@RequestParam String account, @RequestParam String password, @RequestParam String accountType, @RequestParam(required = false) Long rootOrgId,
|
|
|
@RequestParam(required = false) String domain, @RequestHeader String deviceId) throws Exception {
|
|
|
- LoginInfo loginInfo = new LoginInfo(account, password, accountType, rootOrgId, domain, deviceId);
|
|
|
+ LoginInfo loginInfo = new LoginInfo(account, password, accountType, rootOrgId, domain, deviceId, null);
|
|
|
+ Result<UserInfo> result = userAuthService.login(loginInfo);
|
|
|
+ if (result.isSuccess() && result.getData() != null) {
|
|
|
+ //登录成功后缓存Token信息
|
|
|
+ UserInfo userInfo = result.getData();
|
|
|
+ loginInfo.setUserName(userInfo.getDisplayName());
|
|
|
+ loginInfo.setKey(userInfo.getKey());
|
|
|
+ loginInfo.setToken(userInfo.getToken());
|
|
|
+ loginInfo.setAppToken(userInfo.getToken());
|
|
|
+ userAuthService.cacheLoginInfo(loginInfo, userInfo.getKey());
|
|
|
+ log.info(String.format("key:%s token:%s", userInfo.getKey(), userInfo.getToken()));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "验证码接口", notes = "参数accountType值说明:学生身份证号类型=STUDENT_IDENTITY_NUMBER,学生学号类型=STUDENT_CODE,学生手机号类型=STUDENT_PHONE")
|
|
|
+ @RequestMapping(value = "/user/verify", method = {RequestMethod.GET, RequestMethod.POST})
|
|
|
+ public Result<UserInfo> verifyLogin(@RequestParam String account, @RequestParam String smsCode, @RequestParam String accountType, @RequestParam(required = false) Long rootOrgId,
|
|
|
+ @RequestParam(required = false) String domain, @RequestHeader String deviceId) throws Exception {
|
|
|
+ LoginInfo loginInfo = new LoginInfo(account, null, accountType, rootOrgId, domain, deviceId, smsCode);
|
|
|
Result<UserInfo> result = userAuthService.login(loginInfo);
|
|
|
if (result.isSuccess() && result.getData() != null) {
|
|
|
//登录成功后缓存Token信息
|