Search in sources :

Example 46 with UserVo

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

the class OrgGroupAction method save.

@AuthPassport(validate = true)
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> save(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();
    OrgGroupVo group = JSON.parseObject(JSON.toJSONString(json.get("group")), OrgGroupVo.class);
    ;
    List<RelationOrgGroupUserVo> relations = (List<RelationOrgGroupUserVo>) json.get("relations");
    TestOrgGroup po = orgGroupService.save(group, orgId);
    boolean success = orgGroupUserService.saveRelations(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) List(java.util.List) 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)

Example 47 with UserVo

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

the class ProjectRoleAction method save.

@AuthPassport(validate = true)
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> save(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();
    ProjectRoleVo projectRoleVo = JSON.parseObject(JSON.toJSONString(json.get("projectRole")), ProjectRoleVo.class);
    TestProjectRoleForOrg po = projectRoleService.save(projectRoleVo, orgId);
    Map<String, List<ProjectPrivilegeDefineVo>> projectPrivileges = (Map<String, List<ProjectPrivilegeDefineVo>>) json.get("projectPrivileges");
    int i = 0;
    boolean success = projectPrivilegeService.saveProjectPrivileges(po.getId(), projectPrivileges);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : HashMap(java.util.HashMap) ProjectPrivilegeDefineVo(com.ngtesting.platform.vo.ProjectPrivilegeDefineVo) ProjectRoleVo(com.ngtesting.platform.vo.ProjectRoleVo) UserVo(com.ngtesting.platform.vo.UserVo) TestProjectRoleForOrg(com.ngtesting.platform.entity.TestProjectRoleForOrg) JSONObject(com.alibaba.fastjson.JSONObject) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 48 with UserVo

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

the class ProjectRoleAction 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");
    List<ProjectRoleVo> vos = projectRoleService.list(orgId, keywords, disabled);
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) ProjectRoleVo(com.ngtesting.platform.vo.ProjectRoleVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 49 with UserVo

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

the class ProjectRoleAction method get.

@AuthPassport(validate = true)
@RequestMapping(value = "get", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> get(HttpServletRequest request, @RequestBody JSONObject req) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    Long orgId = userVo.getDefaultOrgId();
    Long roleId = req.getLong("id");
    Map<String, List<ProjectPrivilegeDefineVo>> orgPrivileges = projectPrivilegeService.listPrivilegesByOrgAndProjectRole(orgId, roleId);
    if (roleId == null) {
        ret.put("projectRole", new ProjectRoleVo());
        ret.put("projectPrivileges", orgPrivileges);
        ret.put("code", Constant.RespCode.SUCCESS.getCode());
        return ret;
    }
    TestProjectRoleForOrg po = (TestProjectRoleForOrg) projectRoleService.get(TestProjectRoleForOrg.class, roleId);
    ProjectRoleVo vo = projectRoleService.genVo(po);
    ret.put("projectRole", vo);
    ret.put("projectPrivileges", orgPrivileges);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) TestProjectRoleForOrg(com.ngtesting.platform.entity.TestProjectRoleForOrg) JSONObject(com.alibaba.fastjson.JSONObject) List(java.util.List) ProjectRoleVo(com.ngtesting.platform.vo.ProjectRoleVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 50 with UserVo

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

the class ReportAction method plan.

@AuthPassport(validate = true)
@RequestMapping(value = "plan", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> plan(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    Map<String, Object> data = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    List<Map<Object, Object>> resultReport = reportService.chart_execution_result_by_plan(json.getLong("planId"), 14);
    Map<String, List<Object>> processReport = reportService.chart_execution_process_by_plan(json.getLong("planId"), 14);
    Map<String, List<Object>> progressReport = reportService.chart_execution_progress_by_plan(json.getLong("planId"), 14);
    data.put("result", resultReport);
    data.put("process", processReport);
    data.put("progress", progressReport);
    ret.put("data", data);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

UserVo (com.ngtesting.platform.vo.UserVo)84 HashMap (java.util.HashMap)79 AuthPassport (com.ngtesting.platform.util.AuthPassport)78 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)78 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)78 JSONObject (com.alibaba.fastjson.JSONObject)77 TestUser (com.ngtesting.platform.entity.TestUser)9 List (java.util.List)7 CasePriorityVo (com.ngtesting.platform.vo.CasePriorityVo)5 CaseTypeVo (com.ngtesting.platform.vo.CaseTypeVo)5 RelationOrgGroupUserVo (com.ngtesting.platform.vo.RelationOrgGroupUserVo)5 TestRun (com.ngtesting.platform.entity.TestRun)4 TestSuite (com.ngtesting.platform.entity.TestSuite)4 CaseExeStatusVo (com.ngtesting.platform.vo.CaseExeStatusVo)4 CustomFieldVo (com.ngtesting.platform.vo.CustomFieldVo)4 OrgGroupVo (com.ngtesting.platform.vo.OrgGroupVo)4 TestCaseInRunVo (com.ngtesting.platform.vo.TestCaseInRunVo)4 TestRunVo (com.ngtesting.platform.vo.TestRunVo)4 TestSuiteVo (com.ngtesting.platform.vo.TestSuiteVo)4 Map (java.util.Map)4