0

我有这个数据结构

Class Project { 
String status;
Property property ; 
String clientName ; 
Localdate date;

}

现在从这个对象我想使用java 8流方法得到这个数据结构作为输出

{
  "Spring hill recent": {  //client name
    "Dallas": [{  //property name
      month: 'January',  // date
      "overdue": 20,     //accumulation based on how much project falls under this status
      "inprogress": 30,
      "new": 50
    }, {
      month: 'February',
      "overdue": 30,
      "inprogress": 40,
      "new": 50
    }, {
      month: 'March',
      "overdue": 67,
      "inprogress": 45,
      "new": 23
    }]
      month: 'April',
      "overdue": 80,
      "inprogress": 40,
      "new": 20
    }, {
      month: 'December',
      "overdue": 10,
      "inprogress": 30,
      "new": 30
    }, {
      month: 'February',
      "overdue": 90,
      "inprogress": 23,
      "new": 56
    }],
  },
}

到目前为止,我已经添加了此代码,但我不知道如何进行累积

 List<Project> projects = projectRepository.fetchActiveNewAndOverDueProject();
        Map<String, Map<String, List<Project>>> collect = projects.stream()
            .collect(Collectors.groupingBy(Project::getClientName,
                Collectors.groupingBy(property -> property.getProperty(),getName())
            ))
4

0 回答 0