Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
signal
traffic-signal-platform
Commits
409eae83
Commit
409eae83
authored
Mar 24, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 态势检测-设备状态 优化
parent
58fa61f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
24 deletions
+22
-24
SituationDetectionController.java
...et/wanji/web/controller/SituationDetectionController.java
+0
-2
SituationDetectionServiceImpl.java
...wanji/web/service/impl/SituationDetectionServiceImpl.java
+22
-22
No files found.
signal-control-service/src/main/java/net/wanji/web/controller/SituationDetectionController.java
View file @
409eae83
...
...
@@ -162,8 +162,6 @@ public class SituationDetectionController extends BaseController {
@GetMapping
(
value
=
"crossDeviceStatusInfo"
,
produces
=
MediaType
.
APPLICATION_JSON
)
public
JsonViewObject
crossDeviceStatusInfo
()
{
List
<
CrossDeviceStatusInfoOutVO
>
list
=
situationDetectionService
.
crossDeviceStatusInfo
();
// 数据库 status 0离线;1在线 faultType 0正常
// 适配前端 status 1在线;2离线;3故障
for
(
CrossDeviceStatusInfoOutVO
item
:
list
)
{
int
fualType
=
item
.
getFaultType
();
int
status
=
item
.
getStatus
();
...
...
signal-control-service/src/main/java/net/wanji/web/service/impl/SituationDetectionServiceImpl.java
View file @
409eae83
...
...
@@ -23,7 +23,10 @@ import net.wanji.web.common.enums.DeviceStatusEnum;
import
net.wanji.web.common.enums.DeviceTypeEnum
;
import
net.wanji.web.common.util.StringUtils
;
import
net.wanji.web.dto.CrossIdNameDTO
;
import
net.wanji.web.entity.*
;
import
net.wanji.web.entity.TBaseAreaCross
;
import
net.wanji.web.entity.TBaseAreaInfo
;
import
net.wanji.web.entity.TCrossControlHist
;
import
net.wanji.web.entity.TDeviceStatusInfo
;
import
net.wanji.web.mapper.*
;
import
net.wanji.web.po.*
;
import
net.wanji.web.service.SituationDetectionService
;
...
...
@@ -350,27 +353,24 @@ public class SituationDetectionServiceImpl implements SituationDetectionService
@Override
public
Map
<
String
,
Map
<
String
,
Integer
>>
allDeviceStatus
(
String
adCode
)
{
List
<
AllDeviceStatusPO
>
allDeviceStatusPOList
=
allDeviceStatusMapper
.
selectAllDeviceStatus
(
adCode
);
Map
<
String
,
Map
<
String
,
Integer
>>
res
=
new
LinkedHashMap
<>();
// 初始化Map
for
(
DeviceTypeEnum
value
:
DeviceTypeEnum
.
values
())
{
res
.
put
(
value
.
getMsg
(),
null
);
TDeviceStatusInfo
queryEntity
=
new
TDeviceStatusInfo
();
if
(
StringUtils
.
isNotEmpty
(
adCode
))
{
queryEntity
.
setType
(
Integer
.
valueOf
(
adCode
));
}
Map
<
Integer
,
List
<
AllDeviceStatusPO
>>
collect
=
allDeviceStatusPOList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
AllDeviceStatusPO:
:
getType
));
for
(
Map
.
Entry
<
Integer
,
List
<
AllDeviceStatusPO
>>
entry
:
collect
.
entrySet
())
{
Map
<
String
,
Integer
>
valueMap
=
new
LinkedHashMap
<>();
// 初始化Map
for
(
DeviceStatusEnum
value
:
DeviceStatusEnum
.
values
())
{
valueMap
.
put
(
value
.
getMsg
(),
0
);
}
for
(
AllDeviceStatusPO
allDeviceStatusPO
:
entry
.
getValue
())
{
Integer
status
=
allDeviceStatusPO
.
getStatus
();
Integer
statusCount
=
allDeviceStatusPO
.
getStatusCount
();
valueMap
.
put
(
DeviceStatusEnum
.
getMsgByCode
(
status
),
statusCount
);
}
Integer
key
=
entry
.
getKey
();
res
.
put
(
DeviceTypeEnum
.
getMsgByCode
(
key
),
valueMap
);
List
<
TDeviceStatusInfo
>
tDeviceStatusInfos
=
allDeviceStatusMapper
.
selectByEntity
(
queryEntity
);
Map
<
String
,
Map
<
String
,
Integer
>>
res
=
new
LinkedHashMap
<>();
Map
<
Integer
,
List
<
TDeviceStatusInfo
>>
deviceTypeMap
=
tDeviceStatusInfos
.
stream
().
collect
(
Collectors
.
groupingBy
(
TDeviceStatusInfo:
:
getType
));
for
(
Map
.
Entry
<
Integer
,
List
<
TDeviceStatusInfo
>>
entry
:
deviceTypeMap
.
entrySet
())
{
Integer
type
=
entry
.
getKey
();
List
<
TDeviceStatusInfo
>
all
=
entry
.
getValue
();
List
<
TDeviceStatusInfo
>
offline
=
all
.
stream
().
filter
(
tDeviceStatusInfo
->
tDeviceStatusInfo
.
getStatus
()
==
0
).
collect
(
Collectors
.
toList
());
List
<
TDeviceStatusInfo
>
normal
=
all
.
stream
().
filter
(
tDeviceStatusInfo
->
isDealStatus
(
tDeviceStatusInfo
)).
collect
(
Collectors
.
toList
());
Map
deviceMap
=
new
HashMap
<>();
deviceMap
.
put
(
DeviceStatusEnum
.
NORMAL
.
getMsg
(),
normal
.
size
());
deviceMap
.
put
(
DeviceStatusEnum
.
WRONG
.
getMsg
(),
all
.
size
()
-
normal
.
size
()
-
offline
.
size
());
deviceMap
.
put
(
DeviceStatusEnum
.
OFFLINE
.
getMsg
(),
offline
.
size
());
res
.
put
(
DeviceTypeEnum
.
getMsgByCode
(
type
),
deviceMap
);
}
return
res
;
...
...
@@ -586,7 +586,7 @@ public class SituationDetectionServiceImpl implements SituationDetectionService
for
(
CrossInfoOutVo
crossInfoOutVo
:
crossInfoOutVoList
)
{
if
(
StringUtils
.
equals
(
crossInfoOutVo
.
getId
(),
tDeviceStatus
.
getCode
()))
{
signalFaultInfoVO
.
setIp
(
crossInfoOutVo
.
getIp
());
if
(
tDeviceStatus
.
getFaultType
()
==
0
&&
tDeviceStatus
.
getStatus
()
==
1
)
{
if
(
isDealStatus
(
tDeviceStatus
)
)
{
signalFaultInfoVO
.
setDealStatus
(
"2"
);
}
}
...
...
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