Commit 1eb17e57 authored by Quxl's avatar Quxl

优化申报接口

parent 461cfb36
......@@ -5,6 +5,7 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -93,6 +94,7 @@ public class MemberApplyController {
return Rjx.jsonOk();
}
@Transactional
@ResponseBody
@PostMapping("save_playactor")
@ApiOperation("保存影片演职员信息")
......@@ -111,6 +113,7 @@ public class MemberApplyController {
return Rjx.jsonOk();
}
@Transactional
@ResponseBody
@PostMapping("save_issuer")
@ApiOperation("保存影片发行信息")
......@@ -126,6 +129,7 @@ public class MemberApplyController {
return Rjx.jsonOk();
}
@Transactional
@ResponseBody
@PostMapping("save_show")
@ApiOperation("保存影片放映信息")
......
......@@ -4,6 +4,7 @@ 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;
......@@ -172,20 +173,38 @@ public class MemberServiceImpl implements MemberService {
public void saveMemberFilmPlayactor(Long member_film_id, String[] playactor_type, String[] playactor_name,
String[] playactor_film_nums, String[] playactor_country, String[] playactor_birthday,
String[] playactor_intro, Integer[] is_play_shanghai) {
// TODO Auto-generated method stub
if(playactor_type.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();
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]});
} 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) 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
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.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"));
......@@ -196,13 +215,13 @@ public class MemberServiceImpl implements MemberService {
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.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 (?, ?, ?, ?, ?);";
jdbcTemplate.batchUpdate(sql, args);
} else {
throw new XException(messages.get("err.args_nums"));
......
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