package com.diagbot.facade;

import com.diagbot.dto.RetrievalDTO;
import com.diagbot.entity.QuestionInfo;
import com.diagbot.service.impl.RetrievalServiceImpl;
import com.diagbot.vo.RetrievalVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @author: wangyu
 * @time: 2018/11/27 14:54
 */
@Component
public class RetrievalFacade extends RetrievalServiceImpl {

    @Autowired
    QuestionFacade questionFacade;
    /**
     * 获取标签信息
     *
     * @param retrievalVO
     * @return
     */
    public List<RetrievalDTO> getTagInfos(RetrievalVO retrievalVO) {
        //获取同义词标签信息
        List<RetrievalDTO> data = this.getSymptopInfo(retrievalVO);
        //将标签名放入实体
        Map<Long, QuestionInfo> map = questionFacade.getQuestionInfos();
        for (RetrievalDTO retrievalDTO:data) {
            retrievalDTO.setTagName(map.get(retrievalDTO.getQuestionId()).getTagName());
        }
        return data;
    }
}
