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
c5aa8951
Commit
c5aa8951
authored
Apr 14, 2025
by
duwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
交通指标接口mock数据
parent
8d4624d6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
6 deletions
+26
-6
TrendController.java
...c/main/java/net/wanji/opt/controller/TrendController.java
+20
-0
RunningEvaluateServiceImpl.java
...et/wanji/opt/service/impl/RunningEvaluateServiceImpl.java
+6
-6
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controller/TrendController.java
View file @
c5aa8951
package
net
.
wanji
.
opt
.
controller
;
import
cn.hutool.core.date.DateUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
...
...
@@ -16,6 +17,7 @@ import net.wanji.opt.po.trend.AnalysisRidTurnIndicators;
import
net.wanji.opt.po.trend.HoloEventInfoPO
;
import
net.wanji.opt.service.impl.TrendServiceImpl
;
import
net.wanji.opt.vo.*
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -34,6 +36,8 @@ import java.util.List;
@RequestMapping
(
"/trend"
)
@RestController
public
class
TrendController
{
@Value
(
"${mock.flag:false}"
)
private
boolean
isMock
=
false
;
private
final
TrendServiceImpl
trendService
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
...
...
@@ -292,6 +296,10 @@ public class TrendController {
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
TableQueryVO
.
CycleDataElement
.
class
),
})
public
JsonViewObject
laneTrafficIndex
(
@RequestBody
LanePeriodVO
crossIdDateTimeVO
)
throws
Exception
{
if
(
isMock
==
true
){
crossIdDateTimeVO
.
setStart
(
DateUtil
.
parse
(
"2025-04-09 00:00:00"
,
"yyyy-MM-dd HH:mm:ss"
));
crossIdDateTimeVO
.
setEnd
(
DateUtil
.
parse
(
"2025-04-12 00:00:00"
,
"yyyy-MM-dd HH:mm:ss"
));
}
List
<
TableQueryVO
.
CycleDataElement
>
result
=
trendService
.
laneTrafficIndex
(
crossIdDateTimeVO
);
return
JsonViewObject
.
newInstance
().
success
(
result
);
}
...
...
@@ -310,6 +318,10 @@ public class TrendController {
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
AnalysisRidTurnIndicators
.
class
),
})
public
JsonViewObject
lanePeriodTurnData
(
@RequestBody
LanePeriodTurnVO
lanePeriodTurnVO
)
throws
Exception
{
if
(
isMock
==
true
){
lanePeriodTurnVO
.
setStart
(
DateUtil
.
parse
(
"2025-04-09 00:00:00"
,
"yyyy-MM-dd HH:mm:ss"
));
lanePeriodTurnVO
.
setEnd
(
DateUtil
.
parse
(
"2025-04-12 00:00:00"
,
"yyyy-MM-dd HH:mm:ss"
));
}
String
turns
=
lanePeriodTurnVO
.
getTurns
();
if
(
turns
!=
null
){
StringBuilder
inDir
=
new
StringBuilder
();
...
...
@@ -358,6 +370,10 @@ public class TrendController {
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
AnalysisRidTurnIndicators
.
class
),
})
public
JsonViewObject
periodDirectionData
(
@RequestBody
PeriodDirectionVO
periodDirectionVO
)
throws
Exception
{
if
(
isMock
==
true
){
periodDirectionVO
.
setStart
(
DateUtil
.
parse
(
"2025-04-10 00:00:00"
,
"yyyy-MM-dd HH:mm:ss"
));
periodDirectionVO
.
setEnd
(
DateUtil
.
parse
(
"2025-04-13 00:00:00"
,
"yyyy-MM-dd HH:mm:ss"
));
}
List
<
CrossingDirectionQueryVO
.
CycleDataElement
>
result
=
trendService
.
periodDirectionData
(
periodDirectionVO
);
return
JsonViewObject
.
newInstance
().
success
(
result
);
}
...
...
@@ -383,6 +399,10 @@ public class TrendController {
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
AnalysisRidTurnIndicators
.
class
),
})
public
JsonViewObject
periodDirectionData
(
@RequestBody
PeriodCrossingVO
periodCrossingVO
)
throws
Exception
{
if
(
isMock
==
true
){
periodCrossingVO
.
setStart
(
DateUtil
.
parse
(
"2025-04-09 00:00:00"
,
"yyyy-MM-dd HH:mm:ss"
));
periodCrossingVO
.
setEnd
(
DateUtil
.
parse
(
"2025-04-12 00:00:00"
,
"yyyy-MM-dd HH:mm:ss"
));
}
List
<
CrossingQueryVO
.
CycleDataElement
>
result
=
trendService
.
periodCrossingData
(
periodCrossingVO
);
return
JsonViewObject
.
newInstance
().
success
(
result
);
}
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/RunningEvaluateServiceImpl.java
View file @
c5aa8951
...
...
@@ -161,34 +161,34 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
List
<
CrossDataHistPO
>
congestionEventList
=
buildCongestionEvents
(
crossDataHistPOList
);
// 获取拥堵事件集合
vo
.
setCongestionTimes
(
congestionEventList
.
size
());
vo
.
setCongestionTimes
(
congestionEventList
.
size
());
//拥堵次数
int
congestionSum
=
congestionEventList
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
map
(
CrossDataHistPO:
:
getDuration
)
.
filter
(
Objects:
:
nonNull
)
.
mapToInt
(
Integer:
:
intValue
)
.
sum
();
vo
.
setCongestionSum
(
congestionSum
);
vo
.
setCongestionSum
(
congestionSum
);
//拥堵时长
List
<
CrossDataHistPO
>
unbalanceEventList
=
buildUnbalanceEvents
(
crossDataHistPOList
);
// 获取失衡事件集合
vo
.
setUnbalanceTimes
(
unbalanceEventList
.
size
());
vo
.
setUnbalanceTimes
(
unbalanceEventList
.
size
());
//失衡次数
int
unbalanceSum
=
unbalanceEventList
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
map
(
CrossDataHistPO:
:
getDuration
)
.
filter
(
Objects:
:
nonNull
)
.
mapToInt
(
Integer:
:
intValue
)
.
sum
();
vo
.
setUnbalanceSum
(
unbalanceSum
);
vo
.
setUnbalanceSum
(
unbalanceSum
);
//失衡时长
List
<
CrossDataHistPO
>
spilloverEventList
=
buildSpilloverEvents
(
crossDataHistPOList
);
// 获取溢出事件集合
vo
.
setSpilloverTimes
(
spilloverEventList
.
size
());
vo
.
setSpilloverTimes
(
spilloverEventList
.
size
());
//溢出次数
int
spilloverSum
=
spilloverEventList
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
map
(
CrossDataHistPO:
:
getDuration
)
.
filter
(
Objects:
:
nonNull
)
.
mapToInt
(
Integer:
:
intValue
)
.
sum
();
vo
.
setSpilloverSum
(
spilloverSum
);
vo
.
setSpilloverSum
(
spilloverSum
);
//溢出时长
// 相位空放指标
Date
startDate
=
bo
.
getStartDate
();
...
...
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