Commit 0ab6dc74 by jiang'yun

Merge remote-tracking branch 'origin/master'

parents 78717c08 4a1e9b17
......@@ -477,7 +477,7 @@ public class SjGfjsZsdwkhpjController extends BaseController
{
sjGfjsZsdwkhpjZb.setZt("1");
sjGfjsZsdwkhpjZb.setJb("直属单位");
List<SjGfjsZsdwkhpjZb> list = sjGfjsZsdwkhpjZbService.selectSjGfjsZsdwkhpjZbList(sjGfjsZsdwkhpjZb);
List<SjGfjsZsdwkhpjZb> list = sjGfjsZsdwkhpjZbService.selectSjGfjsZsdwkhpjZbList(sjGfjsZsdwkhpjZb);
return getDataTable(list);
}
......@@ -517,5 +517,85 @@ public class SjGfjsZsdwkhpjController extends BaseController
}
//分档结果导出
@PostMapping("/exportFdjg")
public void exportFdjg(HttpServletResponse response, SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb)
{
sjGfjsZsdwkhpjZb.setZt("1");
sjGfjsZsdwkhpjZb.setJb("直属单位");
List<SjGfjsZsdwkhpjZb> list = sjGfjsZsdwkhpjZbService.selectSjGfjsZsdwkhpjZbList(sjGfjsZsdwkhpjZb);
Workbook exl = null;
OutputStream out = null;
InputStream in = null;
try {
in =this.getClass().getResourceAsStream("/static/gfjs_zsdwkhpj_fdjg.xlsx");
exl = WorkbookFactory.create(in);
out = response.getOutputStream();
response.reset();
String filename = URLEncoder.encode("分档结果.xlsx", "UTF-8");
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Disposition", "attachment;filename=" + filename);
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
Sheet sheet = exl.getSheet("Sheet1");
CellStyle cellStyle = exl.createCellStyle();
cellStyle.setWrapText(true);
cellStyle.setAlignment(HorizontalAlignment.LEFT);
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
String deptName="";
int lastRow = sheet.getLastRowNum()+1;
for(SjGfjsZsdwkhpjZb zsdwkhpj:list){
deptName= zsdwkhpj.getDeptName();;
Row row = sheet.createRow(lastRow);
row.setHeightInPoints(18);
int m = 0;
Cell cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getParentName());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getDeptName());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getZqfw());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getJb());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getFdjb());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getPm());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(zsdwkhpj.getDeptLx());
lastRow++;
}
//合并行
mergeCellsByColumn(sheet,0);
mergeCellsByColumn(sheet,1);
sheet.getRow(0).getCell(0).setCellValue(sjGfjsZsdwkhpjZb.getNd()+sjGfjsZsdwkhpjZb.getZqfw()+deptName+"分档结果");
exl.write(out);
exl.close();
}catch (Exception e){
e.getMessage();
throw new BusinessException("导出Excel失败,请联系网站管理员!");
}finally {
if (exl != null) {
try {
exl.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
if (out != null) {
try {
out.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
}
......@@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
zqlx,
jb,
d.dept_dfl,
d.dept_lx,
(select dwlx from sys_dept_cb cb where cb.dept_id = a.dept_id order by cb.nd desc limit 1) dept_lx,
d.dept_ywfl,
djyjzfs,
djyjkfs,
......
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