我正在使用以下代码在 java 中获得响应
List<Dto> Dtos = myConsignmentDao.fetchMyData(myConsignmentRequest);
if(!Dtos.isEmpty()){
List<MyConsignmentData> myDetails = Dtos.stream()
.collect(Collectors.groupingBy(Dto::getConsignmentNumber))
.entrySet().stream()
.map(myConsData -> getMyData(myConsData))
.collect(Collectors.toList());
myResponse.setMyConsignments(myDetails);
myResponse.setMyConsignments(myDetails);
return myResponse;
}
}
我的回应是
{
"myNumber": [
{
"Number": "12345",
"consignmentItems": [
{
"ItemNumber": "678954",
"deliveryDate": "2021-01-05 09:09:53+00"
}
],
"emailAddress": "myresult@gmail.com",
"mobileNumber": "+91377383",
"partyType": "Receiver",
"creationDate": "2020-12-29"
}
我已经使用通量编写了代码
Flux<MtDto> myDtos = myDao.fetchMyData(myConsignmentRequest);
myDtos.groupBy(MyConsignmentsDto::getConsignmentNumber).collectList();
因此,我只得到根对象字段,即 myNumber、mobileNumber、电子邮件地址而不是 itemNumber 和交货日期,有人可以帮助我使用 webflux 编写代码。