Commit a812dd9b authored by 张永's avatar 张永

1

parent b8d9143f
...@@ -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);
} }
...@@ -22,28 +22,38 @@ public class OtherUploadServiceImpl implements OtherUploadService { ...@@ -22,28 +22,38 @@ public class OtherUploadServiceImpl implements OtherUploadService {
public void save(Fc_film_upload fc_film_upload) { public void save(Fc_film_upload fc_film_upload) {
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);
...@@ -62,16 +72,15 @@ public class OtherUploadServiceImpl implements OtherUploadService { ...@@ -62,16 +72,15 @@ public class OtherUploadServiceImpl implements OtherUploadService {
//上传失败 //上传失败
public void updateFail(String videoId,String errorMessage) { public void updateFail(String videoId,String errorMessage) {
String sql = "update fc_film_upload set upload__error_message =? ,upload_state = ? where id = ? "; 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 = ? "; String filmSql = "update fc_member_film set upload_state = ? where upload_id = ? ";
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);
} }
/** /**
......
...@@ -15,7 +15,7 @@ import com.egolm.common.bean.Rjx; ...@@ -15,7 +15,7 @@ import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page; import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.OtherUploadService; import com.egolm.film.api.service.OtherUploadService;
import com.egolm.film.bean.Fc_film_upload; 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.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -44,16 +44,23 @@ public class FilmUploadController { ...@@ -44,16 +44,23 @@ 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();
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.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);
...@@ -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,16 +11,19 @@ public class Fc_film_upload implements java.io.Serializable { ...@@ -11,16 +11,19 @@ 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'")
private Integer film_id; private Integer film_id;
@Column(columnDefinition="int(11) COMMENT '影片NO'")
private Integer film_no;
@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 '剧集名'")
...@@ -35,7 +38,7 @@ public class Fc_film_upload implements java.io.Serializable { ...@@ -35,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 '后台服务上传路径'")
...@@ -44,7 +47,7 @@ public class Fc_film_upload implements java.io.Serializable { ...@@ -44,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;
...@@ -64,6 +67,14 @@ public class Fc_film_upload implements java.io.Serializable { ...@@ -64,6 +67,14 @@ public class Fc_film_upload implements java.io.Serializable {
return film_id; 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) { public void setNumber(Integer number) {
this.number = number; this.number = number;
} }
...@@ -145,4 +156,4 @@ public class Fc_film_upload implements java.io.Serializable { ...@@ -145,4 +156,4 @@ public class Fc_film_upload implements java.io.Serializable {
} }
} }
...@@ -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