public Map list(HttpServletRequest request) {
PageInfo pageInfo = WebUtils.newPageInfo(request);
WaybillInfo waybillInfo = WebUtils.newObject(WaybillInfo.class,
"waybill", request);
UserInfo userInfo = UserInfo.get();
waybillInfo.setOwner(userInfo.getUserNo());
List<String> roleList = roleUserMapper.queryList(userInfo.getUserNo());
waybillInfo.setRoleList(roleList);
List<WaybillInfo> waybillList = waybillMapper.list(waybillInfo,
pageInfo);
List<WaybillInfo> footerList = new ArrayList<WaybillInfo>();
// 总运费 汇总 求余
double sumttlfee = 0;
double avettlfee = 0;
// 申请金额 汇总 求余
double sumappfncamt = 0;
double aveappfncamt = 0;
for (int i = 0; i < waybillList.size(); i++) {
sumttlfee += Double.parseDouble(waybillList.get(i).getTtlfee());
sumappfncamt += Double.parseDouble(waybillList.get(i)
.getAppfncamt());
}
avettlfee = sumttlfee / waybillList.size();
aveappfncamt = sumappfncamt / waybillList.size();
WaybillInfo waybillInfo2 = new WaybillInfo();
// 平均值
waybillInfo2.setTtlfee(String.format("%.2f", avettlfee));
waybillInfo2.setAppfncamt(String.format("%.2f", aveappfncamt));
waybillInfo2.setMile("平均价格:");
// 总和
WaybillInfo waybillInfo3 = new WaybillInfo();
waybillInfo3.setTtlfee(String.format("%.2f", sumttlfee));
waybillInfo3.setAppfncamt(String.format("%.2f", sumappfncamt));
waybillInfo3.setMile("总价格:");
footerList.add(waybillInfo2);
footerList.add(waybillInfo3);
// 返回结果
Map<String, Object> result = new HashMap<String, Object>();
result.put("rows", waybillList);
result.put("total", pageInfo.getTotalCount());
result.put("footer", footerList);
return result;
}