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