Commit c130f8b5 authored by Quxl's avatar Quxl

xx

parent d906e074
package com.egolm.film.api.service;
import java.util.List;
import java.util.Map;
import com.egolm.common.jdbc.Page;
import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.bean.Fc_member_film_all;
import com.egolm.film.bean.Fc_member_film_director;
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;
public interface MemberFilmService {
List<Fc_member_film_director> queryMemberFilmDirectorList(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_show> queryMemberFilmShowList(Long member_film_id);
void doApply(
Integer member_id,
Long member_film_id);
void saveMore(Fc_member_film_all more);
Fc_member_film_all queryMoreByNo(String no);
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(
Integer member_id,
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(
Integer member_id,
Long member_film_id,
String[] issuer_company,
String[] issuer_contacts,
String[] issuer_email,
String[] issuer_tel);
void saveMemberFilmShow(
Integer member_id,
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>> queryChuShenList(String keyword, Integer state, Integer apply_state, String film_type, String enroll_type, String film_country, Page page);
void pass(Integer member_film_id);
void reject(Integer member_film_id);
Fc_member_film queryMemberFilmById(Long member_film_id);
}
......@@ -3,14 +3,7 @@ package com.egolm.film.api.service;
import java.util.List;
import java.util.Map;
import com.egolm.common.jdbc.Page;
import com.egolm.film.bean.Fc_member;
import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.bean.Fc_member_film_all;
import com.egolm.film.bean.Fc_member_film_director;
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;
public interface MemberService {
......@@ -36,107 +29,10 @@ public interface MemberService {
boolean exists(String email);
Fc_member_film queryMemberFilmById(Long id);
List<Fc_member_film_director> queryMemberFilmDirectorList(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_show> queryMemberFilmShowList(Long member_film_id);
void doApply(
Integer member_id,
Long member_film_id);
void saveMore(Fc_member_film_all more);
Fc_member_film_all queryMoreByNo(String no);
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(
Integer member_id,
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(
Integer member_id,
Long member_film_id,
String[] issuer_company,
String[] issuer_contacts,
String[] issuer_email,
String[] issuer_tel);
void saveMemberFilmShow(
Integer member_id,
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);
boolean changePasswordByMemberId(Integer member_id, String password, String newPassword);
Fc_member getMemberByToken(String token);
void updateToken(Integer member_id, String token_string);
List<Map<String, Object>> queryListAll(String keyword);
List<Map<String, Object>> queryChuShenList(String keyword, Integer state, Integer apply_state, String film_type, String enroll_type, String film_country, Page page);
void pass(Integer member_film_id);
void reject(Integer 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.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.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.MemberFilmService;
import com.egolm.film.api.service.Messages;
import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.bean.Fc_member_film_all;
import com.egolm.film.bean.Fc_member_film_director;
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.config.WebMvcConfig;
import com.egolm.film.config.XException;
import com.egolm.film.util.SqlWhere;
@Service
public class MemberFilmServiceImpl implements MemberFilmService {
@Autowired
private Messages messages;
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public List<Fc_member_film_director> queryMemberFilmDirectorList(Long member_film_id) {
return jdbcTemplate.queryForBeans("select * from fc_member_film_director where film_id = ?", Fc_member_film_director.class, member_film_id);
}
@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) {
jdbcTemplate.executeUpdate("update fc_member_film set state = ?, apply_state = ? where id = ? and member_id = ?", 2, 1, member_film_id, member_id);
}
@Override
public void saveMore(Fc_member_film_all more) {
if(more.getId() == null) {
jdbcTemplate.save(more);
} else {
jdbcTemplate.update(more);
}
}
@Override
public Fc_member_film_all queryMoreByNo(String film_no) {
return jdbcTemplate.queryForBean("select * from fc_member_film_all where film_no = ?", Fc_member_film_all.class, film_no);
}
@Override
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);
return keyHolder.getKey().longValue();
}
@Override
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 str = StringUtil.join(",", "", "", "", enroll_type_name_other);
Object[] args = new Object[]{str, cn_name, en_name, intro, last_modify_time, member_id, 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(
Integer member_id,
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) {
if(playactor_type.length == playactor_role_name.length &&
playactor_role_name.length == playactor_name.length &&
playactor_name.length == playactor_film_nums.length &&
playactor_film_nums.length == playactor_country.length &&
playactor_country.length == playactor_birthday.length &&
playactor_birthday.length == playactor_intro.length &&
playactor_intro.length == is_play_shanghai.length) {
Long create_time = System.currentTimeMillis()/1000;
List<Object[]> playactors = new ArrayList<Object[]>();
List<Object[]> directors = new ArrayList<Object[]>();
for(int i = 0; i < playactor_type.length; i++) {
if(!playactor_type[i].equals("0")) {
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]});
} else {
directors.add(new Object[] {
member_film_id,
playactor_name[i],
playactor_film_nums[i],
playactor_intro[i],
playactor_country[i],
playactor_birthday[i],
create_time,
is_play_shanghai[i]});
}
}
jdbcTemplate.executeUpdate("delete from fc_member_film_playactor where film_id = ?", member_film_id);
jdbcTemplate.executeUpdate("delete from fc_member_film_director 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 "
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?)";
String sql_director = ""
+ "insert into fc_member_film_director ("
+ "film_id, "
+ "director_name, "
+ "director_film_nums, "
+ "director_intro, "
+ "playactor_country, "
+ "playactor_birthday, "
+ "create_time, "
+ "director_is_play_shanghai) "
+ "values "
+ "(?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.batchUpdate(sql_playactor, playactors);
jdbcTemplate.batchUpdate(sql_director, directors);
} else {
throw new XException(messages.get("err.args_nums"));
}
}
@Override
@Transactional
public void saveMemberFilmIssuer(
Integer member_id,
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(
Integer member_id,
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 member_id = ? and id = ?", play_shanghai, last_modify_time, member_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 (?, ?, ?, ?, ?);";
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>> queryChuShenList(String keyword, Integer state, Integer apply_state, String film_type, String enroll_type, String film_country, Page page) {
SqlWhere where = new SqlWhere().lk(new String[]{"mf.en_name", "mf.cn_name"}, keyword).eq("mf.state", state).eq("mf.apply_state", apply_state).eq("mf.film_type_name", film_type).eq("mf.enroll_type_name", enroll_type).eq("mf.film_country", film_country);
String sql = "select mf.*, (select GROUP_CONCAT(mfd.director_name) from fc_member_film_director mfd where mfd.film_id = mf.id) director_name from fc_member_film mf" + StringUtil.join(" and ", " where ", "", "", where.getStringList());
Object[] objs = where.getObjectList();
return jdbcTemplate.limit(sql, page, objs);
}
@Override
public void pass(Integer member_film_id) {
String sql = "update fc_member_film set apply_state = ? where id = ?";
jdbcTemplate.executeUpdate(sql, 2, member_film_id);
}
@Override
public void reject(Integer member_film_id) {
String sql = "update fc_member_film set apply_state = ? where id = ?";
jdbcTemplate.executeUpdate(sql, 3, 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.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.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.MemberService;
import com.egolm.film.api.service.Messages;
import com.egolm.film.bean.Fc_member;
import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.bean.Fc_member_film_all;
import com.egolm.film.bean.Fc_member_film_director;
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.config.WebMvcConfig;
import com.egolm.film.config.XException;
import com.egolm.film.util.Common;
import com.egolm.film.util.SqlWhere;
@Service
public class MemberServiceImpl implements MemberService {
@Autowired
private Messages messages;
@Autowired
private JdbcTemplate jdbcTemplate;
......@@ -111,356 +86,6 @@ public class MemberServiceImpl implements MemberService {
return jdbcTemplate.queryForInt("select count(*) from fc_member where email = ?", email) > 0;
}
@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<Fc_member_film_director> queryMemberFilmDirectorList(Long member_film_id) {
return jdbcTemplate.queryForBeans("select * from fc_member_film_director where film_id = ?", Fc_member_film_director.class, member_film_id);
}
@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) {
jdbcTemplate.executeUpdate("update fc_member_film set state = ?, apply_state = ? where id = ? and member_id = ?", 2, 1, member_film_id, member_id);
}
@Override
public void saveMore(Fc_member_film_all more) {
if(more.getId() == null) {
jdbcTemplate.save(more);
} else {
jdbcTemplate.update(more);
}
}
@Override
public Fc_member_film_all queryMoreByNo(String film_no) {
return jdbcTemplate.queryForBean("select * from fc_member_film_all where film_no = ?", Fc_member_film_all.class, film_no);
}
@Override
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);
return keyHolder.getKey().longValue();
}
@Override
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 str = StringUtil.join(",", "", "", "", enroll_type_name_other);
Object[] args = new Object[]{str, cn_name, en_name, intro, last_modify_time, member_id, 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(
Integer member_id,
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) {
if(playactor_type.length == playactor_role_name.length &&
playactor_role_name.length == playactor_name.length &&
playactor_name.length == playactor_film_nums.length &&
playactor_film_nums.length == playactor_country.length &&
playactor_country.length == playactor_birthday.length &&
playactor_birthday.length == playactor_intro.length &&
playactor_intro.length == is_play_shanghai.length) {
Long create_time = System.currentTimeMillis()/1000;
List<Object[]> playactors = new ArrayList<Object[]>();
List<Object[]> directors = new ArrayList<Object[]>();
for(int i = 0; i < playactor_type.length; i++) {
if(!playactor_type[i].equals("0")) {
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]});
} else {
directors.add(new Object[] {
member_film_id,
playactor_name[i],
playactor_film_nums[i],
playactor_intro[i],
playactor_country[i],
playactor_birthday[i],
create_time,
is_play_shanghai[i]});
}
}
jdbcTemplate.executeUpdate("delete from fc_member_film_playactor where film_id = ?", member_film_id);
jdbcTemplate.executeUpdate("delete from fc_member_film_director 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 "
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?)";
String sql_director = ""
+ "insert into fc_member_film_director ("
+ "film_id, "
+ "director_name, "
+ "director_film_nums, "
+ "director_intro, "
+ "playactor_country, "
+ "playactor_birthday, "
+ "create_time, "
+ "director_is_play_shanghai) "
+ "values "
+ "(?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.batchUpdate(sql_playactor, playactors);
jdbcTemplate.batchUpdate(sql_director, directors);
} else {
throw new XException(messages.get("err.args_nums"));
}
}
@Override
@Transactional
public void saveMemberFilmIssuer(
Integer member_id,
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(
Integer member_id,
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 member_id = ? and id = ?", play_shanghai, last_modify_time, member_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 (?, ?, ?, ?, ?);";
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 boolean changePasswordByMemberId(Integer member_id, String password, String newPassword) {
Fc_member member = this.getMemberById(member_id);
......@@ -484,35 +109,4 @@ public class MemberServiceImpl implements MemberService {
jdbcTemplate.executeUpdate(sql, token_string, member_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>> queryChuShenList(String keyword, Integer state, Integer apply_state, String film_type, String enroll_type, String film_country, Page page) {
SqlWhere where = new SqlWhere().lk(new String[]{"mf.en_name", "mf.cn_name"}, keyword).eq("mf.state", state).eq("mf.apply_state", apply_state).eq("mf.film_type_name", film_type).eq("mf.enroll_type_name", enroll_type).eq("mf.film_country", film_country);
String sql = "select mf.*, (select GROUP_CONCAT(mfd.director_name) from fc_member_film_director mfd where mfd.film_id = mf.id) director_name from fc_member_film mf" + StringUtil.join(" and ", " where ", "", "", where.getStringList());
Object[] objs = where.getObjectList();
return jdbcTemplate.limit(sql, page, objs);
}
@Override
public void pass(Integer member_film_id) {
String sql = "update fc_member_film set apply_state = ? where id = ?";
jdbcTemplate.executeUpdate(sql, 2, member_film_id);
}
@Override
public void reject(Integer member_film_id) {
String sql = "update fc_member_film set apply_state = ? where id = ?";
jdbcTemplate.executeUpdate(sql, 3, member_film_id);
}
}
......@@ -13,6 +13,7 @@ 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.FilmService;
import com.egolm.film.api.service.MemberFilmService;
import com.egolm.film.api.service.MemberService;
import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.bean.Fc_member_film_director;
......@@ -42,6 +43,9 @@ public class AdminFirstController {
@Autowired
MemberService memberService;
@Autowired
MemberFilmService memberFilmService;
@Autowired
AdminTokenService tokenService;
......@@ -62,7 +66,7 @@ public class AdminFirstController {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
Page page = new Page(index, limit);
List<Map<String, Object>> list = memberService.queryChuShenList(keyword, state, apply_state, film_type, enroll_type, film_country, page);
List<Map<String, Object>> list = memberFilmService.queryChuShenList(keyword, state, apply_state, film_type, enroll_type, film_country, page);
return Rjx.jsonOk().setData(list);
}
......@@ -81,7 +85,7 @@ public class AdminFirstController {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
Page page = new Page(index, limit);
List<Map<String, Object>> list = memberService.queryChuShenList(keyword, 2, 2, film_type, enroll_type, film_country, page);
List<Map<String, Object>> list = memberFilmService.queryChuShenList(keyword, 2, 2, film_type, enroll_type, film_country, page);
return Rjx.jsonOk().setData(list);
}
......@@ -95,7 +99,7 @@ public class AdminFirstController {
LoginToken loginToken = tokenService.getToken();
Integer adminid = (Integer)loginToken.getId();
service.copyFilm(member_film_id, adminid);
memberService.pass(member_film_id);
memberFilmService.pass(member_film_id);
return Rjx.jsonOk();
}
......@@ -106,7 +110,7 @@ public class AdminFirstController {
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="member_film_id", value="申报影片ID"),
})
public Object reject(Integer member_film_id) {
memberService.reject(member_film_id);
memberFilmService.reject(member_film_id);
return Rjx.jsonOk();
}
......@@ -117,11 +121,11 @@ public class AdminFirstController {
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="申报影片ID")
})
public Object getDetail(Long member_film_id) {
Fc_member_film memberFilm = memberService.queryMemberFilmById(member_film_id);
List<Fc_member_film_director> directorList = memberService.queryMemberFilmDirectorList(memberFilm.getId());
List<Fc_member_film_issuer> issuerList = memberService.queryMemberFilmIssuerList(memberFilm.getId());
List<Fc_member_film_playactor> playactorList = memberService.queryMemberFilmPlayactorList(memberFilm.getId());
List<Fc_member_film_show> showList = memberService.queryMemberFilmShowList(memberFilm.getId());
Fc_member_film memberFilm = memberFilmService.queryMemberFilmById(member_film_id);
List<Fc_member_film_director> directorList = memberFilmService.queryMemberFilmDirectorList(memberFilm.getId());
List<Fc_member_film_issuer> issuerList = memberFilmService.queryMemberFilmIssuerList(memberFilm.getId());
List<Fc_member_film_playactor> playactorList = memberFilmService.queryMemberFilmPlayactorList(memberFilm.getId());
List<Fc_member_film_show> showList = memberFilmService.queryMemberFilmShowList(memberFilm.getId());
return Rjx.jsonOk()
.setData(memberFilm)
......
......@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.egolm.common.bean.Rjx;
import com.egolm.film.api.service.MemberFilmService;
import com.egolm.film.api.service.MemberService;
import com.egolm.film.api.service.MemberTokenService;
import com.egolm.film.bean.Fc_member_film;
......@@ -35,6 +36,9 @@ public class MemberApplyController {
@Autowired
private MemberService memberService;
@Autowired
private MemberFilmService memberFilmService;
@Autowired
private MemberTokenService tokenService;
......@@ -52,7 +56,7 @@ public class MemberApplyController {
Integer member_id = (Integer)loginToken.getId();
List<Map<String, Object>> list = null;
if(member_id.intValue() == opt_member_id.intValue()) {
list = memberService.queryListAll(keyword);
list = memberFilmService.queryListAll(keyword);
} else {
list = memberService.queryListByMemberID(member_id);
}
......@@ -70,7 +74,7 @@ public class MemberApplyController {
public Object saveMemberFilmType(String film_type_name, String enroll_type_name) {
LoginToken loginToken = tokenService.getToken();
Integer member_id = (Integer)loginToken.getId();
Long member_film_id = memberService.saveMemberFilmType(member_id, film_type_name, enroll_type_name);
Long member_film_id = memberFilmService.saveMemberFilmType(member_id, film_type_name, enroll_type_name);
return Rjx.jsonOk().set("member_film_id", member_film_id);
}
......@@ -94,7 +98,7 @@ public class MemberApplyController {
LoginToken loginToken = tokenService.getToken();
Integer member_id = (Integer)loginToken.getId();
memberService.saveMemberFilmBase(
memberFilmService.saveMemberFilmBase(
member_id,
member_film_id,
enroll_type_name_other,
......@@ -150,7 +154,7 @@ public class MemberApplyController {
LoginToken loginToken = tokenService.getToken();
Integer member_id = (Integer)loginToken.getId();
memberService.saveMemberFilmInfo(
memberFilmService.saveMemberFilmInfo(
member_id,
member_film_id,
film_country,
......@@ -201,7 +205,7 @@ public class MemberApplyController {
LoginToken loginToken = tokenService.getToken();
Integer member_id = (Integer)loginToken.getId();
memberService.saveMemberFilmPlayactor(
memberFilmService.saveMemberFilmPlayactor(
member_id,
member_film_id,
playactor_type,
......@@ -236,7 +240,7 @@ public class MemberApplyController {
LoginToken loginToken = tokenService.getToken();
Integer member_id = (Integer)loginToken.getId();
memberService.saveMemberFilmIssuer(
memberFilmService.saveMemberFilmIssuer(
member_id,
member_film_id,
issuer_company,
......@@ -267,7 +271,7 @@ public class MemberApplyController {
LoginToken loginToken = tokenService.getToken();
Integer member_id = (Integer)loginToken.getId();
memberService.saveMemberFilmShow(
memberFilmService.saveMemberFilmShow(
member_id,
member_film_id,
play_shanghai,
......@@ -301,7 +305,7 @@ public class MemberApplyController {
LoginToken loginToken = tokenService.getToken();
Integer member_id = (Integer)loginToken.getId();
memberService.saveMemberFilmCompany(
memberFilmService.saveMemberFilmCompany(
member_id,
member_film_id,
film_apply_company,
......@@ -321,11 +325,11 @@ public class MemberApplyController {
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="申报影片ID")
})
public Object getDetail(Long member_film_id) {
Fc_member_film memberFilm = memberService.queryMemberFilmById(member_film_id);
List<Fc_member_film_director> directorList = memberService.queryMemberFilmDirectorList(memberFilm.getId());
List<Fc_member_film_issuer> issuerList = memberService.queryMemberFilmIssuerList(memberFilm.getId());
List<Fc_member_film_playactor> playactorList = memberService.queryMemberFilmPlayactorList(memberFilm.getId());
List<Fc_member_film_show> showList = memberService.queryMemberFilmShowList(memberFilm.getId());
Fc_member_film memberFilm = memberFilmService.queryMemberFilmById(member_film_id);
List<Fc_member_film_director> directorList = memberFilmService.queryMemberFilmDirectorList(memberFilm.getId());
List<Fc_member_film_issuer> issuerList = memberFilmService.queryMemberFilmIssuerList(memberFilm.getId());
List<Fc_member_film_playactor> playactorList = memberFilmService.queryMemberFilmPlayactorList(memberFilm.getId());
List<Fc_member_film_show> showList = memberFilmService.queryMemberFilmShowList(memberFilm.getId());
return Rjx.jsonOk()
.setData(memberFilm)
......@@ -344,7 +348,7 @@ public class MemberApplyController {
public Object doApply(Long member_film_id) {
LoginToken loginToken = tokenService.getToken();
Integer member_id = (Integer)loginToken.getId();
memberService.doApply(member_id, member_film_id);
memberFilmService.doApply(member_id, member_film_id);
return Rjx.jsonOk();
}
......@@ -355,7 +359,7 @@ public class MemberApplyController {
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="film_no", value="情报影片编号")
})
public Object getMore(String film_no) {
Fc_member_film_all more = memberService.queryMoreByNo(film_no);
Fc_member_film_all more = memberFilmService.queryMoreByNo(film_no);
return Rjx.jsonOk().setData(more);
}
......@@ -366,7 +370,7 @@ public class MemberApplyController {
@ApiImplicitParam(paramType="header", dataType="string", name="i18n_language"),
})
public Object saveMore(Fc_member_film_all more) {
memberService.saveMore(more);
memberFilmService.saveMore(more);
return Rjx.jsonOk();
}
......
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