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
ec1060a4
Commit
ec1060a4
authored
Mar 30, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 方案管理-方案下发优化
parent
0232bbca
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
8 deletions
+84
-8
CrossSectionMapper.java
.../java/net/wanji/web/mapper/scheme/CrossSectionMapper.java
+4
-0
PlanSendServiceImpl.java
.../java/net/wanji/web/service/impl/PlanSendServiceImpl.java
+52
-5
CrossSectionMapper.xml
...e/src/main/resources/mapper/scheme/CrossSectionMapper.xml
+28
-3
No files found.
signal-control-service/src/main/java/net/wanji/web/mapper/scheme/CrossSectionMapper.java
View file @
ec1060a4
...
@@ -4,6 +4,8 @@ import net.wanji.web.po.scheme.CrossSectionPO;
...
@@ -4,6 +4,8 @@ import net.wanji.web.po.scheme.CrossSectionPO;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
/**
* 时段基础信息;(t_base_cross_section)表
* 时段基础信息;(t_base_cross_section)表
*
*
...
@@ -16,4 +18,6 @@ public interface CrossSectionMapper {
...
@@ -16,4 +18,6 @@ public interface CrossSectionMapper {
void
insertOne
(
CrossSectionPO
crossSectionPO
);
void
insertOne
(
CrossSectionPO
crossSectionPO
);
void
deleteByCrossId
(
@Param
(
"crossId"
)
String
crossId
);
void
deleteByCrossId
(
@Param
(
"crossId"
)
String
crossId
);
List
<
CrossSectionPO
>
listCrossSectionPO
(
@Param
(
"entity"
)
CrossSectionPO
entity
);
}
}
signal-control-service/src/main/java/net/wanji/web/service/impl/PlanSendServiceImpl.java
View file @
ec1060a4
...
@@ -43,13 +43,14 @@ public class PlanSendServiceImpl implements PlanSendService {
...
@@ -43,13 +43,14 @@ public class PlanSendServiceImpl implements PlanSendService {
private
final
SchemeConfigServiceImpl
schemeConfigServiceImpl
;
private
final
SchemeConfigServiceImpl
schemeConfigServiceImpl
;
private
final
CrossSchedulesMapper
crossSchedulesMapper
;
private
final
CrossSchedulesMapper
crossSchedulesMapper
;
private
final
CrossLaneLightsMapper
crossLaneLightsMapper
;
private
final
CrossLaneLightsMapper
crossLaneLightsMapper
;
private
final
CrossSectionMapper
crossSectionMapper
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
hourMinuteSdf
=
new
SimpleDateFormat
(
"HH:mm"
);
SimpleDateFormat
hourMinuteSdf
=
new
SimpleDateFormat
(
"HH:mm"
);
private
Gson
gson
=
new
GsonBuilder
().
setDateFormat
(
"yyyy-MM-dd"
).
create
();
private
Gson
gson
=
new
GsonBuilder
().
setDateFormat
(
"yyyy-MM-dd"
).
create
();
public
PlanSendServiceImpl
(
@Qualifier
(
"net.wanji.feign.service.UtcFeignClients"
)
UtcFeignClients
utcFeignClients
,
CrossSchedulesPlanMapper
crossSchedulesPlanMapper
,
CrossPlanMapper
crossPlanMapper
,
CrossSchemeMapper
crossSchemeMapper
,
CrossPhaseMapper
crossPhaseMapper
,
CrossLightsMapper
crossLightsMapper
,
CrossPhaseLightsMapper
crossPhaseLightsMapper
,
RunningPlanServiceImpl
runningPlanServiceImpl
,
SchemeConfigServiceImpl
schemeConfigServiceImpl
,
CrossSchedulesMapper
crossSchedulesMapper
,
CrossLaneLightsMapper
crossLaneLightsMapper
)
{
public
PlanSendServiceImpl
(
@Qualifier
(
"net.wanji.feign.service.UtcFeignClients"
)
UtcFeignClients
utcFeignClients
,
CrossSchedulesPlanMapper
crossSchedulesPlanMapper
,
CrossPlanMapper
crossPlanMapper
,
CrossSchemeMapper
crossSchemeMapper
,
CrossPhaseMapper
crossPhaseMapper
,
CrossLightsMapper
crossLightsMapper
,
CrossPhaseLightsMapper
crossPhaseLightsMapper
,
RunningPlanServiceImpl
runningPlanServiceImpl
,
SchemeConfigServiceImpl
schemeConfigServiceImpl
,
CrossSchedulesMapper
crossSchedulesMapper
,
CrossLaneLightsMapper
crossLaneLightsMapper
,
CrossSectionMapper
crossSectionMapper
)
{
this
.
utcFeignClients
=
utcFeignClients
;
this
.
utcFeignClients
=
utcFeignClients
;
this
.
crossSchedulesPlanMapper
=
crossSchedulesPlanMapper
;
this
.
crossSchedulesPlanMapper
=
crossSchedulesPlanMapper
;
this
.
crossPlanMapper
=
crossPlanMapper
;
this
.
crossPlanMapper
=
crossPlanMapper
;
...
@@ -61,29 +62,75 @@ public class PlanSendServiceImpl implements PlanSendService {
...
@@ -61,29 +62,75 @@ public class PlanSendServiceImpl implements PlanSendService {
this
.
schemeConfigServiceImpl
=
schemeConfigServiceImpl
;
this
.
schemeConfigServiceImpl
=
schemeConfigServiceImpl
;
this
.
crossSchedulesMapper
=
crossSchedulesMapper
;
this
.
crossSchedulesMapper
=
crossSchedulesMapper
;
this
.
crossLaneLightsMapper
=
crossLaneLightsMapper
;
this
.
crossLaneLightsMapper
=
crossLaneLightsMapper
;
this
.
crossSectionMapper
=
crossSectionMapper
;
}
}
@Override
@Override
@Transactional
@Transactional
public
JsonViewObject
scheduleSend
(
ScheduleIdDTO
scheduleIdDTO
)
{
public
JsonViewObject
scheduleSend
(
ScheduleIdDTO
scheduleIdDTO
)
{
String
crossId
=
scheduleIdDTO
.
getCrossId
();
String
crossId
=
scheduleIdDTO
.
getCrossId
();
Integer
scheduleId
=
scheduleIdDTO
.
getScheduleId
();
ScheduleSendVO
scheduleSendVO
=
new
ScheduleSendVO
();
ScheduleSendVO
scheduleSendVO
=
new
ScheduleSendVO
();
scheduleSendVO
.
setCrossCode
(
crossId
);
scheduleSendVO
.
setCrossCode
(
crossId
);
// 构造时间表
// 下发调度
List
<
ScheduleSendVO
.
Schedule
>
schedules
=
buildSchedules
(
crossId
,
scheduleIdDTO
);
List
<
ScheduleSendVO
.
Schedule
>
schedules
=
buildSchedules
(
crossId
,
scheduleIdDTO
);
scheduleSendVO
.
setSchedules
(
schedules
);
scheduleSendVO
.
setSchedules
(
schedules
);
// 发送请求
JsonViewObject
jsonViewObject
=
utcFeignClients
.
scheduleSend
(
scheduleSendVO
);
JsonViewObject
jsonViewObject
=
utcFeignClients
.
scheduleSend
(
scheduleSendVO
);
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCode
()
!=
200
)
{
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCode
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"信号机方案下发-
时间表
下发UTC服务调用异常"
);
return
jsonViewObject
.
fail
(
"信号机方案下发-
运行计划
下发UTC服务调用异常"
);
}
}
// 下发日计划和方案
PlanSendVO
planSendVO
=
getPlanSendVO
(
crossId
,
scheduleId
);
JsonViewObject
planSendResult
=
utcFeignClients
.
planSend
(
planSendVO
);
if
(
Objects
.
isNull
(
planSendResult
)
||
planSendResult
.
getCode
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"信号机方案下发-日计划下发UTC服务调用异常"
);
}
// 更新时间表状态为已执行
// 更新时间表状态为已执行
Integer
scheduleId
=
scheduleIdDTO
.
getScheduleId
();
crossSchedulesMapper
.
resetStatus
(
crossId
);
crossSchedulesMapper
.
resetStatus
(
crossId
);
crossSchedulesMapper
.
updateStatus
(
scheduleId
);
crossSchedulesMapper
.
updateStatus
(
scheduleId
);
return
jsonViewObject
.
success
();
return
jsonViewObject
.
success
();
}
}
private
PlanSendVO
getPlanSendVO
(
String
crossId
,
Integer
scheduleId
)
{
List
<
CrossSchedulesPlanPO
>
crossSchedulesPlanPOList
=
crossSchedulesPlanMapper
.
selectByCrossIdAndSchedulesId
(
crossId
,
scheduleId
);
Integer
planId
=
crossSchedulesPlanPOList
.
get
(
0
).
getPlanId
();
CrossPlanPO
crossPlanPO
=
crossPlanMapper
.
selectById
(
planId
);
CrossSectionPO
crossSectionPO
=
new
CrossSectionPO
();
crossSectionPO
.
setCrossId
(
crossId
);
crossSectionPO
.
setPlanId
(
planId
);
List
<
CrossSectionPO
>
crossSectionPOS
=
crossSectionMapper
.
listCrossSectionPO
(
crossSectionPO
);
List
<
PlanSendVO
.
Plan
.
Section
>
sectionList
=
new
ArrayList
<>(
crossSectionPOS
.
size
());
for
(
CrossSectionPO
sectionPO
:
crossSectionPOS
)
{
Integer
schemeId
=
sectionPO
.
getSchemeId
();
PlanSendVO
.
Plan
.
Section
section
=
new
PlanSendVO
.
Plan
.
Section
();
section
.
setSectionNo
(
sectionPO
.
getSectionNo
());
section
.
setPatternNo
(
String
.
valueOf
(
schemeId
));
section
.
setBeginTime
(
sectionPO
.
getStartTime
());
section
.
setEndTime
(
sectionPO
.
getEndTime
());
section
.
setControlMode
(
String
.
valueOf
(
sectionPO
.
getControlMode
()));
sectionList
.
add
(
section
);
// 下发日计划中方案
SchemeIdDTO
schemeIdDTO
=
new
SchemeIdDTO
();
schemeIdDTO
.
setCrossId
(
crossId
);
schemeIdDTO
.
setSchemeId
(
schemeId
);
schemeSend
(
schemeIdDTO
);
}
PlanSendVO
planSendVO
=
new
PlanSendVO
();
planSendVO
.
setCrossCode
(
crossId
);
PlanSendVO
.
Plan
plan
=
new
PlanSendVO
.
Plan
();
plan
.
setPlanNo
(
crossPlanPO
.
getPlanNo
());
plan
.
setPlanDescribe
(
crossPlanPO
.
getName
());
plan
.
setSectionList
(
sectionList
);
planSendVO
.
setPlanList
(
Arrays
.
asList
(
plan
));
return
planSendVO
;
}
@Override
@Override
public
JsonViewObject
schemeSend
(
SchemeIdDTO
schemeIdDTO
)
{
public
JsonViewObject
schemeSend
(
SchemeIdDTO
schemeIdDTO
)
{
String
crossId
=
schemeIdDTO
.
getCrossId
();
String
crossId
=
schemeIdDTO
.
getCrossId
();
...
...
signal-control-service/src/main/resources/mapper/scheme/CrossSectionMapper.xml
View file @
ec1060a4
...
@@ -16,15 +16,40 @@
...
@@ -16,15 +16,40 @@
<result
property=
"gmtModified"
column=
"gmt_modified"
/>
<result
property=
"gmtModified"
column=
"gmt_modified"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_list"
>
id, section_no,start_time, end_time, cross_id, plan_id, control_mode, scheme_id,gmt_create, gmt_modified
</sql>
<insert
id=
"insertOne"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
<insert
id=
"insertOne"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into t_base_cross_section(section_no,
start_time,end_time,cross_id,plan_id,control_mode,
scheme_id)
insert into t_base_cross_section(section_no,
start_time, end_time, cross_id, plan_id, control_mode,
scheme_id)
values (#{sectionNo},
#{startTime},#{endTime},#{crossId},#{planId},#{controlMode},
#{schemeId})
values (#{sectionNo},
#{startTime}, #{endTime}, #{crossId}, #{planId}, #{controlMode},
#{schemeId})
</insert>
</insert>
<delete
id=
"deleteByCrossId"
>
<delete
id=
"deleteByCrossId"
>
DELETE FROM t_base_cross_section
DELETE
FROM t_base_cross_section
WHERE cross_id = #{crossId}
WHERE cross_id = #{crossId}
</delete>
</delete>
<select
id=
"listCrossSectionPO"
parameterType=
"net.wanji.web.po.scheme.CrossSectionPO"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_list"
/>
from t_base_cross_section
<where>
<if
test=
"entity.id != null and entity.id != ''"
>
and id = #{entity.id}
</if>
<if
test=
"entity.crossId != null and entity.crossId != ''"
>
and cross_id = #{entity.crossId}
</if>
<if
test=
"entity.planId != null and entity.planId != ''"
>
and plan_id = #{entity.planId}
</if>
<if
test=
"entity.schemeId != null and entity.schemeId != ''"
>
and scheme_id = #{entity.schemeId}
</if>
</where>
</select>
</mapper>
</mapper>
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