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
3496fd5e
Commit
3496fd5e
authored
Feb 21, 2019
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
视频上传单独服务
parent
e15790f1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
174 additions
and
0 deletions
+174
-0
FilmUploadController.java
...va/com/egolm/film/api/web/admin/FilmUploadController.java
+174
-0
No files found.
src/main/java/com/egolm/film/api/web/admin/FilmUploadController.java
0 → 100644
View file @
3496fd5e
package
com
.
egolm
.
film
.
api
.
web
.
admin
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
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
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
/**
*
* @ClassName: FilmUploadController
* @Description:上传服务调用接口
* @author: zhang.yong
* @date: 2019年2月21日 下午5:09:33
*
*/
@Api
(
tags
={
"后台视频上传单独服务"
})
@Controller
@RequestMapping
(
"other/upload"
)
public
class
FilmUploadController
{
@Autowired
private
OtherUploadService
otherUploadService
;
@ResponseBody
@Transactional
@PostMapping
(
"save"
)
@ApiOperation
(
"保存上传数据"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
true
,
name
=
"film_id"
,
value
=
"申报影片ID"
),
@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
)
{
try
{
Fc_film_upload
fc_film_upload
=
new
Fc_film_upload
();
fc_film_upload
.
setFilm_id
(
film_id
);
fc_film_upload
.
setNumber
(
number
);
fc_film_upload
.
setUnit_name
(
unit_name
);
fc_film_upload
.
setFile_name
(
file_name
);
fc_film_upload
.
setFile_local_path
(
file_local_path
);
fc_film_upload
.
setUpload_state
(
FilmContrants
.
UPLOAD_STATUS_INIT
);
fc_film_upload
.
setCreate_time
(
new
Date
());
otherUploadService
.
save
(
fc_film_upload
);
return
Rjx
.
jsonOk
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
Rjx
.
jsonErr
().
setMessage
(
"数据保存失败"
);
}
@ResponseBody
@Transactional
@PostMapping
(
"checkExists"
)
@ApiOperation
(
"检查数据是否存在"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
true
,
name
=
"film_id"
,
value
=
"影片ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
true
,
name
=
"number"
,
value
=
"集数"
),
})
public
Object
checkExists
(
Integer
film_id
,
Integer
number
)
{
int
result
=
otherUploadService
.
checkExists
(
film_id
,
number
);
if
(
result
==
0
)
{
return
Rjx
.
jsonOk
();
}
else
{
return
Rjx
.
jsonErr
().
setMessage
(
"记录已存在"
);
}
}
@ResponseBody
@Transactional
@PostMapping
(
"getWaitUploadList"
)
@ApiOperation
(
"获取待上传的数据"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"index"
,
value
=
"分页编号"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"limit"
,
value
=
"分页大小"
),
})
public
Object
getWaitUploadList
(
Long
index
,
Long
limit
){
index
=
index
==
null
?
1
:
index
;
limit
=
limit
==
null
?
1
:
limit
;
Page
page
=
new
Page
(
index
,
limit
);
List
<
Map
<
String
,
Object
>>
list
=
otherUploadService
.
getWaitUploadList
(
page
);
return
Rjx
.
jsonOk
().
setData
(
list
).
setPage
(
page
);
}
@ResponseBody
@Transactional
@PostMapping
(
"updateBegin"
)
@ApiOperation
(
"修改为开始上传"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"film_id"
,
value
=
"分页编号"
),
@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
);
return
Rjx
.
jsonOk
();
}
@ResponseBody
@Transactional
@PostMapping
(
"updateProgress"
)
@ApiOperation
(
"更新上传进度"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
false
,
name
=
"videoId"
,
value
=
"阿里视频ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
false
,
name
=
"progress"
,
value
=
"上传进度"
),
})
public
Object
updateProgress
(
String
videoId
,
String
progress
){
otherUploadService
.
updateProgress
(
videoId
,
progress
);
return
Rjx
.
jsonOk
();
}
@ResponseBody
@Transactional
@PostMapping
(
"updateSuccess"
)
@ApiOperation
(
"更新上传完成"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
false
,
name
=
"videoId"
,
value
=
"阿里视频ID"
),
})
public
Object
updateSuccess
(
String
videoId
){
otherUploadService
.
updateSuccess
(
videoId
);
return
Rjx
.
jsonOk
();
}
@ResponseBody
@Transactional
@PostMapping
(
"updateFailByVideoId"
)
@ApiOperation
(
"更新为上传失败"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
true
,
name
=
"videoId"
,
value
=
"阿里视频ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
false
,
name
=
"errorMessage"
,
value
=
"失败原因"
),
})
public
Object
updateFailByVideoId
(
String
videoId
,
String
errorMessage
){
otherUploadService
.
updateFail
(
videoId
,
errorMessage
);
return
Rjx
.
jsonOk
();
}
@ResponseBody
@Transactional
@PostMapping
(
"updateFailByFilmId"
)
@ApiOperation
(
"更新为上传失败"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
true
,
name
=
"film_id"
,
value
=
"影片ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
false
,
name
=
"number"
,
value
=
"集数"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
false
,
name
=
"errorMessage"
,
value
=
"失败原因"
),
})
public
Object
updateFailByFilmId
(
Integer
film_id
,
Integer
number
,
String
errorMessage
){
otherUploadService
.
updateFail
(
film_id
,
number
,
errorMessage
);
return
Rjx
.
jsonOk
();
}
}
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