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());
}
本文来自博客园,作者:aspirant,转载请注明原文链接:https://www.cnblogs.com/aspirant/p/14686264.html