Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
member-api
Project
Project
Details
Activity
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
曲欣亮
member-api
Commits
d12d8f49
Commit
d12d8f49
authored
Mar 06, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
d463e4ca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
ExportServiceImpl.java
...va/com/egolm/film/api/service/impl/ExportServiceImpl.java
+39
-0
No files found.
src/main/java/com/egolm/film/api/service/impl/ExportServiceImpl.java
View file @
d12d8f49
...
@@ -2,6 +2,9 @@ package com.egolm.film.api.service.impl;
...
@@ -2,6 +2,9 @@ package com.egolm.film.api.service.impl;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
...
@@ -11,6 +14,8 @@ import java.util.Map;
...
@@ -11,6 +14,8 @@ import java.util.Map;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
org.apache.poi.hssf.usermodel.HSSFClientAnchor
;
import
org.apache.poi.hssf.usermodel.HSSFPatriarch
;
import
org.apache.poi.hssf.usermodel.HSSFSheet
;
import
org.apache.poi.hssf.usermodel.HSSFSheet
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Cell
;
...
@@ -20,6 +25,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -20,6 +25,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.ExcelUtil
;
import
com.egolm.common.ExcelUtil
;
import
com.egolm.common.FileUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.Util
;
import
com.egolm.common.Util
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
...
@@ -607,6 +613,39 @@ public class ExportServiceImpl implements ExportService {
...
@@ -607,6 +613,39 @@ public class ExportServiceImpl implements ExportService {
cell
.
setCellValue
(
value
);
cell
.
setCellValue
(
value
);
}
}
}
}
/**
* 处理剧照
*/
if
(
StringUtil
.
isNotBlank
(
filmExt
.
getPhoto_mv
()))
{
String
pathMvPhoto
=
ossService
.
getOssPath
(
filmExt
.
getPhoto_mv
(),
10
);
URL
mvPhotoUrl
=
new
URL
(
pathMvPhoto
);
HttpURLConnection
mvPhotoConn
=
(
HttpURLConnection
)
mvPhotoUrl
.
openConnection
();
mvPhotoConn
.
setRequestMethod
(
"GET"
);
mvPhotoConn
.
setConnectTimeout
(
50
*
1000
);
InputStream
mvPhotoInstream
=
mvPhotoConn
.
getInputStream
();
byte
[]
mvPhotoBytes
=
FileUtil
.
streamToBytes
(
mvPhotoInstream
);
HSSFPatriarch
patriarch
=
sheet
.
createDrawingPatriarch
();
HSSFClientAnchor
anchor
=
new
HSSFClientAnchor
(
0
,
0
,
0
,
0
,
(
short
)
0
,
3
,
(
short
)
9
,
3
);
patriarch
.
createPicture
(
anchor
,
wb
.
addPicture
(
mvPhotoBytes
,
HSSFWorkbook
.
PICTURE_TYPE_JPEG
));
}
/**
* 处理导演图片
*/
if
(
StringUtil
.
isNotBlank
(
filmExt
.
getPhoto_director
()))
{
String
pathDirectorPhoto
=
ossService
.
getOssPath
(
filmExt
.
getPhoto_director
(),
10
);
URL
directorPhotoUrl
=
new
URL
(
pathDirectorPhoto
);
HttpURLConnection
directorPhotoConn
=
(
HttpURLConnection
)
directorPhotoUrl
.
openConnection
();
directorPhotoConn
.
setRequestMethod
(
"GET"
);
directorPhotoConn
.
setConnectTimeout
(
50
*
1000
);
InputStream
directorPhotoInstream
=
directorPhotoConn
.
getInputStream
();
byte
[]
directorPhotoBytes
=
FileUtil
.
streamToBytes
(
directorPhotoInstream
);
HSSFPatriarch
patriarch
=
sheet
.
createDrawingPatriarch
();
HSSFClientAnchor
anchor
=
new
HSSFClientAnchor
(
0
,
0
,
0
,
0
,
(
short
)
2
,
18
,
(
short
)
3
,
25
);
patriarch
.
createPicture
(
anchor
,
wb
.
addPicture
(
directorPhotoBytes
,
HSSFWorkbook
.
PICTURE_TYPE_JPEG
));
}
wb
.
write
(
os
);
wb
.
write
(
os
);
fis
.
close
();
fis
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
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