private void setExternalFieldsForStatusCode(KafkaBeamRequestDTO kafkaBeamRequestDTO, CommsHubReq commsHubReq) {
    RefundPromiseDateDTO refundPromiseDateDTO = getRefundPromiseDateDTO(kafkaBeamRequestDTO);
    CarrierData carrierData = wismrDetailsService.getCarrierDataForPromiseDateAndKiosk(refundPromiseDateDTO);
    String refundPromiseDate = wismrDetailsService.getRefundPromiseDate(carrierData);
    List<AttributeList> attributeList = commsHubReq.getPayload().getCommshub().getMessageDetails().getAttributeList();
    AttributeList attribute = attributeList.get(0);
    attribute.setRefundPromisedDate(refundPromiseDate);
    attribute.setIsSSKioskUsed(checkIfSSKioskUsed(carrierData));
    attribute.setCourier(kafkaBeamRequestDTO.getCarrierCode());
    List<DeliveryDetail> deliveryDetails = attribute.getDeliveryDetails();
    for (DeliveryDetail deliveryDetail : deliveryDetails) {
      deliveryDetail.setParcelCode(kafkaBeamRequestDTO.getParcelCode());
    }
  }
  
  update above code as per this logic 
  Confirm - If the request contains "sts001", use request to retrieve the return order number.
  Confirm - If the request contains either "sts002" or "sts004", use existing getCarrierDataByONoRetONoParCdStatCode to retrieve the return order number....(only findOne)

based on below sample code
  
  private void setCommsHubReturnOrderNumber(KafkaBeamRequestDTO kafkaBeamRequestDTO, CommsHubReq commsHubReq) {
    RefundPromiseDateDTO refundPromiseDateDTO = getRefundPromiseDateDTO(kafkaBeamRequestDTO);
    String returnNumber = fetchReturnNumber(kafkaBeamRequestDTO, refundPromiseDateDTO);
    if (returnNumber == null) {
      return;
    }
    List<AttributeList> attributeList = commsHubReq.getPayload().getCommshub().getMessageDetails().getAttributeList();
    AttributeList attribute = attributeList.get(0);
    attribute.setReturnNumber(returnNumber);
  }
  
  private String fetchReturnNumber(KafkaBeamRequestDTO kafkaBeamRequestDTO, RefundPromiseDateDTO refundPromiseDateDTO) {
    if (kafkaBeamRequestDTO.getReturnOrderNo() != null) {
      return kafkaBeamRequestDTO.getReturnOrderNo();
    } else if (kafkaBeamRequestDTO.getParcelCode() != null) {
      List<CarrierData> carrierDataList = null;
      if ("STS001".equals(refundPromiseDateDTO.getStatusCode())) {
        carrierDataList = wismrDetailsService.getCarrierDataByONoParCdStatCodeOldWism(refundPromiseDateDTO, true);
      } else if ("STS002".equals(refundPromiseDateDTO.getStatusCode())) {
        carrierDataList = wismrDetailsService.getCarrierDataByONoParCdStatCodeOldWism(refundPromiseDateDTO, false);
      }
      if (carrierDataList != null && carrierDataList.size() > 0) {
        return getReturnOrderNoFromLatestStatusDate(carrierDataList);
      }
    }
    return null;
  }
  
  private String getReturnOrderNoFromLatestStatusDate(List<CarrierData> carrierDataList) {
    // Check if there is only one element in the list
    if (carrierDataList.size() == 1) {
      return carrierDataList.get(0).getReturnOrderNo();
    }
    // Initialize most recent delivery date and corresponding carrier data
    LocalDate mostRecentDeliveryDate = null;
    CarrierData mostRecentCarrierData = null;
    for (CarrierData carrierData : carrierDataList) {
      if (carrierData.getStatusDetails() != null && carrierData.getStatusDetails().getDate() != null) {
        try {
          LocalDate statusDate = LocalDate.parse(carrierData.getStatusDetails().getDate());
          if (mostRecentDeliveryDate == null || statusDate.isAfter(mostRecentDeliveryDate)) {
            mostRecentDeliveryDate = statusDate;
            mostRecentCarrierData = carrierData;
          }
        } catch (DateTimeParseException e) {
          log.debug("Invalid date format, cannot parse date '{}' for order ref {}", carrierData.getStatusDetails().getDate(), carrierData.getOrderRef());
        }
      }
    }
    return mostRecentCarrierData == null ? null : mostRecentCarrierData.getReturnOrderNo();
  }