Search in sources :

Example 1 with TestVerVo

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

the class VerServiceImpl method save.

@Override
public TestVer save(JSONObject json, UserVo optUser) {
    Long id = json.getLong("id");
    TestVer po;
    TestVerVo vo = JSON.parseObject(JSON.toJSONString(json), TestVerVo.class);
    Constant.MsgType action;
    if (id != null) {
        po = (TestVer) get(TestVer.class, id);
        action = Constant.MsgType.update;
    } else {
        po = new TestVer();
        action = Constant.MsgType.create;
    }
    po.setName(vo.getName());
    po.setStartTime(vo.getStartTime());
    po.setEndTime(vo.getEndTime());
    po.setDescr(vo.getDescr());
    po.setProjectId(vo.getProjectId());
    saveOrUpdate(po);
    return po;
}
Also used : Constant(com.ngtesting.platform.config.Constant) TestVer(com.ngtesting.platform.entity.TestVer) TestVerVo(com.ngtesting.platform.vo.TestVerVo)

Example 2 with TestVerVo

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

the class VerServiceImpl method genVo.

@Override
public TestVerVo genVo(TestVer po) {
    TestVerVo vo = new TestVerVo();
    vo.setId(po.getId());
    vo.setName(po.getName());
    vo.setStartTime(po.getStartTime());
    vo.setEndTime(po.getEndTime());
    vo.setDescr(po.getDescr());
    vo.setProjectId(po.getProjectId());
    vo.setStatus(po.getStatus().toString());
    return vo;
}
Also used : TestVerVo(com.ngtesting.platform.vo.TestVerVo)

Example 3 with TestVerVo

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

the class VerServiceImpl method getById.

@Override
public TestVerVo getById(Long caseId) {
    TestVer po = (TestVer) get(TestVer.class, caseId);
    TestVerVo vo = genVo(po);
    return vo;
}
Also used : TestVer(com.ngtesting.platform.entity.TestVer) TestVerVo(com.ngtesting.platform.vo.TestVerVo)

Example 4 with TestVerVo

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

the class VerServiceImpl method genVos.

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

Example 5 with TestVerVo

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

the class VerAction 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);
    TestVer po = verService.save(json, userVo);
    TestVerVo vo = verService.genVo(po);
    ret.put("data", vo);
    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) TestVer(com.ngtesting.platform.entity.TestVer) TestVerVo(com.ngtesting.platform.vo.TestVerVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

TestVerVo (com.ngtesting.platform.vo.TestVerVo)7 TestVer (com.ngtesting.platform.entity.TestVer)5 JSONObject (com.alibaba.fastjson.JSONObject)3 AuthPassport (com.ngtesting.platform.util.AuthPassport)3 UserVo (com.ngtesting.platform.vo.UserVo)3 HashMap (java.util.HashMap)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 Constant (com.ngtesting.platform.config.Constant)1 LinkedList (java.util.LinkedList)1