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
b072e1dc
Commit
b072e1dc
authored
Jan 04, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
态势检测-统一事件告警监测弹窗服务
parent
e10d8984
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
115 additions
and
9 deletions
+115
-9
SituationDetectionController.java
...et/wanji/web/controller/SituationDetectionController.java
+63
-6
SituationDetectionService.java
...java/net/wanji/web/service/SituationDetectionService.java
+3
-1
SituationDetectionServiceImpl.java
...wanji/web/service/impl/SituationDetectionServiceImpl.java
+10
-1
CommonEventAlarmOutVo.java
...anji/web/vo/situationDetection/CommonEventAlarmOutVo.java
+38
-0
application-dev.yml
...al-control-service/src/main/resources/application-dev.yml
+1
-1
No files found.
signal-control-service/src/main/java/net/wanji/web/controller/SituationDetectionController.java
View file @
b072e1dc
package
net
.
wanji
.
web
.
controller
;
package
net
.
wanji
.
web
.
controller
;
import
net.wanji.web.common.entity.JsonViewObject
;
import
net.wanji.web.service.SituationDetectionService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
net.wanji.web.common.entity.JsonViewObject
;
import
net.wanji.web.common.util.StringUtils
;
import
net.wanji.web.entity.TBaseCrossInfo
;
import
net.wanji.web.service.SituationDetectionService
;
import
net.wanji.web.util.HttpRestUtil
;
import
net.wanji.web.vo.situationDetection.*
;
import
net.wanji.web.vo.situationDetection.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.ws.rs.core.MediaType
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.ws.rs.core.MediaType
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
static
net
.
wanji
.
web
.
util
.
HttpRestUtil
.
buildHeader
;
/**
/**
...
@@ -26,7 +34,16 @@ import java.util.Map;
...
@@ -26,7 +34,16 @@ import java.util.Map;
@Api
(
value
=
"SituationDetectionController"
,
description
=
"态势监测"
)
@Api
(
value
=
"SituationDetectionController"
,
description
=
"态势监测"
)
@RequestMapping
(
"/situationDetection"
)
@RequestMapping
(
"/situationDetection"
)
@RestController
@RestController
public
class
SituationDetectionController
extends
BaseController
{
public
class
SituationDetectionController
extends
BaseController
{
@Autowired
private
HttpRestUtil
httpRestUtil
;
@Value
(
"${utcServiceUrl}"
)
private
String
utcServiceUrl
;
@Value
(
"${syncDeviceSatusUrn}"
)
private
String
syncDeviceSatusUrl
;
@Autowired
@Autowired
SituationDetectionService
situationDetectionService
;
SituationDetectionService
situationDetectionService
;
...
@@ -147,11 +164,51 @@ public class SituationDetectionController extends BaseController{
...
@@ -147,11 +164,51 @@ public class SituationDetectionController extends BaseController{
}
}
@ApiOperation
(
value
=
"路口设备状态信息"
,
notes
=
"路口设备状态信息"
,
response
=
JsonViewObject
.
class
,
@ApiOperation
(
value
=
"路口设备状态信息"
,
notes
=
"路口设备状态信息"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
)
produces
=
MediaType
.
APPLICATION_JSON
)
@GetMapping
(
value
=
"crossDeviceStatusInfo"
,
produces
=
MediaType
.
APPLICATION_JSON
)
@GetMapping
(
value
=
"crossDeviceStatusInfo"
,
produces
=
MediaType
.
APPLICATION_JSON
)
public
JsonViewObject
crossDeviceStatusInfo
()
{
public
JsonViewObject
crossDeviceStatusInfo
()
{
List
<
CrossDeviceStatusInfoResultVO
>
list
=
situationDetectionService
.
crossDeviceStatusInfo
();
List
<
CrossDeviceStatusInfoResultVO
>
list
=
situationDetectionService
.
crossDeviceStatusInfo
();
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
(
list
);
return
jsonViewObject
.
success
(
list
);
}
}
@ApiOperation
(
value
=
"统一事件告警检测"
,
notes
=
"统一事件告警检测"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
)
@GetMapping
(
value
=
"commonEventWarnNotify"
,
produces
=
MediaType
.
APPLICATION_JSON
)
public
JsonViewObject
commonEventWarnNotify
()
{
// 路口报警
// 事件报警
// 信号机故障
Map
<
String
,
String
>
header
=
buildHeader
();
JsonViewObject
jsonViewObject
=
httpRestUtil
.
doPost
(
utcServiceUrl
.
concat
(
syncDeviceSatusUrl
),
header
,
""
,
JsonViewObject
.
class
);
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCode
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"远程服务调用异常"
.
concat
(
utcServiceUrl
.
concat
(
syncDeviceSatusUrl
)));
}
LocalDateTime
now
=
LocalDateTime
.
now
();
String
formatNow
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
now
);
List
<
Map
<
String
,
Object
>>
content
=
(
List
<
Map
<
String
,
Object
>>)
jsonViewObject
.
getContent
();
Map
<
String
,
Object
>
result
=
content
.
get
(
0
);
String
signalId
=
(
String
)
result
.
get
(
"signalId"
);
Integer
faultType
=
(
Integer
)
result
.
get
(
"faultType"
);
if
(
Objects
.
nonNull
(
faultType
)
&&
faultType
!=
0
&&
StringUtils
.
isNotEmpty
(
signalId
))
{
CommonEventAlarmOutVo
commonEventAlarmOutVo
=
new
CommonEventAlarmOutVo
();
commonEventAlarmOutVo
.
setEventType
(
3
);
commonEventAlarmOutVo
.
setEventId
(
signalId
);
commonEventAlarmOutVo
.
setEventName
(
"信号机故障"
);
// todo 信号机厂商
commonEventAlarmOutVo
.
setEventDesc
(
"信号机故障"
);
commonEventAlarmOutVo
.
setStatus
(
String
.
valueOf
(
faultType
));
commonEventAlarmOutVo
.
setStartTime
(
formatNow
);
TBaseCrossInfo
tBaseCrossInfo
=
situationDetectionService
.
selectCrossInfoById
(
signalId
);
if
(
Objects
.
nonNull
(
tBaseCrossInfo
))
{
commonEventAlarmOutVo
.
setCoordinate
(
tBaseCrossInfo
.
getLocation
());
}
jsonViewObject
.
setContent
(
commonEventAlarmOutVo
);
}
else
{
jsonViewObject
.
setContent
(
null
);
jsonViewObject
.
setMessage
(
"无告警数据"
);
}
return
jsonViewObject
;
}
}
}
signal-control-service/src/main/java/net/wanji/web/service/SituationDetectionService.java
View file @
b072e1dc
package
net
.
wanji
.
web
.
service
;
package
net
.
wanji
.
web
.
service
;
import
net.wanji.web.
po.
CrossInfo
;
import
net.wanji.web.
entity.TBase
CrossInfo
;
import
net.wanji.web.vo.situationDetection.*
;
import
net.wanji.web.vo.situationDetection.*
;
import
java.text.ParseException
;
import
java.text.ParseException
;
...
@@ -32,4 +32,6 @@ public interface SituationDetectionService {
...
@@ -32,4 +32,6 @@ public interface SituationDetectionService {
List
<
GreenwaveCrossOutVO
>
greenwaveCross
(
String
adCode
,
String
currentTime
,
Integer
id
);
List
<
GreenwaveCrossOutVO
>
greenwaveCross
(
String
adCode
,
String
currentTime
,
Integer
id
);
List
<
CrossDeviceStatusInfoResultVO
>
crossDeviceStatusInfo
();
List
<
CrossDeviceStatusInfoResultVO
>
crossDeviceStatusInfo
();
TBaseCrossInfo
selectCrossInfoById
(
String
signalId
);
}
}
signal-control-service/src/main/java/net/wanji/web/service/impl/SituationDetectionServiceImpl.java
View file @
b072e1dc
...
@@ -5,8 +5,9 @@ import cn.hutool.core.date.DateUnit;
...
@@ -5,8 +5,9 @@ import cn.hutool.core.date.DateUnit;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
net.wanji.web.common.enums.*
;
import
net.wanji.web.common.enums.*
;
import
net.wanji.web.common.util.CrossUtil
;
import
net.wanji.web.common.util.CrossUtil
;
import
net.wanji.web.
po.*
;
import
net.wanji.web.
entity.TBaseCrossInfo
;
import
net.wanji.web.mapper.*
;
import
net.wanji.web.mapper.*
;
import
net.wanji.web.po.*
;
import
net.wanji.web.service.SituationDetectionService
;
import
net.wanji.web.service.SituationDetectionService
;
import
net.wanji.web.vo.situationDetection.*
;
import
net.wanji.web.vo.situationDetection.*
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -49,6 +50,9 @@ public class SituationDetectionServiceImpl implements SituationDetectionService
...
@@ -49,6 +50,9 @@ public class SituationDetectionServiceImpl implements SituationDetectionService
@Autowired
@Autowired
CrossInfoMapper
crossInfoMapper
;
CrossInfoMapper
crossInfoMapper
;
@Autowired
TBaseCrossInfoMapper
tBaseCrossInfoMapper
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
@Override
@Override
...
@@ -387,6 +391,11 @@ public class SituationDetectionServiceImpl implements SituationDetectionService
...
@@ -387,6 +391,11 @@ public class SituationDetectionServiceImpl implements SituationDetectionService
List
<
CrossDeviceStatusInfoResultVO
>
results
=
crossInfoMapper
.
listCrossDeviceStatusInfo
();
List
<
CrossDeviceStatusInfoResultVO
>
results
=
crossInfoMapper
.
listCrossDeviceStatusInfo
();
return
results
;
return
results
;
}
}
@Override
public
TBaseCrossInfo
selectCrossInfoById
(
String
signalId
)
{
return
tBaseCrossInfoMapper
.
selectById
(
signalId
);
}
}
}
class
CrossAlarmComparator
implements
Comparator
<
CrossAlarmOutVO
>
{
class
CrossAlarmComparator
implements
Comparator
<
CrossAlarmOutVO
>
{
...
...
signal-control-service/src/main/java/net/wanji/web/vo/situationDetection/CommonEventAlarmOutVo.java
0 → 100644
View file @
b072e1dc
package
net
.
wanji
.
web
.
vo
.
situationDetection
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author duanruiming
* @date 2023/01/04 10:31
*/
@Data
@ApiModel
(
value
=
"CommonEventAlarmOutVo"
,
description
=
"统一事件告警检测返回结果"
)
public
class
CommonEventAlarmOutVo
{
@ApiModelProperty
(
value
=
"事件编号:1:路口报警、2:事件报警、3:信号机故障"
)
Integer
eventType
;
@ApiModelProperty
(
value
=
"事件id"
)
String
eventId
;
@ApiModelProperty
(
value
=
"事件名称"
)
String
eventName
;
@ApiModelProperty
(
value
=
"事件描述"
)
String
eventDesc
;
@ApiModelProperty
(
value
=
"事件状态:路口报警:状态 0正常 1失衡 2拥堵 3溢出 4死锁;事件报警:1事故 2拥堵 3管制 4施工; 信号机故障:0正常 1检测器故障 2时钟故障 3电源故障 4驱动模块故障 5信号灯故障 6箱门开启 7方案错误 8绿冲突 9红全熄 10行人红熄"
)
String
status
;
@ApiModelProperty
(
value
=
"发生时间"
)
String
startTime
;
@ApiModelProperty
(
value
=
"时长(单位:分钟)"
)
Integer
duration
;
@ApiModelProperty
(
value
=
"事件坐标:经度,纬度;经度,纬度..."
)
String
coordinate
;
}
signal-control-service/src/main/resources/application-dev.yml
View file @
b072e1dc
...
@@ -58,5 +58,5 @@ spring:
...
@@ -58,5 +58,5 @@ spring:
signal
:
signal
:
#远程signalUtcService服务地址
#远程signalUtcService服务地址
utcServiceUrl
:
http://10.100.1.59
/
:32000/utc
utcServiceUrl
:
http://10.100.1.59:32000/utc
syncDeviceSatusUrn
:
/signalStatus/runningStatusAlarm
syncDeviceSatusUrn
:
/signalStatus/runningStatusAlarm
\ No newline at end of file
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