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
2e5b5215
Commit
2e5b5215
authored
Oct 26, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 态势监测-表格实时推送
parent
e5adda23
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
3 deletions
+80
-3
CrossIdAndIsFirstBO.java
...e/src/main/java/net/wanji/opt/bo/CrossIdAndIsFirstBO.java
+19
-0
TrendController.java
...c/main/java/net/wanji/opt/controller/TrendController.java
+13
-2
TrendService.java
...ice/src/main/java/net/wanji/opt/service/TrendService.java
+3
-0
TrendServiceImpl.java
...ain/java/net/wanji/opt/service/impl/TrendServiceImpl.java
+45
-1
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/bo/CrossIdAndIsFirstBO.java
0 → 100644
View file @
2e5b5215
package
net
.
wanji
.
opt
.
bo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author Kent HAN
* @date 2023/6/9 13:52
*/
@Data
@ApiModel
(
value
=
"CrossIdAndIsFirstBO"
,
description
=
"表格实时推送"
)
public
class
CrossIdAndIsFirstBO
{
@ApiModelProperty
(
value
=
"路口ID"
)
private
String
crossId
;
@ApiModelProperty
(
value
=
"是否初次调用 0否 1是"
)
private
Integer
isFirstInvoke
;
}
signal-optimize-service/src/main/java/net/wanji/opt/controller/TrendController.java
View file @
2e5b5215
...
@@ -7,7 +7,6 @@ import io.swagger.annotations.ApiResponses;
...
@@ -7,7 +7,6 @@ import io.swagger.annotations.ApiResponses;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.databus.bo.CrossIdBO
;
import
net.wanji.databus.bo.CrossIdBO
;
import
net.wanji.opt.bo.*
;
import
net.wanji.opt.bo.*
;
import
net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO
;
import
net.wanji.opt.dto.trend.AbnormalCrossListDTO
;
import
net.wanji.opt.dto.trend.AbnormalCrossListDTO
;
import
net.wanji.opt.dto.trend.EventAlarmDTO
;
import
net.wanji.opt.dto.trend.EventAlarmDTO
;
import
net.wanji.opt.dto.trend.GreenwaveListDTO
;
import
net.wanji.opt.dto.trend.GreenwaveListDTO
;
...
@@ -178,7 +177,7 @@ public class TrendController {
...
@@ -178,7 +177,7 @@ public class TrendController {
@PostMapping
(
value
=
"/countRealTime"
,
@PostMapping
(
value
=
"/countRealTime"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
AddOrUpdateSceneDT
O
.
class
),
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
CountRealTimeV
O
.
class
),
})
})
public
JsonViewObject
countRealTime
(
@RequestBody
CrossIdBO
crossIdBO
)
{
public
JsonViewObject
countRealTime
(
@RequestBody
CrossIdBO
crossIdBO
)
{
String
crossId
=
crossIdBO
.
getCrossId
();
String
crossId
=
crossIdBO
.
getCrossId
();
...
@@ -197,4 +196,16 @@ public class TrendController {
...
@@ -197,4 +196,16 @@ public class TrendController {
TableQueryVO
tableQueryVO
=
trendService
.
tableQuery
(
crossIdAndTimeSpanBO
);
TableQueryVO
tableQueryVO
=
trendService
.
tableQuery
(
crossIdAndTimeSpanBO
);
return
JsonViewObject
.
newInstance
().
success
(
tableQueryVO
);
return
JsonViewObject
.
newInstance
().
success
(
tableQueryVO
);
}
}
@ApiOperation
(
value
=
"表格实时推送"
,
notes
=
"表格实时推送"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/tableRealTime"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
TableQueryVO
.
class
),
})
public
JsonViewObject
tableRealTime
(
@RequestBody
CrossIdAndIsFirstBO
crossIdAndIsFirstBO
)
{
TableQueryVO
tableRealTimeVO
=
trendService
.
tableRealTime
(
crossIdAndIsFirstBO
);
return
JsonViewObject
.
newInstance
().
success
(
tableRealTimeVO
);
}
}
}
\ No newline at end of file
signal-optimize-service/src/main/java/net/wanji/opt/service/TrendService.java
View file @
2e5b5215
...
@@ -41,4 +41,7 @@ public interface TrendService {
...
@@ -41,4 +41,7 @@ public interface TrendService {
CountRealTimeVO
countRealTime
(
String
crossId
);
CountRealTimeVO
countRealTime
(
String
crossId
);
TableQueryVO
tableQuery
(
CrossIdAndTimeSpanBO
crossIdAndTimeSpanBO
);
TableQueryVO
tableQuery
(
CrossIdAndTimeSpanBO
crossIdAndTimeSpanBO
);
TableQueryVO
tableRealTime
(
CrossIdAndIsFirstBO
crossIdAndIsFirstBO
);
}
}
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/TrendServiceImpl.java
View file @
2e5b5215
...
@@ -39,6 +39,7 @@ import java.text.SimpleDateFormat;
...
@@ -39,6 +39,7 @@ import java.text.SimpleDateFormat;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.ZoneId
;
import
java.time.ZonedDateTime
;
import
java.time.ZonedDateTime
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
...
@@ -93,6 +94,11 @@ public class TrendServiceImpl implements TrendService {
...
@@ -93,6 +94,11 @@ public class TrendServiceImpl implements TrendService {
put
(
8
,
1
);
put
(
8
,
1
);
}};
}};
// 表格实时推送开始时间
private
Date
tableRealTimeFirstDate
;
// 表格周期推送开始时间
private
Date
tableCycleFirstDate
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
public
TrendServiceImpl
(
GreenwaveInfoMapper
greenwaveInfoMapper
,
BaseCrossInfoMapper
baseCrossInfoMapper
,
public
TrendServiceImpl
(
GreenwaveInfoMapper
greenwaveInfoMapper
,
BaseCrossInfoMapper
baseCrossInfoMapper
,
...
@@ -1079,6 +1085,40 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1079,6 +1085,40 @@ public class TrendServiceImpl implements TrendService {
return
tableQueryVO
;
return
tableQueryVO
;
}
}
@Override
public
TableQueryVO
tableRealTime
(
CrossIdAndIsFirstBO
crossIdAndIsFirstBO
)
{
String
crossId
=
crossIdAndIsFirstBO
.
getCrossId
();
Integer
isFirstInvoke
=
crossIdAndIsFirstBO
.
getIsFirstInvoke
();
// 如果是初次调用,需初始化开始时间
if
(
1
==
isFirstInvoke
)
{
initFirstDate
();
}
// 以当前时间为结束时间
Date
endDate
=
new
Date
();
TableQueryVO
tableQueryVO
=
new
TableQueryVO
();
// todo 查询秒级数据
// 查询周期数据
int
startTimeStamp
=
(
int
)
(
tableCycleFirstDate
.
getTime
()
/
1000
);
int
endTimeStamp
=
(
int
)
(
endDate
.
getTime
()
/
1000
);
List
<
CrossLaneDataHistPOExt
>
poExtList
=
crossLaneDataHistMapper
.
selectByCrossIdAndTimeSpan
(
crossId
,
startTimeStamp
,
endTimeStamp
);
tableQueryVO
.
setCycleData
(
buildCycleData
(
poExtList
));
return
tableQueryVO
;
}
private
void
initFirstDate
()
{
tableRealTimeFirstDate
=
new
Date
();
// 将当前时间向前推10分钟
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
tenMinutesAgo
=
now
.
minus
(
10
,
ChronoUnit
.
MINUTES
);
Date
resultDate
=
Date
.
from
(
tenMinutesAgo
.
atZone
(
ZoneId
.
systemDefault
()).
toInstant
());
tableCycleFirstDate
=
resultDate
;
}
private
List
<
TableQueryVO
.
CycleDataElement
>
buildCycleData
(
List
<
CrossLaneDataHistPOExt
>
poExtList
)
{
private
List
<
TableQueryVO
.
CycleDataElement
>
buildCycleData
(
List
<
CrossLaneDataHistPOExt
>
poExtList
)
{
List
<
TableQueryVO
.
CycleDataElement
>
res
=
new
ArrayList
<>();
List
<
TableQueryVO
.
CycleDataElement
>
res
=
new
ArrayList
<>();
...
@@ -1112,7 +1152,11 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1112,7 +1152,11 @@ public class TrendServiceImpl implements TrendService {
res
.
add
(
vo
);
res
.
add
(
vo
);
}
}
return
res
;
List
<
TableQueryVO
.
CycleDataElement
>
sortedRes
=
res
.
stream
()
.
sorted
(
Comparator
.
comparing
(
TableQueryVO
.
CycleDataElement
::
getTime
))
.
collect
(
Collectors
.
toList
());
return
sortedRes
;
}
}
private
MainlineSchemeAnalysisVO
.
GreenwaveData
findMatchingData
(
private
MainlineSchemeAnalysisVO
.
GreenwaveData
findMatchingData
(
...
...
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