Commit d4c69c3c authored by 张永's avatar 张永

增加上传监控接口

parent 0520e2c8
package com.egolm.film.api.service;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.egolm.common.jdbc.Page;
import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.bean.Fc_member_film_enroll;
import com.egolm.film.bean.Fc_member_film_issuer;
import com.egolm.film.bean.Fc_member_film_playactor;
import com.egolm.film.bean.Fc_member_film_show;
import com.egolm.film.bean.model.Fc_member_film_base_model;
public interface FilmService {
Logger logger = LoggerFactory.getLogger(FilmService.class);
List<Fc_member_film_issuer> queryMemberFilmIssuerList(Long member_film_id);
List<Fc_member_film_playactor> queryMemberFilmPlayactorList(Long member_film_id);
List<Fc_member_film_show> queryMemberFilmShowList(Long member_film_id);
void doApply(
Integer member_id,
Long member_film_id);
Long saveMemberFilmType(
Integer member_id,
String film_type_name,
String enroll_type_name);
void saveMemberFilmBase(
Integer member_id,
Long member_film_id,
String[] enroll_type_name_other,
String cn_name,
String en_name,
String intro);
void saveMemberFilmInfo(
Integer member_id,
Long member_film_id,
String film_country,
String dialogue_lang,
String subtitle_lang,
String[] co_production_country,
String film_total_time,
String completion_date,
String show_date,
String first_show_date,
String first_show_city,
Integer is_apply_other_filmfest,
String other_filmfest_name,
String film_medium,
String film_format,
String film_format_url,
String film_format_passw,
String film_format_other);
void saveMemberFilmPlayactor(
Long member_film_id,
String[] playactor_type,
String[] playactor_role_name,
String[] playactor_name,
String[] playactor_film_nums,
String[] playactor_country,
String[] playactor_birthday,
String[] playactor_intro,
Integer[] is_play_shanghai);
void saveMemberFilmIssuer(
Long member_film_id,
String[] issuer_company,
String[] issuer_contacts,
String[] issuer_email,
String[] issuer_tel);
void saveMemberFilmShow(
Long member_film_id,
String play_shanghai,
String[] show_filmfest,
String[] show_filmfest_type,
String[] show_filmfest_intro);
void saveMemberFilmCompany(
Integer member_id,
Long member_film_id,
String film_apply_company,
String film_apply_realname,
String film_apply_email,
String film_apply_tel,
String film_apply_mobile,
String film_apply_country);
List<Map<String, Object>> queryListAll(String keyword);
List<Map<String, Object>> queryFilmList(
Integer admin_group_id,
String keyword,
Integer state,
Integer apply_state,
Integer upload_state,
Integer film_type,
Integer enroll_type,
String film_country,
Integer film_type_short,
String play_shanghai,
Integer review_round,
Integer review_state,
Integer allot_atate,
Integer opt_state,
Integer[] film_group_id,
Page page);
Integer pass(Long member_film_id);
void reject(Boolean is_stop_apply, Long member_film_id, String apply_state_intro);
Fc_member_film queryMemberFilmById(Long member_film_id);
Object queryEnrollList();
Object queryTypeList();
void mergeMemberFilm(Fc_member_film film);
/**
* 更新影片基本信息
* @param filmBase
*/
void updateFilmBase(Fc_member_film_base_model filmBase);
void updateEnroll(Long member_film_id);
void saveUploadId(Long member_film_id, String upload_id);
void saveUploadState(Long member_film_id, Integer upload_state);
List<Fc_member_film_enroll> queryFilmEnrollList(Long member_film_id);
void verifyFilmDuplicate(Long member_film_id);
void updateFilmState(Long member_film_id, Integer state);
void saveCreateBase(Long id, Integer admin_id, Integer member_id, String create_ip);
void exchangeFilmNo(Integer id1, Integer id2);
void initKeywords(Long member_film_id);
}
package com.egolm.film.api.service;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.egolm.common.jdbc.Page;
import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.bean.Fc_member_film_enroll;
import com.egolm.film.bean.Fc_member_film_issuer;
import com.egolm.film.bean.Fc_member_film_playactor;
import com.egolm.film.bean.Fc_member_film_show;
import com.egolm.film.bean.model.Fc_member_film_base_model;
public interface FilmService {
Logger logger = LoggerFactory.getLogger(FilmService.class);
List<Fc_member_film_issuer> queryMemberFilmIssuerList(Long member_film_id);
List<Fc_member_film_playactor> queryMemberFilmPlayactorList(Long member_film_id);
List<Fc_member_film_show> queryMemberFilmShowList(Long member_film_id);
void doApply(
Integer member_id,
Long member_film_id);
Long saveMemberFilmType(
Integer member_id,
String film_type_name,
String enroll_type_name);
void saveMemberFilmBase(
Integer member_id,
Long member_film_id,
String[] enroll_type_name_other,
String cn_name,
String en_name,
String intro);
void saveMemberFilmInfo(
Integer member_id,
Long member_film_id,
String film_country,
String dialogue_lang,
String subtitle_lang,
String[] co_production_country,
String film_total_time,
String completion_date,
String show_date,
String first_show_date,
String first_show_city,
Integer is_apply_other_filmfest,
String other_filmfest_name,
String film_medium,
String film_format,
String film_format_url,
String film_format_passw,
String film_format_other);
void saveMemberFilmPlayactor(
Long member_film_id,
String[] playactor_type,
String[] playactor_role_name,
String[] playactor_name,
String[] playactor_film_nums,
String[] playactor_country,
String[] playactor_birthday,
String[] playactor_intro,
Integer[] is_play_shanghai);
void saveMemberFilmIssuer(
Long member_film_id,
String[] issuer_company,
String[] issuer_contacts,
String[] issuer_email,
String[] issuer_tel);
void saveMemberFilmShow(
Long member_film_id,
String play_shanghai,
String[] show_filmfest,
String[] show_filmfest_type,
String[] show_filmfest_intro);
void saveMemberFilmCompany(
Integer member_id,
Long member_film_id,
String film_apply_company,
String film_apply_realname,
String film_apply_email,
String film_apply_tel,
String film_apply_mobile,
String film_apply_country);
List<Map<String, Object>> queryListAll(String keyword);
List<Map<String, Object>> queryFilmList(
Integer admin_group_id,
String keyword,
Integer state,
Integer apply_state,
Integer upload_state,
Integer film_type,
Integer enroll_type,
String film_country,
Integer film_type_short,
String play_shanghai,
Integer review_round,
Integer review_state,
Integer allot_atate,
Integer opt_state,
Integer[] film_group_id,
Page page);
Integer pass(Long member_film_id);
void reject(Boolean is_stop_apply, Long member_film_id, String apply_state_intro);
Fc_member_film queryMemberFilmById(Long member_film_id);
Object queryEnrollList();
Object queryTypeList();
void mergeMemberFilm(Fc_member_film film);
/**
* 更新影片基本信息
* @param filmBase
*/
void updateFilmBase(Fc_member_film_base_model filmBase);
void updateEnroll(Long member_film_id);
void saveUploadId(Long member_film_id, String upload_id);
void saveUploadState(Long member_film_id, Integer upload_state);
List<Fc_member_film_enroll> queryFilmEnrollList(Long member_film_id);
void verifyFilmDuplicate(Long member_film_id);
void updateFilmState(Long member_film_id, Integer state);
void saveCreateBase(Long id, Integer admin_id, Integer member_id, String create_ip);
void exchangeFilmNo(Integer id1, Integer id2);
void initKeywords(Long member_film_id);
List<Map<String, Object>> queryMonitorUploadList(String keyword,Integer upload_state, Page page);
public void updateFilmUploadState(String[] film_id,String[] number);
}
package com.egolm.film.api.service.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.common.web.ServletUtil;
import com.egolm.film.api.service.FilmService;
import com.egolm.film.api.service.Messages;
import com.egolm.film.bean.Enum_enroll;
import com.egolm.film.bean.Enum_filmtype;
import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.bean.Fc_member_film_enroll;
import com.egolm.film.bean.Fc_member_film_issuer;
import com.egolm.film.bean.Fc_member_film_playactor;
import com.egolm.film.bean.Fc_member_film_show;
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.SqlWhere;
@Service
public class FilmServiceImpl implements FilmService {
@Autowired
private Messages messages;
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public List<Fc_member_film_issuer> queryMemberFilmIssuerList(Long member_film_id) {
return jdbcTemplate.queryForBeans("select * from fc_member_film_issuer where film_id = ?", Fc_member_film_issuer.class, member_film_id);
}
@Override
public List<Fc_member_film_playactor> queryMemberFilmPlayactorList(Long member_film_id) {
return jdbcTemplate.queryForBeans("select * from fc_member_film_playactor where film_id = ?", Fc_member_film_playactor.class, member_film_id);
}
@Override
public List<Fc_member_film_show> queryMemberFilmShowList(Long member_film_id) {
return jdbcTemplate.queryForBeans("select * from fc_member_film_show where film_id = ?", Fc_member_film_show.class, member_film_id);
}
@Override
public void doApply(Integer member_id, Long member_film_id) {
int count = jdbcTemplate.executeUpdate("update fc_member_film set state = 2, apply_state = 1 where id = ? and member_id = ? and state = 1", member_film_id, member_id);
if(count == 0) {
throw new XRException("该片当前状态不能提交申报");
}
}
@Override
@Transactional
public Long saveMemberFilmType(
Integer member_id,
String film_type_name,
String enroll_type_name) {
Integer film_group_id = 0;
Integer state = 1;
Integer is_show = 1;
Integer apply_state = 1;
Integer is_check_director = 0;
Long create_time = System.currentTimeMillis()/1000;
Long last_modify_time = create_time;
String create_ip = ServletUtil.remoteIp(WebMvcConfig.getRequest());
String sql = ""
+ "insert into fc_member_film "
+ "("
+ "member_id, "
+ "film_type_name, "
+ "enroll_type_name, "
+ "film_group_id, "
+ "state, "
+ "is_show, "
+ "apply_state, "
+ "is_check_director, "
+ "create_time, "
+ "create_ip, "
+ "last_modify_time"
+ ") "
+ "values "
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
Object[] args = new Object[]{
member_id,
film_type_name,
enroll_type_name,
film_group_id,
state,
is_show,
apply_state,
is_check_director,
create_time,
create_ip,
last_modify_time};
KeyHolder keyHolder = new GeneratedKeyHolder();
jdbcTemplate.update(new PreparedStatementCreator() {
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement ps = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
for(int i = 0; i <args.length; i++) {
Object argObj = args[i];
if(argObj instanceof java.util.Date) {
java.util.Date argDate = (java.util.Date)argObj;
ps.setObject(i+1, new java.sql.Timestamp(argDate.getTime()));
} else if(argObj.getClass().isEnum()) {
ps.setObject(i+1, args[i].toString());
} else {
ps.setObject(i+1, args[i]);
}
}
return ps;
}
}, keyHolder);
Long film_id = keyHolder.getKey().longValue();
this.updateEnroll(film_id);
return keyHolder.getKey().longValue();
}
@Override
@Transactional
public void saveMemberFilmBase(
Integer member_id,
Long member_film_id,
String[] enroll_type_name_other,
String cn_name,
String en_name,
String intro) {
Long last_modify_time = System.currentTimeMillis()/1000;
String sql = "update fc_member_film set enroll_type_name_other = ?, cn_name = ?, en_name = ?, intro = ?, last_modify_time = ? where member_id = ? and id = ?";
String string = StringUtil.join(",", "", "", "", enroll_type_name_other);
Object[] args = new Object[]{string, cn_name, en_name, intro, last_modify_time, member_id, member_film_id};
this.updateEnroll(member_film_id);
jdbcTemplate.executeUpdate(sql, args);
}
@Override
public void saveMemberFilmInfo(
Integer member_id,
Long member_film_id,
String film_country,
String dialogue_lang,
String subtitle_lang,
String[] co_production_country,
String film_total_time,
String completion_date,
String show_date,
String first_show_date,
String first_show_city,
Integer is_apply_other_filmfest,
String other_filmfest_name,
String film_medium,
String film_format,
String film_format_url,
String film_format_passw,
String film_format_other) {
Long last_modify_time = System.currentTimeMillis()/1000;
String sql = ""
+ "update "
+ "fc_member_film "
+ "set "
+ "film_country = ?, "
+ "dialogue_lang = ?, "
+ "subtitle_lang = ?, "
+ "co_production_country = ?, "
+ "film_total_time = ?, "
+ "completion_date = ?, "
+ "show_date = ?, "
+ "first_show_date = ?, "
+ "first_show_city = ?, "
+ "is_apply_other_filmfest = ?, "
+ "other_filmfest_name = ?, "
+ "film_medium = ?, "
+ "film_format = ?, "
+ "film_format_url = ?, "
+ "film_format_passw = ?, "
+ "film_format_other = ?, "
+ "last_modify_time = ? "
+ "where "
+ "member_id = ? "
+ "and id = ?";
String str = StringUtil.join(",", "", "", "", co_production_country);
Object[] args = new Object[]{
film_country,
dialogue_lang,
subtitle_lang,
str,
film_total_time,
completion_date,
show_date,
first_show_date,
first_show_city,
is_apply_other_filmfest,
other_filmfest_name,
film_medium,
film_format,
film_format_url,
film_format_passw,
film_format_other,
last_modify_time,
member_id,
member_film_id};
jdbcTemplate.executeUpdate(sql, args);
}
@Override
@Transactional
public void saveMemberFilmPlayactor(
Long member_film_id,
String[] playactor_type,
String[] playactor_role_name,
String[] playactor_name,
String[] playactor_film_nums,
String[] playactor_country,
String[] playactor_birthday,
String[] playactor_intro,
Integer[] is_play_shanghai) {
Long create_time = System.currentTimeMillis()/1000;
List<Object[]> playactors = new ArrayList<Object[]>();
for(int i = 0; i < playactor_type.length; i++) {
playactors.add(new Object[]{
member_film_id,
playactor_name[i],
playactor_film_nums[i],
playactor_intro[i],
playactor_country[i],
playactor_birthday[i],
create_time,
playactor_type[i],
playactor_role_name[i]});
}
jdbcTemplate.executeUpdate("delete from fc_member_film_playactor where film_id = ?", member_film_id);
String sql_playactor = ""
+ "insert into fc_member_film_playactor("
+ "film_id, "
+ "playactor_name, "
+ "playactor_film_nums, "
+ "playactor_film_intro, "
+ "playactor_country, "
+ "playactor_birthday, "
+ "create_time, "
+ "playactor_type, "
+ "playactor_role_name)"
+ "values "
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.batchUpdate(sql_playactor, playactors);
}
@Override
@Transactional
public void saveMemberFilmIssuer(
Long member_film_id,
String[] issuer_company,
String[] issuer_contacts,
String[] issuer_email,
String[] issuer_tel) {
if(issuer_company.length == issuer_contacts.length &&
issuer_contacts.length == issuer_email.length &&
issuer_email.length == issuer_tel.length) {
Long create_time = System.currentTimeMillis()/1000;
Object[][] args = new Object[issuer_company.length][];
for(int i = 0; i < issuer_company.length; i++) {
args[i] = new Object[]{member_film_id, issuer_company[i], issuer_contacts[i], issuer_email[i], issuer_tel[i], create_time};
}
jdbcTemplate.executeUpdate("delete from fc_member_film_issuer where film_id = ?", member_film_id);
String sql = ""
+ "insert into fc_member_film_issuer ("
+ "film_id, "
+ "issuer_company, "
+ "issuer_contacts, "
+ "issuer_email, "
+ "issuer_tel, "
+ "create_time) "
+ "values "
+ "(?, ?, ?, ?, ?, ?);";
jdbcTemplate.batchUpdate(sql, args);
} else {
throw new XException(messages.get("err.args_nums"));
}
}
@Override
@Transactional
public void saveMemberFilmShow(
Long member_film_id,
String play_shanghai,
String[] show_filmfest,
String[] show_filmfest_type,
String[] show_filmfest_intro) {
if(show_filmfest.length == show_filmfest_type.length && show_filmfest_type.length == show_filmfest_intro.length) {
Long create_time = System.currentTimeMillis()/1000;
Object[][] args = new Object[show_filmfest.length][];
for(int i = 0; i < show_filmfest.length; i++) {
args[i] = new Object[]{member_film_id, show_filmfest[i], show_filmfest_type[i], show_filmfest_intro[i], create_time};
}
Long last_modify_time = System.currentTimeMillis()/1000;
jdbcTemplate.executeUpdate("update fc_member_film set play_shanghai = ?, last_modify_time = ? where id = ?", play_shanghai, last_modify_time, member_film_id);
jdbcTemplate.executeUpdate("delete from fc_member_film_show where film_id = ?", member_film_id);
String sql = "insert into fc_member_film_show (film_id, show_filmfest, show_filmfest_type, show_filmfest_intro, create_time) values (?, ?, ?, ?, ?);";
jdbcTemplate.batchUpdate(sql, args);
} else {
throw new XException(messages.get("err.args_nums"));
}
}
@Override
public void saveMemberFilmCompany(
Integer member_id,
Long member_film_id,
String film_apply_company,
String film_apply_realname,
String film_apply_email,
String film_apply_tel,
String film_apply_mobile,
String film_apply_country) {
Long last_modify_time = System.currentTimeMillis()/1000;
String sql = ""
+ "update "
+ "fc_member_film "
+ "set "
+ "film_apply_company = ?, "
+ "film_apply_realname = ?, "
+ "film_apply_email = ?, "
+ "film_apply_tel = ?, "
+ "film_apply_mobile = ?, "
+ "film_apply_country = ?,"
+ "last_modify_time = ? "
+ "where "
+ "member_id = ? "
+ "and id = ?";
Object[] args = new Object[]{
film_apply_company,
film_apply_realname,
film_apply_email,
film_apply_tel,
film_apply_mobile,
film_apply_country,
last_modify_time,
member_id,
member_film_id};
jdbcTemplate.executeUpdate(sql, args);
}
@Override
public Fc_member_film queryMemberFilmById(Long id) {
return jdbcTemplate.queryForBean("select * from fc_member_film where id = ?", Fc_member_film.class, id);
}
@Override
public List<Map<String, Object>> queryListAll(String keyword) {
if(StringUtil.isBlank(keyword)) {
String sql = "select * from fc_member_film";
return jdbcTemplate.queryForList(sql);
} else {
String sql = "select * from fc_member_film where en_name like ? or cn_name like ?";
return jdbcTemplate.queryForList(sql, "%" + keyword + "%", "%" + keyword + "%");
}
}
@Override
public List<Map<String, Object>> queryFilmList(
Integer admin_group_id,
String keyword,
Integer state,
Integer apply_state,
Integer upload_state,
Integer film_type,
Integer enroll_type_id,
String film_country,
Integer film_type_short,
String play_shanghai,
Integer review_round,
Integer review_state,
Integer allot_atate,
Integer opt_state,
Integer[] film_type_id,
Page page) {
SqlWhere where = new SqlWhere()
.where("mf.film_type_name = agf.film_type_id and agf.group_id = ?", admin_group_id)
.eq("mf.state", state)
.eq("mf.apply_state", apply_state)
.eq("mf.upload_state", upload_state)
.eq("mf.film_type_name", film_type)
.eq("mf.film_type_name_short", film_type_short)
.eq("mf.film_country", film_country)
.eq("mf.play_shanghai", play_shanghai)
.in("mf.film_type_id", film_type_id)
.lk("mf.keywords", keyword)
;
String sql_film = "fc_member_film";
if(StringUtil.isNotBlank(enroll_type_id)) {
sql_film = "(select mf0.* from fc_member_film mf0, fc_member_film_enroll mfe where mf0.id = mfe.film_id and mfe.enroll_type_id = " + enroll_type_id + ")";
}
String sql = ""
+ "select "
+ "mf.*, "
+ "fg.group_name, "
+ "r.review_round, "
+ "r.review_state, "
+ "r.allot_state, "
+ "r.opt_state, "
+ "m.username member_name, "
+ "a.realname admin_name "
+ "from " + sql_film + " mf "
+ "left join fc_review r on r.film_id = mf.id "
+ "left join fc_film_group fg on fg.id = mf.film_group_id "
+ "left join fc_member m on m.id = mf.member_id "
+ "left join fc_admin a on a.adminid = mf.admin_creator"
+ ", fc_admin_group_filmtype agf"
+ StringUtil.join(" and ", " where ", " ", " ", where.getStringList());
List<Object> objs = new ArrayList<Object>();
objs.addAll(where.getObjectList());
SqlWhere where2 = new SqlWhere()
.eq("t.review_round", review_round)
.eq("t.review_state", review_state)
.eq("t.allot_atate", allot_atate)
.eq("t.opt_state", opt_state)
;
sql = "select t.* from (" + sql + ") t" + StringUtil.join(" and ", " where ", " ", " ", where2.getStringList()) + " order by t.id desc";
objs.addAll(where2.getObjectList());
return jdbcTemplate.limit(sql, page, objs.toArray());
}
@Override
public synchronized Integer pass(Long member_film_id) {
this.updateEnroll(member_film_id);
Integer film_no = jdbcTemplate.queryForInt("select ifnull(max(film_no), 0) + 1 from fc_member_film");
String sql = "update fc_member_film set film_no = ?, apply_state = 2, upload_state = 0, pass_time = ? where id = ? and (film_no is null or film_no = '')";
jdbcTemplate.executeUpdate(sql, film_no, System.currentTimeMillis()/1000L, member_film_id);
return film_no;
}
@Override
public void reject(Boolean is_stop_apply, Long member_film_id, String apply_state_intro) {
if(is_stop_apply) {
String sql = "update fc_member_film set pass_time = ?, apply_state = 3, apply_state_intro = ? where id = ?";
jdbcTemplate.executeUpdate(sql, System.currentTimeMillis()/1000L, apply_state_intro, member_film_id);
} else {
String sql = "update fc_member_film set pass_time = ?, apply_state = 1, apply_state_intro = ?, state = 1 where id = ?";
jdbcTemplate.executeUpdate(sql, System.currentTimeMillis()/1000L, apply_state_intro, member_film_id);
}
}
@Override
public List<Enum_enroll> queryEnrollList() {
return jdbcTemplate.queryForBeansByField(Enum_enroll.class, new HashMap<String,Object>());
}
@Override
public List<Enum_filmtype> queryTypeList() {
return jdbcTemplate.queryForBeansByField(Enum_filmtype.class, new HashMap<String,Object>());
}
@Override
public void mergeMemberFilm(Fc_member_film film) {
jdbcTemplate.merge(film);
}
@Override
@Transactional
public void updateFilmBase(Fc_member_film_base_model filmBase) {
jdbcTemplate.saveOrUpdate(filmBase);
this.updateEnroll(filmBase.getId());
}
@Override
@Transactional
public void updateEnroll(Long member_film_id) {
Fc_member_film film = jdbcTemplate.queryForBean("select enroll_type_name, enroll_type_name_other from fc_member_film where id = ?", Fc_member_film.class, member_film_id);
String enroll_type_name = film.getEnroll_type_name();
List<Fc_member_film_enroll> enrolls = new ArrayList<Fc_member_film_enroll>();
if(enroll_type_name != null) {
String[] strs = enroll_type_name.split(",");
if(strs != null && strs.length > 0) {
for(String str : strs) {
if(str != null && str.matches("\\d+")) {
Fc_member_film_enroll enroll = new Fc_member_film_enroll();
enroll.setEnroll_type_id(Integer.valueOf(str));
enroll.setFilm_id(member_film_id.intValue());
enrolls.add(enroll);
}
}
}
}
jdbcTemplate.executeUpdate("delete from fc_member_film_enroll where film_id = ?", member_film_id);
if(enrolls.size() > 0) {
jdbcTemplate.batchSave(enrolls);
}
}
@Override
public void saveUploadId(Long member_film_id, String upload_id) {
jdbcTemplate.executeUpdate("update fc_member_film set upload_id = ?, upload_time = ? where id = ?", upload_id, new Date(), member_film_id);
}
@Override
public void saveUploadState(Long member_film_id, Integer upload_state) {
jdbcTemplate.executeUpdate("update fc_member_film set upload_state = ? where id = ?", upload_state, member_film_id);
}
@Override
public List<Fc_member_film_enroll> queryFilmEnrollList(Long member_film_id) {
return jdbcTemplate.queryForBeans("select * from fc_member_film_enroll where film_id = ?", Fc_member_film_enroll.class, member_film_id.intValue());
}
@Override
public void verifyFilmDuplicate(Long filmId) {
String sql0 = ""
+ "select "
+ "f.* "
+ "from "
+ "fc_member_film f, "
+ "fc_member_film f2 "
+ "where "
+ "f.apply_state = 2 "
+ "and (f.en_name = f2.en_name or (f.en_name is null and f2.en_name is null)) "
+ "and (f.cn_name = f2.cn_name or (f.cn_name is null and f2.cn_name is null)) "
+ "and f2.id = ? "
+ "and f.id != ?";
List<Fc_member_film> list = jdbcTemplate.queryForBeans(sql0, Fc_member_film.class, filmId, filmId);
String sql = "select playactor_name from fc_member_film_playactor where playactor_type = 'director' and film_id = ?";
List<String> directorList = jdbcTemplate.queryForObjects(sql, String.class, filmId);
for(Fc_member_film film : list) {
List<String> directorListTmp = jdbcTemplate.queryForObjects(sql, String.class, film.getId());
if(directorList.size() == directorListTmp.size()) {
directorList.removeAll(directorListTmp);
if(directorList.size() == 0) {
Long passtime = film.getPass_time();
if(passtime == null) {
passtime = film.getLast_modify_time();
}
String no = StringUtil.formatLength(film.getFilm_no(), "0000");
String str = "通过";
if(film.getApply_state().intValue() == 3) {
str = "否决";
}
int state = film.getApply_state().intValue();
throw new XRException("该片名已经在" + DateUtil.format(new Date(passtime*1000), "yyyy年MM月dd日HH") + "时被管理员" + str + (state == 2 ? ",通过的影片ID号为" + no : ""));
}
}
}
}
@Override
public void updateFilmState(Long member_film_id, Integer state) {
jdbcTemplate.executeUpdate("update fc_member_film set state = ? where id = ?", state, member_film_id);
}
@Override
public void saveCreateBase(Long id, Integer admin_id, Integer member_id, String create_ip) {
Long now = System.currentTimeMillis()/1000;
jdbcTemplate.executeUpdate("update fc_member_film set admin_creator = ?, member_id = ?, create_ip = ?, create_time = ?, last_modify_time = ? where id = ?", admin_id, member_id, create_ip, now, now, id);
}
@Override
@Transactional
public void exchangeFilmNo(Integer id1, Integer id2) {
Fc_member_film f1 = jdbcTemplate.queryForBean("select id, film_no from fc_member_film where id = ?", Fc_member_film.class, id1);
Fc_member_film f2 = jdbcTemplate.queryForBean("select id, film_no from fc_member_film where id = ?", Fc_member_film.class, id2);
jdbcTemplate.batchUpdate("update fc_member_film set film_no = ? where id = ?", new Object[][]{ {f1.getFilm_no(), id2}, {f2.getFilm_no(), id1}});
jdbcTemplate.batchUpdate("update fc_member_film set state = 2, apply_state = ? where id = ?", new Object[][] {{1, id1}, {3, id2}});
jdbcTemplate.batchUpdate("delete from fc_review_record_ext where record_id in (select id from fc_review_record where review_id in (select id from fc_review where film_id = ?))", new Object[][]{{id1}, {id2}});
jdbcTemplate.batchUpdate("delete from fc_review_record where review_id in (select id from fc_review where film_id = ?)", new Object[][]{{id1}, {id2}});
jdbcTemplate.batchUpdate("delete from fc_review_history where review_id in (select id from fc_review where film_id = ?)", new Object[][]{{id1}, {id2}});
jdbcTemplate.batchUpdate("delete from fc_review where id = ?", new Object[][]{{id1}, {id2}});
}
@Override
public void initKeywords(Long member_film_id) {
Fc_member_film film = this.queryMemberFilmById(member_film_id);
List<Fc_member_film_playactor> playactors = this.queryMemberFilmPlayactorList(member_film_id);
List<String> strs = new ArrayList<String>();
for(Fc_member_film_playactor playactor : playactors) {
if(playactor.getPlayactor_type() != null && playactor.getPlayactor_type().equals("director")) {
strs.add(playactor.getPlayactor_name());
}
}
String directors = StringUtil.join(", ", strs);
if(film.getFilm_no() != null) {
strs.add(StringUtil.formatLength(film.getFilm_no(), "0000"));
}
if(StringUtil.isNotBlank(film.getEn_name())) {
strs.add(film.getEn_name());
}
if(StringUtil.isNotBlank(film.getCn_name())) {
strs.add(film.getCn_name());
}
String keywords = StringUtil.join(", ", strs);
jdbcTemplate.executeUpdate("update fc_member_film set director_name = ?, keywords = ? where id = ?", directors, keywords, member_film_id);
}
}
package com.egolm.film.api.service.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.common.web.ServletUtil;
import com.egolm.film.api.service.FilmService;
import com.egolm.film.api.service.Messages;
import com.egolm.film.bean.Enum_enroll;
import com.egolm.film.bean.Enum_filmtype;
import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.bean.Fc_member_film_enroll;
import com.egolm.film.bean.Fc_member_film_issuer;
import com.egolm.film.bean.Fc_member_film_playactor;
import com.egolm.film.bean.Fc_member_film_show;
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.SqlWhere;
@Service
public class FilmServiceImpl implements FilmService {
@Autowired
private Messages messages;
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public List<Fc_member_film_issuer> queryMemberFilmIssuerList(Long member_film_id) {
return jdbcTemplate.queryForBeans("select * from fc_member_film_issuer where film_id = ?", Fc_member_film_issuer.class, member_film_id);
}
@Override
public List<Fc_member_film_playactor> queryMemberFilmPlayactorList(Long member_film_id) {
return jdbcTemplate.queryForBeans("select * from fc_member_film_playactor where film_id = ?", Fc_member_film_playactor.class, member_film_id);
}
@Override
public List<Fc_member_film_show> queryMemberFilmShowList(Long member_film_id) {
return jdbcTemplate.queryForBeans("select * from fc_member_film_show where film_id = ?", Fc_member_film_show.class, member_film_id);
}
@Override
public void doApply(Integer member_id, Long member_film_id) {
int count = jdbcTemplate.executeUpdate("update fc_member_film set state = 2, apply_state = 1 where id = ? and member_id = ? and state = 1", member_film_id, member_id);
if(count == 0) {
throw new XRException("该片当前状态不能提交申报");
}
}
@Override
@Transactional
public Long saveMemberFilmType(
Integer member_id,
String film_type_name,
String enroll_type_name) {
Integer film_group_id = 0;
Integer state = 1;
Integer is_show = 1;
Integer apply_state = 1;
Integer is_check_director = 0;
Long create_time = System.currentTimeMillis()/1000;
Long last_modify_time = create_time;
String create_ip = ServletUtil.remoteIp(WebMvcConfig.getRequest());
String sql = ""
+ "insert into fc_member_film "
+ "("
+ "member_id, "
+ "film_type_name, "
+ "enroll_type_name, "
+ "film_group_id, "
+ "state, "
+ "is_show, "
+ "apply_state, "
+ "is_check_director, "
+ "create_time, "
+ "create_ip, "
+ "last_modify_time"
+ ") "
+ "values "
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
Object[] args = new Object[]{
member_id,
film_type_name,
enroll_type_name,
film_group_id,
state,
is_show,
apply_state,
is_check_director,
create_time,
create_ip,
last_modify_time};
KeyHolder keyHolder = new GeneratedKeyHolder();
jdbcTemplate.update(new PreparedStatementCreator() {
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement ps = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
for(int i = 0; i <args.length; i++) {
Object argObj = args[i];
if(argObj instanceof java.util.Date) {
java.util.Date argDate = (java.util.Date)argObj;
ps.setObject(i+1, new java.sql.Timestamp(argDate.getTime()));
} else if(argObj.getClass().isEnum()) {
ps.setObject(i+1, args[i].toString());
} else {
ps.setObject(i+1, args[i]);
}
}
return ps;
}
}, keyHolder);
Long film_id = keyHolder.getKey().longValue();
this.updateEnroll(film_id);
return keyHolder.getKey().longValue();
}
@Override
@Transactional
public void saveMemberFilmBase(
Integer member_id,
Long member_film_id,
String[] enroll_type_name_other,
String cn_name,
String en_name,
String intro) {
Long last_modify_time = System.currentTimeMillis()/1000;
String sql = "update fc_member_film set enroll_type_name_other = ?, cn_name = ?, en_name = ?, intro = ?, last_modify_time = ? where member_id = ? and id = ?";
String string = StringUtil.join(",", "", "", "", enroll_type_name_other);
Object[] args = new Object[]{string, cn_name, en_name, intro, last_modify_time, member_id, member_film_id};
this.updateEnroll(member_film_id);
jdbcTemplate.executeUpdate(sql, args);
}
@Override
public void saveMemberFilmInfo(
Integer member_id,
Long member_film_id,
String film_country,
String dialogue_lang,
String subtitle_lang,
String[] co_production_country,
String film_total_time,
String completion_date,
String show_date,
String first_show_date,
String first_show_city,
Integer is_apply_other_filmfest,
String other_filmfest_name,
String film_medium,
String film_format,
String film_format_url,
String film_format_passw,
String film_format_other) {
Long last_modify_time = System.currentTimeMillis()/1000;
String sql = ""
+ "update "
+ "fc_member_film "
+ "set "
+ "film_country = ?, "
+ "dialogue_lang = ?, "
+ "subtitle_lang = ?, "
+ "co_production_country = ?, "
+ "film_total_time = ?, "
+ "completion_date = ?, "
+ "show_date = ?, "
+ "first_show_date = ?, "
+ "first_show_city = ?, "
+ "is_apply_other_filmfest = ?, "
+ "other_filmfest_name = ?, "
+ "film_medium = ?, "
+ "film_format = ?, "
+ "film_format_url = ?, "
+ "film_format_passw = ?, "
+ "film_format_other = ?, "
+ "last_modify_time = ? "
+ "where "
+ "member_id = ? "
+ "and id = ?";
String str = StringUtil.join(",", "", "", "", co_production_country);
Object[] args = new Object[]{
film_country,
dialogue_lang,
subtitle_lang,
str,
film_total_time,
completion_date,
show_date,
first_show_date,
first_show_city,
is_apply_other_filmfest,
other_filmfest_name,
film_medium,
film_format,
film_format_url,
film_format_passw,
film_format_other,
last_modify_time,
member_id,
member_film_id};
jdbcTemplate.executeUpdate(sql, args);
}
@Override
@Transactional
public void saveMemberFilmPlayactor(
Long member_film_id,
String[] playactor_type,
String[] playactor_role_name,
String[] playactor_name,
String[] playactor_film_nums,
String[] playactor_country,
String[] playactor_birthday,
String[] playactor_intro,
Integer[] is_play_shanghai) {
Long create_time = System.currentTimeMillis()/1000;
List<Object[]> playactors = new ArrayList<Object[]>();
for(int i = 0; i < playactor_type.length; i++) {
playactors.add(new Object[]{
member_film_id,
playactor_name[i],
playactor_film_nums[i],
playactor_intro[i],
playactor_country[i],
playactor_birthday[i],
create_time,
playactor_type[i],
playactor_role_name[i]});
}
jdbcTemplate.executeUpdate("delete from fc_member_film_playactor where film_id = ?", member_film_id);
String sql_playactor = ""
+ "insert into fc_member_film_playactor("
+ "film_id, "
+ "playactor_name, "
+ "playactor_film_nums, "
+ "playactor_film_intro, "
+ "playactor_country, "
+ "playactor_birthday, "
+ "create_time, "
+ "playactor_type, "
+ "playactor_role_name)"
+ "values "
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.batchUpdate(sql_playactor, playactors);
}
@Override
@Transactional
public void saveMemberFilmIssuer(
Long member_film_id,
String[] issuer_company,
String[] issuer_contacts,
String[] issuer_email,
String[] issuer_tel) {
if(issuer_company.length == issuer_contacts.length &&
issuer_contacts.length == issuer_email.length &&
issuer_email.length == issuer_tel.length) {
Long create_time = System.currentTimeMillis()/1000;
Object[][] args = new Object[issuer_company.length][];
for(int i = 0; i < issuer_company.length; i++) {
args[i] = new Object[]{member_film_id, issuer_company[i], issuer_contacts[i], issuer_email[i], issuer_tel[i], create_time};
}
jdbcTemplate.executeUpdate("delete from fc_member_film_issuer where film_id = ?", member_film_id);
String sql = ""
+ "insert into fc_member_film_issuer ("
+ "film_id, "
+ "issuer_company, "
+ "issuer_contacts, "
+ "issuer_email, "
+ "issuer_tel, "
+ "create_time) "
+ "values "
+ "(?, ?, ?, ?, ?, ?);";
jdbcTemplate.batchUpdate(sql, args);
} else {
throw new XException(messages.get("err.args_nums"));
}
}
@Override
@Transactional
public void saveMemberFilmShow(
Long member_film_id,
String play_shanghai,
String[] show_filmfest,
String[] show_filmfest_type,
String[] show_filmfest_intro) {
if(show_filmfest.length == show_filmfest_type.length && show_filmfest_type.length == show_filmfest_intro.length) {
Long create_time = System.currentTimeMillis()/1000;
Object[][] args = new Object[show_filmfest.length][];
for(int i = 0; i < show_filmfest.length; i++) {
args[i] = new Object[]{member_film_id, show_filmfest[i], show_filmfest_type[i], show_filmfest_intro[i], create_time};
}
Long last_modify_time = System.currentTimeMillis()/1000;
jdbcTemplate.executeUpdate("update fc_member_film set play_shanghai = ?, last_modify_time = ? where id = ?", play_shanghai, last_modify_time, member_film_id);
jdbcTemplate.executeUpdate("delete from fc_member_film_show where film_id = ?", member_film_id);
String sql = "insert into fc_member_film_show (film_id, show_filmfest, show_filmfest_type, show_filmfest_intro, create_time) values (?, ?, ?, ?, ?);";
jdbcTemplate.batchUpdate(sql, args);
} else {
throw new XException(messages.get("err.args_nums"));
}
}
@Override
public void saveMemberFilmCompany(
Integer member_id,
Long member_film_id,
String film_apply_company,
String film_apply_realname,
String film_apply_email,
String film_apply_tel,
String film_apply_mobile,
String film_apply_country) {
Long last_modify_time = System.currentTimeMillis()/1000;
String sql = ""
+ "update "
+ "fc_member_film "
+ "set "
+ "film_apply_company = ?, "
+ "film_apply_realname = ?, "
+ "film_apply_email = ?, "
+ "film_apply_tel = ?, "
+ "film_apply_mobile = ?, "
+ "film_apply_country = ?,"
+ "last_modify_time = ? "
+ "where "
+ "member_id = ? "
+ "and id = ?";
Object[] args = new Object[]{
film_apply_company,
film_apply_realname,
film_apply_email,
film_apply_tel,
film_apply_mobile,
film_apply_country,
last_modify_time,
member_id,
member_film_id};
jdbcTemplate.executeUpdate(sql, args);
}
@Override
public Fc_member_film queryMemberFilmById(Long id) {
return jdbcTemplate.queryForBean("select * from fc_member_film where id = ?", Fc_member_film.class, id);
}
@Override
public List<Map<String, Object>> queryListAll(String keyword) {
if(StringUtil.isBlank(keyword)) {
String sql = "select * from fc_member_film";
return jdbcTemplate.queryForList(sql);
} else {
String sql = "select * from fc_member_film where en_name like ? or cn_name like ?";
return jdbcTemplate.queryForList(sql, "%" + keyword + "%", "%" + keyword + "%");
}
}
@Override
public List<Map<String, Object>> queryFilmList(
Integer admin_group_id,
String keyword,
Integer state,
Integer apply_state,
Integer upload_state,
Integer film_type,
Integer enroll_type_id,
String film_country,
Integer film_type_short,
String play_shanghai,
Integer review_round,
Integer review_state,
Integer allot_atate,
Integer opt_state,
Integer[] film_type_id,
Page page) {
SqlWhere where = new SqlWhere()
.where("mf.film_type_name = agf.film_type_id and agf.group_id = ?", admin_group_id)
.eq("mf.state", state)
.eq("mf.apply_state", apply_state)
.eq("mf.upload_state", upload_state)
.eq("mf.film_type_name", film_type)
.eq("mf.film_type_name_short", film_type_short)
.eq("mf.film_country", film_country)
.eq("mf.play_shanghai", play_shanghai)
.in("mf.film_type_id", film_type_id)
.lk("mf.keywords", keyword)
;
String sql_film = "fc_member_film";
if(StringUtil.isNotBlank(enroll_type_id)) {
sql_film = "(select mf0.* from fc_member_film mf0, fc_member_film_enroll mfe where mf0.id = mfe.film_id and mfe.enroll_type_id = " + enroll_type_id + ")";
}
String sql = ""
+ "select "
+ "mf.*, "
+ "fg.group_name, "
+ "r.review_round, "
+ "r.review_state, "
+ "r.allot_state, "
+ "r.opt_state, "
+ "m.username member_name, "
+ "a.realname admin_name "
+ "from " + sql_film + " mf "
+ "left join fc_review r on r.film_id = mf.id "
+ "left join fc_film_group fg on fg.id = mf.film_group_id "
+ "left join fc_member m on m.id = mf.member_id "
+ "left join fc_admin a on a.adminid = mf.admin_creator"
+ ", fc_admin_group_filmtype agf"
+ StringUtil.join(" and ", " where ", " ", " ", where.getStringList());
List<Object> objs = new ArrayList<Object>();
objs.addAll(where.getObjectList());
SqlWhere where2 = new SqlWhere()
.eq("t.review_round", review_round)
.eq("t.review_state", review_state)
.eq("t.allot_atate", allot_atate)
.eq("t.opt_state", opt_state)
;
sql = "select t.* from (" + sql + ") t" + StringUtil.join(" and ", " where ", " ", " ", where2.getStringList()) + " order by t.id desc";
objs.addAll(where2.getObjectList());
return jdbcTemplate.limit(sql, page, objs.toArray());
}
@Override
public synchronized Integer pass(Long member_film_id) {
this.updateEnroll(member_film_id);
Integer film_no = jdbcTemplate.queryForInt("select ifnull(max(film_no), 0) + 1 from fc_member_film");
String sql = "update fc_member_film set film_no = ?, apply_state = 2, upload_state = 0, pass_time = ? where id = ? and (film_no is null or film_no = '')";
jdbcTemplate.executeUpdate(sql, film_no, System.currentTimeMillis()/1000L, member_film_id);
return film_no;
}
@Override
public void reject(Boolean is_stop_apply, Long member_film_id, String apply_state_intro) {
if(is_stop_apply) {
String sql = "update fc_member_film set pass_time = ?, apply_state = 3, apply_state_intro = ? where id = ?";
jdbcTemplate.executeUpdate(sql, System.currentTimeMillis()/1000L, apply_state_intro, member_film_id);
} else {
String sql = "update fc_member_film set pass_time = ?, apply_state = 1, apply_state_intro = ?, state = 1 where id = ?";
jdbcTemplate.executeUpdate(sql, System.currentTimeMillis()/1000L, apply_state_intro, member_film_id);
}
}
@Override
public List<Enum_enroll> queryEnrollList() {
return jdbcTemplate.queryForBeansByField(Enum_enroll.class, new HashMap<String,Object>());
}
@Override
public List<Enum_filmtype> queryTypeList() {
return jdbcTemplate.queryForBeansByField(Enum_filmtype.class, new HashMap<String,Object>());
}
@Override
public void mergeMemberFilm(Fc_member_film film) {
jdbcTemplate.merge(film);
}
@Override
@Transactional
public void updateFilmBase(Fc_member_film_base_model filmBase) {
jdbcTemplate.saveOrUpdate(filmBase);
this.updateEnroll(filmBase.getId());
}
@Override
@Transactional
public void updateEnroll(Long member_film_id) {
Fc_member_film film = jdbcTemplate.queryForBean("select enroll_type_name, enroll_type_name_other from fc_member_film where id = ?", Fc_member_film.class, member_film_id);
String enroll_type_name = film.getEnroll_type_name();
List<Fc_member_film_enroll> enrolls = new ArrayList<Fc_member_film_enroll>();
if(enroll_type_name != null) {
String[] strs = enroll_type_name.split(",");
if(strs != null && strs.length > 0) {
for(String str : strs) {
if(str != null && str.matches("\\d+")) {
Fc_member_film_enroll enroll = new Fc_member_film_enroll();
enroll.setEnroll_type_id(Integer.valueOf(str));
enroll.setFilm_id(member_film_id.intValue());
enrolls.add(enroll);
}
}
}
}
jdbcTemplate.executeUpdate("delete from fc_member_film_enroll where film_id = ?", member_film_id);
if(enrolls.size() > 0) {
jdbcTemplate.batchSave(enrolls);
}
}
@Override
public void saveUploadId(Long member_film_id, String upload_id) {
jdbcTemplate.executeUpdate("update fc_member_film set upload_id = ?, upload_time = ? where id = ?", upload_id, new Date(), member_film_id);
}
@Override
public void saveUploadState(Long member_film_id, Integer upload_state) {
jdbcTemplate.executeUpdate("update fc_member_film set upload_state = ? where id = ?", upload_state, member_film_id);
}
@Override
public List<Fc_member_film_enroll> queryFilmEnrollList(Long member_film_id) {
return jdbcTemplate.queryForBeans("select * from fc_member_film_enroll where film_id = ?", Fc_member_film_enroll.class, member_film_id.intValue());
}
@Override
public void verifyFilmDuplicate(Long filmId) {
String sql0 = ""
+ "select "
+ "f.* "
+ "from "
+ "fc_member_film f, "
+ "fc_member_film f2 "
+ "where "
+ "f.apply_state = 2 "
+ "and (f.en_name = f2.en_name or (f.en_name is null and f2.en_name is null)) "
+ "and (f.cn_name = f2.cn_name or (f.cn_name is null and f2.cn_name is null)) "
+ "and f2.id = ? "
+ "and f.id != ?";
List<Fc_member_film> list = jdbcTemplate.queryForBeans(sql0, Fc_member_film.class, filmId, filmId);
String sql = "select playactor_name from fc_member_film_playactor where playactor_type = 'director' and film_id = ?";
List<String> directorList = jdbcTemplate.queryForObjects(sql, String.class, filmId);
for(Fc_member_film film : list) {
List<String> directorListTmp = jdbcTemplate.queryForObjects(sql, String.class, film.getId());
if(directorList.size() == directorListTmp.size()) {
directorList.removeAll(directorListTmp);
if(directorList.size() == 0) {
Long passtime = film.getPass_time();
if(passtime == null) {
passtime = film.getLast_modify_time();
}
String no = StringUtil.formatLength(film.getFilm_no(), "0000");
String str = "通过";
if(film.getApply_state().intValue() == 3) {
str = "否决";
}
int state = film.getApply_state().intValue();
throw new XRException("该片名已经在" + DateUtil.format(new Date(passtime*1000), "yyyy年MM月dd日HH") + "时被管理员" + str + (state == 2 ? ",通过的影片ID号为" + no : ""));
}
}
}
}
@Override
public void updateFilmState(Long member_film_id, Integer state) {
jdbcTemplate.executeUpdate("update fc_member_film set state = ? where id = ?", state, member_film_id);
}
@Override
public void saveCreateBase(Long id, Integer admin_id, Integer member_id, String create_ip) {
Long now = System.currentTimeMillis()/1000;
jdbcTemplate.executeUpdate("update fc_member_film set admin_creator = ?, member_id = ?, create_ip = ?, create_time = ?, last_modify_time = ? where id = ?", admin_id, member_id, create_ip, now, now, id);
}
@Override
@Transactional
public void exchangeFilmNo(Integer id1, Integer id2) {
Fc_member_film f1 = jdbcTemplate.queryForBean("select id, film_no from fc_member_film where id = ?", Fc_member_film.class, id1);
Fc_member_film f2 = jdbcTemplate.queryForBean("select id, film_no from fc_member_film where id = ?", Fc_member_film.class, id2);
jdbcTemplate.batchUpdate("update fc_member_film set film_no = ? where id = ?", new Object[][]{ {f1.getFilm_no(), id2}, {f2.getFilm_no(), id1}});
jdbcTemplate.batchUpdate("update fc_member_film set state = 2, apply_state = ? where id = ?", new Object[][] {{1, id1}, {3, id2}});
jdbcTemplate.batchUpdate("delete from fc_review_record_ext where record_id in (select id from fc_review_record where review_id in (select id from fc_review where film_id = ?))", new Object[][]{{id1}, {id2}});
jdbcTemplate.batchUpdate("delete from fc_review_record where review_id in (select id from fc_review where film_id = ?)", new Object[][]{{id1}, {id2}});
jdbcTemplate.batchUpdate("delete from fc_review_history where review_id in (select id from fc_review where film_id = ?)", new Object[][]{{id1}, {id2}});
jdbcTemplate.batchUpdate("delete from fc_review where id = ?", new Object[][]{{id1}, {id2}});
}
@Override
public void initKeywords(Long member_film_id) {
Fc_member_film film = this.queryMemberFilmById(member_film_id);
List<Fc_member_film_playactor> playactors = this.queryMemberFilmPlayactorList(member_film_id);
List<String> strs = new ArrayList<String>();
for(Fc_member_film_playactor playactor : playactors) {
if(playactor.getPlayactor_type() != null && playactor.getPlayactor_type().equals("director")) {
strs.add(playactor.getPlayactor_name());
}
}
String directors = StringUtil.join(", ", strs);
if(film.getFilm_no() != null) {
strs.add(StringUtil.formatLength(film.getFilm_no(), "0000"));
}
if(StringUtil.isNotBlank(film.getEn_name())) {
strs.add(film.getEn_name());
}
if(StringUtil.isNotBlank(film.getCn_name())) {
strs.add(film.getCn_name());
}
String keywords = StringUtil.join(", ", strs);
jdbcTemplate.executeUpdate("update fc_member_film set director_name = ?, keywords = ? where id = ?", directors, keywords, member_film_id);
}
@Override
public List<Map<String, Object>> queryMonitorUploadList(String keyword,Integer upload_state, Page page) {
SqlWhere w = new SqlWhere().lk(new String[]{"file_name", "film_id"}, keyword).eq("upload_state", upload_state);
String sql = "select * from fc_film_upload "+ StringUtil.join(" and ", " where ", "", "", w.getStringList());;
return jdbcTemplate.limit(sql, page, w.getObjectArray());
}
/**
* 批量修改上传状态 为 未上传
* @Title: updateFilmUploadState
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param: @param film_id
* @param: @param number
* @return: void
* @throws
*/
@Override
public void updateFilmUploadState(String[] film_id,String[] number) {
if(film_id.length == number.length) {
List<Object[]> objs = new ArrayList<Object[]>();
for(int i = 0; i < film_id.length; i++) {
objs.add(new Object[]{
film_id[i],
number[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);
}
}
}
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
@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);
}
}
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
@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("upload_monitor")
@ApiOperation("影片上传监控列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="String", required=false, name="keyword", value="关键字"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="upload_state", value="上传状态( 0未上传, 1上传中, 2已上传)"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="index", value="分页编号"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="limit", value="分页大小"),
})
public Object upload_monitor(String keyword,Integer upload_state,Long index, Long limit) {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
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("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("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);
}
}
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