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
5d11325c
Commit
5d11325c
authored
Mar 06, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 态势检测雷达图功能提交
parent
ca530bc3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
261 additions
and
25 deletions
+261
-25
TrendControllerV2.java
...in/java/net/wanji/opt/controllerv2/TrendControllerV2.java
+67
-0
HoloEventMapper.java
...c/main/java/net/wanji/opt/dao/mapper/HoloEventMapper.java
+7
-0
StrategyCrossResultMapper.java
...a/net/wanji/opt/dao/mapper/StrategyCrossResultMapper.java
+3
-0
TrendServiceV2.java
...src/main/java/net/wanji/opt/servicev2/TrendServiceV2.java
+17
-0
TrendServiceV2Impl.java
...va/net/wanji/opt/servicev2/implv2/TrendServiceV2Impl.java
+78
-0
StrategyControlDataExt.java
.../net/wanji/opt/synthesis/pojo/StrategyControlDataExt.java
+7
-0
CrossGreenStatusTimeRateVO.java
...in/java/net/wanji/opt/vo2/CrossGreenStatusTimeRateVO.java
+22
-0
CrossOptInfoVO.java
...rvice/src/main/java/net/wanji/opt/vo2/CrossOptInfoVO.java
+42
-0
HoloEventMapper.xml
...ize-service/src/main/resources/mapper/HoloEventMapper.xml
+3
-10
StrategyCrossResultMapper.xml
...e/src/main/resources/mapper/StrategyCrossResultMapper.xml
+15
-15
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controllerv2/TrendControllerV2.java
0 → 100644
View file @
5d11325c
package
net
.
wanji
.
opt
.
controllerv2
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.opt.servicev2.TrendServiceV2
;
import
net.wanji.opt.vo2.CrossOptInfoVO
;
import
net.wanji.opt.vo2.CrossGreenStatusTimeRateVO
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.ws.rs.core.MediaType
;
import
java.util.Collections
;
import
java.util.List
;
/**
* @author duanruiming
* @date 2025/03/06 18:33
*/
@Api
(
value
=
"TrendControllerV2"
,
description
=
"态势监测v2"
)
@RequestMapping
(
"/trendV2"
)
@RestController
@Slf4j
public
class
TrendControllerV2
{
@Resource
private
TrendServiceV2
trendServiceV2
;
@ApiOperation
(
value
=
"态势监测-区域体检-雷达图"
,
notes
=
"态势监测-区域体检-雷达图"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@GetMapping
(
value
=
"/crossGreenStatusTimeRate"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
CrossGreenStatusTimeRateVO
.
class
),
})
public
JsonViewObject
crossGreenStatusTimeRate
()
{
List
<
CrossGreenStatusTimeRateVO
>
list
=
Collections
.
emptyList
();
try
{
list
=
trendServiceV2
.
crossGreenStatusTimeRate
();
}
catch
(
Exception
e
)
{
log
.
error
(
"态势监测-区域体检-雷达图-查询失败:{}"
,
e
);
JsonViewObject
.
newInstance
().
success
(
list
);
}
return
JsonViewObject
.
newInstance
().
success
(
list
);
}
@ApiOperation
(
value
=
"态势监测-区域体检-路口列表"
,
notes
=
"态势监测-区域体检-路口列表"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@GetMapping
(
value
=
"/crossOptInfoList"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
CrossOptInfoVO
.
class
),
})
public
JsonViewObject
crossOptInfoList
()
throws
Exception
{
List
<
CrossOptInfoVO
>
list
=
Collections
.
emptyList
();
try
{
list
=
trendServiceV2
.
crossOptInfoList
();
}
catch
(
Exception
e
)
{
JsonViewObject
.
newInstance
().
success
(
list
);
}
return
JsonViewObject
.
newInstance
().
success
(
list
);
}
}
\ No newline at end of file
signal-optimize-service/src/main/java/net/wanji/opt/dao/mapper/HoloEventMapper.java
View file @
5d11325c
...
...
@@ -9,6 +9,7 @@ import net.wanji.opt.po.base.EventStatisticPo;
import
net.wanji.opt.po.trend.EventInfoSimplePo
;
import
net.wanji.opt.po.trend.HoloEventInfoPO
;
import
net.wanji.opt.vo.CrossEventListPO
;
import
net.wanji.opt.vo2.CrossGreenStatusTimeRateVO
;
import
org.springframework.stereotype.Repository
;
import
java.util.Date
;
...
...
@@ -64,4 +65,10 @@ public interface HoloEventMapper extends BaseMapper<HoloEventInfoPO> {
*/
List
<
EventTypeTimeRateDTO
>
selectGreenEventTypeTimeRate
(
String
greenId
);
/**
* 态势监测-区域体检-雷达图 查询
* @return
*/
List
<
CrossGreenStatusTimeRateVO
>
selectCrossGreenStatusTimeRate
();
}
signal-optimize-service/src/main/java/net/wanji/opt/dao/mapper/StrategyCrossResultMapper.java
View file @
5d11325c
...
...
@@ -2,6 +2,7 @@ package net.wanji.opt.dao.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity
;
import
net.wanji.opt.vo2.CrossOptInfoVO
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -12,4 +13,6 @@ import java.util.List;
*/
public
interface
StrategyCrossResultMapper
extends
BaseMapper
<
StrategyCrossResultEntity
>
{
List
<
StrategyCrossResultEntity
>
selectAICrossList
(
Date
date
);
List
<
CrossOptInfoVO
>
selectAICrossListV2
();
}
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/TrendServiceV2.java
0 → 100644
View file @
5d11325c
package
net
.
wanji
.
opt
.
servicev2
;
import
net.wanji.opt.vo2.CrossGreenStatusTimeRateVO
;
import
net.wanji.opt.vo2.CrossOptInfoVO
;
import
java.util.List
;
/**
* @author duanruiming
* @date 2025/03/06 18:37
*/
public
interface
TrendServiceV2
{
List
<
CrossGreenStatusTimeRateVO
>
crossGreenStatusTimeRate
();
List
<
CrossOptInfoVO
>
crossOptInfoList
()
throws
Exception
;
}
\ No newline at end of file
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/implv2/TrendServiceV2Impl.java
0 → 100644
View file @
5d11325c
package
net
.
wanji
.
opt
.
servicev2
.
implv2
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.opt.dao.mapper.HoloEventMapper
;
import
net.wanji.opt.dao.mapper.StrategyCrossResultMapper
;
import
net.wanji.opt.servicev2.TrendServiceV2
;
import
net.wanji.opt.vo2.CrossGreenStatusTimeRateVO
;
import
net.wanji.opt.vo2.CrossOptInfoVO
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.*
;
/**
* @author duanruiming
* @date 2025/03/06 18:44
*/
@Service
@Slf4j
public
class
TrendServiceV2Impl
implements
TrendServiceV2
{
@Resource
private
HoloEventMapper
holoEventMapper
;
@Resource
private
StrategyCrossResultMapper
strategyCrossResultMapper
;
@Override
public
List
<
CrossGreenStatusTimeRateVO
>
crossGreenStatusTimeRate
()
{
return
holoEventMapper
.
selectCrossGreenStatusTimeRate
();
}
@Override
public
List
<
CrossOptInfoVO
>
crossOptInfoList
()
throws
Exception
{
List
<
CrossOptInfoVO
>
results
=
new
ArrayList
<>();
try
{
results
=
new
ArrayList
<>();
List
<
CrossOptInfoVO
>
resultList
=
strategyCrossResultMapper
.
selectAICrossListV2
();
if
(!
CollectionUtils
.
isEmpty
(
resultList
))
{
for
(
CrossOptInfoVO
entity
:
resultList
)
{
CrossOptInfoVO
result
=
new
CrossOptInfoVO
();
BeanUtils
.
copyProperties
(
entity
,
result
);
Integer
currentAlgo
=
entity
.
getCurrentAlgo
();
Date
issueTime
=
entity
.
getIssueTime
();
Date
current
=
new
Date
();
Integer
duration
=
Objects
.
nonNull
(
entity
.
getDuration
())
?
entity
.
getDuration
()
:
0
;
// 计算结束时间
if
(
Objects
.
nonNull
(
issueTime
))
{
if
(
Objects
.
equals
(
2
,
currentAlgo
)
&&
current
.
getTime
()
-
issueTime
.
getTime
()
<=
duration
*
1000
)
{
result
.
setOptStatus
(
"优化中"
);
result
.
setOptMethod
(
"均衡调控"
);
}
else
if
(
current
.
getTime
()
-
issueTime
.
getTime
()
>
10
*
1000
)
{
currentAlgo
=
null
;
}
}
// 0无策略
if
(
Objects
.
isNull
(
currentAlgo
)
||
Objects
.
equals
(
0
,
currentAlgo
))
{
result
.
setOptStatus
(
"正常"
);
result
.
setOptMethod
(
"畅通"
);
}
else
if
(
Objects
.
equals
(
2
,
currentAlgo
))
{
result
.
setOptStatus
(
"优化中"
);
result
.
setOptMethod
(
"均衡调控"
);
}
else
{
result
.
setOptStatus
(
"优化中"
);
result
.
setOptMethod
(
"效率提升"
);
}
results
.
add
(
result
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"态势监测-区域体检-雷达图-查询失败:{}"
,
e
);
throw
new
Exception
(
e
);
}
return
results
;
}
}
\ No newline at end of file
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/pojo/StrategyControlDataExt.java
View file @
5d11325c
package
net
.
wanji
.
opt
.
synthesis
.
pojo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
...
...
@@ -9,6 +10,12 @@ import lombok.Data;
@Data
public
class
StrategyControlDataExt
extends
StrategyControlDataEntity
{
private
String
strategyName
;
@ApiModelProperty
(
value
=
"优化状态"
)
private
String
optStatus
;
@ApiModelProperty
(
value
=
"策略类型"
)
private
String
optMethod
;
@ApiModelProperty
(
value
=
"交通指数"
)
private
Double
trafficIndex
;
@ApiModelProperty
(
value
=
"排队长度"
)
private
int
queueLength
;
}
signal-optimize-service/src/main/java/net/wanji/opt/vo2/CrossGreenStatusTimeRateVO.java
0 → 100644
View file @
5d11325c
package
net
.
wanji
.
opt
.
vo2
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author duanruiming
* @date 2025/03/06 16:55
*/
@Data
@ApiModel
(
value
=
"CrossGreenStatusTimeRateVO"
,
description
=
"态势监测-区域体检-雷达图返回"
)
public
class
CrossGreenStatusTimeRateVO
{
@ApiModelProperty
(
value
=
"事件类型"
)
private
String
type
;
@ApiModelProperty
(
value
=
"事件次数"
)
private
Integer
count
;
@ApiModelProperty
(
value
=
"持续时间"
)
private
Integer
time
;
@ApiModelProperty
(
value
=
"当天时间秒数"
)
private
Integer
totalTime
;
}
signal-optimize-service/src/main/java/net/wanji/opt/vo2/CrossOptInfoVO.java
0 → 100644
View file @
5d11325c
package
net
.
wanji
.
opt
.
vo2
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
net.wanji.opt.config.Double2TwoDecimalPlacesSerializer
;
import
java.util.Date
;
/**
* @author duanruiming
* @date 2025/03/06 18:22
*/
@Data
@ApiModel
(
value
=
"CrossOptInfoVO"
,
description
=
"态势监测-区域体检-路口优化列表"
)
public
class
CrossOptInfoVO
{
@ApiModelProperty
(
value
=
"路口编号"
)
private
String
crossId
;
@ApiModelProperty
(
value
=
"路口名称"
)
private
String
crossName
;
@ApiModelProperty
(
value
=
"优化时间"
)
private
Date
issueTime
;
@ApiModelProperty
(
value
=
"事件类型"
)
private
Integer
currentAlgo
;
@ApiModelProperty
(
value
=
"响应编码"
)
private
Integer
responseCode
;
@ApiModelProperty
(
value
=
"响应状态"
)
private
String
responseContent
;
@ApiModelProperty
(
value
=
"持续时长"
)
private
Integer
duration
;
private
String
strategyName
;
@ApiModelProperty
(
value
=
"优化状态"
)
private
String
optStatus
;
@ApiModelProperty
(
value
=
"策略类型"
)
private
String
optMethod
;
@ApiModelProperty
(
value
=
"交通指数"
)
@JsonSerialize
(
using
=
Double2TwoDecimalPlacesSerializer
.
class
)
private
Double
trafficIndex
;
@ApiModelProperty
(
value
=
"排队长度"
)
private
int
queueLength
;
}
\ No newline at end of file
signal-optimize-service/src/main/resources/mapper/HoloEventMapper.xml
View file @
5d11325c
...
...
@@ -243,21 +243,14 @@
) t1 group by t1.type
</select>
<select
id=
"select
GreenEventTypeTimeRate"
parameterType=
"String"
resultType=
"net.wanji.opt.dto.EventTypeTimeRateDT
O"
>
select type, sum(duration)
/ totalTime as timeRat
e from (
<select
id=
"select
CrossGreenStatusTimeRate"
resultType=
"net.wanji.opt.vo2.CrossGreenStatusTimeRateV
O"
>
select type, sum(duration)
as time, count(*) count, totalTim
e from (
select cross_id, type,
TIMESTAMPDIFF(SECOND, start_time, ifnull(end_time,now())) duration,
TIMESTAMPDIFF(SECOND, DATE_FORMAT(start_time, '%Y-%m-%d 00:00:00'), now()) as totalTime
from t_event_info
where type in ('70
5', '706') and start_time >= curdate() and green_id = #{greenId}
where type in ('70
1', '702', '703', '704', '705', '706', '707') and start_time > curdate()
) t1 group by t1.type
<!-- select type, sum(duration) / totalTime as timeRate from (-->
<!-- select cross_id, type,-->
<!-- TIMESTAMPDIFF(SECOND, start_time, ifnull(end_time,now())) duration,-->
<!-- TIMESTAMPDIFF(SECOND, DATE_FORMAT(start_time, '%Y-%m-%d 00:00:00'), '2025-03-03 00:00:00') as totalTime-->
<!-- from t_event_info-->
<!-- where type in ('705', '706') and dt= 20250302 and green_id = 1-->
<!-- ) t1 group by t1.type-->
</select>
...
...
signal-optimize-service/src/main/resources/mapper/StrategyCrossResultMapper.xml
View file @
5d11325c
...
...
@@ -15,21 +15,21 @@
on t1.id = t2.cross_id
and t2.issue_time > CURDATE()
order by t2.issue_time desc
<!-- select t1.id as cross_id, t1.name as cross_name, t2.current_algo, t2.issue_time--
>
<!-- from t_base_cross_info t1 left join-->
<!-- (-->
<!-- select cross_id, cross_name, max(issue_time) issue_time, current_algo--
>
<!-- from t_strategy_cross_result-->
<!-- where issue_time > #{date} and response_code = 200-->
<!-- union-->
<!-- select cross_id, cross_name, max(issue_time) issue_time, current_algo-->
<!-- 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
id=
"selectAICrossListV2"
resultType=
"net.wanji.opt.vo2.CrossOptInfoVO"
>
select t1.id crossId, t1.name crossName, t2.issue_time issueTime, t2.current_algo currentAlgo,
t2.response_code responseCode, t1.location as responseContent, t2.duration,
t3.queue_length queueLength, t3.traffic_index trafficIndex from
(select id, name, location from t_base_cross_info where is_signal = 1) t1
left join (select t1.cross_id, t1.issue_time, t1.current_algo, t1.response_code, t1.duration from t_strategy_cross_result t1
inner join (select cross_id, max(issue_time) issue_time from t_strategy_cross_result where issue_time > CURDATE() group by cross_id) t3
on t1.cross_id = t3.cross_id and t1.issue_time = t3.issue_time where t1.issue_time > CURDATE()) t2
on t1.id = t2.cross_id
and t2.issue_time > CURDATE()
left join t_cross_data_realtime t3 on t1.id = t3.cross_id
order by t2.issue_time desc
</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