|
@@ -18,6 +18,7 @@ import com.sxtvs.open.api.news.entity.YoumeiEsData;
|
|
|
import com.sxtvs.open.api.news.entity.YoumeiOffset;
|
|
|
import com.sxtvs.open.api.news.mapper.YoumeiDataMapper;
|
|
|
import com.sxtvs.open.api.news.service.IYoumeiDataService;
|
|
|
+import com.sxtvs.open.core.advice.BizException;
|
|
|
import com.sxtvs.open.core.es.EsClientPool;
|
|
|
import com.sxtvs.open.core.sls.AliyunLogger;
|
|
|
import jakarta.annotation.Resource;
|
|
@@ -133,12 +134,10 @@ public class YoumeiDataServiceImpl extends ServiceImpl<YoumeiDataMapper, YoumeiD
|
|
|
public YoumeiEsData getData(String id) {
|
|
|
try {
|
|
|
ElasticsearchClient elasticsearchClient = esClientPool.getClient();
|
|
|
- YoumeiEsData news_data = elasticsearchClient.search(x -> x.index("news_data").query(q -> q.ids(i -> i.values(id))), YoumeiEsData.class).hits().hits().get(0).source();
|
|
|
- return news_data;
|
|
|
+ return elasticsearchClient.search(x -> x.index("news_data").query(q -> q.ids(i -> i.values(id))), YoumeiEsData.class).hits().hits().get(0).source();
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ throw new BizException(40000, "未知数据");
|
|
|
}
|
|
|
- return null;
|
|
|
|
|
|
}
|
|
|
|