use of com.code.server.login.anotation.DemoChecker in project summer by foxsugar.
the class DemoAction method modifyConstnat.
@DemoChecker
@RequestMapping("/uConstant")
public AgentResponse modifyConstnat(@RequestParam("constantForm") String constantForm) {
Map<String, Object> rs = JsonUtil.readValue(constantForm, Map.class);
ConstantFormVo vo = JsonUtil.readValue(constantForm, ConstantFormVo.class);
Constant constant = constantDao.findOne(1l);
constant.setInitMoney(vo.getInit_money());
constant.setAppleCheck(Integer.valueOf(vo.getApple_check()).intValue());
constant.setVersionOfAndroid(vo.getVersion_of_android());
constant.setVersionOfIos(vo.getVersion_of_ios());
constant.setMarquee(vo.getMarquee());
constant.setMarquee1(vo.getMarquee1());
constant.setMarquee2(vo.getMarquee2());
constant.setDownload2(vo.getDownload2());
constant.setDownload(vo.getDownload());
constantDao.save(constant);
// 刷新内存
ServerManager.constant = constantDao.findOne(1L);
AgentResponse agentResponse = new AgentResponse();
return agentResponse;
}
use of com.code.server.login.anotation.DemoChecker in project summer by foxsugar.
the class DemoAction method fetchPartner.
@DemoChecker
@RequestMapping("/fetchPartner")
public AgentResponse fetchPartner(long userId) {
if (userId == 0) {
return fetchPartners(1);
}
// GameAgent gameAgent = gameAgentDao.findOne(userId);
GameAgent gameAgent = homeService.findOnePartner(userId);
logger.info("==================================================");
logger.info("userId is{}, game agent is{}", userId, gameAgent);
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();
BeanUtils.copyProperties(gameAgent, gameAgentVo);
AgentUser agentUser = agentUserDao.findAgentUserByInvite_code(gameAgent.getId() + "");
if (agentUser != null) {
gameAgentVo.setPassword(agentUser.getPassword());
}
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 chargeTimerSearch.
@DemoChecker
@RequestMapping("/chargeTimeSearch")
public AgentResponse chargeTimerSearch(String time, int curPage, int chargeFrom, long userId, int moneyType) {
if (curPage > 0) {
curPage--;
}
String[] sA = null;
if (time.contains(",")) {
sA = time.split(",", 1000);
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
List<Date> list = new ArrayList<>();
if (sA != null) {
Arrays.stream(sA).forEach(x -> {
try {
list.add(simpleDateFormat.parse(x));
} catch (ParseException e) {
e.printStackTrace();
}
});
}
Page<Charge> page = homeService.timeSearchCharges(list, new PageRequest(curPage, 20), moneyType, chargeFrom, userId);
AgentResponse agentResponse = new AgentResponse();
Map<String, Object> rs = new HashMap<>();
rs.put("list", page.getContent());
rs.put("total", page.getTotalElements());
agentResponse.setData(rs);
return agentResponse;
}
use of com.code.server.login.anotation.DemoChecker in project summer by foxsugar.
the class DemoAction method doSearch.
@DemoChecker
@RequestMapping("/timeSearch")
public AgentResponse doSearch(String t1, String t2, int curPage) {
if (curPage > 0) {
curPage--;
}
String[] sA = null;
if (t1.contains(",")) {
sA = t1.split(",", 1000);
}
String[] sB = null;
if (t2.contains(",")) {
sB = t2.split(",", 1000);
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
List<Date> listA = new ArrayList<>();
if (sA != null) {
for (String str : sA) {
try {
Date date = simpleDateFormat.parse(str);
listA.add(date);
} catch (ParseException e) {
// e.printStackTrace();
}
}
}
List<Date> listB = new ArrayList<>();
if (sB != null) {
for (String str : sB) {
try {
Date date = simpleDateFormat.parse(str);
listB.add(date);
} catch (ParseException e) {
e.printStackTrace();
}
}
}
int pageSize = 20;
List<User> list = null;
long count = 0;
AgentResponse agentResponse = new AgentResponse();
if (sA != null && sB == null) {
list = homeService.timeQuery(listA, listB, new PageRequest(curPage, pageSize)).getContent();
count = homeService.timeQueryCount(listA, listB);
} else if (sB != null && sB == null) {
// list = userDao.findUsersByLastLoginDateBetween(listB.get(0), listB.get(1));
list = homeService.timeQuery(listA, listB, new PageRequest(curPage, pageSize)).getContent();
count = homeService.timeQueryCount(listA, listB);
} else if (sA != null && sB != null) {
// list = userDao.findUsersByRegistDateBetweenAndLastLoginDateBetween(listA.get(0), listA.get(1), listB.get(0), listB.get(1));
list = homeService.timeQuery(listA, listB, new PageRequest(curPage, pageSize)).getContent();
count = homeService.timeQueryCount(listA, listB);
} else {
agentResponse.setCode(com.code.server.login.action.ErrorCode.ERROR);
agentResponse.setMsg("请选择日期");
return agentResponse;
}
Map<String, Object> result = new HashMap<>();
result.put("total", count);
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 fetchPartners.
@DemoChecker
@RequestMapping("/fetchPartners")
public AgentResponse fetchPartners(int curPage) {
if (curPage > 0) {
curPage--;
}
int pageSize = 20;
Page<GameAgent> page = homeService.findPartner(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());
AgentUser agentUser = agentUserDao.findAgentUserByUsername(gameAgent.getId() + "");
System.out.println("agent user is " + agentUser);
if (agentUser != null) {
gameAgentVo.setPassword(agentUser.getPassword());
}
// gameAgentVo.setPassword(agentUser.getPassword());
// gameAgentVo.setInvite_code(agentUser.getInvite_code());
voList.add(gameAgentVo);
}
long count = homeService.partnerCount();
Map<String, Object> rs = new HashMap<>();
rs.put("total", count);
rs.put("list", voList);
AgentResponse agentResponse = new AgentResponse();
agentResponse.setData(rs);
return agentResponse;
}
Aggregations