use of com.code.server.login.anotation.DemoChecker in project summer by foxsugar.
the class DemoAction method findCharges.
@DemoChecker
@RequestMapping("/findCharges")
public AgentResponse findCharges(int curPage) {
if (curPage > 0) {
curPage--;
}
Page<Charge> page = homeService.findCharges(new PageRequest(curPage, 20));
List<DChargeAdminVo> list = new ArrayList<>();
page.getContent().stream().forEach(x -> {
DChargeAdminVo dChargeAdminVo = new DChargeAdminVo();
BeanUtils.copyProperties(x, dChargeAdminVo);
list.add(dChargeAdminVo);
});
Long count = homeService.chargesCount();
AgentResponse agentResponse = new AgentResponse();
Map<String, Object> rs = new HashMap<>();
rs.put("list", list);
rs.put("total", count);
agentResponse.setData(rs);
return agentResponse;
}
use of com.code.server.login.anotation.DemoChecker in project summer by foxsugar.
the class DemoAction method getChargeRecord.
@DemoChecker
@RequestMapping("/partnerRecord")
public AgentResponse getChargeRecord(String time, int curPage, int userId) {
if (curPage > 0) {
curPage--;
}
if (curPage > 0) {
curPage--;
}
String[] sA = null;
if (time.contains(",")) {
sA = time.split(",", 1000);
}
String start = sA[0];
String end = sA[1];
int agentId = (int) AgentUtil.getUserIdByToken(AgentUtil.findTokenInHeader());
start = DateUtil.becomeStandardSTime(start);
end = DateUtil.becomeStandardSTime(end);
List<String> listA = DateUtil.getDateListIn(end, start);
Sort sort = new Sort(Sort.Direction.DESC, "date");
Page<AgentRecords> page = null;
List<AgentRecords> agentRecordsList = null;
if (agentId == 1) {
page = homeService.findAllAgentRecords(userId, listA, new PageRequest(curPage, 20, sort));
agentRecordsList = page.getContent();
} else {
page = homeService.findAllAgentRecords(agentId, listA, new PageRequest(curPage, 20, sort));
agentRecordsList = page.getContent();
}
Map<String, Object> rs = new HashMap<>();
rs.put("list", agentRecordsList);
rs.put("count", page.getTotalElements());
AgentResponse agentResponse = new AgentResponse();
agentResponse.setData(rs);
return agentResponse;
}
use of com.code.server.login.anotation.DemoChecker in project summer by foxsugar.
the class DemoAction method getLogByDates.
@DemoChecker
@RequestMapping("/getLogByDates")
public AgentResponse getLogByDates(int num) {
LocalDate today = LocalDate.now();
List<String> days = new ArrayList<>();
for (int i = 0; i < num; i++) {
LocalDate temp = today.minusDays(i + 1);
days.add(temp.toString());
}
return new AgentResponse(0, logRecordDao.findByIdIn(days));
}
use of com.code.server.login.anotation.DemoChecker in project summer by foxsugar.
the class DemoAction method fetchDelegate.
@DemoChecker
@RequestMapping("/fetchDelegate")
public AgentResponse fetchDelegate(long userId) {
if (userId == 0) {
return fetchDelegates(1);
}
// GameAgent gameAgent = gameAgentDao.findOne(userId);
GameAgent gameAgent = homeService.findOneDelegate(userId);
List<GameAgentVo> list = new ArrayList<>();
AgentResponse agentResponse = new AgentResponse();
if (gameAgent == null) {
agentResponse.setData(list);
agentResponse.setCode(com.code.server.login.action.ErrorCode.ERROR);
Map<String, Object> result = new HashMap<>();
agentResponse.setMsg(" 没有记录 ");
result.put("total", 0);
result.put("list", list);
agentResponse.setData(result);
} else {
GameAgentVo gameAgentVo = new GameAgentVo();
// 手动设置上级代理id
AgentBean agentBean = RedisManager.getAgentRedisService().getAgentBean(userId);
gameAgent.setParentId(agentBean.getParentId());
BeanUtils.copyProperties(gameAgent, gameAgentVo);
gameAgentVo.setIsPartnerDes(gameAgent.getIsPartner() == 1 ? "合伙人" : "代理");
list.add(gameAgentVo);
Map<String, Object> result = new HashMap<>();
result.put("total", 1);
result.put("list", list);
agentResponse.setData(result);
}
return agentResponse;
}
use of com.code.server.login.anotation.DemoChecker in project summer by foxsugar.
the class DemoAction method fetchDelegates.
@DemoChecker
@RequestMapping("/fetchDelegates")
public AgentResponse fetchDelegates(int curPage) {
if (curPage > 0) {
curPage--;
}
int pageSize = 20;
// Page<GameAgent> page = gameAgentDao.findAll(new PageRequest(curPage, pageSize));
Page<GameAgent> page = homeService.findDelegates(new PageRequest(curPage, pageSize));
List<GameAgent> list = page.getContent();
List<GameAgentVo> voList = new ArrayList<>();
for (GameAgent gameAgent : list) {
GameAgentVo gameAgentVo = new GameAgentVo();
BeanUtils.copyProperties(gameAgent, gameAgentVo);
User user = userDao.findOne(gameAgent.getId());
gameAgentVo.setName(user.getUsername());
voList.add(gameAgentVo);
}
long count = homeService.delegatesCount();
Map<String, Object> rs = new HashMap<>();
rs.put("total", count);
rs.put("list", voList);
AgentResponse agentResponse = new AgentResponse();
agentResponse.setData(rs);
return agentResponse;
}
Aggregations