struts2 java

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;
 }

这是后台给的数据,什么意思

_天蝎座的你_0
浏览 1303回答 1
1回答

Finit

后台给的数据没贴出来啊
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java