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;
}
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;
}
}
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;
}
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;
}
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;
}
Aggregations