Commit af6d1a82 authored by Quxl's avatar Quxl

x

parent f2d2382b
......@@ -7,6 +7,10 @@ import javax.servlet.ServletOutputStream;
public interface ExportService {
Map<String, String> getApplyListColumns();
void exportApplyList(ServletOutputStream outputStream, String[] columns);
void exportApplyList(ServletOutputStream os, String[] columns);
Map<String, String> getApplyPassListColumns();
void exportApplyPassList(ServletOutputStream os, String[] columns);
}
......@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
import com.egolm.common.ExcelUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.Util;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.CountryService;
......@@ -37,7 +38,7 @@ public class ExportServiceImpl implements ExportService {
columns.put("film_no", "电影编号");
columns.put("en_name", "英文名称");
columns.put("cn_name", "中文片名");
columns.put("enroll_type_name", "影片类型");
columns.put("film_type_name", "影片类型");
columns.put("first_show_date", "首次上映时间");
columns.put("first_show_city", "首次上映城市");
columns.put("other_filmfest_name", "同时参加的电影节");
......@@ -45,15 +46,15 @@ public class ExportServiceImpl implements ExportService {
columns.put("film_format", "样片规格");
columns.put("completion_date", "完成日期");
columns.put("film_country", "制片国");
columns.put("film_country_cn", "制片国中文");
columns.put("film_country_cn", "制片国(中文)");
columns.put("co_production_country", "合拍国");
columns.put("co_production_country_cn", "合拍国中文");
columns.put("co_production_country_cn", "合拍国(中文)");
columns.put("enroll_type_name", "报名性质");
columns.put("state", "状态");
columns.put("dialogue_lang", "对拍语言");
columns.put("dialogue_lang_cn", "对白语言中文");
columns.put("dialogue_lang_cn", "对白语言(中文)");
columns.put("subtitle_lang", "字幕语言");
columns.put("subtitle_lang_cn", "字幕语言中文");
columns.put("subtitle_lang_cn", "字幕语言(中文)");
columns.put("play_shanghai", "该片在上海电影节放映是");
columns.put("film_total_time", "时长");
columns.put("film_apply_company", "申报公司");
......@@ -72,10 +73,11 @@ public class ExportServiceImpl implements ExportService {
public void exportApplyList(ServletOutputStream os, String[] columns) {
String sql = ""
+ "select "
+ "mf.id, "
+ "mf.film_no, "
+ "mf.en_name, "
+ "mf.cn_name, "
+ "mf.enroll_type_name, "
+ "mf.film_type_name, "
+ "mf.first_show_date, "
+ "mf.first_show_city, "
+ "mf.other_filmfest_name, "
......@@ -105,29 +107,17 @@ public class ExportServiceImpl implements ExportService {
+ "state = 2";
List<Map<String, Object>> list = jdbcTemplate.limitAll(sql, new Page(1L, 1000L, new String[] {"film_no asc"}));
for(Map<String, Object> map : list) {
String film_country = (String)map.get("film_country");
String film_country_cn = countryMap.get(film_country);
map.put("film_country_cn", film_country_cn);
String co_production_country = (String)map.get("co_production_country");
String co_production_country_cn = countryMap.get(co_production_country);
map.put("co_production_country_cn", co_production_country_cn);
String dialogue_lang = (String)map.get("dialogue_lang");
String dialogue_lang_cn = countryMap.get(dialogue_lang);
map.put("dialogue_lang_cn", dialogue_lang_cn);
String subtitle_lang = (String)map.get("subtitle_lang");
String subtitle_lang_cn = countryMap.get(subtitle_lang);
map.put("subtitle_lang_cn", subtitle_lang_cn);
map.replace("film_type_name", ExportConstant.filmTypes.get(map.get("film_type_name")));
map.replace("film_type_name_short", ExportConstant.filmShortTypes.get(map.get("film_type_name_short")));
map.replace("film_medium", ExportConstant.filmMedium.get(map.get("film_medium")));
map.replace("film_format", ExportConstant.filmFormat.get(map.get("film_format")));
map.replace("state", ExportConstant.states.get(String.valueOf(map.get("state"))));
map.replace("apply_state", ExportConstant.applyStates.get(String.valueOf(map.get("apply_state"))));
map.replace("play_shanghai", ExportConstant.playShanghai.get(String.valueOf(map.get("play_shanghai"))));
map.put("film_country_cn", countryMap.get(map.get("film_country")));
map.put("co_production_country_cn", countryMap.get(map.get("co_production_country")));
map.put("dialogue_lang_cn", countryMap.get(map.get("dialogue_lang")));
map.put("subtitle_lang_cn", countryMap.get(map.get("subtitle_lang")));
map.put("film_type_name", ExportConstant.filmTypes.get(map.get("film_type_name")));
map.put("film_type_name_short", ExportConstant.filmShortTypes.get(map.get("film_type_name_short")));
map.put("film_medium", ExportConstant.filmMedium.get(map.get("film_medium")));
map.put("film_format", ExportConstant.filmFormat.get(map.get("film_format")));
map.put("state", ExportConstant.states.get(String.valueOf(map.get("state"))));
map.put("apply_state", ExportConstant.applyStates.get(String.valueOf(map.get("apply_state"))));
map.put("play_shanghai", ExportConstant.playShanghai.get(String.valueOf(map.get("play_shanghai"))));
String enroll_type_name = (String)map.get("enroll_type_name");
if(StringUtil.isNotBlank(enroll_type_name)) {
......@@ -161,4 +151,150 @@ public class ExportServiceImpl implements ExportService {
ExcelUtil.excel(os, columnList.toArray(new String[columnList.size()]), titleList.toArray(new String[titleList.size()]), null, list);
}
@Override
public Map<String, String> getApplyPassListColumns() {
Map<String, String> columns = new LinkedHashMap<String, String>();
columns.put("film_no", "电影编号");
columns.put("en_name", "英文名称");
columns.put("cn_name", "中文片名");
columns.put("film_type_name", "影片类型");
columns.put("enroll_type_name", "报名性质");
columns.put("film_total_time", "时长");
columns.put("film_medium", "色彩");
columns.put("film_country", "制片国");
columns.put("film_country_cn", "制片国(中文)");
columns.put("co_production_country", "合拍国");
columns.put("co_production_country_cn", "合拍国(中文)");
columns.put("dialogue_lang", "对拍语言");
columns.put("dialogue_lang_cn", "对白语言(中文)");
columns.put("subtitle_lang", "字幕语言");
columns.put("subtitle_lang_cn", "字幕语言(中文)");
columns.put("completion_date", "完成日期");
columns.put("play_shanghai", "该片在上海电影节放映是");
columns.put("prize", "参加过的电影节");
columns.put("first_show_date", "首次上映时间");
columns.put("first_show_city", "首次上映城市");
columns.put("other_filmfest_name", "同时申报的电影节");
columns.put("enroll_type_name_other", "申报奖项");
columns.put("director", "导演");
columns.put("producer", "制片人");
columns.put("actor", "男演员");
columns.put("actress", "女演员");
columns.put("photographer", "摄影");
columns.put("screenwriter", "编剧");
columns.put("issuser", "发行方");
columns.put("film_apply_company", "申报公司");
columns.put("film_apply_realname", "申报人姓名");
columns.put("film_apply_email", "申报人邮箱");
columns.put("film_apply_tel", "申报人电话");
columns.put("film_apply_mobile", "申报人手机");
columns.put("film_type_name_short", "区域类型");
columns.put("film_format", "样片规格");
columns.put("film_format_url", "样片URL");
columns.put("film_format_passw", "样片URL密码");
return columns;
}
@Override
public void exportApplyPassList(ServletOutputStream os, String[] columns) {
String sql = ""
+ "select "
+ "mf.id, "
+ "mf.film_no, "
+ "mf.en_name, "
+ "mf.cn_name, "
+ "mf.film_type_name, "
+ "mf.enroll_type_name, "
+ "mf.film_total_time, "
+ "mf.film_medium, "
+ "mf.film_country, "
+ "mf.co_production_country, "
+ "mf.dialogue_lang, "
+ "mf.subtitle_lang, "
+ "mf.completion_date, "
+ "mf.play_shanghai, "
+ "mf.prize, "
+ "mf.first_show_date, "
+ "mf.first_show_city, "
+ "mf.other_filmfest_name, "
+ "mf.enroll_type_name_other, "
+ "mf.film_apply_company, "
+ "mf.film_apply_realname, "
+ "mf.film_apply_email, "
+ "mf.film_apply_tel, "
+ "mf.film_apply_mobile, "
+ "mf.film_type_name_short, "
+ "mf.film_format, "
+ "mf.film_format_url, "
+ "mf.film_format_passw "
+ " from "
+ "fc_member_film mf "
+ "where "
+ "state = 2 and apply_state = 2";
List<Map<String, Object>> list = jdbcTemplate.limitAll(sql, new Page(1L, 1000L, new String[] {"film_no asc"}));
String sql0 = "select group_concat(fp.playactor_name) text, fp.film_id, fp.playactor_type from fc_member_film_playactor fp group by fp.film_id, fp.playactor_type";
String sql1 = "select group_concat(fi.issuer_company) text, fi.film_id from fc_member_film_issuer fi group by fi.film_id";
List<Map<String, Object>> playactors = jdbcTemplate.queryForList(sql0);
List<Map<String, Object>> issuers = jdbcTemplate.queryForList(sql1);
Map<String, Map<String, Object>> playactorMM = Util.listToMM(playactors, ",", "film_id", "playactor_type");
Map<String, Map<String, Object>> issuerMM = Util.listToMM(issuers, ",", "film_id");
for(Map<String, Object> map : list) {
String id_str = "" + map.get("id");
for(String playactor_type : ExportConstant.playactorTypes.keySet()) {
Map<String, Object> playactorMap = playactorMM.get(id_str + "," + playactor_type);
map.put(playactor_type, playactorMap == null ? null : playactorMap.get("text"));
}
Map<String, Object> issuerMap = issuerMM.get(id_str);
map.put("issuer", issuerMap == null ? null : issuerMap.get("text"));
map.put("film_country_cn", countryMap.get(map.get("film_country")));
map.put("co_production_country_cn", countryMap.get(map.get("co_production_country")));
map.put("dialogue_lang_cn", countryMap.get(map.get("dialogue_lang")));
map.put("subtitle_lang_cn", countryMap.get(map.get("subtitle_lang")));
map.put("film_type_name", ExportConstant.filmTypes.get(map.get("film_type_name")));
map.put("film_type_name_short", ExportConstant.filmShortTypes.get(map.get("film_type_name_short")));
map.put("film_medium", ExportConstant.filmMedium.get(String.valueOf(map.get("film_medium"))));
map.put("film_format", ExportConstant.filmFormat.get(String.valueOf(map.get("film_format"))));
map.put("play_shanghai", ExportConstant.playShanghai.get(String.valueOf(map.get("play_shanghai"))));
String enroll_type_name = (String)map.get("enroll_type_name");
if(StringUtil.isNotBlank(enroll_type_name)) {
List<String> enrolls = new ArrayList<String>();
for(String str : enroll_type_name.split(",")) {
enrolls.add(ExportConstant.enrollTypes.get(str.trim()));
}
map.put("enroll_type_name", StringUtil.join(",", enrolls));
}
String enroll_type_name_other = (String)map.get("enroll_type_name_other");
if(StringUtil.isNotBlank(enroll_type_name_other)) {
List<String> others = new ArrayList<String>();
for(String str : enroll_type_name_other.split(",")) {
others.add(ExportConstant.enrollOtherTypes.get(str.trim()));
}
map.put("enroll_type_name_other", StringUtil.join(",", others));
}
}
Map<String, String> columnMap = this.getApplyPassListColumns();
List<String> titleList = new ArrayList<String>();
List<String> columnList = new ArrayList<String>();
if(columns == null || columns.length == 0) {
for(String key : columnMap.keySet()) {
columnList.add(key);
titleList.add(columnMap.get(key));
}
} else {
for(String column: columns) {
columnList.add(column);
String title = columnMap.get(column);
if(StringUtil.isNotBlank(title)) {
titleList.add(title);
} else {
titleList.add(column);
}
}
}
ExcelUtil.excel(os, columnList.toArray(new String[columnList.size()]), titleList.toArray(new String[titleList.size()]), null, list);
}
}
......@@ -14,7 +14,6 @@ public class ExportConstant {
playactorTypes.put("actor", "男演员");
playactorTypes.put("actress", "女演员");
playactorTypes.put("issuser", "发行方");
playactorTypes.put("show", "参加过的电视节");
}
public static final Map<String, String> filmTypes = new HashMap<String, String>();
......@@ -38,10 +37,10 @@ public class ExportConstant {
}
public static final Map<String, String> enrollTypes = new HashMap<String, String>();
static {
enrollTypes.put("1", "金爵奖国际影片评选");
enrollTypes.put("2", "亚洲新人奖国际影片评选");
enrollTypes.put("3", "电影频道传媒关注");
enrollTypes.put("4", "国际电影展映");
enrollTypes.put("1", "金爵");
enrollTypes.put("2", "亚");
enrollTypes.put("3", "传媒");
enrollTypes.put("4", "展映");
}
public static final Map<String, String> enrollOtherTypes = new HashMap<String, String>();
static {
......
package com.egolm.film.api.web;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
......@@ -15,10 +11,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.egolm.common.DateUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.film.api.service.AdminTokenService;
import com.egolm.film.api.service.ExportService;
import com.egolm.film.api.service.FilmService;
import com.egolm.film.api.service.MemberTokenService;
import com.egolm.film.api.service.ReviewService;
......@@ -47,9 +41,6 @@ public class FilmController {
@Autowired
ReviewService reviewService;
@Autowired
ExportService exportService;
@Autowired
MemberTokenService memberTokenService;
......@@ -191,20 +182,4 @@ public class FilmController {
return Rjx.jsonOk().set("id", filmBase.getId());
}
@ResponseBody
@PostMapping("getApplyListColumns")
@ApiOperation("获取报名列表导出列")
public Object getApplyListColumns() {
return Rjx.jsonOk().setData(exportService.getApplyListColumns());
}
@ResponseBody
@PostMapping("exportApplyList")
@ApiOperation("导出报名列表")
public void exportApplyList(HttpServletResponse response, String[] columns) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报名影片列表[" + DateUtil.format(new Date(), "yyMMdd-HHmmss") + "].xls", "UTF-8"));
exportService.exportApplyList(response.getOutputStream(), columns);
}
}
package com.egolm.film.api.web.admin;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.MessageFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -17,11 +19,13 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.egolm.common.DateUtil;
import com.egolm.common.Util;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.AdminTokenService;
import com.egolm.film.api.service.EmailService;
import com.egolm.film.api.service.ExportService;
import com.egolm.film.api.service.FilmService;
import com.egolm.film.api.service.ReviewService;
import com.egolm.film.bean.Fc_admin;
......@@ -58,6 +62,9 @@ public class AdminFirstController {
@Autowired
ReviewService reviewService;
@Autowired
ExportService exportService;
@ResponseBody
@PostMapping("list")
@ApiOperation("影片列表")
......@@ -207,4 +214,36 @@ public class AdminFirstController {
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("getApplyListColumns")
@ApiOperation("获取报名列表导出列")
public Object getApplyListColumns() {
return Rjx.jsonOk().setData(exportService.getApplyListColumns());
}
@ResponseBody
@PostMapping("exportApplyList")
@ApiOperation("导出报名列表")
public void exportApplyList(HttpServletResponse response, String[] columns) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报名列表[" + DateUtil.format(new Date(), "yyMMdd-HHmmss") + "].xls", "UTF-8"));
exportService.exportApplyList(response.getOutputStream(), columns);
}
@ResponseBody
@PostMapping("getApplyPassListColumns")
@ApiOperation("获取影片列表导出列")
public Object getApplyPassListColumns() {
return Rjx.jsonOk().setData(exportService.getApplyPassListColumns());
}
@ResponseBody
@PostMapping("exportApplyPassList")
@ApiOperation("导出影片列表")
public void exportApplyPassList(HttpServletResponse response, String[] columns) throws IOException {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("影片列表[" + DateUtil.format(new Date(), "yyMMdd-HHmmss") + "].xls", "UTF-8"));
exportService.exportApplyPassList(response.getOutputStream(), columns);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment