预览
public boolean saveImport(OrderImportRecordVO orderImportRecord) {
List<Store> stores = storeService.list();
String storeName = orderImportRecord.getStoreName();
Store store = stores.stream()
.filter(item -> Func.equals(item.getName(), storeName))
.findFirst()
.get();
if (Func.isEmpty(store)) {
throw new ServiceException("店铺不存在!!");
}
orderImportRecord.setStoreId(store.getId());
orderImportRecord.setImportStatus(0);
return save(orderImportRecord);
}
核心代码
Store store = stores.stream()
.filter(item -> Func.equals(item.getName(), storeName))
.findFirst()
.get();