Search in sources :

Example 1 with TwoLevelInfoVo

use of com.code.server.login.vo.TwoLevelInfoVo in project summer by foxsugar.

the class DelegateRelataionAction method fetchOneLevelDelegate.

@AuthChecker
@RequestMapping("/fetch2Delegate")
public AgentResponse fetchOneLevelDelegate() {
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    HttpServletRequest request = attributes.getRequest();
    long agentId = AgentUtil.getAgentByRequest(request);
    List<TwoLevelInfoVo> list = delegateRelataionService.fetchTwoLevelDelegateList(agentId);
    Map<String, Object> result = new HashMap<>();
    result.put("result", list);
    AgentResponse agentResponse = new AgentResponse(200, result);
    return agentResponse;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HashMap(java.util.HashMap) ServletRequestAttributes(org.springframework.web.context.request.ServletRequestAttributes) TwoLevelInfoVo(com.code.server.login.vo.TwoLevelInfoVo) AuthChecker(com.code.server.login.anotation.AuthChecker) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with TwoLevelInfoVo

use of com.code.server.login.vo.TwoLevelInfoVo in project summer by foxsugar.

the class DelegateRelataionServiceImpl method fetchTwoLevelDelegateList.

@Override
public List<TwoLevelInfoVo> fetchTwoLevelDelegateList(long agentId) {
    AgentBean agentBean = RedisManager.getAgentRedisService().getAgentBean(agentId);
    logger.info("fetchTwoLevelDelegateList:agentBean{}", agentBean);
    List<Long> aList = new ArrayList<>();
    for (long uid : agentBean.getChildList()) {
        if (RedisManager.getAgentRedisService().isExit(uid)) {
            aList.add(uid);
        }
    }
    List<TwoLevelInfoVo> result = new ArrayList<>();
    List<User> userList = this.userDao.findUsersByIdIn(aList);
    for (User user : userList) {
        TwoLevelInfoVo twoLevelInfoVo = new TwoLevelInfoVo();
        twoLevelInfoVo.setImage(user.getImage() + "/96");
        twoLevelInfoVo.setUsername(user.getUsername());
        twoLevelInfoVo.setUid(user.getId());
        result.add(twoLevelInfoVo);
    }
    return result;
}
Also used : AgentBean(com.code.server.constant.game.AgentBean) User(com.code.server.db.model.User) ArrayList(java.util.ArrayList) TwoLevelInfoVo(com.code.server.login.vo.TwoLevelInfoVo)

Aggregations

TwoLevelInfoVo (com.code.server.login.vo.TwoLevelInfoVo)2 AgentBean (com.code.server.constant.game.AgentBean)1 User (com.code.server.db.model.User)1 AuthChecker (com.code.server.login.anotation.AuthChecker)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ServletRequestAttributes (org.springframework.web.context.request.ServletRequestAttributes)1