Search in sources :

Example 6 with UsrDptRelation

use of com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation in project tis by qlangtech.

the class UsrDptRelationDAOImpl method deleteByPrimaryKey.

public int deleteByPrimaryKey(String usrId) {
    UsrDptRelation key = new UsrDptRelation();
    key.setUsrId(usrId);
    return this.deleteRecords("usr_dpt_relation.ibatorgenerated_deleteByPrimaryKey", key);
}
Also used : UsrDptRelation(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation)

Example 7 with UsrDptRelation

use of com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation in project tis by qlangtech.

the class UsrDptRelationDAOImpl method loadFromWriteDB.

public UsrDptRelation loadFromWriteDB(String usrId) {
    UsrDptRelation key = new UsrDptRelation();
    key.setUsrId(usrId);
    UsrDptRelation record = this.loadFromWriterDB("usr_dpt_relation.ibatorgenerated_selectByPrimaryKey", key);
    return record;
}
Also used : UsrDptRelation(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation)

Example 8 with UsrDptRelation

use of com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation in project tis by qlangtech.

the class UserUtils method getUser.

public static final IUser getUser(final HttpServletRequest r, RunContext runContext) {
    TUser result = null;
    if (true || ManageUtils.isDaily()) {
        result = getMockUser(r, runContext);
        // return NOT_LOGIN_USER;
        return result;
    }
    final TISHttpServletRequestWrapper request = (TISHttpServletRequestWrapper) (((StrutsRequestWrapper) r).getRequest());
    HttpSession session = request.getSession();
    try {
        if ((result = getUserFromCache(request)) == null) {
            Cookie userCookie = request.getCookie(UserUtils.USER_TOKEN);
            if (userCookie != null && StringUtils.isNotEmpty(userCookie.getValue())) {
                UsrDptRelationCriteria query = new UsrDptRelationCriteria();
                query.createCriteria().andUserNameEqualTo(LoginAction.getDcodeUserName(userCookie.getValue()));
                for (UsrDptRelation usr : runContext.getUsrDptRelationDAO().selectByExample(query)) {
                    result = new TUser(usr, runContext);
                    session.setAttribute(USER_TOKEN_SESSION, result);
                    return result;
                }
            } else {
                return NOT_LOGIN_USER;
            }
        // SimpleSSOUser user = SimpleUserUtil.findUser(request);
        // result = new TUser(user.getEmpId(),
        // StringUtils.defaultIfEmpty(
        // user.getNickNameCn(), user.getLastName()), runContext);
        // result.setDepartment(user.getDepDesc());
        // result = new TUser("18097", "baisui", runContext);
        // result.setDepartment("manage");
        // 
        // // 阿里巴巴全局departmentId
        // result.setDepartmentid(123);
        // result.setWangwang("百岁");
        // result.setEmail("bvaisui@taobao.com");
        }
        return result;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : Cookie(javax.servlet.http.Cookie) UsrDptRelationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria) HttpSession(javax.servlet.http.HttpSession) StrutsRequestWrapper(org.apache.struts2.dispatcher.StrutsRequestWrapper) UsrDptRelation(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation)

Example 9 with UsrDptRelation

use of com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation in project tis by qlangtech.

the class UserUtils method getMockUser.

private static final TUser getMockUser(HttpServletRequest request, RunContext runContext) {
    if (DEFAULT_SUPER_USER == null) {
        UsrDptRelation usr = new UsrDptRelation();
        usr.setUsrId("9999");
        usr.setUserName("admin");
        DEFAULT_SUPER_USER = new TUser(usr, runContext, new SuperUserFetcher(runContext));
        DEFAULT_SUPER_USER.setDepartmentid(8);
        DEFAULT_SUPER_USER.setDepartment("管理");
    }
    return DEFAULT_SUPER_USER;
}
Also used : UsrDptRelation(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation)

Aggregations

UsrDptRelation (com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation)9 UsrDptRelationCriteria (com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria)5 Func (com.qlangtech.tis.manage.spring.aop.Func)2 Department (com.qlangtech.tis.manage.biz.dal.pojo.Department)1 Role (com.qlangtech.tis.manage.biz.dal.pojo.Role)1 Date (java.util.Date)1 Cookie (javax.servlet.http.Cookie)1 HttpSession (javax.servlet.http.HttpSession)1 StrutsRequestWrapper (org.apache.struts2.dispatcher.StrutsRequestWrapper)1