Commit 461cfb36 authored by Quxl's avatar Quxl

完善申报接口

parent 11d00605
......@@ -137,7 +137,7 @@ public class MemberApplyController {
@ApiImplicitParam(paramType = "query", dataType = "array", allowMultiple=true, required = false, name = "show_filmfest_intro", value="简介(获奖或报名奖项等)"),
})
public Object saveMemberFilmShow(Long member_film_id, String play_shanghai, String[] show_filmfest, String[] show_filmfest_type, String[] show_filmfest_intro) {
memberService.saveMemberFilmShow(member_film_id, play_shanghai, show_filmfest, show_filmfest_type, show_filmfest_intro, show_filmfest_intro);
memberService.saveMemberFilmShow(member_film_id, play_shanghai, show_filmfest, show_filmfest_type, show_filmfest_intro);
return Rjx.jsonOk();
}
......
......@@ -62,7 +62,7 @@ public interface MemberService {
String[] issuer_email, String[] issuer_tel);
void saveMemberFilmShow(Long member_film_id, String play_shanghai, String[] show_filmfest,
String[] show_filmfest_type, String[] show_filmfest_intro, String[] show_filmfest_intro2);
String[] show_filmfest_type, String[] show_filmfest_intro);
void saveMemberFilmCompany(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);
......
package com.egolm.film.api.member.service.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
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 com.egolm.common.StringUtil;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.film.api.member.service.MemberService;
import com.egolm.film.bean.Fc_member;
......@@ -15,11 +23,16 @@ 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.common.Messages;
import com.egolm.film.config.XException;
@Service
public class MemberServiceImpl implements MemberService {
@Autowired
private Messages messages;
@Autowired
private JdbcTemplate jdbcTemplate;
......@@ -114,23 +127,45 @@ public class MemberServiceImpl implements MemberService {
@Override
public Long saveMemberFilmType(Long member_film_id, String film_type_name, String enroll_type_name) {
// TODO Auto-generated method stub
return null;
}
@Override
public void saveMemberFilmBase(Long member_film_id, String[] enroll_type_name_other, String cn_name, String en_name,
String intro) {
// TODO Auto-generated method stub
String sql = "insert into fc_member_film (film_type_name, enroll_type_name) values (?, ?)";
Object[] args = new Object[]{film_type_name, enroll_type_name};
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(Long member_film_id, String[] enroll_type_name_other, String cn_name, String en_name, String intro) {
String sql = "update fc_member_film set enroll_type_name_other = ?, cn_name = ?, en_name = ?, intro = ? where id = ?";
String str = StringUtil.join(",", "", "", "", enroll_type_name_other);
Object[] args = new Object[]{str, cn_name, en_name, intro, member_film_id};
jdbcTemplate.executeUpdate(sql, args);
}
@Override
public void saveMemberFilmInfo(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 film_medium, String film_format) {
// TODO Auto-generated method stub
String sql = "update fc_member_film set film_country = ?, dialogue_lang = ?, subtitle_lang = ?, co_production_country = ?, film_total_time = ?, completion_date = ?, show_date = ?, film_medium = ?, film_format = ? where id = ?";
String str = StringUtil.join(",", "", "", "", co_production_country);
Object[] args = new Object[]{str, film_country, dialogue_lang, subtitle_lang, str, film_total_time, completion_date, show_date, film_medium, film_format, member_film_id};
jdbcTemplate.executeUpdate(sql, args);
}
@Override
......@@ -142,23 +177,43 @@ public class MemberServiceImpl implements MemberService {
}
@Override
public void saveMemberFilmIssuer(Long member_film_id, String[] issuer_company, String[] issuer_contacts,
String[] issuer_email, String[] issuer_tel) {
// TODO Auto-generated method stub
public void saveMemberFilmIssuer(Long member_film_id, String[] issuer_company, String[] issuer_contacts, String[] issuer_email, String[] issuer_tel) {
if(issuer_company.length == issuer_contacts.length && issuer_contacts.length == issuer_email.length && issuer_email.length == issuer_tel.length) {
Long create_time = System.currentTimeMillis();
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 (?, ?, ?, ?, ?, ?);";
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.batchUpdate(sql, args);
} else {
throw new XException(messages.get("err.args_nums"));
}
}
@Override
public void saveMemberFilmShow(Long member_film_id, String play_shanghai, String[] show_filmfest,
String[] show_filmfest_type, String[] show_filmfest_intro, String[] show_filmfest_intro2) {
// TODO Auto-generated method stub
public void saveMemberFilmShow(Long member_film_id, String play_shanghai, String[] show_filmfest, String[] show_filmfest_type, String[] show_filmfest_intro) {
if(show_filmfest.length == show_filmfest_type.length && show_filmfest_type.length == show_filmfest_intro.length) {
Long create_time = System.currentTimeMillis();
jdbcTemplate.executeUpdate("update fc_member_film set play_shanghai = ? where id = ?", play_shanghai, 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 (?, ?, ?, ?, ?);";
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};
}
jdbcTemplate.batchUpdate(sql, args);
} else {
throw new XException(messages.get("err.args_nums"));
}
}
@Override
public void saveMemberFilmCompany(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) {
// TODO Auto-generated method stub
public void saveMemberFilmCompany(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) {
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 = ? where id = ?";
Object[] args = new Object[]{film_apply_company, film_apply_realname, film_apply_email, film_apply_tel, film_apply_mobile, film_apply_country, member_film_id};
jdbcTemplate.executeUpdate(sql, args);
}
......
......@@ -10,4 +10,4 @@ err.user_exists=User already exists
err.email_null=The mailbox can not be empty
err.name_null=The username can not be empty
err.pwd_null=The password can not be empty
err.args_nums=Incorrect number of parameters
......@@ -10,4 +10,4 @@ err.user_exists=\u7528\u6237\u5DF2\u5B58\u5728
err.email_null=\u90AE\u7BB1\u4E0D\u80FD\u4E3A\u7A7A
err.name_null=\u59D3\u540D\u4E0D\u80FD\u4E3A\u7A7A
err.pwd_null=\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A
err.args_nums=\u653E\u6620\u53C2\u6570\u6570\u91CF\u9519\u8BEF
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