|
@@ -41,21 +41,40 @@ public class AlarmUserController {
|
|
String obj = requestData.getData().toString();
|
|
String obj = requestData.getData().toString();
|
|
String jsonData = RSAService.translateByPublicKey(obj, requestData.getPublicKey());
|
|
String jsonData = RSAService.translateByPublicKey(obj, requestData.getPublicKey());
|
|
AlarmUser user = JSONObject.parseObject(jsonData, AlarmUser.class);
|
|
AlarmUser user = JSONObject.parseObject(jsonData, AlarmUser.class);
|
|
-
|
|
|
|
- AlarmUser dataUser = alarmUserService.login(user);
|
|
|
|
-
|
|
|
|
- if (dataUser != null) {
|
|
|
|
- String token = "";
|
|
|
|
- token = TokenUtil.createJwtToken(dataUser.getUserName());
|
|
|
|
- AlarmUser data = new AlarmUser();
|
|
|
|
- data.setChineseName(dataUser.getChineseName());
|
|
|
|
- data.setUserName(dataUser.getUserName());
|
|
|
|
- data.setId(dataUser.getId());
|
|
|
|
- data.setIdentity(dataUser.getIdentity());
|
|
|
|
- wrapper = ResponseWrapper.success("登陆成功", data);
|
|
|
|
- wrapper.setToken(token);
|
|
|
|
|
|
+ if (StringUtil.isNotBlank(user.getMark())) {
|
|
|
|
+ AlarmUser dbUser = alarmUserService.singleLogin(user); //单点登录
|
|
|
|
+ //单点登录
|
|
|
|
+ if (dbUser!=null) {
|
|
|
|
+ String token = "";
|
|
|
|
+ token = TokenUtil.createJwtToken(user.getUserName());
|
|
|
|
+ AlarmUser data = new AlarmUser();
|
|
|
|
+ data.setChineseName(dbUser.getChineseName());
|
|
|
|
+ data.setUserName(dbUser.getUserName());
|
|
|
|
+ data.setId(dbUser.getId());
|
|
|
|
+ data.setIdentity(dbUser.getIdentity());
|
|
|
|
+
|
|
|
|
+ wrapper = ResponseWrapper.success("登陆成功", data);
|
|
|
|
+ wrapper.setToken(token);
|
|
|
|
+ } else {
|
|
|
|
+ wrapper = ResponseWrapper.error("身份不合法");
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- wrapper = ResponseWrapper.error("用户名或密码错误");
|
|
|
|
|
|
+
|
|
|
|
+ AlarmUser dataUser = alarmUserService.login(user);
|
|
|
|
+
|
|
|
|
+ if (dataUser != null) {
|
|
|
|
+ String token = "";
|
|
|
|
+ token = TokenUtil.createJwtToken(dataUser.getUserName());
|
|
|
|
+ AlarmUser data = new AlarmUser();
|
|
|
|
+ data.setChineseName(dataUser.getChineseName());
|
|
|
|
+ data.setUserName(dataUser.getUserName());
|
|
|
|
+ data.setId(dataUser.getId());
|
|
|
|
+ data.setIdentity(dataUser.getIdentity());
|
|
|
|
+ wrapper = ResponseWrapper.success("登陆成功", data);
|
|
|
|
+ wrapper.setToken(token);
|
|
|
|
+ } else {
|
|
|
|
+ wrapper = ResponseWrapper.error("用户名或密码错误");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|