Commit 9cd379a1 authored by tianyiming's avatar tianyiming

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

parent 9d49011c
...@@ -21,6 +21,7 @@ import org.elasticsearch.index.query.QueryBuilders; ...@@ -21,6 +21,7 @@ import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -47,6 +48,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -47,6 +48,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Autowired @Autowired
CylinderFillingRecordMapper cylinderFillingRecordMapper; 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 ...@@ -178,7 +185,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize); Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize);
RestHighLevelClient esClient = new RestHighLevelClient( 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(); SearchRequest request = new SearchRequest();
......
...@@ -129,6 +129,12 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -129,6 +129,12 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
@Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}") @Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}")
private String cylPackageId; private String cylPackageId;
@Value("${biz.elasticsearch.address}")
private String esAddress;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Autowired @Autowired
StartPlatformTokenService startPlatformTokenService; StartPlatformTokenService startPlatformTokenService;
...@@ -711,7 +717,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -711,7 +717,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize); Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize);
RestHighLevelClient esClient = new RestHighLevelClient( 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(); SearchRequest request = new SearchRequest();
......
...@@ -39,6 +39,7 @@ eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.por ...@@ -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 eureka.instance.ip-address = 172.16.3.34
## ES properties: ## ES properties:
biz.elasticsearch.port=9200
biz.elasticsearch.address=36.46.151.113 biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=docker-cluster spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300 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