Search in sources :

Example 86 with AuthPassport

use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.

the class CustomFieldAction 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 customFieldId = json.getLong("id");
    CustomFieldVo vo;
    if (customFieldId == null) {
        vo = new CustomFieldVo();
        vo.setMyColumn(customFieldService.getLastUnusedColumn(orgId));
        vo.setCode(UUID.randomUUID().toString());
    } else {
        TestCustomField po = (TestCustomField) customFieldService.get(TestCustomField.class, customFieldId);
        vo = customFieldService.genVo(po);
    }
    if (vo.getMyColumn() == null) {
        ret.put("code", Constant.RespCode.BIZ_FAIL.getCode());
        ret.put("msg", "自定义字段不能超过20个");
    }
    List<String> applyToList = customFieldService.listApplyTo();
    List<String> typeList = customFieldService.listType();
    List<String> formatList = customFieldService.listFormat();
    List<TestProjectVo> projectList = customFieldService.listProjectsForField(orgId, customFieldId);
    ret.put("data", vo);
    ret.put("applyToList", applyToList);
    ret.put("typeList", typeList);
    ret.put("formatList", formatList);
    ret.put("projects", projectList);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) TestProjectVo(com.ngtesting.platform.vo.TestProjectVo) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) CustomFieldVo(com.ngtesting.platform.vo.CustomFieldVo) TestCustomField(com.ngtesting.platform.entity.TestCustomField) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 87 with AuthPassport

use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.

the class CustomFieldAction method changeOrder.

@AuthPassport(validate = true)
@RequestMapping(value = "changeOrder", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> changeOrder(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 id = json.getLong("id");
    String act = json.getString("act");
    boolean success = customFieldService.changeOrderPers(id, act);
    List<CustomFieldVo> vos = customFieldService.listVos(orgId);
    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) CustomFieldVo(com.ngtesting.platform.vo.CustomFieldVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 88 with AuthPassport

use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.

the class DocumentAction 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>();
    long eventId = json.getLong("eventId");
    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 = documentService.listByPage(eventId, page, pageSize, null);
    List<DocumentVo> vos = documentService.genVos(pageData.getItems());
    ret.put("collectionSize", pageData.getTotal());
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) Page(com.ngtesting.platform.vo.Page) DocumentVo(com.ngtesting.platform.vo.DocumentVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 89 with AuthPassport

use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.

the class SysRoleAction 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 = json.getLong("orgId");
    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 = roleService.listByPage(orgId, keywords, disabled, page, pageSize);
    List<RoleVo> vos = roleService.genVos(pageData.getItems());
    ret.put("collectionSize", pageData.getTotal());
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : RoleVo(com.ngtesting.platform.vo.RoleVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) 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 90 with AuthPassport

use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.

the class SysRoleAction 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();
    RoleVo vo = json.getObject("role", RoleVo.class);
    SysRole po = roleService.save(vo, orgId);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : RoleVo(com.ngtesting.platform.vo.RoleVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) SysRole(com.ngtesting.platform.entity.SysRole) JSONObject(com.alibaba.fastjson.JSONObject) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

AuthPassport (com.ngtesting.platform.util.AuthPassport)100 HashMap (java.util.HashMap)100 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)99 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)99 JSONObject (com.alibaba.fastjson.JSONObject)98 UserVo (com.ngtesting.platform.vo.UserVo)78 TestUser (com.ngtesting.platform.entity.TestUser)12 List (java.util.List)12 TestCase (com.ngtesting.platform.entity.TestCase)6 CasePriorityVo (com.ngtesting.platform.vo.CasePriorityVo)5 CaseTypeVo (com.ngtesting.platform.vo.CaseTypeVo)5 TestProject (com.ngtesting.platform.entity.TestProject)4 TestRun (com.ngtesting.platform.entity.TestRun)4 TestSuite (com.ngtesting.platform.entity.TestSuite)4 CustomFieldVo (com.ngtesting.platform.vo.CustomFieldVo)4 OrgGroupVo (com.ngtesting.platform.vo.OrgGroupVo)4 Page (com.ngtesting.platform.vo.Page)4 TestCaseInRunVo (com.ngtesting.platform.vo.TestCaseInRunVo)4 TestRunVo (com.ngtesting.platform.vo.TestRunVo)4 TestSuiteVo (com.ngtesting.platform.vo.TestSuiteVo)4