Commit 9cd379a1 authored by tianyiming's avatar tianyiming

添加es配置及修改气瓶查询es相关连接

parent 9d49011c
......@@ -21,6 +21,7 @@ import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -47,6 +48,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Autowired
CylinderFillingRecordMapper cylinderFillingRecordMapper;
@Value("${biz.elasticsearch.address}")
private String esAddress;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
/**
* 分页查询
*/
......@@ -178,7 +185,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize);
RestHighLevelClient esClient = new RestHighLevelClient(
RestClient.builder(new HttpHost("36.46.151.113", 9200, "http"))
RestClient.builder(new HttpHost(esAddress, esPort, "http"))
);
SearchRequest request = new SearchRequest();
......
......@@ -129,6 +129,12 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
@Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}")
private String cylPackageId;
@Value("${biz.elasticsearch.address}")
private String esAddress;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Autowired
StartPlatformTokenService startPlatformTokenService;
......@@ -711,7 +717,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize);
RestHighLevelClient esClient = new RestHighLevelClient(
RestClient.builder(new HttpHost("36.46.151.113", 9200, "http"))
RestClient.builder(new HttpHost(esAddress, esPort, "http"))
);
SearchRequest request = new SearchRequest();
......
......@@ -39,6 +39,7 @@ eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.por
eureka.instance.ip-address = 172.16.3.34
## ES properties:
biz.elasticsearch.port=9200
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment