|
|
@ -2,7 +2,6 @@ package com.bfd.mf.service; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.bfd.mf.common.service.common.CrudService; |
|
|
|
import com.bfd.mf.common.service.es.ClusterService; |
|
|
|
import com.bfd.mf.common.service.es.EsQueryAuthorCountService; |
|
|
|
import com.bfd.mf.common.service.es.EsQueryAuthorService; |
|
|
|
import com.bfd.mf.common.service.es.SubjectQueryDataService; |
|
|
@ -13,6 +12,7 @@ import com.bfd.mf.common.web.repository.mysql.SentimentRepository; |
|
|
|
import com.bfd.mf.common.web.repository.mysql.base.SiteRepository; |
|
|
|
import com.bfd.mf.common.web.vo.params.QueryRequest; |
|
|
|
import com.bfd.mf.common.web.vo.view.monitor.ESMonitorEntity; |
|
|
|
import com.bfd.mf.config.BFDApiConfig; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -28,7 +28,7 @@ import java.util.Map; |
|
|
|
public class SearchAuthorService extends CrudService<SentimentModify, SentimentRepository> implements Serializable { |
|
|
|
private static Logger logger = LoggerFactory.getLogger(SearchAuthorService.class); |
|
|
|
@Autowired |
|
|
|
private ClusterService clusterService; |
|
|
|
private BFDApiConfig bfdApiConfig; |
|
|
|
@Autowired |
|
|
|
private SubjectQueryDataService subjectQueryDataService; |
|
|
|
@Autowired |
|
|
@ -75,8 +75,8 @@ public class SearchAuthorService extends CrudService<SentimentModify, SentimentR |
|
|
|
public JSONObject queryAuthorByAuthorId(QueryRequest queryRequest) { |
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
try { |
|
|
|
Cluster cluster = clusterService.findClusterByType(Cluster.CLUSTER_TYPE.mini_cluster_type); |
|
|
|
String indexName = cluster.getPrefixIndexPattern() +"_"+ queryRequest.getSubjectId(); |
|
|
|
//Cluster cluster = clusterService.findClusterByType(Cluster.CLUSTER_TYPE.mini_cluster_type); |
|
|
|
String indexName = bfdApiConfig.getIndexNamePre()+ queryRequest.getSubjectId(); |
|
|
|
String[] indexNames = {indexName}; |
|
|
|
List<JSONObject> dataList = esQueryAuthorService.queryAuthorByAuthorId(indexNames, queryRequest); |
|
|
|
jsonObject = parseAuthorMessage(dataList); |
|
|
@ -135,8 +135,8 @@ public class SearchAuthorService extends CrudService<SentimentModify, SentimentR |
|
|
|
public JSONObject queryContentsByAuthorId(QueryRequest queryRequest) { |
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
try { |
|
|
|
Cluster cluster = clusterService.findClusterByType(Cluster.CLUSTER_TYPE.mini_cluster_type); |
|
|
|
String indexName = cluster.getPrefixIndexPattern()+ "_" + queryRequest.getSubjectId(); |
|
|
|
// Cluster cluster = clusterService.findClusterByType(Cluster.CLUSTER_TYPE.mini_cluster_type); |
|
|
|
String indexName =bfdApiConfig.getIndexNamePre()+ queryRequest.getSubjectId(); |
|
|
|
String indexNames[] = {indexName}; |
|
|
|
List<JSONObject> dataList = esQueryAuthorService.queryContentsByAuthorId(indexNames, queryRequest); |
|
|
|
List<ESMonitorEntity> esMonitorEntityLists = new ArrayList<>(); |
|
|
@ -280,8 +280,8 @@ public class SearchAuthorService extends CrudService<SentimentModify, SentimentR |
|
|
|
} |
|
|
|
|
|
|
|
private String[] getIndexNames(QueryRequest queryRequest) { |
|
|
|
Cluster cluster = clusterService.findClusterByType(Cluster.CLUSTER_TYPE.mini_cluster_type); // 111 |
|
|
|
List<String> currentIndexList = subjectQueryDataService.getIndexBySubjectIds(cluster, queryRequest.getSubjectId()); |
|
|
|
// Cluster cluster = clusterService.findClusterByType(Cluster.CLUSTER_TYPE.mini_cluster_type); // 111 |
|
|
|
List<String> currentIndexList = subjectQueryDataService.getIndexBySubjectIds( queryRequest.getSubjectId()); |
|
|
|
String[] indexName = currentIndexList.toArray(new String[currentIndexList.size()]); |
|
|
|
return indexName; |
|
|
|
} |
|
|
|