Commit 98d7f5ca authored by Quxl's avatar Quxl
parents ed3ba8c0 c197b9da
...@@ -7,22 +7,24 @@ import com.egolm.common.jdbc.Page; ...@@ -7,22 +7,24 @@ import com.egolm.common.jdbc.Page;
import com.egolm.film.bean.Fc_film_upload; import com.egolm.film.bean.Fc_film_upload;
public interface OtherUploadService { 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 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 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 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(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 { ...@@ -23,27 +23,37 @@ public class OtherUploadServiceImpl implements OtherUploadService {
jdbcTemplate.saveOrUpdate(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) { public void batchSave(List<Fc_film_upload> fc_film_upload) {
jdbcTemplate.batchSave(fc_film_upload); jdbcTemplate.batchSave(fc_film_upload);
} }
public int checkExists(Integer film_id,Integer number) { public int checkExists(Integer film_no,Integer number) {
String sql = "SELECT count(1) from fc_film_upload where film_id = ? and number = ?"; String sql = "SELECT count(1) from fc_film_upload where film_no = ? and number = ?";
return jdbcTemplate.queryForInt(sql, film_id,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)) { if(StringUtil.isNotEmpty(taskName)) {
String sql = "update fc_film_upload set id = ? ,upload_state = ? ,upload_progress = '0%' ,taskName=? where film_id = ? and 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_id,number); jdbcTemplate.executeUpdate(sql,videoId,FilmContrants.UPLOAD_STATUS_ING,taskName,film_no,number);
}else { }else {
String sql = "update fc_film_upload set id = ? ,upload_state = ? ,upload_progress = '0%' where film_id = ? and 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_id,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 = ? "; 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 { ...@@ -52,7 +62,7 @@ public class OtherUploadServiceImpl implements OtherUploadService {
jdbcTemplate.executeUpdate(sql,progress,videoId); 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 = ? "; 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); jdbcTemplate.executeUpdate(sql,FilmContrants.UPLOAD_STATUS_COMPLETED,videoId);
...@@ -68,10 +78,9 @@ public class OtherUploadServiceImpl implements OtherUploadService { ...@@ -68,10 +78,9 @@ public class OtherUploadServiceImpl implements OtherUploadService {
jdbcTemplate.executeUpdate(filmSql,FilmContrants.UPLOAD_STATUS_FILE,videoId); jdbcTemplate.executeUpdate(filmSql,FilmContrants.UPLOAD_STATUS_FILE,videoId);
} }
public void updateFail(Integer film_id,Integer number,String errorMessage) { public void updateFail(Integer film_no,Integer number,String errorMessage) {
String sql = "update fc_film_upload set upload__error_message =? ,upload_state = ? where film_id = ? and number = ? "; 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_id,number); jdbcTemplate.executeUpdate(sql, errorMessage,FilmContrants.UPLOAD_STATUS_FILE,film_no,number);
} }
/** /**
......
...@@ -44,21 +44,28 @@ public class FilmUploadController { ...@@ -44,21 +44,28 @@ public class FilmUploadController {
@PostMapping("save") @PostMapping("save")
@ApiOperation("保存上传数据") @ApiOperation("保存上传数据")
@ApiImplicitParams({ @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="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="unit_name", value="剧集名"),
@ApiImplicitParam(paramType="query", dataType="String", required=true, name="file_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="后台服务上传路径"), @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 { try {
Fc_film_upload fc_film_upload = new Fc_film_upload(); Fc_film_upload fc_film_upload = new Fc_film_upload();
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_id(film_id); fc_film_upload.setFilm_id(film_id);
fc_film_upload.setFilm_no(film_no);
fc_film_upload.setNumber(number); fc_film_upload.setNumber(number);
fc_film_upload.setUnit_name(unit_name); fc_film_upload.setUnit_name(unit_name);
fc_film_upload.setFile_name(file_name); fc_film_upload.setFile_name(file_name);
fc_film_upload.setFile_local_path(file_local_path); 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()); fc_film_upload.setCreate_time(new Date());
otherUploadService.save(fc_film_upload); otherUploadService.save(fc_film_upload);
...@@ -108,13 +115,14 @@ public class FilmUploadController { ...@@ -108,13 +115,14 @@ public class FilmUploadController {
@PostMapping("updateBegin") @PostMapping("updateBegin")
@ApiOperation("修改为开始上传") @ApiOperation("修改为开始上传")
@ApiImplicitParams({ @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="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="videoId", value="阿里视频ID"),
@ApiImplicitParam(paramType="query", dataType="String", required=false, name="taskName", value="任务名称"), @ApiImplicitParam(paramType="query", dataType="String", required=false, name="taskName", value="任务名称"),
}) })
public Object updateBegin(Integer film_id, Integer number,String videoId,String taskName){ public Object updateBegin(Integer film_id,Integer film_no, Integer number,String videoId,String taskName){
otherUploadService.updateBegin(film_id, number, videoId, taskName); otherUploadService.updateBegin(film_id,film_no, number, videoId, taskName);
return Rjx.jsonOk(); return Rjx.jsonOk();
} }
...@@ -139,9 +147,10 @@ public class FilmUploadController { ...@@ -139,9 +147,10 @@ public class FilmUploadController {
@ApiOperation("更新上传完成") @ApiOperation("更新上传完成")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="String", required=false, name="videoId", value="阿里视频ID"), @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){ public Object updateSuccess(String videoId,String film_no){
otherUploadService.updateSuccess(videoId); otherUploadService.updateSuccess(videoId,film_no);
return Rjx.jsonOk(); return Rjx.jsonOk();
} }
...@@ -160,15 +169,15 @@ public class FilmUploadController { ...@@ -160,15 +169,15 @@ public class FilmUploadController {
@ResponseBody @ResponseBody
@Transactional @Transactional
@PostMapping("updateFailByFilmId") @PostMapping("updateFailByFilmNo")
@ApiOperation("更新为上传失败") @ApiOperation("更新为上传失败")
@ApiImplicitParams({ @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="int", required=false, name="number", value="集数"),
@ApiImplicitParam(paramType="query", dataType="String", required=false, name="errorMessage", value="失败原因"), @ApiImplicitParam(paramType="query", dataType="String", required=false, name="errorMessage", value="失败原因"),
}) })
public Object updateFailByFilmId(Integer film_id,Integer number,String errorMessage){ public Object updateFailByFilmNo(Integer film_no,Integer number,String errorMessage){
otherUploadService.updateFail(film_id, number, errorMessage); otherUploadService.updateFail(film_no, number, errorMessage);
return Rjx.jsonOk(); return Rjx.jsonOk();
} }
} }
...@@ -11,7 +11,7 @@ public class Fc_film_upload implements java.io.Serializable { ...@@ -11,7 +11,7 @@ public class Fc_film_upload implements java.io.Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(columnDefinition="varchar(255)") @Column(columnDefinition="varchar(255) COMMENT '阿里云视频ID'")
private String id; private String id;
@Column(columnDefinition="int(11) COMMENT '影片ID'") @Column(columnDefinition="int(11) COMMENT '影片ID'")
...@@ -23,7 +23,7 @@ public class Fc_film_upload implements java.io.Serializable { ...@@ -23,7 +23,7 @@ public class Fc_film_upload implements java.io.Serializable {
@Column(columnDefinition="int(11) COMMENT '集数'") @Column(columnDefinition="int(11) COMMENT '集数'")
private Integer number; private Integer number;
@Column(columnDefinition="int(11) COMMENT '上传状态'") @Column(columnDefinition="int(11) COMMENT '上传状态 0未上传, 1上传中, 2已上传'")
private Integer upload_state; private Integer upload_state;
@Column(columnDefinition="varchar(255) COMMENT '剧集名'") @Column(columnDefinition="varchar(255) COMMENT '剧集名'")
...@@ -38,7 +38,7 @@ public class Fc_film_upload implements java.io.Serializable { ...@@ -38,7 +38,7 @@ public class Fc_film_upload implements java.io.Serializable {
@Column(columnDefinition="datetime COMMENT '完成上传时间'") @Column(columnDefinition="datetime COMMENT '完成上传时间'")
private Date upload_time; private Date upload_time;
@Column(columnDefinition="varchar(32) COMMENT '上传进度'") @Column(columnDefinition="varchar(36) COMMENT '上传进度'")
private String upload_progress; private String upload_progress;
@Column(columnDefinition="varchar(255) COMMENT '后台服务上传路径'") @Column(columnDefinition="varchar(255) COMMENT '后台服务上传路径'")
...@@ -47,7 +47,7 @@ public class Fc_film_upload implements java.io.Serializable { ...@@ -47,7 +47,7 @@ public class Fc_film_upload implements java.io.Serializable {
@Column(columnDefinition="varchar(255) COMMENT '后台服务上传失败原因'") @Column(columnDefinition="varchar(255) COMMENT '后台服务上传失败原因'")
private String upload__error_message; private String upload__error_message;
@Column(columnDefinition="varchar(64) COMMENT '后台服务上传任务名称'") @Column(columnDefinition="varchar(255) COMMENT '分配的任务名称'")
private String taskName; private String taskName;
......
...@@ -5,4 +5,6 @@ public class FilmContrants { ...@@ -5,4 +5,6 @@ public class FilmContrants {
public static int UPLOAD_STATUS_ING=1; //上传中 public static int UPLOAD_STATUS_ING=1; //上传中
public static int UPLOAD_STATUS_COMPLETED=2; //上传完成 public static int UPLOAD_STATUS_COMPLETED=2; //上传完成
public static int UPLOAD_STATUS_FILE=3; //上传失败 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