mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 20:06:51 +08:00
Merge branch 'master' of codeup.aliyun.com:6265f483e4166464dc2f9c14/boeu/baseservers
This commit is contained in:
@@ -23,6 +23,7 @@ import com.xboe.constants.Constants;
|
|||||||
import com.xboe.core.exception.XaskException;
|
import com.xboe.core.exception.XaskException;
|
||||||
import com.xboe.core.orm.FieldFilters;
|
import com.xboe.core.orm.FieldFilters;
|
||||||
import com.xboe.core.orm.QueryBuilder;
|
import com.xboe.core.orm.QueryBuilder;
|
||||||
|
import com.xboe.core.orm.UpdateBuilder;
|
||||||
import com.xboe.module.teacher.dao.TeacherDao;
|
import com.xboe.module.teacher.dao.TeacherDao;
|
||||||
import com.xboe.module.teacher.dto.TeacherSyncUpdateDto;
|
import com.xboe.module.teacher.dto.TeacherSyncUpdateDto;
|
||||||
import com.xboe.module.teacher.entity.Teacher;
|
import com.xboe.module.teacher.entity.Teacher;
|
||||||
@@ -208,12 +209,20 @@ public class TeacherServiceImpl implements ITeacherService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateTeacher(TeacherFiledVo entity) {
|
public void updateTeacher(TeacherFiledVo entity) {
|
||||||
Teacher teacher = dao.get(entity.getId());
|
|
||||||
teacher.setPhoto(entity.getPhoto());
|
// Teacher teacher = dao.get(entity.getId());
|
||||||
teacher.setWorkExperience(entity.getWorkExperience());
|
// teacher.setPhoto(entity.getPhoto());
|
||||||
teacher.setCourses(entity.getCourses());
|
// teacher.setWorkExperience(entity.getWorkExperience());
|
||||||
teacher.setExpertise(entity.getExpertise());
|
// teacher.setCourses(entity.getCourses());
|
||||||
dao.update(teacher);
|
// teacher.setExpertise(entity.getExpertise());
|
||||||
|
// dao.update(teacher);
|
||||||
|
//修改为以下方式,不影响其它字段的
|
||||||
|
dao.updateMultiFieldById(entity.getId(),
|
||||||
|
UpdateBuilder.create("photo", entity.getPhoto()),
|
||||||
|
UpdateBuilder.create("workExperience", entity.getWorkExperience()),
|
||||||
|
UpdateBuilder.create("courses", entity.getCourses()),
|
||||||
|
UpdateBuilder.create("expertise", entity.getExpertise())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.xboe.core.CurrentUser;
|
|||||||
import com.xboe.core.IAuthorizationToken;
|
import com.xboe.core.IAuthorizationToken;
|
||||||
import com.xboe.core.JsonResponse;
|
import com.xboe.core.JsonResponse;
|
||||||
import com.xboe.core.api.ApiBaseController;
|
import com.xboe.core.api.ApiBaseController;
|
||||||
|
import com.xboe.data.dto.UserData;
|
||||||
import com.xboe.data.outside.IOutSideDataService;
|
import com.xboe.data.outside.IOutSideDataService;
|
||||||
import com.xboe.module.teacher.entity.Teacher;
|
import com.xboe.module.teacher.entity.Teacher;
|
||||||
import com.xboe.module.teacher.service.ITeacherService;
|
import com.xboe.module.teacher.service.ITeacherService;
|
||||||
@@ -66,11 +67,11 @@ public class PortalConsoleApi extends ApiBaseController{
|
|||||||
return error("账号错误,无此账号");
|
return error("账号错误,无此账号");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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());
|
||||||
Organization org = null;
|
Organization org = null;
|
||||||
@@ -106,22 +107,26 @@ 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());
|
||||||
map.put("sex",user.getGender());
|
map.put("sex",user.getGender());
|
||||||
|
|||||||
@@ -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"));
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
|||||||
// }
|
// }
|
||||||
if(cuser==null) {
|
if(cuser==null) {
|
||||||
// 判断token中获取的值是否当前系统的,不是则告诉前端来获取
|
// 判断token中获取的值是否当前系统的,不是则告诉前端来获取
|
||||||
if(tokenData.containsKey("userId")) {
|
if(tokenData.containsKey("uId")) {
|
||||||
error(response,302,"系统无当前用户,需同步");
|
error(response,302,"token 错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
error(response,401,"请重新登录");
|
error(response,401,"请重新登录");
|
||||||
@@ -127,9 +127,9 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
|||||||
|
|
||||||
private CurrentUser convertByMap(Map<String, String> data) {
|
private CurrentUser convertByMap(Map<String, String> data) {
|
||||||
if(!data.containsKey("aid")) {
|
if(!data.containsKey("aid")) {
|
||||||
//在这里写根据原系统UserId去查询用户信息。然后生成CurrentUser 返回就可以了
|
//修改为新的接口,通过uId获取
|
||||||
if(data.containsKey("userId")) {
|
if(data.containsKey("uId")) {
|
||||||
User user = userService.getBySysId(data.get("userId"));
|
User user = userService.get(data.get("uId"));
|
||||||
if(user != null){
|
if(user != null){
|
||||||
CurrentUser cuser=new CurrentUser();
|
CurrentUser cuser=new CurrentUser();
|
||||||
cuser.setAccountId(user.getId());
|
cuser.setAccountId(user.getId());
|
||||||
@@ -141,8 +141,22 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if(data.containsKey("userId")) {
|
||||||
|
// User user = userService.getBySysId(data.get("userId"));
|
||||||
|
// if(user != null){
|
||||||
|
// CurrentUser cuser=new CurrentUser();
|
||||||
|
// cuser.setAccountId(user.getId());
|
||||||
|
// cuser.setName(user.getName());
|
||||||
|
// cuser.setCode(user.getUserNo());
|
||||||
|
// cuser.setDepartId(user.getDepartId());
|
||||||
|
// return cuser;
|
||||||
|
// }else {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
//此处用于本地登录的情况,直接从token中获取,不需要再查询一次了
|
||||||
CurrentUser cuser=new CurrentUser();
|
CurrentUser cuser=new CurrentUser();
|
||||||
cuser.setAccountId(data.get("aid"));
|
cuser.setAccountId(data.get("aid"));
|
||||||
cuser.setName(data.get("name"));
|
cuser.setName(data.get("name"));
|
||||||
|
|||||||
Reference in New Issue
Block a user