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

Atitit  代理与分销系统(1)  子代理 充值总额功能设计概览 sum() groubpy subagt的更多相关文章

  1. Atitit.atiagent  agent分销系统 代理系统 设计文档

    Atitit.atiagent  agent分销系统 代理系统 设计文档 1. 启动项目1 2. 首也2 3. 登录功能2 4. 用户中心2 5. 充值查询3 6. 授权下级代理4 7. 我的提成5 ...

  2. net-snmp子代理(SubAgent)编写详述

    net-snmp子代理(SubAgent)编写 net-snmp子代理(SubAgent)编写 Netsnmp_Node_Handler MIB/OID定义 1.头文件test.h的编写 2.test ...

  3. snmpd 子代理模式编译测试

    1.参考链接 1)Net-snmp添加子代理示例 https://blog.csdn.net/eyf0917/article/details/39546651   2.操作步骤 1)网络拷贝下面的文件 ...

  4. atitit. 分销系统规划p8k

    atitit. 分销系统规划p8k 1. 商户平台管理 overview2 1.1. 分销业务管理2 1.2. 文案管理2 1.3. 订单管理3 1.4. 统计报表3 1.5. 财务结算3 1.6.  ...

  5. snmp agent 表格实现(子代理方式实现)

    前奏參见例如以下: http://blog.sina.com.cn/s/blog_8f3de3250100xhao.html http://blog.csdn.net/hepeng597/articl ...

  6. 细说java系统之动态代理

    代理模式 在深入学习动态代理之前,需要先掌握代理模式.只有深刻理解了代理模式的应用,才能充分理解Java动态代理带来的便利. 在生活中存在许多使用"代理模式"的场景,比如:村里的张 ...

  7. 信用卡分销系统源码、分销系统定制贴牌、信用卡三级分销系统源码、信用卡返佣系统OEM

    信用卡返佣分销系统贴牌,全套源码,可定制UI界面 这一整套绝对是市场上最完善最好的一套系统:里面的特色功能: 1.合伙人功能,解决你前期的资金以及资源问题 2.推广素材库,全方位增加推广效率 3.红包 ...

  8. Spring学习总结(二)——静态代理、JDK与CGLIB动态代理、AOP+IoC

    一.为什么需要代理模式 假设需实现一个计算的类Math.完成加.减.乘.除功能,如下所示: package com.zhangguo.Spring041.aop01; public class Mat ...

  9. 动态代理的两种方式,以及区别(静态代理、JDK与CGLIB动态代理、AOP+IoC)

    Spring学习总结(二)——静态代理.JDK与CGLIB动态代理.AOP+IoC   目录 一.为什么需要代理模式 二.静态代理 三.动态代理,使用JDK内置的Proxy实现 四.动态代理,使用cg ...

随机推荐

  1. python 实现彻底删除文件夹和文件夹下的文件

    python 中有很多内置库可以帮忙用来删除文件夹和文件,当面对要删除多个非空文件夹,并且目录层次大于3层以上时,仅使用一种内置方法是无法达到彻底删除文件夹和文件的效果的,比较low的方式是多次调用直 ...

  2. 在Windows上编译最新的CURL,含有zlib,openssl

    最近,从网上下载了一个curl库,使用时各种报错,都无法启动,于是干脆就直接自己编译了. 1. 准备工作 a. 下载zlib zlib可以使得HTTP请求支持gzip压缩,其地址如下: 官网:http ...

  3. 【fortify】安全漏洞的分类

    https://vulncat.hpefod.com/zh-cn 下面摘要著名的软件安全专家Gary Mc Graw的2006年的新书<Software Security building se ...

  4. ubuntu引导修复

    很多人在自己电脑上装了双系统,我自己装了win7和ubuntu14.04,主要还是用win7,但是有时候win7系统崩溃掉时只能重装咯,重装后发现ubuntu的引导不见了,我也试过在windows下修 ...

  5. oracle中imp命令详解 .

    转自http://www.cnblogs.com/songdavid/articles/2435439.html oracle中imp命令详解 Oracle的导入实用程序(Import utility ...

  6. coalesce函数用法

    COALESCE函数会依次检查输入的参数,返回第一个不是NULL的参数,只有当传入COALESCE函数的所有的参数都是NULL的时候,函数才会返回NULL

  7. Jquery 表单验证

    <html>     <head>         <meta http-equiv="content-type" content="tex ...

  8. Python成长笔记 - 基础篇 (九)

    创建一个socketserver 至少分以下几步: First, you must create a request handler class by subclassing the BaseRequ ...

  9. PHP自带Session隐患(session文件独占锁引起阻塞)

    PHP自带Session隐患(session文件独占锁引起阻塞) PHP默认的会话处理器是session.save_handler = files(即文件).如果同一个客户端同时并发发送多个请求(如a ...

  10. 微信内置浏览器的JS API

    /**! * 微信内置浏览器的Javascript API,功能包括: * * 1.分享到微信朋友圈 * 2.分享给微信好友 * 3.分享到腾讯微博 * 4.新的分享接口,包含朋友圈.好友.微博的分享 ...