mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 11:26:50 +08:00
Merge branch 'preview' of codeup.aliyun.com:6265f483e4166464dc2f9c14/boeu/baseservers into release
This commit is contained in:
@@ -28,6 +28,10 @@ public class AccountDao extends BaseDao<Account> {
|
|||||||
return this.findOne(FieldFilters.eq("loginName", loginName), FieldFilters.eq("deleted", false));
|
return this.findOne(FieldFilters.eq("loginName", loginName), FieldFilters.eq("deleted", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Account findLoginBySysId(String sysId) {
|
||||||
|
return this.findOne(FieldFilters.eq("sysId", sysId),FieldFilters.eq("deleted", false));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查账号是否存在
|
* 检查账号是否存在
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -27,6 +27,13 @@ public interface IAccountService {
|
|||||||
*/
|
*/
|
||||||
Account getBySysId(String id);
|
Account getBySysId(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为登录获取用户账号
|
||||||
|
* @param sysId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Account findLoginBySysId(String sysId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按登录名查询账号
|
* 按登录名查询账号
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.xboe.account.service.impl;
|
package com.xboe.account.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -17,7 +18,6 @@ import com.xboe.account.service.IAccountService;
|
|||||||
import com.xboe.common.utils.MD5Util;
|
import com.xboe.common.utils.MD5Util;
|
||||||
import com.xboe.common.utils.StringUtil;
|
import com.xboe.common.utils.StringUtil;
|
||||||
import com.xboe.constants.CacheName;
|
import com.xboe.constants.CacheName;
|
||||||
import com.xboe.core.exception.DaoException;
|
|
||||||
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.UpdateBuilder;
|
import com.xboe.core.orm.UpdateBuilder;
|
||||||
@@ -140,4 +140,30 @@ public class AccountServiceImpl implements IAccountService {
|
|||||||
public void delete(Account account) {
|
public void delete(Account account) {
|
||||||
dao.setDeleted(account.getId());
|
dao.setDeleted(account.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Account findLoginBySysId(String sysId) {
|
||||||
|
|
||||||
|
//重复用户的问题
|
||||||
|
List<Account> list=dao.findList(FieldFilters.eq("sysId", sysId));
|
||||||
|
if(list.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Account account=null;
|
||||||
|
for(Account a:list) {
|
||||||
|
if(!a.getDeleted() && a.getStatus()<Account.STATUS_DEAD) {
|
||||||
|
account=a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(account!=null) {
|
||||||
|
Account result = new Account();
|
||||||
|
BeanUtils.copyProperties(account,result,"passKey","passValue");
|
||||||
|
return result;
|
||||||
|
}else{
|
||||||
|
account=list.get(0);
|
||||||
|
Account result = new Account();
|
||||||
|
BeanUtils.copyProperties(account,result,"passKey","passValue");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ public class PortalConsoleApi extends ApiBaseController{
|
|||||||
Map<String,Object> map=new HashMap<String,Object>();
|
Map<String,Object> map=new HashMap<String,Object>();
|
||||||
try {
|
try {
|
||||||
Account account = accountService.get(getCurrent().getAccountId());
|
Account account = accountService.get(getCurrent().getAccountId());
|
||||||
|
if(account==null) {
|
||||||
|
log.error("未找到账号id【"+getCurrent().getAccountId()+"】对应的用户");
|
||||||
|
return error("账号错误,无此账号");
|
||||||
|
}
|
||||||
|
|
||||||
User user = userService.get(getCurrent().getAccountId());
|
User user = userService.get(getCurrent().getAccountId());
|
||||||
Organization org = null;
|
Organization org = null;
|
||||||
String departName = "";
|
String departName = "";
|
||||||
|
|||||||
@@ -209,18 +209,27 @@ public class PortalLoginApi extends ApiBaseController {
|
|||||||
//检查系统用户是否存在
|
//检查系统用户是否存在
|
||||||
account = accountService.get(tokenInfo.get("aid"));
|
account = accountService.get(tokenInfo.get("aid"));
|
||||||
}else{
|
}else{
|
||||||
|
log.error("查询用户kid【"+tokenInfo.get("userId")+"】");
|
||||||
// 没有aid则判断是否已同步的用户,不是则同步
|
// 没有aid则判断是否已同步的用户,不是则同步
|
||||||
if(StringUtil.isNotBlank(tokenInfo.get("userId"))){
|
if(StringUtil.isNotBlank(tokenInfo.get("userId"))){
|
||||||
account = accountService.getBySysId(tokenInfo.get("userId"));
|
account = accountService.findLoginBySysId(tokenInfo.get("userId"));
|
||||||
if(account == null){ //系统中无此用户,需要同步用户
|
if(account == null){ //系统中无此用户,需要同步用户
|
||||||
|
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("登录失败,未同步用户");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
if(account.getDeleted()!=null && account.getDeleted()) {
|
||||||
|
return error("登录失败,用户已删除,请与管理员联系");
|
||||||
|
}else if(account.getStatus()!=null && account.getStatus()==Account.STATUS_DEAD) {
|
||||||
|
return error("登录失败,用户已停用,请与管理员联系");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
return error("token不合法");
|
return error("token不合法");
|
||||||
|
|||||||
@@ -89,14 +89,37 @@ public class MainDbSyncServiceImpl implements IMainDbSyncService {
|
|||||||
//System.out.println("dto.name="+dto.getName());
|
//System.out.println("dto.name="+dto.getName());
|
||||||
Integer employeeStatus=dto.getEmployeeStatus();
|
Integer employeeStatus=dto.getEmployeeStatus();
|
||||||
//同一个用户工号对应 多个kid的情况,所以直接根据kid查询是不对的,同步过来的,使用sysId查询
|
//同一个用户工号对应 多个kid的情况,所以直接根据kid查询是不对的,同步过来的,使用sysId查询
|
||||||
|
MainAccount a=null;
|
||||||
MainUser user = userDao.get(dto.getId());
|
MainUser user = userDao.get(dto.getId());
|
||||||
if(user!=null) {
|
if(user!=null) {
|
||||||
//更新用户信息,更新账号信息
|
//更新用户信息,更新账号信息
|
||||||
user.setSysId(dto.getKid());
|
user.setSysId(dto.getKid());
|
||||||
//hasUser.setBirthday(null);
|
user.setName(dto.getName());
|
||||||
|
user.setDepartId(dto.getDepartId());
|
||||||
|
user.setDescription(dto.getDescription());
|
||||||
|
user.setDomainId(dto.getDomainId());
|
||||||
|
user.setDuty(dto.getDuty());
|
||||||
|
user.setSysId(dto.getKid());
|
||||||
|
user.setLearningDuration(dto.getLearningDuration());
|
||||||
|
user.setName(dto.getName());
|
||||||
|
user.setRank(dto.getRank());
|
||||||
|
user.setSassId(dto.getSassId());
|
||||||
|
user.setTelephoneNo(dto.getTelephoneNo());
|
||||||
|
user.setUserNo(dto.getUserNo());
|
||||||
|
user.setGender(dto.toGenderInteger()==3? 1:dto.toGenderInteger());
|
||||||
|
user.setGraduatedFrom(dto.getGraduatedFrom());
|
||||||
|
user.setGraduatedMajor(dto.getGraduatedMajor());
|
||||||
|
user.setHighestEducation(dto.getHighestEducation());
|
||||||
|
user.setHomePhoneNo(dto.getHomePhoneNo());
|
||||||
|
user.setIdNumber(dto.getIdNumber());
|
||||||
|
user.setMobileNo(dto.getMobile());
|
||||||
|
user.setNationality(dto.getNationality());
|
||||||
|
userDao.saveAndFlush(user);
|
||||||
|
//账号没有修改的字段,所以不进行更新操作了
|
||||||
|
//a=accountDao.getById(dto.getId());
|
||||||
}else {
|
}else {
|
||||||
//账号信息
|
//账号信息
|
||||||
MainAccount a=new MainAccount();
|
a=new MainAccount();
|
||||||
//同步过程中一样,可以不一样。因为此系统当前是一致的,所以统一使用一个
|
//同步过程中一样,可以不一样。因为此系统当前是一致的,所以统一使用一个
|
||||||
a.setId(dto.getId());
|
a.setId(dto.getId());
|
||||||
a.setAvatar(dto.getAvatar());
|
a.setAvatar(dto.getAvatar());
|
||||||
|
|||||||
Reference in New Issue
Block a user