list 转另一个list stream操作



private static List<PmsInventoryRecordDO> convertFromInventoryDoList(Long tenantId, Long ptnrId, InventoryRecordTypeEnum type, Long saleId, List<PmsInventoryDO> piDOList) {
if (CollectionUtils.isEmpty(piDOList)) {
return new ArrayList<>();
}
if (saleId == null || saleId <= 0) {
return new ArrayList<>();
}
return piDOList.stream()
.map(it -> {
PmsInventoryRecordDO pirDO = new PmsInventoryRecordDO();
pirDO.setGmtCreate(new Date());
pirDO.setGmtModified(new Date());
pirDO.setPriceId(it.getPriceId());
pirDO.setSaleId(saleId);
pirDO.setCount(it.getSaleCount());
pirDO.setType(type.getCode());
pirDO.setEventId(it.getEventId());
pirDO.setProjectId(it.getProjectId());
pirDO.setPtnrId(ptnrId);
pirDO.setTenantId(tenantId);
pirDO.setDataState(DataStateEnum.EFFECTIVE.getCode());
return pirDO;
}).collect(Collectors.toList());
}
 

 

posted @ 2021-04-21 18:00  aspirant  阅读(1439)  评论(0编辑  收藏  举报