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
10fbf0c0
Commit
10fbf0c0
authored
Nov 22, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 绿波时序图接口查询
parent
9ea7c2df
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
168 additions
and
115 deletions
+168
-115
Constants.java
...service/src/main/java/net/wanji/opt/common/Constants.java
+2
-0
DoubleToTwoDecimalPlacesSerializer.java
.../wanji/opt/config/DoubleToTwoDecimalPlacesSerializer.java
+26
-0
GreenBeltKafkaDTO.java
...ce/src/main/java/net/wanji/opt/dto/GreenBeltKafkaDTO.java
+10
-0
KafkaListeners.java
...ice/src/main/java/net/wanji/opt/kafka/KafkaListeners.java
+0
-60
SynthesisConsumerHandler.java
...in/java/net/wanji/opt/kafka/SynthesisConsumerHandler.java
+1
-1
GreenBeltInfoServiceImpl.java
.../net/wanji/opt/service/impl/GreenBeltInfoServiceImpl.java
+100
-50
StrategyGreenBeltController.java
...opt/synthesis/controller/StrategyGreenBeltController.java
+19
-4
GreenBeltInfoVO.java
...rvice/src/main/java/net/wanji/opt/vo/GreenBeltInfoVO.java
+10
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/common/Constants.java
View file @
10fbf0c0
...
@@ -56,5 +56,7 @@ public class Constants {
...
@@ -56,5 +56,7 @@ public class Constants {
* 绿波优化查询缓存key
* 绿波优化查询缓存key
*/
*/
public
static
final
String
GREEN_ID_OPT_KEY
=
"green_opt_"
;
public
static
final
String
GREEN_ID_OPT_KEY
=
"green_opt_"
;
public
static
final
String
GREEN_ID_OPT_CHART_KEY
=
"green_opt_chart_"
;
}
}
\ No newline at end of file
signal-optimize-service/src/main/java/net/wanji/opt/config/DoubleToTwoDecimalPlacesSerializer.java
0 → 100644
View file @
10fbf0c0
package
net
.
wanji
.
opt
.
config
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.JsonSerializer
;
import
com.fasterxml.jackson.databind.SerializerProvider
;
import
java.io.IOException
;
import
java.text.DecimalFormat
;
/**
* @author duanruiming
* @date 2024/11/20 19:00
*/
public
class
DoubleToTwoDecimalPlacesSerializer
extends
JsonSerializer
<
Double
>
{
private
static
final
DecimalFormat
df
=
new
DecimalFormat
(
"#.00"
);
@Override
public
void
serialize
(
Double
value
,
JsonGenerator
gen
,
SerializerProvider
serializers
)
throws
IOException
{
if
(
value
!=
null
)
{
String
formattedValue
=
df
.
format
(
value
);
gen
.
writeString
(
formattedValue
);
}
else
{
gen
.
writeNull
();
}
}
}
\ No newline at end of file
signal-optimize-service/src/main/java/net/wanji/opt/dto/GreenBeltKafkaDTO.java
View file @
10fbf0c0
...
@@ -70,4 +70,14 @@ public class GreenBeltKafkaDTO {
...
@@ -70,4 +70,14 @@ public class GreenBeltKafkaDTO {
private
int
dynamic
;
// 是否动态绿波(1=是,0=否)
private
int
dynamic
;
// 是否动态绿波(1=是,0=否)
@JsonProperty
(
"control_method"
)
@JsonProperty
(
"control_method"
)
private
int
controlMethod
;
// -1=stop by error, 0=no control, 1=control
private
int
controlMethod
;
// -1=stop by error, 0=no control, 1=control
@JsonProperty
(
"travel_time_forward"
)
private
Map
<
String
,
Double
>
travelTimeForward
;
@JsonProperty
(
"travel_time_backward"
)
private
Map
<
String
,
Double
>
travelTimeBackward
;
@JsonProperty
(
"distance_forward"
)
private
Map
<
String
,
Double
>
distanceForward
;
@JsonProperty
(
"distance_backward"
)
private
Map
<
String
,
Double
>
distanceBackward
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/kafka/KafkaListeners.java
deleted
100644 → 0
View file @
9ea7c2df
package
net
.
wanji
.
opt
.
kafka
;
import
lombok.NonNull
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.utils.tool.JacksonUtils
;
import
net.wanji.common.utils.tool.StringUtils
;
import
net.wanji.opt.common.Constants
;
import
net.wanji.opt.common.RedisUtils
;
import
net.wanji.opt.service.GreenBeltInfoService
;
import
net.wanji.opt.vo.GreenBeltInfoVO
;
import
org.apache.kafka.clients.consumer.Consumer
;
import
org.springframework.kafka.annotation.KafkaListener
;
import
org.springframework.kafka.listener.KafkaListenerErrorHandler
;
import
org.springframework.kafka.listener.ListenerExecutionFailedException
;
import
org.springframework.messaging.Message
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/**
* @author duanruiming
* @date 2024/11/18 23:40
* @description 消费神思推送kafka数据,不同kafka
*/
@Component
@Slf4j
public
class
KafkaListeners
implements
KafkaListenerErrorHandler
{
@Resource
private
GreenBeltInfoService
greenBeltInfoService
;
@Resource
private
RedisUtils
redisUtils
;
@KafkaListener
(
topics
=
{
"green_belt_info_data"
},
groupId
=
"group2"
,
containerFactory
=
"kafkaListenerContainerFactory2"
)
public
void
receiveGreenBeltInfoData
(
String
message
)
throws
Exception
{
if
(
StringUtils
.
isNotBlank
(
message
))
{
GreenBeltInfoVO
greenBeltInfoVO
=
greenBeltInfoService
.
convertData
(
message
);
greenBeltInfoService
.
save
(
greenBeltInfoVO
);
String
key
=
Constants
.
GREEN_ID_OPT_KEY
.
concat
(
greenBeltInfoVO
.
getGreenId
());
redisUtils
.
set
(
key
,
JacksonUtils
.
getInstance
().
writeValueAsString
(
greenBeltInfoVO
));
}
}
@Override
@NonNull
public
Object
handleError
(
Message
<?>
message
,
ListenerExecutionFailedException
e
)
{
return
new
Object
();
}
@Override
@NonNull
public
Object
handleError
(
Message
<?>
message
,
ListenerExecutionFailedException
exception
,
Consumer
<?,
?>
consumer
)
{
String
errorMessage
=
String
.
format
(
"监听主题:%s,消费者详情:%s,异常信息:%s,消息详情:%s"
,
consumer
.
listTopics
(),
consumer
.
groupMetadata
(),
exception
,
message
);
log
.
error
(
errorMessage
);
return
KafkaListenerErrorHandler
.
super
.
handleError
(
message
,
exception
,
consumer
);
}
}
signal-optimize-service/src/main/java/net/wanji/opt/kafka/SynthesisConsumerHandler.java
View file @
10fbf0c0
...
@@ -35,7 +35,7 @@ public class SynthesisConsumerHandler implements KafkaListenerErrorHandler {
...
@@ -35,7 +35,7 @@ public class SynthesisConsumerHandler implements KafkaListenerErrorHandler {
private
SynthesisOptimizeLogInfoMapper
synthesisOptimizeLogInfoMapper
;
private
SynthesisOptimizeLogInfoMapper
synthesisOptimizeLogInfoMapper
;
private
String
str
=
"{\n"
+
private
String
str
=
"{\n"
+
"
\"cross_id\":\"cross0001\", \n"
+
"\"cross_id\":\"cross0001\", \n"
+
"\t\"control_id\":\"123456\", \n"
+
"\t\"control_id\":\"123456\", \n"
+
"\t\"provider\":\"hisense\", \n"
+
"\t\"provider\":\"hisense\", \n"
+
"\t\"plan_no\":4, \n"
+
"\t\"plan_no\":4, \n"
+
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/GreenBeltInfoServiceImpl.java
View file @
10fbf0c0
...
@@ -3,7 +3,6 @@ package net.wanji.opt.service.impl;
...
@@ -3,7 +3,6 @@ package net.wanji.opt.service.impl;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
net.wanji.common.utils.tool.JacksonUtils
;
import
net.wanji.common.utils.tool.JacksonUtils
;
import
net.wanji.opt.common.Constants
;
import
net.wanji.opt.common.Constants
;
import
net.wanji.opt.common.RedisUtils
;
import
net.wanji.opt.dao.mapper.StrategyGreenOptHistMapper
;
import
net.wanji.opt.dao.mapper.StrategyGreenOptHistMapper
;
import
net.wanji.opt.dto.GreenBeltKafkaDTO
;
import
net.wanji.opt.dto.GreenBeltKafkaDTO
;
import
net.wanji.opt.po.StrategyGreenOptHistEntity
;
import
net.wanji.opt.po.StrategyGreenOptHistEntity
;
...
@@ -49,6 +48,7 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
...
@@ -49,6 +48,7 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
greenBeltInfoVO
.
setDynamic
(
kafkaDTO
.
getDynamic
());
greenBeltInfoVO
.
setDynamic
(
kafkaDTO
.
getDynamic
());
greenBeltInfoVO
.
setControlMethod
(
kafkaDTO
.
getControlMethod
());
greenBeltInfoVO
.
setControlMethod
(
kafkaDTO
.
getControlMethod
());
greenBeltInfoVO
.
setDirGreenDetails
(
dirGreenDetails
);
greenBeltInfoVO
.
setDirGreenDetails
(
dirGreenDetails
);
System
.
err
.
println
(
mapper
.
writeValueAsString
(
greenBeltInfoVO
));
}
}
@Override
@Override
...
@@ -123,6 +123,11 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
...
@@ -123,6 +123,11 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
crossGreenDetail
.
setSpeed
(
speed
);
crossGreenDetail
.
setSpeed
(
speed
);
Double
offset
=
kafkaDTO
.
getOffset
().
get
(
crossId
);
Double
offset
=
kafkaDTO
.
getOffset
().
get
(
crossId
);
crossGreenDetail
.
setOffset
(
offset
);
crossGreenDetail
.
setOffset
(
offset
);
Double
distance
=
kafkaDTO
.
getDistanceBackward
().
get
(
crossId
);
crossGreenDetail
.
setDistance
(
distance
);
Double
travelTime
=
kafkaDTO
.
getTravelTimeBackward
().
get
(
crossId
);
crossGreenDetail
.
setTravelTime
(
travelTime
);
crossGreenDetails
.
add
(
crossGreenDetail
);
crossGreenDetails
.
add
(
crossGreenDetail
);
}
}
// 反向绿波
// 反向绿波
...
@@ -159,6 +164,11 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
...
@@ -159,6 +164,11 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
crossGreenDetail
.
setSpeed
(
speed
);
crossGreenDetail
.
setSpeed
(
speed
);
Double
offset
=
kafkaDTO
.
getOffset
().
get
(
crossId
);
Double
offset
=
kafkaDTO
.
getOffset
().
get
(
crossId
);
crossGreenDetail
.
setOffset
(
offset
);
crossGreenDetail
.
setOffset
(
offset
);
Double
distance
=
kafkaDTO
.
getDistanceForward
().
get
(
crossId
);
crossGreenDetail
.
setDistance
(
distance
);
Double
travelTime
=
kafkaDTO
.
getTravelTimeForward
().
get
(
crossId
);
crossGreenDetail
.
setTravelTime
(
travelTime
);
crossGreenDetails
.
add
(
crossGreenDetail
);
crossGreenDetails
.
add
(
crossGreenDetail
);
}
}
// 正向绿波
// 正向绿波
...
@@ -181,64 +191,88 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
...
@@ -181,64 +191,88 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
"\t\"backward_direction\": \"e2w\",\n"
+
"\t\"backward_direction\": \"e2w\",\n"
+
"\t\"belt_start_backward\": {\n"
+
"\t\"belt_start_backward\": {\n"
+
"\t\t\"13MOD0B5SI0\": 0.0,\n"
+
"\t\t\"13MOD0B5SI0\": 0.0,\n"
+
"\t\t\"13MQJ0B5SI0\":
87
.0,\n"
+
"\t\t\"13MQJ0B5SI0\":
91
.0,\n"
+
"\t\t\"13MS20B5SI0\":
7
.0,\n"
+
"\t\t\"13MS20B5SI0\":
25
.0,\n"
+
"\t\t\"13MUK0B5SH0\":
79
.0,\n"
+
"\t\t\"13MUK0B5SH0\":
0
.0,\n"
+
"\t\t\"13N0F0B5SH0\":
3
.0,\n"
+
"\t\t\"13N0F0B5SH0\":
45
.0,\n"
+
"\t\t\"13N200B5SH0\":
86
.0\n"
+
"\t\t\"13N200B5SH0\":
0
.0\n"
+
"\t},\n"
+
"\t},\n"
+
"\t\"belt_start_forward\": {\n"
+
"\t\"belt_start_forward\": {\n"
+
"\t\t\"13MOD0B5SI0\": 0.0,\n"
+
"\t\t\"13MOD0B5SI0\": 0.0,\n"
+
"\t\t\"13MQJ0B5SI0\":
87
.0,\n"
+
"\t\t\"13MQJ0B5SI0\":
91
.0,\n"
+
"\t\t\"13MS20B5SI0\":
7
.0,\n"
+
"\t\t\"13MS20B5SI0\":
25
.0,\n"
+
"\t\t\"13MUK0B5SH0\":
79
.0,\n"
+
"\t\t\"13MUK0B5SH0\":
0
.0,\n"
+
"\t\t\"13N0F0B5SH0\":
3
.0,\n"
+
"\t\t\"13N0F0B5SH0\":
45
.0,\n"
+
"\t\t\"13N200B5SH0\":
86
.0\n"
+
"\t\t\"13N200B5SH0\":
0
.0\n"
+
"\t},\n"
+
"\t},\n"
+
"\t\"control_duration\":
9
0,\n"
+
"\t\"control_duration\":
1
0,\n"
+
"\t\"control_method\": 1,\n"
+
"\t\"control_method\": 1,\n"
+
"\t\"control_time\": \"2024-11-18T18:39:55\",\n"
+
"\t\"control_time\": \"2024-11-20T18:15:31\",\n"
+
"\t\"cycle\": {\n"
+
"\t\t\"13MOD0B5SI0\": 220.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 220.0,\n"
+
"\t\t\"13MS20B5SI0\": 220.0,\n"
+
"\t\t\"13MUK0B5SH0\": 220.0,\n"
+
"\t\t\"13N0F0B5SH0\": 220.0,\n"
+
"\t\t\"13N200B5SH0\": 220.0\n"
+
"\t},\n"
+
"\t\"distance_backward\": {\n"
+
"\t\t\"13MOD0B5SI0\": -1.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 637.5,\n"
+
"\t\t\"13MS20B5SI0\": 412.49999999999994,\n"
+
"\t\t\"13MUK0B5SH0\": 725.0,\n"
+
"\t\t\"13N0F0B5SH0\": 525.0,\n"
+
"\t\t\"13N200B5SH0\": 450.0\n"
+
"\t},\n"
+
"\t\"distance_forward\": {\n"
+
"\t\t\"13MOD0B5SI0\": 637.5,\n"
+
"\t\t\"13MQJ0B5SI0\": 412.49999999999994,\n"
+
"\t\t\"13MS20B5SI0\": 725.0,\n"
+
"\t\t\"13MUK0B5SH0\": 525.0,\n"
+
"\t\t\"13N0F0B5SH0\": 450.0,\n"
+
"\t\t\"13N200B5SH0\": -1.0\n"
+
"\t},\n"
+
"\t\"dynamic\": 1,\n"
+
"\t\"dynamic\": 1,\n"
+
"\t\"forward_direction\": \"w2e\",\n"
+
"\t\"forward_direction\": \"w2e\",\n"
+
"\t\"green_width_backward\":
35.9999999999999
,\n"
+
"\t\"green_width_backward\":
42.0
,\n"
+
"\t\"green_width_forward\":
80
.0,\n"
+
"\t\"green_width_forward\":
41
.0,\n"
+
"\t\"greenbelt_direction\":
0
,\n"
+
"\t\"greenbelt_direction\":
2
,\n"
+
"\t\"greenbelt_id\": \"road1\",\n"
+
"\t\"greenbelt_id\": \"road1\",\n"
+
"\t\"greenbelt_length\": 2757.0,\n"
+
"\t\"greenbelt_length\": 2757.0,\n"
+
"\t\"greenbelt_type\": 2,\n"
+
"\t\"greenbelt_type\": 2,\n"
+
"\t\"max_cycle\": 220,\n"
+
"\t\"max_cycle\": 220,\n"
+
"\t\"max_speed_backward\":
45
.0,\n"
+
"\t\"max_speed_backward\":
50
.0,\n"
+
"\t\"max_speed_forward\":
35
.0,\n"
+
"\t\"max_speed_forward\":
50
.0,\n"
+
"\t\"min_speed_backward\":
35
.0,\n"
+
"\t\"min_speed_backward\":
40
.0,\n"
+
"\t\"min_speed_forward\":
25
.0,\n"
+
"\t\"min_speed_forward\":
40
.0,\n"
+
"\t\"offset\": {\n"
+
"\t\"offset\": {\n"
+
"\t\t\"13MOD0B5SI0\":
198
.0,\n"
+
"\t\t\"13MOD0B5SI0\":
0
.0,\n"
+
"\t\t\"13MQJ0B5SI0\":
46
.0,\n"
+
"\t\t\"13MQJ0B5SI0\":
87
.0,\n"
+
"\t\t\"13MS20B5SI0\":
89
.0,\n"
+
"\t\t\"13MS20B5SI0\":
117
.0,\n"
+
"\t\t\"13MUK0B5SH0\":
216
.0,\n"
+
"\t\t\"13MUK0B5SH0\":
119
.0,\n"
+
"\t\t\"13N0F0B5SH0\":
201
.0,\n"
+
"\t\t\"13N0F0B5SH0\":
0
.0,\n"
+
"\t\t\"13N200B5SH0\":
89
.0\n"
+
"\t\t\"13N200B5SH0\":
0
.0\n"
+
"\t},\n"
+
"\t},\n"
+
"\t\"phase_end_backward\": {\n"
+
"\t\"phase_end_backward\": {\n"
+
"\t\t\"13MOD0B5SI0\": 1
3
2.0,\n"
+
"\t\t\"13MOD0B5SI0\": 1
4
2.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 1
6
5.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 1
7
5.0,\n"
+
"\t\t\"13MS20B5SI0\": 1
4
8.0,\n"
+
"\t\t\"13MS20B5SI0\": 1
5
8.0,\n"
+
"\t\t\"13MUK0B5SH0\": 1
1
5.0,\n"
+
"\t\t\"13MUK0B5SH0\": 1
2
5.0,\n"
+
"\t\t\"13N0F0B5SH0\": 1
6
5.0,\n"
+
"\t\t\"13N0F0B5SH0\": 1
7
5.0,\n"
+
"\t\t\"13N200B5SH0\": 1
5
5.0\n"
+
"\t\t\"13N200B5SH0\": 1
4
5.0\n"
+
"\t},\n"
+
"\t},\n"
+
"\t\"phase_end_forward\": {\n"
+
"\t\"phase_end_forward\": {\n"
+
"\t\t\"13MOD0B5SI0\": 1
3
2.0,\n"
+
"\t\t\"13MOD0B5SI0\": 1
4
2.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 1
6
5.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 1
7
5.0,\n"
+
"\t\t\"13MS20B5SI0\": 1
4
8.0,\n"
+
"\t\t\"13MS20B5SI0\": 1
5
8.0,\n"
+
"\t\t\"13MUK0B5SH0\": 1
1
5.0,\n"
+
"\t\t\"13MUK0B5SH0\": 1
2
5.0,\n"
+
"\t\t\"13N0F0B5SH0\": 1
6
5.0,\n"
+
"\t\t\"13N0F0B5SH0\": 1
7
5.0,\n"
+
"\t\t\"13N200B5SH0\": 1
5
5.0\n"
+
"\t\t\"13N200B5SH0\": 1
4
5.0\n"
+
"\t},\n"
+
"\t},\n"
+
"\t\"phase_start_backward\": {\n"
+
"\t\"phase_start_backward\": {\n"
+
"\t\t\"13MOD0B5SI0\": 39.0,\n"
+
"\t\t\"13MOD0B5SI0\": 39.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 42.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 42.0,\n"
+
"\t\t\"13MS20B5SI0\": 4
3
.0,\n"
+
"\t\t\"13MS20B5SI0\": 4
5
.0,\n"
+
"\t\t\"13MUK0B5SH0\": 0.0,\n"
+
"\t\t\"13MUK0B5SH0\": 0.0,\n"
+
"\t\t\"13N0F0B5SH0\": 42.0,\n"
+
"\t\t\"13N0F0B5SH0\": 42.0,\n"
+
"\t\t\"13N200B5SH0\": 40.0\n"
+
"\t\t\"13N200B5SH0\": 40.0\n"
+
...
@@ -246,25 +280,41 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
...
@@ -246,25 +280,41 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
"\t\"phase_start_forward\": {\n"
+
"\t\"phase_start_forward\": {\n"
+
"\t\t\"13MOD0B5SI0\": 39.0,\n"
+
"\t\t\"13MOD0B5SI0\": 39.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 42.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 42.0,\n"
+
"\t\t\"13MS20B5SI0\": 4
3
.0,\n"
+
"\t\t\"13MS20B5SI0\": 4
5
.0,\n"
+
"\t\t\"13MUK0B5SH0\": 0.0,\n"
+
"\t\t\"13MUK0B5SH0\": 0.0,\n"
+
"\t\t\"13N0F0B5SH0\": 42.0,\n"
+
"\t\t\"13N0F0B5SH0\": 42.0,\n"
+
"\t\t\"13N200B5SH0\": 40.0\n"
+
"\t\t\"13N200B5SH0\": 40.0\n"
+
"\t},\n"
+
"\t},\n"
+
"\t\"speed_backward\": {\n"
+
"\t\"speed_backward\": {\n"
+
"\t\t\"13MOD0B5SI0\": -1.0,\n"
+
"\t\t\"13MOD0B5SI0\": -1.0,\n"
+
"\t\t\"13MQJ0B5SI0\":
36.608
,\n"
+
"\t\t\"13MQJ0B5SI0\":
45.0
,\n"
+
"\t\t\"13MS20B5SI0\": 4
1.257999999999996
,\n"
+
"\t\t\"13MS20B5SI0\": 4
4.99999999999999
,\n"
+
"\t\t\"13MUK0B5SH0\": 4
0.976
,\n"
+
"\t\t\"13MUK0B5SH0\": 4
5.0
,\n"
+
"\t\t\"13N0F0B5SH0\":
38.536
,\n"
+
"\t\t\"13N0F0B5SH0\":
45.0
,\n"
+
"\t\t\"13N200B5SH0\": 4
2.28
\n"
+
"\t\t\"13N200B5SH0\": 4
5.0
\n"
+
"\t},\n"
+
"\t},\n"
+
"\t\"speed_forward\": {\n"
+
"\t\"speed_forward\": {\n"
+
"\t\t\"13MOD0B5SI0\": 30.315999999999995,\n"
+
"\t\t\"13MOD0B5SI0\": 45.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 23.904,\n"
+
"\t\t\"13MQJ0B5SI0\": 44.99999999999999,\n"
+
"\t\t\"13MS20B5SI0\": 41.739999999999995,\n"
+
"\t\t\"13MS20B5SI0\": 45.0,\n"
+
"\t\t\"13MUK0B5SH0\": 27.832000000000004,\n"
+
"\t\t\"13MUK0B5SH0\": 45.0,\n"
+
"\t\t\"13N0F0B5SH0\": 25.536,\n"
+
"\t\t\"13N0F0B5SH0\": 45.0,\n"
+
"\t\t\"13N200B5SH0\": -1.0\n"
+
"\t},\n"
+
"\t\"travel_time_backward\": {\n"
+
"\t\t\"13MOD0B5SI0\": -1.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 51.0,\n"
+
"\t\t\"13MS20B5SI0\": 33.0,\n"
+
"\t\t\"13MUK0B5SH0\": 58.0,\n"
+
"\t\t\"13N0F0B5SH0\": 42.0,\n"
+
"\t\t\"13N200B5SH0\": 36.0\n"
+
"\t},\n"
+
"\t\"travel_time_forward\": {\n"
+
"\t\t\"13MOD0B5SI0\": 51.0,\n"
+
"\t\t\"13MQJ0B5SI0\": 33.0,\n"
+
"\t\t\"13MS20B5SI0\": 58.0,\n"
+
"\t\t\"13MUK0B5SH0\": 42.0,\n"
+
"\t\t\"13N0F0B5SH0\": 36.0,\n"
+
"\t\t\"13N200B5SH0\": -1.0\n"
+
"\t\t\"13N200B5SH0\": -1.0\n"
+
"\t}\n"
+
"\t}\n"
+
"}"
;
"}"
;
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/controller/StrategyGreenBeltController.java
View file @
10fbf0c0
...
@@ -9,7 +9,7 @@ import net.wanji.common.utils.tool.JacksonUtils;
...
@@ -9,7 +9,7 @@ import net.wanji.common.utils.tool.JacksonUtils;
import
net.wanji.opt.common.Constants
;
import
net.wanji.opt.common.Constants
;
import
net.wanji.opt.common.RedisUtils
;
import
net.wanji.opt.common.RedisUtils
;
import
net.wanji.opt.service.GreenBeltInfoService
;
import
net.wanji.opt.service.GreenBeltInfoService
;
import
net.wanji.opt.
synthesis.pojo.StrategyControl
VO
;
import
net.wanji.opt.
vo.GreenBeltChart
VO
;
import
net.wanji.opt.vo.GreenBeltInfoVO
;
import
net.wanji.opt.vo.GreenBeltInfoVO
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
@@ -34,14 +34,14 @@ public class StrategyGreenBeltController {
...
@@ -34,14 +34,14 @@ public class StrategyGreenBeltController {
@Resource
@Resource
private
GreenBeltInfoService
greenBeltInfoService
;
private
GreenBeltInfoService
greenBeltInfoService
;
@ApiOperation
(
value
=
"绿波时序图
查询"
,
notes
=
"绿波时序图
查询"
,
response
=
JsonViewObject
.
class
,
@ApiOperation
(
value
=
"绿波时序图
数据查询"
,
notes
=
"绿波时序图数据
查询"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/
strategyInfoOperation
"
,
@PostMapping
(
value
=
"/
greenBletData
"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
GreenBeltInfoVO
.
class
),
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
GreenBeltInfoVO
.
class
),
})
})
public
JsonViewObject
strategyInfoOperation
(
@RequestBody
String
greenId
)
throws
Exception
{
public
JsonViewObject
greenBletData
(
@RequestBody
String
greenId
)
throws
Exception
{
// todo 测试
// todo 测试
GreenBeltInfoVO
greenBeltInfoVO1
=
greenBeltInfoService
.
convertData
(
null
);
GreenBeltInfoVO
greenBeltInfoVO1
=
greenBeltInfoService
.
convertData
(
null
);
...
@@ -54,4 +54,19 @@ public class StrategyGreenBeltController {
...
@@ -54,4 +54,19 @@ public class StrategyGreenBeltController {
GreenBeltInfoVO
greenBeltInfoVO
=
JacksonUtils
.
getInstance
().
readValue
(
String
.
valueOf
(
obj
),
GreenBeltInfoVO
.
class
);
GreenBeltInfoVO
greenBeltInfoVO
=
JacksonUtils
.
getInstance
().
readValue
(
String
.
valueOf
(
obj
),
GreenBeltInfoVO
.
class
);
return
jsonViewObject
.
success
(
greenBeltInfoVO
);
return
jsonViewObject
.
success
(
greenBeltInfoVO
);
}
}
@ApiOperation
(
value
=
"绿波时序图图形查询"
,
notes
=
"绿波时序图图形查询"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/greenBeltChart"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
GreenBeltInfoVO
.
class
),
})
public
JsonViewObject
greenBeltChart
(
@RequestBody
String
greenId
)
throws
Exception
{
String
key
=
Constants
.
GREEN_ID_OPT_CHART_KEY
.
concat
(
greenId
);
Object
obj
=
redisUtils
.
get
(
key
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
GreenBeltChartVO
greenBeltChartVO
=
JacksonUtils
.
getInstance
().
readValue
(
String
.
valueOf
(
obj
),
GreenBeltChartVO
.
class
);
return
jsonViewObject
.
success
(
greenBeltChartVO
);
}
}
}
signal-optimize-service/src/main/java/net/wanji/opt/vo/GreenBeltInfoVO.java
View file @
10fbf0c0
package
net
.
wanji
.
opt
.
vo
;
package
net
.
wanji
.
opt
.
vo
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
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
java.util.List
;
import
java.util.List
;
...
@@ -42,8 +44,10 @@ public class GreenBeltInfoVO {
...
@@ -42,8 +44,10 @@ public class GreenBeltInfoVO {
@ApiModelProperty
(
"绿波方向"
)
@ApiModelProperty
(
"绿波方向"
)
private
String
dir
;
private
String
dir
;
@ApiModelProperty
(
"最大速度"
)
@ApiModelProperty
(
"最大速度"
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
maxSpeed
;
private
Double
maxSpeed
;
@ApiModelProperty
(
"最小速度"
)
@ApiModelProperty
(
"最小速度"
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
minSpeed
;
private
Double
minSpeed
;
@ApiModelProperty
(
"绿波带宽"
)
@ApiModelProperty
(
"绿波带宽"
)
private
Double
greenWidthTime
;
private
Double
greenWidthTime
;
...
@@ -62,9 +66,15 @@ public class GreenBeltInfoVO {
...
@@ -62,9 +66,15 @@ public class GreenBeltInfoVO {
@ApiModelProperty
(
"绿波带开始时间"
)
@ApiModelProperty
(
"绿波带开始时间"
)
private
Double
greenStartTime
;
private
Double
greenStartTime
;
@ApiModelProperty
(
"绿波速度"
)
@ApiModelProperty
(
"绿波速度"
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
speed
;
private
Double
speed
;
@ApiModelProperty
(
"相位差"
)
@ApiModelProperty
(
"相位差"
)
private
Double
offset
;
private
Double
offset
;
@ApiModelProperty
(
"行程时间"
)
private
Double
travelTime
;
@ApiModelProperty
(
"到下一个路口距离"
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
distance
;
}
}
}
}
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