...
|
...
|
@@ -9,8 +9,10 @@ import com.yoho.search.consumer.index.fullbuild.RobotQuestionIndexBuilder; |
|
|
import com.yoho.search.consumer.index.increment.AbstractMqListener;
|
|
|
import com.yoho.search.consumer.service.daoService.RobotKnowledgeBaseService;
|
|
|
import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
|
|
|
import com.yoho.search.dal.RobotRelatedQuestionMapper;
|
|
|
import com.yoho.search.dal.model.RobotKnowledgeBase;
|
|
|
import com.yoho.search.dal.model.RobotQuestionIndexBO;
|
|
|
import com.yoho.search.dal.model.RobotRelatedQuestion;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
...
|
...
|
@@ -32,6 +34,8 @@ public class RobotKnowledgeBaseMqListener extends AbstractMqListener { |
|
|
private RobotKnowledgeBaseService robotKnowledgeBaseService;
|
|
|
@Autowired
|
|
|
private RobotQuestionIndexBuilder robotQuestionIndexBuilder;
|
|
|
@Autowired
|
|
|
private RobotRelatedQuestionMapper robotRelatedQuestionMapper;
|
|
|
|
|
|
@Override
|
|
|
public String getIndexName() {
|
...
|
...
|
@@ -46,7 +50,12 @@ public class RobotKnowledgeBaseMqListener extends AbstractMqListener { |
|
|
@Override
|
|
|
protected void deleteData(String id) throws Exception {
|
|
|
robotKnowledgeBaseService.delete(Integer.valueOf(id));
|
|
|
indexService.deleteIndexData(this.getIndexName(), id);
|
|
|
List<Integer> ids = new ArrayList<>();
|
|
|
ids.add(Integer.valueOf(id));
|
|
|
List<RobotRelatedQuestion> robotRelatedQuestions = robotRelatedQuestionMapper.selectListsByKnowledgeBaseIds(ids);
|
|
|
for(RobotRelatedQuestion robotRelatedQuestion:robotRelatedQuestions){
|
|
|
indexService.deleteIndexData(this.getIndexName(), robotRelatedQuestion.getId().toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
...
|
...
|
|