Commit 1c14966b authored by Quxl's avatar Quxl

x

parent fd447c5f
......@@ -7,4 +7,8 @@ public interface CountryService {
public List<Map<String, String>> queryCountryList();
public Map<String, String> queryCountryMap();
public Map<String, String> queryCountryMapReverse();
}
package com.egolm.film.api.service;
import java.io.OutputStream;
import java.util.Map;
import javax.servlet.ServletOutputStream;
public interface ExportService {
Map<String, String> getAllTitles(String[] columns);
void export(
OutputStream os,
Integer admin_group_id,
String keyword,
Integer state,
Integer apply_state,
Integer film_type,
Integer enroll_type,
Integer upload_state,
String film_country,
Integer film_type_short,
String play_shanghai,
Integer review_round,
Integer review_state,
Integer allot_atate,
Integer opt_state,
Integer[] film_group_id,
String[] columns);
void export(OutputStream os);
void exportApplyList(ServletOutputStream outputStream);
}
package com.egolm.film.api.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -28,6 +29,30 @@ public class CountryServiceImpl implements CountryService {
return list;
}
@Override
public Map<String, String> queryCountryMap() {
List<Map<String, String>> list = this.queryCountryList();
Map<String, String> countryMap = new HashMap<String, String>();
for(Map<String, String> map : list) {
for(String key : map.keySet()) {
countryMap.put(key, map.get(key));
}
}
return countryMap;
}
@Override
public Map<String, String> queryCountryMapReverse() {
List<Map<String, String>> list = this.queryCountryList();
Map<String, String> countryMap = new HashMap<String, String>();
for(Map<String, String> map : list) {
for(String key : map.keySet()) {
countryMap.put(map.get(key), key);
}
}
return countryMap;
}
public static void main(String[] args) {
System.out.println(JSON.toJSONString(new CountryServiceImpl().queryCountryList()));
}
......
......@@ -420,7 +420,7 @@ public class ReviewServiceImpl implements ReviewService {
asiaNew.setOriginal_name(film.getOrigion_name());
Map<String, Object> fields = new HashMap<String, Object>();
String sql = "select rr.user_group_id, rre.ext_type, rre.ext_name, avg(rre.ext_score) ext_score from fc_review_record rr, fc_review_record_ext rre where rre.record_id = rr.id and rr.review_id = " + review_id + " and rr.review_round = " + review_round + " group by rr.user_group_id, rre.ext_type, rre.ext_name";
String sql = "select rr.user_group_id, rre.ext_type, rre.ext_name, avg(rre.ext_score) ext_score, sum(rre.ext_score) ext_score_sum from fc_review_record rr, fc_review_record_ext rre where rre.record_id = rr.id and rr.review_id = " + review_id + " and rr.review_round = " + review_round + " group by rr.user_group_id, rre.ext_type, rre.ext_name";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
if(list != null && list.size() > 0) {
for(Map<String, Object> map : list) {
......@@ -428,6 +428,7 @@ public class ReviewServiceImpl implements ReviewService {
String ext_type = (String)map.get("ext_type");
String ext_name = (String)map.get("ext_name");
BigDecimal ext_score = BigDecimal.valueOf((Double)map.get("ext_score")).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal ext_score_sum = BigDecimal.valueOf((Double)map.get("ext_score_sum")).setScale(2, BigDecimal.ROUND_HALF_UP);
String setScoreFildName = "item_" + ext_type;
String setDataFieldName = "item_" + ext_type + "_data";
......@@ -452,6 +453,7 @@ public class ReviewServiceImpl implements ReviewService {
Map<String, Object> scoreMap = new HashMap<String, Object>();
scoreMap.put("ext_name", ext_name);
scoreMap.put("ext_score", ext_score);
scoreMap.put("ext_score_sum", ext_score_sum);
datas.add(scoreMap);
}
......
package com.egolm.film.api.web;
import java.util.HashMap;
import java.util.Map;
public class ExportConstant {
public static final Map<String, String> playactorTypes = new HashMap<String, String>();
static {
playactorTypes.put("director", "导演");
playactorTypes.put("producer", "制片人");
playactorTypes.put("screenwriter", "编剧");
playactorTypes.put("photographer", "摄影");
playactorTypes.put("actor", "男演员");
playactorTypes.put("actress", "女演员");
playactorTypes.put("issuser", "发行方");
playactorTypes.put("show", "参加过的电视节");
}
public static final Map<String, String> filmTypes = new HashMap<String, String>();
static {
filmTypes.put("1", "剧情片");
filmTypes.put("2", "纪录片");
filmTypes.put("3", "动画片");
filmTypes.put("4", "短片");
}
public static final Map<String, String> filmShortTypes = new HashMap<String, String>();
static {
filmShortTypes.put("1", "欧洲");
filmShortTypes.put("2", "亚太");
filmShortTypes.put("3", "美非");
filmShortTypes.put("4", "华语");
filmShortTypes.put("5", "纪录片");
filmShortTypes.put("6", "动画片");
filmShortTypes.put("7", "真人短片");
filmShortTypes.put("8", "动画短片");
}
public static final Map<String, String> enrollTypes = new HashMap<String, String>();
static {
enrollTypes.put("1", "金爵奖国际影片评选");
enrollTypes.put("2", "亚洲新人奖国际影片评选");
enrollTypes.put("3", "电影频道传媒关注");
enrollTypes.put("4", "国际电影展映");
}
public static final Map<String, String> enrollOtherTypes = new HashMap<String, String>();
static {
enrollOtherTypes.put("1", "最佳导演");
enrollOtherTypes.put("2", "最佳女演员");
enrollOtherTypes.put("3", "最佳男演员");
enrollOtherTypes.put("4", "最佳编剧");
enrollOtherTypes.put("5", "最佳摄影");
enrollOtherTypes.put("6", "真人短片");
enrollOtherTypes.put("7", "动画短片");
enrollOtherTypes.put("8", "最佳影片");
}
public static final Map<String, String> states = new HashMap<String, String>();
static {
states.put("1", "未提交");
states.put("2", "已提交");
}
public static final Map<String, String> applyStates = new HashMap<String, String>();
static {
applyStates.put("1", "未受理");
applyStates.put("2", "初审通过");
applyStates.put("3", "初审否决");
}
public static final Map<String, String> YN = new HashMap<String, String>();
static {
YN.put("0", "否");
YN.put("1", "是");
}
public static final Map<String, String> filmMedium = new HashMap<String, String>();
static {
filmMedium.put("1", "彩色");
filmMedium.put("2", "黑白");
filmMedium.put("3", "彩色+黑白");
}
public static final Map<String, String> filmFormat = new HashMap<String, String>();
static {
filmFormat.put("1", "移动存储");
filmFormat.put("2", "在线连接");
}
public static final Map<String, String> playShanghai = new HashMap<String, String>();
static {
playShanghai.put("1", "世界首映");
playShanghai.put("2", "国籍首映");
playShanghai.put("3", "亚洲首映");
playShanghai.put("4", "中国首映");
}
}
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;
......@@ -11,6 +15,7 @@ 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;
......@@ -186,4 +191,13 @@ public class FilmController {
return Rjx.jsonOk().set("id", filmBase.getId());
}
@ResponseBody
@PostMapping("exportApplyList")
@ApiOperation("导出报名列表")
public void exportApplyList(HttpServletResponse response) 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());
}
}
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;
......@@ -15,18 +13,15 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
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;
......@@ -63,9 +58,6 @@ public class AdminFirstController {
@Autowired
ReviewService reviewService;
@Autowired
ExportService exportService;
@ResponseBody
@PostMapping("list")
@ApiOperation("影片列表")
......@@ -105,46 +97,6 @@ public class AdminFirstController {
return Rjx.jsonOk().setData(list).setPage(page);
}
@GetMapping("exportExcel")
@ApiOperation("影片列表导出")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="keyword", value="关键字"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="state", value="影片状态 1未提交 2 已提交"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="apply_state", value="初审状态 1未初审 2初审通过 3初审否决"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="film_type", value="影片类型"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="enroll_type", value="影片性质"),
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="film_country", value="影片国家地区"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="film_type_short", value="影片扩展分类"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="upload_state", value="影片文件上传状态(0,1)"),
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="play_shanghai", value="首映情况"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="review_round", value="审片轮数,第几轮审片"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="review_state", value="审片结论 1通过 2否决 3参赛 4参赛备选 5参展"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="allot_atate", value="评委分配状态 0未分配评委 1已分配评委评选中"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="opt_state", value="评选状态 0未评选 1有争议 2管理员分配 3已完成"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="film_group_id", value="影片分组ID"),
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="columns", value="数据导出时导出列" , allowMultiple=true),
})
public void exportExcel(
String keyword, String film_country, String play_shanghai,
Integer state, Integer apply_state, Integer film_type, Integer enroll_type, Integer upload_state, Integer film_type_short,
Integer review_round, Integer review_state, Integer allot_atate, Integer opt_state, Integer[] film_group_id,
String[] columns,
HttpServletRequest request,
HttpServletResponse response) throws IOException {
Fc_admin admin = Util.mapTo(tokenService.getTokenObj(), Fc_admin.class);
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("影片列表[" + DateUtil.format(new Date(), "yyMMdd-HHmmss") + "].xls", "UTF-8"));
exportService.export(response.getOutputStream(), admin.getGroup_id(), keyword, state, apply_state, film_type, enroll_type, upload_state, film_country, film_type_short, play_shanghai, review_round, review_state, allot_atate, opt_state, film_group_id, columns);
}
@Transactional
@ResponseBody
@PostMapping("exportColumns")
@ApiOperation("查看导出列")
public Object exportColumns() {
return Rjx.jsonOk().setData(exportService.getAllTitles(null));
}
@ResponseBody
@Transactional
@PostMapping("pass")
......
package com.egolm.film.config;
public class Constant {
}
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