Commit 9980adc1 authored by Quxl's avatar Quxl
parents f7874a82 50016f92
package com.egolm.film.api.service;
import java.util.List;
import java.util.Map;
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 save(Fc_film_upload fc_film_upload);
public int checkExists(Integer film_id,Integer number);
public List<Map<String,Object>> getWaitUploadList(Page page);
public void updateBegin(Integer film_id, Integer number,String videoId,String taskName);
public void updateProgress(String videoId,String progress);
public void updateSuccess(String videoId);
public void updateFail(String videoId,String errorMessage);
public void updateFail(Integer film_id,Integer number,String errorMessage);
}
......@@ -35,6 +35,7 @@ import com.egolm.film.bean.model.Fc_member_film_base_model;
import com.egolm.film.config.WebMvcConfig;
import com.egolm.film.config.XException;
import com.egolm.film.config.XRException;
import com.egolm.film.util.FilmContrants;
import com.egolm.film.util.SqlWhere;
......@@ -635,15 +636,25 @@ public class FilmServiceImpl implements FilmService {
@Override
public void updateFilmUploadState(String[] film_id,String[] number) {
if(film_id.length == number.length) {
List<Object[]> objs = new ArrayList<Object[]>();
List<Object[]> uploadObjs = new ArrayList<Object[]>();
List<Object[]> filmObjs = new ArrayList<Object[]>();
for(int i = 0; i < film_id.length; i++) {
objs.add(new Object[]{
uploadObjs.add(new Object[]{
FilmContrants.UPLOAD_STATUS_INIT,
film_id[i],
number[i]});
filmObjs.add(new Object[]{
FilmContrants.UPLOAD_STATUS_INIT,
film_id[i]});
}
String sql = "update fc_film_upload set upload_state = 0 ,upload__error_message= '',upload_progress='0%' where film_id = ? and number = ? ";
jdbcTemplate.batchUpdate(sql, objs);
String updateSql = "update fc_film_upload set upload_state = ? ,upload__error_message= '',upload_progress='0%' where film_id = ? and number = ? ";
jdbcTemplate.batchUpdate(updateSql, uploadObjs);
String filmSql = "update fc_member_film set upload_state = ? where film_no = ? ";
jdbcTemplate.batchUpdate(filmSql, filmObjs);
}
}
}
package com.egolm.film.api.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.egolm.common.StringUtil;
import com.egolm.common.jdbc.JdbcTemplate;
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;
@Service
public class OtherUploadServiceImpl implements OtherUploadService {
@Autowired
private JdbcTemplate jdbcTemplate;
public void save(Fc_film_upload fc_film_upload) {
jdbcTemplate.saveOrUpdate(fc_film_upload);
}
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 void updateBegin(Integer film_id, 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);
}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 filmSql = "update fc_member_film set upload_id =?, upload_state = ? where film_no = ? ";
jdbcTemplate.executeUpdate(filmSql, videoId,FilmContrants.UPLOAD_STATUS_ING,film_id);
}
//修改进度
public void updateProgress(String videoId,String progress) {
String sql = "update fc_film_upload set upload_progress = ? where id = ? ";
jdbcTemplate.executeUpdate(sql,progress,videoId);
}
//上传成功
public void updateSuccess(String videoId) {
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);
String filmSql = "update fc_member_film set upload_state = ? ,upload_time =now() where upload_id = ? ";
jdbcTemplate.executeUpdate(filmSql, FilmContrants.UPLOAD_STATUS_COMPLETED,videoId);
}
//上传失败
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);
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);
}
/**
* 获取待上传的视频 一次1条
* @Title: getList
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param: @return
* @return: List<Map<String,Object>>
* @throws
*/
public List<Map<String,Object>> getWaitUploadList(Page page){
String sql = "SELECT * from fc_film_upload where upload_state = 0";
return jdbcTemplate.limit(sql, page);
}
}
package com.egolm.film.api.web.admin;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.MessageFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
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.DateUtil;
import com.egolm.common.Util;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.AdminTokenService;
import com.egolm.film.api.service.EmailService;
import com.egolm.film.api.service.ExportService;
import com.egolm.film.api.service.FilmService;
import com.egolm.film.api.service.ReviewService;
import com.egolm.film.bean.Fc_admin;
import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.model.LoginToken;
import com.egolm.film.util.Common;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
/**
* 初审
* @author Quxl
*
*/
@Api
@Controller
@RequestMapping("admin/first")
public class AdminFirstController {
Logger logger = LoggerFactory.getLogger(AdminFirstController.class);
@Autowired
FilmService filmService;
@Autowired
AdminTokenService tokenService;
@Autowired
EmailService emailService;
@Autowired
ReviewService reviewService;
@Autowired
ExportService exportService;
@ResponseBody
@PostMapping("list")
@ApiOperation("影片列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="keyword", value="关键字"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="state", value="影片状态 1未提交 2 已提交"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="apply_state", value="初审状态 1未初审 2初审通过 3初审否决"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="film_type", value="影片类型"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="enroll_type", value="影片性质"),
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="film_country", value="影片国家地区"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="film_type_short", value="影片扩展分类"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="upload_state", value="影片文件上传状态(0,1)"),
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="play_shanghai", value="首映情况"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="review_round", value="审片轮数,第几轮审片"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="review_state", value="审片结论 1通过 2否决 3参赛 4参赛备选 5参展"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="allot_atate", value="评委分配状态 0未分配评委 1已分配评委评选中"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="opt_state", value="评选状态 0未评选 1有争议 2管理员分配 3已完成"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="film_group_id", value="影片分组ID"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="index", value="分页编号"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="limit", value="分页大小"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="limitKey", value="排序"),
})
public Object list(
String keyword, String film_country, String play_shanghai,
Integer state, Integer apply_state, Integer film_type, Integer enroll_type, Integer upload_state, Integer film_type_short,
Integer review_round, Integer review_state, Integer allot_atate, Integer opt_state, Integer[] film_group_id,
Long index,
Long limit,
String[] limitKey,
HttpServletRequest request,
HttpServletResponse response) throws IOException {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
Page page = new Page(index, limit, limitKey);
Fc_admin admin = Util.mapTo(tokenService.getTokenObj(), Fc_admin.class);
List<Map<String, Object>> list = filmService.queryFilmList(admin.getGroup_id(), keyword, state, apply_state, upload_state, film_type, enroll_type, film_country, film_type_short, play_shanghai, review_round, review_state, allot_atate, opt_state, film_group_id, page);
return Rjx.jsonOk().setData(list).setPage(page);
}
@ResponseBody
@Transactional
@PostMapping("pass")
@ApiOperation("初审通过")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="申报影片ID"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="film_type_name_short", value="影片分类扩展分类"),
})
public Object pass(Long member_film_id, String film_type_name_short) {
filmService.verifyFilmDuplicate(member_film_id);
Fc_member_film film = new Fc_member_film();
LoginToken token = tokenService.getToken();
Integer adminid = (Integer)token.getId();
film.setId(member_film_id);
film.setFilm_type_name_short(film_type_name_short);
film.setFirst_admin_id(adminid);
film.setApply_state(2);
film.setUpload_state(0);
film.setPass_time(System.currentTimeMillis()/1000);
filmService.mergeMemberFilm(film);
filmService.pass(member_film_id);
reviewService.toFirstRound(member_film_id);
Map<String, Object> map = emailService.sendByTemplate_01(member_film_id, "doc/first_pass");
Rjx rjx = Rjx.jsonOk();
rjx.putAll(map);
filmService.initKeywords(member_film_id);
return rjx;
}
@ResponseBody
@PostMapping("reject")
@ApiOperation("初审驳回")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="申报影片ID"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="apply_state_intro", value="拒绝理由,初审结论"),
@ApiImplicitParam(paramType="query", dataType="boolean", required=false, name="is_stop_apply", value="true否决 false驳回"),
})
public Object reject(Boolean is_stop_apply, Long member_film_id, String apply_state_intro) {
if(is_stop_apply == null) {
is_stop_apply = false;
}
filmService.reject(is_stop_apply, member_film_id, apply_state_intro);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("testMail")
@ApiOperation("初审通过邮件通知测试")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", dataType="string", required=true, name="i18n_language"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="email")
})
public Object testMail(String email, HttpServletRequest request) {
String i18n_language = request.getHeader("i18n_language");
String[] strs = i18n_language.split("_", 2);
String content = Common.getStringAsStream("doc/first_pass_" + strs[0].toLowerCase() + "_" + strs[1].toUpperCase() + ".txt");
content = MessageFormat.format(content, "曲欣亮", "00001", "蜘蛛侠");
LoginToken token = tokenService.getToken();
Integer adminid = (Integer)token.getId();
emailService.send(2, adminid, "测试邮件", content, email);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("save_upload_id")
@ApiOperation("保存上传状态和上传ID")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="申报影片ID"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="upload_id", value="影片上传ID"),
})
public Object save_upload_id(Long member_film_id, String upload_id) {
filmService.saveUploadId(member_film_id, upload_id);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("save_upload_state")
@ApiOperation("保存上传状态和上传ID")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="申报影片ID"),
@ApiImplicitParam(paramType="query", dataType="int", required=true, name="upload_state", value="影片上传状态(0未上传, 1已上传)"),
})
public Object save_upload_state(Long member_film_id, Integer upload_state) {
filmService.saveUploadState(member_film_id, upload_state);
return Rjx.jsonOk();
package com.egolm.film.api.web.admin;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.MessageFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
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.DateUtil;
import com.egolm.common.Util;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.AdminTokenService;
import com.egolm.film.api.service.EmailService;
import com.egolm.film.api.service.ExportService;
import com.egolm.film.api.service.FilmService;
import com.egolm.film.api.service.ReviewService;
import com.egolm.film.bean.Fc_admin;
import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.model.LoginToken;
import com.egolm.film.util.Common;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
/**
* 初审
* @author Quxl
*
*/
@Api
@Controller
@RequestMapping("admin/first")
public class AdminFirstController {
Logger logger = LoggerFactory.getLogger(AdminFirstController.class);
@Autowired
FilmService filmService;
@Autowired
AdminTokenService tokenService;
@Autowired
EmailService emailService;
@Autowired
ReviewService reviewService;
@Autowired
ExportService exportService;
@ResponseBody
@PostMapping("list")
@ApiOperation("影片列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="keyword", value="关键字"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="state", value="影片状态 1未提交 2 已提交"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="apply_state", value="初审状态 1未初审 2初审通过 3初审否决"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="film_type", value="影片类型"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="enroll_type", value="影片性质"),
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="film_country", value="影片国家地区"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="film_type_short", value="影片扩展分类"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="upload_state", value="影片文件上传状态(0,1)"),
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="play_shanghai", value="首映情况"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="review_round", value="审片轮数,第几轮审片"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="review_state", value="审片结论 1通过 2否决 3参赛 4参赛备选 5参展"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="allot_atate", value="评委分配状态 0未分配评委 1已分配评委评选中"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="opt_state", value="评选状态 0未评选 1有争议 2管理员分配 3已完成"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="film_group_id", value="影片分组ID"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="index", value="分页编号"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="limit", value="分页大小"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="limitKey", value="排序"),
})
public Object list(
String keyword, String film_country, String play_shanghai,
Integer state, Integer apply_state, Integer film_type, Integer enroll_type, Integer upload_state, Integer film_type_short,
Integer review_round, Integer review_state, Integer allot_atate, Integer opt_state, Integer[] film_group_id,
Long index,
Long limit,
String[] limitKey,
HttpServletRequest request,
HttpServletResponse response) throws IOException {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
Page page = new Page(index, limit, limitKey);
Fc_admin admin = Util.mapTo(tokenService.getTokenObj(), Fc_admin.class);
List<Map<String, Object>> list = filmService.queryFilmList(admin.getGroup_id(), keyword, state, apply_state, upload_state, film_type, enroll_type, film_country, film_type_short, play_shanghai, review_round, review_state, allot_atate, opt_state, film_group_id, page);
return Rjx.jsonOk().setData(list).setPage(page);
}
@ResponseBody
@Transactional
@PostMapping("pass")
@ApiOperation("初审通过")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="申报影片ID"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="film_type_name_short", value="影片分类扩展分类"),
})
public Object pass(Long member_film_id, String film_type_name_short) {
filmService.verifyFilmDuplicate(member_film_id);
Fc_member_film film = new Fc_member_film();
LoginToken token = tokenService.getToken();
Integer adminid = (Integer)token.getId();
film.setId(member_film_id);
film.setFilm_type_name_short(film_type_name_short);
film.setFirst_admin_id(adminid);
film.setApply_state(2);
film.setUpload_state(0);
film.setPass_time(System.currentTimeMillis()/1000);
filmService.mergeMemberFilm(film);
filmService.pass(member_film_id);
reviewService.toFirstRound(member_film_id);
Map<String, Object> map = emailService.sendByTemplate_01(member_film_id, "doc/first_pass");
Rjx rjx = Rjx.jsonOk();
rjx.putAll(map);
filmService.initKeywords(member_film_id);
return rjx;
}
@ResponseBody
@PostMapping("reject")
@ApiOperation("初审驳回")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="申报影片ID"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="apply_state_intro", value="拒绝理由,初审结论"),
@ApiImplicitParam(paramType="query", dataType="boolean", required=false, name="is_stop_apply", value="true否决 false驳回"),
})
public Object reject(Boolean is_stop_apply, Long member_film_id, String apply_state_intro) {
if(is_stop_apply == null) {
is_stop_apply = false;
}
filmService.reject(is_stop_apply, member_film_id, apply_state_intro);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("testMail")
@ApiOperation("初审通过邮件通知测试")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", dataType="string", required=true, name="i18n_language"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="email")
})
public Object testMail(String email, HttpServletRequest request) {
String i18n_language = request.getHeader("i18n_language");
String[] strs = i18n_language.split("_", 2);
String content = Common.getStringAsStream("doc/first_pass_" + strs[0].toLowerCase() + "_" + strs[1].toUpperCase() + ".txt");
content = MessageFormat.format(content, "曲欣亮", "00001", "蜘蛛侠");
LoginToken token = tokenService.getToken();
Integer adminid = (Integer)token.getId();
emailService.send(2, adminid, "测试邮件", content, email);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("save_upload_id")
@ApiOperation("保存上传状态和上传ID")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="申报影片ID"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="upload_id", value="影片上传ID"),
})
public Object save_upload_id(Long member_film_id, String upload_id) {
filmService.saveUploadId(member_film_id, upload_id);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("save_upload_state")
@ApiOperation("保存上传状态和上传ID")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="申报影片ID"),
@ApiImplicitParam(paramType="query", dataType="int", required=true, name="upload_state", value="影片上传状态(0未上传, 1已上传)"),
})
public Object save_upload_state(Long member_film_id, Integer upload_state) {
filmService.saveUploadState(member_film_id, upload_state);
return Rjx.jsonOk();
}
@ResponseBody
......@@ -207,62 +207,78 @@ public class AdminFirstController {
Page page = new Page(index, limit);
List<Map<String, Object>> list = filmService.queryMonitorUploadList(keyword,upload_state,page);
return Rjx.jsonOk().setData(list).setPage(page);
}
@ResponseBody
@PostMapping("update_state")
@ApiOperation("修改影片状态")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="影片ID"),
@ApiImplicitParam(paramType="query", dataType="int", required=true, name="state", value="影片状态:1未提交 2已提交"),
})
public Object update_state(Long member_film_id, Integer state) {
filmService.updateFilmState(member_film_id, state);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("exchangeFilmNo")
@ApiOperation("交换影片编号, id1影片会被更新初审待审核状态,id2影片会被更新为初审否决状态")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="int", required=true, name="id1", value="做为主影片,会被保留,状态重置为初审待审核"),
@ApiImplicitParam(paramType="query", dataType="int", required=true, name="id2", value="编号会被替换,并且状态会重置为初审否决"),
})
public Object exchangeFilmNo(Integer id1, Integer id2) {
filmService.exchangeFilmNo(id1, id2);
filmService.initKeywords(id1.longValue());
filmService.initKeywords(id2.longValue());
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("getApplyListColumns")
@ApiOperation("获取报名列表导出列")
public Object getApplyListColumns() {
return Rjx.jsonOk().setData(exportService.getApplyListColumns());
}
@GetMapping("exportApplyList")
@ApiOperation("导出报名列表")
public void exportApplyList(HttpServletResponse response, String[] columns) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报名列表[" + DateUtil.format(new Date(), "yyMMdd-HHmmss") + "].xls", "UTF-8"));
exportService.exportApplyList(response.getOutputStream(), columns);
}
@ResponseBody
@PostMapping("getApplyPassListColumns")
@ApiOperation("获取影片列表导出列")
public Object getApplyPassListColumns() {
return Rjx.jsonOk().setData(exportService.getApplyPassListColumns());
}
@GetMapping("exportApplyPassList")
@ApiOperation("导出影片列表")
public void exportApplyPassList(HttpServletResponse response, String[] columns) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("影片列表[" + DateUtil.format(new Date(), "yyMMdd-HHmmss") + "].xls", "UTF-8"));
exportService.exportApplyPassList(response.getOutputStream(), columns);
}
}
@ResponseBody
@PostMapping("batch_update_state")
@ApiOperation("批量修改上传列表状态")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="int", allowMultiple=true, required=true, name="film_id", value="影片ID"),
@ApiImplicitParam(paramType="query", dataType="int", allowMultiple=true, required=true, name="number", value="第几集"),
})
public Object batch_update_state(HttpServletRequest req) {
String[] film_id = req.getParameterValues("film_id");
String[] number = req.getParameterValues("number");
filmService.updateFilmUploadState(film_id, number);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("update_state")
@ApiOperation("修改影片状态")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="影片ID"),
@ApiImplicitParam(paramType="query", dataType="int", required=true, name="state", value="影片状态:1未提交 2已提交"),
})
public Object update_state(Long member_film_id, Integer state) {
filmService.updateFilmState(member_film_id, state);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("exchangeFilmNo")
@ApiOperation("交换影片编号, id1影片会被更新初审待审核状态,id2影片会被更新为初审否决状态")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="int", required=true, name="id1", value="做为主影片,会被保留,状态重置为初审待审核"),
@ApiImplicitParam(paramType="query", dataType="int", required=true, name="id2", value="编号会被替换,并且状态会重置为初审否决"),
})
public Object exchangeFilmNo(Integer id1, Integer id2) {
filmService.exchangeFilmNo(id1, id2);
filmService.initKeywords(id1.longValue());
filmService.initKeywords(id2.longValue());
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("getApplyListColumns")
@ApiOperation("获取报名列表导出列")
public Object getApplyListColumns() {
return Rjx.jsonOk().setData(exportService.getApplyListColumns());
}
@GetMapping("exportApplyList")
@ApiOperation("导出报名列表")
public void exportApplyList(HttpServletResponse response, String[] columns) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报名列表[" + DateUtil.format(new Date(), "yyMMdd-HHmmss") + "].xls", "UTF-8"));
exportService.exportApplyList(response.getOutputStream(), columns);
}
@ResponseBody
@PostMapping("getApplyPassListColumns")
@ApiOperation("获取影片列表导出列")
public Object getApplyPassListColumns() {
return Rjx.jsonOk().setData(exportService.getApplyPassListColumns());
}
@GetMapping("exportApplyPassList")
@ApiOperation("导出影片列表")
public void exportApplyPassList(HttpServletResponse response, String[] columns) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("影片列表[" + DateUtil.format(new Date(), "yyMMdd-HHmmss") + "].xls", "UTF-8"));
exportService.exportApplyPassList(response.getOutputStream(), columns);
}
}
\ No newline at end of file
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();
}
}
package com.egolm.film.bean;
import javax.persistence.Entity;
import javax.persistence.Column;
import java.util.Date;
@Entity(name="fc_film_upload")
public class Fc_film_upload implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Column(columnDefinition="varchar(255) COMMENT '阿里云视频ID'")
private String id;
@Column(columnDefinition="int(11) COMMENT '影片ID'")
private Integer film_id;
@Column(columnDefinition="int(11) COMMENT '集数'")
private Integer number;
@Column(columnDefinition="int(11) COMMENT '上传状态 0未上传, 1上传中, 2已上传'")
private Integer upload_state;
@Column(columnDefinition="varchar(255) COMMENT '剧集名'")
private String unit_name;
@Column(columnDefinition="varchar(255) COMMENT '文件名'")
private String file_name;
@Column(columnDefinition="datetime COMMENT '开始上传时间'")
private Date create_time;
@Column(columnDefinition="datetime COMMENT '完成上传时间'")
private Date upload_time;
@Column(columnDefinition="varchar(36) COMMENT '上传进度'")
private String upload_progress;
@Column(columnDefinition="varchar(255) COMMENT '后台服务上传路径'")
private String file_local_path;
@Column(columnDefinition="varchar(255) COMMENT '后台服务上传失败原因'")
private String upload__error_message;
@Column(columnDefinition="varchar(255) COMMENT '分配的任务名称'")
private String taskName;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setFilm_id(Integer film_id) {
this.film_id = film_id;
}
public Integer getFilm_id() {
return film_id;
}
public void setNumber(Integer number) {
this.number = number;
}
public Integer getNumber() {
return number;
}
public void setUpload_state(Integer upload_state) {
this.upload_state = upload_state;
}
public Integer getUpload_state() {
return upload_state;
}
public void setUnit_name(String unit_name) {
this.unit_name = unit_name;
}
public String getUnit_name() {
return unit_name;
}
public void setFile_name(String file_name) {
this.file_name = file_name;
}
public String getFile_name() {
return file_name;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Date getCreate_time() {
return create_time;
}
public void setUpload_time(Date upload_time) {
this.upload_time = upload_time;
}
public Date getUpload_time() {
return upload_time;
}
public void setUpload_progress(String upload_progress) {
this.upload_progress = upload_progress;
}
public String getUpload_progress() {
return upload_progress;
}
public void setFile_local_path(String file_local_path) {
this.file_local_path = file_local_path;
}
public String getFile_local_path() {
return file_local_path;
}
public void setUpload__error_message(String upload__error_message) {
this.upload__error_message = upload__error_message;
}
public String getUpload__error_message() {
return upload__error_message;
}
public void setTaskName(String taskName) {
this.taskName = taskName;
}
public String getTaskName() {
return taskName;
}
}
package com.egolm.film.util;
public class FilmContrants {
public static int UPLOAD_STATUS_INIT=0; //待上传
public static int UPLOAD_STATUS_ING=1; //上传中
public static int UPLOAD_STATUS_COMPLETED=2; //上传完成
public static int UPLOAD_STATUS_FILE=3; //上传失败
}
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