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
fc0728d1
Commit
fc0728d1
authored
Dec 07, 2024
by
zhouleilei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
8d3da2e4
9ebadf1a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
21 deletions
+50
-21
BaseCrossInfoCache.java
...src/main/java/net/wanji/opt/cache/BaseCrossInfoCache.java
+3
-1
Double2TwoDecimalPlacesSerializer.java
...t/wanji/opt/config/Double2TwoDecimalPlacesSerializer.java
+1
-1
TrendServiceImpl.java
...ain/java/net/wanji/opt/service/impl/TrendServiceImpl.java
+4
-0
StrategyControlController.java
...i/opt/synthesis/controller/StrategyControlController.java
+1
-1
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+38
-17
DoubleToTwoDecimalPlacesSerializer.java
...ji/databus/config/DoubleToTwoDecimalPlacesSerializer.java
+1
-1
GreenwaveListVO.java
...s/src/main/java/net/wanji/databus/vo/GreenwaveListVO.java
+2
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/cache/BaseCrossInfoCache.java
View file @
fc0728d1
...
...
@@ -12,6 +12,7 @@ import org.springframework.util.CollectionUtils;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -74,7 +75,8 @@ public class BaseCrossInfoCache implements CommandLineRunner {
public
void
init
()
{
List
<
BaseCrossInfoPO
>
baseCrossInfoPOS
=
baseCrossInfoMapper
.
selectAll
(
new
CrossInfoVO
());
if
(!
CollectionUtils
.
isEmpty
(
baseCrossInfoPOS
))
{
crossInfoList
.
addAll
(
baseCrossInfoPOS
);
List
<
BaseCrossInfoPO
>
collect
=
baseCrossInfoPOS
.
stream
().
filter
(
po
->
Objects
.
equals
(
po
.
getIsSignal
(),
1
)).
collect
(
Collectors
.
toList
());
crossInfoList
.
addAll
(
collect
);
}
}
}
signal-optimize-service/src/main/java/net/wanji/opt/config/Double2TwoDecimalPlacesSerializer.java
View file @
fc0728d1
...
...
@@ -12,7 +12,7 @@ import java.text.DecimalFormat;
* @date 2024/12/01 16:17
*/
public
class
Double2TwoDecimalPlacesSerializer
extends
JsonSerializer
<
Double
>
{
private
static
final
DecimalFormat
df
=
new
DecimalFormat
(
"#.00"
);
private
static
final
DecimalFormat
df
=
new
DecimalFormat
(
"#
0
.00"
);
@Override
public
void
serialize
(
Double
value
,
JsonGenerator
gen
,
SerializerProvider
serializers
)
throws
IOException
{
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/TrendServiceImpl.java
View file @
fc0728d1
...
...
@@ -202,6 +202,9 @@ public class TrendServiceImpl implements TrendService {
Integer
greenId
=
entry
.
getKey
();
List
<
GreenwaveListVO
>
value
=
entry
.
getValue
();
if
(
Objects
.
equals
(
1
,
value
.
size
()))
{
value
.
forEach
(
vo
->
{
vo
.
setType
(
"单向绿波"
);
});
greenwaveListVOList
.
addAll
(
value
);
}
if
(
Objects
.
equals
(
2
,
value
.
size
()))
{
...
...
@@ -227,6 +230,7 @@ public class TrendServiceImpl implements TrendService {
wDirVo
.
setStopTimes
((
int
)
(
stopTimes
/
2
));
wDirVo
.
setTrafficIndex
(
trafficIndex
/
2
<
1
?
1
:
trafficIndex
/
2
);
wDirVo
.
setTravelTime
(
travelTime
/
2
);
wDirVo
.
setType
(
"双向绿波"
);
greenwaveListVOList
.
add
(
wDirVo
);
}
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/controller/StrategyControlController.java
View file @
fc0728d1
...
...
@@ -7,8 +7,8 @@ import io.swagger.annotations.ApiResponses;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.opt.synthesis.pojo.StrategyControlDataEntity
;
import
net.wanji.opt.synthesis.pojo.StrategyControlDetailList
;
import
net.wanji.opt.synthesis.pojo.vo.StrategyControlVO
;
import
net.wanji.opt.synthesis.pojo.StrategyFactoryEntity
;
import
net.wanji.opt.synthesis.pojo.vo.StrategyControlVO
;
import
net.wanji.opt.synthesis.service.StrategyControlService
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
fc0728d1
...
...
@@ -19,7 +19,6 @@ import net.wanji.databus.po.BaseCrossInfoPO;
import
net.wanji.databus.po.TBaseCrossInfo
;
import
net.wanji.opt.cache.BaseCrossInfoCache
;
import
net.wanji.opt.cache.GreenWaveInfoCache
;
import
net.wanji.opt.common.enums.CrossOptStrategyEnum
;
import
net.wanji.opt.common.enums.StrategyControlEnum
;
import
net.wanji.opt.dao.mapper.*
;
import
net.wanji.opt.po.StrategyGreenOptHistEntity
;
...
...
@@ -72,6 +71,8 @@ public class StrategyControlServiceImpl implements StrategyControlService {
private
StrategyGreenOptHistMapper
strategyGreenOptHistMapper
;
@Resource
private
StrategyCrossResultMapper
strategyCrossResultMapper
;
@Resource
private
BaseCrossInfoCache
baseCrossInfoCache
;
@Override
...
...
@@ -355,7 +356,6 @@ public class StrategyControlServiceImpl implements StrategyControlService {
List
<
StrategyControlDataVO
.
TimeTable
>
timeTables
=
instance
.
readValue
(
time
,
new
TypeReference
<
List
<
StrategyControlDataVO
.
TimeTable
>>()
{
});
for
(
StrategyControlDataVO
.
TimeTable
timeTable
:
timeTables
)
{
int
currentWeek
=
DateUtil
.
thisDayOfWeek
()
-
1
;
String
[]
timeList
=
timeTable
.
getTimeList
();
for
(
String
s
:
timeList
)
{
String
[]
hours
=
s
.
split
(
","
);
...
...
@@ -370,28 +370,25 @@ public class StrategyControlServiceImpl implements StrategyControlService {
DateTime
currentTime
=
DateUtil
.
parse
(
format
,
"HH:mm"
);
DateTime
startHourDate
=
DateUtil
.
parse
(
startHour
,
"HH:mm"
);
DateTime
endHourDate
=
DateUtil
.
parse
(
entHour
,
"HH:mm"
);
if
(
currentTime
.
after
(
startHourDate
)
&&
currentTime
.
b
efore
(
endHourDate
))
{
if
(
currentTime
.
isAfter
(
startHourDate
)
&&
currentTime
.
isB
efore
(
endHourDate
))
{
result
.
setTime
(
hour
);
result
.
setStatus
(
1
);
}
else
{
// 如果有调度策略在执行,设置为开启,否则关闭,提供前端过滤配置和未配置
result
.
setStatus
(
0
);
result
.
setTime
(
null
);
}
}
}
}
if
(
type
==
0
)
{
BaseCrossInfoPO
baseCrossInfoPO
=
baseCrossInfoMapper
.
selectById
(
entity
.
getBizId
());
result
.
setCrossName
(
baseCrossInfoPO
.
getName
());
String
location
=
baseCrossInfoPO
.
getLocation
();
location
=
location
.
replace
(
"POINT("
,
""
).
replace
(
" "
,
","
).
replace
(
")"
,
""
);
result
.
setWkt
(
location
);
}
if
(
type
==
1
)
{
GreenwaveInfoPO
greenwaveInfoPO
=
greenwaveInfoMapper
.
selectById
(
Integer
.
valueOf
(
entity
.
getBizId
()));
Map
<
Integer
,
GreenwaveInfoPO
>
greenWaveMap
=
GreenWaveInfoCache
.
greenWaveMap
;
if
(!
greenWaveMap
.
isEmpty
())
{
GreenwaveInfoPO
greenwaveInfoPO
=
greenWaveMap
.
get
(
Integer
.
valueOf
(
entity
.
getBizId
()));
result
.
setCrossName
(
greenwaveInfoPO
.
getName
());
result
.
setWkt
(
greenwaveInfoPO
.
getWkt
());
}
}
results
.
add
(
result
);
}
return
results
;
...
...
@@ -403,19 +400,43 @@ public class StrategyControlServiceImpl implements StrategyControlService {
try
{
List
<
StrategyControlDataEntity
>
currentStrateInfoList
=
getCurrentStrateInfoList
(
type
);
List
<
StrategyControlDataExt
>
strategyControlDataExts
=
new
ArrayList
<>();
List
<
StrategyControlDataExt
>
results
=
new
ArrayList
<>();
for
(
StrategyControlDataEntity
strategyControlDataEntity
:
currentStrateInfoList
)
{
Integer
strategy
=
strategyControlDataEntity
.
getStrategy
();
StrategyControlDataExt
strategyControlDataExt
=
new
StrategyControlDataExt
();
BeanUtils
.
copyProperties
(
strategyControlDataEntity
,
strategyControlDataExt
);
strategyControlDataExt
.
setStrategyName
(
StrategyControlEnum
.
getDesc
(
strategy
));
strategyControlDataExt
.
setOptStatus
(
"未执行"
);
if
(
StringUtils
.
isNotBlank
(
strategyControlDataEntity
.
getTime
()))
{
strategyControlDataExt
.
setOptStatus
(
"优化中"
);
}
strategyControlDataExts
.
add
(
strategyControlDataExt
);
}
strategyControlDataExts
.
sort
(
Comparator
.
comparing
(
StrategyControlDataExt:
:
getOptStatus
));
return
jsonViewObject
.
success
(
strategyControlDataExts
,
"路网优化监测查询成功"
);
}
if
(
Objects
.
equals
(
0
,
type
))
{
List
<
BaseCrossInfoPO
>
crossInfoCache
=
baseCrossInfoCache
.
getCrossInfoCache
();
if
(!
CollectionUtils
.
isEmpty
(
crossInfoCache
))
{
for
(
BaseCrossInfoPO
baseCrossInfoPO
:
crossInfoCache
)
{
StrategyControlDataExt
ext
=
new
StrategyControlDataExt
();
ext
.
setBizId
(
baseCrossInfoPO
.
getId
());
ext
.
setStrategyName
(
"无策略"
);
ext
.
setOptStatus
(
"未优化"
);
ext
.
setStatus
(
0
);
for
(
StrategyControlDataExt
strategyControlDataExt
:
strategyControlDataExts
)
{
if
(
StringUtils
.
equals
(
baseCrossInfoPO
.
getId
(),
strategyControlDataExt
.
getBizId
()))
{
ext
=
strategyControlDataExt
;
}
}
String
location
=
baseCrossInfoPO
.
getLocation
();
location
=
location
.
replace
(
"POINT("
,
""
).
replace
(
" "
,
","
).
replace
(
")"
,
""
);
ext
.
setWkt
(
location
);
results
.
add
(
ext
);
}
}
}
if
(
Objects
.
equals
(
1
,
type
))
{
results
.
addAll
(
strategyControlDataExts
);
}
results
.
sort
(
Comparator
.
comparing
(
StrategyControlDataExt:
:
getOptStatus
));
return
jsonViewObject
.
success
(
results
,
"路网优化监测查询成功"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"路网优化监测查询失败: {}"
,
e
);
return
jsonViewObject
.
fail
(
"路网优化监测查询失败"
);
...
...
wj-databus/src/main/java/net/wanji/databus/config/DoubleToTwoDecimalPlacesSerializer.java
View file @
fc0728d1
...
...
@@ -12,7 +12,7 @@ import java.text.DecimalFormat;
* @date 2024/12/01 16:17
*/
public
class
DoubleToTwoDecimalPlacesSerializer
extends
JsonSerializer
<
Double
>
{
private
static
final
DecimalFormat
df
=
new
DecimalFormat
(
"#.00"
);
private
static
final
DecimalFormat
df
=
new
DecimalFormat
(
"#
0
.00"
);
@Override
public
void
serialize
(
Double
value
,
JsonGenerator
gen
,
SerializerProvider
serializers
)
throws
IOException
{
...
...
wj-databus/src/main/java/net/wanji/databus/vo/GreenwaveListVO.java
View file @
fc0728d1
...
...
@@ -18,6 +18,8 @@ import java.util.List;
public
class
GreenwaveListVO
{
@ApiModelProperty
(
value
=
"绿波ID"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"绿波方向类型"
)
private
String
type
;
@ApiModelProperty
(
value
=
"子区名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"协调方式:0未开启;1相位差优化;2选择方案"
)
...
...
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