use of com.code.server.db.model.AgentUser in project summer by foxsugar.
the class IChargeDaoTest method findOne.
@Test
public void findOne() {
// AgentUser agentUser = agentUserDao.findOne(27);
// AgentInfo agentInfo = agentUser.getAgentInfo();
// System.out.println(agentInfo);
AgentUser agentUser = agentUserDao.findOne(10334);
System.out.println(agentUser);
}
use of com.code.server.db.model.AgentUser in project summer by foxsugar.
the class AgentUserService method list.
public Page<AgentUser> list(int page, int size) {
List<AgentUser> list = new ArrayList<>();
PageRequest pageRequest = new PageRequest(page, size);
return agentUserDao.findAll(pageRequest);
}
use of com.code.server.db.model.AgentUser in project summer by foxsugar.
the class AgentService method change2Partner.
/**
* 改变为合伙人
*
* @param userId
*/
public void change2Partner(long userId) {
AgentBean agentBean = RedisManager.getAgentRedisService().getAgentBean(userId);
String unionId = userService.getUserDao().getOpenIdById(userId);
// 如果不是代理,先成为代理
if (agentBean == null) {
agentBean = player2Agnet(userId, unionId);
}
// 已经是合伙人 返回
if (agentBean.getIsPartner() == 1)
return;
// 如果有上级代理
long parentId = agentBean.getParentId();
if (parentId != 0) {
AgentBean parentAgentBean = RedisManager.getAgentRedisService().getAgentBean(parentId);
// 删掉这个下级代理
parentAgentBean.getChildList().remove(userId);
RedisManager.getAgentRedisService().updateAgentBean(parentAgentBean);
}
// 自己变成合伙人
agentBean.setIsPartner(1);
// 合伙人id 改成自己
agentBean.setPartnerId(userId);
// 上级变为0
agentBean.setParentId(0);
RedisManager.getAgentRedisService().updateAgentBean(agentBean);
// user 上的改变 把上级去掉
changePlayerReferee(userId, 0);
// 自己下级的合伙人 全部改成自己
Set<AgentBean> allChild = new HashSet<>();
findAllClildAgent(agentBean, allChild);
for (AgentBean subAgentBean : allChild) {
subAgentBean.setPartnerId(userId);
// 加入保存列表
RedisManager.getAgentRedisService().updateAgentBean(subAgentBean);
}
// 在agent_user 生产合伙人表
AgentUser agentUser = agentUserService.agentUserDao.findAgentUserByUsername("" + userId);
if (agentUser == null) {
agentUser = new AgentUser();
agentUser.setCreateTime(new Date()).setUsername("" + userId).setPassword("" + userId).setLevel(1);
agentUserService.agentUserDao.save(agentUser);
}
}
use of com.code.server.db.model.AgentUser in project summer by foxsugar.
the class IChargeDaoTest method test.
@Test
public void test() {
List<AgentUser> list = (List<AgentUser>) agentUserDao.findAll();
for (AgentUser agentUser : list) {
AgentInfo agentInfo = new AgentInfo();
AgentInfoRecord agentInfoRecord = new AgentInfoRecord();
agentUser.setAgentInfo(agentInfo);
agentUser.setAgentInfoRecord(agentInfoRecord);
agentUserDao.save(agentUser);
}
}
use of com.code.server.db.model.AgentUser in project summer by foxsugar.
the class IAgentUserDaoTest method test.
@Test
public void test() {
System.out.println(agentUserDao);
System.out.println(agentUserDao.findAll());
AgentUser agentUser = agentUserDao.findOne(10334);
System.out.println(agentUser);
}
Aggregations