Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sentinel
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
曲欣亮
sentinel
Commits
a812dd9b
Commit
a812dd9b
authored
Feb 26, 2019
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
b8d9143f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
41 deletions
+74
-41
OtherUploadService.java
...n/java/com/egolm/film/api/service/OtherUploadService.java
+7
-5
OtherUploadServiceImpl.java
...m/egolm/film/api/service/impl/OtherUploadServiceImpl.java
+27
-18
FilmUploadController.java
...va/com/egolm/film/api/web/admin/FilmUploadController.java
+22
-13
Fc_film_upload.java
src/main/java/com/egolm/film/bean/Fc_film_upload.java
+16
-5
FilmContrants.java
src/main/java/com/egolm/film/util/FilmContrants.java
+2
-0
No files found.
src/main/java/com/egolm/film/api/service/OtherUploadService.java
View file @
a812dd9b
...
...
@@ -7,22 +7,24 @@ import com.egolm.common.jdbc.Page;
import
com.egolm.film.bean.Fc_film_upload
;
public
interface
OtherUploadService
{
public
void
batchSave
(
List
<
Fc_film_upload
>
fc_film_upload
);
public
void
batchSave
(
List
<
Fc_film_upload
>
fc_film_upload
);
public
void
save
(
Fc_film_upload
fc_film_upload
);
public
int
checkExists
(
Integer
film_
id
,
Integer
number
);
public
int
checkExists
(
Integer
film_
no
,
Integer
number
);
public
List
<
Map
<
String
,
Object
>>
getWaitUploadList
(
Page
page
);
public
void
updateBegin
(
Integer
film_id
,
Integer
number
,
String
videoId
,
String
taskName
);
public
void
updateBegin
(
Integer
film_id
,
Integer
film_no
,
Integer
number
,
String
videoId
,
String
taskName
);
public
void
updateProgress
(
String
videoId
,
String
progress
);
public
void
updateSuccess
(
String
videoId
);
public
void
updateSuccess
(
String
videoId
,
String
film_no
);
public
void
updateFail
(
String
videoId
,
String
errorMessage
);
public
void
updateFail
(
Integer
film_id
,
Integer
number
,
String
errorMessage
);
public
void
updateFail
(
Integer
film_no
,
Integer
number
,
String
errorMessage
);
public
int
getIdByNo
(
Integer
film_no
);
}
src/main/java/com/egolm/film/api/service/impl/OtherUploadServiceImpl.java
View file @
a812dd9b
...
...
@@ -22,28 +22,38 @@ public class OtherUploadServiceImpl implements OtherUploadService {
public
void
save
(
Fc_film_upload
fc_film_upload
)
{
jdbcTemplate
.
saveOrUpdate
(
fc_film_upload
);
}
public
int
getIdByNo
(
Integer
film_no
)
{
try
{
String
sql
=
"select id from fc_member_film where film_no = ?"
;
return
jdbcTemplate
.
queryForInt
(
sql
,
film_no
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
0
;
}
public
void
batchSave
(
List
<
Fc_film_upload
>
fc_film_upload
)
{
jdbcTemplate
.
batchSave
(
fc_film_upload
);
}
public
int
checkExists
(
Integer
film_
id
,
Integer
number
)
{
String
sql
=
"SELECT count(1) from fc_film_upload where film_
id
= ? and number = ?"
;
return
jdbcTemplate
.
queryForInt
(
sql
,
film_
id
,
number
);
public
int
checkExists
(
Integer
film_
no
,
Integer
number
)
{
String
sql
=
"SELECT count(1) from fc_film_upload where film_
no
= ? and number = ?"
;
return
jdbcTemplate
.
queryForInt
(
sql
,
film_
no
,
number
);
}
//开始上传
public
void
updateBegin
(
Integer
film_id
,
Integer
number
,
String
videoId
,
String
taskName
)
{
public
void
updateBegin
(
Integer
film_id
,
Integer
film_no
,
Integer
number
,
String
videoId
,
String
taskName
)
{
if
(
StringUtil
.
isNotEmpty
(
taskName
))
{
String
sql
=
"update fc_film_upload set id = ? ,upload_state = ? ,upload_progress = '0%' ,taskName=? where film_
id
= ? and number = ? "
;
jdbcTemplate
.
executeUpdate
(
sql
,
videoId
,
FilmContrants
.
UPLOAD_STATUS_ING
,
taskName
,
film_
id
,
number
);
String
sql
=
"update fc_film_upload set id = ? ,upload_state = ? ,upload_progress = '0%' ,taskName=? where film_
no
= ? and number = ? "
;
jdbcTemplate
.
executeUpdate
(
sql
,
videoId
,
FilmContrants
.
UPLOAD_STATUS_ING
,
taskName
,
film_
no
,
number
);
}
else
{
String
sql
=
"update fc_film_upload set id = ? ,upload_state = ? ,upload_progress = '0%' where film_
id
= ? and number = ? "
;
jdbcTemplate
.
executeUpdate
(
sql
,
videoId
,
FilmContrants
.
UPLOAD_STATUS_ING
,
film_
id
,
number
);
String
sql
=
"update fc_film_upload set id = ? ,upload_state = ? ,upload_progress = '0%' where film_
no
= ? and number = ? "
;
jdbcTemplate
.
executeUpdate
(
sql
,
videoId
,
FilmContrants
.
UPLOAD_STATUS_ING
,
film_
no
,
number
);
}
String
filmSql
=
"update fc_member_film set upload_id =?, upload_state = ? where film_no = ? "
;
jdbcTemplate
.
executeUpdate
(
filmSql
,
videoId
,
FilmContrants
.
UPLOAD_STATUS_ING
,
film_
id
);
jdbcTemplate
.
executeUpdate
(
filmSql
,
videoId
,
FilmContrants
.
UPLOAD_STATUS_ING
,
film_
no
);
}
//修改进度
...
...
@@ -52,7 +62,7 @@ public class OtherUploadServiceImpl implements OtherUploadService {
jdbcTemplate
.
executeUpdate
(
sql
,
progress
,
videoId
);
}
//上传成功
public
void
updateSuccess
(
String
videoId
)
{
public
void
updateSuccess
(
String
videoId
,
String
film_no
)
{
String
sql
=
"update fc_film_upload set upload_time = now() ,file_local_path = '' ,upload_state = ? where id = ? "
;
jdbcTemplate
.
executeUpdate
(
sql
,
FilmContrants
.
UPLOAD_STATUS_COMPLETED
,
videoId
);
...
...
@@ -62,16 +72,15 @@ public class OtherUploadServiceImpl implements OtherUploadService {
//上传失败
public
void
updateFail
(
String
videoId
,
String
errorMessage
)
{
String
sql
=
"update fc_film_upload set upload__error_message =? ,upload_state = ? where id = ? "
;
jdbcTemplate
.
executeUpdate
(
sql
,
errorMessage
,
FilmContrants
.
UPLOAD_STATUS_FILE
,
videoId
);
jdbcTemplate
.
executeUpdate
(
sql
,
errorMessage
,
FilmContrants
.
UPLOAD_STATUS_FILE
,
videoId
);
String
filmSql
=
"update fc_member_film set upload_state = ? where upload_id = ? "
;
jdbcTemplate
.
executeUpdate
(
filmSql
,
FilmContrants
.
UPLOAD_STATUS_FILE
,
videoId
);
}
public
void
updateFail
(
Integer
film_id
,
Integer
number
,
String
errorMessage
)
{
String
sql
=
"update fc_film_upload set upload__error_message =? ,upload_state = ? where film_id = ? and number = ? "
;
jdbcTemplate
.
executeUpdate
(
sql
,
errorMessage
,
FilmContrants
.
UPLOAD_STATUS_FILE
,
film_id
,
number
);
public
void
updateFail
(
Integer
film_no
,
Integer
number
,
String
errorMessage
)
{
String
sql
=
"update fc_film_upload set upload__error_message =? ,upload_state = ? where film_no = ? and number = ? "
;
jdbcTemplate
.
executeUpdate
(
sql
,
errorMessage
,
FilmContrants
.
UPLOAD_STATUS_FILE
,
film_no
,
number
);
}
/**
...
...
src/main/java/com/egolm/film/api/web/admin/FilmUploadController.java
View file @
a812dd9b
...
...
@@ -15,7 +15,7 @@ import com.egolm.common.bean.Rjx;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.service.OtherUploadService
;
import
com.egolm.film.bean.Fc_film_upload
;
import
com.egolm.film.util.FilmContrants
;
import
com.egolm.film.util.FilmContrants
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -44,16 +44,23 @@ public class FilmUploadController {
@PostMapping
(
"save"
)
@ApiOperation
(
"保存上传数据"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
true
,
name
=
"film_
id"
,
value
=
"申报影片ID
"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
true
,
name
=
"film_
no"
,
value
=
"申报影片NO
"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
true
,
name
=
"number"
,
value
=
"影片分类扩展分类"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
true
,
name
=
"unit_name"
,
value
=
"剧集名"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
true
,
name
=
"file_name"
,
value
=
"文件名"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
true
,
name
=
"file_local_path"
,
value
=
"后台服务上传路径"
),
})
public
Object
save
(
Integer
film_
id
,
Integer
number
,
String
unit_name
,
String
file_name
,
String
file_local_path
)
{
public
Object
save
(
Integer
film_
no
,
Integer
number
,
String
unit_name
,
String
file_name
,
String
file_local_path
)
{
try
{
Fc_film_upload
fc_film_upload
=
new
Fc_film_upload
();
fc_film_upload
.
setFilm_id
(
film_id
);
int
film_id
=
otherUploadService
.
getIdByNo
(
film_no
);
if
(
film_id
!=
0
)
{
fc_film_upload
.
setUpload_state
(
FilmContrants
.
UPLOAD_STATUS_INIT
);
}
else
{
fc_film_upload
.
setUpload_state
(
FilmContrants
.
UPLOAD_STATUS_ERROR
);
fc_film_upload
.
setUpload__error_message
(
"该视频没有对应的申报记录"
);
}
fc_film_upload
.
setFilm_no
(
film_no
);
fc_film_upload
.
setNumber
(
number
);
fc_film_upload
.
setUnit_name
(
unit_name
);
fc_film_upload
.
setFile_name
(
file_name
);
...
...
@@ -108,13 +115,14 @@ public class FilmUploadController {
@PostMapping
(
"updateBegin"
)
@ApiOperation
(
"修改为开始上传"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"film_id"
,
value
=
"分页编号"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"film_id"
,
value
=
"影片ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"film_no"
,
value
=
"影片NO"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"number"
,
value
=
"分页大小"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
false
,
name
=
"videoId"
,
value
=
"阿里视频ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
false
,
name
=
"taskName"
,
value
=
"任务名称"
),
})
public
Object
updateBegin
(
Integer
film_id
,
Integer
number
,
String
videoId
,
String
taskName
){
otherUploadService
.
updateBegin
(
film_id
,
number
,
videoId
,
taskName
);
public
Object
updateBegin
(
Integer
film_id
,
Integer
film_no
,
Integer
number
,
String
videoId
,
String
taskName
){
otherUploadService
.
updateBegin
(
film_id
,
film_no
,
number
,
videoId
,
taskName
);
return
Rjx
.
jsonOk
();
}
...
...
@@ -139,9 +147,10 @@ public class FilmUploadController {
@ApiOperation
(
"更新上传完成"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
false
,
name
=
"videoId"
,
value
=
"阿里视频ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
false
,
name
=
"film_no"
,
value
=
"影片no"
),
})
public
Object
updateSuccess
(
String
videoId
){
otherUploadService
.
updateSuccess
(
videoId
);
public
Object
updateSuccess
(
String
videoId
,
String
film_no
){
otherUploadService
.
updateSuccess
(
videoId
,
film_no
);
return
Rjx
.
jsonOk
();
}
...
...
@@ -160,15 +169,15 @@ public class FilmUploadController {
@ResponseBody
@Transactional
@PostMapping
(
"updateFailByFilm
Id
"
)
@PostMapping
(
"updateFailByFilm
No
"
)
@ApiOperation
(
"更新为上传失败"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
true
,
name
=
"film_
id"
,
value
=
"影片ID
"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
true
,
name
=
"film_
no"
,
value
=
"影片NO
"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
false
,
name
=
"number"
,
value
=
"集数"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
false
,
name
=
"errorMessage"
,
value
=
"失败原因"
),
})
public
Object
updateFailByFilm
Id
(
Integer
film_id
,
Integer
number
,
String
errorMessage
){
otherUploadService
.
updateFail
(
film_
id
,
number
,
errorMessage
);
public
Object
updateFailByFilm
No
(
Integer
film_no
,
Integer
number
,
String
errorMessage
){
otherUploadService
.
updateFail
(
film_
no
,
number
,
errorMessage
);
return
Rjx
.
jsonOk
();
}
}
src/main/java/com/egolm/film/bean/Fc_film_upload.java
View file @
a812dd9b
...
...
@@ -11,16 +11,19 @@ public class Fc_film_upload implements java.io.Serializable {
private
static
final
long
serialVersionUID
=
1L
;
@Column
(
columnDefinition
=
"varchar(255)"
)
@Column
(
columnDefinition
=
"varchar(255)
COMMENT '阿里云视频ID'
"
)
private
String
id
;
@Column
(
columnDefinition
=
"int(11) COMMENT '影片ID'"
)
private
Integer
film_id
;
@Column
(
columnDefinition
=
"int(11) COMMENT '影片NO'"
)
private
Integer
film_no
;
@Column
(
columnDefinition
=
"int(11) COMMENT '集数'"
)
private
Integer
number
;
@Column
(
columnDefinition
=
"int(11) COMMENT '上传状态'"
)
@Column
(
columnDefinition
=
"int(11) COMMENT '上传状态
0未上传, 1上传中, 2已上传
'"
)
private
Integer
upload_state
;
@Column
(
columnDefinition
=
"varchar(255) COMMENT '剧集名'"
)
...
...
@@ -35,7 +38,7 @@ public class Fc_film_upload implements java.io.Serializable {
@Column
(
columnDefinition
=
"datetime COMMENT '完成上传时间'"
)
private
Date
upload_time
;
@Column
(
columnDefinition
=
"varchar(3
2
) COMMENT '上传进度'"
)
@Column
(
columnDefinition
=
"varchar(3
6
) COMMENT '上传进度'"
)
private
String
upload_progress
;
@Column
(
columnDefinition
=
"varchar(255) COMMENT '后台服务上传路径'"
)
...
...
@@ -44,7 +47,7 @@ public class Fc_film_upload implements java.io.Serializable {
@Column
(
columnDefinition
=
"varchar(255) COMMENT '后台服务上传失败原因'"
)
private
String
upload__error_message
;
@Column
(
columnDefinition
=
"varchar(
64) COMMENT '后台服务上传
任务名称'"
)
@Column
(
columnDefinition
=
"varchar(
255) COMMENT '分配的
任务名称'"
)
private
String
taskName
;
...
...
@@ -64,6 +67,14 @@ public class Fc_film_upload implements java.io.Serializable {
return
film_id
;
}
public
void
setFilm_no
(
Integer
film_no
)
{
this
.
film_no
=
film_no
;
}
public
Integer
getFilm_no
()
{
return
film_no
;
}
public
void
setNumber
(
Integer
number
)
{
this
.
number
=
number
;
}
...
...
@@ -145,4 +156,4 @@ public class Fc_film_upload implements java.io.Serializable {
}
}
src/main/java/com/egolm/film/util/FilmContrants.java
View file @
a812dd9b
...
...
@@ -5,4 +5,6 @@ public class FilmContrants {
public
static
int
UPLOAD_STATUS_ING
=
1
;
//上传中
public
static
int
UPLOAD_STATUS_COMPLETED
=
2
;
//上传完成
public
static
int
UPLOAD_STATUS_FILE
=
3
;
//上传失败
public
static
int
UPLOAD_STATUS_ERROR
=
4
;
//数据异常
}
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