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
b5de02c9
Commit
b5de02c9
authored
Nov 04, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 策略操作接口优化
parent
c3c89fa9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
StrategyControlDataVO.java
...a/net/wanji/opt/synthesis/pojo/StrategyControlDataVO.java
+2
-0
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+19
-9
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/pojo/StrategyControlDataVO.java
View file @
b5de02c9
...
@@ -15,6 +15,8 @@ import java.util.List;
...
@@ -15,6 +15,8 @@ import java.util.List;
@Data
@Data
@ApiModel
(
value
=
"StrategyControlDataVO"
,
description
=
"策略控制操作数据实体"
)
@ApiModel
(
value
=
"StrategyControlDataVO"
,
description
=
"策略控制操作数据实体"
)
public
class
StrategyControlDataVO
{
public
class
StrategyControlDataVO
{
@ApiModelProperty
(
value
=
"id"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"路口干线Id"
)
@ApiModelProperty
(
value
=
"路口干线Id"
)
private
String
bizId
;
private
String
bizId
;
@ApiModelProperty
(
value
=
"类型 0-路口 1-干线"
)
@ApiModelProperty
(
value
=
"类型 0-路口 1-干线"
)
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
b5de02c9
...
@@ -3,6 +3,7 @@ package net.wanji.opt.synthesis.service.impl;
...
@@ -3,6 +3,7 @@ package net.wanji.opt.synthesis.service.impl;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.enums.DateStyle
;
import
net.wanji.common.enums.DateStyle
;
import
net.wanji.common.framework.Constants
;
import
net.wanji.common.framework.Constants
;
...
@@ -19,6 +20,7 @@ import org.springframework.stereotype.Service;
...
@@ -19,6 +20,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
...
@@ -41,15 +43,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -41,15 +43,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
try
{
try
{
// 存库
// 存库
List
<
StrategyControlDataEntity
>
entities
=
new
ArrayList
<>();
insertAndUpdate
(
strategyControlVO
);
List
<
StrategyControlDataVO
>
dataList
=
strategyControlVO
.
getDataList
();
for
(
StrategyControlDataVO
dataVO
:
dataList
)
{
StrategyControlDataEntity
entity
=
new
StrategyControlDataEntity
();
BeanUtils
.
copyProperties
(
entity
,
dataVO
);
entity
.
setTime
(
JacksonUtils
.
getInstance
().
writeValueAsString
(
dataVO
.
getTime
()));
entities
.
add
(
entity
);
}
strategyControlInfoMapper
.
insertBatch
(
entities
);
StrategyControlReq
req
=
convertReq
(
strategyControlVO
);
StrategyControlReq
req
=
convertReq
(
strategyControlVO
);
Result
result
=
pushStrategyControlService
.
push
(
req
);
Result
result
=
pushStrategyControlService
.
push
(
req
);
...
@@ -69,6 +63,22 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -69,6 +63,22 @@ public class StrategyControlServiceImpl implements StrategyControlService {
}
}
}
}
private
void
insertAndUpdate
(
StrategyControlVO
strategyControlVO
)
throws
IllegalAccessException
,
InvocationTargetException
,
JsonProcessingException
{
List
<
StrategyControlDataVO
>
dataList
=
strategyControlVO
.
getDataList
();
for
(
StrategyControlDataVO
dataVO
:
dataList
)
{
StrategyControlDataEntity
entity
=
new
StrategyControlDataEntity
();
BeanUtils
.
copyProperties
(
entity
,
dataVO
);
entity
.
setTime
(
JacksonUtils
.
getInstance
().
writeValueAsString
(
dataVO
.
getTime
()));
if
(
StringUtils
.
equals
(
"insert"
,
dataVO
.
getAction
()))
{
strategyControlInfoMapper
.
insert
(
entity
);
}
else
if
(
StringUtils
.
equals
(
"update"
,
dataVO
.
getAction
()))
{
strategyControlInfoMapper
.
updateById
(
entity
);
}
else
if
(
StringUtils
.
equals
(
"delete"
,
dataVO
.
getAction
()))
{
strategyControlInfoMapper
.
deleteById
(
entity
);
}
}
}
private
StrategyControlReq
convertReq
(
StrategyControlVO
vo
)
throws
Exception
{
private
StrategyControlReq
convertReq
(
StrategyControlVO
vo
)
throws
Exception
{
try
{
try
{
List
<
StrategyControlDataVO
>
dataList
=
vo
.
getDataList
();
List
<
StrategyControlDataVO
>
dataList
=
vo
.
getDataList
();
...
...
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