Search in sources :

Example 36 with TestUser

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

Example 37 with TestUser

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

the class AccountServiceImpl method getByToken.

@Override
public TestUser getByToken(String token) {
    DetachedCriteria dc = DetachedCriteria.forClass(TestUser.class);
    dc.add(Restrictions.eq("token", token));
    dc.add(Restrictions.ne("deleted", true));
    dc.add(Restrictions.ne("disabled", true));
    List ls = findAllByCriteria(dc);
    if (ls.size() > 0) {
        return (TestUser) ls.get(0);
    } else {
        return null;
    }
}
Also used : DetachedCriteria(org.hibernate.criterion.DetachedCriteria) List(java.util.List) TestUser(com.ngtesting.platform.entity.TestUser)

Example 38 with TestUser

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

the class AccountServiceImpl method loginPers.

@Override
public TestUser loginPers(String email, String password, Boolean rememberMe) {
    String newToken = null;
    DetachedCriteria dc = DetachedCriteria.forClass(TestUser.class);
    dc.add(Restrictions.eq("email", email));
    dc.add(Restrictions.eq("password", password));
    dc.add(Restrictions.ne("deleted", true));
    List<TestUser> ls = (List<TestUser>) findAllByCriteria(dc);
    TestUser user = null;
    if (ls.size() > 0) {
        user = ls.get(0);
        newToken = UUID.randomUUID().toString();
        user.setToken(newToken);
        user.setLastLoginTime(new Date());
        saveOrUpdate(user);
    }
    return user;
}
Also used : DetachedCriteria(org.hibernate.criterion.DetachedCriteria) List(java.util.List) TestUser(com.ngtesting.platform.entity.TestUser) Date(java.util.Date)

Example 39 with TestUser

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

the class AccountServiceImpl method registerPers.

@Override
public TestUser registerPers(String name, String email, String phone, String password) {
    String newToken = null;
    DetachedCriteria dc = DetachedCriteria.forClass(TestUser.class);
    dc.add(Restrictions.eq("email", email));
    dc.add(Restrictions.ne("deleted", true));
    dc.add(Restrictions.ne("disabled", true));
    List<TestUser> ls = (List<TestUser>) findAllByCriteria(dc);
    if (ls.size() > 0) {
        return null;
    }
    TestUser user = new TestUser();
    newToken = UUID.randomUUID().toString();
    user.setName(name);
    user.setToken(newToken);
    user.setEmail(email);
    user.setPhone(phone);
    user.setPassword(password);
    user.setAvatar("upload/sample/user/avatar.png");
    user.setLeftSize(300);
    user.setLastLoginTime(new Date());
    saveOrUpdate(user);
    return user;
}
Also used : DetachedCriteria(org.hibernate.criterion.DetachedCriteria) List(java.util.List) TestUser(com.ngtesting.platform.entity.TestUser) Date(java.util.Date)

Example 40 with TestUser

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

the class AccountServiceImpl method setLeftSizePers.

@Override
public TestUser setLeftSizePers(Long userId, Integer left) {
    TestUser po = (TestUser) get(TestUser.class, userId);
    po.setLeftSize(left);
    saveOrUpdate(po);
    return po;
}
Also used : 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