Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
涂亚平
/
subsidy-center
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 17ae467d
authored
Nov 26, 2024
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
回家同步
1 parent
101a8dab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
21 deletions
src/main/java/com/subsidy/service/impl/MoniMajorServiceImpl.java
src/main/resources/mapper/MoniCompanyMapper.xml
src/main/java/com/subsidy/service/impl/MoniMajorServiceImpl.java
View file @
17ae467
...
...
@@ -103,36 +103,36 @@ public class MoniMajorServiceImpl extends ServiceImpl<MoniMajorMapper, MoniMajor
List
<
OutPutVO
>
outPuts
=
simulationSeekerDTO
.
getOutPuts
();
// 定义线程池的大小,根据你的需要来设置
//
ExecutorService executor = Executors.newFixedThreadPool(outPuts.size());
ExecutorService
executor
=
Executors
.
newFixedThreadPool
(
outPuts
.
size
());
// 用于存放Future对象的列表,Future对象可以用来检查任务是否完成
//
List<Future<?>> futures = new ArrayList<>();
List
<
Future
<?>>
futures
=
new
ArrayList
<>();
for
(
OutPutVO
outPutVO
:
outPuts
)
{
//
Future<?> future = executor.submit(new Callable() {
//
@Override
//
public Object call() throws Exception {
Future
<?>
future
=
executor
.
submit
(
new
Callable
()
{
@Override
public
Object
call
()
throws
Exception
{
// 这里执行你的任务
dataProcess
(
outPutVO
);
//
return null;
//
}
//
});
return
null
;
}
});
// 将Future对象添加到列表中
//
futures.add(future);
futures
.
add
(
future
);
}
// 关闭ExecutorService,不再接受新任务
//
executor.shutdown();
//
// 等待所有任务完成
//
for (Future<?> future : futures) {
//
try {
//
// get方法会阻塞直到任务完成
//
future.get();
//
} catch (Exception e) {
//
e.printStackTrace();
//
}
//
}
executor
.
shutdown
();
// 等待所有任务完成
for
(
Future
<?>
future
:
futures
)
{
try
{
// get方法会阻塞直到任务完成
future
.
get
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
//
// Collections.shuffle(data);
// ExcelUtil.writeMapExcel(excelFieldVOS, data);
...
...
src/main/resources/mapper/MoniCompanyMapper.xml
View file @
17ae467
...
...
@@ -56,7 +56,6 @@
LEFT JOIN moni_company t2 ON t.job_type = t2.job_major
WHERE
t.major_type = #{majorType}
limit 700000
</select>
</mapper>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment