Search in sources :

Example 6 with AuthChecker

use of com.code.server.login.anotation.AuthChecker in project summer by foxsugar.

the class TodayChargeAction method showCost.

@AuthChecker
@RequestMapping("/dCost")
public AgentResponse showCost(String start, String end) {
    // 转化为标准字符串
    logger.info("dCost==========start:{},end:{}", start, end);
    start = DateUtil.becomeStandardSTime(start);
    end = DateUtil.becomeStandardSTime(end);
    logger.info("dCost==========start:{},end:{}", start, end);
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    HttpServletRequest request = attributes.getRequest();
    long agentId = AgentUtil.getAgentByRequest(request);
    List<String> list = DateUtil.getDateListIn(end, start);
    AgentBean agentBean = RedisManager.getAgentRedisService().getAgentBean(agentId);
    AgentInfo agentInfo = agentBean.getAgentInfo();
    List<DChildCostVo> li = new ArrayList<>();
    double oneLevel = 0d;
    double twoLevel = 0d;
    double threeLevel = 0d;
    for (String dateStr : list) {
        ChildCost childCost = agentInfo.getEveryDayCost().get(dateStr);
        DChildCostVo dChildCostVo = new DChildCostVo();
        if (childCost != null) {
            BeanUtils.copyProperties(childCost, dChildCostVo);
        }
        dChildCostVo.setDateStr(dateStr);
        li.add(dChildCostVo);
        oneLevel += dChildCostVo.getFirstLevel();
        twoLevel += dChildCostVo.getSecondLevel();
        threeLevel += dChildCostVo.getThirdLevel();
    }
    // double total = oneLevel * 0.2 * 0.01 + twoLevel * 0.1 * 0.01 + threeLevel *0.1 * 0.01;
    double total = (oneLevel + twoLevel + threeLevel) * 0.01;
    Map<String, Object> result = new HashMap<>();
    result.put("li", li);
    result.put("total", total);
    // result.put("oneLevel", oneLevel * 0.2 * 0.01);
    // result.put("twoLevel", twoLevel * 0.1 * 0.01);
    // result.put("threeLevel", threeLevel *0.1 * 0.01);
    result.put("oneLevel", oneLevel * 0.01);
    result.put("twoLevel", twoLevel * 0.01);
    result.put("threeLevel", threeLevel * 0.01);
    result.put("start", list.get(list.size() - 1));
    result.put("end", list.get(0));
    double income = oneLevel * 0.2 * 0.01 + twoLevel * 0.1 * 0.01 + threeLevel * 0.1 * 0.01;
    result.put("income", income);
    AgentResponse agentResponse = new AgentResponse(200, result);
    return agentResponse;
}
Also used : ServletRequestAttributes(org.springframework.web.context.request.ServletRequestAttributes) HttpServletRequest(javax.servlet.http.HttpServletRequest) AgentBean(com.code.server.constant.game.AgentBean) ChildCost(com.code.server.constant.db.ChildCost) AgentInfo(com.code.server.constant.db.AgentInfo) AuthChecker(com.code.server.login.anotation.AuthChecker) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with AuthChecker

use of com.code.server.login.anotation.AuthChecker in project summer by foxsugar.

the class TodayChargeAction method canBlance.

@AuthChecker
@RequestMapping("/canBlance")
public AgentResponse canBlance() {
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    HttpServletRequest request = attributes.getRequest();
    long agentId = AgentUtil.getAgentByRequest(request);
    AgentResponse agentResponse = new AgentResponse();
    double re = todayChargeService.canBlance(agentId);
    Map<String, Object> rs = new HashMap<>();
    rs.put("result", re);
    // System.out.println("---------|||||" + re);
    agentResponse.setData(rs);
    return agentResponse;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ServletRequestAttributes(org.springframework.web.context.request.ServletRequestAttributes) AuthChecker(com.code.server.login.anotation.AuthChecker) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with AuthChecker

use of com.code.server.login.anotation.AuthChecker in project summer by foxsugar.

the class TodayChargeAction method showTodayOneLevelChargeList.

@AuthChecker
// 直接玩家
@RequestMapping("/level1Charges")
public AgentResponse showTodayOneLevelChargeList() {
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    HttpServletRequest request = attributes.getRequest();
    long agentId = AgentUtil.getAgentByRequest(request);
    OneLevelVo oneLevelVo = todayChargeService.oneLevelCharges(agentId);
    Map<String, Object> result = new HashMap<>();
    result.put("result", oneLevelVo);
    AgentResponse agentResponse = new AgentResponse(200, result);
    return agentResponse;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ServletRequestAttributes(org.springframework.web.context.request.ServletRequestAttributes) AuthChecker(com.code.server.login.anotation.AuthChecker) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with AuthChecker

use of com.code.server.login.anotation.AuthChecker in project summer by foxsugar.

the class TodayChargeAction method homeCharge.

@AuthChecker
@RequestMapping("/homeCharge")
public AgentResponse homeCharge() {
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    HttpServletRequest request = attributes.getRequest();
    long agentId = AgentUtil.getAgentByRequest(request);
    HomeChargeVo homeChargeVo = todayChargeService.showCharge(agentId);
    Map<String, Object> result = new HashMap<>();
    result.put("result", homeChargeVo);
    AgentResponse agentResponse = new AgentResponse(200, result);
    return agentResponse;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ServletRequestAttributes(org.springframework.web.context.request.ServletRequestAttributes) AuthChecker(com.code.server.login.anotation.AuthChecker) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with AuthChecker

use of com.code.server.login.anotation.AuthChecker in project summer by foxsugar.

the class TodayChargeAction method showTodayThreeLevelChargeList.

@AuthChecker
// 二级代理充值记录
@RequestMapping("/dlevel3Charges")
public AgentResponse showTodayThreeLevelChargeList(String start, String end) {
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    HttpServletRequest request = attributes.getRequest();
    long agentId = AgentUtil.getAgentByRequest(request);
    Date startDate = DateUtil.convert2Date(start);
    Date endDate = DateUtil.convert2Date(end);
    ThreeLevelVo threeLevelVo = todayChargeService.threeLevelCharges(startDate, endDate, agentId);
    Map<String, Object> result = new HashMap<>();
    result.put("result", threeLevelVo);
    AgentResponse agentResponse = new AgentResponse(200, result);
    return agentResponse;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ServletRequestAttributes(org.springframework.web.context.request.ServletRequestAttributes) AuthChecker(com.code.server.login.anotation.AuthChecker) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

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