Search in sources :

Example 1 with OrgGroupVo

use of com.ngtesting.platform.vo.OrgGroupVo in project ngtesting-platform by aaronchen2k.

the class OrgGroupServiceImpl method genVos.

@Override
public List<OrgGroupVo> genVos(List<TestOrgGroup> pos) {
    List<OrgGroupVo> vos = new LinkedList<OrgGroupVo>();
    for (TestOrgGroup po : pos) {
        OrgGroupVo vo = genVo(po);
        vos.add(vo);
    }
    return vos;
}
Also used : TestOrgGroup(com.ngtesting.platform.entity.TestOrgGroup) OrgGroupVo(com.ngtesting.platform.vo.OrgGroupVo) LinkedList(java.util.LinkedList)

Example 2 with OrgGroupVo

use of com.ngtesting.platform.vo.OrgGroupVo in project ngtesting-platform by aaronchen2k.

the class OrgGroupServiceImpl method genVo.

// @Override
// public void initDefaultBasicDataPers(TestOrg org) {
// String [] groups = new String[]{"测试主管","测试设计","测试执行"};
// for(String name : groups) {
// TestOrgGroup po = new TestOrgGroup();
// po.setName(name);
// po.setOrgId(org.getId());
// saveOrUpdate(po);
// }
// }
@Override
public OrgGroupVo genVo(TestOrgGroup group) {
    OrgGroupVo vo = new OrgGroupVo();
    BeanUtilEx.copyProperties(vo, group);
    return vo;
}
Also used : OrgGroupVo(com.ngtesting.platform.vo.OrgGroupVo)

Example 3 with OrgGroupVo

use of com.ngtesting.platform.vo.OrgGroupVo in project ngtesting-platform by aaronchen2k.

the class OrgGroupAction method list.

@AuthPassport(validate = true)
@RequestMapping(value = "list", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> list(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    Long orgId = userVo.getDefaultOrgId();
    String keywords = json.getString("keywords");
    String disabled = json.getString("disabled");
    int page = json.getInteger("page") == null ? 0 : json.getInteger("page") - 1;
    int pageSize = json.getInteger("pageSize") == null ? Constant.PAGE_SIZE : json.getInteger("pageSize");
    Page pageData = orgGroupService.listByPage(orgId, keywords, disabled, page, pageSize);
    List<OrgGroupVo> vos = orgGroupService.genVos(pageData.getItems());
    ret.put("collectionSize", pageData.getTotal());
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) RelationOrgGroupUserVo(com.ngtesting.platform.vo.RelationOrgGroupUserVo) HashMap(java.util.HashMap) OrgGroupVo(com.ngtesting.platform.vo.OrgGroupVo) JSONObject(com.alibaba.fastjson.JSONObject) Page(com.ngtesting.platform.vo.Page) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with OrgGroupVo

use of com.ngtesting.platform.vo.OrgGroupVo in project ngtesting-platform by aaronchen2k.

the class UserAndGroupAction method search.

@AuthPassport(validate = true)
@RequestMapping(value = "search", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> search(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    Long orgId = json.getLong("orgId");
    String keywords = json.getString("keywords");
    JSONArray exceptIds = json.getJSONArray("exceptIds");
    List userPos = userService.search(orgId, keywords, exceptIds);
    List<UserVo> userVos = userService.genVos(userPos);
    List groupPos = orgGroupService.search(orgId, keywords, exceptIds);
    List<OrgGroupVo> groupVos = orgGroupService.genVos(groupPos);
    List<Object> vos = new ArrayList<>();
    vos.addAll(groupVos);
    vos.addAll(userVos);
    ret.put("data", vos);
    ret.put("code", RespCode.SUCCESS.getCode());
    return ret;
}
Also used : HashMap(java.util.HashMap) OrgGroupVo(com.ngtesting.platform.vo.OrgGroupVo) JSONArray(com.alibaba.fastjson.JSONArray) ArrayList(java.util.ArrayList) UserVo(com.ngtesting.platform.vo.UserVo) JSONObject(com.alibaba.fastjson.JSONObject) ArrayList(java.util.ArrayList) List(java.util.List) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 5 with OrgGroupVo

use of com.ngtesting.platform.vo.OrgGroupVo in project ngtesting-platform by aaronchen2k.

the class OrgGroupAction method get.

@AuthPassport(validate = true)
@RequestMapping(value = "get", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> get(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    Long orgId = userVo.getDefaultOrgId();
    Long orgGroupId = json.getLong("id");
    List<RelationOrgGroupUserVo> relations = orgGroupUserService.listRelationsByGroup(orgId, orgGroupId);
    if (orgGroupId == null) {
        ret.put("group", new OrgGroupVo());
        ret.put("relations", relations);
        ret.put("code", Constant.RespCode.SUCCESS.getCode());
        return ret;
    }
    TestOrgGroup po = (TestOrgGroup) orgGroupService.get(TestOrgGroup.class, Long.valueOf(orgGroupId));
    OrgGroupVo group = orgGroupService.genVo(po);
    ret.put("group", group);
    ret.put("relations", relations);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) RelationOrgGroupUserVo(com.ngtesting.platform.vo.RelationOrgGroupUserVo) TestOrgGroup(com.ngtesting.platform.entity.TestOrgGroup) HashMap(java.util.HashMap) OrgGroupVo(com.ngtesting.platform.vo.OrgGroupVo) JSONObject(com.alibaba.fastjson.JSONObject) RelationOrgGroupUserVo(com.ngtesting.platform.vo.RelationOrgGroupUserVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

OrgGroupVo (com.ngtesting.platform.vo.OrgGroupVo)6 JSONObject (com.alibaba.fastjson.JSONObject)4 AuthPassport (com.ngtesting.platform.util.AuthPassport)4 UserVo (com.ngtesting.platform.vo.UserVo)4 HashMap (java.util.HashMap)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 TestOrgGroup (com.ngtesting.platform.entity.TestOrgGroup)3 RelationOrgGroupUserVo (com.ngtesting.platform.vo.RelationOrgGroupUserVo)3 List (java.util.List)2 JSONArray (com.alibaba.fastjson.JSONArray)1 Page (com.ngtesting.platform.vo.Page)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1