Commit 0f9f94da authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_dl_plan6' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6

parents 00378ae5 36006126
......@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -156,10 +157,12 @@ public class EquipmentAlarmController extends AbstractBaseController {
request12.setName("isRemoveShield");
request12.setValue(StringUtil.isNotEmpty(isRemoveShield) ? StringUtils.trimToNull(isRemoveShield) : null);
queryRequests.add(request12);
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request13);
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())){
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request13);
}
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<Map<String, Object>> list = iEquipmentSpecificAlarmService.listPage(param);
return CommonResponseUtil.success(list);
......@@ -276,10 +279,12 @@ public class EquipmentAlarmController extends AbstractBaseController {
request13.setName("isRemovedFire");
request13.setValue(StringUtil.isNotEmpty(isRemovedFire) ? StringUtils.trimToNull(isRemovedFire) : null);
queryRequests.add(request13);
CommonRequest request14 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request14);
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())){
CommonRequest request14 = new CommonRequest();
request14.setName("bizOrgCode");
request14.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request14);
}
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
org.springframework.data.domain.Page<AlarmListDataVO> list = iEquipmentSpecificAlarmService.listAlarmsPage(param);
return CommonResponseUtil.success(list);
......
......@@ -94,17 +94,25 @@ public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerT
try {
if (type == 2) {
powerTransferCompanyResources.setStatus(code);
powerTransferCompanyResources.setRemarks(remarks);
powerTransferCompanyResourcesMapper.updateById(powerTransferCompanyResources);
List<Object> carStatusInfoDtoList = new ArrayList();
//修改装备信息
CarStatusInfoDto carStatusInfo = new CarStatusInfoDto();
carStatusInfo.setSequenceNbr(carId + "");
carStatusInfo.setStatus(FireCarStatusEnum.执勤.getCode());
carStatusInfoDtoList.add(carStatusInfo);
// 更新所有车辆状态为执勤
equipFeignClient.updateCarStatus(carStatusInfoDtoList);
if("finished".equals(code)){
List<Object> carStatusInfoDtoList = new ArrayList();
//修改装备信息
CarStatusInfoDto carStatusInfo = new CarStatusInfoDto();
carStatusInfo.setSequenceNbr(carId + "");
carStatusInfo.setStatus(FireCarStatusEnum.执勤.getCode());
carStatusInfoDtoList.add(carStatusInfo);
// 更新所有车辆状态为执勤
equipFeignClient.updateCarStatus(carStatusInfoDtoList);
}
} else {
if (FireCarStatusEnum.到场.getCode().equals(code)){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......
......@@ -2,7 +2,12 @@ package com.yeejoin.amos.knowledgebase.config;
import org.apache.commons.lang3.StringUtils;
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.client.config.RequestConfig;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
......@@ -16,17 +21,31 @@ public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean
@Qualifier("highLevelClient")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
String url = uris.replace("http://", "");
final String[] parts = StringUtils.split(url, ":");
HttpHost httpHost = new HttpHost(parts[0], Integer.parseInt(parts[1]), "http");
RestClientBuilder builder = RestClient.builder(httpHost);
builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
@Override
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
});
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
@Override
......
......@@ -15,6 +15,10 @@
<artifactId>amos-boot-module-equip-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -26,6 +26,10 @@
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -29,6 +29,13 @@ spring.datasource.hikari.max-lifetime=120000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
##liquibase
spring.liquibase.change-log = classpath:/db/changelog/changelog-master.xml
spring.liquibase.enabled= true
......
......@@ -15,7 +15,10 @@
<artifactId>amos-boot-module-knowledgebase-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -40,6 +40,8 @@ eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=172.16.10.66:9300
spring.elasticsearch.rest.uris=http://172.16.10.66:9200
elasticsearch.username= elastic
elasticsearch.password= 123456
#emqx v4.0
emqx.clean-session=true
......
......@@ -20,4 +20,10 @@ mybatis-plus.type-aliases-super-type=org.typroject.tyboot.core.rdbms.orm.entity.
mybatis-plus.global-config.db-config.id-type=id_worker
mybatis-plus.mapper-locations=classpath:mapper/*
## redis失效时间
redis.cache.failure.time=10800
\ No newline at end of file
redis.cache.failure.time=10800
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
......@@ -23,6 +23,10 @@
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -61,4 +61,12 @@ feign.httpclient.connection-timeout=5000
video.fegin.name=video
latentDanger.feign.name=AMOS-LATENT-DANGER
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
\ No newline at end of file
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
## 消防救援保障部ID
fire-rescue=1432549862557130753
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
......@@ -13,6 +13,10 @@
<artifactId>amos-boot-module-maintenance-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -67,3 +67,8 @@ eureka.instance.metadata-map.management.context-path=${server.servlet.context-pa
eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
......@@ -16,6 +16,10 @@
<artifactId>amos-boot-module-patrol-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -56,4 +56,10 @@ rule.definition.model-package=com.yeejoin.amos.patrol.business.entity.mybatis
rule.definition.default-agency=STATE_GRID
jcs.fegin.name=JCS
emergency.command.section.id=1418223840361709569
\ No newline at end of file
emergency.command.section.id=1418223840361709569
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
......@@ -33,6 +33,10 @@
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -73,3 +73,8 @@ eureka.instance.metadata-map.management.context-path=${server.servlet.context-pa
eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
package com.yeejoin.amos.boot.module.tzs.api.dto;
import lombok.Data;
@Data
public class KV {
private String name;
private Object value;
}
package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tzs.api.dto.KV;
import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog;
import java.util.List;
/**
* 消息流水表 Mapper 接口
......@@ -10,5 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2022-04-20
*/
public interface MsgLogMapper extends BaseMapper<MsgLog> {
List<KV> getMsgType();
}
......@@ -2,4 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tzs.api.mapper.MsgLogMapper">
<select id="getMsgType" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.KV">
SELECT msg_type AS value, msg_type_name AS name
FROM tz_msg_log
GROUP BY msg_type
</select>
</mapper>
package com.yeejoin.amos.boot.module.tzs.biz.controller;
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.api.dto.KV;
import com.yeejoin.amos.boot.module.tzs.api.dto.MsgLogDto;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.MsgLogServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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 org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.MsgLogDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List;
import java.util.Map;
/**
* 消息流水表
......@@ -92,14 +89,13 @@ public class MsgLogController extends BaseController {
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @param size 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "消息流水表分页查询", notes = "消息流水表分页查询")
public ResponseModel<Page<MsgLogDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size) {
public ResponseModel<Page<MsgLogDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size) {
Page<MsgLogDto> page = new Page<MsgLogDto>();
page.setCurrent(current);
page.setSize(size);
......@@ -126,8 +122,7 @@ public class MsgLogController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "告警数量统计", notes = "告警数量统计")
@GetMapping(value = "/count")
public ResponseModel<Integer> countByTerminalType(
@RequestParam(value = "terminalType", required = false) String terminalType) {
public ResponseModel<Integer> countByTerminalType(@RequestParam(value = "terminalType", required = false) String terminalType) {
return ResponseHelper.buildResponse(msgLogServiceImpl.countByTerminalType(terminalType));
}
......@@ -135,21 +130,56 @@ public class MsgLogController extends BaseController {
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @param size 每页大小
* @param terminalType 终端类型
* @param isRead 是否未读
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page/terminalType")
@ApiOperation(httpMethod = "GET", value = "消息流水表分页查询", notes = "消息流水表分页查询")
public ResponseModel<Page<MsgLogDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "terminalType") String terminalType,
@RequestParam(value = "isRead") Boolean isRead) {
Page<MsgLogDto> page = new Page<MsgLogDto>();
public ResponseModel<Page<MsgLogDto>> queryForPage(
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(required = false) String terminalType,
@RequestParam(required = false) Boolean isRead,
@RequestParam(required = false) String sendTimeStart,
@RequestParam(required = false) String sendTimeEnd,
@RequestParam(required = false) String msgType,
@RequestParam(required = false) String body
) {
Page<MsgLogDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(msgLogServiceImpl.queryForMsgLogByTerminalTypePage(page, terminalType, isRead));
return ResponseHelper.buildResponse(msgLogServiceImpl.queryForMsgLogByTerminalTypePage(page, terminalType, isRead, sendTimeStart, sendTimeEnd, msgType, body));
}
/**
* 获取消息类型
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/msgType")
@ApiOperation(httpMethod = "GET", value = "获取消息类型")
public ResponseModel<List<KV>> queryForPage() {
return ResponseHelper.buildResponse(msgLogServiceImpl.getType());
}
/**
* 全部已读
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/allRead")
@ApiOperation(httpMethod = "GET", value = "全部已读")
public ResponseModel<Boolean> allRead() {
return ResponseHelper.buildResponse(msgLogServiceImpl.allRead());
}
/**
* 批量删除
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/deleteByIds")
@ApiOperation(httpMethod = "POST", value = "批量删除")
public ResponseModel<Boolean> deleteByIds(@RequestBody Map<String, List<Long>> body) {
return ResponseHelper.buildResponse(msgLogServiceImpl.deleteByIds(body.get("ids")));
}
}
\ No newline at end of file
}
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertMsgDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.KV;
import com.yeejoin.amos.boot.module.tzs.api.dto.MsgLogDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog;
import com.yeejoin.amos.boot.module.tzs.api.enums.TerminalTypeEnum;
import com.yeejoin.amos.boot.module.tzs.api.mapper.MsgLogMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IMsgLogService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.LinkedList;
import java.util.List;
/**
......@@ -26,7 +31,7 @@ import java.util.List;
* @date 2022-04-20
*/
@Service
public class MsgLogServiceImpl extends BaseService<MsgLogDto,MsgLog,MsgLogMapper> implements IMsgLogService {
public class MsgLogServiceImpl extends BaseService<MsgLogDto, MsgLog, MsgLogMapper> implements IMsgLogService {
Logger logger = LoggerFactory.getLogger(MsgLogServiceImpl.class);
......@@ -36,26 +41,25 @@ public class MsgLogServiceImpl extends BaseService<MsgLogDto,MsgLog,MsgLogMapper
/**
* 分页查询
*/
public Page<MsgLogDto> queryForMsgLogPage(Page<MsgLogDto> page) {
public Page<MsgLogDto> queryForMsgLogPage(Page<MsgLogDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<MsgLogDto> queryForMsgLogList() {
return this.queryForList("" , false);
public List<MsgLogDto> queryForMsgLogList() {
return this.queryForList("", false);
}
public List<MsgLogDto> queryForWebMsgLogList(String terminalType) {
return this.queryForList("" , false, terminalType);
public List<MsgLogDto> queryForWebMsgLogList(String terminalType) {
return this.queryForList("", false, terminalType);
}
public List<AlertMsgDto> queryForAlertMsg(List<String> regionCodes) {
List<AlertMsgDto> alertMsgDtoList = Lists.newArrayList();
// 查询电梯警情预报消息
List<AlertPaperInfoDto> alertPaperInfoDtoList =
alertCalledService.getAlertPaperInfoList(alertCalledService.authRegionCodeList(regionCodes), false);
List<AlertPaperInfoDto> alertPaperInfoDtoList = alertCalledService.getAlertPaperInfoList(alertCalledService.authRegionCodeList(regionCodes), false);
if (!ValidationUtil.isEmpty(alertPaperInfoDtoList)) {
alertPaperInfoDtoList.forEach(msg -> {
AlertMsgDto alertMsgDto = new AlertMsgDto();
......@@ -82,15 +86,51 @@ public class MsgLogServiceImpl extends BaseService<MsgLogDto,MsgLog,MsgLogMapper
alertMsgDtoList.add(alertMsgDto);
});
}
return alertMsgDtoList;
}
public Integer countByTerminalType(String terminalType) {
return this.list(new LambdaQueryWrapper<MsgLog>().eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType)).size();
return this.list(new LambdaQueryWrapper<MsgLog>().eq(StringUtils.hasText(terminalType), MsgLog::getTerminalType, terminalType)).size();
}
public Page<MsgLogDto> queryForMsgLogByTerminalTypePage(Page<MsgLogDto> page, String terminalType, Boolean isRead, String sendTimeStart, String sendTimeEnd, String msgType, String body) {
Page<MsgLog> msgLogPage = new Page<>(page.getCurrent(), page.getSize());
LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>();
if (!StringUtils.hasText(terminalType)) {
terminalType = TerminalTypeEnum.TERMINAL_TYPE_WEB.getCode();
}
wrapper.eq(MsgLog::getTerminalType, terminalType);
wrapper.eq(isRead != null, MsgLog::getIsRead, isRead);
wrapper.ge(StringUtils.hasText(sendTimeStart), MsgLog::getSendTime, sendTimeStart);
wrapper.le(StringUtils.hasText(sendTimeEnd), MsgLog::getSendTime, sendTimeEnd);
wrapper.eq(StringUtils.hasText(msgType), MsgLog::getMsgType, msgType);
wrapper.eq(MsgLog::getIsDelete, 0);
wrapper.like(StringUtils.hasText(body), MsgLog::getBody, body);
page(msgLogPage, wrapper);
LinkedList<MsgLogDto> msgLogDtos = new LinkedList<>();
for (MsgLog record : msgLogPage.getRecords()) {
MsgLogDto msgLogDto = new MsgLogDto();
BeanUtils.copyProperties(record, msgLogDto);
msgLogDtos.add(msgLogDto);
}
page.setRecords(msgLogDtos);
return page;
}
public Page<MsgLogDto> queryForMsgLogByTerminalTypePage(Page<MsgLogDto> page, String terminalType, Boolean isRead) {
return this.queryForPage(page, "rec_date", false, terminalType, isRead);
public List<KV> getType() {
return getBaseMapper().getMsgType();
}
}
\ No newline at end of file
public boolean allRead() {
LambdaUpdateWrapper<MsgLog> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(MsgLog::getIsRead, 0).set(MsgLog::getIsRead, 1);
return update(wrapper);
}
public boolean deleteByIds(List<Long> longs) {
LambdaUpdateWrapper<MsgLog> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(MsgLog::getSequenceNbr, longs).set(MsgLog::getIsDelete, 1);
return update(wrapper);
}
}
......@@ -24,6 +24,11 @@ public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean
@Qualifier("highLevelClient")
......@@ -35,8 +40,9 @@ public class ElasticSearchClientConfig {
HttpHost httpHost = new HttpHost(parts[0], Integer.parseInt(parts[1]), "http");
RestClientBuilder builder = RestClient.builder(httpHost);
//增加安全配置,使用kibana,勿删
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic","es123456"));
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
@Override
......@@ -47,13 +53,13 @@ public class ElasticSearchClientConfig {
}
});// 调整最大重试超时时间(默认为30秒).setMaxRetryTimeoutMillis(60000);
//增加安全配置,使用kibana,勿删
// builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
// @Override
// public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
// httpClientBuilder.disableAuthCaching();
// return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
// }
// });
builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
@Override
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
......
......@@ -16,6 +16,8 @@ biz.elasticsearch.address=172.16.10.66
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= 123456
##biz custem properties
biz.hk.video.url=http://11.11.16.12:9017/artemis-web/debug
......
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