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
3fe37ca4
Commit
3fe37ca4
authored
Jul 05, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 项目启动时自动加载静态数据
parent
3c93e6a1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
CrossInfoCache.java
.../src/main/java/net/wanji/utc/dt/cache/CrossInfoCache.java
+2
-0
StartQueryStaticInfo.java
...ain/java/net/wanji/utc/dt/cache/StartQueryStaticInfo.java
+61
-0
No files found.
signal-utc-dt-service/src/main/java/net/wanji/utc/dt/cache/CrossInfoCache.java
View file @
3fe37ca4
...
@@ -8,6 +8,7 @@ import net.wanji.databus.dao.mapper.ManufacturerInfoMapper;
...
@@ -8,6 +8,7 @@ import net.wanji.databus.dao.mapper.ManufacturerInfoMapper;
import
net.wanji.databus.po.CrossInfoPO
;
import
net.wanji.databus.po.CrossInfoPO
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -19,6 +20,7 @@ import java.util.*;
...
@@ -19,6 +20,7 @@ import java.util.*;
*/
*/
@Slf4j
@Slf4j
@Component
@Component
@Order
(
1
)
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
class
CrossInfoCache
implements
ApplicationRunner
{
public
class
CrossInfoCache
implements
ApplicationRunner
{
...
...
signal-utc-dt-service/src/main/java/net/wanji/utc/dt/cache/StartQueryStaticInfo.java
0 → 100644
View file @
3fe37ca4
package
net
.
wanji
.
utc
.
dt
.
cache
;
import
net.wanji.databus.dao.entity.CrossSchedulesPO
;
import
net.wanji.databus.dto.PlanSectionDTO
;
import
net.wanji.databus.dto.SchemePhaseLightsDTO
;
import
net.wanji.databus.po.CrossInfoPO
;
import
net.wanji.databus.vo.PlanSectionVO
;
import
net.wanji.databus.vo.SchemePhaseLightsVO
;
import
net.wanji.utc.dt.service.controller.StaticInfoService
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author duanruiming
* @date 2023/07/05 16:23
*/
@Component
@Order
(
2
)
public
class
StartQueryStaticInfo
implements
CommandLineRunner
{
@Resource
(
name
=
"commonThreadPoolExecutor"
)
ThreadPoolTaskExecutor
commonThreadPoolExecutor
;
@Resource
CrossInfoCache
crossInfoCache
;
@Resource
StaticInfoService
staticInfoService
;
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
try
{
Map
<
String
,
CrossInfoPO
>
crossInfoMap
=
crossInfoCache
.
getCrossInfoCache
();
if
(!
crossInfoMap
.
isEmpty
())
{
for
(
Map
.
Entry
<
String
,
CrossInfoPO
>
entry
:
crossInfoMap
.
entrySet
())
{
commonThreadPoolExecutor
.
execute
(()
->
{
try
{
String
crossId
=
entry
.
getKey
();
List
<
CrossSchedulesPO
>
crossSchedulesPOS
=
staticInfoService
.
crossSchedules
(
crossId
);
SchemePhaseLightsDTO
schemePhaseLightsDTO
=
new
SchemePhaseLightsDTO
();
schemePhaseLightsDTO
.
setCrossId
(
crossId
);
SchemePhaseLightsVO
schemePhaseLightsVO
=
staticInfoService
.
schemePhaseLights
(
schemePhaseLightsDTO
);
PlanSectionDTO
planSectionDTO
=
new
PlanSectionDTO
();
planSectionDTO
.
setCrossId
(
crossId
);
List
<
PlanSectionVO
>
planSectionVOS
=
staticInfoService
.
planSection
(
planSectionDTO
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"开机启动自动加载静态信息失败"
,
e
);
}
});
}
}
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"开机启动自动加载静态信息失败"
,
e
);
}
}
}
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