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
bc8d9c28
Commit
bc8d9c28
authored
Apr 07, 2025
by
duwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标导出接口开发
parent
ffb125e1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
205 additions
and
19 deletions
+205
-19
TrendController.java
...c/main/java/net/wanji/opt/controller/TrendController.java
+47
-5
TrendService.java
...ice/src/main/java/net/wanji/opt/service/TrendService.java
+13
-1
TrendServiceImpl.java
...ain/java/net/wanji/opt/service/impl/TrendServiceImpl.java
+142
-13
CommonCrossIdDateTimeVO.java
...c/main/java/net/wanji/opt/vo/CommonCrossIdDateTimeVO.java
+3
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controller/TrendController.java
View file @
bc8d9c28
...
...
@@ -418,22 +418,64 @@ public class TrendController {
}
@ApiOperation
(
value
=
"周期导出功能"
,
notes
=
"周期导出功能"
)
/**
* 周期车道数据导出
* @param lanePeriodVO
* @param response
* @throws Exception
*/
@ApiOperation
(
value
=
"周期车道数据导出功能"
,
notes
=
"周期导出功能"
)
@PostMapping
(
value
=
"/periodExcel"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
HttpServletResponse
.
class
),
})
public
void
period
Excel
(
@RequestBody
CommonCrossIdDateTimeVO
crossIdDateTime
VO
,
HttpServletResponse
response
)
throws
Exception
{
trendService
.
period
Excel
(
crossIdDateTime
VO
,
response
);
public
void
period
LaneExcel
(
@RequestBody
LanePeriodVO
lanePeriod
VO
,
HttpServletResponse
response
)
throws
Exception
{
trendService
.
period
LaneExcel
(
lanePeriod
VO
,
response
);
}
/**
* 周期转向数据导出
* @param periodTurnVO
* @param response
* @throws Exception
*/
@ApiOperation
(
value
=
"周期转向数据导出功能"
,
notes
=
"周期转向数据导出功能"
)
@PostMapping
(
value
=
"/periodTurnExcel"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
HttpServletResponse
.
class
),
})
public
void
periodTurnExcel
(
@RequestBody
LanePeriodTurnVO
lanePeriodTurnVO
,
HttpServletResponse
response
)
throws
Exception
{
trendService
.
periodTurnExcel
(
lanePeriodTurnVO
,
response
);
public
void
periodTurnExcel
(
@RequestBody
LanePeriodTurnVO
periodTurnVO
,
HttpServletResponse
response
)
throws
Exception
{
trendService
.
periodTurnExcel
(
periodTurnVO
,
response
);
}
/**
* 周期方向数据导出
* @param directionVO
* @param response
* @throws Exception
*/
@ApiOperation
(
value
=
"周期方向数据导出功能"
,
notes
=
"周期转向数据导出功能"
)
@PostMapping
(
value
=
"/periodDirExcel"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
HttpServletResponse
.
class
),
})
public
void
directionExcel
(
@RequestBody
PeriodDirectionVO
directionVO
,
HttpServletResponse
response
)
throws
Exception
{
trendService
.
periodDirectionExcel
(
directionVO
,
response
);
}
/**
* 周期路口数据导出
* @param crossingVO
* @param response
* @throws Exception
*/
@ApiOperation
(
value
=
"周期路口数据导出功能"
,
notes
=
"周期转向数据导出功能"
)
@PostMapping
(
value
=
"/periodCrossExcel"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
HttpServletResponse
.
class
),
})
public
void
crossExcel
(
@RequestBody
PeriodCrossingVO
crossingVO
,
HttpServletResponse
response
)
throws
Exception
{
trendService
.
periodCrossExcel
(
crossingVO
,
response
);
}
@ApiOperation
(
value
=
"车道快照数据导出功能"
,
notes
=
"车道快照数据导出功能"
)
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/TrendService.java
View file @
bc8d9c28
...
...
@@ -89,9 +89,21 @@ public interface TrendService {
List
<
LaneIdAliasNameVO
>
laneIdList
(
CommonCrossIdVO
commonCrossIdVO
)
throws
Exception
;
void
periodExcel
(
CommonCrossIdDateTimeVO
crossIdDateTimeVO
,
HttpServletResponse
response
)
throws
Exception
;
//
void periodExcel(CommonCrossIdDateTimeVO crossIdDateTimeVO, HttpServletResponse response) throws Exception;
void
periodTurnExcel
(
LanePeriodTurnVO
lanePeriodTurnVO
,
HttpServletResponse
response
)
throws
Exception
;
/**
* 周期方向数据导出
* @param turnVO
* @param response
*/
void
periodDirectionExcel
(
PeriodDirectionVO
turnVO
,
HttpServletResponse
response
);
/**
* 周期路口数据导出
* @param turnVO
* @param response
*/
void
periodCrossExcel
(
PeriodCrossingVO
turnVO
,
HttpServletResponse
response
);
void
laneSnapshotExcel
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
,
HttpServletResponse
response
)
throws
Exception
;
}
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/TrendServiceImpl.java
View file @
bc8d9c28
...
...
@@ -2921,26 +2921,49 @@ public class TrendServiceImpl implements TrendService {
}
}
@Override
public
void
periodExcel
(
CommonCrossIdDateTimeVO
crossIdDateTimeVO
,
HttpServletResponse
response
)
throws
Exception
{
String
crossId
=
crossIdDateTimeVO
.
getCrossId
();
Date
startDate
=
crossIdDateTimeVO
.
getStart
();
Date
endDate
=
crossIdDateTimeVO
.
getEnd
();
String
startStr
=
DateUtil
.
format
(
startDate
,
DateStyle
.
YYYY_MM_DD_HH_MM
.
getValue
());
String
endStr
=
DateUtil
.
format
(
endDate
,
DateStyle
.
MM_DD_HH_MM
.
getValue
());
int
start
=
(
int
)
(
startDate
.
getTime
()
/
1000
);
int
end
=
(
int
)
(
endDate
.
getTime
()
/
1000
);
/**
* 周期车道数据导出
* @param lanePeriodVO
* @param response
* @throws Exception
*/
public
void
periodLaneExcel
(
LanePeriodVO
lanePeriodVO
,
HttpServletResponse
response
)
throws
Exception
{
String
crossId
=
lanePeriodVO
.
getCrossId
();
int
start
=
(
int
)
(
lanePeriodVO
.
getStart
().
getTime
()
/
1000
);
int
end
=
(
int
)
(
lanePeriodVO
.
getEnd
().
getTime
()
/
1000
);
String
startStr
=
DateUtil
.
format
(
lanePeriodVO
.
getStart
(),
DateStyle
.
YYYY_MM_DD_HH_MM
.
getValue
());
String
endStr
=
DateUtil
.
format
(
lanePeriodVO
.
getEnd
(),
DateStyle
.
MM_DD_HH_MM
.
getValue
());
String
ids
=
lanePeriodVO
.
getIds
();
List
<
String
>
idsList
=
null
;
if
(!
StringUtils
.
isBlank
(
ids
))
{
idsList
=
Arrays
.
asList
(
ids
.
split
(
","
));
}
//分析粒度【5m:五分钟 10m:10分钟 30m:30分钟 1h:一小时】
String
granularity
=
lanePeriodVO
.
getGranularity
();
if
(
StringUtils
.
isBlank
(
granularity
))
{
granularity
=
"5"
;
}
else
{
granularity
=
granularity
.
replace
(
"m"
,
""
).
replace
(
"h"
,
""
);
}
// 查询周期数据
List
<
CrossLaneDataHist
POExt
>
poExtList
=
crossLaneDataHistMapper
.
selectByCrossIdAndTimeSpan
(
crossId
,
start
,
end
);
List
<
TableQueryVO
.
CycleDataElement
>
dataList
=
buildCycleData
(
crossId
,
poExtList
);
List
<
CrossLaneDataHist
VOExt
>
poExtList
=
crossLaneDataHistMapper
.
selectByCrossIdAndTimeIds
(
crossId
,
start
,
end
,
granularity
,
idsList
);
List
<
TableQueryVO
.
CycleDataElement
>
dataList
=
build
Lane
CycleData
(
crossId
,
poExtList
);
String
crossName
=
crossInfoCache
.
getCrossName
(
crossId
);
ExcelExportUtils
.
exportExcel
(
response
,
startStr
,
endStr
,
dataList
,
crossName
.
concat
(
"车道周期数据"
),
TableQueryVO
.
CycleDataElement
.
class
);
}
/**
* 周期转向数据导出
* @param turnVO
* @param response
* @throws Exception
*/
@Override
public
void
periodTurnExcel
(
LanePeriodTurnVO
lanePeriodTurnVO
,
HttpServletResponse
response
)
throws
Exception
{
public
void
periodTurnExcel
(
LanePeriodTurnVO
turnVO
,
HttpServletResponse
response
)
throws
Exception
{
/*
String startStr = null;
String endStr = null;
List<TurnDataIndexExcelVO> result = new ArrayList<>();
...
...
@@ -3036,14 +3059,120 @@ public class TrendServiceImpl implements TrendService {
}
}
}
*/
try
{
//路口
String
crossId
=
turnVO
.
getCrossId
();
int
start
=
(
int
)
(
turnVO
.
getStart
().
getTime
()
/
1000
);
int
end
=
(
int
)
(
turnVO
.
getEnd
().
getTime
()
/
1000
);
String
startStr
=
DateUtil
.
format
(
turnVO
.
getStart
(),
DateStyle
.
YYYY_MM_DD_HH_MM
.
getValue
());
String
endStr
=
DateUtil
.
format
(
turnVO
.
getEnd
(),
DateStyle
.
MM_DD_HH_MM
.
getValue
());
//转向 用逗号分隔
String
turnType
=
turnVO
.
getTurnType
();
List
<
String
>
turnTypeList
=
null
;
if
(!
StringUtils
.
isBlank
(
turnType
))
{
turnTypeList
=
Arrays
.
asList
(
turnType
.
split
(
","
));
}
//驶入方向 用逗号分隔
String
inDir
=
turnVO
.
getInDir
();
List
<
Integer
>
inDirList
=
null
;
if
(!
StringUtils
.
isBlank
(
inDir
))
{
inDirList
=
Arrays
.
stream
(
inDir
.
split
(
","
)).
map
(
Integer:
:
parseInt
).
collect
(
Collectors
.
toList
());
}
//分析粒度【5m:五分钟 10m:10分钟 30m:30分钟 1h:一小时】
String
granularity
=
turnVO
.
getGranularity
();
if
(
StringUtils
.
isBlank
(
granularity
))
{
granularity
=
"5"
;
}
else
{
granularity
=
granularity
.
replace
(
"m"
,
""
).
replace
(
"h"
,
""
);;
}
// 查询周期数据
List
<
CrossTurnDataHistVO
>
vo
=
crossTurnDataHistMapper
.
selectByCrossIdTurn
(
crossId
,
start
,
end
,
granularity
,
turnTypeList
,
inDirList
);
List
<
CrossingTurnQueryVO
.
CycleDataElement
>
result
=
buildCrossingTurnCycleData
(
crossId
,
vo
);
String
crossName
=
crossInfoCache
.
getCrossName
(
crossId
);
ExcelExportUtils
.
exportExcel
(
response
,
startStr
,
endStr
,
result
,
crossName
.
concat
(
"转向周期数据"
),
TurnDataIndexExcelVO
.
class
);
ExcelExportUtils
.
exportExcel
(
response
,
startStr
,
endStr
,
result
,
crossName
.
concat
(
"转向周期数据"
),
CrossingTurnQueryVO
.
CycleDataElement
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"导出转向数据异常:"
,
e
);
throw
new
OptServiceException
(
e
);
}
}
/**
* 周期方向数据导出
* @param directionVO
* @param response
* @throws Exception
*/
@Override
public
void
periodDirectionExcel
(
PeriodDirectionVO
directionVO
,
HttpServletResponse
response
)
{
try
{
//路口
String
crossId
=
directionVO
.
getCrossId
();
int
start
=
(
int
)
(
directionVO
.
getStart
().
getTime
()
/
1000
);
int
end
=
(
int
)
(
directionVO
.
getEnd
().
getTime
()
/
1000
);
String
startStr
=
DateUtil
.
format
(
directionVO
.
getStart
(),
DateStyle
.
YYYY_MM_DD_HH_MM
.
getValue
());
String
endStr
=
DateUtil
.
format
(
directionVO
.
getEnd
(),
DateStyle
.
MM_DD_HH_MM
.
getValue
());
//方向
String
dirType
=
directionVO
.
getDirection
();
List
<
Integer
>
dirTypeList
=
null
;
if
(!
StringUtils
.
isBlank
(
dirType
))
{
dirTypeList
=
Arrays
.
stream
(
dirType
.
split
(
","
)).
map
(
Integer:
:
parseInt
).
collect
(
Collectors
.
toList
());
}
//分析粒度【5m:五分钟 10m:10分钟 30m:30分钟 1h:一小时】
String
granularity
=
directionVO
.
getGranularity
();
if
(
StringUtils
.
isBlank
(
granularity
))
{
granularity
=
"5"
;
}
else
{
granularity
=
granularity
.
replace
(
"m"
,
""
).
replace
(
"h"
,
""
);;
}
// 查询周期数据
List
<
CrossDirDataHistVO
>
vo
=
crossDirDataHistMapper
.
selectByCrossIdAndStartEndDir
(
crossId
,
start
,
end
,
dirTypeList
,
granularity
);
List
<
CrossingDirectionQueryVO
.
CycleDataElement
>
result
=
buildCrossingDirectionCycleData
(
crossId
,
vo
);
String
crossName
=
crossInfoCache
.
getCrossName
(
crossId
);
ExcelExportUtils
.
exportExcel
(
response
,
startStr
,
endStr
,
result
,
crossName
.
concat
(
"方向周期数据"
),
CrossingDirectionQueryVO
.
CycleDataElement
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"导出方向数据异常:"
,
e
);
throw
new
OptServiceException
(
e
);
}
}
/**
* 周期路口数据导出
* @param crossingVO
* @param response
* @throws Exception
*/
@Override
public
void
periodCrossExcel
(
PeriodCrossingVO
crossingVO
,
HttpServletResponse
response
)
{
try
{
String
crossId
=
crossingVO
.
getCrossId
();
int
start
=
(
int
)
(
crossingVO
.
getStart
().
getTime
()
/
1000
);
int
end
=
(
int
)
(
crossingVO
.
getEnd
().
getTime
()
/
1000
);
String
startStr
=
DateUtil
.
format
(
crossingVO
.
getStart
(),
DateStyle
.
YYYY_MM_DD_HH_MM
.
getValue
());
String
endStr
=
DateUtil
.
format
(
crossingVO
.
getEnd
(),
DateStyle
.
MM_DD_HH_MM
.
getValue
());
//分析粒度【5m:五分钟 10m:10分钟 30m:30分钟 1h:一小时】
String
granularity
=
crossingVO
.
getGranularity
();
if
(
StringUtils
.
isBlank
(
granularity
))
{
granularity
=
"5"
;
}
else
{
granularity
=
granularity
.
replace
(
"m"
,
""
).
replace
(
"h"
,
""
);
}
// 查询周期数据
List
<
CrossDataHistVO
>
vo
=
crossDataHistMapper
.
selectByCrossIdAndStartEndStat
(
crossId
,
start
,
end
,
granularity
);
List
<
CrossingQueryVO
.
CycleDataElement
>
result
=
buildCrossingCycleData
(
crossId
,
vo
);
String
crossName
=
crossInfoCache
.
getCrossName
(
crossId
);
ExcelExportUtils
.
exportExcel
(
response
,
startStr
,
endStr
,
result
,
crossName
.
concat
(
"路口周期数据"
),
CrossingQueryVO
.
CycleDataElement
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"导出路口数据异常:"
,
e
);
throw
new
OptServiceException
(
e
);
}
}
@Override
public
void
laneSnapshotExcel
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
,
HttpServletResponse
response
)
throws
Exception
{
try
{
...
...
signal-optimize-service/src/main/java/net/wanji/opt/vo/CommonCrossIdDateTimeVO.java
View file @
bc8d9c28
...
...
@@ -23,6 +23,9 @@ public class CommonCrossIdDateTimeVO {
@ApiModelProperty
(
value
=
"路口ID"
)
@NotBlank
(
message
=
"路口编号不能为空"
)
private
String
crossId
;
@ApiModelProperty
(
value
=
"车道IDs"
)
@NotBlank
(
message
=
"车道ids不能为空"
)
private
String
ids
;
@ApiModelProperty
(
value
=
"开始时间"
)
@NotNull
(
message
=
"开始日期不能为空"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
...
...
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