mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-14 21:36:48 +08:00
修改登录控制及用户初始化值
This commit is contained in:
@@ -70,7 +70,7 @@ public class PortalConsoleApi extends ApiBaseController{
|
||||
UserData userData = outsideDataService.getUserInfoByUserId(null);
|
||||
if(userData==null) {
|
||||
log.error("通过api获取用用户信息错误【"+getCurrent().getAccountId()+"】对应的用户");
|
||||
return error("未能获取当前用户信息");
|
||||
//return error("未能获取当前用户信息");
|
||||
}
|
||||
|
||||
User user = userService.get(getCurrent().getAccountId());
|
||||
@@ -107,21 +107,25 @@ public class PortalConsoleApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
|
||||
//以下是使用的接口数据判断身份
|
||||
// int utype=1;//仅仅是学员
|
||||
// if(userData.getTeacher()) {
|
||||
// utype=2;
|
||||
// }
|
||||
// if(userData.getAdminType()>0) {
|
||||
// if(utype==2) {
|
||||
// utype=5;//是管理员,又是教师
|
||||
// }else {
|
||||
// utype=3;
|
||||
// }
|
||||
// if(userData!=null) {
|
||||
//
|
||||
// if(userData.getTeacher()) {
|
||||
// utype=2;
|
||||
// }
|
||||
// if(userData.getAdminType()>0) {
|
||||
// if(utype==2) {
|
||||
// utype=5;//是管理员,又是教师
|
||||
// }else {
|
||||
// utype=3;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
map.put("aid",account.getId());
|
||||
map.put("sysId",user.getSysId());
|
||||
map.put("adminType",userData.getAdminType());//管理员类型,1表默认管理员,2表非默认管理员,0表不是管理员
|
||||
map.put("adminType",userData==null? 0:userData.getAdminType());//管理员类型,1表默认管理员,2表非默认管理员,0表不是管理员
|
||||
//map.put("adminType",0);
|
||||
map.put("companyId",user.getCompanyId());
|
||||
map.put("name",user.getName());
|
||||
|
||||
@@ -263,35 +263,42 @@ public class PortalLoginApi extends ApiBaseController {
|
||||
return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error");
|
||||
}
|
||||
Account account = null;
|
||||
if(StringUtil.isNotBlank(tokenInfo.get("aid"))){
|
||||
String aid=tokenInfo.get("aid");
|
||||
if(StringUtil.isBlank(aid)){
|
||||
aid=tokenInfo.get("uId");;
|
||||
}
|
||||
if(StringUtil.isBlank(aid)){
|
||||
return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error no uId");
|
||||
}
|
||||
if(StringUtil.isNotBlank(aid)){
|
||||
//检查系统用户是否存在
|
||||
account = accountService.get(tokenInfo.get("aid"));
|
||||
account = accountService.get(aid);
|
||||
}else{
|
||||
//log.error("查询用户kid【"+tokenInfo.get("userId")+"】");
|
||||
// 没有aid则判断是否已同步的用户,不是则同步
|
||||
if(StringUtil.isNotBlank(tokenInfo.get("userId"))){
|
||||
account = accountService.findLoginBySysId(tokenInfo.get("userId"));
|
||||
if(account == null){ //系统中无此用户,需要同步用户
|
||||
log.error("未找到【"+tokenInfo.get("userId")+"】的用户");
|
||||
UserVo fwUser = fwUserService.getById(tokenInfo.get("userId"));
|
||||
if(fwUser != null) {
|
||||
try {
|
||||
account = userService.syncUser(fwUser);
|
||||
} catch (Exception e) {
|
||||
log.error("boelogin同步用户错误:" + e.getMessage());
|
||||
return error("登录失败,未同步用户");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if(account.getDeleted()!=null && account.getDeleted()) {
|
||||
return error("登录失败,用户已删除,请与管理员联系");
|
||||
}else if(account.getStatus()!=null && account.getStatus()==Account.STATUS_DEAD) {
|
||||
return error("登录失败,用户已停用,请与管理员联系");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
return error("token不合法");
|
||||
}
|
||||
// //log.error("查询用户kid【"+tokenInfo.get("userId")+"】");
|
||||
// // 没有aid则判断是否已同步的用户,不是则同步
|
||||
// if(StringUtil.isNotBlank(tokenInfo.get("userId"))){
|
||||
// account = accountService.findLoginBySysId(tokenInfo.get("userId"));
|
||||
// if(account == null){ //系统中无此用户,需要同步用户
|
||||
// log.error("未找到【"+tokenInfo.get("userId")+"】的用户");
|
||||
// UserVo fwUser = fwUserService.getById(tokenInfo.get("userId"));
|
||||
// if(fwUser != null) {
|
||||
// try {
|
||||
// account = userService.syncUser(fwUser);
|
||||
// } catch (Exception e) {
|
||||
// log.error("boelogin同步用户错误:" + e.getMessage());
|
||||
// return error("登录失败,未同步用户");
|
||||
// }
|
||||
// }
|
||||
// }else {
|
||||
// if(account.getDeleted()!=null && account.getDeleted()) {
|
||||
// return error("登录失败,用户已删除,请与管理员联系");
|
||||
// }else if(account.getStatus()!=null && account.getStatus()==Account.STATUS_DEAD) {
|
||||
// return error("登录失败,用户已停用,请与管理员联系");
|
||||
// }
|
||||
// }
|
||||
// }else {
|
||||
// return error("token不合法");
|
||||
// }
|
||||
}
|
||||
if (account == null) {
|
||||
log.error("未找到用户的id:"+tokenInfo.get("userId"));
|
||||
|
||||
Reference in New Issue
Block a user