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
jinan
traffic-signal-platform
Commits
e13aa51d
Commit
e13aa51d
authored
Feb 09, 2025
by
zhoushiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
12b47efb
ae31b4a8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
35 deletions
+46
-35
InduceHistController.java
...net/wanji/opt/controller/induce/InduceHistController.java
+15
-2
CrossIndexServiceImpl.java
...ava/net/wanji/opt/service/impl/CrossIndexServiceImpl.java
+1
-0
StrategyControlDataVO.java
...et/wanji/opt/synthesis/pojo/vo/StrategyControlDataVO.java
+2
-2
PushStrategyControlServiceImpl.java
...ynthesis/service/impl/PushStrategyControlServiceImpl.java
+2
-0
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+26
-31
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controller/induce/InduceHistController.java
View file @
e13aa51d
...
...
@@ -10,10 +10,12 @@ import net.wanji.common.framework.i18n.I18nResourceBundle;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.common.framework.rest.Page
;
import
net.wanji.common.framework.rest.ValidationGroups
;
import
net.wanji.common.utils.tool.DateUtil
;
import
net.wanji.common.utils.tool.StringUtils
;
import
net.wanji.opt.dto.induce.InduceDTO
;
import
net.wanji.opt.entity.InduceHist
;
import
net.wanji.opt.service.induce.InduceHistService
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -79,8 +81,19 @@ public class InduceHistController {
// Map params = JSONObject.parseObject(JSONObject.toJSONString(InduceHist), Map.class);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
induceHist
),
Map
.
class
).
forEach
((
k
,
v
)
->
params
.
put
(
StringUtils
.
camelToCapital
(
k
.
toString
()).
toLowerCase
(),
v
));
List
list
=
this
.
induceHistService
.
listByMap
(
params
);
jsonView
.
success
(
list
);
List
<
InduceHist
>
list
=
this
.
induceHistService
.
listByMap
(
params
);
List
<
InduceHist
>
result
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
for
(
InduceHist
hist
:
list
)
{
Date
createTime
=
hist
.
getCreateTime
();
Date
date
=
DateUtil
.
addDay
(
DateUtil
.
StringToDate
(
new
Date
()),
-
30
);
if
(
createTime
.
before
(
date
))
{
continue
;
}
result
.
add
(
hist
);
}
}
jsonView
.
success
(
result
);
}
catch
(
Exception
e
)
{
jsonView
.
fail
(
I18nResourceBundle
.
getConstants
(
"GET_FAILED_MSG"
));
log
.
error
(
"{} getByWhere error,jsonStr:{}"
,
this
.
getClass
().
getSimpleName
(),
jsonStr
,
e
);
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/CrossIndexServiceImpl.java
View file @
e13aa51d
...
...
@@ -94,6 +94,7 @@ public class CrossIndexServiceImpl implements CrossIndexService {
LocalDateTime
startOfDay
=
LocalDateTime
.
of
(
currentDate
,
startTime
);
queryWrapper
.
eq
(
StrategyCrossResultEntity:
:
getCrossId
,
crossIdBO
.
getCrossId
());
queryWrapper
.
ge
(
StrategyCrossResultEntity:
:
getIssueTime
,
startOfDay
);
queryWrapper
.
eq
(
StrategyCrossResultEntity:
:
getResponseCode
,
200
);
List
<
StrategyCrossResultEntity
>
list
=
strategyCrossResultMapper
.
selectList
(
queryWrapper
);
List
<
CrossOptResult
>
crossOptResults
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/pojo/vo/StrategyControlDataVO.java
View file @
e13aa51d
package
net
.
wanji
.
opt
.
synthesis
.
pojo
.
vo
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -39,11 +39,11 @@ public class StrategyControlDataVO {
private
Integer
model
;
@Data
@NoArgsConstructor
public
static
class
TimeTable
{
@ApiModelProperty
(
value
=
"星期周日至周六 0-6 7为每天不限时"
)
private
Integer
week
;
@ApiModelProperty
(
value
=
"时间段,格式为“开始时间-结束时间”,时间格式为hh:mm:ss,范围00:00:00到23:59:59"
)
@JsonProperty
(
"time_list"
)
private
String
[]
timeList
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/PushStrategyControlServiceImpl.java
View file @
e13aa51d
...
...
@@ -32,6 +32,7 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
ObjectMapper
mapper
=
JacksonUtils
.
getInstance
();
String
resultStr
=
RestTemplateTool
.
post
(
url
,
mapper
.
writeValueAsString
(
req
));
if
(
StringUtils
.
isNotBlank
(
resultStr
))
{
log
.
info
(
"下发神思策略详情成功,内容: {}"
,
req
);
Result
result
=
mapper
.
readValue
(
resultStr
,
Result
.
class
);
return
result
;
}
else
{
...
...
@@ -52,6 +53,7 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
ObjectMapper
mapper
=
JacksonUtils
.
getInstance
();
String
resultStr
=
RestTemplateTool
.
post
(
switchUrl
,
mapper
.
writeValueAsString
(
req
));
if
(
StringUtils
.
isNotBlank
(
resultStr
))
{
log
.
info
(
"下发神思策略开关成功,内容: {}"
,
req
);
Result
result
=
mapper
.
readValue
(
resultStr
,
Result
.
class
);
return
result
;
}
else
{
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
e13aa51d
...
...
@@ -247,6 +247,8 @@ public class StrategyControlServiceImpl implements StrategyControlService {
}
else
{
queryWrapper
.
ne
(
StrategyCrossResultEntity:
:
getResponseCode
,
200
);
}
queryWrapper
.
orderByDesc
(
StrategyCrossResultEntity:
:
getIssueTime
);
queryWrapper
.
last
(
"limit 3000"
);
}
List
<
StrategyCrossResultEntity
>
resultEntities
=
strategyCrossResultMapper
.
selectList
(
queryWrapper
);
if
(!
CollectionUtils
.
isEmpty
(
resultEntities
))
{
...
...
@@ -265,11 +267,6 @@ public class StrategyControlServiceImpl implements StrategyControlService {
Date
issueTime
=
resultEntity
.
getIssueTime
();
String
format
=
DateUtil
.
format
(
issueTime
,
Constants
.
DATE_FORMAT
.
E_DATE_FORMAT_SECOND
);
histVO
.
setOptTime
(
format
);
//if (resultEntity.getCurrentAlgo() != 1) {
// histVO.setResult(Objects.equals(200, resultEntity.getResponseCode()) ? "成功" : "失败");
//} else {
// histVO.setResult("成功");
//}
histVO
.
setResult
(
resultEntity
.
getResponseContent
());
histVO
.
setCode
(
resultEntity
.
getResponseCode
());
results
.
add
(
histVO
);
...
...
@@ -491,37 +488,35 @@ public class StrategyControlServiceImpl implements StrategyControlService {
private
List
<
StrategyControlDataExt
>
getGreenList
(
Date
date
)
{
List
<
StrategyControlDataExt
>
results
=
new
ArrayList
<>();
List
<
HoloEventInfoPO
>
holoEventInfoPOS
=
holoEventMapper
.
selectAIGreenList
(
date
);
if
(!
CollectionUtils
.
isEmpty
(
holoEventInfoPOS
))
{
for
(
HoloEventInfoPO
holoEventInfoPO
:
holoEventInfoPOS
)
{
LambdaQueryWrapper
<
StrategyGreenOptHistEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
ge
(
StrategyGreenOptHistEntity:
:
getControlTime
,
date
);
queryWrapper
.
orderByAsc
(
StrategyGreenOptHistEntity:
:
getControlTime
);
List
<
StrategyGreenOptHistEntity
>
entities
=
strategyGreenOptHistMapper
.
selectList
(
queryWrapper
);
if
(!
CollectionUtils
.
isEmpty
(
entities
))
{
for
(
StrategyGreenOptHistEntity
entity
:
entities
)
{
Integer
greenId
=
entity
.
getGreenId
();
StrategyControlDataExt
ext
=
new
StrategyControlDataExt
();
ext
.
setBizId
(
holoEventInfoPO
.
getCrossId
());
ext
.
setCrossName
(
holoEventInfoPO
.
getRemark
());
String
location
=
holoEventInfoPO
.
getExtend
();
ext
.
setWkt
(
location
);
Integer
alarmStatus
=
holoEventInfoPO
.
getAlarmStatus
();
String
optMethod
=
"效率提升"
;
if
(
Objects
.
isNull
(
alarmStatus
))
{
ext
.
setStatus
(-
1
);
Integer
controlMethod
=
entity
.
getControlMethod
();
if
(
Objects
.
equals
(-
1
,
controlMethod
))
{
ext
.
setStatus
(
0
);
ext
.
setOptStatus
(
"优化中"
);
}
else
{
ext
.
setStatus
(
alarmStatus
);
ext
.
setStatus
(
1
);
ext
.
setOptStatus
(
"未优化"
);
}
Map
<
Integer
,
GreenwaveInfoPO
>
greenWaveMap
=
GreenWaveInfoCache
.
greenWaveMap
;
GreenwaveInfoPO
greenwaveInfoPO
=
greenWaveMap
.
get
(
greenId
);
ext
.
setBizId
(
String
.
valueOf
(
entity
.
getGreenId
()));
ext
.
setCrossName
(
greenwaveInfoPO
.
getName
());
String
location
=
greenwaveInfoPO
.
getWkt
();
ext
.
setWkt
(
location
);
String
optMethod
=
"效率提升"
;
ext
.
setOptMethod
(
optMethod
);
String
desc
=
EventStatusEnum
.
getDesc
(
alarmStatus
);
ext
.
setOptStatus
(
desc
);
String
type
=
holoEventInfoPO
.
getType
();
if
(
StringUtils
.
isBlank
(
type
))
{
ext
.
setStrategyName
(
"动态绿波"
);
}
if
(
StringUtils
.
equals
(
"705"
,
type
))
{
ext
.
setStrategyName
(
"干线-缓行"
);
}
if
(
StringUtils
.
equals
(
"706"
,
type
))
{
ext
.
setStrategyName
(
"干线-拥堵"
);
}
ext
.
setStrategyName
(
"动态双向绿波"
);
results
.
add
(
ext
);
}
}
results
.
sort
(
Comparator
.
comparing
(
StrategyControlDataExt:
:
getStatus
).
reversed
());
return
results
;
}
...
...
@@ -734,7 +729,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
strategyControlDataEntity
.
setStrategy
(
datum
.
getStrategy
());
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
strategyControlDataEntity
.
setScheduleStart
(
simpleDateFormat
.
parse
(
datum
.
getSchedule_start
()));
strategyControlDataEntity
.
setSchedule
Start
(
simpleDateFormat
.
parse
(
datum
.
getSchedule_start
()));
strategyControlDataEntity
.
setSchedule
End
(
simpleDateFormat
.
parse
(
datum
.
getSchedule_end
()));
ObjectMapper
instance
=
JacksonUtils
.
getInstance
();
strategyControlDataEntity
.
setTime
(
instance
.
writeValueAsString
(
datum
.
getTime_table
()));
strategyControlDataEntity
.
setFrequency
(
datum
.
getStrategy
());
...
...
@@ -791,7 +786,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
strategyControlDataEntity
.
setStrategy
(
datum
.
getStrategy
());
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
strategyControlDataEntity
.
setScheduleStart
(
simpleDateFormat
.
parse
(
datum
.
getSchedule_start
()));
strategyControlDataEntity
.
setSchedule
Start
(
simpleDateFormat
.
parse
(
datum
.
getSchedule_start
()));
strategyControlDataEntity
.
setSchedule
End
(
simpleDateFormat
.
parse
(
datum
.
getSchedule_end
()));
ObjectMapper
instance
=
JacksonUtils
.
getInstance
();
strategyControlDataEntity
.
setTime
(
instance
.
writeValueAsString
(
datum
.
getTime_table
()));
strategyControlDataEntity
.
setFrequency
(
datum
.
getStrategy
());
...
...
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