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
2d17e884
Commit
2d17e884
authored
Jan 22, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] AI路口优化
parent
0a24e219
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
33 deletions
+43
-33
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+22
-18
StrategyCrossResultMapper.xml
...e/src/main/resources/mapper/StrategyCrossResultMapper.xml
+21
-15
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
2d17e884
...
@@ -527,33 +527,37 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -527,33 +527,37 @@ public class StrategyControlServiceImpl implements StrategyControlService {
private
List
<
StrategyControlDataExt
>
getCrossList
(
Date
date
)
{
private
List
<
StrategyControlDataExt
>
getCrossList
(
Date
date
)
{
List
<
StrategyControlDataExt
>
results
=
new
ArrayList
<>();
List
<
StrategyControlDataExt
>
results
=
new
ArrayList
<>();
List
<
HoloEventInfoPO
>
holoEventInfoPOS
=
holoEventMapper
.
selectAIList
(
date
);
List
<
StrategyCrossResultEntity
>
resultList
=
strategyCrossResultMapper
.
selectAICrossList
(
null
);
if
(!
CollectionUtils
.
isEmpty
(
holoEventInfoPOS
))
{
if
(!
CollectionUtils
.
isEmpty
(
resultList
))
{
for
(
HoloEventInfoPO
holoEventInfoPO
:
holoEventInfoPOS
)
{
for
(
StrategyCrossResultEntity
entity
:
resultList
)
{
StrategyControlDataExt
ext
=
new
StrategyControlDataExt
();
StrategyControlDataExt
ext
=
new
StrategyControlDataExt
();
ext
.
setBizId
(
holoEventInfoPO
.
getCrossId
());
ext
.
setBizId
(
entity
.
getCrossId
());
ext
.
setCrossName
(
holoEventInfoPO
.
getRemark
());
ext
.
setCrossName
(
entity
.
getCrossName
());
String
location
=
holoEventInfoPO
.
getExtend
();
String
location
=
entity
.
getResponseContent
();
location
=
location
.
replace
(
"POINT("
,
""
).
replace
(
" "
,
","
).
replace
(
")"
,
""
);
location
=
location
.
replace
(
"POINT("
,
""
).
replace
(
" "
,
","
).
replace
(
")"
,
""
);
ext
.
setWkt
(
location
);
ext
.
setWkt
(
location
);
String
eventType
=
holoEventInfoPO
.
getType
();
Integer
currentAlgo
=
entity
.
getCurrentAlgo
();
Integer
alarmStatus
=
holoEventInfoPO
.
getAlarmStatus
();
Date
issueTime
=
entity
.
getIssueTime
();
String
optMethod
=
"效率提升"
;
Date
current
=
new
Date
()
;
ext
.
setStatus
(
alarmStatus
);
ext
.
setOptMethod
(
optMethod
);
// 优化时间大于5分钟,默认优化完
if
(
StringUtils
.
equals
(
eventType
,
"702"
)
)
{
if
(
Objects
.
nonNull
(
issueTime
)
&&
current
.
getTime
()
-
issueTime
.
getTime
()
>
5
*
60
*
1000
)
{
ext
.
setOptMethod
(
"均衡调控"
)
;
currentAlgo
=
null
;
}
}
if
(
StringUtils
.
isBlank
(
eventType
))
{
if
(
Objects
.
isNull
(
currentAlgo
))
{
ext
.
setOptStatus
(
"正常"
);
ext
.
setOptMethod
(
"畅通"
);
ext
.
setOptMethod
(
"畅通"
);
ext
.
setStatus
(-
1
);
}
else
if
(
Objects
.
equals
(
1
,
currentAlgo
))
{
ext
.
setOptStatus
(
"优化中"
);
ext
.
setOptMethod
(
"均衡调控"
);
}
else
{
ext
.
setOptStatus
(
"优化中"
);
ext
.
setOptMethod
(
"效率提升"
);
}
}
String
desc
=
EventStatusEnum
.
getDesc
(
alarmStatus
);
ext
.
setOptStatus
(
desc
);
results
.
add
(
ext
);
results
.
add
(
ext
);
}
}
}
}
results
.
sort
(
Comparator
.
comparing
(
StrategyControlDataExt:
:
getStatus
).
reversed
());
return
results
;
return
results
;
}
}
...
...
signal-optimize-service/src/main/resources/mapper/StrategyCrossResultMapper.xml
View file @
2d17e884
...
@@ -7,21 +7,27 @@
...
@@ -7,21 +7,27 @@
<select
id=
"selectAICrossList"
resultType=
"net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity"
>
<select
id=
"selectAICrossList"
resultType=
"net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity"
>
select t1.id as cross_id, t1.name as cross_name, t2.current_algo, t2.issue_time
select t1.id as crossId, t1.name as crossName, t2.issue_time, t2.current_algo, t2.response_code, t1.location as responseContent from
from t_base_cross_info t1 left join
(select id, name, location from t_base_cross_info where is_signal = 1) t1
(
left join (select cross_id, max(issue_time) issue_time, current_algo, response_code from t_strategy_cross_result group by cross_id) t2
select cross_id, cross_name, max(issue_time) issue_time, current_algo
on t1.id = t2.cross_id
from t_strategy_cross_result
and t2.issue_time > DATE_FORMAT(now(),'%Y-%m-%d 00:00:00')
where issue_time > #{date} and response_code = 200
order by t2.issue_time desc
union
<!-- select t1.id as cross_id, t1.name as cross_name, t2.current_algo, t2.issue_time-->
select cross_id, cross_name, max(issue_time) issue_time, current_algo
<!-- from t_base_cross_info t1 left join-->
from t_strategy_cross_result
<!-- (-->
where issue_time > #{date} and response_code
<
0
<!-- select cross_id, cross_name, max(issue_time) issue_time, current_algo-->
group by cross_id
<!-- from t_strategy_cross_result-->
order by issue_time
<!-- where issue_time > #{date} and response_code = 200-->
) t2 on t1.id = t2.cross_id
<!-- union-->
where t1.is_signal = 1
<!-- select cross_id, cross_name, max(issue_time) issue_time, current_algo-->
order by t2.issue_time desc;
<!-- from t_strategy_cross_result-->
<!-- where issue_time > #{date} and response_code < 0-->
<!-- group by cross_id-->
<!-- order by issue_time-->
<!-- ) t2 on t1.id = t2.cross_id-->
<!-- where t1.is_signal = 1-->
<!-- order by t2.issue_time desc;-->
</select>
</select>
</mapper>
</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