Search in sources :

Example 1 with HomePageVo

use of com.code.server.login.vo.HomePageVo in project summer by foxsugar.

the class HomeAction method showHomePage.

@AuthChecker
@RequestMapping("/show")
public AgentResponse showHomePage() {
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    HttpServletRequest request = attributes.getRequest();
    long agentId = AgentUtil.getAgentByRequest(request);
    HomePageVo homePageVo = homeService.showHomePage(agentId);
    Map<String, Object> rs = new HashMap<>();
    rs.put("result", homePageVo);
    AgentResponse agentResponse = new AgentResponse(200, rs);
    return agentResponse;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HomePageVo(com.code.server.login.vo.HomePageVo) HashMap(java.util.HashMap) ServletRequestAttributes(org.springframework.web.context.request.ServletRequestAttributes) AuthChecker(com.code.server.login.anotation.AuthChecker) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with HomePageVo

use of com.code.server.login.vo.HomePageVo in project summer by foxsugar.

the class HomeServiceImpl method showHomePage.

@Override
public HomePageVo showHomePage(long agentId) {
    AgentBean agentBean = RedisManager.getAgentRedisService().getAgentBean(agentId);
    HomePageVo homePageVo = new HomePageVo();
    homePageVo.setRebate(agentBean.getRebate());
    homePageVo.setInvitationCode("" + agentId);
    HomeChargeVo homeChargeVo = todayChargeService.showCharge(agentId);
    String total = homeChargeVo.getTotal();
    homePageVo.setTotalMoney((Double.parseDouble(total)));
    // 收益
    AgentInfo agentInfo = agentBean.getAgentInfo();
    String today = DateUtil.convert2DayString(new Date());
    Map<String, ChildCost> everyDayCos = agentInfo.getEveryDayCost();
    ChildCost childCost = everyDayCos.get(today);
    if (childCost != null) {
        homePageVo.setFirstLevel(childCost.getFirstLevel() * 0.01 * 0.2);
        homePageVo.setSecondLevel(childCost.getSecondLevel() * 0.01 * 0.1);
        homePageVo.setThirdLevel(childCost.getThirdLevel() * 0.01 * 0.1);
        // homePageVo.setAllCost(childCost.getFirstLevel() * 0.01 * 0.2 + childCost.getSecondLevel()* 0.01 * 0.1 + childCost.getThirdLevel() * 0.01 * 0.1);
        double allCost = (childCost.getFirstLevel() + childCost.getSecondLevel() + childCost.getThirdLevel()) * 0.01;
        homePageVo.setAllCost(allCost);
    }
    return homePageVo;
}
Also used : AgentBean(com.code.server.constant.game.AgentBean) HomePageVo(com.code.server.login.vo.HomePageVo) HomeChargeVo(com.code.server.login.vo.HomeChargeVo) ChildCost(com.code.server.constant.db.ChildCost) AgentInfo(com.code.server.constant.db.AgentInfo)

Aggregations

HomePageVo (com.code.server.login.vo.HomePageVo)2 AgentInfo (com.code.server.constant.db.AgentInfo)1 ChildCost (com.code.server.constant.db.ChildCost)1 AgentBean (com.code.server.constant.game.AgentBean)1 AuthChecker (com.code.server.login.anotation.AuthChecker)1 HomeChargeVo (com.code.server.login.vo.HomeChargeVo)1 HashMap (java.util.HashMap)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ServletRequestAttributes (org.springframework.web.context.request.ServletRequestAttributes)1