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
849cf846
Commit
849cf846
authored
Jun 27, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 万集标准类型优化
parent
982f885a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
37 deletions
+38
-37
WanJiCommonStaticInfoService.java
.../utc/service/staticinfo/WanJiCommonStaticInfoService.java
+2
-4
WanJiCommonStaticInfoServiceImpl.java
...ice/staticinfo/impl/WanJiCommonStaticInfoServiceImpl.java
+36
-33
No files found.
signal-utc-service/src/main/java/net/wanji/utc/service/staticinfo/WanJiCommonStaticInfoService.java
View file @
849cf846
package
net
.
wanji
.
utc
.
service
.
staticinfo
;
import
net.wanji.databus.dao.entity.CrossSchedulesPO
;
import
net.wanji.databus.vo.PlanSectionVO
;
import
net.wanji.databus.vo.SchemePhaseLightsVO
;
import
net.wanji.utc.common.Result
;
import
net.wanji.utc.service.rpc.RpcService
;
...
...
@@ -21,7 +19,7 @@ public interface WanJiCommonStaticInfoService extends RpcService {
* @param signalId
* @return
*/
Result
<
SchemePhaseLightsVO
>
schemePhaseLights
(
String
crossId
,
String
signalId
)
throws
Exception
;
void
schemePhaseLights
(
String
crossId
,
String
signalId
)
throws
Exception
;
/**
* 静态参数,获取计划数据-计划信息、时段信息
...
...
@@ -30,7 +28,7 @@ public interface WanJiCommonStaticInfoService extends RpcService {
* @param signalId
* @return
*/
Result
<
PlanSectionVO
>
planSection
(
String
crossId
,
String
signalId
,
Integer
planNo
)
throws
Exception
;
void
planSection
(
String
crossId
,
String
signalId
,
Integer
planNo
)
throws
Exception
;
/**
* 静态参数,获取时间表数据
...
...
signal-utc-service/src/main/java/net/wanji/utc/service/staticinfo/impl/WanJiCommonStaticInfoServiceImpl.java
View file @
849cf846
package
net
.
wanji
.
utc
.
service
.
staticinfo
.
impl
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.framework.rest.JsonViewObject
;
...
...
@@ -45,63 +47,61 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe
@Override
public
Result
<
SchemePhaseLightsVO
>
schemePhaseLights
(
String
crossId
,
String
signalId
)
throws
Exception
{
public
void
schemePhaseLights
(
String
crossId
,
String
signalId
)
throws
Exception
{
String
manufacturerIdCode
=
crossInfoCache
.
getManufacturerCodeByCrossId
(
crossId
);
CrossIdVO
crossIdVO
=
new
CrossIdVO
();
crossIdVO
.
setCrossId
(
crossId
);
JsonViewObject
jsonViewObject
=
utcFeignClientCache
.
getUtcFeignClientService
(
manufacturerIdCode
).
schemePhaseLights
(
crossIdVO
);
SchemePhaseLightsVO
content
=
(
SchemePhaseLightsVO
)
jsonViewObject
.
getContent
();
if
(
Objects
.
nonNull
(
content
))
{
List
<
BaseCrossSchemePO
>
crossSchemeList
=
content
.
getCrossSchemeList
();
crossSchemeList
.
forEach
(
crossSchemePO
->
{
crossSchemeMapper
.
deleteOne
(
crossId
,
crossSchemePO
.
getSchemeNo
());
crossSchemeMapper
.
insertOne
(
crossSchemePO
);
});
List
<
CrossPhasePO
>
crossPhaseList
=
content
.
getCrossPhaseList
();
crossPhaseList
.
forEach
(
crossPhasePO
->
{
crossPhaseMapper
.
deleteBatch
(
crossId
,
crossPhasePO
.
getPlanId
());
crossPhaseMapper
.
insertOne
(
crossPhasePO
);
});
ObjectMapper
objectMapper
=
new
ObjectMapper
();
SchemePhaseLightsVO
content
=
objectMapper
.
convertValue
(
jsonViewObject
.
getContent
(),
SchemePhaseLightsVO
.
class
);
List
<
BaseCrossSchemePO
>
crossSchemeList
=
content
.
getCrossSchemeList
();
crossSchemeList
.
forEach
(
crossSchemePO
->
{
crossSchemeMapper
.
deleteOne
(
crossId
,
crossSchemePO
.
getSchemeNo
());
crossSchemeMapper
.
insertOne
(
crossSchemePO
);
});
List
<
CrossPhasePO
>
crossPhaseList
=
content
.
getCrossPhaseList
();
crossPhaseList
.
forEach
(
crossPhasePO
->
{
crossPhaseMapper
.
deleteBatch
(
crossId
,
crossPhasePO
.
getPlanId
());
crossPhaseMapper
.
insertOne
(
crossPhasePO
);
});
List
<
CrossLightsPO
>
crossLightsList
=
content
.
getCrossLightsList
();
crossLightsList
.
forEach
(
crossLightsPO
->
{
crossLightsMapper
.
deleteOne
(
crossId
,
crossLightsPO
.
getName
());
crossLightsMapper
.
insertOne
(
crossLightsPO
);
});
List
<
CrossPhaseLightsPO
>
crossPhaseLightsPOList
=
content
.
getCrossPhaseLightsPOList
();
if
(!
CollectionUtils
.
isEmpty
(
crossPhaseLightsPOList
))
{
crossPhaseLightsMapper
.
deleteByCrossId
(
crossPhaseLightsPOList
.
get
(
0
).
getCrossId
());
crossPhaseLightsMapper
.
insertBatch
(
crossPhaseLightsPOList
);
}
List
<
CrossLightsPO
>
crossLightsList
=
content
.
getCrossLightsList
();
crossLightsList
.
forEach
(
crossLightsPO
->
{
crossLightsMapper
.
deleteOne
(
crossId
,
crossLightsPO
.
getName
());
crossLightsMapper
.
insertOne
(
crossLightsPO
);
});
List
<
CrossPhaseLightsPO
>
crossPhaseLightsPOList
=
content
.
getCrossPhaseLightsPOList
();
if
(!
CollectionUtils
.
isEmpty
(
crossPhaseLightsPOList
))
{
crossPhaseLightsMapper
.
deleteByCrossId
(
crossPhaseLightsPOList
.
get
(
0
).
getCrossId
());
crossPhaseLightsMapper
.
insertBatch
(
crossPhaseLightsPOList
);
}
return
Result
.
success
(
content
);
}
@Override
public
Result
<
PlanSectionVO
>
planSection
(
String
crossId
,
String
signalId
,
Integer
planNo
)
throws
Exception
{
public
void
planSection
(
String
crossId
,
String
signalId
,
Integer
planNo
)
throws
Exception
{
String
manufacturerIdCode
=
crossInfoCache
.
getManufacturerCodeByCrossId
(
crossId
);
PlanSectionDTO
planSectionDTO
=
new
PlanSectionDTO
();
planSectionDTO
.
setCrossId
(
crossId
);
planSectionDTO
.
setPlanNo
(
planNo
);
JsonViewObject
jsonViewObject
=
utcFeignClientCache
.
getUtcFeignClientService
(
manufacturerIdCode
).
planSection
(
planSectionDTO
);
PlanSectionVO
content
=
(
PlanSectionVO
)
jsonViewObject
.
getContent
();
if
(
Objects
.
nonNull
(
content
))
{
if
(
Objects
.
nonNull
(
content
))
{
List
<
CrossPlanPO
>
crossPlanPOList
=
content
.
getCrossPlanPOList
();
ObjectMapper
mapper
=
new
ObjectMapper
();
List
<
PlanSectionVO
>
content
=
mapper
.
convertValue
(
jsonViewObject
.
getContent
(),
new
TypeReference
<
List
<
PlanSectionVO
>>()
{
});
if
(!
CollectionUtils
.
isEmpty
(
content
))
{
for
(
PlanSectionVO
planSectionVO
:
content
)
{
List
<
CrossPlanPO
>
crossPlanPOList
=
planSectionVO
.
getCrossPlanPOList
();
crossPlanPOList
.
forEach
(
crossPlanPO
->
{
crossPlanMapper
.
deleteOne
(
crossId
,
Integer
.
parseInt
(
crossPlanPO
.
getPlanNo
()));
crossPlanMapper
.
insertOne
(
crossPlanPO
);
});
List
<
CrossSectionPO
>
crossSectionPOList
=
content
.
getCrossSectionPOList
();
List
<
CrossSectionPO
>
crossSectionPOList
=
planSectionVO
.
getCrossSectionPOList
();
crossSectionPOList
.
forEach
(
crossSectionPO
->
{
crossSectionMapper
.
deleteOne
(
crossId
,
Integer
.
parseInt
(
crossSectionPO
.
getSectionNo
()),
null
);
crossSectionMapper
.
insertOne
(
crossSectionPO
);
});
}
}
return
Result
.
success
(
content
);
}
@Override
...
...
@@ -111,7 +111,10 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe
crossSchedulesDTO
.
setManufacturerCode
(
manufacturerIdCode
);
crossSchedulesDTO
.
setCrossIdList
(
Arrays
.
asList
(
crossId
));
JsonViewObject
jsonViewObject
=
utcFeignClientCache
.
getUtcFeignClientService
(
manufacturerIdCode
).
crossSchedules
(
crossSchedulesDTO
);
List
<
CrossSchedulesPO
>
content
=
(
List
<
CrossSchedulesPO
>)
jsonViewObject
.
getContent
();
ObjectMapper
mapper
=
new
ObjectMapper
();
List
<
CrossSchedulesPO
>
content
=
mapper
.
convertValue
(
jsonViewObject
.
getContent
(),
new
TypeReference
<
List
<
CrossSchedulesPO
>>()
{
});
if
(
Objects
.
nonNull
(
content
))
{
if
(!
CollectionUtils
.
isEmpty
(
content
))
{
content
.
forEach
(
crossSchedulesPO
->
{
...
...
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