Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
7ea33d57
Commit
7ea33d57
authored
Aug 31, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修改初始化
parent
4c163d7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
17 deletions
+20
-17
ESAlertCalledService.java
...odule/elevator/biz/service/impl/ESAlertCalledService.java
+13
-17
ElevatorAppRunner.java
...t/module/elevator/biz/service/impl/ElevatorAppRunner.java
+7
-0
No files found.
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/service/impl/ESAlertCalledService.java
View file @
7ea33d57
...
...
@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.elevator.api.entity.ESAlertCalled;
import
com.yeejoin.amos.boot.module.elevator.api.enums.AlertStatusEnum
;
import
com.yeejoin.amos.boot.module.elevator.biz.dao.ESAlertCalledRepository
;
import
com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -23,7 +24,6 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilde
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
javax.annotation.PostConstruct
;
import
java.util.Date
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -38,6 +38,7 @@ import java.util.List;
* @version $Id: ESAlertCalledService.java, v 0.1 2021年6月19日 下午5:12:01 gwb Exp $
*/
@Service
@Slf4j
public
class
ESAlertCalledService
{
@Autowired
...
...
@@ -51,27 +52,23 @@ public class ESAlertCalledService {
@Value
(
"${alertcall.es.synchrony.time}"
)
private
Long
time
;
@PostConstruct
public
void
init
()
throws
Exception
{
//初始化ES,重建索引
initEs
();
}
/**
* 重建索引
*/
public
Boolean
initEs
()
throws
Exception
{
esAlertCalledRepository
.
deleteAll
();
/**
* 同步历史48小时以内的警情处置记录
*/
public
Boolean
initEs
()
{
try
{
esAlertCalledRepository
.
deleteAll
();
}
catch
(
Exception
e
)
{
log
.
error
(
"索引不存在:{}"
,
e
.
getMessage
());
}
// 同步历史48小时以内的警情处置记录
QueryWrapper
<
AlertCalled
>
wrapper
=
new
QueryWrapper
<>();
long
currentTime
=
System
.
currentTimeMillis
()
;
if
(
ValidationUtil
.
isEmpty
(
time
))
//默认为同步48小时
//默认为同步48小时
if
(
ValidationUtil
.
isEmpty
(
time
))
{
currentTime
=
currentTime
-
48
*
60
*
60
*
1000
;
}
else
...
...
@@ -102,8 +99,7 @@ public class ESAlertCalledService {
*
* @param alertCalled 警情信息列表
*/
public
ESAlertCalled
saveAlertCalledToES
(
AlertCalled
alertCalled
)
throws
Exception
{
public
ESAlertCalled
saveAlertCalledToES
(
AlertCalled
alertCalled
)
{
ESAlertCalled
esAlertCalled
=
new
ESAlertCalled
();
esAlertCalled
.
setSequenceNbr
(
alertCalled
.
getSequenceNbr
());
esAlertCalled
.
setAlarmType
(
alertCalled
.
getAlarmType
());
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/service/impl/ElevatorAppRunner.java
View file @
7ea33d57
...
...
@@ -20,11 +20,18 @@ public class ElevatorAppRunner implements ApplicationRunner {
@Autowired
ElevatorServiceImpl
elevatorServiceImpl
;
@Autowired
ESAlertCalledService
esAlertCalledService
;
@Override
public
void
run
(
ApplicationArguments
args
)
{
// 缓存电梯数据
List
<
ElevatorDto
>
list
=
elevatorServiceImpl
.
selectExportData
(
null
);
redisUtil
.
set
(
BizCommonConstant
.
OLD_ELEVATOR_REDIS_KEY
,
JSONObject
.
toJSONString
(
list
));
// 电梯es数据缓存
esAlertCalledService
.
initEs
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment