|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
import cn.jlw.Exception.GlobalException;
|
|
|
|
|
import cn.jlw.util.JWTUtil;
|
|
|
|
|
import cn.jlw.util.JsonMergeUtil;
|
|
|
|
|
import cn.jlw.util.SztzjyRequestUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
@ -60,9 +61,22 @@ public class UsersService extends CoreBaseService<Users> {
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
|
public Users login(UsersQuery usersQuery) {
|
|
|
|
|
if (StringUtils.isEmpty(usersQuery.getUsername()) || StringUtils.isEmpty(usersQuery.getPassword())) {
|
|
|
|
|
if ((StringUtils.isEmpty(usersQuery.getUsername()) || StringUtils.isEmpty(usersQuery.getPassword()))
|
|
|
|
|
&& StringUtils.isEmpty(usersQuery.getKey())) {
|
|
|
|
|
throw new GlobalException("用户名或密码不能为空");
|
|
|
|
|
}
|
|
|
|
|
if (!StringUtils.isEmpty(usersQuery.getKey())) {
|
|
|
|
|
// 单独登录
|
|
|
|
|
final Map<String, Object> decode = JWTUtil.decode(usersQuery.getKey());
|
|
|
|
|
final String username = (String) decode.get("username");
|
|
|
|
|
final String password = (String) decode.get("password");
|
|
|
|
|
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
|
|
|
|
|
throw new GlobalException("单点登录失败,token解析异常!");
|
|
|
|
|
}
|
|
|
|
|
usersQuery.setUsername(username);
|
|
|
|
|
usersQuery.setPassword(password);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final Users user = loginByPlatform(usersQuery.getUsername(), usersQuery.getPassword()); // 通过智云登录并获取用户信息
|
|
|
|
|
// final Users user = loginByLocal(usersQuery.getUsername(), usersQuery.getPassword()); // 无法连接智云 使用本地登录
|
|
|
|
|
//之前的系统用的是token+缓存,我们这次改为用session来存储数据
|
|
|
|
|