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
de0b467f
Commit
de0b467f
authored
Jan 18, 2025
by
zhoushiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
72a746a6
3e539f29
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
26 deletions
+55
-26
OptStatusEnum.java
...c/main/java/net/wanji/opt/common/enums/OptStatusEnum.java
+2
-3
CrossIndexServiceImpl.java
...ava/net/wanji/opt/service/impl/CrossIndexServiceImpl.java
+20
-15
StrategyControlController.java
...i/opt/synthesis/controller/StrategyControlController.java
+16
-1
StrategyControlService.java
...t/wanji/opt/synthesis/service/StrategyControlService.java
+13
-3
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+4
-4
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/common/enums/OptStatusEnum.java
View file @
de0b467f
...
...
@@ -12,9 +12,8 @@ import java.util.Objects;
@Getter
@AllArgsConstructor
public
enum
OptStatusEnum
{
ZERO
(
0
,
"未优化"
),
ONE
(
1
,
"优化中"
),
TWO
(
2
,
"优化完"
);
ZERO
(
0
,
"正常"
),
ONE
(
1
,
"优化中"
);
private
Integer
code
;
private
String
desc
;
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/CrossIndexServiceImpl.java
View file @
de0b467f
...
...
@@ -130,25 +130,30 @@ public class CrossIndexServiceImpl implements CrossIndexService {
aiOptResultVO
.
setId
(
resultEntity
.
getCrossId
());
aiOptResultVO
.
setName
(
resultEntity
.
getCrossName
());
Integer
currentAlgo
=
resultEntity
.
getCurrentAlgo
();
if
(
Objects
.
nonNull
(
currentAlgo
))
{
aiOptResultVO
.
setStrategy
(
currentAlgo
);
// 失衡 均衡调控,其他效率提升
aiOptResultVO
.
setOptMethod
(
Objects
.
equals
(
1
,
currentAlgo
)
?
StrategyControlEnum
.
ONE
.
getMethod
()
:
StrategyControlEnum
.
TWO
.
getMethod
());
// 失衡 优化中,15分钟内,优化中,其他,优化完
aiOptResultVO
.
setOptStatus
(
OptStatusEnum
.
TWO
.
getCode
());
if
(
Objects
.
equals
(
1
,
currentAlgo
))
{
aiOptResultVO
.
setOptStatus
(
OptStatusEnum
.
ZERO
.
getCode
());
Date
issueTimeDate
=
resultEntity
.
getIssueTime
();
//Date issueTimeDate = DateUtils.parseDate(issueTime
);
Integer
countDown
=
Objects
.
isNull
(
resultEntity
.
getCountDown
())
?
0
:
resultEntity
.
getCountDown
(
);
long
optTime
=
issueTimeDate
.
getTime
();
long
currentTimeMillis
=
System
.
currentTimeMillis
();
long
offset
=
currentTimeMillis
-
optTime
;
long
offset
=
(
currentTimeMillis
-
optTime
)
/
1000
;
if
(
Objects
.
equals
(
1
,
currentAlgo
))
{
if
(
offset
<=
15
*
60
*
1000
)
{
aiOptResultVO
.
setOptStatus
(
OptStatusEnum
.
ONE
.
getCode
());
}
}
else
{
if
(
offset
<=
countDown
)
{
aiOptResultVO
.
setOptStatus
(
OptStatusEnum
.
ONE
.
getCode
());
}
}
aiOptResultVO
.
setOptStatusName
(
Objects
.
equals
(
1
,
currentAlgo
)
?
OptStatusEnum
.
ONE
.
getDesc
()
:
OptStatusEnum
.
TWO
.
getDesc
(
));
if
(
Objects
.
isNull
(
currentAlgo
))
{
aiOptResultVO
.
setOptStatus
(
-
1
);
aiOptResultVO
.
setOptStatusName
(
OptStatusEnum
.
ZERO
.
getDesc
(
));
aiOptResultVO
.
setOptStatusName
(
OptStatusEnum
.
getDesc
(
aiOptResultVO
.
getOptStatus
()
));
}
else
{
aiOptResultVO
.
setOptStatus
(
OptStatusEnum
.
ZERO
.
getCode
()
);
aiOptResultVO
.
setOptStatusName
(
OptStatusEnum
.
getDesc
(
aiOptResultVO
.
getOptStatus
()
));
}
results
.
add
(
aiOptResultVO
);
}
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/controller/StrategyControlController.java
View file @
de0b467f
...
...
@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
javax.ws.rs.core.MediaType
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @author duanruiming
...
...
@@ -182,6 +184,19 @@ public class StrategyControlController {
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
StrategyFactoryEntity
.
class
),
})
public
JsonViewObject
strategyFactoryDel
(
@Param
(
"id"
)
Integer
id
)
throws
Exception
{
return
strategyControlService
.
strategyFactoryDel
(
id
);
return
strategyControlService
.
strategyFactoryDel
(
Arrays
.
asList
(
id
)
);
}
@ApiOperation
(
value
=
"策略管理计划批量删除"
,
notes
=
"策略管理计划批量删除"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/strategyFactoryDelList"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
StrategyFactoryEntity
.
class
),
})
public
JsonViewObject
strategyFactoryDelList
(
@RequestBody
List
<
Integer
>
ids
)
throws
Exception
{
return
strategyControlService
.
strategyFactoryDel
(
ids
);
}
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/StrategyControlService.java
View file @
de0b467f
...
...
@@ -3,10 +3,11 @@ package net.wanji.opt.synthesis.service;
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.pojo.vo.StrategyFactoryQueryVO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author duanruiming
...
...
@@ -16,15 +17,24 @@ public interface StrategyControlService {
JsonViewObject
strategyInfoOperation
(
StrategyControlVO
strategyControlVO
)
throws
Exception
;
JsonViewObject
strategyInfoPageList
(
StrategyControlDataEntity
entity
)
throws
Exception
;
JsonViewObject
crossStrategyInfoList
(
Integer
type
)
throws
Exception
;
JsonViewObject
strategyOptTimes
()
throws
Exception
;
JsonViewObject
crossStrategyHistList
(
Integer
strategyType
,
Integer
groupType
,
Integer
resultType
)
throws
Exception
;
JsonViewObject
crossOptInfoList
(
Integer
type
)
throws
Exception
;
JsonViewObject
strategyPlanDetail
(
String
crossId
)
throws
Exception
;
JsonViewObject
strategyPush
(
StrategyControlDetailList
list
)
throws
Exception
;
JsonViewObject
strategyPlanSave
(
StrategyControlDetailList
list
)
throws
Exception
;
JsonViewObject
strategyFactoryList
(
StrategyFactoryQueryVO
vo
)
throws
Exception
;
JsonViewObject
strategyFactorySave
(
StrategyFactoryEntity
entity
)
throws
Exception
;
JsonViewObject
strategyFactoryDel
(
Integer
id
)
throws
Exception
;
JsonViewObject
strategyFactoryDel
(
List
<
Integer
>
ids
)
throws
Exception
;
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
de0b467f
...
...
@@ -913,12 +913,12 @@ public class StrategyControlServiceImpl implements StrategyControlService {
}
@Override
public
JsonViewObject
strategyFactoryDel
(
Integer
id
)
throws
Exception
{
public
JsonViewObject
strategyFactoryDel
(
List
<
Integer
>
ids
)
throws
Exception
{
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
try
{
StrategyFactoryEntity
strategyFactoryEntity
=
new
StrategyFactoryEntity
();
strategyFactoryEntity
.
setId
(
id
);
strategyFactoryMapper
.
deleteById
(
strategyFactoryEntity
);
if
(!
CollectionUtils
.
isEmpty
(
ids
))
{
strategyFactoryMapper
.
deleteBatchIds
(
ids
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"策略库策略删除失败:{}"
,
e
);
jsonViewObject
.
success
(
"策略库策略删除失败"
);
...
...
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