Search in sources :

Example 1 with AgileSysUser

use of com.jeeagile.system.entity.AgileSysUser in project jeeagile by jeeagile.

the class AgileUserDetailsServiceImpl method userLogin.

@Override
public AgileBaseUser userLogin(String loginName, String userPassword) {
    try {
        AgileSysUser agileSysUser = this.getAgileSysUser(loginName);
        if (agileSysUser == null) {
            throw new AgileAuthException("用户《" + loginName + "》不存在,请核实!");
        }
        this.checkAgileSysUser(agileSysUser);
        String md5Password = AgileSecurityUtil.encryptPassword(userPassword);
        if (!md5Password.equals(agileSysUser.getUserPwd())) {
            throw new AgileAuthException(AgileResultCode.FAIL_USER_PWD, "用户密码错误!");
        }
        return getAgileUserData(agileSysUser);
    } catch (AgileBaseException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new AgileAuthException("用户登录异常!");
    }
}
Also used : AgileBaseException(com.jeeagile.core.exception.AgileBaseException) AgileSysUser(com.jeeagile.system.entity.AgileSysUser) AgileAuthException(com.jeeagile.core.exception.AgileAuthException) AgileAuthException(com.jeeagile.core.exception.AgileAuthException) AgileBaseException(com.jeeagile.core.exception.AgileBaseException)

Example 2 with AgileSysUser

use of com.jeeagile.system.entity.AgileSysUser in project jeeagile by jeeagile.

the class AgileSysPersonServiceImpl method updateUserAvatar.

@Override
public boolean updateUserAvatar(String userAvatar) {
    AgileSysUser agileSysUser = new AgileSysUser();
    agileSysUser.setId(AgileSecurityContext.getCurrentUserId());
    agileSysUser.setUserAvatar(userAvatar);
    return agileSysUserService.updateById(agileSysUser);
}
Also used : AgileSysUser(com.jeeagile.system.entity.AgileSysUser)

Example 3 with AgileSysUser

use of com.jeeagile.system.entity.AgileSysUser in project jeeagile by jeeagile.

the class AgileSysPersonServiceImpl method updatePersonInfo.

@Override
public boolean updatePersonInfo(AgileUpdatePerson agileUpdatePerson) {
    AgileBaseUser userData = getCurrentUserData();
    AgileSysUser agileSysUser = new AgileSysUser();
    BeanUtils.copyProperties(agileUpdatePerson, agileSysUser);
    agileSysUser.setId(userData.getUserId());
    return agileSysUserService.updateById(agileSysUser);
}
Also used : AgileSysUser(com.jeeagile.system.entity.AgileSysUser) AgileBaseUser(com.jeeagile.core.security.user.AgileBaseUser)

Example 4 with AgileSysUser

use of com.jeeagile.system.entity.AgileSysUser in project jeeagile by jeeagile.

the class AgileSysPersonServiceImpl method updatePersonPwd.

@Override
public boolean updatePersonPwd(AgileUpdatePwd agileUpdatePwd) {
    AgileBaseUser userData = getCurrentUserData();
    AgileSysUser oldSysUser = agileSysUserService.getById(userData.getUserId());
    String oldUserPwd = AgileSecurityUtil.encryptPassword(agileUpdatePwd.getOldPwd());
    String newUserPwd = AgileSecurityUtil.encryptPassword(agileUpdatePwd.getNewPwd());
    if (oldSysUser.getUserPwd().equals(oldUserPwd)) {
        AgileSysUser newSysUser = new AgileSysUser();
        newSysUser.setId(oldSysUser.getId());
        newSysUser.setUserPwd(newUserPwd);
        return agileSysUserService.updateById(newSysUser);
    } else {
        throw new AgileValidateException("输入的老密码有误,请确认!");
    }
}
Also used : AgileValidateException(com.jeeagile.core.exception.AgileValidateException) AgileSysUser(com.jeeagile.system.entity.AgileSysUser) AgileBaseUser(com.jeeagile.core.security.user.AgileBaseUser)

Example 5 with AgileSysUser

use of com.jeeagile.system.entity.AgileSysUser in project jeeagile by jeeagile.

the class AgileSysPersonServiceImpl method getPersonInfo.

@Override
public AgilePersonInfo getPersonInfo() {
    AgilePersonInfo agilePersonInfo = new AgilePersonInfo();
    AgileBaseUser userData = getCurrentUserData();
    AgileSysUser agileSysUser = agileSysUserService.getById(userData.getUserId());
    if (agileSysUser != null && AgileStringUtil.isNotEmpty(agileSysUser.getId())) {
        BeanUtils.copyProperties(agileSysUser, agilePersonInfo);
        agilePersonInfo.setDeptName(userData.getDeptName());
        List<String> roleNameList = agileSysPersonMapper.getRoleNameByUserId(agileSysUser.getId());
        List<String> postNameList = agileSysPersonMapper.getPostNameByUserId(agileSysUser.getId());
        agilePersonInfo.setRoleNameList(roleNameList);
        agilePersonInfo.setPostNameList(postNameList);
    }
    return agilePersonInfo;
}
Also used : AgilePersonInfo(com.jeeagile.system.vo.AgilePersonInfo) AgileSysUser(com.jeeagile.system.entity.AgileSysUser) AgileBaseUser(com.jeeagile.core.security.user.AgileBaseUser)

Aggregations

AgileSysUser (com.jeeagile.system.entity.AgileSysUser)10 AgileAuthException (com.jeeagile.core.exception.AgileAuthException)3 AgileBaseException (com.jeeagile.core.exception.AgileBaseException)3 AgileBaseUser (com.jeeagile.core.security.user.AgileBaseUser)3 AgileValidateException (com.jeeagile.core.exception.AgileValidateException)1 AgilePersonInfo (com.jeeagile.system.vo.AgilePersonInfo)1