Commit a812dd9b authored by 张永's avatar 张永

1

parent b8d9143f
......@@ -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);
}
......@@ -23,27 +23,37 @@ public class OtherUploadServiceImpl implements OtherUploadService {
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);
......@@ -68,10 +78,9 @@ public class OtherUploadServiceImpl implements OtherUploadService {
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);
}
/**
......
......@@ -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("updateFailByFilmId")
@PostMapping("updateFailByFilmNo")
@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 updateFailByFilmId(Integer film_id,Integer number,String errorMessage){
otherUploadService.updateFail(film_id, number, errorMessage);
public Object updateFailByFilmNo(Integer film_no,Integer number,String errorMessage){
otherUploadService.updateFail(film_no, number, errorMessage);
return Rjx.jsonOk();
}
}
......@@ -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(32) COMMENT '上传进度'")
@Column(columnDefinition="varchar(36) 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;
}
......
......@@ -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; //数据异常
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment