Search in sources :

Example 1 with UserVo

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

the class EnvAction 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);
    TestEnv po = envService.save(json, userVo);
    TestEnvVo vo = envService.genVo(po);
    optFacade.opt(WsConstant.WS_TODO, userVo.getId().toString());
    ret.put("data", vo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) TestEnv(com.ngtesting.platform.entity.TestEnv) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) TestEnvVo(com.ngtesting.platform.vo.TestEnvVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with UserVo

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

the class EnvAction method delete.

@AuthPassport(validate = true)
@RequestMapping(value = "delete", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> delete(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 id = json.getLong("id");
    TestEnv po = envService.delete(id, userVo.getId());
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) TestEnv(com.ngtesting.platform.entity.TestEnv) 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 3 with UserVo

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

the class MsgAction method markAllRead.

@AuthPassport(validate = true)
@RequestMapping(value = "markAllRead", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> markAllRead(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    msgService.markAllReadPers(userVo.getId());
    optFacade.opt(WsConstant.WS_TODO, userVo.getId().toString());
    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) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with UserVo

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

the class MsgAction 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);
    String keywords = json.getString("keywords");
    String isRead = json.getString("isRead");
    int page = json.getInteger("page") == null ? 0 : json.getInteger("page") - 1;
    int pageSize = json.getInteger("pageSize") == null ? Constant.PAGE_SIZE : json.getInteger("pageSize");
    Page pageDate = msgService.listByPage(userVo.getId(), isRead, keywords, page, pageSize);
    List<UserVo> vos = msgService.genVos(pageDate.getItems());
    ret.put("collectionSize", pageDate.getTotal());
    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) 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 5 with UserVo

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

the class OrgAction 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>();
    Long id = json.getLong("id");
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    if (id != null) {
        TestOrg po = (TestOrg) orgService.get(TestOrg.class, id);
        OrgVo vo = orgService.genVo(po);
        TestUser user = (TestUser) orgService.get(TestUser.class, userVo.getId());
        if (po.getId().longValue() == user.getDefaultOrgId().longValue()) {
            vo.setDefaultOrg(true);
        }
        ret.put("data", vo);
    }
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : OrgVo(com.ngtesting.platform.vo.OrgVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) TestOrg(com.ngtesting.platform.entity.TestOrg) TestUser(com.ngtesting.platform.entity.TestUser) 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