Search in sources :

Example 1 with TestUser

use of com.ngtesting.platform.entity.TestUser 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;
}
Also used : TestCaseCommentsVo(com.ngtesting.platform.vo.TestCaseCommentsVo) TestUser(com.ngtesting.platform.entity.TestUser)

Example 2 with TestUser

use of com.ngtesting.platform.entity.TestUser in project ngtesting-platform by aaronchen2k.

the class RelationOrgGroupUserServiceImpl method genVo.

private RelationOrgGroupUserVo genVo(Long orgId, Long orgGroupId, Long userId) {
    RelationOrgGroupUserVo vo = new RelationOrgGroupUserVo();
    vo.setOrgId(orgId);
    if (orgGroupId != null) {
        TestOrgGroup orgGroup = (TestOrgGroup) get(TestOrgGroup.class, orgGroupId);
        vo.setOrgGroupId(orgGroupId);
        vo.setOrgGroupName(orgGroup.getName());
    }
    if (userId != null) {
        TestUser user = (TestUser) get(TestUser.class, userId);
        vo.setUserId(user.getId());
        vo.setUserName(user.getName());
    }
    return vo;
}
Also used : TestOrgGroup(com.ngtesting.platform.entity.TestOrgGroup) RelationOrgGroupUserVo(com.ngtesting.platform.vo.RelationOrgGroupUserVo) TestUser(com.ngtesting.platform.entity.TestUser)

Example 3 with TestUser

use of com.ngtesting.platform.entity.TestUser in project ngtesting-platform by aaronchen2k.

the class RelationOrgGroupUserServiceImpl method listRelationsByGroup.

@Override
public List<RelationOrgGroupUserVo> listRelationsByGroup(Long orgId, Long orgGroupId) {
    List<TestUser> allUsers = listAllOrgUsers(orgId);
    List<TestRelationOrgGroupUser> relations;
    if (orgGroupId == null) {
        relations = new LinkedList<>();
    } else {
        relations = listRelations(orgId, orgGroupId, null);
    }
    List<RelationOrgGroupUserVo> vos = new LinkedList<>();
    for (TestUser user : allUsers) {
        RelationOrgGroupUserVo vo = genVo(orgId, orgGroupId, user.getId());
        vo.setSelected(false);
        vo.setSelecting(false);
        for (TestRelationOrgGroupUser po : relations) {
            if (po.getUserId().longValue() == user.getId().longValue() && po.getOrgGroupId().longValue() == orgGroupId.longValue()) {
                vo.setSelected(true);
                vo.setSelecting(true);
            }
        }
        vos.add(vo);
    }
    return vos;
}
Also used : TestRelationOrgGroupUser(com.ngtesting.platform.entity.TestRelationOrgGroupUser) TestUser(com.ngtesting.platform.entity.TestUser) RelationOrgGroupUserVo(com.ngtesting.platform.vo.RelationOrgGroupUserVo) LinkedList(java.util.LinkedList)

Example 4 with TestUser

use of com.ngtesting.platform.entity.TestUser in project ngtesting-platform by aaronchen2k.

the class OrgRoleUserServiceImpl method listAllOrgUsers.

private List<TestUser> listAllOrgUsers() {
    DetachedCriteria dc = DetachedCriteria.forClass(TestUser.class);
    dc.add(Restrictions.eq("deleted", Boolean.FALSE));
    dc.add(Restrictions.eq("disabled", Boolean.FALSE));
    dc.addOrder(Order.asc("id"));
    List<TestUser> ls = findAllByCriteria(dc);
    return ls;
}
Also used : DetachedCriteria(org.hibernate.criterion.DetachedCriteria) TestUser(com.ngtesting.platform.entity.TestUser)

Example 5 with TestUser

use of com.ngtesting.platform.entity.TestUser in project ngtesting-platform by aaronchen2k.

the class OrgServiceImpl method setDefaultPers.

@Override
public void setDefaultPers(Long orgId, UserVo userVo) {
    TestUser user = (TestUser) get(TestUser.class, userVo.getId());
    user.setDefaultOrgId(orgId);
    List<TestProjectAccessHistoryVo> recentProjects = projectService.listRecentProjectVo(orgId, userVo.getId());
    user.setDefaultPrjId(recentProjects.get(0).getProjectId());
    saveOrUpdate(user);
    userVo.setDefaultOrgId(user.getDefaultOrgId());
    userVo.setDefaultPrjId(recentProjects.get(0).getProjectId());
}
Also used : TestProjectAccessHistoryVo(com.ngtesting.platform.vo.TestProjectAccessHistoryVo) TestUser(com.ngtesting.platform.entity.TestUser)

Aggregations

TestUser (com.ngtesting.platform.entity.TestUser)43 HashMap (java.util.HashMap)13 JSONObject (com.alibaba.fastjson.JSONObject)12 AuthPassport (com.ngtesting.platform.util.AuthPassport)12 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)12 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)12 UserVo (com.ngtesting.platform.vo.UserVo)9 List (java.util.List)9 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)9 TestOrg (com.ngtesting.platform.entity.TestOrg)5 TestVerifyCode (com.ngtesting.platform.entity.TestVerifyCode)5 Date (java.util.Date)5 RelationOrgGroupUserVo (com.ngtesting.platform.vo.RelationOrgGroupUserVo)3 LinkedList (java.util.LinkedList)3 OrgVo (com.ngtesting.platform.vo.OrgVo)2 TestAlert (com.ngtesting.platform.entity.TestAlert)1 TestOrgGroup (com.ngtesting.platform.entity.TestOrgGroup)1 TestOrgRole (com.ngtesting.platform.entity.TestOrgRole)1 TestPlan (com.ngtesting.platform.entity.TestPlan)1 TestProject (com.ngtesting.platform.entity.TestProject)1