反復Map<br>>

5363 ワード

この間、反復MapAspectVoはオブジェクトです.
具体的なページは以下の通りです.
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
   <th width="100%" height="30px" align="center" valign="middle" class="list_gridRB" colspan="6"> ( )</th>
   </tr>
    <tr>
	<th rowspan="2" colspan="2" align="center" valign="middle" class="list_gridRB"> </th>
	<th colspan="4" height="20" align="center" valign="middle" class="list_gridRB"> </th>
	</tr>
	<tr>
	<th height="20" align="center" valign="middle" class="list_gridRB"> </th>
	<th height="20" align="center" valign="middle" class="list_gridRB"> </th>
	<th height="20" align="center" valign="middle" class="list_gridRB"> </th>
	<th height="20" align="center" valign="middle" class="list_gridRB"> </th>
	</tr>
	<ww:iterator value="object.keySet()" id="key">
	<tr>
	<td width="20%" align="center" valign="middle" class="list_gridRB" rowspan="<ww:property value="(object.get(#key)).size()"/>"><ww:property value="#key"/></td>
	<ww:iterator value="object.get(#key)" status="status">
	<ww:if test="#status.count == 1">
	 <td width="20%" height="20"  ><ww:property value="aspectName"/></td>
	<td height="20"  ><ww:property value="base"/></td>
	<td height="20" ><ww:property value="pre"/></td>
	<td height="20"  >
	 <ww:if test="hPecent=='.00%'">0.00%</ww:if>
	<ww:else><ww:property value="hPecent"/></ww:else>
	</td>
	<td height="20" align="center" valign="middle" class="list_gridRB">
	<ww:if test="zPecent=='.00%'">0.00%</ww:if>
	 <ww:else><ww:property value="zPecent"/></ww:else>
	 </td>
	</ww:if>
	</ww:iterator>
	</tr>
	<ww:iterator value="object.get(#key)" status="sta">
	<ww:if test="#sta.count > 1">
	<tr>
	<td height="20"  ><ww:property value="aspectName"/></td>
	<td height="20"  ><ww:property value="base"/></td>
	<td height="20"  ><ww:property value="pre"/></td>
	 <td height="20"  >
	 <ww:if test="hPecent=='.00%'">0.00%</ww:if>
	 <ww:else><ww:property value="hPecent"/></ww:else>
	 </td>
	  <td height="20" align="center" valign="middle"  >
	<ww:if test="zPecent=='.00%'">0.00%</ww:if>
	 <ww:else><ww:property value="zPecent"/></ww:else>
	 </td>
	  </tr>
	 </ww:if>   
		</ww:iterator>
	</ww:iterator>
 </table>

AspectVoのコード:中の公式に注意
/**
 * 
 */
package com.hdzx.model;

import java.text.DecimalFormat;

/**
 * @author chendj
 *
 */
public class AspectVo {
	private String aspectName;// Id
	private Integer base;// 
	private Integer pre;// 
	private String hPecent;//   = ( - )/ *100%
	private String zPecent;//   =  / *100%
	
	public static Integer SUM = 0;// 
	
	public String getAspectName() {
		return aspectName;
	}
	public void setAspectName(String aspectName) {
		this.aspectName = aspectName;
	}
	public Integer getBase() {
		return base;
	}
	public void setBase(Integer base) {
		this.base = base;
	}
	public Integer getPre() {
		return pre;
	}
	public void setPre(Integer pre) {
		this.pre = pre;
	}
	public String getHPecent() {
		DecimalFormat df1 = new DecimalFormat("##.00%"); 
		if(base != 0)
			hPecent = df1.format((double)(base - pre)/base);
		else
			hPecent = df1.format(Double.valueOf(-pre));
		return hPecent;
	}
	public void setHPecent(String pecent) {
		hPecent = pecent;
	}
	public String getZPecent() {
		DecimalFormat df1 = new DecimalFormat("##.00%"); 
		if(SUM != 0)
			zPecent = df1.format((double)(base)/SUM);
		else
			zPecent = "0.00%";
		return zPecent;
	}
	public void setZPecent(String pecent) {
		zPecent = pecent;
	}
	
	
	
}