Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SchoolReportGen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
霍传世
SchoolReportGen
Commits
c9a29266
Commit
c9a29266
authored
Oct 29, 2024
by
霍传世
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试生成上传任务表
parent
9f2fe9a1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
26 deletions
+44
-26
src/main/java/com/example/pdfgenerator/controller/PDFGeByProvinceBatchController.java
...fgenerator/controller/PDFGeByProvinceBatchController.java
+44
-26
No files found.
src/main/java/com/example/pdfgenerator/controller/PDFGeByProvinceBatchController.java
View file @
c9a29266
...
...
@@ -205,6 +205,7 @@ public class PDFGeByProvinceBatchController {
//
// Map<String, List<ClassBasicReportParameters>> classSubjectReport = synthesisClassSubjectReportParameters.stream().collect(Collectors.groupingBy(ClassBasicReportParameters::getProvince));
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
10
);
//分组开始执行记录
for
(
String
key
:
schoolReport
.
keySet
())
{
...
...
@@ -212,34 +213,51 @@ public class PDFGeByProvinceBatchController {
List
<
BasicReportParameters
>
schoolBasicReport
=
schoolReport
.
get
(
key
);
for
(
BasicReportParameters
schoolLevel
:
schoolBasicReport
)
{
logger
.
info
(
"school:"
+
schoolLevel
.
getSchool
()+
"loading---------------------------------------------------------------"
);
executorService
.
submit
(()
->
{
// 其他逻辑...
logger
.
info
(
"basicReport:loading******************************************"
);
ProcessBuilder
processBuilder
=
new
ProcessBuilder
();
processBuilder
.
command
(
"bash"
,
"-c"
,
schoolLevel
.
getCommand
());
processBuilder
.
redirectErrorStream
(
true
);
// 合并标准输出和错误输出
Process
process
=
processBuilder
.
start
();
Process
process
=
null
;
try
{
process
=
processBuilder
.
start
();
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
process
.
getInputStream
()));
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
}
int
exitCode
=
process
.
waitFor
();
logger
.
info
(
"exitCode:"
+
schoolLevel
.
getSchool
());
File
file
=
new
File
(
"/myworkSpace/basic/"
);
File
[]
files1
=
file
.
listFiles
();
assert
files1
!=
null
;
for
(
File
file1
:
files1
)
{
PutObjectRequest
putObjectRequest
=
new
PutObjectRequest
(
bucketName
,
"PdfTest/"
+
file1
.
getName
(),
file1
);
while
(
true
)
{
try
{
PutObjectResult
putObjectResult
=
cosClient
.
putObject
(
putObjectRequest
);
logger
.
info
(
putObjectResult
.
getRequestId
());
file1
.
delete
();
}
catch
(
CosServiceException
e
)
{
logger
.
info
(
"cos服务出现问题"
);
e
.
printStackTrace
();
}
catch
(
CosClientException
e
)
{
logger
.
info
(
"cos客户端出现问题"
+
file
.
getName
()+
"文件上传有误,重新上传"
);
e
.
printStackTrace
();
if
(!((
line
=
reader
.
readLine
())
!=
null
))
break
;
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
try
{
int
exitCode
=
process
.
waitFor
();
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
logger
.
info
(
"exitCode:"
+
schoolLevel
.
getSchool
());
// File file = new File("/myworkSpace/basic/");
// File[] files1 = file.listFiles();
// assert files1 != null;
// for (File file1 : files1) {
// PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, "PdfTest/"+file1.getName(), file1);
// try {
// PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
// logger.info(putObjectResult.getRequestId());
// file1.delete();
// } catch (CosServiceException e) {
// logger.info("cos服务出现问题");
// e.printStackTrace();
// } catch (CosClientException e) {
// logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传");
// e.printStackTrace();
// }
// }
});
}
}
return
null
;
...
...
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