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
023c4b35
Commit
023c4b35
authored
Feb 14, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 策略库管理保存添加策略编号唯一校验
parent
0711ba8f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
128 additions
and
1 deletion
+128
-1
StrategyControlController.java
...i/opt/synthesis/controller/StrategyControlController.java
+12
-0
StrategyControlDetailList.java
...t/wanji/opt/synthesis/pojo/StrategyControlDetailList.java
+1
-0
StrategyControlService.java
...t/wanji/opt/synthesis/service/StrategyControlService.java
+2
-0
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+95
-1
StrategyNameCrossVO.java
...e/src/main/java/net/wanji/opt/vo/StrategyNameCrossVO.java
+18
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/controller/StrategyControlController.java
View file @
023c4b35
...
...
@@ -9,6 +9,7 @@ import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import
net.wanji.opt.synthesis.pojo.vo.StrategyControlVO
;
import
net.wanji.opt.synthesis.pojo.vo.StrategyFactoryQueryVO
;
import
net.wanji.opt.synthesis.service.StrategyControlService
;
import
net.wanji.opt.vo.StrategyNameCrossVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -152,6 +153,17 @@ public class StrategyControlController {
return
strategyControlService
.
strategyFactoryList
(
vo
);
}
@ApiOperation
(
value
=
"策略管理-路口详情-优化策略查询"
,
notes
=
"策略管理-路口详情-优化策略查询"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@GetMapping
(
value
=
"/strategyNameCrossInfo"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
StrategyNameCrossVO
.
class
),
})
public
JsonViewObject
strategyNameCrossInfo
(
@RequestParam
String
crossId
)
throws
Exception
{
return
strategyControlService
.
strategyNameCrossInfo
(
crossId
);
}
@ApiOperation
(
value
=
"策略库查询列表"
,
notes
=
"策略库分页查询列表"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/pojo/StrategyControlDetailList.java
View file @
023c4b35
...
...
@@ -52,6 +52,7 @@ public class StrategyControlDetailList {
public
static
class
DailyPlanDetail
{
private
Integer
strategy
;
private
String
strategyName
;
private
String
strategyNo
;
private
List
<
String
>
times
;
}
}
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/StrategyControlService.java
View file @
023c4b35
...
...
@@ -37,4 +37,6 @@ public interface StrategyControlService {
JsonViewObject
strategyFactorySave
(
StrategyFactoryEntity
entity
)
throws
Exception
;
JsonViewObject
strategyFactoryDel
(
List
<
Integer
>
ids
)
throws
Exception
;
JsonViewObject
strategyNameCrossInfo
(
String
crossId
)
throws
Exception
;
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
023c4b35
...
...
@@ -28,6 +28,7 @@ import net.wanji.opt.synthesis.pojo.*;
import
net.wanji.opt.synthesis.pojo.vo.*
;
import
net.wanji.opt.synthesis.service.PushStrategyControlService
;
import
net.wanji.opt.synthesis.service.StrategyControlService
;
import
net.wanji.opt.vo.StrategyNameCrossVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.jetbrains.annotations.NotNull
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -347,7 +348,6 @@ public class StrategyControlServiceImpl implements StrategyControlService {
// 转化成 0 畅通 1失衡 2拥堵 3溢出 4死锁 5空放 6干线拥堵 7干线缓行 8干线畅通
Integer
status
=
baseCrossInfoPO
.
getRealtimeStatus
();
strategyControlDataEntity
.
setStrategy
(
status
);
strategyControlDataEntity
.
setOptMethod
(
Objects
.
equals
(
1
,
status
)
?
"均衡调控"
:
"效率提升"
);
strategyControlDataEntity
.
setTime
(
null
);
strategyControlDataEntity
.
setStatus
(
status
);
strategyControlDataEntity
.
setCrossName
(
baseCrossInfoPO
.
getName
());
...
...
@@ -1100,4 +1100,98 @@ public class StrategyControlServiceImpl implements StrategyControlService {
}
return
jsonViewObject
.
success
(
"策略库删除成功"
);
}
@Override
public
JsonViewObject
strategyNameCrossInfo
(
String
crossId
)
throws
Exception
{
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
try
{
ObjectMapper
instance
=
JacksonUtils
.
getInstance
();
// 通过当前时间获取当前日计划编号
Integer
currentDailyPlanId
=
1
;
String
currentStrategyNo
=
""
;
List
<
String
>
strategyNoList
=
new
ArrayList
<>();
LambdaQueryWrapper
<
StrategyPlanInfoEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
StrategyPlanInfoEntity:
:
getCrossId
,
crossId
);
Date
currentDate
=
new
Date
();
queryWrapper
.
le
(
StrategyPlanInfoEntity:
:
getStartTime
,
currentDate
);
queryWrapper
.
ge
(
StrategyPlanInfoEntity:
:
getEndTime
,
currentDate
);
List
<
StrategyPlanInfoEntity
>
planInfoEntities
=
strategyPlanInfoMapper
.
selectList
(
queryWrapper
);
for
(
StrategyPlanInfoEntity
planInfoEntity
:
planInfoEntities
)
{
String
planDetailStr
=
planInfoEntity
.
getPlanDetails
();
List
<
StrategyControlDetailList
.
ExecutePlan
.
PlanDetail
>
planDetails
=
instance
.
readValue
(
planDetailStr
,
new
TypeReference
<
List
<
StrategyControlDetailList
.
ExecutePlan
.
PlanDetail
>>()
{});
if
(!
CollectionUtils
.
isEmpty
(
planDetails
))
{
for
(
StrategyControlDetailList
.
ExecutePlan
.
PlanDetail
planDetail
:
planDetails
)
{
int
week
=
DateUtil
.
getWeek
(
currentDate
)
==
0
?
7
:
DateUtil
.
getWeek
(
currentDate
);
List
<
Integer
>
weeks
=
planDetail
.
getWeeks
();
Integer
dailyPlanId
=
planDetail
.
getDailyPlanId
();
if
(
weeks
.
contains
(
week
))
{
currentDailyPlanId
=
dailyPlanId
;
}
}
}
}
LambdaQueryWrapper
<
StrategyDailyPlanInfoEntity
>
dailyQuery
=
new
LambdaQueryWrapper
<>();
dailyQuery
.
eq
(
StrategyDailyPlanInfoEntity:
:
getCrossId
,
crossId
);
List
<
StrategyDailyPlanInfoEntity
>
dailyEntities
=
strategyDailyPlanInfoMapper
.
selectList
(
dailyQuery
);
if
(!
CollectionUtils
.
isEmpty
(
dailyEntities
))
{
for
(
StrategyDailyPlanInfoEntity
dailyEntity
:
dailyEntities
)
{
Integer
dailyPlanId
=
dailyEntity
.
getDailyPlanId
();
if
(
Objects
.
equals
(
dailyPlanId
,
currentDailyPlanId
))
{
String
dailyPlanDetailStr
=
dailyEntity
.
getDailyPlanDetails
();
List
<
StrategyControlDetailList
.
DailyPlan
.
DailyPlanDetail
>
dailyPlanDetails
=
instance
.
readValue
(
dailyPlanDetailStr
,
new
TypeReference
<
List
<
StrategyControlDetailList
.
DailyPlan
.
DailyPlanDetail
>>()
{});
if
(!
CollectionUtils
.
isEmpty
(
dailyPlanDetails
))
{
for
(
StrategyControlDetailList
.
DailyPlan
.
DailyPlanDetail
dailyPlanDetail
:
dailyPlanDetails
)
{
String
strategyNo
=
dailyPlanDetail
.
getStrategyNo
();
List
<
String
>
times
=
dailyPlanDetail
.
getTimes
();
if
(!
CollectionUtils
.
isEmpty
(
times
))
{
String
startTime
=
times
.
get
(
0
);
String
endTime
=
times
.
get
(
1
);
if
(
StringUtils
.
equals
(
"24:00"
,
endTime
))
{
endTime
=
"23:59"
;
}
String
format
=
DateUtil
.
format
(
currentDate
,
Constants
.
DATE_FORMAT
.
E_DATE_FORMAT_HOUR_MINUTE
);
Date
currentTime
=
DateUtil
.
parse
(
format
,
"HH:mm"
);
Date
startHourDate
=
DateUtil
.
parse
(
startTime
,
"HH:mm"
);
Date
endHourDate
=
DateUtil
.
parse
(
endTime
,
"HH:mm"
);
if
(
currentTime
.
after
(
startHourDate
)
&&
currentTime
.
before
(
endHourDate
))
{
currentStrategyNo
=
strategyNo
;
}
strategyNoList
.
add
(
strategyNo
);
}
}
}
}
}
// 通过策略编号获取策略名称
LambdaQueryWrapper
<
StrategyFactoryEntity
>
factoryQuery
=
new
LambdaQueryWrapper
<>();
factoryQuery
.
in
(
StrategyFactoryEntity:
:
getStrategyNo
,
strategyNoList
);
List
<
StrategyFactoryEntity
>
factoryEntities
=
strategyFactoryMapper
.
selectList
(
factoryQuery
);
String
currentName
=
""
;
List
<
String
>
strategyNames
=
new
ArrayList
<>();
for
(
StrategyFactoryEntity
factoryEntity
:
factoryEntities
)
{
String
company
=
factoryEntity
.
getCompany
();
String
strategyName
=
factoryEntity
.
getStrategyName
();
String
method
=
factoryEntity
.
getMethod
();
String
strategyNo
=
factoryEntity
.
getStrategyNo
();
String
name
=
String
.
join
(
"-"
,
company
,
method
,
strategyName
);
strategyNames
.
add
(
name
);
if
(
StringUtils
.
equals
(
strategyNo
,
currentStrategyNo
))
{
currentName
=
name
;
}
}
StrategyNameCrossVO
strategyNameCrossVO
=
new
StrategyNameCrossVO
();
strategyNameCrossVO
.
setCurrentName
(
currentName
);
strategyNameCrossVO
.
setStrategyNames
(
strategyNames
);
return
jsonViewObject
.
success
(
strategyNameCrossVO
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"策略管理-路口详情-优化策略查询, {}"
,
e
);
return
jsonViewObject
.
fail
(
"策略管理-路口详情-优化策略查询失败"
);
}
return
jsonViewObject
.
fail
(
"策略管理-路口详情-优化策略查询失败"
);
}
}
signal-optimize-service/src/main/java/net/wanji/opt/vo/StrategyNameCrossVO.java
0 → 100644
View file @
023c4b35
package
net
.
wanji
.
opt
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author duanruiming
* @date 2025/02/14 15:11
* @description 策略管理-路口详情-优化策略返回实体
*/
@Data
@ApiModel
(
value
=
"StrategyNameCrossVO"
,
description
=
"策略管理-路口详情-优化策略返回实体"
)
public
class
StrategyNameCrossVO
{
private
String
currentName
;
private
List
<
String
>
strategyNames
;
}
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