Commit 3a1faaaa authored by Quxl's avatar Quxl

x

parent 1bb54bd6
......@@ -17,4 +17,6 @@ public interface ExportService {
Map<String, String> getReviewPassListColumns();
void exportReviewPassList(ServletOutputStream os, String[] columns, List<Map<String, Object>> list);
void exportPublication(ServletOutputStream os, Integer film_id);
}
package com.egolm.film.api.service.impl;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -8,7 +10,9 @@ import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.egolm.common.ExcelUtil;
......@@ -21,6 +25,7 @@ import com.egolm.film.api.service.CountryService;
import com.egolm.film.api.service.ExportService;
import com.egolm.film.api.service.FilmService;
import com.egolm.film.api.service.LanguageService;
import com.egolm.film.config.XRException;
@Service
public class ExportServiceImpl implements ExportService {
......@@ -535,4 +540,30 @@ public class ExportServiceImpl implements ExportService {
}
ExcelUtil.excel(os, columnList.toArray(new String[columnList.size()]), titleList.toArray(new String[titleList.size()]), null, list);
}
@Value("${template.publication.path}")
private String publicationPath;
@Override
public void exportPublication(ServletOutputStream os, Integer film_id) {
HSSFWorkbook wb = null;
FileInputStream fis =null;
try {
fis = new FileInputStream(publicationPath);
wb = new HSSFWorkbook(fis);
//TODO 在这里修改单元格内容
wb.write(os);
fis.close();
} catch (Exception e) {
throw new XRException("会刊导出失败");
}finally{
try {
if(fis != null) {
fis.close();
}
} catch (IOException e) {
throw new XRException("模板读取失败");
}
}
}
}
......@@ -115,12 +115,13 @@ public class FilmGroupServiceImpl implements FilmGroupService {
String sql = ""
+ "select "
+ "t.*, "
+ "fg.group_name, "
+ "r.id review_id, "
+ "r.review_state, "
+ "r.review_round, "
+ "r.opt_state "
+ "from "
+ "" + table + " t, fc_review r where r.film_id = t.id and r.opt_state = 3 and r.review_state != 2 and t.film_group_id is not null and t.film_group_id != 0 and (t.not_invite is null or t.not_invite = 0) " + StringUtil.join(" and ", " and ", "", "", wehre.getStringList());
+ "" + table + " t left join fc_film_group fg on fg.id = t.group_id, fc_review r where r.film_id = t.id and r.opt_state = 3 and r.review_state != 2 and t.film_group_id is not null and t.film_group_id != 0 and (t.not_invite is null or t.not_invite = 0) " + StringUtil.join(" and ", " and ", "", "", wehre.getStringList());
return jdbcTemplate.limit(sql, page, wehre.getObjectArray());
}
......
......@@ -17,12 +17,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.ExportService;
import com.egolm.film.api.service.FilmGroupService;
import com.egolm.film.api.service.FilmService;
import com.egolm.film.bean.Fc_film_group;
import com.egolm.film.bean.Fc_member_film;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -40,6 +43,9 @@ public class FilmGroupController {
@Autowired
ExportService exportService;
@Autowired
FilmService filmService;
@Autowired
JdbcTemplate jdbcTemplate;
......@@ -95,6 +101,16 @@ public class FilmGroupController {
exportService.exportReviewPassList(response.getOutputStream(), columns, list);
}
@GetMapping("exportPublication")
@ApiOperation("导出会刊")
public void exportPublication(Integer film_id, HttpServletResponse response) throws IOException {
Fc_member_film film = filmService.queryMemberFilmById(film_id.longValue());
String filmNoString = StringUtil.formatLength(film.getFilm_no(), "0000");
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("会刊[" + filmNoString + "].xls", "UTF-8"));
exportService.exportPublication(response.getOutputStream(), film_id);
}
@ResponseBody
@PostMapping("getNotInviteList")
@ApiOperation("查询移除列表(不邀请)")
......
......@@ -18,6 +18,8 @@ com.egolm.film.email.smtp.from=filmpassword@siff.com
com.egolm.film.email.smtp.username=filmpassword@siff.com
com.egolm.film.email.smtp.password=siffstvf2018
template.publication.path=/data/etc/template/publication.xlsx
spring.datasource.url=jdbc:mysql://10.10.0.111:3306/mv?useSSL=false&useUnicode=true&characterEncoding=utf8
spring.datasource.username=root
......
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