Commit 66d226c7 authored by Quxl's avatar Quxl

x

parent 2874e2d5
...@@ -418,100 +418,51 @@ public class FilmServiceImpl implements FilmService { ...@@ -418,100 +418,51 @@ public class FilmServiceImpl implements FilmService {
.eq("mf.film_country", film_country) .eq("mf.film_country", film_country)
.eq("mf.play_shanghai", play_shanghai) .eq("mf.play_shanghai", play_shanghai)
; ;
if(StringUtil.isNotBlank(keyword)) {
String lkstr = "%" + keyword + "%";
if(keyword.matches("\\d+")) {
where1.where("(mf.film_no = ? or mf.en_name like ? or mf.cn_name like ? or fp.playactor_name like ?)", new Object[] {Integer.valueOf(keyword), lkstr, lkstr, lkstr});
} else {
where1.lk(new String[]{"mf.en_name", "mf.cn_name", "fp.playactor_name"}, keyword);
}
}
String sql_film = "fc_member_film"; String sql_film = "fc_member_film";
if(StringUtil.isNotBlank(enroll_type_id)) { if(StringUtil.isNotBlank(enroll_type_id)) {
sql_film = "(select mf0.* from fc_member_film mf0, fc_member_film_enroll mfe where mf0.id = mfe.film_id and mfe.enroll_type_id = " + enroll_type_id + ")"; sql_film = "(select mf0.* from fc_member_film mf0, fc_member_film_enroll mfe where mf0.id = mfe.film_id and mfe.enroll_type_id = " + enroll_type_id + ")";
} }
String sql = "" String sql = ""
+ "select " + "select "
+ "mf.id, " + "mf.*, "
+ "mf.film_no, "
+ "mf.en_name, "
+ "mf.cn_name, "
+ "mf.film_type_name, "
+ "mf.film_type_name_short, "
+ "mf.enroll_type_name, "
+ "mf.enroll_type_name_other, "
+ "mf.film_total_time, "
+ "mf.completion_date, "
+ "mf.play_shanghai, "
+ "mf.state, "
+ "mf.apply_state, "
+ "mf.upload_id, "
+ "mf.upload_state, "
+ "mf.film_country, "
+ "mf.member_id, "
+ "mf.admin_creator, "
+ "fg.group_name, " + "fg.group_name, "
+ "r.review_round, " + "r.review_round, "
+ "r.review_state, " + "r.review_state, "
+ "r.allot_state, " + "r.allot_state, "
+ "r.opt_state, " + "r.opt_state, "
+ "group_concat(fp.playactor_name) director_name, "
+ "m.username member_name, " + "m.username member_name, "
+ "a.realname admin_name " + "a.realname admin_name, "
+ "from " + "(select group_concat(fp.playactor_name) from fc_member_film_playactor fp where fp.film_id = mf.id and fp.playactor_type = 'director') director_name "
+ " fc_member_film_playactor fp, " + sql_film + " mf " + "from " + sql_film + " mf "
+ "left join fc_review r on r.film_id = mf.id " + "left join fc_review r on r.film_id = mf.id "
+ "left join fc_film_group fg on fg.id = mf.film_group_id " + "left join fc_film_group fg on fg.id = mf.film_group_id "
+ "left join fc_member m on m.id = mf.member_id " + "left join fc_member m on m.id = mf.member_id "
+ "left join fc_admin a on a.adminid = mf.admin_creator " + "left join fc_admin a on a.adminid = mf.admin_creator "
+ "where " + StringUtil.join(" and ", " where ", " ", " ", where1.getStringList());
+ "mf.id = fp.film_id "
+ "and fp.playactor_type = 'director' "
+ StringUtil.join(" and ", " and ", " ", " ", where1.getStringList())
+ "group by "
+ "mf.id, "
+ "mf.film_no, "
+ "mf.en_name, "
+ "mf.cn_name, "
+ "mf.film_type_name, "
+ "mf.film_type_name_short, "
+ "mf.enroll_type_name, "
+ "mf.enroll_type_name_other, "
+ "mf.film_total_time, "
+ "mf.completion_date, "
+ "mf.play_shanghai, "
+ "mf.state, "
+ "mf.apply_state, "
+ "mf.upload_id, "
+ "mf.upload_state, "
+ "mf.film_country, "
+ "fg.group_name, "
+ "r.review_round, "
+ "r.review_state, "
+ "r.allot_state, "
+ "r.opt_state "
+ "order by mf.film_no";
List<Object> objs = new ArrayList<Object>(); List<Object> objs = new ArrayList<Object>();
Object[] ary1 = where1.getObjectArray(); Object[] ary1 = where1.getObjectArray();
for(Object obj : ary1) { for(Object obj : ary1) {
objs.add(obj); objs.add(obj);
} }
SqlWhere where2 = new SqlWhere() SqlWhere where2 = new SqlWhere()
.eq("t.review_round", review_round) .eq("t.review_round", review_round)
.eq("t.review_state", review_state) .eq("t.review_state", review_state)
.eq("t.allot_atate", allot_atate) .eq("t.allot_atate", allot_atate)
.eq("t.opt_state", opt_state) .eq("t.opt_state", opt_state)
; ;
if(StringUtil.isNotBlank(keyword)) {
String lkstr = "%" + keyword + "%";
if(keyword.matches("\\d+")) {
where2.where("(t.film_no = ? or t.en_name like ? or t.cn_name like ? or t.director_name like ?)", new Object[] {Integer.valueOf(keyword), lkstr, lkstr, lkstr});
} else {
where2.lk(new String[]{"t.en_name", "t.cn_name", "t.director_name"}, keyword);
}
}
sql = "select t.* from (" + sql + ") t" + StringUtil.join(" and ", " where ", " ", " ", where2.getStringList()) + " order by t.film_no desc, t.id desc"; sql = "select t.* from (" + sql + ") t" + StringUtil.join(" and ", " where ", " ", " ", where2.getStringList()) + " order by t.film_no desc, t.id desc";
Object[] ary2 = where2.getObjectArray(); Object[] ary2 = where2.getObjectArray();
for(Object obj : ary2) { for(Object obj : ary2) {
objs.add(obj); objs.add(obj);
} }
return jdbcTemplate.limit(sql, page, objs.toArray()); return jdbcTemplate.limit(sql, page, objs.toArray());
} }
......
package com.egolm.film.api.web.admin; package com.egolm.film.api.web.admin;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -20,7 +16,6 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -20,7 +16,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.egolm.common.DateUtil;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page; import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.AdminTokenService; import com.egolm.film.api.service.AdminTokenService;
...@@ -66,6 +61,7 @@ public class AdminFirstController { ...@@ -66,6 +61,7 @@ public class AdminFirstController {
@ResponseBody @ResponseBody
@PostMapping("list") @PostMapping("list")
@GetMapping("exportExcel")
@ApiOperation("影片列表") @ApiOperation("影片列表")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="keyword", value="关键字"), @ApiImplicitParam(paramType="query", dataType="string", required=false, name="keyword", value="关键字"),
...@@ -128,23 +124,6 @@ public class AdminFirstController { ...@@ -128,23 +124,6 @@ public class AdminFirstController {
return Rjx.jsonOk().setData(exportService.getAllTitles(null)); return Rjx.jsonOk().setData(exportService.getAllTitles(null));
} }
@Transactional
@GetMapping("exportExcel")
@ApiOperation("导出Excel")
@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="string", required=false, name="film_country", value="影片国家地区"),
@ApiImplicitParam(paramType="query", dataType="int", required=false, name="upload_state", value="影片文件上传状态(0,1)"),
})
public void exportExcel(HttpServletResponse response, String keyword, Integer state, Integer apply_state, Integer film_type, Integer upload_state, String film_country, 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.export(response.getOutputStream(), keyword, state, apply_state, film_type, upload_state, film_country, columns);
}
@ResponseBody @ResponseBody
@Transactional @Transactional
@PostMapping("pass") @PostMapping("pass")
......
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