use of com.ngtesting.platform.vo.TestCaseCommentsVo in project ngtesting-platform by aaronchen2k.
the class CaseCommentsServiceImpl method save.
@Override
public TestCaseCommentsVo save(JSONObject json, UserVo userVo) {
TestCaseCommentsVo vo = JSON.parseObject(JSON.toJSONString(json), TestCaseCommentsVo.class);
TestCaseComments po = new TestCaseComments();
if (vo.getId() != null) {
po = (TestCaseComments) get(TestCaseComments.class, vo.getId());
} else {
po.setId(null);
}
po.setSummary(vo.getSummary());
po.setContent(vo.getContent());
po.setTestCaseId(vo.getTestCaseId());
po.setUserId(userVo.getId());
po.setChangeTime(new Date());
saveOrUpdate(po);
return genVo(po);
}
use of com.ngtesting.platform.vo.TestCaseCommentsVo in project ngtesting-platform by aaronchen2k.
the class CaseCommentsServiceImpl method genVo.
@Override
public TestCaseCommentsVo genVo(TestCaseComments po) {
TestCaseCommentsVo vo = new TestCaseCommentsVo();
BeanUtilEx.copyProperties(vo, po);
if (vo.getUpdateTime() == null) {
vo.setUpdateTime(vo.getCreateTime());
}
TestUser user = (TestUser) get(TestUser.class, po.getUserId());
vo.setUserName(user.getName());
vo.setUserAvatar(user.getAvatar());
return vo;
}
use of com.ngtesting.platform.vo.TestCaseCommentsVo in project ngtesting-platform by aaronchen2k.
the class CaseCommentsAction 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);
TestCaseCommentsVo vo = commentsService.save(json, userVo);
ret.put("data", vo);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
Aggregations