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
704398d5
Commit
704398d5
authored
Oct 12, 2021
by
李腾威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地图ES搜索电梯修改,ES初始化电梯信息修改
parent
ee92d854
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
67 deletions
+63
-67
ElevatorController.java
...os/boot/module/tzs/biz/controller/ElevatorController.java
+29
-29
ESElevatorServiceImpl.java
...ot/module/tzs/biz/service/impl/ESElevatorServiceImpl.java
+34
-38
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/ElevatorController.java
View file @
704398d5
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
controller
;
import
java.io.UnsupportedEncodingException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.StringUtils
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
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.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -55,9 +29,34 @@ import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TestInfoServiceImpl;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
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.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.io.UnsupportedEncodingException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
/**
* 电梯Api
...
...
@@ -392,10 +391,11 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/init"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"电梯信息放入es"
,
notes
=
"电梯信息放入es"
)
public
void
init
()
{
public
void
init
(
Integer
num
)
{
IPage
<
Elevator
>
elevatorPage
=
new
Page
<>();
Integer
count
=
elevatorService
.
count
();
for
(
int
i
=
0
;
i
<=
3
;
i
++
)
{
for
(
int
i
=
0
;
i
<=
(
ValidationUtil
.
isEmpty
(
num
)
?
count
:
num
);
i
++
)
{
elevatorPage
.
setCurrent
(
i
);
elevatorPage
.
setSize
(
500
);
elevatorPage
=
elevatorService
.
page
(
elevatorPage
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/ESElevatorServiceImpl.java
View file @
704398d5
...
...
@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.EsElevatorDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.Elevator
;
...
...
@@ -19,11 +18,8 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilde
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
*
...
...
@@ -111,26 +107,26 @@ public class ESElevatorServiceImpl {
}
AlertCalled
alertCalled
=
null
;
List
<
AlertCalled
>
alertCalleds
=
null
;
if
(!
ValidationUtil
.
isEmpty
(
alertId
))
{
alertCalled
=
iAlertCalledService
.
getById
(
elevatorDto
.
getAlertId
());
BoolQueryBuilder
qb4
=
QueryBuilders
.
boolQuery
();
qb4
.
must
(
QueryBuilders
.
termQuery
(
"sequenceNbr"
,
alertCalled
.
getEquipmentId
()));
boolMust
.
must
(
qb4
);
}
else
{
if
(
elevatorDto
.
getIsToday
()
!=
null
&&
elevatorDto
.
getIsToday
())
{
queryWrapper
.
ge
(
AlertCalled:
:
getCallTime
,
DateUtils
.
stampToDate
(
System
.
currentTimeMillis
(),
DateUtils
.
DATE_PATTERN
));
queryWrapper
.
le
(
AlertCalled:
:
getCallTime
,
DateUtils
.
stampToDate
(
DateUtils
.
dateAddDays
(
new
Date
(),
1
).
getTime
(),
DateUtils
.
DATE_PATTERN
));
}
alertCalleds
=
iAlertCalledService
.
list
(
queryWrapper
);
List
<
Long
>
stringList
=
new
ArrayList
<>();
for
(
AlertCalled
al:
alertCalleds
)
{
stringList
.
add
(
al
.
getEquipmentId
());
}
List
<
Long
>
listL
=
stringList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
qb0
.
should
(
QueryBuilders
.
termsQuery
(
"sequenceNbr"
,
listL
.
toArray
()));
boolMust
.
must
(
qb0
);
}
//
if(!ValidationUtil.isEmpty(alertId)) {
//
alertCalled = iAlertCalledService.getById(elevatorDto.getAlertId());
//
BoolQueryBuilder qb4 = QueryBuilders.boolQuery();
//
qb4.must(QueryBuilders.termQuery("sequenceNbr", alertCalled.getEquipmentId()));
//
boolMust.must(qb4);
//
} else {
//
if(elevatorDto.getIsToday() != null && elevatorDto.getIsToday()) {
//
queryWrapper.ge(AlertCalled::getCallTime, DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN));
//
queryWrapper.le(AlertCalled::getCallTime, DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN));
//
}
//
alertCalleds = iAlertCalledService.list(queryWrapper);
//
List<Long> stringList = new ArrayList<>();
//
for (AlertCalled al: alertCalleds
//
) {
//
stringList.add(al.getEquipmentId());
//
}
//
List<Long> listL = stringList.stream().distinct().collect(Collectors.toList());
//
qb0.should(QueryBuilders.termsQuery("sequenceNbr", listL.toArray()));
//
boolMust.must(qb0);
//
}
if
(!
ValidationUtil
.
isEmpty
(
address
))
{
...
...
@@ -165,20 +161,20 @@ public class ESElevatorServiceImpl {
{
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
searchHit
.
getContent
());
EsElevatorDto
esElevatorDto
=
JSONObject
.
toJavaObject
(
jsonObject
,
EsElevatorDto
.
class
);
if
(
null
!=
alertCalleds
)
{
for
(
AlertCalled
al:
alertCalleds
)
{
if
(
al
.
getEquipmentId
().
equals
(
esElevatorDto
.
getSequenceNbr
()))
{
esElevatorDto
.
setHappenTime
(
al
.
getCallTime
());
esElevatorDto
.
setAlertId
(
String
.
valueOf
(
al
.
getSequenceNbr
()));
esElevatorDto
.
setAlarmTypeCode
(
al
.
getAlarmTypeCode
());
esElevatorDto
.
setType
(
al
.
getAlertStage
());
list
.
add
(
esElevatorDto
);
break
;
}
}
}
list
.
add
(
esElevatorDto
);
//
if(null != alertCalleds) {
//
for (AlertCalled al: alertCalleds
//
) {
//
if(al.getEquipmentId().equals(esElevatorDto.getSequenceNbr())) {
//
esElevatorDto.setHappenTime(al.getCallTime());
//
esElevatorDto.setAlertId(String.valueOf(al.getSequenceNbr()));
//
esElevatorDto.setAlarmTypeCode(al.getAlarmTypeCode());
//
esElevatorDto.setType(al.getAlertStage());
//
list.add(esElevatorDto);
//
break;
//
}
//
}
//
}
}
}
catch
(
Exception
e
)
...
...
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