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
b73b2575
Commit
b73b2575
authored
Mar 06, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
2b70400f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
16 deletions
+97
-16
OssService.java
src/main/java/com/egolm/film/api/service/OssService.java
+7
-0
ExportServiceImpl.java
...va/com/egolm/film/api/service/impl/ExportServiceImpl.java
+56
-1
OssServiceImpl.java
.../java/com/egolm/film/api/service/impl/OssServiceImpl.java
+29
-0
FilmController.java
src/main/java/com/egolm/film/api/web/FilmController.java
+5
-15
No files found.
src/main/java/com/egolm/film/api/service/OssService.java
0 → 100644
View file @
b73b2575
package
com
.
egolm
.
film
.
api
.
service
;
public
interface
OssService
{
String
getOssPath
(
String
relativePath
,
Integer
expiryTime
);
}
src/main/java/com/egolm/film/api/service/impl/ExportServiceImpl.java
View file @
b73b2575
...
...
@@ -3,6 +3,7 @@ package com.egolm.film.api.service.impl;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -10,7 +11,10 @@ import java.util.Map;
import
javax.annotation.Resource
;
import
javax.servlet.ServletOutputStream
;
import
org.apache.poi.hssf.usermodel.HSSFSheet
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
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.Value
;
import
org.springframework.stereotype.Service
;
...
...
@@ -25,6 +29,9 @@ import com.egolm.film.api.service.CountryService;
import
com.egolm.film.api.service.ExportService
;
import
com.egolm.film.api.service.FilmService
;
import
com.egolm.film.api.service.LanguageService
;
import
com.egolm.film.api.service.OssService
;
import
com.egolm.film.bean.Fc_member_film
;
import
com.egolm.film.bean.Fc_member_film_ext
;
import
com.egolm.film.config.XRException
;
@Service
...
...
@@ -544,14 +551,62 @@ public class ExportServiceImpl implements ExportService {
@Value
(
"${template.publication.path}"
)
private
String
publicationPath
;
@Autowired
OssService
ossService
;
@Override
public
void
exportPublication
(
ServletOutputStream
os
,
Integer
film_id
)
{
Fc_member_film
film
=
filmService
.
queryMemberFilmById
(
film_id
.
longValue
());
Fc_member_film_ext
filmExt
=
filmService
.
queryFilmExt
(
film_id
);
Map
<
String
,
String
>
vars
=
new
HashMap
<
String
,
String
>();
vars
.
put
(
"1,0"
,
film
.
getCn_name
());
vars
.
put
(
"2,0"
,
film
.
getEn_name
());
vars
.
put
(
"3,0"
,
filmExt
.
getDirector_en
());
vars
.
put
(
"6,0"
,
film
.
getFilm_country
());
vars
.
put
(
"7,0"
,
film
.
getCompletion_date
());
vars
.
put
(
"8,0"
,
film
.
getFilm_total_time
());
vars
.
put
(
"9,0"
,
filmExt
.
getFormat
());
vars
.
put
(
"11,0"
,
filmExt
.
getScreenplay
());
vars
.
put
(
"13,0"
,
filmExt
.
getDirector_of_photography
());
vars
.
put
(
"15,0"
,
filmExt
.
getMusic
());
vars
.
put
(
"17,0"
,
filmExt
.
getProduction_designer
());
vars
.
put
(
"19,0"
,
filmExt
.
getExecutive_producer
());
vars
.
put
(
"21,0"
,
filmExt
.
getEditor
());
vars
.
put
(
"23,0"
,
filmExt
.
getProducer_en
());
vars
.
put
(
"25,0"
,
filmExt
.
getCast
());
vars
.
put
(
"27,0"
,
filmExt
.
getProduction_en
());
vars
.
put
(
"29,0"
,
filmExt
.
getWorld_sales
());
vars
.
put
(
"30,0"
,
filmExt
.
getResolution
());
vars
.
put
(
"31,0"
,
filmExt
.
getAspect_ratio
());
vars
.
put
(
"32,0"
,
filmExt
.
getSound_format
());
vars
.
put
(
"33,0"
,
filmExt
.
getFrame_rate
());
vars
.
put
(
"34,0"
,
filmExt
.
getKdm
());
vars
.
put
(
"6,3"
,
filmExt
.
getSynopsis_cn
());
vars
.
put
(
"12,3"
,
filmExt
.
getSynopsis_en
());
vars
.
put
(
"20,5"
,
filmExt
.
getDirector_biography_cn
());
vars
.
put
(
"24,5"
,
filmExt
.
getDirector_biography_en
());
HSSFWorkbook
wb
=
null
;
FileInputStream
fis
=
null
;
try
{
fis
=
new
FileInputStream
(
publicationPath
);
wb
=
new
HSSFWorkbook
(
fis
);
//TODO 在这里修改单元格内容
HSSFSheet
sheet
=
wb
.
getSheetAt
(
0
);
for
(
String
key
:
vars
.
keySet
())
{
String
value
=
vars
.
get
(
key
);
String
[]
xyAry
=
key
.
split
(
","
,
2
);
Integer
x
=
Integer
.
valueOf
(
xyAry
[
1
]);
Integer
y
=
Integer
.
valueOf
(
xyAry
[
0
]);
Row
row
=
sheet
.
getRow
(
y
-
1
);
Cell
cell
=
row
.
getCell
(
x
-
1
);
String
tplValue
=
cell
.
getStringCellValue
();
if
(
StringUtil
.
isBlank
(
tplValue
))
{
cell
.
setCellValue
(
value
);
}
else
{
cell
.
setCellValue
(
tplValue
.
replaceFirst
(
"_+"
,
value
));
}
}
wb
.
write
(
os
);
fis
.
close
();
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/egolm/film/api/service/impl/OssServiceImpl.java
0 → 100644
View file @
b73b2575
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
com.egolm.film.api.service.OssService
;
import
com.egolm.film.util.OSSUtils
;
@Service
public
class
OssServiceImpl
implements
OssService
{
@Value
(
"${aliyun.sts.accessKeyId}"
)
private
String
accessKeyId
;
@Value
(
"${aliyun.sts.accessKeySecret}"
)
private
String
accessKeySecret
;
@Value
(
"${aliyun.oss.endpoint}"
)
private
String
endpoint
;
@Value
(
"${aliyun.oss.bucket}"
)
private
String
bucket
;
@Override
public
String
getOssPath
(
String
relativePath
,
Integer
expiryTime
)
{
OSSUtils
ossUtil
=
new
OSSUtils
(
endpoint
,
accessKeyId
,
accessKeySecret
);
String
ossPicPath
=
ossUtil
.
urlSign
(
bucket
,
relativePath
,
expiryTime
);
ossUtil
.
closeOssClient
();
return
ossPicPath
;
}
}
src/main/java/com/egolm/film/api/web/FilmController.java
View file @
b73b2575
...
...
@@ -5,7 +5,6 @@ import java.util.List;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -16,6 +15,7 @@ import com.egolm.common.bean.Rjx;
import
com.egolm.film.api.service.AdminTokenService
;
import
com.egolm.film.api.service.FilmService
;
import
com.egolm.film.api.service.MemberTokenService
;
import
com.egolm.film.api.service.OssService
;
import
com.egolm.film.api.service.OtherUploadService
;
import
com.egolm.film.api.service.ReviewService
;
import
com.egolm.film.bean.Fc_member_film
;
...
...
@@ -28,7 +28,6 @@ import com.egolm.film.bean.model.Fc_member_film_base_model;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XRException
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.util.OSSUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -55,6 +54,9 @@ public class FilmController {
@Autowired
OtherUploadService
uploadService
;
@Autowired
OssService
ossService
;
@ResponseBody
@PostMapping
(
"get_detail"
)
@ApiOperation
(
"获取全部申报信息"
)
...
...
@@ -260,15 +262,6 @@ public class FilmController {
return
Rjx
.
jsonOk
().
setData
(
ext
);
}
@Value
(
"${aliyun.sts.accessKeyId}"
)
private
String
accessKeyId
;
@Value
(
"${aliyun.sts.accessKeySecret}"
)
private
String
accessKeySecret
;
@Value
(
"${aliyun.oss.endpoint}"
)
private
String
endpoint
;
@Value
(
"${aliyun.oss.bucket}"
)
private
String
bucket
;
@ResponseBody
@Transactional
@PostMapping
(
"getOssMvPath"
)
...
...
@@ -277,10 +270,7 @@ public class FilmController {
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"relativePath"
,
value
=
"相对路径"
),
})
public
Object
getOssMvPath
(
String
relativePath
){
OSSUtils
ossUtil
=
new
OSSUtils
(
endpoint
,
accessKeyId
,
accessKeySecret
);
String
ossPicPath
=
ossUtil
.
urlSign
(
bucket
,
relativePath
,
60
*
24
);
ossUtil
.
closeOssClient
();
return
Rjx
.
jsonOk
().
setData
(
ossPicPath
);
return
Rjx
.
jsonOk
().
setData
(
ossService
.
getOssPath
(
relativePath
,
60
*
24
));
}
}
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