package com.zm.order.tool.server.helper;


import com.zm.order.tool.server.dto.OrderItemCommentDTO;
import com.zm.order.tool.server.message.CommentDocumentMessage;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author nianchang
 * @ClassName OrderCommentHelper
 * @date 2021/04/07 10:58 上午
 */
@Component
public class CommentHandlerHelper {

    public List<CommentDocumentMessage> buildAsyncEs(List<OrderItemCommentDTO> itemCommentList) {
        List<CommentDocumentMessage> commentToEsDTOList  = new ArrayList<>(itemCommentList.size());
        for (OrderItemCommentDTO itemCommentDTO : itemCommentList) {
            CommentDocumentMessage commentToEsDTO = new CommentDocumentMessage();
            commentToEsDTO.setSellerId(itemCommentDTO.getSellerId());
            commentToEsDTO.setOrderNo(itemCommentDTO.getOrderNo());
            commentToEsDTO.setGoodsId(itemCommentDTO.getGoodsId());
            commentToEsDTO.setItemId(itemCommentDTO.getItemId());
            commentToEsDTOList.add(commentToEsDTO);
        }
        return commentToEsDTOList;
    }
}





