public String getBrokerReward() throws Exception {
User user = (User) session("user");
Long userId = user.getId();// 获得用户编号
pageBean.setPageNum(1);
pageBean.setPageSize(12);
myHomeService.getEveryMonthReward(pageBean, userId);
List<Map<String, Object>> list = pageBean.getPage();
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
for (int i = 0; i < 12; i++) {
String month = dateFormat.format(DateUtil.dateAddMonth(new Date(),
i - 12));
Map<String, Object> map = new HashMap<String, Object>();
map.put("month", month);
map.put("reward", 0.00);
map.put("rewardFormat", "0.00");
for(Map<String, Object> reward : list){
if(month.equals((String)reward.get("month"))){
map.put("reward", reward.get("reward"));
map.put("rewardFormat", reward.get("rewardFormat"));
list.remove(reward);
break;
}
}
resultList.add(map);
}
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("result", resultList);
JSONUtils.printObject(resultMap);
return null;
}
这是后台给的数据,什么意思
Finit
相关分类