|
@@ -0,0 +1,247 @@
|
|
|
|
+package com.jeeplus.modules.sg.managementcenter.reserveManagement.utils;
|
|
|
|
+
|
|
|
|
+import com.jeeplus.modules.sg.managementcenter.reserveManagement.entity.ReserveManagement;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
+import org.apache.poi.ss.usermodel.Row;
|
|
|
|
+import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
+
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.io.*;
|
|
|
|
+import java.net.URLEncoder;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+public class ReserveExportUtil {
|
|
|
|
+
|
|
|
|
+ private XSSFCellStyle style = null;
|
|
|
|
+
|
|
|
|
+ public static ReserveExportUtil getOne(){
|
|
|
|
+
|
|
|
|
+ return new ReserveExportUtil();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 传入excel模板名称 获取workbook对象
|
|
|
|
+ * @param fileName excel模板名称
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public XSSFWorkbook getWorkbook(String fileName){
|
|
|
|
+ InputStream inputStream = null;
|
|
|
|
+ XSSFWorkbook workbook = null;
|
|
|
|
+ try {
|
|
|
|
+ File file = new File(this.getClass().getResource("/").getPath() + "/freemarker/excelmodel/"+fileName+".xlsx");
|
|
|
|
+ inputStream = new FileInputStream(file);// 将excel文件转为输入流
|
|
|
|
+ workbook = new XSSFWorkbook(inputStream);// 创建个workbook,
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return workbook;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 导出前期基本信息
|
|
|
|
+ * @param response
|
|
|
|
+ * @param workbook
|
|
|
|
+ * @param list
|
|
|
|
+ */
|
|
|
|
+ public void exportBasic(HttpServletResponse response, XSSFWorkbook workbook, List<ReserveManagement> list){
|
|
|
|
+ try {
|
|
|
|
+ int index = 1;//第一列序号
|
|
|
|
+ int rowNum = 6;//数据起始列
|
|
|
|
+ Sheet sheet = workbook.getSheetAt(0);
|
|
|
|
+ for(int i=0;i<list.size();i++){
|
|
|
|
+ Row row = sheet.createRow(rowNum+i);
|
|
|
|
+ Cell cell0 = crateCell(workbook,row,0); //序号
|
|
|
|
+ Cell cell1 = crateCell(workbook,row,1); //项目性质
|
|
|
|
+ Cell cell2 = crateCell(workbook,row,2); //需求单位
|
|
|
|
+ Cell cell3 = crateCell(workbook,row,3); //区域
|
|
|
|
+ Cell cell4 = crateCell(workbook,row,4); //项目分组
|
|
|
|
+ Cell cell5 = crateCell(workbook,row,5); //储备批次
|
|
|
|
+ Cell cell6 = crateCell(workbook,row,6); //供电区域
|
|
|
|
+ Cell cell7 = crateCell(workbook,row,7); //网格编号
|
|
|
|
+ Cell cell8 = crateCell(workbook,row,8); //单元格编号
|
|
|
|
+ Cell cell9 = crateCell(workbook,row,9); //项目储备编号
|
|
|
|
+ Cell cell10 = crateCell(workbook,row,10); //电网项目编号
|
|
|
|
+ Cell cell11 = crateCell(workbook,row,11); //项目名称
|
|
|
|
+ Cell cell12 = crateCell(workbook,row,12); //建设必要性及内容
|
|
|
|
+ Cell cell13 = crateCell(workbook,row,13); //变电站名称
|
|
|
|
+ Cell cell14 = crateCell(workbook,row,14); //线路名称
|
|
|
|
+ Cell cell15 = crateCell(workbook,row,15); //网架项目划分
|
|
|
|
+ Cell cell16 = crateCell(workbook,row,16); //项目类型
|
|
|
|
+ Cell cell17 = crateCell(workbook,row,17); //费用估算
|
|
|
|
+ Cell cell18 = crateCell(workbook,row,18); //是否迎峰度夏项目
|
|
|
|
+ Cell cell19 = crateCell(workbook,row,19); //项目紧急程度
|
|
|
|
+ Cell cell20 = crateCell(workbook,row,20); //拟实施下达年份
|
|
|
|
+ Cell cell21 = crateCell(workbook,row,21); //拟实施批次
|
|
|
|
+ Cell cell22 = crateCell(workbook,row,22); //备注
|
|
|
|
+ Cell cell23 = crateCell(workbook,row,23); //设计状态
|
|
|
|
+ Cell cell24 = crateCell(workbook,row,24); //是否通过省公司评审
|
|
|
|
+ Cell cell25 = crateCell(workbook,row,25); //是否需提交路径图
|
|
|
|
+ Cell cell26 = crateCell(workbook,row,26); //是否完成物资清册编制
|
|
|
|
+ Cell cell27 = crateCell(workbook,row,27); //是否完成图纸移交
|
|
|
|
+ Cell cell28 = crateCell(workbook,row,28); //交底牵头部门
|
|
|
|
+ Cell cell29 = crateCell(workbook,row,29); //交底参与部门
|
|
|
|
+ Cell cell30 = crateCell(workbook,row,30); //是否完成交底
|
|
|
|
+ Cell cell31 = crateCell(workbook,row,31); //项目管理中心人员
|
|
|
|
+ Cell cell32 = crateCell(workbook,row,32); //设计院人员
|
|
|
|
+ Cell cell33 = crateCell(workbook,row,33); //经研所人员
|
|
|
|
+ Cell cell34 = crateCell(workbook,row,34); //区域中心人员
|
|
|
|
+ Cell cell35 = crateCell(workbook,row,35); //不停电作业中心人员
|
|
|
|
+ Cell cell36 = crateCell(workbook,row,36); //作业方式
|
|
|
|
+ Cell cell37 = crateCell(workbook,row,37); //交底完成日期
|
|
|
|
+ Cell cell38 = crateCell(workbook,row,38); //备注
|
|
|
|
+ Cell cell39 = crateCell(workbook,row,39); //立项说明
|
|
|
|
+ Cell cell40 = crateCell(workbook,row,40); //不具备立项条件说明
|
|
|
|
+ Cell cell41 = crateCell(workbook,row,41); //方案变更说明
|
|
|
|
+ Cell cell42 = crateCell(workbook,row,42); //政处难度初判
|
|
|
|
+ Cell cell43 = crateCell(workbook,row,43); //是否有资本设备
|
|
|
|
+ Cell cell44 = crateCell(workbook,row,44); //是否有变电站新出线
|
|
|
|
+ Cell cell45 = crateCell(workbook,row,45); //是否已实施
|
|
|
|
+ Cell cell46 = crateCell(workbook,row,46); //现场情况描述
|
|
|
|
+ Cell cell47 = crateCell(workbook,row,47); //是否有实施必要性
|
|
|
|
+ Cell cell48 = crateCell(workbook,row,48); //实施无必要描述
|
|
|
|
+ Cell cell49 = crateCell(workbook,row,49); //是否存在前置条件
|
|
|
|
+ Cell cell50 = crateCell(workbook,row,50); //前置条件描述
|
|
|
|
+ Cell cell51= crateCell(workbook,row,51); //是否存在施工方案问题
|
|
|
|
+ Cell cell52 = crateCell(workbook,row,52); //施工方案问题描述
|
|
|
|
+ Cell cell53 = crateCell(workbook,row,53); //现场是否存在安全隐患
|
|
|
|
+ Cell cell54 = crateCell(workbook,row,54); //安全隐患描述
|
|
|
|
+ Cell cell55 = crateCell(workbook,row,55); //是否需要定制物资
|
|
|
|
+ Cell cell56 = crateCell(workbook,row,56); //定制物资描述
|
|
|
|
+ Cell cell57 = crateCell(workbook,row,57); //是否有拆旧物资
|
|
|
|
+ Cell cell58 = crateCell(workbook,row,58); //作业方式
|
|
|
|
+ Cell cell59 = crateCell(workbook,row,59); //停电问题描述
|
|
|
|
+ Cell cell60 = crateCell(workbook,row,60); //是否有土建工作量
|
|
|
|
+ Cell cell61 = crateCell(workbook,row,61); //是否有立杆工作量
|
|
|
|
+ Cell cell62 = crateCell(workbook,row,62); //总工作量描述
|
|
|
|
+ Cell cell63 = crateCell(workbook,row,63); //区域中心
|
|
|
|
+ Cell cell64 = crateCell(workbook,row,64); //供电所辖区
|
|
|
|
+ Cell cell65 = crateCell(workbook,row,65); //政处地点
|
|
|
|
+ Cell cell66 = crateCell(workbook,row,66); //政处类型
|
|
|
|
+ Cell cell67 = crateCell(workbook,row,67); //政处对象
|
|
|
|
+ Cell cell68 = crateCell(workbook,row,68); //政处描述
|
|
|
|
+ Cell cell69 = crateCell(workbook,row,69); //是否需规划报批
|
|
|
|
+ Cell cell70 = crateCell(workbook,row,70); //是否需办理安评航评手续
|
|
|
|
+ Cell cell71 = crateCell(workbook,row,71); //政处难点提醒
|
|
|
|
+
|
|
|
|
+ ReserveManagement reserveManagement = list.get(i);
|
|
|
|
+
|
|
|
|
+ cell0.setCellValue(String.valueOf(index++));
|
|
|
|
+ cell1.setCellValue(reserveManagement.getProjectNature());
|
|
|
|
+ cell2.setCellValue(reserveManagement.getDemandUnit());
|
|
|
|
+ cell3.setCellValue(reserveManagement.getDistrict());
|
|
|
|
+ cell4.setCellValue(reserveManagement.getProjectGroup());
|
|
|
|
+ cell5.setCellValue(reserveManagement.getReserveBatches());
|
|
|
|
+ cell6.setCellValue(reserveManagement.getBlockSupply());
|
|
|
|
+ cell7.setCellValue(reserveManagement.getGridNumber());
|
|
|
|
+ cell8.setCellValue(reserveManagement.getCellNumber());
|
|
|
|
+ cell9.setCellValue(reserveManagement.getProjectReserveId());
|
|
|
|
+ cell10.setCellValue(reserveManagement.getPowerGridProjectId());
|
|
|
|
+ cell11.setCellValue(reserveManagement.getProjectName());
|
|
|
|
+ cell12.setCellValue(reserveManagement.getConstructionNecessityAndContent());
|
|
|
|
+ cell13.setCellValue(reserveManagement.getSubstationName());
|
|
|
|
+ cell14.setCellValue(reserveManagement.getCircuitName());
|
|
|
|
+ cell15.setCellValue(reserveManagement.getNetRackProjectDivide());
|
|
|
|
+ cell16.setCellValue(reserveManagement.getProjectType());
|
|
|
|
+
|
|
|
|
+ String costEstimateStr= reserveManagement.getCostEstimate().toString();
|
|
|
|
+ if(StringUtils.isNotBlank(costEstimateStr)){
|
|
|
|
+ cell17.setCellValue(Double.parseDouble(costEstimateStr));
|
|
|
|
+ }else{
|
|
|
|
+ cell37.setCellValue("");
|
|
|
|
+ }
|
|
|
|
+ cell18.setCellValue(reserveManagement.getWhetherWindwardProject());
|
|
|
|
+ cell19.setCellValue(reserveManagement.getProjectUrgencyDegree());
|
|
|
|
+ cell20.setCellValue(reserveManagement.getImplementIssuedYear());
|
|
|
|
+ cell21.setCellValue(reserveManagement.getImplementBatch());
|
|
|
|
+ cell22.setCellValue(reserveManagement.getBasicRemarks());
|
|
|
|
+ cell23.setCellValue(reserveManagement.getDesignCondition());
|
|
|
|
+ cell24.setCellValue(reserveManagement.getWhetherPassReview());
|
|
|
|
+ cell25.setCellValue(reserveManagement.getWhetherNeedWiringDiagram());
|
|
|
|
+ cell26.setCellValue(reserveManagement.getWhetherFinishMaterials());
|
|
|
|
+ cell27.setCellValue(reserveManagement.getWhetherFinishDrawing());
|
|
|
|
+ cell28.setCellValue(reserveManagement.getDisclosureToCoordinate());
|
|
|
|
+ cell29.setCellValue(reserveManagement.getDisclosureParticipate());
|
|
|
|
+ cell30.setCellValue(reserveManagement.getWhetherFinishDisclosure());
|
|
|
|
+ cell31.setCellValue(reserveManagement.getProjectManagementPeople());
|
|
|
|
+ cell32.setCellValue(reserveManagement.getDesigningInstitutePeople());
|
|
|
|
+ cell33.setCellValue(reserveManagement.getIfoPeople());
|
|
|
|
+ cell34.setCellValue(reserveManagement.getRegionalCenterPeople());
|
|
|
|
+ cell35.setCellValue(reserveManagement.getUninterruptedOperationPeople());
|
|
|
|
+ cell36.setCellValue(reserveManagement.getWorkMode());
|
|
|
|
+
|
|
|
|
+ String dateStr = reserveManagement.getDisclosureFinishDateStr();
|
|
|
|
+ if(StringUtils.isNotBlank(dateStr)){
|
|
|
|
+ cell37.setCellValue(dateStr);
|
|
|
|
+ }else{
|
|
|
|
+ cell37.setCellValue("");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ cell38.setCellValue(reserveManagement.getDisclosureRemarks());
|
|
|
|
+ cell39.setCellValue(reserveManagement.getProjectDescription());
|
|
|
|
+ cell40.setCellValue(reserveManagement.getDoNotPossessProjectDescription());
|
|
|
|
+ cell41.setCellValue(reserveManagement.getChangedProgramsExplain());
|
|
|
|
+ cell42.setCellValue(reserveManagement.getInitialDifficulty());
|
|
|
|
+ cell43.setCellValue(reserveManagement.getCapitalEquipment());
|
|
|
|
+ cell44.setCellValue(reserveManagement.getSubstationNewLine());
|
|
|
|
+ cell45.setCellValue(reserveManagement.getWhetherImplement());
|
|
|
|
+ cell46.setCellValue(reserveManagement.getFieldDescription());
|
|
|
|
+ cell47.setCellValue(reserveManagement.getNecessaryOfImplementation());
|
|
|
|
+ cell48.setCellValue(reserveManagement.getUnnecessaryDescription());
|
|
|
|
+ cell49.setCellValue(reserveManagement.getPrecondition());
|
|
|
|
+ cell50.setCellValue(reserveManagement.getConditionsDescribed());
|
|
|
|
+ cell51.setCellValue(reserveManagement.getConstructionSchemeProblem());
|
|
|
|
+ cell52.setCellValue(reserveManagement.getProblemDescriptionOfConstructionScheme());
|
|
|
|
+ cell53.setCellValue(reserveManagement.getExistingSecurityThreat());
|
|
|
|
+ cell54.setCellValue(reserveManagement.getSafetyHazardDescription());
|
|
|
|
+ cell55.setCellValue(reserveManagement.getCustomizedMaterials());
|
|
|
|
+ cell56.setCellValue(reserveManagement.getMaterialDescription());
|
|
|
|
+ cell57.setCellValue(reserveManagement.getDismantlingTheOldMaterial());
|
|
|
|
+ cell58.setCellValue(reserveManagement.getOperatingType());
|
|
|
|
+ cell59.setCellValue(reserveManagement.getProblemDescription());
|
|
|
|
+ cell60.setCellValue(reserveManagement.getCivilWork());
|
|
|
|
+ cell61.setCellValue(reserveManagement.getVerticalRodWorkload());
|
|
|
|
+ cell62.setCellValue(reserveManagement.getTotalWorkloadDescription());
|
|
|
|
+ cell63.setCellValue(reserveManagement.getRegionalCenter());
|
|
|
|
+ cell64.setCellValue(reserveManagement.getPowerSupplyArea());
|
|
|
|
+ cell65.setCellValue(reserveManagement.getZhengLocation());
|
|
|
|
+ cell66.setCellValue(reserveManagement.getZhengType());
|
|
|
|
+ cell67.setCellValue(reserveManagement.getZhengObject());
|
|
|
|
+ cell68.setCellValue(reserveManagement.getZhengDescribe());
|
|
|
|
+ cell69.setCellValue(reserveManagement.getProjectApproval());
|
|
|
|
+ cell70.setCellValue(reserveManagement.getCourseEvaluationProcedures());
|
|
|
|
+ cell71.setCellValue(reserveManagement.getZhengDifficultyWarn());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String str = URLEncoder.encode("镇江本部配网项目储备清单.xlsx", "UTF8");
|
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename="+str);
|
|
|
|
+ response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
|
+ workbook.write(outputStream);
|
|
|
|
+ outputStream.flush();
|
|
|
|
+ outputStream.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 创建Cell对象 同时设置style
|
|
|
|
+ * @param workbook
|
|
|
|
+ * @param row
|
|
|
|
+ * @param num
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ Cell crateCell(XSSFWorkbook workbook,Row row, int num){
|
|
|
|
+ Cell cell = row.createCell(num);
|
|
|
|
+ if(style == null){
|
|
|
|
+ style =workbook.createCellStyle();
|
|
|
|
+ style.setWrapText(true);
|
|
|
|
+ style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
|
|
|
|
+ }
|
|
|
|
+ cell.setCellStyle(style);
|
|
|
|
+ return cell;
|
|
|
|
+ }
|
|
|
|
+}
|