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
f708007b
Commit
f708007b
authored
Dec 01, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 干线列表查询优化
parent
21927e5b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
5 deletions
+46
-5
TrendServiceImpl.java
...ain/java/net/wanji/opt/service/impl/TrendServiceImpl.java
+37
-1
GreenBeltInfoVO.java
...rvice/src/main/java/net/wanji/opt/vo/GreenBeltInfoVO.java
+1
-1
DoubleToTwoDecimalPlacesSerializer.java
...ji/databus/config/DoubleToTwoDecimalPlacesSerializer.java
+3
-3
GreenwaveListVO.java
...s/src/main/java/net/wanji/databus/vo/GreenwaveListVO.java
+5
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/TrendServiceImpl.java
View file @
f708007b
...
@@ -193,7 +193,43 @@ public class TrendServiceImpl implements TrendService {
...
@@ -193,7 +193,43 @@ public class TrendServiceImpl implements TrendService {
Integer
status
=
greenwaveListDTO
.
getStatus
();
Integer
status
=
greenwaveListDTO
.
getStatus
();
String
name
=
greenwaveListDTO
.
getName
();
String
name
=
greenwaveListDTO
.
getName
();
Integer
type
=
greenwaveListDTO
.
getType
();
Integer
type
=
greenwaveListDTO
.
getType
();
List
<
GreenwaveListVO
>
greenwaveListVOList
=
greenwaveInfoMapper
.
listGreenwave
(
status
,
name
,
type
);
List
<
GreenwaveListVO
>
greenDirList
=
greenwaveInfoMapper
.
listGreenwave
(
status
,
name
,
type
);
// 数据库中包含正反绿波 转化成双向
List
<
GreenwaveListVO
>
greenwaveListVOList
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
greenDirList
))
{
Map
<
Integer
,
List
<
GreenwaveListVO
>>
greenMap
=
greenDirList
.
stream
().
collect
(
Collectors
.
groupingBy
(
GreenwaveListVO:
:
getId
));
for
(
Map
.
Entry
<
Integer
,
List
<
GreenwaveListVO
>>
entry
:
greenMap
.
entrySet
())
{
Integer
greenId
=
entry
.
getKey
();
List
<
GreenwaveListVO
>
value
=
entry
.
getValue
();
if
(
Objects
.
equals
(
1
,
value
.
size
()))
{
greenwaveListVOList
.
addAll
(
value
);
}
if
(
Objects
.
equals
(
2
,
value
.
size
()))
{
Double
speed
=
0.0
;
Double
trafficIndex
=
1.0
;
int
travelTime
=
0
;
GreenwaveListVO
wDirVo
=
new
GreenwaveListVO
();
for
(
GreenwaveListVO
greenwaveListVO
:
value
)
{
speed
+=
greenwaveListVO
.
getSpeed
()
==
null
?
0.0
:
greenwaveListVO
.
getSpeed
();
trafficIndex
+=
greenwaveListVO
.
getTrafficIndex
()
==
null
?
0.0
:
greenwaveListVO
.
getTrafficIndex
();
travelTime
+=
greenwaveListVO
.
getTravelTime
();
wDirVo
.
setId
(
greenId
);
wDirVo
.
setName
(
greenwaveListVO
.
getName
());
wDirVo
.
setWkt
(
greenwaveListVO
.
getWkt
());
wDirVo
.
setDuration
(
greenwaveListVO
.
getDuration
());
wDirVo
.
setStartTime
(
greenwaveListVO
.
getStartTime
());
wDirVo
.
setRealtimeStatus
(
greenwaveListVO
.
getRealtimeStatus
());
wDirVo
.
setInfoStatus
(
greenwaveListVO
.
getInfoStatus
());
}
wDirVo
.
setSpeed
(
speed
/
2
);
wDirVo
.
setTrafficIndex
(
trafficIndex
/
2
<
1
?
1
:
trafficIndex
/
2
);
wDirVo
.
setTravelTime
(
travelTime
/
2
);
greenwaveListVOList
.
add
(
wDirVo
);
}
}
}
// 3、4都算拥堵
// 3、4都算拥堵
if
(
status
!=
null
&&
status
==
3
)
{
if
(
status
!=
null
&&
status
==
3
)
{
List
<
GreenwaveListVO
>
extraList
=
greenwaveInfoMapper
.
listGreenwave
(
4
,
name
,
type
);
List
<
GreenwaveListVO
>
extraList
=
greenwaveInfoMapper
.
listGreenwave
(
4
,
name
,
type
);
...
...
signal-optimize-service/src/main/java/net/wanji/opt/vo/GreenBeltInfoVO.java
View file @
f708007b
...
@@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
...
@@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
net.wanji.
opt
.config.DoubleToTwoDecimalPlacesSerializer
;
import
net.wanji.
databus
.config.DoubleToTwoDecimalPlacesSerializer
;
import
java.util.List
;
import
java.util.List
;
...
...
signal-optimize-service/src/main/java/net/wanji/opt
/config/DoubleToTwoDecimalPlacesSerializer.java
→
wj-databus/src/main/java/net/wanji/databus
/config/DoubleToTwoDecimalPlacesSerializer.java
View file @
f708007b
package
net
.
wanji
.
opt
.
config
;
package
net
.
wanji
.
databus
.
config
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.JsonSerializer
;
import
com.fasterxml.jackson.databind.JsonSerializer
;
...
@@ -9,7 +9,7 @@ import java.text.DecimalFormat;
...
@@ -9,7 +9,7 @@ import java.text.DecimalFormat;
/**
/**
* @author duanruiming
* @author duanruiming
* @date 2024/1
1/20 19:00
* @date 2024/1
2/01 16:17
*/
*/
public
class
DoubleToTwoDecimalPlacesSerializer
extends
JsonSerializer
<
Double
>
{
public
class
DoubleToTwoDecimalPlacesSerializer
extends
JsonSerializer
<
Double
>
{
private
static
final
DecimalFormat
df
=
new
DecimalFormat
(
"#.00"
);
private
static
final
DecimalFormat
df
=
new
DecimalFormat
(
"#.00"
);
...
...
wj-databus/src/main/java/net/wanji/databus/vo/GreenwaveListVO.java
View file @
f708007b
package
net
.
wanji
.
databus
.
vo
;
package
net
.
wanji
.
databus
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
net.wanji.databus.config.DoubleToTwoDecimalPlacesSerializer
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -22,6 +25,7 @@ public class GreenwaveListVO {
...
@@ -22,6 +25,7 @@ public class GreenwaveListVO {
@ApiModelProperty
(
value
=
"路口状态:1畅通;2缓行;3拥堵;5未知"
)
@ApiModelProperty
(
value
=
"路口状态:1畅通;2缓行;3拥堵;5未知"
)
private
Integer
realtimeStatus
;
private
Integer
realtimeStatus
;
@ApiModelProperty
(
value
=
"拥堵指数"
)
@ApiModelProperty
(
value
=
"拥堵指数"
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
trafficIndex
;
private
Double
trafficIndex
;
@ApiModelProperty
(
value
=
"开始时间 格式 08:20:23"
)
@ApiModelProperty
(
value
=
"开始时间 格式 08:20:23"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"HH:mm:ss"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"HH:mm:ss"
,
timezone
=
"GMT+8"
)
...
@@ -36,6 +40,7 @@ public class GreenwaveListVO {
...
@@ -36,6 +40,7 @@ public class GreenwaveListVO {
@ApiModelProperty
(
value
=
"行程时间"
)
@ApiModelProperty
(
value
=
"行程时间"
)
private
int
travelTime
;
private
int
travelTime
;
@ApiModelProperty
(
value
=
"行程速度"
)
@ApiModelProperty
(
value
=
"行程速度"
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
speed
;
private
Double
speed
;
@ApiModelProperty
(
value
=
"路口列表"
)
@ApiModelProperty
(
value
=
"路口列表"
)
private
List
<
CrossListElement
>
crossList
;
private
List
<
CrossListElement
>
crossList
;
...
...
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