Commit 5adbdb9d authored by Quxl's avatar Quxl

Merge branch 'master' of

http://key@gitlab.egolm.com/hanxu/siff-film-api.git

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