Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
HYH.APSJ
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
佟礼
HYH.APSJ
Commits
edb4f4d5
Commit
edb4f4d5
authored
Dec 29, 2025
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
异步更新缓存
parent
a4664aaf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
4 deletions
+32
-4
ApsApplication.java
src/main/java/com/aps/ApsApplication.java
+3
-0
LanuchController.java
src/main/java/com/aps/controller/LanuchController.java
+29
-4
No files found.
src/main/java/com/aps/ApsApplication.java
View file @
edb4f4d5
...
@@ -4,10 +4,13 @@ package com.aps;
...
@@ -4,10 +4,13 @@ package com.aps;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.EnableAsync
;
@SpringBootApplication
@SpringBootApplication
@MapperScan
(
"com.aps.mapper"
)
// 扫描Mapper接口
@MapperScan
(
"com.aps.mapper"
)
// 扫描Mapper接口
@EnableAsync
public
class
ApsApplication
{
public
class
ApsApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/com/aps/controller/LanuchController.java
View file @
edb4f4d5
...
@@ -8,7 +8,10 @@ import com.aps.service.ProdSceneConfigService;
...
@@ -8,7 +8,10 @@ import com.aps.service.ProdSceneConfigService;
import
com.aps.service.plan.PlanResultService
;
import
com.aps.service.plan.PlanResultService
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
...
@@ -27,6 +30,7 @@ public class LanuchController {
...
@@ -27,6 +30,7 @@ public class LanuchController {
@Autowired
@Autowired
private
ProdSceneConfigService
prodSceneConfigService
;
private
ProdSceneConfigService
prodSceneConfigService
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
LanuchController
.
class
);
/**
/**
* 启动工单
* 启动工单
...
@@ -34,10 +38,31 @@ public class LanuchController {
...
@@ -34,10 +38,31 @@ public class LanuchController {
@PostMapping
(
"/execute"
)
@PostMapping
(
"/execute"
)
@Operation
(
summary
=
"启动工单"
)
@Operation
(
summary
=
"启动工单"
)
public
R
<
ProdSceneConfig
>
lanuch
(
@RequestBody
Map
<
String
,
String
>
params
)
{
public
R
<
ProdSceneConfig
>
lanuch
(
@RequestBody
Map
<
String
,
String
>
params
)
{
String
sceneName
=
params
.
get
(
"sceneName"
);
String
sceneName
=
params
.
get
(
"sceneName"
);
String
userId
=
params
.
get
(
"userId"
);
String
userId
=
params
.
get
(
"userId"
);
return
lanuchService
.
lanuch
(
sceneName
,
userId
);
R
<
ProdSceneConfig
>
result
=
lanuchService
.
lanuch
(
sceneName
,
userId
);
// 异步更新物料和设备缓存
updateMaterialAndEquipmentCacheAsync
();
return
result
;
}
@Async
public
void
updateMaterialAndEquipmentCacheAsync
()
{
try
{
log
.
info
(
"开始异步更新物料缓存"
);
planResultService
.
getMaterials
();
log
.
info
(
"物料缓存更新完成"
);
log
.
info
(
"开始异步更新设备缓存"
);
planResultService
.
InitCalendarToAllMachines
();
log
.
info
(
"设备缓存更新完成"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"异步更新物料和设备缓存时发生错误: "
,
e
);
}
}
}
/**
/**
...
@@ -47,15 +72,15 @@ public class LanuchController {
...
@@ -47,15 +72,15 @@ public class LanuchController {
@Operation
(
summary
=
"运算"
)
@Operation
(
summary
=
"运算"
)
public
R
<
String
>
schedule
(
@RequestBody
Map
<
String
,
String
>
params
)
{
public
R
<
String
>
schedule
(
@RequestBody
Map
<
String
,
String
>
params
)
{
String
sceneId
=
params
.
get
(
"sceneId"
);
String
sceneId
=
params
.
get
(
"sceneId"
);
// 如果需要处理时间字段,可以从params中获取并转换
// 如果需要处理时间字段,可以从params中获取并转换
// 例如:开始时间、结束时间等
// 例如:开始时间、结束时间等
String
startTimeStr
=
params
.
get
(
"startTime"
);
String
startTimeStr
=
params
.
get
(
"startTime"
);
String
endTimeStr
=
params
.
get
(
"endTime"
);
String
endTimeStr
=
params
.
get
(
"endTime"
);
// 在这里可以添加时间格式转换逻辑
// 在这里可以添加时间格式转换逻辑
// 根据不同格式解析时间字符串
// 根据不同格式解析时间字符串
Chromosome
scheduleChromosomes
=
planResultService
.
schedule
(
sceneId
);
Chromosome
scheduleChromosomes
=
planResultService
.
schedule
(
sceneId
);
return
R
.
ok
(
"运算完成"
);
return
R
.
ok
(
"运算完成"
);
}
}
...
...
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