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
d2db0cdc
Commit
d2db0cdc
authored
Mar 06, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
3195e0fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
28 deletions
+37
-28
ExportServiceImpl.java
...va/com/egolm/film/api/service/impl/ExportServiceImpl.java
+37
-28
No files found.
src/main/java/com/egolm/film/api/service/impl/ExportServiceImpl.java
View file @
d2db0cdc
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
...
@@ -19,7 +20,6 @@ import org.apache.poi.hssf.usermodel.HSSFPatriarch;
...
@@ -19,7 +20,6 @@ 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
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -604,13 +604,14 @@ public class ExportServiceImpl implements ExportService {
...
@@ -604,13 +604,14 @@ public class ExportServiceImpl implements ExportService {
String
[]
xyAry
=
key
.
split
(
","
,
2
);
String
[]
xyAry
=
key
.
split
(
","
,
2
);
Integer
x
=
Integer
.
valueOf
(
xyAry
[
1
]);
Integer
x
=
Integer
.
valueOf
(
xyAry
[
1
]);
Integer
y
=
Integer
.
valueOf
(
xyAry
[
0
]);
Integer
y
=
Integer
.
valueOf
(
xyAry
[
0
]);
Row
row
=
sheet
.
getRow
(
y
-
1
);
Cell
cell
=
sheet
.
getRow
(
y
-
1
).
getCell
(
x
-
1
);
Cell
cell
=
row
.
getCell
(
x
-
1
);
if
(
cell
!=
null
)
{
String
tplValue
=
cell
.
getStringCellValue
();
String
tplValue
=
cell
.
getStringCellValue
();
if
(
StringUtil
.
isNotBlank
(
tplValue
)
&&
tplValue
.
contains
(
"_"
))
{
if
(
StringUtil
.
isNotBlank
(
tplValue
)
&&
tplValue
.
contains
(
"_"
))
{
cell
.
setCellValue
(
tplValue
.
replaceFirst
(
"_+"
,
value
));
cell
.
setCellValue
(
tplValue
.
replaceFirst
(
"_+"
,
value
));
}
else
{
}
else
{
cell
.
setCellValue
(
value
);
cell
.
setCellValue
(
value
);
}
}
}
}
}
...
@@ -618,32 +619,40 @@ public class ExportServiceImpl implements ExportService {
...
@@ -618,32 +619,40 @@ public class ExportServiceImpl implements ExportService {
* 处理剧照
* 处理剧照
*/
*/
if
(
StringUtil
.
isNotBlank
(
filmExt
.
getPhoto_mv
()))
{
if
(
StringUtil
.
isNotBlank
(
filmExt
.
getPhoto_mv
()))
{
String
pathMvPhoto
=
ossService
.
getOssPath
(
filmExt
.
getPhoto_mv
(),
10
);
try
{
URL
mvPhotoUrl
=
new
URL
(
pathMvPhoto
);
String
pathMvPhoto
=
ossService
.
getOssPath
(
filmExt
.
getPhoto_mv
(),
10
);
HttpURLConnection
mvPhotoConn
=
(
HttpURLConnection
)
mvPhotoUrl
.
openConnection
();
URL
mvPhotoUrl
=
new
URL
(
pathMvPhoto
);
mvPhotoConn
.
setRequestMethod
(
"GET"
);
HttpURLConnection
mvPhotoConn
=
(
HttpURLConnection
)
mvPhotoUrl
.
openConnection
();
mvPhotoConn
.
setConnectTimeout
(
50
*
1000
);
mvPhotoConn
.
setRequestMethod
(
"GET"
);
InputStream
mvPhotoInstream
=
mvPhotoConn
.
getInputStream
();
mvPhotoConn
.
setConnectTimeout
(
50
*
1000
);
byte
[]
mvPhotoBytes
=
FileUtil
.
streamToBytes
(
mvPhotoInstream
);
InputStream
mvPhotoInstream
=
mvPhotoConn
.
getInputStream
();
HSSFPatriarch
patriarch
=
sheet
.
createDrawingPatriarch
();
byte
[]
mvPhotoBytes
=
FileUtil
.
streamToBytes
(
mvPhotoInstream
);
HSSFClientAnchor
anchor
=
new
HSSFClientAnchor
(
0
,
0
,
0
,
0
,
(
short
)
0
,
3
,
(
short
)
9
,
3
);
HSSFPatriarch
patriarch
=
sheet
.
createDrawingPatriarch
();
patriarch
.
createPicture
(
anchor
,
wb
.
addPicture
(
mvPhotoBytes
,
HSSFWorkbook
.
PICTURE_TYPE_JPEG
));
HSSFClientAnchor
anchor
=
new
HSSFClientAnchor
(
0
,
0
,
0
,
0
,
(
short
)
0
,
3
,
(
short
)
9
,
3
);
patriarch
.
createPicture
(
anchor
,
wb
.
addPicture
(
mvPhotoBytes
,
HSSFWorkbook
.
PICTURE_TYPE_JPEG
));
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
}
/**
/**
* 处理导演图片
* 处理导演图片
*/
*/
if
(
StringUtil
.
isNotBlank
(
filmExt
.
getPhoto_director
()))
{
if
(
StringUtil
.
isNotBlank
(
filmExt
.
getPhoto_director
()))
{
String
pathDirectorPhoto
=
ossService
.
getOssPath
(
filmExt
.
getPhoto_director
(),
10
);
try
{
URL
directorPhotoUrl
=
new
URL
(
pathDirectorPhoto
);
String
pathDirectorPhoto
=
ossService
.
getOssPath
(
filmExt
.
getPhoto_director
(),
10
);
HttpURLConnection
directorPhotoConn
=
(
HttpURLConnection
)
directorPhotoUrl
.
openConnection
();
URL
directorPhotoUrl
=
new
URL
(
pathDirectorPhoto
);
directorPhotoConn
.
setRequestMethod
(
"GET"
);
HttpURLConnection
directorPhotoConn
=
(
HttpURLConnection
)
directorPhotoUrl
.
openConnection
();
directorPhotoConn
.
setConnectTimeout
(
50
*
1000
);
directorPhotoConn
.
setRequestMethod
(
"GET"
);
InputStream
directorPhotoInstream
=
directorPhotoConn
.
getInputStream
();
directorPhotoConn
.
setConnectTimeout
(
50
*
1000
);
byte
[]
directorPhotoBytes
=
FileUtil
.
streamToBytes
(
directorPhotoInstream
);
InputStream
directorPhotoInstream
=
directorPhotoConn
.
getInputStream
();
HSSFPatriarch
patriarch
=
sheet
.
createDrawingPatriarch
();
byte
[]
directorPhotoBytes
=
FileUtil
.
streamToBytes
(
directorPhotoInstream
);
HSSFClientAnchor
anchor
=
new
HSSFClientAnchor
(
0
,
0
,
0
,
0
,
(
short
)
2
,
18
,
(
short
)
3
,
25
);
HSSFPatriarch
patriarch
=
sheet
.
createDrawingPatriarch
();
patriarch
.
createPicture
(
anchor
,
wb
.
addPicture
(
directorPhotoBytes
,
HSSFWorkbook
.
PICTURE_TYPE_JPEG
));
HSSFClientAnchor
anchor
=
new
HSSFClientAnchor
(
0
,
0
,
0
,
0
,
(
short
)
2
,
18
,
(
short
)
3
,
25
);
patriarch
.
createPicture
(
anchor
,
wb
.
addPicture
(
directorPhotoBytes
,
HSSFWorkbook
.
PICTURE_TYPE_JPEG
));
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
}
wb
.
write
(
os
);
wb
.
write
(
os
);
...
...
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