メソッド参照に不正な戻り値の型を修正する方法:RにRecipeIndicatorsDtoを変換することはできませんか?

下のエラーを修復するには?

メソッド参照で不正な戻り値の型:RにRecipeIndicatorsDtoを変換することはできません

みんなありがとう

public List<RecipeIndicatorsDto> listByUploadTime(LocalDateTime localDateTime) {
    if(localDateTime!=null) {
        QRecipeIndicator qRecipeIndicator = recipeIndicatorRepo.getQEntity();
        QOrder qOrder=orderRepo.getQEntity();
        List<Predicate> predicates = new ArrayList<>();
        predicates.add(qRecipeIndicator.uploadTime.before(localDateTime));
        List<RecipeIndicator> recipeIndicators = recipeIndicatorRepo.find(predicates, new PageRequest(0, 100));
        List<Order> orders=orderRepo.find(null,new PageRequest(0,100));
        return recipeIndicators.stream()
                               .map(DtoFactory::recipeIndicatorsDto)
                               .collect(Collectors.toList());

パブリック静的RecipeIndicatorsDto recipeIndicatorsDto(RecipeIndicator recipeIndicator、受注オーダー){場合(recipeIndicator = NULL &&順= nullを!){RecipeIndicatorsDto recipeIndicatorsDto =新しいRecipeIndicatorsDto(); recipeIndicatorsDto.setVerificationStatus(recipeIndicator.getVerificationStatus())。
recipeIndicatorsDto.setUploadTime(recipeIndicator.getUploadTime())。recipeIndicatorsDto.setRemark(order.getRemark())。recipeIndicatorsDto.setUseDays(order.getUseDays())。

彼らは次のとおりでした:

DtoFactory::recipeIndicatorsDto必要とする静的メソッドへのメソッド参照されRecipeIndicatorたパラメータとOrderパラメータ。あなたはそれを渡しているのでmapStream<RecipeIndicator>、唯一のRecipeIndicatorインスタンスが使用可能です。

代わりに、ラムダ式を使用することができます。

.map(recipeIndicator -> DtoFactory.recipeIndicatorsDto(recipeIndicator, qOrder))

私はわからないんだけどOrder、あなたがそれに渡すインスタンス。私はそれがあるかもしれない推測しましたqOrder

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=214128&siteId=1