Search in sources :

Example 26 with UserVo

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

the class CaseTypeAction 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();
    CaseTypeVo vo = json.getObject("model", CaseTypeVo.class);
    TestCaseType po = caseTypeService.save(vo, orgId);
    CaseTypeVo projectVo = caseTypeService.genVo(po);
    Map<String, Map<String, String>> casePropertyMap = casePropertyService.getMap(orgId);
    ret.put("casePropertyMap", casePropertyMap);
    ret.put("data", projectVo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) CaseTypeVo(com.ngtesting.platform.vo.CaseTypeVo) HashMap(java.util.HashMap) TestCaseType(com.ngtesting.platform.entity.TestCaseType) JSONObject(com.alibaba.fastjson.JSONObject) 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 27 with UserVo

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

the class CustomFieldAction 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();
    CustomFieldVo customField = JSON.parseObject(JSON.toJSONString(json.get("model")), CustomFieldVo.class);
    List<TestProjectVo> projects = (List<TestProjectVo>) json.get("relations");
    TestCustomField po = customFieldService.save(customField, orgId);
    boolean success = customFieldService.saveRelationsProjects(po.getId(), projects);
    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) List(java.util.List) 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 28 with UserVo

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

the class CustomFieldAction 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();
    List<CustomFieldVo> vos = customFieldService.listVos(orgId);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    ret.put("data", vos);
    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 29 with UserVo

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

the class CustomFieldOptionAction 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 fieldId = json.getLong("fieldId");
    Long id = json.getLong("id");
    String act = json.getString("act");
    boolean success = customFieldOptionService.changeOrderPers(id, act, fieldId);
    List<CustomFieldOptionVo> vos = customFieldOptionService.listVos(fieldId);
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : CustomFieldOptionVo(com.ngtesting.platform.vo.CustomFieldOptionVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) 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)

Example 30 with UserVo

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

the class CustomFieldOptionAction 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);
    CustomFieldOptionVo option = JSON.parseObject(JSON.toJSONString(json.getJSONObject("model")), CustomFieldOptionVo.class);
    TestCustomFieldOption po = customFieldOptionService.save(option);
    List<CustomFieldOptionVo> vos = customFieldOptionService.listVos(po.getFieldId());
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : CustomFieldOptionVo(com.ngtesting.platform.vo.CustomFieldOptionVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) TestCustomFieldOption(com.ngtesting.platform.entity.TestCustomFieldOption) 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