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
461b0342
Commit
461b0342
authored
Oct 28, 2024
by
霍传世
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试生成上传
parent
01e5d750
Pipeline
#233
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
src/main/java/com/example/pdfgenerator/controller/PDFGeByProvinceBatchController.java
...fgenerator/controller/PDFGeByProvinceBatchController.java
+23
-4
No files found.
src/main/java/com/example/pdfgenerator/controller/PDFGeByProvinceBatchController.java
View file @
461b0342
...
...
@@ -4,6 +4,10 @@ import com.example.pdfgenerator.Dto.BasicReportParameters;
import
com.example.pdfgenerator.Dto.ClassBasicReportParameters
;
import
com.example.pdfgenerator.config.MyDataSourceConfig
;
import
com.qcloud.cos.COSClient
;
import
com.qcloud.cos.exception.CosClientException
;
import
com.qcloud.cos.exception.CosServiceException
;
import
com.qcloud.cos.model.PutObjectRequest
;
import
com.qcloud.cos.model.PutObjectResult
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -15,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.util.Arrays
;
...
...
@@ -33,7 +38,7 @@ public class PDFGeByProvinceBatchController {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
GeneratorAllTypePdfByProvinceController
.
class
);
@Autowired
private
COSClient
cos
cL
ient
;
private
COSClient
cos
Cl
ient
;
JdbcTemplate
reportJdbcTemplate
=
MyDataSourceConfig
.
getReportJdbcTemplate
();
...
...
@@ -204,10 +209,8 @@ public class PDFGeByProvinceBatchController {
for
(
String
key
:
schoolReport
.
keySet
())
{
logger
.
info
(
"province:"
+
key
+
"Gen..............................................................."
);
List
<
BasicReportParameters
>
schoolBasicReport
=
schoolReport
.
get
(
key
);
List
<
BasicReportParameters
>
schoolSubject
=
schoolSubjectReport
.
get
(
key
);
for
(
BasicReportParameters
schoolLevel
:
schoolBasicReport
)
{
logger
.
info
(
"school:"
+
schoolLevel
.
getSchool
()+
"loading---------------------------------------------------------------"
);
Map
<
String
,
List
<
BasicReportParameters
>>
schoolMap
=
schoolSubject
.
stream
().
collect
(
Collectors
.
groupingBy
(
BasicReportParameters:
:
getSchool
));
logger
.
info
(
"basicReport:loading******************************************"
);
ProcessBuilder
processBuilder
=
new
ProcessBuilder
();
processBuilder
.
command
(
"bash"
,
"-c"
,
schoolLevel
.
getCommand
());
...
...
@@ -217,9 +220,25 @@ public class PDFGeByProvinceBatchController {
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
}
Thread
.
sleep
(
1000
);
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
);
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