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
952a14b3
Commit
952a14b3
authored
Sep 18, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
08a50408
444f6d38
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
218 additions
and
51 deletions
+218
-51
AbnormalDetailBO.java
...vice/src/main/java/net/wanji/opt/bo/AbnormalDetailBO.java
+29
-0
SceneEvaluateController.java
...ava/net/wanji/opt/controller/SceneEvaluateController.java
+17
-3
SceneEvaluateService.java
...main/java/net/wanji/opt/service/SceneEvaluateService.java
+8
-2
SceneEvaluateServiceImpl.java
.../net/wanji/opt/service/impl/SceneEvaluateServiceImpl.java
+145
-39
SceneEvaluateAbnormalDetailVO.java
.../java/net/wanji/opt/vo/SceneEvaluateAbnormalDetailVO.java
+16
-0
SceneEvaluateAbnormalDistributeVO.java
...a/net/wanji/opt/vo/SceneEvaluateAbnormalDistributeVO.java
+2
-2
CrossDataHistMapper.java
...ava/net/wanji/databus/dao/mapper/CrossDataHistMapper.java
+1
-1
CrossTurnDataRealtimePO.java
...in/java/net/wanji/databus/po/CrossTurnDataRealtimePO.java
+0
-4
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/bo/AbnormalDetailBO.java
0 → 100644
View file @
952a14b3
package
net
.
wanji
.
opt
.
bo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author Kent HAN
* @date 2023/6/9 13:52
*/
@Data
@ApiModel
(
value
=
"AbnormalDetailBO"
,
description
=
"异常事件详情"
)
public
class
AbnormalDetailBO
{
@ApiModelProperty
(
value
=
"路口ID"
)
private
String
crossId
;
@ApiModelProperty
(
value
=
"小时分钟 HH:mm"
)
private
String
hourMinute
;
@ApiModelProperty
(
value
=
"月日,格式 7/9"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"M/d"
,
timezone
=
"GMT+8"
)
private
Date
problemDate
;
@ApiModelProperty
(
value
=
"状态 0正常 1 失衡 2 拥堵 3 溢出 4 死锁"
)
private
Integer
status
;
}
signal-optimize-service/src/main/java/net/wanji/opt/controller/SceneEvaluateController.java
View file @
952a14b3
...
...
@@ -6,14 +6,17 @@ import io.swagger.annotations.ApiResponse;
import
io.swagger.annotations.ApiResponses
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.databus.bo.CrossIdAndStartEndDateBO
;
import
net.wanji.opt.bo.AbnormalDetailBO
;
import
net.wanji.opt.service.impl.SceneEvaluateServiceImpl
;
import
net.wanji.opt.vo.SceneEvaluateabnormalDistributeVO
;
import
net.wanji.opt.vo.SceneEvaluateAbnormalDetailVO
;
import
net.wanji.opt.vo.SceneEvaluateAbnormalDistributeVO
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.ws.rs.core.MediaType
;
import
java.text.ParseException
;
/**
* 场景评价
...
...
@@ -36,11 +39,22 @@ public class SceneEvaluateController {
@PostMapping
(
value
=
"/abnormalDistribute"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
SceneEvaluate
a
bnormalDistributeVO
.
class
),
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
SceneEvaluate
A
bnormalDistributeVO
.
class
),
})
public
JsonViewObject
abnormalDistribute
(
@RequestBody
CrossIdAndStartEndDateBO
bo
)
{
SceneEvaluate
a
bnormalDistributeVO
res
=
sceneEvaluateService
.
abnormalDistribute
(
bo
);
SceneEvaluate
A
bnormalDistributeVO
res
=
sceneEvaluateService
.
abnormalDistribute
(
bo
);
return
JsonViewObject
.
newInstance
().
success
(
res
);
}
@ApiOperation
(
value
=
"异常事件详情"
,
notes
=
"异常事件详情"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/abnormalDetail"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
SceneEvaluateAbnormalDetailVO
.
class
),
})
public
JsonViewObject
abnormalDetail
(
@RequestBody
AbnormalDetailBO
abnormalDetailBO
)
throws
ParseException
{
SceneEvaluateAbnormalDetailVO
res
=
sceneEvaluateService
.
abnormalDetail
(
abnormalDetailBO
);
return
JsonViewObject
.
newInstance
().
success
(
res
);
}
}
\ No newline at end of file
signal-optimize-service/src/main/java/net/wanji/opt/service/SceneEvaluateService.java
View file @
952a14b3
package
net
.
wanji
.
opt
.
service
;
import
net.wanji.databus.bo.CrossIdAndStartEndDateBO
;
import
net.wanji.opt.vo.SceneEvaluateabnormalDistributeVO
;
import
net.wanji.opt.bo.AbnormalDetailBO
;
import
net.wanji.opt.vo.SceneEvaluateAbnormalDetailVO
;
import
net.wanji.opt.vo.SceneEvaluateAbnormalDistributeVO
;
import
java.text.ParseException
;
public
interface
SceneEvaluateService
{
SceneEvaluateabnormalDistributeVO
abnormalDistribute
(
CrossIdAndStartEndDateBO
bo
);
SceneEvaluateAbnormalDistributeVO
abnormalDistribute
(
CrossIdAndStartEndDateBO
bo
);
SceneEvaluateAbnormalDetailVO
abnormalDetail
(
AbnormalDetailBO
abnormalDetailBO
)
throws
ParseException
;
}
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/SceneEvaluateServiceImpl.java
View file @
952a14b3
...
...
@@ -7,12 +7,16 @@ import net.wanji.common.utils.tool.TimeArrayUtil;
import
net.wanji.databus.bo.CrossIdAndStartEndDateBO
;
import
net.wanji.databus.dao.mapper.CrossDataHistMapper
;
import
net.wanji.databus.dto.MetricHistDTO
;
import
net.wanji.databus.po.CrossDataHistPO
;
import
net.wanji.opt.bo.AbnormalDetailBO
;
import
net.wanji.opt.service.SceneEvaluateService
;
import
net.wanji.opt.vo.RunningEvaluateMetricsDetailVO
;
import
net.wanji.opt.vo.SceneEvaluateabnormalDistributeVO
;
import
net.wanji.opt.vo.SceneEvaluateAbnormalDetailVO
;
import
net.wanji.opt.vo.SceneEvaluateAbnormalDistributeVO
;
import
org.jetbrains.annotations.NotNull
;
import
org.springframework.stereotype.Service
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -34,13 +38,13 @@ public class SceneEvaluateServiceImpl implements SceneEvaluateService {
}
@Override
public
SceneEvaluate
a
bnormalDistributeVO
abnormalDistribute
(
CrossIdAndStartEndDateBO
bo
)
{
public
SceneEvaluate
A
bnormalDistributeVO
abnormalDistribute
(
CrossIdAndStartEndDateBO
bo
)
{
String
crossId
=
bo
.
getCrossId
();
Date
startDate
=
bo
.
getStartDate
();
Date
endDate
=
bo
.
getEndDate
();
SceneEvaluate
abnormalDistributeVO
vo
=
new
SceneEvaluatea
bnormalDistributeVO
();
List
<
SceneEvaluate
a
bnormalDistributeVO
.
TimeDistribution
>
timeDistributionList
=
SceneEvaluate
AbnormalDistributeVO
vo
=
new
SceneEvaluateA
bnormalDistributeVO
();
List
<
SceneEvaluate
A
bnormalDistributeVO
.
TimeDistribution
>
timeDistributionList
=
buildTimeDistributionList
(
crossId
,
startDate
,
endDate
);
vo
.
setTimeDateDistributionList
(
buildFinalTimeDistributionList
(
timeDistributionList
));
...
...
@@ -48,11 +52,113 @@ public class SceneEvaluateServiceImpl implements SceneEvaluateService {
return
vo
;
}
public
List
<
SceneEvaluateabnormalDistributeVO
.
TimeDateDistribution
>
buildFinalTimeDistributionList
(
List
<
SceneEvaluateabnormalDistributeVO
.
TimeDistribution
>
timeDistributionList
)
{
List
<
SceneEvaluateabnormalDistributeVO
.
FinalTimeDistribution
>
finalTimeDistributionList
=
new
ArrayList
<>();
@Override
public
SceneEvaluateAbnormalDetailVO
abnormalDetail
(
AbnormalDetailBO
abnormalDetailBO
)
throws
ParseException
{
String
crossId
=
abnormalDetailBO
.
getCrossId
();
String
hourMinute
=
abnormalDetailBO
.
getHourMinute
();
Date
problemDate
=
abnormalDetailBO
.
getProblemDate
();
Integer
status
=
abnormalDetailBO
.
getStatus
();
// 获取当前年份
Calendar
calendar
=
Calendar
.
getInstance
();
int
currentYear
=
calendar
.
get
(
Calendar
.
YEAR
);
// 设置 problemDate 的年份为当前年份
calendar
.
setTime
(
problemDate
);
calendar
.
set
(
Calendar
.
YEAR
,
currentYear
);
Date
newDate
=
calendar
.
getTime
();
calendar
.
setTime
(
newDate
);
// 设置时间为当天开始时间(00:00:00)
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
0
);
calendar
.
set
(
Calendar
.
MINUTE
,
0
);
calendar
.
set
(
Calendar
.
SECOND
,
0
);
calendar
.
set
(
Calendar
.
MILLISECOND
,
0
);
int
startOfDayTimestamp
=
(
int
)
(
calendar
.
getTimeInMillis
()
/
1000
);
// 设置时间为当天结束时间(23:59:59)
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
23
);
calendar
.
set
(
Calendar
.
MINUTE
,
59
);
calendar
.
set
(
Calendar
.
SECOND
,
59
);
int
endOfDayTimestamp
=
(
int
)
(
calendar
.
getTimeInMillis
()
/
1000
);
// 查询当天所有场景
List
<
CrossDataHistPO
>
crossDataHistPOList
=
crossDataHistMapper
.
selectByCrossIdAndStartEnd
(
crossId
,
startOfDayTimestamp
,
endOfDayTimestamp
);
// 按照startTime分组并选择duration最长的一个。
List
<
CrossDataHistPO
>
filteredList
=
crossDataHistPOList
.
stream
()
.
filter
(
po
->
Objects
.
equals
(
po
.
getStatus
(),
status
))
.
collect
(
Collectors
.
groupingBy
(
CrossDataHistPO:
:
getStartTime
))
.
values
().
stream
()
.
map
(
list
->
list
.
stream
().
max
(
Comparator
.
comparingInt
(
CrossDataHistPO:
:
getDuration
)).
get
())
.
collect
(
Collectors
.
toList
());
// 进行startTime和endTime的格式化和分组。
Map
<
String
,
List
<
CrossDataHistPO
>>
groupedData
=
filteredList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
po
->
{
// 计算startTime和endTime
Date
startTime
=
po
.
getStartTime
();
Date
endTime
=
new
Date
(
startTime
.
getTime
()
+
po
.
getDuration
()
*
60
*
1000L
);
// startTime向前取整至5分钟
calendar
.
setTime
(
startTime
);
int
minute
=
calendar
.
get
(
Calendar
.
MINUTE
);
calendar
.
add
(
Calendar
.
MINUTE
,
-(
minute
%
5
));
String
startTimeStr
=
HOUR_SDF
.
format
(
calendar
.
getTime
());
// endTime向后取整至5分钟
calendar
.
setTime
(
endTime
);
minute
=
calendar
.
get
(
Calendar
.
MINUTE
);
calendar
.
add
(
Calendar
.
MINUTE
,
5
-
(
minute
%
5
));
String
endTimeStr
=
HOUR_SDF
.
format
(
calendar
.
getTime
());
return
startTimeStr
+
"-"
+
endTimeStr
;
}));
Date
targetDate
=
HOUR_SDF
.
parse
(
hourMinute
);
// 获取当前年份,并设置targetDate的年份
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
newDate
);
String
[]
split
=
hourMinute
.
split
(
":"
);
cal
.
set
(
Calendar
.
HOUR
,
Integer
.
parseInt
(
split
[
0
]));
cal
.
set
(
Calendar
.
MINUTE
,
Integer
.
parseInt
(
split
[
1
]));
targetDate
=
cal
.
getTime
();
// 从groupedData中筛选与hourMinute相交的记录
List
<
CrossDataHistPO
>
intersectingRecords
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
List
<
CrossDataHistPO
>>
entry
:
groupedData
.
entrySet
())
{
String
key
=
entry
.
getKey
();
String
[]
times
=
key
.
split
(
"-"
);
Calendar
startCal
=
Calendar
.
getInstance
();
Calendar
endCal
=
Calendar
.
getInstance
();
startCal
.
setTime
(
newDate
);
endCal
.
setTime
(
newDate
);
String
[]
start
=
times
[
0
].
split
(
":"
);
startCal
.
set
(
Calendar
.
HOUR
,
Integer
.
parseInt
(
start
[
0
]));
startCal
.
set
(
Calendar
.
MINUTE
,
Integer
.
parseInt
(
start
[
1
]));
String
[]
end
=
times
[
0
].
split
(
":"
);
endCal
.
set
(
Calendar
.
HOUR
,
Integer
.
parseInt
(
end
[
0
]));
endCal
.
set
(
Calendar
.
MINUTE
,
Integer
.
parseInt
(
end
[
1
]));
Date
startTime
=
startCal
.
getTime
();
Date
endTime
=
endCal
.
getTime
();
// 检查相交条件
if
(!(
targetDate
.
before
(
startTime
)
||
targetDate
.
after
(
endTime
)))
{
intersectingRecords
.
addAll
(
entry
.
getValue
());
}
}
return
null
;
}
public
List
<
SceneEvaluateAbnormalDistributeVO
.
TimeDateDistribution
>
buildFinalTimeDistributionList
(
List
<
SceneEvaluateAbnormalDistributeVO
.
TimeDistribution
>
timeDistributionList
)
{
List
<
SceneEvaluateAbnormalDistributeVO
.
FinalTimeDistribution
>
finalTimeDistributionList
=
new
ArrayList
<>();
for
(
SceneEvaluate
a
bnormalDistributeVO
.
TimeDistribution
timeDistribution
:
timeDistributionList
)
{
for
(
SceneEvaluate
A
bnormalDistributeVO
.
TimeDistribution
timeDistribution
:
timeDistributionList
)
{
Date
problemDate
=
timeDistribution
.
getProblemDate
();
for
(
RunningEvaluateMetricsDetailVO
.
ProblemStatus
problemStatus
:
timeDistribution
.
getProblemStatusList
())
{
...
...
@@ -62,8 +168,8 @@ public class SceneEvaluateServiceImpl implements SceneEvaluateService {
// 生成 FinalTimeDistribution 对象
for
(
Date
time
=
getStartTimeOfDay
();
time
.
before
(
getEndTimeOfDay
());
time
=
addFiveMinutes
(
time
))
{
if
(
isTimeIntersecting
(
time
,
addFiveMinutes
(
time
),
startTime
,
endTime
))
{
SceneEvaluate
a
bnormalDistributeVO
.
FinalTimeDistribution
finalTimeDistribution
=
new
SceneEvaluate
a
bnormalDistributeVO
.
FinalTimeDistribution
();
SceneEvaluate
A
bnormalDistributeVO
.
FinalTimeDistribution
finalTimeDistribution
=
new
SceneEvaluate
A
bnormalDistributeVO
.
FinalTimeDistribution
();
finalTimeDistribution
.
setProblemDate
(
problemDate
);
finalTimeDistribution
.
setStatus
(
status
);
// 将 time 中的年、月、日设置为 problemDate 中的年、月、日
...
...
@@ -102,8 +208,8 @@ public class SceneEvaluateServiceImpl implements SceneEvaluateService {
.
anyMatch
(
item
->
item
.
getDistributionTime
().
equals
(
time
)
&&
isSameDay
(
item
.
getProblemDate
(),
problemDate
));
if
(!
exists
)
{
SceneEvaluate
a
bnormalDistributeVO
.
FinalTimeDistribution
newItem
=
new
SceneEvaluate
a
bnormalDistributeVO
.
FinalTimeDistribution
();
SceneEvaluate
A
bnormalDistributeVO
.
FinalTimeDistribution
newItem
=
new
SceneEvaluate
A
bnormalDistributeVO
.
FinalTimeDistribution
();
newItem
.
setProblemDate
(
problemDate
);
newItem
.
setDistributionTime
(
time
);
newItem
.
setStatus
(
null
);
...
...
@@ -113,14 +219,14 @@ public class SceneEvaluateServiceImpl implements SceneEvaluateService {
}
// 重新排序
finalTimeDistributionList
.
sort
(
Comparator
.
comparing
(
SceneEvaluate
a
bnormalDistributeVO
.
FinalTimeDistribution
::
getProblemDate
)
.
thenComparing
(
SceneEvaluate
a
bnormalDistributeVO
.
FinalTimeDistribution
::
getDistributionTime
));
.
sort
(
Comparator
.
comparing
(
SceneEvaluate
A
bnormalDistributeVO
.
FinalTimeDistribution
::
getProblemDate
)
.
thenComparing
(
SceneEvaluate
A
bnormalDistributeVO
.
FinalTimeDistribution
::
getDistributionTime
));
// 生成时间日期分布
List
<
SceneEvaluate
a
bnormalDistributeVO
.
TimeDateDistribution
>
timeDateDistributionList
=
new
ArrayList
<>();
List
<
SceneEvaluate
A
bnormalDistributeVO
.
TimeDateDistribution
>
timeDateDistributionList
=
new
ArrayList
<>();
List
<
String
>
minuteSectionArray
=
TimeArrayUtil
.
getMinuteSectionArray
(
5
);
for
(
String
timeStr
:
minuteSectionArray
)
{
SceneEvaluate
a
bnormalDistributeVO
.
TimeDateDistribution
timeDateDistribution
=
new
SceneEvaluate
a
bnormalDistributeVO
.
TimeDateDistribution
();
SceneEvaluate
A
bnormalDistributeVO
.
TimeDateDistribution
timeDateDistribution
=
new
SceneEvaluate
A
bnormalDistributeVO
.
TimeDateDistribution
();
timeDateDistribution
.
setHourMinute
(
timeStr
);
timeDateDistribution
.
setStatusByDateList
(
buildStatusByDateList
(
timeStr
,
finalTimeDistributionList
));
timeDateDistributionList
.
add
(
timeDateDistribution
);
...
...
@@ -128,19 +234,19 @@ public class SceneEvaluateServiceImpl implements SceneEvaluateService {
return
timeDateDistributionList
;
}
private
List
<
SceneEvaluate
a
bnormalDistributeVO
.
StatusByDate
>
buildStatusByDateList
(
String
timeStr
,
List
<
SceneEvaluate
a
bnormalDistributeVO
.
FinalTimeDistribution
>
finalTimeDistributionList
)
{
List
<
SceneEvaluate
a
bnormalDistributeVO
.
StatusByDate
>
res
=
new
ArrayList
<>();
private
List
<
SceneEvaluate
A
bnormalDistributeVO
.
StatusByDate
>
buildStatusByDateList
(
String
timeStr
,
List
<
SceneEvaluate
A
bnormalDistributeVO
.
FinalTimeDistribution
>
finalTimeDistributionList
)
{
List
<
SceneEvaluate
A
bnormalDistributeVO
.
StatusByDate
>
res
=
new
ArrayList
<>();
for
(
SceneEvaluate
a
bnormalDistributeVO
.
FinalTimeDistribution
ftd
:
finalTimeDistributionList
)
{
for
(
SceneEvaluate
A
bnormalDistributeVO
.
FinalTimeDistribution
ftd
:
finalTimeDistributionList
)
{
Date
problemDate
=
ftd
.
getProblemDate
();
Date
distributionTime
=
ftd
.
getDistributionTime
();
String
format
=
HOUR_SDF
.
format
(
distributionTime
);
if
(
Objects
.
equals
(
timeStr
,
format
))
{
SceneEvaluate
a
bnormalDistributeVO
.
StatusByDate
inRes
=
getRecordInRes
(
res
,
problemDate
);
SceneEvaluate
A
bnormalDistributeVO
.
StatusByDate
inRes
=
getRecordInRes
(
res
,
problemDate
);
// 如果 res 中没有记录
if
(
ObjectUtil
.
isEmpty
(
inRes
))
{
SceneEvaluate
a
bnormalDistributeVO
.
StatusByDate
statusByDate
=
buildStatusByDate
(
ftd
,
problemDate
);
SceneEvaluate
A
bnormalDistributeVO
.
StatusByDate
statusByDate
=
buildStatusByDate
(
ftd
,
problemDate
);
res
.
add
(
statusByDate
);
}
else
{
modifyRecordInRes
(
ftd
,
inRes
);
...
...
@@ -151,8 +257,8 @@ public class SceneEvaluateServiceImpl implements SceneEvaluateService {
}
private
void
modifyRecordInRes
(
SceneEvaluate
a
bnormalDistributeVO
.
FinalTimeDistribution
ftd
,
SceneEvaluate
a
bnormalDistributeVO
.
StatusByDate
inRes
)
{
SceneEvaluate
A
bnormalDistributeVO
.
FinalTimeDistribution
ftd
,
SceneEvaluate
A
bnormalDistributeVO
.
StatusByDate
inRes
)
{
Integer
status
=
ftd
.
getStatus
();
if
(
Objects
.
equals
(
status
,
CrossStatusEnum
.
UNBALANCE
.
getCode
()))
{
inRes
.
setIsUnbalance
(
1
);
...
...
@@ -164,18 +270,18 @@ public class SceneEvaluateServiceImpl implements SceneEvaluateService {
}
@NotNull
private
SceneEvaluate
a
bnormalDistributeVO
.
StatusByDate
buildStatusByDate
(
SceneEvaluate
a
bnormalDistributeVO
.
FinalTimeDistribution
ftd
,
Date
problemDate
)
{
SceneEvaluate
a
bnormalDistributeVO
.
StatusByDate
statusByDate
=
new
SceneEvaluate
a
bnormalDistributeVO
.
StatusByDate
();
private
SceneEvaluate
A
bnormalDistributeVO
.
StatusByDate
buildStatusByDate
(
SceneEvaluate
A
bnormalDistributeVO
.
FinalTimeDistribution
ftd
,
Date
problemDate
)
{
SceneEvaluate
A
bnormalDistributeVO
.
StatusByDate
statusByDate
=
new
SceneEvaluate
A
bnormalDistributeVO
.
StatusByDate
();
statusByDate
.
setProblemDate
(
problemDate
);
modifyRecordInRes
(
ftd
,
statusByDate
);
return
statusByDate
;
}
private
SceneEvaluate
a
bnormalDistributeVO
.
StatusByDate
getRecordInRes
(
List
<
SceneEvaluate
a
bnormalDistributeVO
.
StatusByDate
>
res
,
Date
problemDate
)
{
for
(
SceneEvaluate
a
bnormalDistributeVO
.
StatusByDate
statusByDate
:
res
)
{
private
SceneEvaluate
A
bnormalDistributeVO
.
StatusByDate
getRecordInRes
(
List
<
SceneEvaluate
A
bnormalDistributeVO
.
StatusByDate
>
res
,
Date
problemDate
)
{
for
(
SceneEvaluate
A
bnormalDistributeVO
.
StatusByDate
statusByDate
:
res
)
{
Date
problemDateInRes
=
statusByDate
.
getProblemDate
();
// 创建Calendar实例
Calendar
cal1
=
Calendar
.
getInstance
();
...
...
@@ -262,15 +368,15 @@ public class SceneEvaluateServiceImpl implements SceneEvaluateService {
return
calendar
.
getTime
();
}
private
static
void
setCounts
(
List
<
SceneEvaluate
a
bnormalDistributeVO
.
TimeDistribution
>
timeDistributionList
,
SceneEvaluate
a
bnormalDistributeVO
vo
)
{
private
static
void
setCounts
(
List
<
SceneEvaluate
A
bnormalDistributeVO
.
TimeDistribution
>
timeDistributionList
,
SceneEvaluate
A
bnormalDistributeVO
vo
)
{
int
congestionDuration
=
0
;
int
congestionTimes
=
0
;
int
unbalanceDuration
=
0
;
int
unbalanceTimes
=
0
;
int
spilloverDuration
=
0
;
int
spilloverTimes
=
0
;
for
(
SceneEvaluate
a
bnormalDistributeVO
.
TimeDistribution
timeDistribution
:
timeDistributionList
)
{
for
(
SceneEvaluate
A
bnormalDistributeVO
.
TimeDistribution
timeDistribution
:
timeDistributionList
)
{
List
<
RunningEvaluateMetricsDetailVO
.
ProblemStatus
>
problemStatusList
=
timeDistribution
.
getProblemStatusList
();
for
(
RunningEvaluateMetricsDetailVO
.
ProblemStatus
problemStatus
:
problemStatusList
)
{
...
...
@@ -296,9 +402,9 @@ public class SceneEvaluateServiceImpl implements SceneEvaluateService {
vo
.
setSpilloverDuration
(
spilloverDuration
);
}
private
List
<
SceneEvaluate
a
bnormalDistributeVO
.
TimeDistribution
>
buildTimeDistributionList
(
private
List
<
SceneEvaluate
A
bnormalDistributeVO
.
TimeDistribution
>
buildTimeDistributionList
(
String
crossId
,
Date
startDate
,
Date
endDate
)
{
List
<
SceneEvaluate
a
bnormalDistributeVO
.
TimeDistribution
>
res
=
new
ArrayList
<>();
List
<
SceneEvaluate
A
bnormalDistributeVO
.
TimeDistribution
>
res
=
new
ArrayList
<>();
Calendar
start
=
Calendar
.
getInstance
();
Calendar
end
=
Calendar
.
getInstance
();
start
.
setTime
(
startDate
);
...
...
@@ -307,8 +413,8 @@ public class SceneEvaluateServiceImpl implements SceneEvaluateService {
end
.
add
(
Calendar
.
DATE
,
1
);
for
(
Date
date
=
start
.
getTime
();
start
.
before
(
end
);
start
.
add
(
Calendar
.
DATE
,
1
),
date
=
start
.
getTime
())
{
SceneEvaluate
a
bnormalDistributeVO
.
TimeDistribution
timeDistribution
=
new
SceneEvaluate
a
bnormalDistributeVO
.
TimeDistribution
();
SceneEvaluate
A
bnormalDistributeVO
.
TimeDistribution
timeDistribution
=
new
SceneEvaluate
A
bnormalDistributeVO
.
TimeDistribution
();
timeDistribution
.
setProblemDate
(
date
);
// 获取问题列表
// 路口级别全量数据
...
...
signal-optimize-service/src/main/java/net/wanji/opt/vo/SceneEvaluateAbnormalDetailVO.java
0 → 100644
View file @
952a14b3
package
net
.
wanji
.
opt
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author Kent HAN
* @date 2023/2/9 8:38
*/
@Data
@NoArgsConstructor
@ApiModel
(
value
=
"SceneEvaluateAbnormalDetailVO"
,
description
=
"异常事件详情"
)
public
class
SceneEvaluateAbnormalDetailVO
{
}
signal-optimize-service/src/main/java/net/wanji/opt/vo/SceneEvaluate
a
bnormalDistributeVO.java
→
signal-optimize-service/src/main/java/net/wanji/opt/vo/SceneEvaluate
A
bnormalDistributeVO.java
View file @
952a14b3
...
...
@@ -15,8 +15,8 @@ import java.util.List;
*/
@Data
@NoArgsConstructor
@ApiModel
(
value
=
"SceneEvaluate
a
bnormalDistributeVO"
,
description
=
"异常事件时空分布"
)
public
class
SceneEvaluate
a
bnormalDistributeVO
{
@ApiModel
(
value
=
"SceneEvaluate
A
bnormalDistributeVO"
,
description
=
"异常事件时空分布"
)
public
class
SceneEvaluate
A
bnormalDistributeVO
{
@ApiModelProperty
(
value
=
"拥堵次数"
)
Integer
congestionTimes
;
@ApiModelProperty
(
value
=
"失衡次数"
)
...
...
wj-databus/src/main/java/net/wanji/databus/dao/mapper/CrossDataHistMapper.java
View file @
952a14b3
...
...
@@ -27,5 +27,5 @@ public interface CrossDataHistMapper extends BaseMapper<CrossDataHistPO> {
Double
selectMaxSaturation
(
String
crossId
,
int
startStamp
,
int
endStamp
);
Integer
selectCrossEmergencyCount
(
String
crossId
,
int
start
TimeStamp
,
int
endTime
Stamp
);
Integer
selectCrossEmergencyCount
(
String
crossId
,
int
start
Stamp
,
int
end
Stamp
);
}
wj-databus/src/main/java/net/wanji/databus/po/CrossTurnDataRealtimePO.java
View file @
952a14b3
...
...
@@ -89,10 +89,6 @@ public class CrossTurnDataRealtimePO {
@ApiModelProperty
(
name
=
"修改时间"
,
notes
=
""
)
public
Date
gmtModified
;
@ApiModelProperty
(
value
=
"绿灯间隔清空率"
,
notes
=
""
)
public
Double
clearRate
;
@ApiModelProperty
(
value
=
"负载均衡度"
,
notes
=
""
)
public
Double
loadBalance
;
@ApiModelProperty
(
value
=
"绿灯有效利用率"
,
notes
=
""
)
public
Double
greenLightEfficiency
;
@ApiModelProperty
(
name
=
"溢流率:交叉口间路段车辆排队长度超出可容纳空间的时长与观测总时长的百分比"
,
notes
=
""
)
...
...
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