zoukankan      html  css  js  c++  java
  • Atitit  代理与分销系统(1)  子代理 充值总额功能设计概览 sum() groubpy subagt

    Atitit  代理与分销系统(1)  子代理 充值总额功能设计概览 sum() groubpy subagt

     

     

    Keyword

    分组与聚合操作。

    一个for做分组。。。里面的做聚合。。。

    数据g操作查询api sql

    etRchgTotal_groupby_SubAgent_where_ParentAgentId(

     

     

    http://localhost:8080/agentNrecharge/sub_total_overview.htm?begindate=2016-06-09&enddate=2016-06-09&cnn=3&parent_id=888888

     

     

     

     

    http://localhost:8080/wrmiServletV3?iocx=com.attilax.ioc.Ioc4agent&$rdm=0.5026763516943902&$code=new(com.attilax.agent.AgentRechargeService).getSubAgentNtotalsByParentAgentId(888888)

     

     

    [ { "uid":"200005", "total":0 }, { "uid":"20002422", "total":0 }, { "uid":"200024", "total":0 }, { "uid":"200025", "total":0 } ]

     

     

    00001. 

    $code:

    00002. 

    new(com.attilax.orm.AtiOrmV2).queryAsRzt("select sum(rmb) sumx from recharge where status=1 and accountId in ( select id as uid from account where promoter=888888 )")

    00003. 

     

    http://localhost:8080/wrmiServletV3?iocx=com.attilax.ioc.Ioc4agent&$rdm=0.8521046019159257&__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATEGENERATOR=735FCFCE&hid_cDate=2016-06-09&hid_cDate2=2016-06-09&mylist%24ctl00%24hid_Agentuid=111755&$code=new(com.attilax.orm.AtiOrmV2).queryAsRzt("select%20sum(rmb)%20sumx%20from%20recharge%20%20where%20status%3D1%20and%20accountId%20in%20(%20%20select%20id%20as%20uid%20from%20account%20where%20promoter%3D888888%20)")&$utype=agent

     

     

     

    /atiplat_cms/src/com/attilax/agent/AgentRechargeService.java

    分组

    public List getRchgTotal_groupby_SubAgent_where_ParentAgentId(String pid) {

    String sql = " select uid from  agent where  parent_id=$pid$";

    sql = sql.replace("$pid$", pid);

    List<Map> li = dbsvr.findBySql(sql);

    for (Map map : li) {

    String subAgentId = (String) map.get("uid");

    Map m = Maps.newLinkedHashMap();

    m.put("promoter", subAgentId);

    BigDecimal money = getRchgTotalsRecycleByAgentId(subAgentId);

    map.put("total", money);

    }

     

    return li;

     

    }

     

     

    聚合

     

    /**

     * sub mem ,self ,and subagt

    attilax    2016年11月7日  下午5:14:57

     * @param subAgentId

     * @return

     */

    public BigDecimal getRchgTotalsRecycleByAgentId(String subAgentId) {

    //Map m

    BigDecimal SubMemTotal= getSubMemTotalByAgentId(subAgentId,Maps.newConcurrentMap());

    String agent_id=subAgentId;

    BigDecimal self=getSelfTotalByUid(subAgentId);

    SubMemTotal=SubMemTotal.add(self);

    //calc sub agent 's  member recharge

    String sql = " select uid from  agent where  parent_id=$pid$";

    sql = sql.replace("$pid$", agent_id);

    List<Map> li = dbsvr.findBySql(sql);

    for (Map map : li) {

    String sub_id=(String) map.get("uid");

    //Map m2=Maps.newLinkedHashMap();

    //m2.putAll(subAgentId);

    //m2.put("promoter",sub_id);

    BigDecimal SubMemTotal2=getRchgTotalsRecycleByAgentId(sub_id);

    SubMemTotal=SubMemTotal.add(SubMemTotal2);

    }

    return SubMemTotal; 

     

    }

     

    作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 

    汉字名:艾提拉(艾龙)   EMAIL:1466519819@qq.com

    转载请注明来源: http://www.cnblogs.com/attilax/

    Atiend

     

  • 相关阅读:
    c++关于析构的那点小事(个人吐槽向
    我分析内存泄漏的一道作业题,已解决
    大一上学期的一点小疑惑,代码验证ok
    C++类型转换
    c++形参改变实参(对指针的理解
    c++整型->字符型转换
    [转]二重积分换元法的一种简单证明 (ps:里面的符号有点小错误,理解就好。。。
    c++实现矩阵类矩阵行列式,伴随矩阵,逆矩阵
    假期周计划2.0
    大道至简
  • 原文地址:https://www.cnblogs.com/attilax/p/6041152.html
Copyright © 2011-2022 走看看