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
1894e009
Commit
1894e009
authored
Mar 13, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 态势检测-优化监测优化返回结果;
parent
86352175
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
219 additions
and
73 deletions
+219
-73
DiagnoController.java
.../main/java/net/wanji/opt/controller/DiagnoController.java
+1
-0
TrendControllerV2.java
...in/java/net/wanji/opt/controllerv2/TrendControllerV2.java
+73
-15
HoloEventMapper.java
...c/main/java/net/wanji/opt/dao/mapper/HoloEventMapper.java
+7
-2
TrendServiceV2.java
...src/main/java/net/wanji/opt/servicev2/TrendServiceV2.java
+5
-4
TrendServiceV2Impl.java
...va/net/wanji/opt/servicev2/implv2/TrendServiceV2Impl.java
+51
-4
EventTypeCountTimeVO.java
...src/main/java/net/wanji/opt/vo2/EventTypeCountTimeVO.java
+22
-0
GreenOptInfoDTO.java
...vice/src/main/java/net/wanji/opt/vo2/GreenOptInfoDTO.java
+0
-41
OptMonitoringResultVO.java
...rc/main/java/net/wanji/opt/vo2/OptMonitoringResultVO.java
+23
-0
StatisticsEventTypeCountTimeVO.java
...ava/net/wanji/opt/vo2/StatisticsEventTypeCountTimeVO.java
+5
-0
HoloEventMapper.xml
...ize-service/src/main/resources/mapper/HoloEventMapper.xml
+13
-7
DateUtil.java
...n/src/main/java/net/wanji/common/utils/tool/DateUtil.java
+19
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controller/DiagnoController.java
View file @
1894e009
...
@@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.MediaType
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
...
signal-optimize-service/src/main/java/net/wanji/opt/controllerv2/TrendControllerV2.java
View file @
1894e009
...
@@ -8,14 +8,12 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -8,14 +8,12 @@ import lombok.extern.slf4j.Slf4j;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.opt.servicev2.TrendServiceV2
;
import
net.wanji.opt.servicev2.TrendServiceV2
;
import
net.wanji.opt.vo2.*
;
import
net.wanji.opt.vo2.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.MediaType
;
import
java.util.
Collections
;
import
java.util.
*
;
import
java.util.
List
;
import
java.util.
stream.Collectors
;
/**
/**
* @author duanruiming
* @author duanruiming
...
@@ -86,17 +84,36 @@ public class TrendControllerV2 {
...
@@ -86,17 +84,36 @@ public class TrendControllerV2 {
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@GetMapping
(
value
=
"/greenOptMonitoringList"
)
@GetMapping
(
value
=
"/greenOptMonitoringList"
)
@ApiResponses
({
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
OptMonitoringVO
.
class
),
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
OptMonitoring
Result
VO
.
class
),
})
})
public
JsonViewObject
greenOptMonitoringList
()
throws
Exception
{
public
JsonViewObject
greenOptMonitoringList
()
throws
Exception
{
List
<
OptMonitoringVO
>
list
=
Collections
.
emptyList
();
OptMonitoringResultVO
result
=
new
OptMonitoringResultVO
();
try
{
try
{
list
=
trendServiceV2
.
greenOptMonitoringList
();
List
<
OptMonitoringVO
>
list
=
trendServiceV2
.
greenOptMonitoringList
();
countResult
(
result
,
list
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"态势监测-运行监测-干线优化监测-查询异常:"
,
e
);
log
.
error
(
"态势监测-运行监测-干线优化监测-查询异常:"
,
e
);
JsonViewObject
.
newInstance
().
success
(
lis
t
);
JsonViewObject
.
newInstance
().
success
(
resul
t
);
}
}
return
JsonViewObject
.
newInstance
().
success
(
list
);
return
JsonViewObject
.
newInstance
().
success
(
result
);
}
private
void
countResult
(
OptMonitoringResultVO
result
,
List
<
OptMonitoringVO
>
list
)
throws
Exception
{
Map
<
String
,
List
<
OptMonitoringVO
>>
listMap
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
OptMonitoringVO:
:
getType
));
List
<
OptMonitoringResultVO
.
TypeCount
>
typeCounts
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
List
<
OptMonitoringVO
>>
entry
:
listMap
.
entrySet
())
{
String
key
=
entry
.
getKey
();
List
<
OptMonitoringVO
>
value
=
entry
.
getValue
();
OptMonitoringResultVO
.
TypeCount
typeCount
=
new
OptMonitoringResultVO
.
TypeCount
();
typeCount
.
setType
(
key
);
typeCount
.
setEventCount
(
value
.
size
());
List
<
OptMonitoringVO
>
optList
=
value
.
stream
().
filter
(
vo
->
Objects
.
equals
(
1
,
vo
.
getOptStatus
())).
collect
(
Collectors
.
toList
());
typeCount
.
setOptCount
(
optList
.
size
());
typeCounts
.
add
(
typeCount
);
}
result
.
setTypeCount
(
typeCounts
);
result
.
setOptMonitoringVOList
(
list
);
}
}
@ApiOperation
(
value
=
"态势监测-运行监测-路口优化监测"
,
notes
=
"态势监测-运行监测-路口优化监测"
,
@ApiOperation
(
value
=
"态势监测-运行监测-路口优化监测"
,
notes
=
"态势监测-运行监测-路口优化监测"
,
...
@@ -104,17 +121,18 @@ public class TrendControllerV2 {
...
@@ -104,17 +121,18 @@ public class TrendControllerV2 {
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@GetMapping
(
value
=
"/crossOptMonitoringList"
)
@GetMapping
(
value
=
"/crossOptMonitoringList"
)
@ApiResponses
({
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
OptMonitoringVO
.
class
),
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
OptMonitoring
Result
VO
.
class
),
})
})
public
JsonViewObject
crossOptMonitoringList
()
throws
Exception
{
public
JsonViewObject
crossOptMonitoringList
()
throws
Exception
{
List
<
OptMonitoringVO
>
list
=
Collections
.
emptyList
();
OptMonitoringResultVO
result
=
new
OptMonitoringResultVO
();
try
{
try
{
list
=
trendServiceV2
.
crossOptMonitoringList
();
List
<
OptMonitoringVO
>
list
=
trendServiceV2
.
crossOptMonitoringList
();
countResult
(
result
,
list
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"态势监测-运行监测-路口优化监测:"
,
e
);
log
.
error
(
"态势监测-运行监测-路口优化监测:"
,
e
);
JsonViewObject
.
newInstance
().
success
(
lis
t
);
JsonViewObject
.
newInstance
().
success
(
resul
t
);
}
}
return
JsonViewObject
.
newInstance
().
success
(
lis
t
);
return
JsonViewObject
.
newInstance
().
success
(
resul
t
);
}
}
@ApiOperation
(
value
=
"态势监测-事件告警-实时列表"
,
notes
=
"态势监测-事件告警-实时列表"
,
@ApiOperation
(
value
=
"态势监测-事件告警-实时列表"
,
notes
=
"态势监测-事件告警-实时列表"
,
...
@@ -134,4 +152,44 @@ public class TrendControllerV2 {
...
@@ -134,4 +152,44 @@ public class TrendControllerV2 {
}
}
return
JsonViewObject
.
newInstance
().
success
(
list
);
return
JsonViewObject
.
newInstance
().
success
(
list
);
}
}
@ApiOperation
(
value
=
"态势监测-区域体检-雷达图绿波事件事件类型过滤"
,
notes
=
"态势监测-区域体检-雷达图绿波事件事件类型过滤"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/selectGreenEventTypeCountTimeList"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
OptMonitoringVO
.
class
),
})
public
JsonViewObject
selectGreenEventTypeCountTimeList
(
@RequestBody
EventTypeCountTimeVO
vo
)
throws
Exception
{
List
<
StatisticsEventTypeCountTimeVO
>
list
=
Collections
.
emptyList
();
try
{
list
=
trendServiceV2
.
selectGreenEventTypeCountTimeList
(
vo
);
}
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
)
@PostMapping
(
value
=
"/selectCrossEventTypeCountTimeList"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
OptMonitoringVO
.
class
),
})
public
JsonViewObject
selectCrossEventTypeCountTimeList
(
@RequestBody
EventTypeCountTimeVO
vo
)
throws
Exception
{
List
<
StatisticsEventTypeCountTimeVO
>
list
=
Collections
.
emptyList
();
try
{
list
=
trendServiceV2
.
selectCrossEventTypeCountTimeList
(
vo
);
}
catch
(
Exception
e
)
{
log
.
error
(
"态势监测-事件告警-实时列表:"
,
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 @
1894e009
...
@@ -15,6 +15,7 @@ import net.wanji.opt.vo2.StatisticsEventTypeCountTimeVO;
...
@@ -15,6 +15,7 @@ import net.wanji.opt.vo2.StatisticsEventTypeCountTimeVO;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -84,11 +85,15 @@ public interface HoloEventMapper extends BaseMapper<HoloEventInfoPO> {
...
@@ -84,11 +85,15 @@ public interface HoloEventMapper extends BaseMapper<HoloEventInfoPO> {
* 态势监测-区域体检-雷达图事件类型过滤
* 态势监测-区域体检-雷达图事件类型过滤
* @return
* @return
*/
*/
List
<
StatisticsEventTypeCountTimeVO
>
selectGreenEventTypeCountTimeList
(
@Param
(
"type"
)
String
type
,
@Param
(
"date"
)
Date
date
);
List
<
StatisticsEventTypeCountTimeVO
>
selectGreenEventTypeCountTimeList
(
@Param
(
"type"
)
String
type
,
@Param
(
"startTime"
)
LocalDateTime
startTime
,
@Param
(
"endTime"
)
LocalDateTime
endTime
);
/**
/**
* 态势监测-区域体检-雷达图事件类型过滤
* 态势监测-区域体检-雷达图事件类型过滤
* @return
* @return
*/
*/
List
<
StatisticsEventTypeCountTimeVO
>
selectCrossEventTypeCountTimeList
(
@Param
(
"type"
)
String
type
,
@Param
(
"date"
)
Date
date
);
List
<
StatisticsEventTypeCountTimeVO
>
selectCrossEventTypeCountTimeList
(
@Param
(
"type"
)
String
type
,
@Param
(
"startTime"
)
LocalDateTime
startTime
,
@Param
(
"endTime"
)
LocalDateTime
endTime
);
}
}
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/TrendServiceV2.java
View file @
1894e009
package
net
.
wanji
.
opt
.
servicev2
;
package
net
.
wanji
.
opt
.
servicev2
;
import
net.wanji.opt.vo2.CrossGreenStatusTimeRateVO
;
import
net.wanji.opt.vo2.*
;
import
net.wanji.opt.vo2.CrossOptInfoVO
;
import
net.wanji.opt.vo2.GreenOptInfoVO
;
import
net.wanji.opt.vo2.OptMonitoringVO
;
import
java.util.List
;
import
java.util.List
;
...
@@ -24,4 +21,8 @@ public interface TrendServiceV2 {
...
@@ -24,4 +21,8 @@ public interface TrendServiceV2 {
List
<
OptMonitoringVO
>
crossOptMonitoringList
()
throws
Exception
;
List
<
OptMonitoringVO
>
crossOptMonitoringList
()
throws
Exception
;
List
<
OptMonitoringVO
>
eventAlarmRealTimeList
()
throws
Exception
;
List
<
OptMonitoringVO
>
eventAlarmRealTimeList
()
throws
Exception
;
List
<
StatisticsEventTypeCountTimeVO
>
selectGreenEventTypeCountTimeList
(
EventTypeCountTimeVO
vo
)
throws
Exception
;
List
<
StatisticsEventTypeCountTimeVO
>
selectCrossEventTypeCountTimeList
(
EventTypeCountTimeVO
vo
)
throws
Exception
;
}
}
\ No newline at end of file
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/implv2/TrendServiceV2Impl.java
View file @
1894e009
package
net
.
wanji
.
opt
.
servicev2
.
implv2
;
package
net
.
wanji
.
opt
.
servicev2
.
implv2
;
import
com.alibaba.nacos.api.utils.StringUtils
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.utils.tool.DateUtil
;
import
net.wanji.common.utils.tool.DateUtil
;
...
@@ -22,8 +21,10 @@ import net.wanji.opt.vo2.dto.GreenOptDTO;
...
@@ -22,8 +21,10 @@ import net.wanji.opt.vo2.dto.GreenOptDTO;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -92,7 +93,7 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
...
@@ -92,7 +93,7 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
String
lastWeekCrossId
=
crossDataHistPO
.
getCrossId
();
String
lastWeekCrossId
=
crossDataHistPO
.
getCrossId
();
Double
lastWeekTrafficIndex
=
crossDataHistPO
.
getTrafficIndex
();
Double
lastWeekTrafficIndex
=
crossDataHistPO
.
getTrafficIndex
();
Double
lastWeekQueueLength
=
crossDataHistPO
.
getQueueLength
();
Double
lastWeekQueueLength
=
crossDataHistPO
.
getQueueLength
();
if
(
StringUtils
.
e
quals
(
crossId
,
lastWeekCrossId
))
{
if
(
StringUtils
.
e
ndsWithIgnoreCase
(
crossId
,
lastWeekCrossId
))
{
if
(
trafficIndex
>
lastWeekTrafficIndex
)
{
if
(
trafficIndex
>
lastWeekTrafficIndex
)
{
result
.
setTrafficIndexUpDown
(
1
);
result
.
setTrafficIndexUpDown
(
1
);
}
else
{
}
else
{
...
@@ -139,7 +140,7 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
...
@@ -139,7 +140,7 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
Double
curTrafficIndex
=
greenwaveHistPO
.
getTrafficIndex
();
Double
curTrafficIndex
=
greenwaveHistPO
.
getTrafficIndex
();
Double
curSpeed
=
Objects
.
nonNull
(
greenwaveHistPO
.
getSpeed
())
?
greenwaveHistPO
.
getSpeed
()
:
0
;
Double
curSpeed
=
Objects
.
nonNull
(
greenwaveHistPO
.
getSpeed
())
?
greenwaveHistPO
.
getSpeed
()
:
0
;
Integer
curTravelTime
=
greenwaveHistPO
.
getTrvalTime
();
Integer
curTravelTime
=
greenwaveHistPO
.
getTrvalTime
();
if
(
Objects
.
equals
(
greenId
,
curGreenId
)
&&
StringUtils
.
e
quals
(
roadDirection
,
curDirection
))
{
if
(
Objects
.
equals
(
greenId
,
curGreenId
)
&&
StringUtils
.
e
ndsWithIgnoreCase
(
roadDirection
,
curDirection
))
{
if
(
trafficIndex
>
curTrafficIndex
)
{
if
(
trafficIndex
>
curTrafficIndex
)
{
greenOptDTO
.
setTrafficIndexUpDown
(
1
);
greenOptDTO
.
setTrafficIndexUpDown
(
1
);
...
@@ -213,12 +214,13 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
...
@@ -213,12 +214,13 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
String
crossId
=
optMonitoringVO
.
getId
();
String
crossId
=
optMonitoringVO
.
getId
();
for
(
CrossLastOptResultDTO
optResultDTO
:
optResultDTOS
)
{
for
(
CrossLastOptResultDTO
optResultDTO
:
optResultDTOS
)
{
String
id
=
optResultDTO
.
getId
();
String
id
=
optResultDTO
.
getId
();
if
(
StringUtils
.
e
quals
(
id
,
crossId
))
{
if
(
StringUtils
.
e
ndsWithIgnoreCase
(
id
,
crossId
))
{
Date
optTime
=
optResultDTO
.
getOptTime
();
Date
optTime
=
optResultDTO
.
getOptTime
();
Integer
duration
=
optResultDTO
.
getDuration
();
Integer
duration
=
optResultDTO
.
getDuration
();
String
type
=
optResultDTO
.
getType
();
String
type
=
optResultDTO
.
getType
();
// 优化时间计算
// 优化时间计算
optMonitoringVO
.
setOptTime
(
optTime
);
optMonitoringVO
.
setOptTime
(
optTime
);
optMonitoringVO
.
setOptStatus
(
0
);
optMonitoringVO
.
setTypeDesc
(
EventInfoTypeEnum
.
getOptDesc
(
type
));
optMonitoringVO
.
setTypeDesc
(
EventInfoTypeEnum
.
getOptDesc
(
type
));
if
(
Objects
.
nonNull
(
optTime
))
{
if
(
Objects
.
nonNull
(
optTime
))
{
// 空放优化中,6秒钟结束,当前时间小于开始时间+持续时间
// 空放优化中,6秒钟结束,当前时间小于开始时间+持续时间
...
@@ -247,4 +249,49 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
...
@@ -247,4 +249,49 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
List
<
OptMonitoringVO
>
sort
=
results
.
stream
().
sorted
(
Comparator
.
comparing
(
OptMonitoringVO:
:
getStartTime
).
reversed
()).
collect
(
Collectors
.
toList
());
List
<
OptMonitoringVO
>
sort
=
results
.
stream
().
sorted
(
Comparator
.
comparing
(
OptMonitoringVO:
:
getStartTime
).
reversed
()).
collect
(
Collectors
.
toList
());
return
sort
;
return
sort
;
}
}
@Override
public
List
<
StatisticsEventTypeCountTimeVO
>
selectGreenEventTypeCountTimeList
(
EventTypeCountTimeVO
vo
)
throws
Exception
{
String
type
=
vo
.
getType
();
LocalDateTime
current
=
vo
.
getDate
();
LocalDateTime
curDayStart
=
DateUtil
.
getLastDayMidNight
(
current
,
0
);
LocalDateTime
latDayStart
=
DateUtil
.
getLastDayMidNight
(
current
,
-
7
);
LocalDateTime
lastDayEnd
=
current
.
plusDays
(-
1
);
List
<
StatisticsEventTypeCountTimeVO
>
currentList
=
holoEventMapper
.
selectGreenEventTypeCountTimeList
(
type
,
curDayStart
,
current
);
List
<
StatisticsEventTypeCountTimeVO
>
lastDayList
=
holoEventMapper
.
selectGreenEventTypeCountTimeList
(
type
,
latDayStart
,
lastDayEnd
);
setCountDurationRate
(
currentList
,
lastDayList
);
return
currentList
;
}
private
static
void
setCountDurationRate
(
List
<
StatisticsEventTypeCountTimeVO
>
currentList
,
List
<
StatisticsEventTypeCountTimeVO
>
lastDayList
)
{
currentList
.
forEach
(
result
->
{
for
(
StatisticsEventTypeCountTimeVO
last
:
lastDayList
)
{
String
id
=
result
.
getId
();
String
lastId
=
last
.
getId
();
if
(
StringUtils
.
endsWithIgnoreCase
(
id
,
lastId
))
{
if
(
last
.
getCount
()
==
0
||
last
.
getDuration
()
==
0
)
{
continue
;
}
double
countRate
=
(
result
.
getCount
()
-
last
.
getCount
())
/
last
.
getCount
()
*
100
;
double
durationRate
=
(
result
.
getDuration
()
-
last
.
getDuration
())
/
last
.
getCount
()
*
100
;
result
.
setCountRate
((
int
)
countRate
);
result
.
setDurationRate
((
int
)
durationRate
);
}
}
});
}
@Override
public
List
<
StatisticsEventTypeCountTimeVO
>
selectCrossEventTypeCountTimeList
(
EventTypeCountTimeVO
vo
)
throws
Exception
{
String
type
=
vo
.
getType
();
LocalDateTime
current
=
vo
.
getDate
();
LocalDateTime
curDayStart
=
DateUtil
.
getLastDayMidNight
(
current
,
0
);
LocalDateTime
latDayStart
=
DateUtil
.
getLastDayMidNight
(
current
,
-
1
);
LocalDateTime
lastDayEnd
=
current
.
plusDays
(-
1
);
List
<
StatisticsEventTypeCountTimeVO
>
currentList
=
holoEventMapper
.
selectCrossEventTypeCountTimeList
(
type
,
curDayStart
,
current
);
List
<
StatisticsEventTypeCountTimeVO
>
lastDayList
=
holoEventMapper
.
selectCrossEventTypeCountTimeList
(
type
,
latDayStart
,
lastDayEnd
);
setCountDurationRate
(
currentList
,
lastDayList
);
return
currentList
;
}
}
}
\ No newline at end of file
signal-optimize-service/src/main/java/net/wanji/opt/vo2/EventTypeCountTimeVO.java
0 → 100644
View file @
1894e009
package
net
.
wanji
.
opt
.
vo2
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
/**
* @author duanruiming
* @date 2025/03/13 17:07
*/
@Data
@ApiModel
(
value
=
"EventTypeCountTimeVO"
,
description
=
"态势监测-区域体检-雷达图路口事件请求"
)
public
class
EventTypeCountTimeVO
{
@ApiModelProperty
(
value
=
"事件类型"
)
private
String
type
;
@ApiModelProperty
(
value
=
"日期"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
date
;
}
signal-optimize-service/src/main/java/net/wanji/opt/vo2/GreenOptInfoDTO.java
deleted
100644 → 0
View file @
86352175
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
;
/**
* @author duanruiming
* @date 2025/03/10 16:14
*/
@Data
@ApiModel
(
value
=
"GreenOptInfoDTO"
,
description
=
"态势监测-区域体检-绿波优化列表"
)
public
class
GreenOptInfoDTO
{
@ApiModelProperty
(
value
=
"绿波编号"
)
private
Integer
greenId
;
@ApiModelProperty
(
value
=
"绿波名称"
)
private
String
greenName
;
@ApiModelProperty
(
value
=
"绿波方向"
)
private
String
roadDirection
;
@ApiModelProperty
(
value
=
"绿波名称"
)
private
String
directionName
;
@ApiModelProperty
(
value
=
"经纬度"
)
private
String
wkt
;
@ApiModelProperty
(
value
=
"策略名称"
)
private
String
strategyName
;
@ApiModelProperty
(
value
=
"交通指数"
)
@JsonSerialize
(
using
=
Double2TwoDecimalPlacesSerializer
.
class
)
private
Double
trafficIndex
;
@ApiModelProperty
(
value
=
"运行速度"
)
private
Integer
speed
;
@ApiModelProperty
(
value
=
"行程速度"
)
private
Integer
travelTime
;
@ApiModelProperty
(
value
=
"同比交通指数,0-向下, 1向上"
)
private
Integer
trafficIndexUpDown
;
@ApiModelProperty
(
value
=
"同比运行速度,0-向下, 1向上"
)
private
Integer
speedUpDown
;
@ApiModelProperty
(
value
=
"同比行程时间,0-向下, 1向上"
)
private
Integer
travelUpDown
;
}
signal-optimize-service/src/main/java/net/wanji/opt/vo2/OptMonitoringResultVO.java
0 → 100644
View file @
1894e009
package
net
.
wanji
.
opt
.
vo2
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author duanruiming
* @date 2025/03/13 14:26
*/
@Data
@ApiModel
(
value
=
"OptMonitoringVO"
,
description
=
"态势监测-运行监测-优化监测返回实体"
)
public
class
OptMonitoringResultVO
{
private
List
<
TypeCount
>
typeCount
;
private
List
<
OptMonitoringVO
>
optMonitoringVOList
;
@Data
public
static
class
TypeCount
{
private
String
type
;
private
Integer
eventCount
;
private
Integer
optCount
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/vo2/StatisticsEventTypeCountTimeVO.java
View file @
1894e009
...
@@ -25,4 +25,9 @@ public class StatisticsEventTypeCountTimeVO {
...
@@ -25,4 +25,9 @@ public class StatisticsEventTypeCountTimeVO {
private
Integer
count
;
private
Integer
count
;
@ApiModelProperty
(
value
=
"持续时间"
)
@ApiModelProperty
(
value
=
"持续时间"
)
private
Integer
duration
;
private
Integer
duration
;
@ApiModelProperty
(
value
=
"同比比例,上一周同一时间次数比例"
)
private
Integer
countRate
;
@ApiModelProperty
(
value
=
"同比比例,上一周同一持续时间次数比例"
)
private
Integer
durationRate
;
}
}
signal-optimize-service/src/main/resources/mapper/HoloEventMapper.xml
View file @
1894e009
...
@@ -277,9 +277,9 @@
...
@@ -277,9 +277,9 @@
order by t2.start_time desc
order by t2.start_time desc
</select>
</select>
<!-- 态势监测-区域体检-雷达图事件类型过滤 -->
<!-- 态势监测-区域体检-雷达图
绿波事件
事件类型过滤 -->
<select
id=
"selectGreenEventTypeCountTimeList"
resultType=
"net.wanji.opt.vo2.StatisticsEventTypeCountTimeVO"
>
<select
id=
"selectGreenEventTypeCountTimeList"
resultType=
"net.wanji.opt.vo2.StatisticsEventTypeCountTimeVO"
>
select t1.id, t1.name, t1.wkt, t2.type, ifnull(t2.count, 0)
, ifnull(t2.duration, 0)
,
select t1.id, t1.name, t1.wkt, t2.type, ifnull(t2.count, 0)
as count, ifnull(t2.duration, 0) as duration
,
case when t2.type = '705' then '缓行次数'
case when t2.type = '705' then '缓行次数'
when t2.type = '706' then '拥堵次数'
when t2.type = '706' then '拥堵次数'
end as typeDesc
end as typeDesc
...
@@ -289,14 +289,17 @@
...
@@ -289,14 +289,17 @@
select type, green_id,
select type, green_id,
count(*) as count,
count(*) as count,
SUM(TIMESTAMPDIFF(SECOND, start_time, ifnull(end_time, now()))) as duration
SUM(TIMESTAMPDIFF(SECOND, start_time, ifnull(end_time, now()))) as duration
from t_event_info where type = #{type} and dt = #{date} group by green_id) t2
from t_event_info where type = #{type}
and start_time between #{startTime} and #{endTime}
group by cross_id) t2
on t1.id = t2.green_id
on t1.id = t2.green_id
order by duration desc
</select>
</select>
<!-- 态势监测-区域体检-雷达图事件类型过滤 -->
<!-- 态势监测-区域体检-雷达图
路口
事件类型过滤 -->
<select
id=
"select
Green
EventTypeCountTimeList"
resultType=
"net.wanji.opt.vo2.StatisticsEventTypeCountTimeVO"
>
<select
id=
"select
Cross
EventTypeCountTimeList"
resultType=
"net.wanji.opt.vo2.StatisticsEventTypeCountTimeVO"
>
select t1.id, t1.name, REPLACE(SUBSTRING(location, 7, 18), ' ', ',') as wkt,
select t1.id, t1.name, REPLACE(SUBSTRING(location, 7, 18), ' ', ',') as wkt,
t2.type, ifnull(t2.count, 0)
, ifnull(t2.duration, 0)
,
t2.type, ifnull(t2.count, 0)
as count, ifnull(t2.duration, 0) as duration
,
case when t2.type = '701' then '空放次数'
case when t2.type = '701' then '空放次数'
when t2.type = '702' then '失衡次数'
when t2.type = '702' then '失衡次数'
when t2.type = '703' then '溢出次数'
when t2.type = '703' then '溢出次数'
...
@@ -308,9 +311,12 @@
...
@@ -308,9 +311,12 @@
select type, cross_id,
select type, cross_id,
ifnull(count(*), 0) as count,
ifnull(count(*), 0) as count,
SUM(TIMESTAMPDIFF(SECOND, start_time, ifnull(end_time, now()))) as duration
SUM(TIMESTAMPDIFF(SECOND, start_time, ifnull(end_time, now()))) as duration
from t_event_info where type = '701' and dt = curdate() group by cross_id) t2
from t_event_info where type = #{type}
and start_time between #{startTime} and #{endTime}
group by cross_id) t2
on t1.id = t2.cross_id
on t1.id = t2.cross_id
where t1.is_signal = 1
where t1.is_signal = 1
order by duration desc
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
wj-common/src/main/java/net/wanji/common/utils/tool/DateUtil.java
View file @
1894e009
...
@@ -561,6 +561,25 @@ public class DateUtil {
...
@@ -561,6 +561,25 @@ public class DateUtil {
return
midNight
;
return
midNight
;
}
}
/**
* 将当前日期转化为00点
* @param date
* @param offset
* @return
*/
public
static
LocalDateTime
getLastDayMidNight
(
LocalDateTime
date
,
Integer
offset
)
{
LocalDateTime
localDateTime
=
date
.
plusDays
(
offset
);
LocalDate
localDate
=
localDateTime
.
toLocalDate
();
LocalTime
startTime
=
LocalTime
.
MIDNIGHT
;
LocalDateTime
midNight
=
LocalDateTime
.
of
(
localDate
,
startTime
);
return
midNight
;
}
public
static
void
main
(
String
[]
args
)
{
LocalDateTime
lastDayMidNight
=
getLastDayMidNight
(
LocalDateTime
.
now
(),
-
7
);
System
.
err
.
println
(
lastDayMidNight
);
}
/**
/**
* 对当前日期进行加减小时返回日期
* 对当前日期进行加减小时返回日期
* @param offset
* @param offset
...
...
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