Commit f1eeb03d authored by suhuiguang's avatar suhuiguang

1.压测优化

parent fe0d7933
......@@ -116,6 +116,7 @@ public class ControllerAop {
urls.add("/tcm/userInfo/getPersonType");
// urls.add("/patrol/api/check/checkCalendarForWx");
urls.add("/patrol/api/check/saveRecordAll");
urls.add("/patrol/api/check/saveRecordAll2");
urls.add("/patrol/api/planTask/queryPlanTaskNew");
// 获取请求路径
for (String uri : urls) {
......
......@@ -24,10 +24,23 @@ public class CacheHelper {
@PostConstruct
public void init() {
List<InputItem> inputItems = iInputItemDao.findAll();
inputItems.forEach(inputItem -> redisUtils.hset(P_INPUT_ITEM_REDIS_KEY_PREFIX, String.valueOf(inputItem.getId()), inputItem));
redisUtils.del(P_INPUT_ITEM_REDIS_KEY_PREFIX);
inputItems.forEach(inputItem -> redisUtils.hset(P_INPUT_ITEM_REDIS_KEY_PREFIX, String.valueOf(inputItem.getId()), inputItem, 3600));
}
public InputItem getInputItemCacheData(String inputItemId) {
if(redisUtils.hHasKey(P_INPUT_ITEM_REDIS_KEY_PREFIX, inputItemId)){
return (InputItem) redisUtils.hget(P_INPUT_ITEM_REDIS_KEY_PREFIX, inputItemId);
} else {
synchronized (this){
if(redisUtils.hHasKey(P_INPUT_ITEM_REDIS_KEY_PREFIX, inputItemId)){
return (InputItem) redisUtils.hget(P_INPUT_ITEM_REDIS_KEY_PREFIX, inputItemId);
} else{
List<InputItem> inputItems = iInputItemDao.findAll();
inputItems.forEach(inputItem -> redisUtils.hset(P_INPUT_ITEM_REDIS_KEY_PREFIX, String.valueOf(inputItem.getId()), inputItem, 3600));
return (InputItem) redisUtils.hget(P_INPUT_ITEM_REDIS_KEY_PREFIX, inputItemId);
}
}
}
}
}
......@@ -230,10 +230,11 @@ public class CheckController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "一键提交巡检任务", notes = "一键提交巡检任务<font color='blue'>手机app</font>")
@RequestMapping(value = "/saveRecordAll", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@RequestMapping(value = "/saveRecordAll2", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public ResponseModel<Object> saveCheckRecordAll(@RequestParam String ids) {
String userId = RequestContext.getExeUserId();
try {
// 查询数据库和es 单线程串行执行
UserTransmittableUtils.setUser();
planTaskService.handleAllBatch(ids, userId);
} catch (Exception e) {
......@@ -246,10 +247,11 @@ public class CheckController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "一键提交巡检任务", notes = "一键提交巡检任务<font color='blue'>手机app</font>")
@RequestMapping(value = "/saveRecordAll2", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public ResponseModel<Object> saveCheckRecordAll1(@RequestParam String ids) {
@RequestMapping(value = "/saveRecordAll", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public ResponseModel<Object> saveCheckRecordAll2(@RequestParam String ids) {
String userId = RequestContext.getExeUserId();
try {
// 查询数据库和es 多线程并行执行
UserTransmittableUtils.setUser();
planTaskService.handleAllBatch2(ids, userId);
} catch (Exception e) {
......
......@@ -96,8 +96,10 @@ public class CheckRecordDataConsumer implements Runnable {
}
private AgencyUserModel getAgencyUserModel(RequestContextModel requestContextModel) {
List<AgencyUserModel> agencyUserModels = FeignUtil.remoteCall(()->Privilege.agencyUserClient.queryByIds(requestContextModel.getExcutedUserId(),false));
return agencyUserModels.get(0);
// 记录暂时不用 注释掉
//List<AgencyUserModel> agencyUserModels = FeignUtil.remoteCall(()->Privilege.agencyUserClient.queryByIds(requestContextModel.getExcutedUserId(),false));
// return agencyUserModels.get(0);
return null;
}
private void setRequestContext(){
......
package com.yeejoin.amos.patrol.business.dto;
import lombok.Getter;
import lombok.Setter;
/**
*
* @author LiuLin
* @date 2023年10月11日 09:31
*/
@Setter
@Getter
public final class EsEntity<T> {
private String id;
private T data;
public EsEntity() {
}
public EsEntity(String id, T data) {
this.data = data;
this.id = id;
}
}
\ No newline at end of file
......@@ -52,20 +52,22 @@ import com.yeejoin.amos.patrol.exception.YeeException;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.quartz.IJobService;
import com.yeejoin.amos.patrol.utils.UserTransmittableUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.compress.utils.Sets;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
......@@ -118,8 +120,8 @@ import static com.alibaba.fastjson.JSON.toJSONString;
@Service("planTaskService")
@EnableAsync
@Slf4j
public class PlanTaskServiceImpl implements IPlanTaskService {
private final Logger log = LoggerFactory.getLogger(PlanTaskServiceImpl.class);
@Resource
private DataSource dataSource;
......@@ -437,7 +439,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
throw new YeeException("计划不存在");
}
// 校验计划数据是否异常
if (!checkData(plan.getId())){
if (!checkData(plan.getId())) {
throw new YeeException("计划数据异常!");
}
//2.数据必输校验,不满足直接return,不再向下进行
......@@ -691,6 +693,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
/**
* 校验计划数据是否异常
*
* @return
*/
private Boolean checkData(Long planId) {
......@@ -699,6 +702,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
return false;
}
/**
* 自动任务执行
*/
......@@ -722,7 +726,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
HashMap<String, Object> paramMap = new HashMap<String, Object>();
for (Plan plan : planList) {
// 校验计划数据是否异常
if (!checkData(plan.getId())){
if (!checkData(plan.getId())) {
continue;
}
// tzs修改为查询用户组id
......@@ -1129,12 +1133,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
for (Map<String, String> excludeItem : excludeItems) {
List<AppCheckInputRespone> appCheckInputRespones = collect2.get(String.valueOf(excludeItem.get("point_id")));
if (excludeItem.containsKey("exclude_items") && !ObjectUtils.isEmpty(excludeItem.get("exclude_items"))){
if (excludeItem.containsKey("exclude_items") && !ObjectUtils.isEmpty(excludeItem.get("exclude_items"))) {
String[] exclude_items = excludeItem.get("exclude_items").split(",");
List<AppCheckInputRespone> appCheckInputRespones1 = new ArrayList<>();
for (String exclude_item : exclude_items) {
List<AppCheckInputRespone> collect = appCheckInputRespones.stream().filter(x -> x.getPointInputItemId().equals(exclude_item)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(collect)){
if (CollectionUtils.isEmpty(collect)) {
continue;
}
appCheckInputRespones1.add(collect.get(0));
......@@ -1695,19 +1699,52 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override
@Transactional(rollbackFor = Exception.class)
public void handleAllBatch(String planTaskIds, String userId) {
// StopWatch stopWatchAll = new StopWatch();
// stopWatchAll.start();
// StopWatch stopWatch1 = new StopWatch();
// stopWatch1.start();
// 1.数组准备:查询要一键提交的任务及更新状态
List<PlanTask> planTasks = getPlanTasks(planTaskIds);
if (planTasks.isEmpty()) {
return;
}
// stopWatch1.stop();
// log.info("planTasks耗时:{}",stopWatch1.getTotalTimeSeconds());
// 2.数组准备:查询未完成状态的任务明细及更新状态
// StopWatch stopWatch2 = new StopWatch();
// stopWatch2.start();
List<PlanTaskDetail> planTaskDetails = getWaitingDealPlanTaskDetails(planTasks);
// stopWatch2.stop();
// log.info("planTaskDetails耗时:{}",stopWatch2.getTotalTimeSeconds());
// 3.数组准备: es存储数据组装
List<ESTaskDetailDto> esTaskDetailDtos = this.buildESTaskDetailDtoData(planTasks, planTaskDetails);
List<ESPlanTaskListDto> esPlanTaskListDtos = this.buildESPlanTaskListDtoData(planTasks, esTaskDetailDtos, planTaskDetails);
// StopWatch stopWatch3 = new StopWatch();
// stopWatch3.start();
List<ESTaskDetailDto> esTaskDetailDtos = this.buildESTaskDetailDtoData(planTaskIds, planTaskDetails);
// stopWatch3.stop();
// log.info("esTaskDetailDtos耗时:{}",stopWatch3.getTotalTimeSeconds());
// StopWatch stopWatch4 = new StopWatch();
// stopWatch4.start();
List<ESPlanTaskListDto> esPlanTaskListDtos = this.buildESPlanTaskListDtoData(planTaskIds, esTaskDetailDtos, planTaskDetails);
// stopWatch4.stop();
// log.info("esPlanTaskListDtos耗时:{}",stopWatch4.getTotalTimeSeconds());
// 4.保存页面必须的数据
// StopWatch stopWatch5 = new StopWatch();
// stopWatch5.start();
saveMustData(esTaskDetailDtos, esPlanTaskListDtos, planTasks);
// stopWatch5.stop();
// log.info("saveMustData耗时:{}",stopWatch5.getTotalTimeSeconds());
// StopWatch stopWatch6 = new StopWatch();
// stopWatch6.start();
this.sendInsertMessage(planTasks, planTaskDetails);
// stopWatch6.stop();
// log.info("sendInsertMessage耗时:{}",stopWatch6.getTotalTimeSeconds());
// stopWatchAll.stop();
// log.info("handleAllBatch总耗时:{}",stopWatchAll.getTotalTimeSeconds());
}
......@@ -1725,13 +1762,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
CompletableFuture<List<ESTaskDetailDto>> allESTaskDetailDtosFuture = CompletableFuture.supplyAsync(() -> this.queryTaskDetailEs(planTaskIds), asyncServiceExecutor);
// 4.数组准备: es存储数据组装2
CompletableFuture<List<ESPlanTaskListDto>> esPlanTaskListDtosFuture = CompletableFuture.supplyAsync(() -> this.queryTaskListEs(planTaskIds), asyncServiceExecutor);
CompletableFuture.allOf(allESTaskDetailDtosFuture, esPlanTaskListDtosFuture).join();
CompletableFuture.allOf(planTasksFuture, planTaskDetailsFuture, allESTaskDetailDtosFuture, esPlanTaskListDtosFuture).join();
List<PlanTask> planTasks = planTasksFuture.join();
List<PlanTaskDetail> planTaskDetails = planTaskDetailsFuture.join();
List<ESTaskDetailDto> esTaskDetailDtos = allESTaskDetailDtosFuture.join();
List<ESPlanTaskListDto> esPlanTaskListDtos = esPlanTaskListDtosFuture.join();
finshPlanTask(planTasks, planTaskDetails);
finishPlanTask(planTasks, planTaskDetails);
buildESTaskDetailDtoData2(esTaskDetailDtos, planTaskDetails);
buildESPlanTaskListDtoData2(esPlanTaskListDtos, esTaskDetailDtos, planTaskDetails);
saveMustData(esTaskDetailDtos, esPlanTaskListDtos, planTasks);
......@@ -1741,7 +1777,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private List<ESPlanTaskListDto> queryTaskListEs(String planTaskIds) {
List<ESPlanTaskListDto> esPlanTaskListDtos = new ArrayList<>();
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
boolMust.must(QueryBuilders.termsQuery("planTaskId",planTaskIds.split(",")));
boolMust.must(QueryBuilders.termsQuery("planTaskId", planTaskIds.split(",")));
esPlanTaskList.search(boolMust).forEach(esPlanTaskListDtos::add);
return esPlanTaskListDtos;
}
......@@ -1749,12 +1785,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private List<ESTaskDetailDto> queryTaskDetailEs(String planTaskIds) {
List<ESTaskDetailDto> esTaskDetailDtos = new ArrayList<>();
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
boolMust.must(QueryBuilders.termsQuery("planTaskId",planTaskIds.split(",")));
boolMust.must(QueryBuilders.termsQuery("planTaskId", planTaskIds.split(",")));
esTaskDetail.search(boolMust).forEach(esTaskDetailDtos::add);
return esTaskDetailDtos;
}
private void finshPlanTask(List<PlanTask> planTasks, List<PlanTaskDetail> planTaskDetails) {
private void finishPlanTask(List<PlanTask> planTasks, List<PlanTaskDetail> planTaskDetails) {
planTasks.forEach(planTask -> {
planTask.setFinishStatus(XJConstant.TASK_STATUS_FINISH);
if (planTask.getRiskStatus() != 1) {
......@@ -1767,12 +1803,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
private void sendInsertMessage(List<PlanTask> planTasks, List<PlanTaskDetail> planTaskDetails){
private void sendInsertMessage(List<PlanTask> planTasks, List<PlanTaskDetail> planTaskDetails) {
CheckRecordDataDto dataDto = new CheckRecordDataDto();
dataDto.setPlanTasks(planTasks);
dataDto.setPlanTaskDetails(planTaskDetails);
dataDto.setRequestContextModel(UserTransmittableUtils.getUser());
publisher.publish(new CheckRecordInsertEvent(this,dataDto));
publisher.publish(new CheckRecordInsertEvent(this, dataDto));
}
private void saveMustData(List<ESTaskDetailDto> esTaskDetailDtos, List<ESPlanTaskListDto> esPlanTaskListDtos, List<PlanTask> planTasks) {
......@@ -1787,15 +1823,39 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private void saveTasks(List<ESTaskDetailDto> esTaskDetailDtos) {
try {
esTaskDetail.saveAll(esTaskDetailDtos);
List<EsEntity<ESTaskDetailDto>> batchList = esTaskDetailDtos.stream()
.map(item -> new EsEntity<>(item.getId().toString(), item)).collect(Collectors.toList());
this.insertBatch("web_app_task_detail", batchList);
// esTaskDetail.saveAll(esTaskDetailDtos);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
/**
* Description: 批量插入数据
*
* @param index index
* @param list 插入列表
* @author LiuLin
*/
public <T> void insertBatch(String index, List<EsEntity<T>> list) {
BulkRequest request = new BulkRequest();
list.forEach(item -> request.add(new IndexRequest(index).id(item.getId())
.source(JSON.toJSONString(item.getData()), XContentType.JSON)));
try {
restHighLevelClient.bulk(request, RequestOptions.DEFAULT);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private void savePlanTasks(List<ESPlanTaskListDto> esPlanTaskListDtos) {
try {
esPlanTaskList.saveAll(esPlanTaskListDtos);
// esPlanTaskList.saveAll(esPlanTaskListDtos);
List<EsEntity<ESPlanTaskListDto>> batchList = esPlanTaskListDtos.stream()
.map(item -> new EsEntity<>(item.getPlanTaskId(), item)).collect(Collectors.toList());
this.insertBatch("web_app_plan_task_list", batchList);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
......@@ -1825,9 +1885,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
private List<ESTaskDetailDto> buildESTaskDetailDtoData(List<PlanTask> planTasks, List<PlanTaskDetail> planTaskDetails) {
private List<ESTaskDetailDto> buildESTaskDetailDtoData(String planTaskIds, List<PlanTaskDetail> planTaskDetails) {
// 查询所有的
List<ESTaskDetailDto> allESTaskDetailDtos = esTaskDetail.findAllByPlanTaskIdIn(planTasks.stream().map(p -> String.valueOf(p.getId())).collect(Collectors.toList()));
List<ESTaskDetailDto> allESTaskDetailDtos = this.queryTaskDetailEs(planTaskIds);
Map<Long, ESTaskDetailDto> esTaskDetailDtoMap = allESTaskDetailDtos.stream().collect(Collectors.toMap(ESTaskDetailDto::getId, Function.identity()));
// 只更新未完成状态
planTaskDetails.forEach(planTaskDetail -> {
......@@ -1838,7 +1898,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
for (Map<String, Object> map : mapList.get("items")) {
AppCheckInputRespone appCheckInputRespone = new AppCheckInputRespone();
BeanUtil.copyProperties(map, appCheckInputRespone);
InputItem inputItem = cacheHelper.getInputItemCacheData(map.get("checkInputId").toString());
InputItem inputItem = inputItemDao.getOne(Long.parseLong(map.get("checkInputId").toString()));
CheckInput checkInput = new CheckInput();
String itemType = String.valueOf(map.get("itemType"));
if (XJConstant.INPUT_ITEM_SELECT.equals(itemType)) {
......@@ -1863,7 +1923,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
private List<ESTaskDetailDto> buildESTaskDetailDtoData2(List<ESTaskDetailDto> allESTaskDetailDtos, List<PlanTaskDetail> planTaskDetails) {
private void buildESTaskDetailDtoData2(List<ESTaskDetailDto> allESTaskDetailDtos, List<PlanTaskDetail> planTaskDetails) {
// 查询所有的
Map<Long, ESTaskDetailDto> esTaskDetailDtoMap = allESTaskDetailDtos.stream().collect(Collectors.toMap(ESTaskDetailDto::getId, Function.identity()));
// 只更新未完成状态
......@@ -1875,7 +1935,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
for (Map<String, Object> map : mapList.get("items")) {
AppCheckInputRespone appCheckInputRespone = new AppCheckInputRespone();
BeanUtil.copyProperties(map, appCheckInputRespone);
InputItem inputItem = cacheHelper.getInputItemCacheData(map.get("checkInputId").toString());
InputItem inputItem = inputItemDao.getOne(Long.parseLong(map.get("checkInputId").toString()));
CheckInput checkInput = new CheckInput();
String itemType = String.valueOf(map.get("itemType"));
if (XJConstant.INPUT_ITEM_SELECT.equals(itemType)) {
......@@ -1896,13 +1956,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
esTaskDetailDto.setPointStatus(String.valueOf(PlanTaskDetailIsFinishEnum.FINISHED.getValue()));
esTaskDetailDto.setPointImgUrls(new ArrayList<>());
});
return allESTaskDetailDtos;
}
private List<ESPlanTaskListDto> buildESPlanTaskListDtoData(List<PlanTask> planTasks, List<ESTaskDetailDto> esTaskDetailDtos, List<PlanTaskDetail> planTaskDetails) {
List<String> ids = planTasks.stream().map(p -> String.valueOf(p.getId())).collect(Collectors.toList());
List<ESPlanTaskListDto> esPlanTaskListDtos = esPlanTaskList.findAllByPlanTaskIdIn(ids);
private List<ESPlanTaskListDto> buildESPlanTaskListDtoData(String planTaskIds, List<ESTaskDetailDto> esTaskDetailDtos, List<PlanTaskDetail> planTaskDetails) {
List<ESPlanTaskListDto> esPlanTaskListDtos = this.queryTaskListEs(planTaskIds);
esPlanTaskListDtos.forEach(esPlanTaskListDto -> {
esPlanTaskListDto.setFinishStatus(String.valueOf(PlanTaskFinishStatusEnum.FINISHED.getValue()));
esPlanTaskListDto.setFinshNum(this.filterByStatus("1", esPlanTaskListDto.getPlanTaskId(), esTaskDetailDtos));
......@@ -1915,7 +1972,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return esPlanTaskListDtos;
}
private List<ESPlanTaskListDto> buildESPlanTaskListDtoData2(List<ESPlanTaskListDto> esPlanTaskListDtos, List<ESTaskDetailDto> esTaskDetailDtos, List<PlanTaskDetail> planTaskDetails) {
private void buildESPlanTaskListDtoData2(List<ESPlanTaskListDto> esPlanTaskListDtos, List<ESTaskDetailDto> esTaskDetailDtos, List<PlanTaskDetail> planTaskDetails) {
esPlanTaskListDtos.forEach(esPlanTaskListDto -> {
esPlanTaskListDto.setFinishStatus(String.valueOf(PlanTaskFinishStatusEnum.FINISHED.getValue()));
esPlanTaskListDto.setFinshNum(this.filterByStatus("1", esPlanTaskListDto.getPlanTaskId(), esTaskDetailDtos));
......@@ -1925,7 +1982,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
esPlanTaskListDto.setTaskPlanNum(this.filterByStatus("1", esPlanTaskListDto.getPlanTaskId(), esTaskDetailDtos));
esPlanTaskListDto.setPoints(this.buildPlanTaskPoint(esPlanTaskListDto.getPlanTaskId(), planTaskDetails));
});
return esPlanTaskListDtos;
}
private List<PlanTaskDetail> buildPlanTaskPoint(String planTaskId, List<PlanTaskDetail> planTaskDetails) {
......
......@@ -25,6 +25,13 @@ public class ElasticSearchClientConfig {
@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();
......@@ -36,6 +43,8 @@ public class ElasticSearchClientConfig {
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.disableAuthCaching();
httpClientBuilder.setMaxConnTotal(maxConnectNum);
httpClientBuilder.setMaxConnPerRoute(maxConnectPerRoute);
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
......
package com.yeejoin.amos.patrol.config;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
@Configuration
@EnableElasticsearchRepositories(basePackages = {"com.yeejoin.amos.boot.module.common.biz.dao","com.yeejoin.amos.patrol.business.dao.repository"})
public class ElasticSearchRestTemplateConfig {
@Bean
public ElasticsearchRestTemplate elasticsearchTemplate(RestHighLevelClient restHighLevelClient) {
return new ElasticsearchRestTemplate(restHighLevelClient);
}
}
......@@ -26,7 +26,7 @@ spring.datasource.password=Yeejoin@2023
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.driver-class-name = cn.com.vastbase.Driver
spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 100
spring.datasource.hikari.maximum-pool-size = 200
spring.datasource.hikari.minimum-idle=15
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
......@@ -43,7 +43,7 @@ spring.redis.database=1
spring.redis.host=172.16.10.243
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-active=500
spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10
spring.redis.jedis.pool.min-idle=0
......@@ -112,6 +112,8 @@ fire-rescue=1432549862557130753
action.auto_create_index:true
elasticsearch.username=elastic
elasticsearch.password=a123456
elasticsearch.maxConnectNum= 1000
elasticsearch.maxConnectPerRoute= 1000
spring.elasticsearch.rest.uris=http://172.16.10.243:9200
## unit(h)
alertcall.es.synchrony.time=48
......@@ -195,8 +197,11 @@ spring.jpa.properties.hibernate.order_updates =true
shardingsphere.create.tables.num=10
logging.level.com.zaxxer.hikari=DEBUG
logging.level.org.springframework.data.elasticsearch=error
logging.level.org.elasticsearch=error
amos.system.user.user-name=admin_tzs
amos.system.user.password=a1234560
amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=AMOS_STUDIO_WEB
spring.application.name = AMOS-PATROL-LTW
spring.application.name = AMOS-PATROL
server.servlet.context-path=/patrol
server.port = 8082
......@@ -17,11 +17,12 @@ spring.jpa.show-sql = false
spring.jpa.hibernate.ddl-auto = none
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.database-platform = org.hibernate.dialect.MySQLDialect
mybatis.mapper-locations = classpath:db/mapper/*.xml
mybatis-plus.mapper-locations=classpath:db/mapper/*.xml
mybatis.type-aliases-package = com.yeejoin.amos.patrol.business.entity.mybatis
mybatis.configuration.mapUnderscoreToCamelCase=true
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.nologging.NoLoggingImpl
mybatis-plus.global-config.db-config.update-strategy=ignored
spring.liquibase.change-log=classpath:/db/changelog/changelog-master.xml
......
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