Atitit 代理与分销系统(1) 子代理 充值总额功能设计概览 sum() groubpy subagt
Atitit 代理与分销系统(1) 子代理 充值总额功能设计概览 sum() groubpy subagt
Keyword
分组与聚合操作。
一个for做分组。。。里面的做聚合。。。
数据g操作查询api sql化
etRchgTotal_groupby_SubAgent_where_ParentAgentId(
[ { "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的更多相关文章
- Atitit.atiagent agent分销系统 代理系统 设计文档
Atitit.atiagent agent分销系统 代理系统 设计文档 1. 启动项目1 2. 首也2 3. 登录功能2 4. 用户中心2 5. 充值查询3 6. 授权下级代理4 7. 我的提成5 ...
- net-snmp子代理(SubAgent)编写详述
net-snmp子代理(SubAgent)编写 net-snmp子代理(SubAgent)编写 Netsnmp_Node_Handler MIB/OID定义 1.头文件test.h的编写 2.test ...
- snmpd 子代理模式编译测试
1.参考链接 1)Net-snmp添加子代理示例 https://blog.csdn.net/eyf0917/article/details/39546651 2.操作步骤 1)网络拷贝下面的文件 ...
- atitit. 分销系统规划p8k
atitit. 分销系统规划p8k 1. 商户平台管理 overview2 1.1. 分销业务管理2 1.2. 文案管理2 1.3. 订单管理3 1.4. 统计报表3 1.5. 财务结算3 1.6. ...
- snmp agent 表格实现(子代理方式实现)
前奏參见例如以下: http://blog.sina.com.cn/s/blog_8f3de3250100xhao.html http://blog.csdn.net/hepeng597/articl ...
- 细说java系统之动态代理
代理模式 在深入学习动态代理之前,需要先掌握代理模式.只有深刻理解了代理模式的应用,才能充分理解Java动态代理带来的便利. 在生活中存在许多使用"代理模式"的场景,比如:村里的张 ...
- 信用卡分销系统源码、分销系统定制贴牌、信用卡三级分销系统源码、信用卡返佣系统OEM
信用卡返佣分销系统贴牌,全套源码,可定制UI界面 这一整套绝对是市场上最完善最好的一套系统:里面的特色功能: 1.合伙人功能,解决你前期的资金以及资源问题 2.推广素材库,全方位增加推广效率 3.红包 ...
- Spring学习总结(二)——静态代理、JDK与CGLIB动态代理、AOP+IoC
一.为什么需要代理模式 假设需实现一个计算的类Math.完成加.减.乘.除功能,如下所示: package com.zhangguo.Spring041.aop01; public class Mat ...
- 动态代理的两种方式,以及区别(静态代理、JDK与CGLIB动态代理、AOP+IoC)
Spring学习总结(二)——静态代理.JDK与CGLIB动态代理.AOP+IoC 目录 一.为什么需要代理模式 二.静态代理 三.动态代理,使用JDK内置的Proxy实现 四.动态代理,使用cg ...
随机推荐
- n+1 < n , are you sure?
密码终于找回了,原来是我邮箱把改密链接的邮件当垃圾邮件了-- 回到正题,这是道面试题,原话大致是这样的: n+1<n成立吗?请说明. 当时我听到这个题后直觉是成立的,但是想不到怎么回事,后来别人 ...
- Class 'Illuminate\Html\HtmlServiceProvider' not found或者form表单不能正常使用解决办法
在laravel框架中,form不能正常使用如何处理. 网上搜到的解决方案通常都是一致的,下面分类考虑: 1,打开根目录composer.json 文件, require 里面增加: 如果larave ...
- Struts2之提交对象数组至后台
struts2中有许多很好的特性,比如在设置好getter和setter方法后,加上前端的匹配设置,后台即可自动将前端输入的数据转换为后台的相应的对象. 如现在传入一个Person类的对象,其中Per ...
- 给mysql的root用户
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
- Win7 64位 MinGW环境测试SDL2.0.3
下载MinGW版的文件 http://www.libsdl.org/release/SDL2-devel-2.0.3-mingw.tar.gz 解压放到mysys下面 运行Makefile mysys ...
- Don't Block on Async Code【转】
http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html This is a problem that is brough ...
- Java学习笔记 07 接口、继承与多态
一.类的继承 继承的好处 >>使整个程序架构具有一定的弹性,在程序中复用一些已经定义完善的类不仅可以减少软件开发周期,也可以提高软件的可维护性和可扩展性 继承的基本思想 >>基 ...
- BOOST1.54简化编译
1.设置环境变量 BOOST_ROOT E:\Projects\00.CODE.SDK\boost_1_54_0 2.运行bootstrap.bat 3.运行: bjam install --tool ...
- ubuntu 14.04 下evolution邮箱客户端设置(腾讯企业邮箱)
安装 evolution 有PPA可用,支持 Ubuntu 14.04 及衍生系统.打开终端,输入以下命令: sudo add-apt-repository ppa:fta/gnome3 sudo a ...
- SqlIO优化
1SqlIO优化 set statistics io on--sqlset statistics io off 2Sql占用CPU时间 select c.total_worker_time, c.la ...