|
@@ -1,11 +1,23 @@
|
|
package com.xt.jygl.ggfwxxgl.hxhbgl.service.impl;
|
|
package com.xt.jygl.ggfwxxgl.hxhbgl.service.impl;
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
|
+
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import com.xt.jygl.common.ExportUtil;
|
|
import com.xt.jygl.common.service.JyglBaseService;
|
|
import com.xt.jygl.common.service.JyglBaseService;
|
|
import com.xt.jygl.ggfwxxgl.hxhbgl.entity.HxhbglEntity;
|
|
import com.xt.jygl.ggfwxxgl.hxhbgl.entity.HxhbglEntity;
|
|
import com.xt.jygl.ggfwxxgl.hxhbgl.service.HxhbglService;
|
|
import com.xt.jygl.ggfwxxgl.hxhbgl.service.HxhbglService;
|
|
|
|
+import com.xt.jygl.ggfwxxgl.hxhbgl.vo.HxhbglVo;
|
|
import com.xtframe.sec.common.SecRepository;
|
|
import com.xtframe.sec.common.SecRepository;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -19,5 +31,119 @@ public class HxhbglServiceImpl extends JyglBaseService<HxhbglEntity, String> imp
|
|
// TODO Auto-generated method stub
|
|
// TODO Auto-generated method stub
|
|
return this.dao;
|
|
return this.dao;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void exportExcelAll(List<HxhbglVo> voList, String[] titles, ServletOutputStream outputStream) {
|
|
|
|
+ // 创建一个workbook 对应一个excel应用文件
|
|
|
|
+ XSSFWorkbook workBook = new XSSFWorkbook();
|
|
|
|
+ // 在workbook中添加一个sheet,对应Excel文件中的sheet
|
|
|
|
+ XSSFSheet sheet = workBook.createSheet("航线航班管理信息");
|
|
|
|
+ ExportUtil exportUtil = new ExportUtil(workBook, sheet);
|
|
|
|
+ XSSFCellStyle headStyle = exportUtil.getHeadStyle();
|
|
|
|
+ XSSFCellStyle bodyStyle = exportUtil.getBodyStyle();
|
|
|
|
+ // 构建表头
|
|
|
|
+ XSSFRow headRow = sheet.createRow(0);
|
|
|
|
+ XSSFCell cell = null;
|
|
|
|
+ for (int i = 0; i < titles.length; i++) {
|
|
|
|
+ cell = headRow.createCell(i);
|
|
|
|
+ cell.setCellStyle(headStyle);
|
|
|
|
+ cell.setCellValue(titles[i]);
|
|
|
|
+ }
|
|
|
|
+ // 构建表体数据
|
|
|
|
+ if (voList != null && voList.size() > 0) {
|
|
|
|
+ for (int j = 0; j < voList.size(); j++) {
|
|
|
|
+ XSSFRow bodyRow = sheet.createRow(j + 1);
|
|
|
|
+ HxhbglVo vo = voList.get(j);
|
|
|
|
+ // 序号
|
|
|
|
+ cell = bodyRow.createCell(0);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(j + 1);
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(1);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getSsjyrzw());
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(2);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getSsgkglbmzw());
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(3);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getRq());
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(4);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getNmjzxttl() != null ? vo.getNmjzxttl().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(5);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getWmjzxttl() != null ? vo.getWmjzxttl().toString() : "");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(6);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getYyhxts() != null ? vo.getYyhxts().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(7);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getYyhxhbs() != null ? vo.getYyhxhbs().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(8);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getYyhxbz() != null ? vo.getYyhxbz().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(9);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getJyhxts() != null ? vo.getJyhxts().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(10);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getJyhxhbs() != null ? vo.getJyhxhbs().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(11);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getJyhxbz() != null ? vo.getJyhxbz().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(12);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getNzxts() != null ? vo.getNzxts().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(13);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getNzxhbs() != null ? vo.getNzxhbs().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(14);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getNzxbz() != null ? vo.getNzxbz().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(15);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getNmhxts() != null ? vo.getNmhxts().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(16);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getNmhxhbs() != null ? vo.getNmhxhbs().toString() : "");
|
|
|
|
+
|
|
|
|
+ cell = bodyRow.createCell(17);
|
|
|
|
+ cell.setCellStyle(bodyStyle);
|
|
|
|
+ cell.setCellValue(vo.getNmhxbz() != null ? vo.getNmhxbz().toString() : "");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ workBook.write(outputStream);
|
|
|
|
+ outputStream.flush();
|
|
|
|
+ outputStream.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ try {
|
|
|
|
+ outputStream.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|