use of com.ngtesting.platform.vo.TestProjectVo in project ngtesting-platform by aaronchen2k.
the class ProjectServiceImpl method genGroupVos.
@Override
public List<TestProjectVo> genGroupVos(List<TestProject> pos) {
List<TestProjectVo> voList = new LinkedList<TestProjectVo>();
for (TestProject po : pos) {
TestProjectVo vo = genVo(po);
voList.add(vo);
}
return voList;
}
use of com.ngtesting.platform.vo.TestProjectVo in project ngtesting-platform by aaronchen2k.
the class CustomFieldServiceImpl method saveRelationsProjects.
@Override
public boolean saveRelationsProjects(Long fieldId, List<TestProjectVo> projects) {
if (projects == null) {
return false;
}
TestCustomField field = (TestCustomField) get(TestCustomField.class, fieldId);
Set<TestProject> projectSet = field.getProjectSet();
for (Object obj : projects) {
TestProjectVo vo = JSON.parseObject(JSON.toJSONString(obj), TestProjectVo.class);
if (vo.getSelecting() != vo.getSelected()) {
// 变化了
TestProject project = (TestProject) get(TestProject.class, vo.getId());
if (vo.getSelecting() && !projectSet.contains(project)) {
// 勾选
projectSet.add(project);
} else if (project != null) {
// 取消
projectSet.remove(project);
}
}
}
saveOrUpdate(field);
return true;
}
use of com.ngtesting.platform.vo.TestProjectVo 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;
}
use of com.ngtesting.platform.vo.TestProjectVo in project ngtesting-platform by aaronchen2k.
the class CustomFieldAction 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>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
Long orgId = userVo.getDefaultOrgId();
Long customFieldId = json.getLong("id");
CustomFieldVo vo;
if (customFieldId == null) {
vo = new CustomFieldVo();
vo.setMyColumn(customFieldService.getLastUnusedColumn(orgId));
vo.setCode(UUID.randomUUID().toString());
} else {
TestCustomField po = (TestCustomField) customFieldService.get(TestCustomField.class, customFieldId);
vo = customFieldService.genVo(po);
}
if (vo.getMyColumn() == null) {
ret.put("code", Constant.RespCode.BIZ_FAIL.getCode());
ret.put("msg", "自定义字段不能超过20个");
}
List<String> applyToList = customFieldService.listApplyTo();
List<String> typeList = customFieldService.listType();
List<String> formatList = customFieldService.listFormat();
List<TestProjectVo> projectList = customFieldService.listProjectsForField(orgId, customFieldId);
ret.put("data", vo);
ret.put("applyToList", applyToList);
ret.put("typeList", typeList);
ret.put("formatList", formatList);
ret.put("projects", projectList);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.vo.TestProjectVo in project ngtesting-platform by aaronchen2k.
the class ProjectServiceImpl method genVo.
@Override
public TestProjectVo genVo(TestProject po) {
if (po == null) {
return null;
}
TestProjectVo vo = new TestProjectVo();
BeanUtilEx.copyProperties(vo, po);
if (po.getParentId() == null) {
vo.setParentId(null);
}
return vo;
}
Aggregations