use of com.ngtesting.platform.entity.TestProject in project ngtesting-platform by aaronchen2k.
the class CustomFieldServiceImpl method save.
@Override
public TestCustomField save(CustomFieldVo vo, Long orgId) {
if (vo == null) {
return null;
}
TestCustomField po;
if (vo.getId() != null) {
po = (TestCustomField) get(TestCustomField.class, vo.getId());
} else {
po = new TestCustomField();
}
this.initPo(po, vo);
po.setApplyTo(TestCustomField.FieldApplyTo.valueOf(vo.getApplyTo()));
po.setType(TestCustomField.FieldType.valueOf(vo.getType()));
if (StringUtil.isNotEmpty(vo.getFormat())) {
po.setFormat(TestCustomField.FieldFormat.valueOf(vo.getFormat()));
}
po.setOrgId(orgId);
if (vo.getId() == null) {
String hql = "select max(ordr) from TestCustomField";
Integer maxOrder = (Integer) getByHQL(hql);
if (maxOrder == null) {
maxOrder = 0;
}
po.setOrdr(maxOrder + 10);
}
if (!po.getType().equals(FieldType.text)) {
po.setRows(0);
po.setFormat(null);
}
if (po.getGlobal() && po.getProjectSet().size() > 0) {
po.setProjectSet(new HashSet<TestProject>(0));
}
saveOrUpdate(po);
return po;
}
use of com.ngtesting.platform.entity.TestProject in project ngtesting-platform by aaronchen2k.
the class ProjectAction method saveMembers.
@AuthPassport(validate = true)
@RequestMapping(value = "saveMembers", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> saveMembers(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();
List<TestRelationProjectRoleEntity> pos = relationProjectRoleEntityService.batchSavePers(json);
List<RelationProjectRoleEntityVo> entityInRoles = relationProjectRoleEntityService.genVos(pos);
Long projectId = json.getLong("projectId");
TestProject project = (TestProject) relationProjectRoleEntityService.get(TestProject.class, projectId);
historyService.create(project.getId(), userVo, Constant.MsgType.update.msg, TestHistory.TargetType.project_member, project.getId(), project.getName());
ret.put("entityInRoles", entityInRoles);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.entity.TestProject in project ngtesting-platform by aaronchen2k.
the class ReportAction method project.
@AuthPassport(validate = true)
@RequestMapping(value = "project", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> project(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
Map<String, Object> data = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
Long id = json.getLong("projectId");
TestProject prj = (TestProject) reportService.get(TestProject.class, id);
Map<String, List<Object>> designReport = reportService.chart_design_progress_by_project(id, prj.getType(), 14);
Map<String, List<Object>> exeReport = reportService.chart_excution_process_by_project(id, prj.getType(), 14);
data.put("design", designReport);
data.put("exe", exeReport);
ret.put("data", data);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.entity.TestProject in project ngtesting-platform by aaronchen2k.
the class ProjectAction 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 projectId = json.getLong("id");
if (projectId != null) {
TestProject project = projectService.getDetail(projectId);
TestProjectVo vo = projectService.genVo(project);
if (TestProject.ProjectType.group.equals(project.getType())) {
vo.setLastestProjectGroup(projectService.isLastestProjectGroup(orgId, projectId));
}
ret.put("data", vo);
}
List<TestProjectVo> groups = projectService.listProjectGroups(orgId);
List<ProjectRoleVo> projectRoles = projectRoleService.list(orgId, null, null);
List<TestRelationProjectRoleEntity> entityInRolesPos = relationProjectRoleEntityService.listByProject(projectId);
List<RelationProjectRoleEntityVo> entityInRoles = relationProjectRoleEntityService.genVos(entityInRolesPos);
ret.put("groups", groups);
ret.put("projectRoles", projectRoles);
ret.put("entityInRoles", entityInRoles);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.entity.TestProject in project ngtesting-platform by aaronchen2k.
the class ProjectAction 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();
Long userId = userVo.getId();
TestProjectVo vo = json.getObject("model", TestProjectVo.class);
TestProject po = projectService.save(vo, orgId, userVo);
if (TestProject.ProjectType.project.equals(po.getType())) {
projectService.updateNameInHisotyPers(po.getId(), userId);
}
pushSettingsService.pushRecentProjects(userVo);
pushSettingsService.pushPrjSettings(userVo);
ret.put("data", vo);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
Aggregations