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
jinan
traffic-signal-platform
Commits
207cc171
Commit
207cc171
authored
Mar 28, 2025
by
wang yecheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方案评价追加trycatch
parent
525a80a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
265 additions
and
238 deletions
+265
-238
EvaluationInfoServiceImpl.java
.../servicev2/evaluation/impl/EvaluationInfoServiceImpl.java
+265
-238
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/evaluation/impl/EvaluationInfoServiceImpl.java
View file @
207cc171
...
...
@@ -3,6 +3,7 @@ package net.wanji.opt.servicev2.evaluation.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.nacos.common.utils.CollectionUtils
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.databus.dao.mapper.CrossDataHistMapper
;
import
net.wanji.databus.po.CrossDataHistPO
;
import
net.wanji.opt.constant.ServiceLevelEnum
;
...
...
@@ -19,6 +20,7 @@ import java.util.stream.Collectors;
import
java.util.stream.Stream
;
@Service
@Slf4j
public
class
EvaluationInfoServiceImpl
extends
ServiceImpl
<
CrossDataHistMapper
,
CrossDataHistPO
>
implements
EvaluationInfoService
{
@Autowired
...
...
@@ -28,71 +30,81 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
@Override
public
Map
<
String
,
Object
>
getListEvaluationSummarize
(
String
crossId
,
String
startTime
,
String
endTime
,
String
contrastStartTime
,
String
constrastEndTime
)
{
//分析时间的数据
List
<
CrossDataHistPO
>
analyseList
=
crossDataHistMapper
.
getListEvaluationanalyse
(
crossId
,
startTime
,
endTime
);
//比较时间的数据
List
<
CrossDataHistPO
>
contrastList
=
crossDataHistMapper
.
getListEvaluationcontrast
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//分析时间服务水平
List
<
CrossDataHistPO
>
ServiceLevelanalyseList
=
crossDataHistMapper
.
getEvaluationanalyseServiceLevel
(
crossId
,
startTime
,
endTime
);
//比较时间的服务水平
List
<
CrossDataHistPO
>
contrastServiceLevelList
=
crossDataHistMapper
.
getServiceLevelEvaluationcontrast
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//取出分析时间 的速度 延误 排队长度
Double
speed
=
0.00
;
Integer
delayTime
=
0
;
Double
queueLength
=
0.00
;
//分析的交通流量
int
analyseFlow
=
0
;
for
(
CrossDataHistPO
analyselist:
analyseList
){
if
(
analyselist
==
null
)
{
continue
;
// 跳过空元素
}
try
{
//分析时间的数据
List
<
CrossDataHistPO
>
analyseList
=
crossDataHistMapper
.
getListEvaluationanalyse
(
crossId
,
startTime
,
endTime
);
//比较时间的数据
List
<
CrossDataHistPO
>
contrastList
=
crossDataHistMapper
.
getListEvaluationcontrast
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//分析时间服务水平
// List<CrossDataHistPO> ServiceLevelanalyseList = crossDataHistMapper.getEvaluationanalyseServiceLevel(crossId, startTime, endTime);
//比较时间的服务水平
// List<CrossDataHistPO> contrastServiceLevelList = crossDataHistMapper.getServiceLevelEvaluationcontrast(crossId, contrastStartTime, constrastEndTime);
//取出分析时间 的速度 延误 排队长度
Double
speed
=
0.00
;
Integer
delayTime
=
0
;
Double
queueLength
=
0.00
;
//分析的交通流量
int
analyseFlow
=
0
;
for
(
CrossDataHistPO
analyselist
:
analyseList
)
{
if
(
analyselist
==
null
)
{
continue
;
// 跳过空元素
}
speed
=
analyselist
.
getSpeed
();
delayTime
=
analyselist
.
getDelayTime
();
queueLength
=
analyselist
.
getQueueLength
();
analyseFlow
=
analyselist
.
getFlow
();
}
//取出对比时间 的速度 延误 排队长度
Double
speedCompare
=
0.00
;
Integer
delayTimeCompare
=
0
;
Double
queueLengthCompare
=
0.00
;
//对比的交通流量
int
contrastFlow
=
0
;
for
(
CrossDataHistPO
contrastlist:
contrastList
){
if
(
contrastlist
==
null
)
{
continue
;
// 跳过空元素
}
speedCompare
=
contrastlist
.
getSpeed
();
delayTimeCompare
=
contrastlist
.
getDelayTime
();
queueLengthCompare
=
contrastlist
.
getQueueLength
();
contrastFlow
=
contrastlist
.
getFlow
();
}
// 计算速度变化百分比
double
speedChangePercent
=
calculatePercentage
(
speed
,
speedCompare
);
// 计算延误变化百分比
double
delayTimeChangePercent
=
calculatePercentage
(
delayTime
,
delayTimeCompare
);
// 计算排队长度变化百分比
double
queueLengthChangePercent
=
calculatePercentage
(
queueLength
,
queueLengthCompare
);
// 计算交通流量百分比
double
flow
=
calculatePercentage
(
analyseFlow
,
contrastFlow
);
//取出分析时间的服务水平
String
analyseserviceLevel
=
getServiceLevel
(
ServiceLevelanalyseList
);
//取出对比时间的服务水平
String
compareServiceLevel
=
getServiceLevel
(
contrastServiceLevelList
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"speed"
,
speedChangePercent
+
"%"
);
jsonObject
.
put
(
"delay"
,
delayTimeChangePercent
+
"%"
);
jsonObject
.
put
(
"queueLength"
,
queueLengthChangePercent
+
"%"
);
jsonObject
.
put
(
"flow"
,
flow
+
"%"
);
jsonObject
.
put
(
"analyseserviceLevel"
,
analyseserviceLevel
);
jsonObject
.
put
(
"compareServiceLevel"
,
compareServiceLevel
);
return
jsonObject
;
analyseFlow
=
analyselist
.
getFlow
();
}
//取出对比时间 的速度 延误 排队长度
Double
speedCompare
=
0.00
;
Integer
delayTimeCompare
=
0
;
Double
queueLengthCompare
=
0.00
;
//对比的交通流量
int
contrastFlow
=
0
;
for
(
CrossDataHistPO
contrastlist
:
contrastList
)
{
if
(
contrastlist
==
null
)
{
continue
;
// 跳过空元素
}
speedCompare
=
contrastlist
.
getSpeed
();
delayTimeCompare
=
contrastlist
.
getDelayTime
();
queueLengthCompare
=
contrastlist
.
getQueueLength
();
contrastFlow
=
contrastlist
.
getFlow
();
}
// 计算速度变化百分比
double
speedChangePercent
=
calculatePercentage
(
speed
,
speedCompare
);
// 计算延误变化百分比
double
delayTimeChangePercent
=
calculatePercentage
(
delayTime
,
delayTimeCompare
);
// 计算排队长度变化百分比
double
queueLengthChangePercent
=
calculatePercentage
(
queueLength
,
queueLengthCompare
);
// 计算交通流量百分比
double
flow
=
calculatePercentage
(
analyseFlow
,
contrastFlow
);
//取出分析时间的服务水平
// String analyseserviceLevel = getServiceLevel(ServiceLevelanalyseList);
//取出对比时间的服务水平
// String compareServiceLevel = getServiceLevel(contrastServiceLevelList);
JSONObject
jsonObject
=
new
JSONObject
();
//平均速度
jsonObject
.
put
(
"speed"
,
speedChangePercent
+
"%"
);
//平均延误
jsonObject
.
put
(
"delay"
,
delayTimeChangePercent
+
"%"
);
//平均排队时长
jsonObject
.
put
(
"queueLength"
,
queueLengthChangePercent
+
"%"
);
// 计算交通流量百分比
jsonObject
.
put
(
"flow"
,
flow
+
"%"
);
// jsonObject.put("analyseserviceLevel", analyseserviceLevel);
// jsonObject.put("compareServiceLevel", compareServiceLevel);
return
jsonObject
;
}
catch
(
Exception
e
){
log
.
error
(
"{} getListEvaluationSummarize error"
,
this
.
getClass
().
getSimpleName
(),
e
);
throw
e
;
}
}
/**
* 计算变化百分比
...
...
@@ -134,79 +146,85 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
@Override
public
Map
<
String
,
Object
>
summaryEvaluation
(
String
crossId
,
String
startTime
,
String
endTime
,
String
contrastStartTime
,
String
constrastEndTime
)
{
try
{
//分析时间
List
<
TEventOptimizeInfo
>
overFlowList
=
crossProblemEvaluationMapper
.
getOverflow
(
crossId
,
startTime
,
endTime
);
//对比时间
List
<
TEventOptimizeInfo
>
contrastoverFlowList
=
crossProblemEvaluationMapper
.
getContrastOverflow
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//分析溢出次数
long
overFlowcount
=
overFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())).
count
();
//对比溢出次数
long
ontrastoverFlowcount
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())).
count
();
//分析时间
List
<
TEventOptimizeInfo
>
overFlowList
=
crossProblemEvaluationMapper
.
getOverflow
(
crossId
,
startTime
,
endTime
);
//分析溢出优化次数
long
overFlowTime
=
overFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//对比时间
List
<
TEventOptimizeInfo
>
contrastoverFlowList
=
crossProblemEvaluationMapper
.
getContrastOverflow
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//分析溢出次数
long
overFlowcount
=
overFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())).
count
();
//对比溢出优化
次数
long
contrastoverFlowTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//对比溢出
次数
long
ontrastoverFlowcount
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())).
count
();
//分析溢出时长
int
fenxioverflowTime
=
overFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
();
//分析溢出优化次数
long
overFlowTime
=
overFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//对比溢出时长
int
duibioverflowTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
();
//计算溢出次数百分比
double
overFlowCishujisuan
=
calculatePercentage
(
overFlowcount
,
ontrastoverFlowcount
);
//对比溢出优化次数
long
contrastoverFlowTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//计算溢时长百分比
double
overFlowtimejisuan
=
calculatePercentage
(
fenxioverflowTime
,
duibioverflowTime
);
//分析溢出时长
int
fenxioverflowTime
=
overFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
(
);
//对比溢出时长
int
duibioverflowTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
();
//计算溢出次数百分比
double
overFlowCishujisuan
=
calculatePercentage
(
overFlowcount
,
ontrastoverFlowcount
);
//分析时间的数据t_cross_data_hist
List
<
CrossDataHistPO
>
analyseList
=
crossDataHistMapper
.
getListEvaluationanalyse
(
crossId
,
startTime
,
end
Time
);
//计算溢时长百分比
double
overFlowtimejisuan
=
calculatePercentage
(
fenxioverflowTime
,
duibioverflow
Time
);
//比较时间的数据t_cross_data_hist
List
<
CrossDataHistPO
>
contrastList
=
crossDataHistMapper
.
getListEvaluationcontrast
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//溢出分析的延时时间
Integer
overFlowdelayTime
=
0
;
for
(
CrossDataHistPO
analyselist
:
analyseList
)
{
if
(
analyselist
==
null
)
{
continue
;
// 跳过空元素
}
overFlowdelayTime
=
analyselist
.
getDelayTime
();
}
//溢出对比的延时时间
Integer
conTrastoverFlowdelayTime
=
0
;
for
(
CrossDataHistPO
contrastlist
:
contrastList
)
{
if
(
contrastlist
==
null
)
{
continue
;
// 跳过空元素
}
conTrastoverFlowdelayTime
=
contrastlist
.
getDelayTime
();
}
//溢出的平均延误时间计算
double
overFlowDelayjisuan
=
calculatePercentage
(
overFlowdelayTime
,
conTrastoverFlowdelayTime
);
//分析时间的数据t_cross_data_hist
List
<
CrossDataHistPO
>
analyseList
=
crossDataHistMapper
.
getListEvaluationanalyse
(
crossId
,
startTime
,
endTime
);
JSONObject
jsonObject
=
new
JSONObject
();
//溢出次数
jsonObject
.
put
(
"analyOverFlowTime"
,
overFlowcount
);
//溢出优化次数
jsonObject
.
put
(
"analyOverFlowOptimize"
,
overFlowTime
);
//对比溢出次数
jsonObject
.
put
(
"contrastOverFlowTime"
,
ontrastoverFlowcount
);
//对比的溢出优化次数
jsonObject
.
put
(
"contrastOverFlowOptimize"
,
contrastoverFlowTime
);
//溢出次数分析对比计算
jsonObject
.
put
(
"OverFlowTimeCalculate"
,
overFlowCishujisuan
+
"%"
);
//溢出时长分析对比计算
jsonObject
.
put
(
"OverFlowHourCalculate"
,
overFlowtimejisuan
+
"%"
);
//溢出平均延误
jsonObject
.
put
(
"OverFlowavgdelay"
,
overFlowDelayjisuan
+
"%"
);
//比较时间的数据t_cross_data_hist
List
<
CrossDataHistPO
>
contrastList
=
crossDataHistMapper
.
getListEvaluationcontrast
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//溢出分析的延时时间
Integer
overFlowdelayTime
=
0
;
for
(
CrossDataHistPO
analyselist
:
analyseList
)
{
if
(
analyselist
==
null
)
{
continue
;
// 跳过空元素
}
overFlowdelayTime
=
analyselist
.
getDelayTime
();
}
return
jsonObject
;
}
//溢出对比的延时时间
Integer
conTrastoverFlowdelayTime
=
0
;
for
(
CrossDataHistPO
contrastlist
:
contrastList
)
{
if
(
contrastlist
==
null
)
{
continue
;
// 跳过空元素
}
conTrastoverFlowdelayTime
=
contrastlist
.
getDelayTime
();
}
//溢出的平均延误时间计算
double
overFlowDelayjisuan
=
calculatePercentage
(
overFlowdelayTime
,
conTrastoverFlowdelayTime
);
JSONObject
jsonObject
=
new
JSONObject
();
//溢出次数
jsonObject
.
put
(
"analyOverFlowTime"
,
overFlowcount
);
//溢出优化次数
jsonObject
.
put
(
"analyOverFlowOptimize"
,
overFlowTime
);
//对比溢出次数
jsonObject
.
put
(
"contrastOverFlowTime"
,
ontrastoverFlowcount
);
//对比的溢出优化次数
jsonObject
.
put
(
"contrastOverFlowOptimize"
,
contrastoverFlowTime
);
//溢出次数分析对比计算
jsonObject
.
put
(
"OverFlowTimeCalculate"
,
overFlowCishujisuan
+
"%"
);
//溢出时长分析对比计算
jsonObject
.
put
(
"OverFlowHourCalculate"
,
overFlowtimejisuan
+
"%"
);
//溢出平均延误
jsonObject
.
put
(
"OverFlowavgdelay"
,
overFlowDelayjisuan
+
"%"
);
return
jsonObject
;
}
catch
(
Exception
e
){
log
.
error
(
"{} summaryEvaluation error"
,
this
.
getClass
().
getSimpleName
(),
e
);
throw
e
;
}
}
/*失衡702
...
...
@@ -214,78 +232,83 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
* */
@Override
public
Map
<
String
,
Object
>
unbalanceEvaluation
(
String
crossId
,
String
startTime
,
String
endTime
,
String
contrastStartTime
,
String
constrastEndTime
)
{
try
{
//分析时间
List
<
TEventOptimizeInfo
>
overFlowList
=
crossProblemEvaluationMapper
.
getOverflow
(
crossId
,
startTime
,
endTime
);
//分析时间
List
<
TEventOptimizeInfo
>
overFlowList
=
crossProblemEvaluationMapper
.
getOverflow
(
crossId
,
startTime
,
endTime
);
//对比时间
List
<
TEventOptimizeInfo
>
contrastoverFlowList
=
crossProblemEvaluationMapper
.
getContrastOverflow
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//分析失衡次数
long
unbalancecount
=
overFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())).
count
();
//对比时间
List
<
TEventOptimizeInfo
>
contrastoverFlowList
=
crossProblemEvaluationMapper
.
getContrastOverflow
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//分析失衡次数
long
unbalancecount
=
overFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())).
count
();
//对比失衡次数
long
contrastunbalancecount
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())).
count
();
//对比失衡次数
long
contrastunbalancecount
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())).
count
();
//分析失衡优化次数
long
unbalanceTime
=
overFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//分析失衡优化次数
long
unbalanceTime
=
overFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//对比失衡优化次数
long
contrastunbalanceTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//对比失衡优化次数
long
contrastunbalanceTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//分析失衡时长
int
fenxiunbalanceTime
=
overFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
();
//分析失衡时长
int
fenxiunbalanceTime
=
overFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
();
//对比失衡时长
int
duibiunbalanceTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
();
//计算失衡次数百分比
double
unbalanceCishujisuan
=
calculatePercentage
(
unbalancecount
,
contrastunbalancecount
);
//对比失衡时长
int
duibiunbalanceTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"702"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
();
//计算失衡次数百分比
double
unbalanceCishujisuan
=
calculatePercentage
(
unbalancecount
,
contrastunbalancecount
);
//计算失衡时长百分比
double
unbalancetimejisuan
=
calculatePercentage
(
fenxiunbalanceTime
,
duibiunbalanceTime
);
//计算失衡时长百分比
double
unbalancetimejisuan
=
calculatePercentage
(
fenxiunbalanceTime
,
duibiunbalanceTime
);
//分析时间路口平均停车次数t_cross_data_hist
List
<
CrossDataHistPO
>
analyseList
=
crossDataHistMapper
.
getListEvaluationanalyse
(
crossId
,
startTime
,
endTime
);
//分析时间路口平均停车次数t_cross_data_hist
List
<
CrossDataHistPO
>
analyseList
=
crossDataHistMapper
.
getListEvaluationanalyse
(
crossId
,
startTime
,
endTime
);
//比较时间的数据路口平均停车次数t_cross_data_hist
List
<
CrossDataHistPO
>
contrastList
=
crossDataHistMapper
.
getListEvaluationcontrast
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//失衡分析时间的stop_times路口平均停车次数
Double
unbalanceStopTimes
=
0.0
;
for
(
CrossDataHistPO
analyselist
:
analyseList
)
{
if
(
analyselist
==
null
)
{
continue
;
// 跳过空元素
//比较时间的数据路口平均停车次数t_cross_data_hist
List
<
CrossDataHistPO
>
contrastList
=
crossDataHistMapper
.
getListEvaluationcontrast
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//失衡分析时间的stop_times路口平均停车次数
Double
unbalanceStopTimes
=
0.0
;
for
(
CrossDataHistPO
analyselist
:
analyseList
)
{
if
(
analyselist
==
null
)
{
continue
;
// 跳过空元素
}
unbalanceStopTimes
=
analyselist
.
getStopTimes
();
}
unbalanceStopTimes
=
analyselist
.
getStopTimes
();
}
//失衡对比的时间stop_times路口平均停车次数
Double
conTrastUnbalanceStopTimes
=
0.0
;
for
(
CrossDataHistPO
contrastlist
:
contrastList
)
{
if
(
contrastlist
==
null
)
{
continue
;
// 跳过空元素
//失衡对比的时间stop_times路口平均停车次数
Double
conTrastUnbalanceStopTimes
=
0.0
;
for
(
CrossDataHistPO
contrastlist
:
contrastList
)
{
if
(
contrastlist
==
null
)
{
continue
;
// 跳过空元素
}
conTrastUnbalanceStopTimes
=
contrastlist
.
getStopTimes
();
}
conTrastUnbalanceStopTimes
=
contrastlist
.
getStopTimes
();
//失衡的平均停车次数计算
double
unbalanceStopTimesjisuan
=
calculatePercentage
(
unbalanceStopTimes
,
conTrastUnbalanceStopTimes
);
JSONObject
jsonObject
=
new
JSONObject
();
//分析失衡次数
jsonObject
.
put
(
"unbalancecount"
,
unbalancecount
);
//分析失衡优化次数
jsonObject
.
put
(
"unbalanceTime"
,
unbalanceTime
);
//对比失衡次数
jsonObject
.
put
(
"ontrastunbalancecount"
,
contrastunbalancecount
);
//对比的失衡的优化次数
jsonObject
.
put
(
"contrastunbalanceTime"
,
contrastunbalanceTime
);
//失衡次数分析对比计算
jsonObject
.
put
(
"unbalanceCishucalculate"
,
unbalanceCishujisuan
+
"%"
);
//失衡时长分析对比计算
jsonObject
.
put
(
"unbalancetimecalculate"
,
unbalancetimejisuan
+
"%"
);
//失衡平均停车次数
jsonObject
.
put
(
"unbalanceStopTimescalculate"
,
unbalanceStopTimesjisuan
+
"%"
);
return
jsonObject
;
}
catch
(
Exception
e
){
log
.
error
(
"{} unbalanceEvaluation error"
,
this
.
getClass
().
getSimpleName
(),
e
);
throw
e
;
}
//失衡的平均停车次数计算
double
unbalanceStopTimesjisuan
=
calculatePercentage
(
unbalanceStopTimes
,
conTrastUnbalanceStopTimes
);
JSONObject
jsonObject
=
new
JSONObject
();
//分析失衡次数
jsonObject
.
put
(
"unbalancecount"
,
unbalancecount
);
//分析失衡优化次数
jsonObject
.
put
(
"unbalanceTime"
,
unbalanceTime
);
//对比失衡次数
jsonObject
.
put
(
"ontrastunbalancecount"
,
contrastunbalancecount
);
//对比的失衡的优化次数
jsonObject
.
put
(
"contrastunbalanceTime"
,
contrastunbalanceTime
);
//失衡次数分析对比计算
jsonObject
.
put
(
"unbalanceCishucalculate"
,
unbalanceCishujisuan
+
"%"
);
//失衡时长分析对比计算
jsonObject
.
put
(
"unbalancetimecalculate"
,
unbalancetimejisuan
+
"%"
);
//失衡平均停车次数
jsonObject
.
put
(
"unbalanceStopTimescalculate"
,
unbalanceStopTimesjisuan
+
"%"
);
return
jsonObject
;
}
/*
...
...
@@ -294,80 +317,84 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
@Override
public
Map
<
String
,
Object
>
idleEvaluation
(
String
crossId
,
String
startTime
,
String
endTime
,
String
contrastStartTime
,
String
constrastEndTime
)
{
//分析时间
List
<
TEventOptimizeInfo
>
overFlowList
=
crossProblemEvaluationMapper
.
getOverflow
(
crossId
,
startTime
,
endTime
);
try
{
//对比
时间
List
<
TEventOptimizeInfo
>
contrastoverFlowList
=
crossProblemEvaluationMapper
.
getContrastOverflow
(
crossId
,
contrastStartTime
,
constrastE
ndTime
);
//分析
时间
List
<
TEventOptimizeInfo
>
overFlowList
=
crossProblemEvaluationMapper
.
getOverflow
(
crossId
,
startTime
,
e
ndTime
);
//分析时间空放次数
long
dileCount
=
overFlowList
.
stream
().
filter
(
evet
->
"701"
.
equals
(
evet
.
getEventType
())).
count
(
);
//对比时间
List
<
TEventOptimizeInfo
>
contrastoverFlowList
=
crossProblemEvaluationMapper
.
getContrastOverflow
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//对比
时间空放次数
long
contrastDileCount
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"701"
.
equals
(
even
t
.
getEventType
())).
count
();
//分析
时间空放次数
long
dileCount
=
overFlowList
.
stream
().
filter
(
evet
->
"701"
.
equals
(
eve
t
.
getEventType
())).
count
();
//分析时间空放优化
次数
long
dileTime
=
overFlowList
.
stream
().
filter
(
event
->
"701"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//对比时间空放
次数
long
contrastDileCount
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"701"
.
equals
(
event
.
getEventType
())).
count
();
//对比时间空放优化次数
//分析时间空放优化次数
long
dileTime
=
overFlowList
.
stream
().
filter
(
event
->
"701"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
long
contrastDileTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"701"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//对比时间空放优化次数
long
contrastDileTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"701"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//分析空放时长
int
fenxiDileTime
=
overFlowList
.
stream
().
filter
(
event
->
"701"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
();
//分析空放时长
int
fenxiDileTime
=
overFlowList
.
stream
().
filter
(
event
->
"701"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
();
//对比空放时长
int
duibiDileTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"701"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
();
//计算空放次数百分比
double
dileCishujisuan
=
calculatePercentage
(
dileCount
,
contrastDileCount
);
//对比空放时长
int
duibiDileTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"701"
.
equals
(
event
.
getEventType
())).
mapToInt
(
TEventOptimizeInfo:
:
getDuration
).
sum
();
//计算空放次数百分比
double
dileCishujisuan
=
calculatePercentage
(
dileCount
,
contrastDileCount
);
//计算空放时长百分比
double
dileTimejisuan
=
calculatePercentage
(
fenxiDileTime
,
duibiDileTime
);
//计算空放时长百分比
double
dileTimejisuan
=
calculatePercentage
(
fenxiDileTime
,
duibiDileTime
);
//分析时间路口平均速度t_cross_data_hist
List
<
CrossDataHistPO
>
analyseList
=
crossDataHistMapper
.
getListEvaluationanalyse
(
crossId
,
startTime
,
endTime
);
//分析时间路口平均速度t_cross_data_hist
List
<
CrossDataHistPO
>
analyseList
=
crossDataHistMapper
.
getListEvaluationanalyse
(
crossId
,
startTime
,
endTime
);
//比较时间的数据路口平均速度t_cross_data_hist
List
<
CrossDataHistPO
>
contrastList
=
crossDataHistMapper
.
getListEvaluationcontrast
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//空放分析时间的Speed路口平均速度
Double
dileSpeed
=
0.0
;
for
(
CrossDataHistPO
analyselist
:
analyseList
)
{
if
(
analyselist
==
null
)
{
continue
;
// 跳过空元素
//比较时间的数据路口平均速度t_cross_data_hist
List
<
CrossDataHistPO
>
contrastList
=
crossDataHistMapper
.
getListEvaluationcontrast
(
crossId
,
contrastStartTime
,
constrastEndTime
);
//空放分析时间的Speed路口平均速度
Double
dileSpeed
=
0.0
;
for
(
CrossDataHistPO
analyselist
:
analyseList
)
{
if
(
analyselist
==
null
)
{
continue
;
// 跳过空元素
}
dileSpeed
=
analyselist
.
getSpeed
();
}
dileSpeed
=
analyselist
.
getSpeed
();
}
//空放对比的时间平均速度
Double
conTrastDileSpeed
=
0.0
;
for
(
CrossDataHistPO
contrastlist
:
contrastList
)
{
if
(
contrastlist
==
null
)
{
continue
;
// 跳过空元素
//空放对比的时间平均速度
Double
conTrastDileSpeed
=
0.0
;
for
(
CrossDataHistPO
contrastlist
:
contrastList
)
{
if
(
contrastlist
==
null
)
{
continue
;
// 跳过空元素
}
conTrastDileSpeed
=
contrastlist
.
getSpeed
();
}
conTrastDileSpeed
=
contrastlist
.
getSpeed
();
}
//空放的平均速度
double
dileSpeedjisuan
=
calculatePercentage
(
dileSpeed
,
conTrastDileSpeed
);
JSONObject
jsonObject
=
new
JSONObject
();
//分析时间空放次数
jsonObject
.
put
(
"dileCount"
,
dileCount
);
//分析时间空放优化次数
jsonObject
.
put
(
"dileTime"
,
dileTime
);
//对比时间空放的次数
jsonObject
.
put
(
"contrastDileCount"
,
contrastDileCount
);
//对比的空放的优化次数
jsonObject
.
put
(
"contrastDileTime"
,
contrastDileTime
);
//空放次数分析对比计算
jsonObject
.
put
(
"dileCishucalculate"
,
dileCishujisuan
+
"%"
);
//空放时长分析对比计算
jsonObject
.
put
(
"dileTimecalculate"
,
dileTimejisuan
+
"%"
);
//空放评价速度对比计算
jsonObject
.
put
(
"dileSpeedcalculate"
,
dileSpeedjisuan
+
"%"
);
return
jsonObject
;
//空放的平均速度
double
dileSpeedjisuan
=
calculatePercentage
(
dileSpeed
,
conTrastDileSpeed
);
JSONObject
jsonObject
=
new
JSONObject
();
//分析时间空放次数
jsonObject
.
put
(
"dileCount"
,
dileCount
);
//分析时间空放优化次数
jsonObject
.
put
(
"dileTime"
,
dileTime
);
//对比时间空放的次数
jsonObject
.
put
(
"contrastDileCount"
,
contrastDileCount
);
//对比的空放的优化次数
jsonObject
.
put
(
"contrastDileTime"
,
contrastDileTime
);
//空放次数分析对比计算
jsonObject
.
put
(
"dileCishucalculate"
,
dileCishujisuan
+
"%"
);
//空放时长分析对比计算
jsonObject
.
put
(
"dileTimecalculate"
,
dileTimejisuan
+
"%"
);
//空放评价速度对比计算
jsonObject
.
put
(
"dileSpeedcalculate"
,
dileSpeedjisuan
+
"%"
);
return
jsonObject
;
}
catch
(
Exception
e
){
log
.
error
(
"{} idleEvaluation error"
,
this
.
getClass
().
getSimpleName
(),
e
);
throw
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