Search in sources :

Example 1 with DChildVo

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

the class DemoAction method assembleDelegateRelationship.

public Map<String, Object> assembleDelegateRelationship(long agentId, List<User> aList, List<User> bList) {
    Map<String, Object> nodeRoot = new HashMap<>();
    nodeRoot.put("name", transformStr(agentId));
    List<Object> childrenRoot = new ArrayList<>();
    nodeRoot.put("children", childrenRoot);
    Map<String, Object> node1_1 = new HashMap<>();
    childrenRoot.add(node1_1);
    node1_1.put("name", "直接玩家");
    List<Object> children1_1 = new ArrayList<>();
    node1_1.put("children", children1_1);
    // 直接玩家
    for (User user : aList) {
        DChildVo childVo = new DChildVo();
        childVo.setName(transformStr(user));
        childVo.setValue((int) user.getId());
        children1_1.add(childVo);
    }
    Map<String, Object> node1_2 = new HashMap<>();
    childrenRoot.add(node1_2);
    node1_2.put("name", "二级代理");
    List<Object> children1_2 = new ArrayList<>();
    node1_2.put("children", children1_2);
    // 二级代理
    for (User user : bList) {
        Map<String, Object> node2_x = new HashMap<>();
        node2_x.put("name", transformStr(user));
        children1_2.add(node2_x);
        List<Object> child2_x = new ArrayList<>();
        node2_x.put("children", child2_x);
        // //三级代理
        // for (int j = 100; j < 110; j++){
        // DChildVo childVo = new DChildVo();
        // childVo.setValue(j);
        // childVo.setName("三级代理" + j);
        // child2_x.add(childVo);
        // }
        AgentBean agentBean = RedisManager.getAgentRedisService().getAgentBean(user.getId());
        if (agentBean == null)
            continue;
        for (Long id : agentBean.getChildList()) {
            DChildVo dChildVo = new DChildVo();
            dChildVo.setName(transformStr(id));
            child2_x.add(dChildVo);
        }
    }
    return nodeRoot;
}
Also used : AgentBean(com.code.server.constant.game.AgentBean) DChildVo(com.code.server.login.vo.DChildVo)

Example 2 with DChildVo

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

the class DemoAction method assDemo.

public Map<String, Object> assDemo() {
    Map<String, Object> nodeRoot = new HashMap<>();
    nodeRoot.put("name", "self");
    List<Object> childrenRoot = new ArrayList<>();
    nodeRoot.put("children", childrenRoot);
    Map<String, Object> node1_1 = new HashMap<>();
    childrenRoot.add(node1_1);
    node1_1.put("name", "直接玩家");
    List<Object> children1_1 = new ArrayList<>();
    node1_1.put("children", children1_1);
    // 直接玩家
    for (int i = 0; i < 5; i++) {
        DChildVo childVo = new DChildVo();
        childVo.setName(i + "");
        childVo.setValue(i);
        children1_1.add(childVo);
    }
    Map<String, Object> node1_2 = new HashMap<>();
    childrenRoot.add(node1_2);
    node1_2.put("name", "二级代理");
    List<Object> children1_2 = new ArrayList<>();
    node1_2.put("children", children1_2);
    for (int i = 10; i < 20; i++) {
        Map<String, Object> node2_x = new HashMap<>();
        node2_x.put("name", i);
        children1_2.add(node2_x);
        List<Object> child2_x = new ArrayList<>();
        node2_x.put("children", child2_x);
        for (int j = 100; j < 110; j++) {
            DChildVo childVo = new DChildVo();
            childVo.setValue(j);
            childVo.setName("三级代理" + j);
            child2_x.add(childVo);
        }
    }
    // 二级代理
    for (int i = 5; i < 10; i++) {
        Map<String, Object> node2_x = new HashMap<>();
        node2_x.put("name", i + "");
        children1_2.add(node2_x);
        List<Object> child2_x = new ArrayList<>();
        node2_x.put("children", child2_x);
        // 三级代理
        for (int j = 100; j < 110; j++) {
            DChildVo childVo = new DChildVo();
            childVo.setValue(j);
            childVo.setName("三级代理" + j);
            child2_x.add(childVo);
        }
    }
    return nodeRoot;
}
Also used : DChildVo(com.code.server.login.vo.DChildVo)

Example 3 with DChildVo

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

the class DemoAction method ass.

public Map<String, Object> ass() {
    Map<String, Object> rs = new HashMap<>();
    rs.put("name", "flare");
    List<Object> list = new ArrayList<>();
    rs.put("children", list);
    Map<String, Object> inner = new HashMap<>();
    list.add(inner);
    inner.put("name", "analytics");
    List<Object> analytics = new ArrayList<>();
    inner.put("children", analytics);
    Map<String, Object> map = new HashMap<>();
    map.put("name", "cluster");
    analytics.add(map);
    List<Object> cluster = new ArrayList<>();
    map.put("children", cluster);
    for (int i = 0; i < 35; i++) {
        DChildVo childVo = new DChildVo();
        childVo.setName(i + "");
        childVo.setValue(i);
        cluster.add(childVo);
    }
    return rs;
}
Also used : DChildVo(com.code.server.login.vo.DChildVo)

Aggregations

DChildVo (com.code.server.login.vo.DChildVo)3 AgentBean (com.code.server.constant.game.AgentBean)1