Commit 3da02830 authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_main' into develop_tzs_register

parents 36909b54 2959bad5
package com.yeejoin.amos.api.openapi.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean(destroyMethod = "close")
@Qualifier("highLevelClient")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
package com.yeejoin.amos.boot.module.elevator.biz.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean(destroyMethod = "close")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
package com.yeejoin.amos.boot.module.app.biz.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean(destroyMethod = "close")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
package com.yeejoin.amos.boot.module.jg.biz.config; package com.yeejoin.amos.boot.module.common.api.config;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.auth.AuthScope; import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider; import org.apache.http.client.CredentialsProvider;
...@@ -12,7 +13,9 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -12,7 +13,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64;
@Configuration @Configuration
public class ElasticSearchClientConfig { public class ElasticSearchClientConfig {
...@@ -34,13 +37,18 @@ public class ElasticSearchClientConfig { ...@@ -34,13 +37,18 @@ public class ElasticSearchClientConfig {
try { try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new); HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts); RestClientBuilder builder = RestClient.builder(httpHosts);
// 全局HTTP客户端配置
builder.setHttpClientConfigCallback(httpClientBuilder -> { builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.disableAuthCaching(); httpClientBuilder.addInterceptorFirst((HttpRequestInterceptor) (request, context) -> {
String auth = username + ":" + password;
String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes(StandardCharsets.UTF_8));
request.setHeader("Authorization", "Basic " + encodedAuth);
});
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider) return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider)
.setMaxConnTotal(200) .setMaxConnTotal(200)
.setMaxConnPerRoute(60); .setMaxConnPerRoute(60);
}); });
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。 // 请求级参数配置
builder.setRequestConfigCallback(requestConfigBuilder -> { builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒) // 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000) return requestConfigBuilder.setConnectTimeout(5000 * 1000)
......
package com.yeejoin.amos.boot.module.cylinder.biz.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean(destroyMethod = "close")
@Qualifier("highLevelClient")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
package com.yeejoin.amos.boot.module.jczs.biz.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean(destroyMethod = "close")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
...@@ -61,4 +61,9 @@ public class BizRelationDataDto { ...@@ -61,4 +61,9 @@ public class BizRelationDataDto {
* 单据是否已经完成 * 单据是否已经完成
*/ */
private Boolean bizIsFinished; private Boolean bizIsFinished;
/**
* 是否需要保存时is_delete=1
*/
private Boolean needRecord = true;
} }
package com.yeejoin.amos.boot.module.jg.biz.controller; package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.yeejoin.amos.boot.module.jg.api.dto.JgResumeInfoDto; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List; import com.yeejoin.amos.boot.module.jg.api.dto.JgResumeInfoDto;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgResumeInfoServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgResumeInfoServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import io.swagger.annotations.Api;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/** /**
* 监管履历信息表 * 监管履历信息表
...@@ -111,7 +110,7 @@ public class JgResumeInfoController extends BaseController { ...@@ -111,7 +110,7 @@ public class JgResumeInfoController extends BaseController {
Page<JgResumeInfoDto> page = new Page<>(); Page<JgResumeInfoDto> page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
return ResponseHelper.buildResponse(jgResumeInfoServiceImpl.queryForJgResumeInfoPage(page, record)); return ResponseHelper.buildResponse(jgResumeInfoServiceImpl.queryForJgResumeInfoPage(page, record, false));
} }
/** /**
...@@ -123,7 +122,7 @@ public class JgResumeInfoController extends BaseController { ...@@ -123,7 +122,7 @@ public class JgResumeInfoController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询") @ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<JgResumeInfoDto>> selectForList() { public ResponseModel<List<JgResumeInfoDto>> selectForList() {
return ResponseHelper.buildResponse(jgResumeInfoServiceImpl.queryForJgResumeInfoList()); return ResponseHelper.buildResponse(jgResumeInfoServiceImpl.queryForJgResumeInfoList(false));
} }
} }
...@@ -29,7 +29,6 @@ import java.util.concurrent.Executors; ...@@ -29,7 +29,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import java.util.stream.Stream;
/** /**
* @author Administrator * @author Administrator
...@@ -133,6 +132,9 @@ public class ChangeLogInsertListener { ...@@ -133,6 +132,9 @@ public class ChangeLogInsertListener {
dto.setRecUserId(recUserId); dto.setRecUserId(recUserId);
dto.setStatus("正常"); dto.setStatus("正常");
dto.setRoutePath(routePath); dto.setRoutePath(routePath);
if (!event.getBizRelationData().getNeedRecord()) {
dto.setIsDelete(true);
}
jgResumeInfoService.createWithModel(dto); jgResumeInfoService.createWithModel(dto);
} catch (Exception e) { } catch (Exception e) {
log.error("插入设备履历日志异常,bizType: {}, 错误: {}", changeLog.getBizType(), e.getMessage(), e); log.error("插入设备履历日志异常,bizType: {}, 错误: {}", changeLog.getBizType(), e.getMessage(), e);
......
...@@ -18,6 +18,7 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.HandleRes ...@@ -18,6 +18,7 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.HandleRes
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy; import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgBizChangeLogServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgBizChangeLogServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -28,6 +29,9 @@ import java.util.stream.Collectors; ...@@ -28,6 +29,9 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public abstract class DefaultBizDataChangeHandler<U extends BaseBizDataChangeEvent> implements IBizDataChangeHandleStrategy { public abstract class DefaultBizDataChangeHandler<U extends BaseBizDataChangeEvent> implements IBizDataChangeHandleStrategy {
@Value("${save.sa.id:2008843301616119809}")
public Long saRoleId;
public static String IS_REQUIRES_TEMPORARY_SAVE = "isRequiresTemporarySave"; public static String IS_REQUIRES_TEMPORARY_SAVE = "isRequiresTemporarySave";
public static String TEMPORARY_PIPELINES_DATA = "temporaryPipelinesData"; public static String TEMPORARY_PIPELINES_DATA = "temporaryPipelinesData";
...@@ -137,6 +141,12 @@ public abstract class DefaultBizDataChangeHandler<U extends BaseBizDataChangeEve ...@@ -137,6 +141,12 @@ public abstract class DefaultBizDataChangeHandler<U extends BaseBizDataChangeEve
bizRelationDataDto.setUnitCode(selectedOrgInfo.getCompany().getCompanyCode()); bizRelationDataDto.setUnitCode(selectedOrgInfo.getCompany().getCompanyCode());
bizRelationDataDto.setUnitName(selectedOrgInfo.getCompany().getCompanyName()); bizRelationDataDto.setUnitName(selectedOrgInfo.getCompany().getCompanyName());
bizRelationDataDto.setBizIsFinished(bizIsFinished(applyNo)); bizRelationDataDto.setBizIsFinished(bizIsFinished(applyNo));
Map<Long, List<Long>> roles = selectedOrgInfo.getUserModel().getOrgRoleSeqs();
// 判断登录用户是否拥有超级编辑角色
List<Long> roleIds = roles.get(selectedOrgInfo.getCompany().getSequenceNbr());
if (roleIds.contains(saRoleId)) {
bizRelationDataDto.setNeedRecord(false);
}
if (!noPeatChangeFields.isEmpty()) { if (!noPeatChangeFields.isEmpty()) {
eventPublisher.publish(new BaseBizDataChangeEvent(this, bizRelationDataDto, noPeatChangeFields, RequestContext.cloneRequestContext())); eventPublisher.publish(new BaseBizDataChangeEvent(this, bizRelationDataDto, noPeatChangeFields, RequestContext.cloneRequestContext()));
} else { } else {
......
...@@ -320,7 +320,7 @@ public class EquipChangeDataUpdateServiceImpl { ...@@ -320,7 +320,7 @@ public class EquipChangeDataUpdateServiceImpl {
if (optional.isPresent()) { if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get(); ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(equipUseInfoChangeDataDto.getUseUnitCreditCode()); esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(equipUseInfoChangeDataDto.getUseUnitCreditCode());
esEquipmentCategoryDto.setUSC_UNIT_NAME(equipUseInfoChangeDataDto.getUseUnitName()); esEquipmentCategoryDto.setUSE_UNIT_NAME(equipUseInfoChangeDataDto.getUseUnitName());
esEquipmentCategoryDto.setUSE_INNER_CODE(equipUseInfoChangeDataDto.getUseInnerCode()); esEquipmentCategoryDto.setUSE_INNER_CODE(equipUseInfoChangeDataDto.getUseInnerCode());
esEquipmentCategoryDto.setUSE_PLACE(equipUseInfoChangeDataDto.getProvinceName() + "/" + equipUseInfoChangeDataDto.getCityName() + "/" + equipUseInfoChangeDataDto.getCountyName() + "/" + equipUseInfoChangeDataDto.getStreetName()); esEquipmentCategoryDto.setUSE_PLACE(equipUseInfoChangeDataDto.getProvinceName() + "/" + equipUseInfoChangeDataDto.getCityName() + "/" + equipUseInfoChangeDataDto.getCountyName() + "/" + equipUseInfoChangeDataDto.getStreetName());
esEquipmentCategoryDto.setUSE_PLACE_CODE(equipUseInfoChangeDataDto.getProvince() + "#" + equipUseInfoChangeDataDto.getCity() + "#" + equipUseInfoChangeDataDto.getCounty() + "#" + equipUseInfoChangeDataDto.getFactoryUseSiteStreet()); esEquipmentCategoryDto.setUSE_PLACE_CODE(equipUseInfoChangeDataDto.getProvince() + "#" + equipUseInfoChangeDataDto.getCity() + "#" + equipUseInfoChangeDataDto.getCounty() + "#" + equipUseInfoChangeDataDto.getFactoryUseSiteStreet());
...@@ -348,7 +348,7 @@ public class EquipChangeDataUpdateServiceImpl { ...@@ -348,7 +348,7 @@ public class EquipChangeDataUpdateServiceImpl {
if (optional.isPresent()) { if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get(); ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(equipUseInfoChangeDataDto.getUseUnitCreditCode()); esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(equipUseInfoChangeDataDto.getUseUnitCreditCode());
esEquipmentCategoryDto.setUSC_UNIT_NAME(equipUseInfoChangeDataDto.getUseUnitName()); esEquipmentCategoryDto.setUSE_UNIT_NAME(equipUseInfoChangeDataDto.getUseUnitName());
esEquipmentCategoryDto.setUSE_INNER_CODE(equipUseInfoChangeDataDto.getUseInnerCode()); esEquipmentCategoryDto.setUSE_INNER_CODE(equipUseInfoChangeDataDto.getUseInnerCode());
esEquipmentCategory.save(esEquipmentCategoryDto); esEquipmentCategory.save(esEquipmentCategoryDto);
} }
......
...@@ -1168,7 +1168,7 @@ public class DataHandlerServiceImpl { ...@@ -1168,7 +1168,7 @@ public class DataHandlerServiceImpl {
categoryDto.ifPresent(categoryEs -> { categoryDto.ifPresent(categoryEs -> {
categoryEs.setUSE_UNIT_CREDIT_CODE(companyCode); categoryEs.setUSE_UNIT_CREDIT_CODE(companyCode);
// 捎带更新单位名称保持数据库和es一致 // 捎带更新单位名称保持数据库和es一致
categoryEs.setUSC_UNIT_NAME(e.getUseUnitName()); categoryEs.setUSE_UNIT_NAME(e.getUseUnitName());
esEquipmentCategory.save(categoryEs); esEquipmentCategory.save(categoryEs);
}); });
} }
......
...@@ -235,7 +235,7 @@ public class EquipChangeDataUpdateService { ...@@ -235,7 +235,7 @@ public class EquipChangeDataUpdateService {
if (optional.isPresent()) { if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get(); ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(equipUseInfoChangeDataDto.getUseUnitCreditCode()); esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(equipUseInfoChangeDataDto.getUseUnitCreditCode());
esEquipmentCategoryDto.setUSC_UNIT_NAME(equipUseInfoChangeDataDto.getUseUnitName()); esEquipmentCategoryDto.setUSE_UNIT_NAME(equipUseInfoChangeDataDto.getUseUnitName());
esEquipmentCategoryDto.setUSE_INNER_CODE(equipUseInfoChangeDataDto.getUseInnerCode()); esEquipmentCategoryDto.setUSE_INNER_CODE(equipUseInfoChangeDataDto.getUseInnerCode());
esEquipmentCategory.save(esEquipmentCategoryDto); esEquipmentCategory.save(esEquipmentCategoryDto);
} }
......
...@@ -207,8 +207,13 @@ public class EquipClaimServiceImpl { ...@@ -207,8 +207,13 @@ public class EquipClaimServiceImpl {
sourceAsJSON.put(EQU_STATE, EquipmentEnum.getName.get(Integer.valueOf(sourceAsJSON.get(EQU_STATE).toString()))); sourceAsJSON.put(EQU_STATE, EquipmentEnum.getName.get(Integer.valueOf(sourceAsJSON.get(EQU_STATE).toString())));
} }
sourceAsJSON.put(record, sourceAsJSON.get(SEQUENCE_NBR)); sourceAsJSON.put(record, sourceAsJSON.get(SEQUENCE_NBR));
// 录入时间如果CREATE_DATE为空则使用REC_DATE
// 日期转化 // 日期转化
sourceAsJSON.put(CREATE_DATE, Instant.ofEpochMilli(Long.parseLong(sourceAsJSON.getString(CREATE_DATE))).atZone(ZoneId.systemDefault()).toLocalDate()); if (ValidationUtil.isEmpty(sourceAsJSON.get(CREATE_DATE))) {
sourceAsJSON.put(CREATE_DATE, Instant.ofEpochMilli(Long.parseLong(sourceAsJSON.getString("REC_DATE"))).atZone(ZoneId.systemDefault()).toLocalDate());
} else {
sourceAsJSON.put(CREATE_DATE, Instant.ofEpochMilli(Long.parseLong(sourceAsJSON.getString(CREATE_DATE))).atZone(ZoneId.systemDefault()).toLocalDate());
}
list.add(sourceAsJSON); list.add(sourceAsJSON);
} }
if (response.getInternalResponse().hits().getTotalHits() != null) { if (response.getInternalResponse().hits().getTotalHits() != null) {
...@@ -406,11 +411,11 @@ public class EquipClaimServiceImpl { ...@@ -406,11 +411,11 @@ public class EquipClaimServiceImpl {
// 认领到自己单位下 -> 已纳管设备列表 , + 历史设备登记 // 认领到自己单位下 -> 已纳管设备列表 , + 历史设备登记
// 认领 更新设备信息 // 认领 更新设备信息
this.updateEquipInfoWithClaim(equipInfo, equipParams, true); this.updateEquipInfoWithClaim(equipInfo, equipParams, false);
// 历史设备登记 // 历史设备登记
JgUseRegistration useRegistration = this.addHistoryEquipRegistration(equipInfo); // JgUseRegistration useRegistration = this.addHistoryEquipRegistration(equipInfo);
// 添加设备的业务履历 // 添加设备的业务履历
this.addEquipResume(equipInfo, BusinessTypeEnum.JG_EQUIP_CLAIM, useRegistration); this.addEquipResume(equipInfo, BusinessTypeEnum.JG_EQUIP_CLAIM, new JgUseRegistration());
} }
// 添加es中的使用单位信息 // 添加es中的使用单位信息
HashMap<String, Map<String, Object>> objMap = new HashMap<>(); HashMap<String, Map<String, Object>> objMap = new HashMap<>();
...@@ -892,6 +897,8 @@ public class EquipClaimServiceImpl { ...@@ -892,6 +897,8 @@ public class EquipClaimServiceImpl {
supervisionInfo.setRecord(record); supervisionInfo.setRecord(record);
supervisionInfo.setRecDate(timestamp); supervisionInfo.setRecDate(timestamp);
supervisionInfo.setSequenceNbr(Objects.toString(equipInfo.get("SUPERVISIONINFO_SEQ"), null)); supervisionInfo.setSequenceNbr(Objects.toString(equipInfo.get("SUPERVISIONINFO_SEQ"), null));
supervisionInfo.setOrgBranchCode(Objects.toString(equipInfo.get("orgBranchCode"), "").split("_")[0]);
supervisionInfo.setOrgBranchName(Objects.toString(equipInfo.get("orgBranchCode"), "").split("_")[1]);
iIdxBizJgSupervisionInfoService.saveOrUpdateData(supervisionInfo); iIdxBizJgSupervisionInfoService.saveOrUpdateData(supervisionInfo);
// 其他信息 // 其他信息
IdxBizJgOtherInfo otherInfo = JSON.parseObject(toJSONString(equipInfo), IdxBizJgOtherInfo.class); IdxBizJgOtherInfo otherInfo = JSON.parseObject(toJSONString(equipInfo), IdxBizJgOtherInfo.class);
......
...@@ -230,10 +230,8 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ ...@@ -230,10 +230,8 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
map.put("equList", PipelineEnum.PRESSURE_PIPELINE.getCode()); map.put("equList", PipelineEnum.PRESSURE_PIPELINE.getCode());
registerInfoService.batchDeleteByRecord(map); registerInfoService.batchDeleteByRecord(map);
} }
// 删除装置表信息 // 删除装置表信息
this.removeById(sequenceNbr); this.removeById(sequenceNbr);
eventPublisher.publish(new DataRefreshEvent(this, useInfos.stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList()), DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.DELETE));
return Boolean.TRUE; return Boolean.TRUE;
} }
...@@ -1026,7 +1024,6 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ ...@@ -1026,7 +1024,6 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
} }
// 删除装置表信息 // 删除装置表信息
this.removeByIds(ids); this.removeByIds(ids);
eventPublisher.publish(new DataRefreshEvent(this, useInfos.stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList()), DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.DELETE));
return Boolean.TRUE; return Boolean.TRUE;
} }
......
...@@ -29,7 +29,9 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; ...@@ -29,7 +29,9 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.*; import com.yeejoin.amos.boot.biz.common.utils.*;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dao.EsEquipmentDao;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper; import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent; import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
...@@ -119,8 +121,7 @@ import static com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum.SPE ...@@ -119,8 +121,7 @@ import static com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum.SPE
import static com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum.YIDENGJI; import static com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum.YIDENGJI;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XIAN_YANG; import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XIAN_YANG;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XI_XIAN; import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XI_XIAN;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.IDX_BIZ_EQUIPMENT_INFO; import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.*;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.IDX_BIZ_VIEW_JG_ALL;
/** /**
...@@ -361,6 +362,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -361,6 +362,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired @Autowired
private TechParamsBackupService techParamsBackupService; private TechParamsBackupService techParamsBackupService;
@Autowired
private EsEquipmentDao esEquipmentDao;
public static final String DATA_QUALITY_SCORE = "DATA_QUALITY_SCORE"; public static final String DATA_QUALITY_SCORE = "DATA_QUALITY_SCORE";
public static final String DATA_QUALITY_SCORE_JG = "DATA_QUALITY"; public static final String DATA_QUALITY_SCORE_JG = "DATA_QUALITY";
...@@ -1230,10 +1234,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1230,10 +1234,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
esEquipmentCategoryDto.setSEQUENCE_NBR(recordList.toString()); esEquipmentCategoryDto.setSEQUENCE_NBR(recordList.toString());
list.add(esEquipmentCategoryDto); list.add(esEquipmentCategoryDto);
} }
// 删除校验,被引用时不可删除。管道不做是否引用校验,直接删除已有管道(20251121注释,管道引用不能删除)
//if(!PipelineEnum.PRESSURE_PIPELINE.getCode().equals(map.get("equList"))) {
//this.checkForDelete(records);
//}
this.checkForDelete(records); this.checkForDelete(records);
if (CollUtil.isNotEmpty(records)) { if (CollUtil.isNotEmpty(records)) {
// 删除涉及的19张表的数据 // 删除涉及的19张表的数据
...@@ -1242,11 +1242,19 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1242,11 +1242,19 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
// 删除es中的数据 // 删除es中的数据
esEquipmentCategory.deleteAll(list); esEquipmentCategory.deleteAll(list);
esEquipmentDao.deleteAll(this.buildEquipData(records));
} }
eventPublisher.publish(new DataRefreshEvent(this, records, DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.DELETE));
return true; return true;
} }
private Iterable<? extends ESEquipmentInfo> buildEquipData(List<String> records) {
return records.stream().map(record->{
ESEquipmentInfo esEquipmentInfo = new ESEquipmentInfo();
esEquipmentInfo.setSEQUENCE_NBR(record);
return esEquipmentInfo;
}).collect(Collectors.toList());
}
/** /**
* 删除校验,被引用时不可删除 * 删除校验,被引用时不可删除
* *
......
...@@ -95,7 +95,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg ...@@ -95,7 +95,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
private static final String RECORD = "record"; private static final String RECORD = "record";
private static final String SEQUENCE_NBR = "sequenceNbr"; private static final String SEQUENCE_NBR = "sequenceNbr";
private static final String EQU_CODE_CC = "5000"; private static final String EQU_CODE_CC = "5000";
private static final int ONCE_MAX_SUBMIT = 5000; private static final int ONCE_MAX_SUBMIT = 2000;
private final List<String> NOT_FLOWING_STATE = Arrays.asList("使用单位待提交", "一级受理已驳回", "使用单位已撤回", "已作废", "已完成"); private final List<String> NOT_FLOWING_STATE = Arrays.asList("使用单位待提交", "一级受理已驳回", "使用单位已撤回", "已作废", "已完成");
......
...@@ -9,7 +9,7 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgResumeInfoService; ...@@ -9,7 +9,7 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgResumeInfoService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -25,8 +25,8 @@ public class JgResumeInfoServiceImpl extends BaseService<JgResumeInfoDto, JgResu ...@@ -25,8 +25,8 @@ public class JgResumeInfoServiceImpl extends BaseService<JgResumeInfoDto, JgResu
/** /**
* 分页查询 * 分页查询
*/ */
public Page<JgResumeInfoDto> queryForJgResumeInfoPage(Page<JgResumeInfoDto> page, String equId) { public Page<JgResumeInfoDto> queryForJgResumeInfoPage(Page<JgResumeInfoDto> page, String equId, Boolean isDelete) {
return this.queryForPage(page, null, false, equId); return this.queryForPage(page, null, false, equId, isDelete);
} }
public Page<JgResumeInfoDto> queryPageListByChangeIds(Page<JgResumeInfoDto> page, Set<String> equIds) { public Page<JgResumeInfoDto> queryPageListByChangeIds(Page<JgResumeInfoDto> page, Set<String> equIds) {
...@@ -35,8 +35,8 @@ public class JgResumeInfoServiceImpl extends BaseService<JgResumeInfoDto, JgResu ...@@ -35,8 +35,8 @@ public class JgResumeInfoServiceImpl extends BaseService<JgResumeInfoDto, JgResu
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<JgResumeInfoDto> queryForJgResumeInfoList() { public List<JgResumeInfoDto> queryForJgResumeInfoList(Boolean isDelete) {
return this.queryForList("", false); return this.queryForList("", false, isDelete);
} }
public void saveBatchResume(List<JgResumeInfoDto> jgResumeInfoDtoList) { public void saveBatchResume(List<JgResumeInfoDto> jgResumeInfoDtoList) {
......
...@@ -161,7 +161,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -161,7 +161,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
private static final String DEFINITION_KEY = "useRegistration"; private static final String DEFINITION_KEY = "useRegistration";
private static final String JIAN_CHA_ROLE_ID = "1864242478501093377"; private static final String JIAN_CHA_ROLE_ID = "1864242478501093377";
private static final int ONCE_MAX_SUBMIT = 5000; private static final int ONCE_MAX_SUBMIT = 2000;
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");; private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");;
private static final int BATCH_SIZE = 1000; private static final int BATCH_SIZE = 1000;
private final List<String> NOT_FLOWING_STATE = Arrays.asList("使用单位待提交", "一级受理已驳回", "使用单位已撤回", "已作废"); private final List<String> NOT_FLOWING_STATE = Arrays.asList("使用单位待提交", "一级受理已驳回", "使用单位已撤回", "已作废");
......
...@@ -4,11 +4,6 @@ ...@@ -4,11 +4,6 @@
"dictDataKey": "0", "dictDataKey": "0",
"dictDataValue": "按设备种类", "dictDataValue": "按设备种类",
"dictDataDesc": "upload/tzs/common/image/业务场景-设备.png" "dictDataDesc": "upload/tzs/common/image/业务场景-设备.png"
},
{
"dictDataKey": "1",
"dictDataValue": "按应用场景",
"dictDataDesc": "upload/tzs/common/image/业务场景-应用.png"
} }
], ],
"SGGZ": [ "SGGZ": [
......
package com.yeejoin.amos.boot.module.jyjc.biz.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean(destroyMethod = "close")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder ->
httpClientBuilder
.setDefaultCredentialsProvider(credentialsProvider)
.setMaxConnTotal(200)
.setMaxConnPerRoute(50));
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(60 * 1000)
// 套接字超时(默认为30秒)
.setSocketTimeout(60 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
package com.yeejoin.amos.boot.module.statistcs.biz.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean(destroyMethod = "close")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider)
.setMaxConnTotal(200)
.setMaxConnPerRoute(60);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
package com.yeejoin.amos.boot.module.tcm.biz.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean(destroyMethod = "close")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder.disableAuthCaching()
.setDefaultCredentialsProvider(credentialsProvider).setMaxConnTotal(200)
.setMaxConnPerRoute(60));
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
package com.yeejoin.amos.patrol.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Value("${elasticsearch.maxConnectNum:1000}")
private int maxConnectNum;
@Value("${elasticsearch.maxConnectPerRoute:1000}")
private int maxConnectPerRoute;
@Bean(destroyMethod = "close")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.disableAuthCaching();
httpClientBuilder.setMaxConnTotal(maxConnectNum);
httpClientBuilder.setMaxConnPerRoute(maxConnectPerRoute);
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
package com.yeejoin.amos.boot.module.ymt.biz.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean(destroyMethod = "close")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder.disableAuthCaching().setDefaultCredentialsProvider(credentialsProvider)
.setMaxConnTotal(200)
.setMaxConnPerRoute(60));
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
package com.yeejoin.amos.boot.module.ys.biz.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean(destroyMethod = "close")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
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