当前位置: 代码迷 >> 报表 >> jap 中展示梯形报表
  详细解决方案

jap 中展示梯形报表

热度:102   发布时间:2016-05-05 07:40:29.0
jap 中显示梯形报表
CREATE TABLE `reg_payer_payment_info` (	id bigint(20) not null auto_increment,  `reg_time` timestamp NOT NULL comment '注册日期',  `reg_num` int(11) default '0'  comment '注册人数',  `reg_sum` DOUBLE default '0'  comment '充值金额',  `price_total` double default '0'  comment '比率',  `days` int(11) NOT NULL default '0'  comment '注册多少天了',  `create_time` timestamp NOT NULL comment '计算日期',  PRIMARY KEY  (id)) ENGINE=INNODB DEFAULT CHARSET=utf8;


Java 代码是一个Map 里面嵌套一个List。
最开始的想法是
1.List里面放List
2.List里面放Map,Map再放List
3.Map里面放Map,Map再放List
4.Map里面Map
5.Map里面放List

Map regMap = new LinkedHashMap();		//循环分组		for(int i=0;i<=count;i++){			//分组时间			String reg = DateUtil.addDay(stu, i);			int regNum = 0;//注册人数			List li = new ArrayList();			for(int j=0;j<rppInfoList.size();j++){				if(DateUtil.DateToString(rppInfoList.get(j).getRegTime(), "yyyy-MM-dd").equals(reg)){					if(regNum==0){												regNum = rppInfoList.get(j).getRegNum();					}					li.add(rppInfoList.get(j).getPriceTotal());				}			}			regMap.put(reg+"|"+regNum, li);		}


Jsp页面
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>  <table align="left" border="0" class="viewTable"  >    		<tr>   			<th style="white-space:nowrap"  >统计注册付费率</th>   			<th>注册人数</th>					<c:forEach items="${regMap }" var="entry" varStatus="i">					<c:if test="${i.index < (fn:length(regMap))}">   					<th>   						${i.index+2 }   					</th>					</c:if>   			</c:forEach>		   		</tr>   		   		<c:forEach items="${regMap }" var="entry">   			<tr>   				<td >	   					${fn:split(entry.key,"|")[0] }   				</td>   				   				<td>	   					${fn:split(entry.key,"|")[1] }   				</td>   				<c:forEach items="${entry.value }" var="li">   					<td>   						<fmt:formatNumber value="${li}" pattern="####.##" />   					</td>   				</c:forEach>   			</tr>   		</c:forEach>   </table>
  相关解决方案