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
92556429
Commit
92556429
authored
Nov 04, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 神思策略接口
parent
e961c4c8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
23 deletions
+96
-23
StrategyControlInfoMapper.java
...a/net/wanji/opt/dao/mapper/StrategyControlInfoMapper.java
+15
-0
StrategyControlDataEntity.java
...main/java/net/wanji/opt/po/StrategyControlDataEntity.java
+29
-0
StrategyControlDataVO.java
...a/net/wanji/opt/synthesis/pojo/StrategyControlDataVO.java
+1
-1
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+17
-22
StrategyControlInfoMapper.xml
...e/src/main/resources/mapper/StrategyControlInfoMapper.xml
+34
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/dao/mapper/StrategyControlInfoMapper.java
0 → 100644
View file @
92556429
package
net
.
wanji
.
opt
.
dao
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
net.wanji.opt.po.StrategyControlDataEntity
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author duanruiming
* @date 2024/11/04 10:57
*/
public
interface
StrategyControlInfoMapper
extends
BaseMapper
<
StrategyControlDataEntity
>
{
int
insertBatch
(
@Param
(
"list"
)
List
<
StrategyControlDataEntity
>
list
);
}
signal-optimize-service/src/main/java/net/wanji/opt/po/StrategyControlDataEntity.java
0 → 100644
View file @
92556429
package
net
.
wanji
.
opt
.
po
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author duanruiming
* @date 2024/11/04 10:53
*/
@Data
public
class
StrategyControlDataEntity
{
/** value = 路口干线Id */
private
String
bizId
;
/** value = 类型 0-路口 1-干线 */
private
Integer
bizType
;
/** value = 策略类型 0-绿波带 1-失衡 2-溢出 3-空放 */
private
Integer
strategy
;
/** value = 开始时间日期 */
private
Date
scheduleStart
;
/** value = 结束时间日期 */
private
Date
scheduleEnd
;
/** value = 日计划表 */
private
String
time
;
/** value = 调控频率(秒),策略下发的频率(只针对失衡和绿波带有效) */
private
Integer
frequency
;
/** value = 状态(1=开启,0=停止) */
private
Integer
status
;
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/pojo/StrategyControlDataVO.java
View file @
92556429
...
@@ -28,7 +28,7 @@ public class StrategyControlDataVO {
...
@@ -28,7 +28,7 @@ public class StrategyControlDataVO {
@ApiModelProperty
(
value
=
"日计划表"
)
@ApiModelProperty
(
value
=
"日计划表"
)
private
List
<
StrategyControlDataVO
.
TimeTable
>
time
;
private
List
<
StrategyControlDataVO
.
TimeTable
>
time
;
@ApiModelProperty
(
value
=
"调控频率(秒),策略下发的频率(只针对失衡和绿波带有效)"
)
@ApiModelProperty
(
value
=
"调控频率(秒),策略下发的频率(只针对失衡和绿波带有效)"
)
private
Integer
freq
;
private
Integer
freq
uency
;
@ApiModelProperty
(
value
=
"状态(1=开启,0=停止)"
)
@ApiModelProperty
(
value
=
"状态(1=开启,0=停止)"
)
private
Integer
status
;
private
Integer
status
;
@ApiModelProperty
(
value
=
"操作(insert=新增,update=更新,delete=删除)"
)
@ApiModelProperty
(
value
=
"操作(insert=新增,update=更新,delete=删除)"
)
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
92556429
...
@@ -7,13 +7,16 @@ import net.wanji.common.enums.DateStyle;
...
@@ -7,13 +7,16 @@ import net.wanji.common.enums.DateStyle;
import
net.wanji.common.framework.Constants
;
import
net.wanji.common.framework.Constants
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.common.utils.tool.JacksonUtils
;
import
net.wanji.common.utils.tool.JacksonUtils
;
import
net.wanji.opt.dao.mapper.StrategyControlInfoMapper
;
import
net.wanji.opt.po.StrategyControlDataEntity
;
import
net.wanji.opt.synthesis.pojo.*
;
import
net.wanji.opt.synthesis.pojo.*
;
import
net.wanji.opt.synthesis.service.PushStrategyControlService
;
import
net.wanji.opt.synthesis.service.PushStrategyControlService
;
import
net.wanji.opt.synthesis.service.StrategyControlService
;
import
net.wanji.opt.synthesis.service.StrategyControlService
;
import
org.
springframework.beans.factory.annotation.Autowired
;
import
org.
apache.commons.beanutils.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.*
;
/**
/**
...
@@ -24,34 +27,26 @@ import java.util.*;
...
@@ -24,34 +27,26 @@ import java.util.*;
@Service
@Service
public
class
StrategyControlServiceImpl
implements
StrategyControlService
{
public
class
StrategyControlServiceImpl
implements
StrategyControlService
{
@
Autowired
@
Resource
private
PushStrategyControlService
pushStrategyControlService
;
private
PushStrategyControlService
pushStrategyControlService
;
@Resource
private
StrategyControlInfoMapper
strategyControlInfoMapper
;
@Override
@Override
public
JsonViewObject
strategyInfoOperation
(
StrategyControlVO
strategyControlVO
)
throws
Exception
{
public
JsonViewObject
strategyInfoOperation
(
StrategyControlVO
strategyControlVO
)
throws
Exception
{
try
{
try
{
StrategyControlReq
req
=
convertReq
(
strategyControlVO
);
// 存库
// 存库
// 调用推送
List
<
StrategyControlDataEntity
>
entities
=
new
ArrayList
<>();
//StrategyControlDataReq detailData = new StrategyControlDataReq();
List
<
StrategyControlDataVO
>
dataList
=
strategyControlVO
.
getDataList
();
//detailData.setBiz_id("241940");
for
(
StrategyControlDataVO
dataVO
:
dataList
)
{
//detailData.setBiz_type(0);
StrategyControlDataEntity
entity
=
new
StrategyControlDataEntity
();
//detailData.setStrategy(3);
BeanUtils
.
copyProperties
(
entity
,
dataVO
);
//Date date = new Date();
entity
.
setTime
(
JacksonUtils
.
getInstance
().
writeValueAsString
(
dataVO
.
getTime
()));
//detailData.setSchedule_end(DateUtil.format(date, DateStyle.YYYY_MM_DD_HH_MM_SS.getValue()));
}
//detailData.setSchedule_end(DateUtil.format(date, DateStyle.YYYY_MM_DD_HH_MM_SS.getValue()));
strategyControlInfoMapper
.
insertBatch
(
entities
);
//StrategyControlDataReq.Time_table timeTable = new StrategyControlDataReq.Time_table();
//timeTable.setWeek(1);
//timeTable.setTime_list(new String[]{"00:00-01:00", "01:00-02:00"});
//StrategyControlDataReq.Time_table timeTable1 = new StrategyControlDataReq.Time_table();
//timeTable1.setWeek(1);
//timeTable1.setTime_list(new String[]{"02:00-03:00", "03:00-04:00"});
//detailData.setTime(Arrays.asList(timeTable1, timeTable));
//detailData.setFreq(1000 * 60);
//detailData.setStrategy(1);
//detailData.setAction("insert");
StrategyControlReq
req
=
convertReq
(
strategyControlVO
);
// todo 测试数据
// todo 测试数据
//req.setData(Arrays.asList(detailData));
//req.setData(Arrays.asList(detailData));
Result
result
=
pushStrategyControlService
.
push
(
req
);
Result
result
=
pushStrategyControlService
.
push
(
req
);
...
@@ -93,7 +88,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -93,7 +88,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
timeTables
.
add
(
timeTable
);
timeTables
.
add
(
timeTable
);
});
});
detailData
.
setTime
(
timeTables
);
detailData
.
setTime
(
timeTables
);
detailData
.
setFreq
(
dataVO
.
getFreq
());
detailData
.
setFreq
(
dataVO
.
getFreq
uency
());
detailData
.
setStatus
(
dataVO
.
getStatus
());
detailData
.
setStatus
(
dataVO
.
getStatus
());
detailData
.
setAction
(
dataVO
.
getAction
());
detailData
.
setAction
(
dataVO
.
getAction
());
dataReqList
.
add
(
detailData
);
dataReqList
.
add
(
detailData
);
...
...
signal-optimize-service/src/main/resources/mapper/StrategyControlInfoMapper.xml
0 → 100644
View file @
92556429
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"net.wanji.opt.dao.mapper.StrategyControlInfoMapper"
>
<insert
id=
"insertBatch"
parameterType=
"net.wanji.opt.po.StrategyControlDataEntity"
>
INSERT INTO t_strategy_control_info (
bizId,
bizType,
strategy,
schedule_start,
schedule_end,
`time`,
frequency,
status,
create_time,
gmt_modified
) VALUES
<foreach
collection=
"list"
item=
"entity"
separator=
","
>
#{entity.bizId},
#{entity.bizType},
#{entity.strategy},
#{entity.scheduleStart},
#{entity.scheduleEnd},
#{entity.time},
#{entity.frequency},
#{entity.status},
#{createTime, jdbcType=TIMESTAMP, default=CURRENT_TIMESTAMP},
#{gmtModified, jdbcType=TIMESTAMP, default=CURRENT_TIMESTAMP, update="CURRENT_TIMESTAMP"}
</foreach>
</insert>
</mapper>
\ No newline at end of file
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