遍歷HashMap

public String query() {
		agentList = bizCardAgentService.findAll();
		daiOilOrderRecordStatusMap = DaiOilOrderRecordStatus.toStringMap();
		// 統計總數
		totalRecord = 0;
		totalSuccessAmount = 0;
		List<HashMap> list = (List<HashMap>) this.getValueList().getList();
		for (int i = 0; i < list.size(); i++) {
			Map rowMap = (Map) list.get(i);
			if(rowMap.get("status").toString().equals("Success")){
				totalRecord += 1;
				try {
					totalSuccessAmount += new Double(rowMap.get("amount").toString());
				} catch (Exception e) {
					// TODO: handle exception
				}
			}
		}
		return super.query();
	}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章