use of com.ngtesting.platform.vo.OrgVo in project ngtesting-platform by aaronchen2k.
the class OrgServiceImpl method listVo.
@Override
public List<OrgVo> listVo(String keywords, String disabled, Long id) {
List ls = list(keywords, disabled, id);
List<OrgVo> vos = genVos(ls, id);
return vos;
}
use of com.ngtesting.platform.vo.OrgVo 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;
}
use of com.ngtesting.platform.vo.OrgVo in project ngtesting-platform by aaronchen2k.
the class OrgAction 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 disabled = json.getString("disabled");
List<OrgVo> vos = orgService.listVo(keywords, disabled, userVo.getId());
ret.put("data", vos);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.vo.OrgVo in project ngtesting-platform by aaronchen2k.
the class OrgAction method save.
@AuthPassport(validate = true)
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> save(HttpServletRequest request, @RequestBody OrgVo vo) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
orgService.save(vo, userVo.getId());
List<OrgVo> vos = orgService.listVo(null, "false", userVo.getId());
pushSettingsService.pushMyOrgs(userVo);
ret.put("myOrgs", vos);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.vo.OrgVo in project ngtesting-platform by aaronchen2k.
the class OrgServiceImpl method genVos.
@Override
public List<OrgVo> genVos(List<TestOrg> pos, Long userId) {
TestUser user = (TestUser) get(TestUser.class, userId);
List<OrgVo> voList = new LinkedList<OrgVo>();
for (TestOrg po : pos) {
OrgVo vo = genVo(po);
if (po.getId().longValue() == user.getDefaultOrgId().longValue()) {
vo.setDefaultOrg(true);
}
voList.add(vo);
}
return voList;
}
Aggregations