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
f56fcf7a
Commit
f56fcf7a
authored
Mar 27, 2025
by
wang yecheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方案评价溢出优化
parent
37ececdd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
143 additions
and
2 deletions
+143
-2
EvaluationInfoController.java
...opt/controllerv2/evaluation/EvaluationInfoController.java
+25
-1
CrossProblemEvaluationMapper.java
...t/dao/mapper/evaluation/CrossProblemEvaluationMapper.java
+4
-0
EvaluationInfoService.java
...wanji/opt/servicev2/evaluation/EvaluationInfoService.java
+2
-0
EvaluationInfoServiceImpl.java
.../servicev2/evaluation/impl/EvaluationInfoServiceImpl.java
+82
-1
CrossProblemEvaluationMapper.xml
...ources/mapper/evaluation/CrossProblemEvaluationMapper.xml
+30
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controllerv2/evaluation/EvaluationInfoController.java
View file @
f56fcf7a
...
...
@@ -38,7 +38,6 @@ public class EvaluationInfoController {
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
AreaProblemOverview
.
class
),
})
public
JsonViewObject
problemOverview
(
String
crossId
,
String
startTime
,
String
endTime
,
String
contrastStartTime
,
String
constrastEndTime
)
{
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
try
{
...
...
@@ -51,6 +50,31 @@ public class EvaluationInfoController {
return
jsonViewObject
;
}
@ApiOperation
(
value
=
"方案评价-溢出"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"crossId"
,
value
=
"路口ID"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"分析时段开始时间"
,
required
=
false
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"分析时段截止时间"
,
required
=
false
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"contrastStartTime"
,
value
=
"对比时段开始时间"
,
required
=
false
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"constrastEndTime"
,
value
=
"对比时段截止时间"
,
required
=
false
,
dataType
=
"string"
),
})
@GetMapping
(
value
=
"/overFlow"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
AreaProblemOverview
.
class
),
})
public
JsonViewObject
summaryEvaluation
(
String
crossId
,
String
startTime
,
String
endTime
,
String
contrastStartTime
,
String
constrastEndTime
)
{
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
try
{
Map
<
String
,
Object
>
resData
=
evaluationInfoService
.
summaryEvaluation
(
crossId
,
startTime
,
endTime
,
contrastStartTime
,
constrastEndTime
);
jsonViewObject
.
success
(
resData
);
}
catch
(
Exception
e
){
jsonViewObject
.
fail
(
I18nResourceBundle
.
getConstants
(
"GET_FAILED_MSG"
));
log
.
error
(
"{} getAll error"
,
this
.
getClass
().
getSimpleName
(),
e
);
}
return
jsonViewObject
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/dao/mapper/evaluation/CrossProblemEvaluationMapper.java
View file @
f56fcf7a
...
...
@@ -2,6 +2,7 @@ package net.wanji.opt.dao.mapper.evaluation;
import
net.wanji.common.framework.mapper.BaseInterfaceMapper
;
import
net.wanji.opt.entity.evaluation.EventInfo
;
import
net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo
;
import
net.wanji.opt.entity.judgeanalysis.AnalysisProblemAndStrategyDay
;
import
java.util.List
;
...
...
@@ -19,5 +20,8 @@ public interface CrossProblemEvaluationMapper {
public
List
<
AnalysisProblemAndStrategyDay
>
findOVerFlowInfo
();
List
<
TEventOptimizeInfo
>
getOverflow
(
String
crossId
,
String
startTime
,
String
endTime
);
List
<
TEventOptimizeInfo
>
getContrastOverflow
(
String
crossId
,
String
contrastStartTime
,
String
constrastEndTime
);
}
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/evaluation/EvaluationInfoService.java
View file @
f56fcf7a
...
...
@@ -8,4 +8,6 @@ import java.util.Map;
public
interface
EvaluationInfoService
extends
IService
<
CrossDataHistPO
>
{
Map
<
String
,
Object
>
getListEvaluationSummarize
(
String
crossId
,
String
startTime
,
String
endTime
,
String
contrastStartTime
,
String
constrastEndTime
);
Map
<
String
,
Object
>
summaryEvaluation
(
String
crossId
,
String
startTime
,
String
endTime
,
String
contrastStartTime
,
String
constrastEndTime
);
}
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/evaluation/impl/EvaluationInfoServiceImpl.java
View file @
f56fcf7a
...
...
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
net.wanji.databus.dao.mapper.CrossDataHistMapper
;
import
net.wanji.databus.po.CrossDataHistPO
;
import
net.wanji.opt.constant.ServiceLevelEnum
;
import
net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo
;
import
net.wanji.opt.entity.judgeanalysis.AnalysisProblemAndStrategyDay
;
import
net.wanji.opt.dao.mapper.evaluation.CrossProblemEvaluationMapper
;
import
net.wanji.opt.servicev2.evaluation.EvaluationInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -14,6 +16,7 @@ import org.springframework.stereotype.Service;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
@Service
public
class
EvaluationInfoServiceImpl
extends
ServiceImpl
<
CrossDataHistMapper
,
CrossDataHistPO
>
implements
EvaluationInfoService
{
...
...
@@ -100,7 +103,7 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
*/
private
static
double
calculatePercentage
(
double
analyseValue
,
double
contrastValue
)
{
// 防止除零错误
if
(
analyse
Value
==
0
)
{
if
(
contrast
Value
==
0
)
{
return
0
;
}
...
...
@@ -127,4 +130,82 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
return
serviceLevel
;
}
@Override
public
Map
<
String
,
Object
>
summaryEvaluation
(
String
crossId
,
String
startTime
,
String
endTime
,
String
contrastStartTime
,
String
constrastEndTime
)
{
//分析时间
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
();
//分析溢出优化次数
long
overFlowTime
=
overFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//对比溢出优化次数
long
contrastoverFlowTime
=
contrastoverFlowList
.
stream
().
filter
(
event
->
"703"
.
equals
(
event
.
getEventType
())
&&
"1"
.
equals
(
event
.
getOptStatus
())).
count
();
//分析溢出时长
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
);
//计算溢时长百分比
double
overFlowtimejisuan
=
calculatePercentage
(
fenxioverflowTime
,
duibioverflowTime
);
//分析时间的数据t_cross_data_hist
List
<
CrossDataHistPO
>
analyseList
=
crossDataHistMapper
.
getListEvaluationanalyse
(
crossId
,
startTime
,
endTime
);
//比较时间的数据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
);
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
;
}
}
signal-optimize-service/src/main/resources/mapper/evaluation/CrossProblemEvaluationMapper.xml
View file @
f56fcf7a
...
...
@@ -9,7 +9,37 @@
FROM t_event_optimize_info
WHERE 1=1
</select>
<select
id=
"getOverflow"
parameterType=
"net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo"
resultType=
"net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo"
>
SELECT
cross_id,duration,opt_status,
event_type,opt_duration
FROM
t_event_optimize_info
WHERE
1=1
<if
test=
"crossId!=null and crossId!=''"
>
AND cross_id=#{crossId}
</if>
<if
test=
"startTime!=null and startTime!='' and endTime!='' and endTime!=null"
>
AND happen_start_time>=#{startTime} and happen_start_time
<
=#{endTime}
</if>
</select>
<select
id=
"getContrastOverflow"
parameterType=
"net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo"
resultType=
"net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo"
>
SELECT
cross_id,duration,opt_status,
event_type,opt_duration
FROM
t_event_optimize_info
WHERE
1=1
<if
test=
"crossId!=null and crossId!=''"
>
AND cross_id=#{crossId}
</if>
<if
test=
"contrastStartTime!=null and contrastStartTime!='' and constrastEndTime!='' and constrastEndTime!=null"
>
AND happen_start_time>=#{contrastStartTime} and happen_start_time
<
=#{constrastEndTime}
</if>
</select>
</mapper>
\ 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