Commit c1e98ab7 authored by liboyang's avatar liboyang

push

parent 48d3fa8f
package com.yxproject.start.utils; //package com.yxproject.start.utils;
//
import com.yxproject.start.entity.PersonPostAbnormalEntity; //import com.yxproject.start.entity.PersonPostAbnormalEntity;
import com.yxproject.start.entity.PersonalProgressStatusEntity; //import com.yxproject.start.entity.PersonalProgressStatusEntity;
import com.yxproject.start.entity.RedoRegistrationEntity; //import com.yxproject.start.entity.RedoRegistrationEntity;
import com.yxproject.start.entity.TemporaryCertificateEntity; //import com.yxproject.start.entity.TemporaryCertificateEntity;
import org.apache.poi.hssf.usermodel.*; //import org.apache.poi.hssf.usermodel.*;
//
import java.io.FileOutputStream; //import java.io.FileOutputStream;
import java.io.IOException; //import java.io.IOException;
import java.text.SimpleDateFormat; //import java.text.SimpleDateFormat;
import java.util.Date; //import java.util.Date;
import java.util.List; //import java.util.List;
//
import static java.lang.Integer.parseInt; //import static java.lang.Integer.parseInt;
import static java.lang.Integer.valueOf; //import static java.lang.Integer.valueOf;
//
/** ///**
* @auther zhangyusheng // * @auther zhangyusheng
* 2019/2/12 15:44 // * 2019/2/12 15:44
*/ // */
public class ExportExcel { //public class ExportExcel {
/** // /**
* 导出错误邮寄信息 // * 导出错误邮寄信息
* @param personPostAbnormalEntities // * @param personPostAbnormalEntities
* @return // * @return
*/ // */
public static String exportPersonPostAbnormalExcel(List<PersonPostAbnormalEntity> personPostAbnormalEntities){ // public static String exportPersonPostAbnormalExcel(List<PersonPostAbnormalEntity> personPostAbnormalEntities){
//第一步创建workbook // //第一步创建workbook
HSSFWorkbook wb = new HSSFWorkbook(); // HSSFWorkbook wb = new HSSFWorkbook();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
HSSFSheet sheet = wb.createSheet("邮寄信息错误信息表"); // HSSFSheet sheet = wb.createSheet("邮寄信息错误信息表");
sheet.setColumnWidth(0, 30 * 100); // sheet.setColumnWidth(0, 30 * 100);
sheet.setColumnWidth(1, 30 * 70); // sheet.setColumnWidth(1, 30 * 70);
sheet.setColumnWidth(2, 30 * 80); // sheet.setColumnWidth(2, 30 * 80);
sheet.setColumnWidth(3, 30 * 50); // sheet.setColumnWidth(3, 30 * 50);
sheet.setColumnWidth(4, 30 * 110); // sheet.setColumnWidth(4, 30 * 110);
sheet.setColumnWidth(5, 30 * 110); // sheet.setColumnWidth(5, 30 * 110);
sheet.setColumnWidth(6, 30 * 110); // sheet.setColumnWidth(6, 30 * 110);
sheet.setColumnWidth(7, 30 * 110); // sheet.setColumnWidth(7, 30 * 110);
sheet.setColumnWidth(8, 30 * 110); // sheet.setColumnWidth(8, 30 * 110);
sheet.setColumnWidth(9, 30 * 110); // sheet.setColumnWidth(9, 30 * 110);
sheet.setColumnWidth(10, 30 * 110); // sheet.setColumnWidth(10, 30 * 110);
sheet.setColumnWidth(11, 30 * 110); // sheet.setColumnWidth(11, 30 * 110);
sheet.setColumnWidth(12, 30 * 110); // sheet.setColumnWidth(12, 30 * 110);
sheet.setColumnWidth(13, 30 * 110); // sheet.setColumnWidth(13, 30 * 110);
sheet.setColumnWidth(14, 30 * 110); // sheet.setColumnWidth(14, 30 * 110);
sheet.setColumnWidth(15, 30 * 110); // sheet.setColumnWidth(15, 30 * 110);
sheet.setColumnWidth(16, 30 * 110); // sheet.setColumnWidth(16, 30 * 110);
sheet.setColumnWidth(17, 30 * 110); // sheet.setColumnWidth(17, 30 * 110);
sheet.setColumnWidth(18, 30 * 110); // sheet.setColumnWidth(18, 30 * 110);
sheet.setColumnWidth(19, 30 * 110); // sheet.setColumnWidth(19, 30 * 110);
sheet.setColumnWidth(20, 30 * 110); // sheet.setColumnWidth(20, 30 * 110);
sheet.setColumnWidth(21, 30 * 110); // sheet.setColumnWidth(21, 30 * 110);
sheet.setColumnWidth(22, 30 * 110); // sheet.setColumnWidth(22, 30 * 110);
sheet.setColumnWidth(23, 30 * 110); // sheet.setColumnWidth(23, 30 * 110);
sheet.setColumnWidth(24, 30 * 110); // sheet.setColumnWidth(24, 30 * 110);
//第三步创建行row:添加表头0行 // //第三步创建行row:添加表头0行
HSSFRow row = sheet.createRow(0); // HSSFRow row = sheet.createRow(0);
HSSFCellStyle style = wb.createCellStyle();//样式 // HSSFCellStyle style = wb.createCellStyle();//样式
style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中 // style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中
style.setAlignment(HSSFCellStyle.ALIGN_LEFT); // style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
style.setWrapText(true);//设置自动换行 // style.setWrapText(true);//设置自动换行
HSSFFont font = wb.createFont(); // HSSFFont font = wb.createFont();
font.setFontHeightInPoints((short) 12); // font.setFontHeightInPoints((short) 12);
style.setFont(font); // style.setFont(font);
row = sheet.createRow(0); //创建下标为0的单元格 // row = sheet.createRow(0); //创建下标为0的单元格
row.setHeightInPoints(Short.parseShort("20"));//设置行高 // row.setHeightInPoints(Short.parseShort("20"));//设置行高
HSSFCell cell = row.createCell(0); //设定值 // HSSFCell cell = row.createCell(0); //设定值
cell.setCellValue("邮件号"); // cell.setCellValue("邮件号");
cell = row.createCell(1); //设定值 // cell = row.createCell(1); //设定值
cell.setCellValue("反邮件号"); // cell.setCellValue("反邮件号");
cell = row.createCell(2); //设定值 // cell = row.createCell(2); //设定值
cell.setCellValue("订单号"); // cell.setCellValue("订单号");
cell = row.createCell(3); //设定值 // cell = row.createCell(3); //设定值
cell.setCellValue("订单生成时间"); // cell.setCellValue("订单生成时间");
cell = row.createCell(4); //设定值 // cell = row.createCell(4); //设定值
cell.setCellValue("openid"); // cell.setCellValue("openid");
cell = row.createCell(5); //设定值 // cell = row.createCell(5); //设定值
cell.setCellValue("微信支付订单号"); // cell.setCellValue("微信支付订单号");
cell = row.createCell(6); //设定值 // cell = row.createCell(6); //设定值
cell.setCellValue("支付状态"); // cell.setCellValue("支付状态");
cell = row.createCell(7); //设定值 // cell = row.createCell(7); //设定值
cell.setCellValue("订单状态"); // cell.setCellValue("订单状态");
cell = row.createCell(8); //设定值 // cell = row.createCell(8); //设定值
cell.setCellValue("申请人姓名"); // cell.setCellValue("申请人姓名");
cell = row.createCell(9); //设定值 // cell = row.createCell(9); //设定值
cell.setCellValue("寄件人姓名"); // cell.setCellValue("寄件人姓名");
cell = row.createCell(10); //设定值 // cell = row.createCell(10); //设定值
cell.setCellValue("寄件人联系方式"); // cell.setCellValue("寄件人联系方式");
cell = row.createCell(1); //设定值 // cell = row.createCell(1); //设定值
cell.setCellValue("寄件人地址"); // cell.setCellValue("寄件人地址");
cell = row.createCell(11); //设定值 // cell = row.createCell(11); //设定值
cell.setCellValue("收件人姓名"); // cell.setCellValue("收件人姓名");
cell = row.createCell(12); //设定值 // cell = row.createCell(12); //设定值
cell.setCellValue("收件人联系方式"); // cell.setCellValue("收件人联系方式");
cell = row.createCell(13); //设定值 // cell = row.createCell(13); //设定值
cell.setCellValue("收件人地址"); // cell.setCellValue("收件人地址");
cell = row.createCell(14); //设定值 // cell = row.createCell(14); //设定值
cell.setCellValue("配货单号"); // cell.setCellValue("配货单号");
cell = row.createCell(15); //设定值 // cell = row.createCell(15); //设定值
cell.setCellValue("到件省/直辖市"); // cell.setCellValue("到件省/直辖市");
cell = row.createCell(16); //设定值 // cell = row.createCell(16); //设定值
cell.setCellValue("到件城市"); // cell.setCellValue("到件城市");
cell = row.createCell(17); //设定值 // cell = row.createCell(17); //设定值
cell.setCellValue("到件县/区"); // cell.setCellValue("到件县/区");
cell = row.createCell(18); //设定值 // cell = row.createCell(18); //设定值
cell.setCellValue("业务类型"); // cell.setCellValue("业务类型");
cell = row.createCell(19); //设定值 // cell = row.createCell(19); //设定值
cell.setCellValue("格口信息"); // cell.setCellValue("格口信息");
cell = row.createCell(20); //设定值 // cell = row.createCell(20); //设定值
cell.setCellValue("内件性质"); // cell.setCellValue("内件性质");
cell = row.createCell(21); //设定值 // cell = row.createCell(21); //设定值
cell.setCellValue("内件信息"); // cell.setCellValue("内件信息");
cell = row.createCell(22); //设定值 // cell = row.createCell(22); //设定值
cell.setCellValue("留白一"); // cell.setCellValue("留白一");
cell = row.createCell(23); //设定值 // cell = row.createCell(23); //设定值
cell.setCellValue("错误代码"); // cell.setCellValue("错误代码");
cell = row.createCell(24); //设定值
cell.setCellValue("检查日期");
for (int i =0;i<personPostAbnormalEntities.size();i++){
PersonPostAbnormalEntity personPostAbnormalEntity = personPostAbnormalEntities.get(i);
row = sheet.createRow(i + 1);
cell = row.createCell(0); //设定值
cell.setCellValue(personPostAbnormalEntity.getWaybillNumber());
cell = row.createCell(1); //设定值
cell.setCellValue(personPostAbnormalEntity.getBackWaybillNumber());
cell = row.createCell(2); //设定值
cell.setCellValue(personPostAbnormalEntity.getOrderNumber());
cell = row.createCell(3); //设定值
cell.setCellValue(personPostAbnormalEntity.getCreateDate());
cell = row.createCell(4); //设定值
cell.setCellValue(personPostAbnormalEntity.getOpenid());
cell = row.createCell(5); //设定值
cell.setCellValue(personPostAbnormalEntity.getWcPlayOrderNumber());
cell = row.createCell(6); //设定值
cell.setCellValue(personPostAbnormalEntity.getPlayState());
cell = row.createCell(7); //设定值
cell.setCellValue(personPostAbnormalEntity.getOrderState());
cell = row.createCell(8); //设定值
cell.setCellValue(personPostAbnormalEntity.getApplicantName());
cell = row.createCell(9); //设定值
cell.setCellValue(personPostAbnormalEntity.getSenderName());
cell = row.createCell(10); //设定值
cell.setCellValue(personPostAbnormalEntity.getSenderPhone());
cell = row.createCell(11); //设定值
cell.setCellValue(personPostAbnormalEntity.getRecipientName());
cell = row.createCell(12); //设定值
cell.setCellValue(personPostAbnormalEntity.getRecipientPhone());
cell = row.createCell(13); //设定值
cell.setCellValue(personPostAbnormalEntity.getRecipientAddress());
cell = row.createCell(14); //设定值
cell.setCellValue(personPostAbnormalEntity.getOrderBlankNumber());
cell = row.createCell(15); //设定值
cell.setCellValue(personPostAbnormalEntity.getGetToProvince());
cell = row.createCell(16); //设定值
cell.setCellValue(personPostAbnormalEntity.getGetToCity());
cell = row.createCell(17); //设定值
cell.setCellValue(personPostAbnormalEntity.getGetToCounty());
cell = row.createCell(18); //设定值
cell.setCellValue(personPostAbnormalEntity.getBusinessType());
cell = row.createCell(19); //设定值
cell.setCellValue(personPostAbnormalEntity.getLatticeMouthInformation());
cell = row.createCell(20); //设定值
cell.setCellValue(personPostAbnormalEntity.getNatureOfTheInternal());
cell = row.createCell(21); //设定值
cell.setCellValue(personPostAbnormalEntity.getNatureOfTheInformation());
cell = row.createCell(22); //设定值
cell.setCellValue(personPostAbnormalEntity.getFirstWhite());
cell = row.createCell(23); //设定值
cell.setCellValue(personPostAbnormalEntity.getErrCode());
// cell = row.createCell(24); //设定值 // cell = row.createCell(24); //设定值
// cell.setCellValue(personPostAbnormalEntity.getCheck_Date()); // cell.setCellValue("检查日期");
} // for (int i =0;i<personPostAbnormalEntities.size();i++){
//第六步将生成excel文件保存到指定路径下 // PersonPostAbnormalEntity personPostAbnormalEntity = personPostAbnormalEntities.get(i);
FileOutputStream fout = null; // row = sheet.createRow(i + 1);
try { // cell = row.createCell(0); //设定值
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls"); // cell.setCellValue(personPostAbnormalEntity.getWaybillNumber());
fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "邮寄错误信息表" + ".xls"); // cell = row.createCell(1); //设定值
wb.write(fout); // cell.setCellValue(personPostAbnormalEntity.getBackWaybillNumber());
fout.close(); // cell = row.createCell(2); //设定值
} catch (IOException e) { // cell.setCellValue(personPostAbnormalEntity.getOrderNumber());
e.printStackTrace(); // cell = row.createCell(3); //设定值
} // cell.setCellValue(personPostAbnormalEntity.getCreateDate());
// cell = row.createCell(4); //设定值
System.out.println("Excel文件生成成功..." + new Date()); // cell.setCellValue(personPostAbnormalEntity.getOpenid());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls"; // cell = row.createCell(5); //设定值
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "邮寄错误信息表" + ".xls"; // cell.setCellValue(personPostAbnormalEntity.getWcPlayOrderNumber());
} // cell = row.createCell(6); //设定值
// cell.setCellValue(personPostAbnormalEntity.getPlayState());
/** // cell = row.createCell(7); //设定值
* 导出个人制证状态信息表 // cell.setCellValue(personPostAbnormalEntity.getOrderState());
* @param personalProgressStatusEntities // cell = row.createCell(8); //设定值
* @return // cell.setCellValue(personPostAbnormalEntity.getApplicantName());
*/ // cell = row.createCell(9); //设定值
public static String exportPersonalProgressStatusExcel(List<PersonalProgressStatusEntity> personalProgressStatusEntities){ // cell.setCellValue(personPostAbnormalEntity.getSenderName());
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); // cell = row.createCell(10); //设定值
//第一步创建workbook // cell.setCellValue(personPostAbnormalEntity.getSenderPhone());
HSSFWorkbook wb = new HSSFWorkbook(); // cell = row.createCell(11); //设定值
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); // cell.setCellValue(personPostAbnormalEntity.getRecipientName());
HSSFSheet sheet = wb.createSheet("个人制证状态信息表"); // cell = row.createCell(12); //设定值
sheet.setColumnWidth(0, 30 * 110); // cell.setCellValue(personPostAbnormalEntity.getRecipientPhone());
sheet.setColumnWidth(1, 30 * 110); // cell = row.createCell(13); //设定值
sheet.setColumnWidth(2, 30 * 110); // cell.setCellValue(personPostAbnormalEntity.getRecipientAddress());
sheet.setColumnWidth(3, 30 * 110); // cell = row.createCell(14); //设定值
sheet.setColumnWidth(4, 30 * 110); // cell.setCellValue(personPostAbnormalEntity.getOrderBlankNumber());
sheet.setColumnWidth(5, 30 * 110); // cell = row.createCell(15); //设定值
sheet.setColumnWidth(6, 30 * 110); // cell.setCellValue(personPostAbnormalEntity.getGetToProvince());
sheet.setColumnWidth(7, 30 * 110); // cell = row.createCell(16); //设定值
sheet.setColumnWidth(8, 30 * 110); // cell.setCellValue(personPostAbnormalEntity.getGetToCity());
sheet.setColumnWidth(9, 30 * 110); // cell = row.createCell(17); //设定值
sheet.setColumnWidth(10, 30 * 110); // cell.setCellValue(personPostAbnormalEntity.getGetToCounty());
sheet.setColumnWidth(11, 30 * 110); // cell = row.createCell(18); //设定值
sheet.setColumnWidth(12, 30 * 110); // cell.setCellValue(personPostAbnormalEntity.getBusinessType());
//第三步创建行row:添加表头0行 // cell = row.createCell(19); //设定值
HSSFRow row = sheet.createRow(0); // cell.setCellValue(personPostAbnormalEntity.getLatticeMouthInformation());
HSSFCellStyle style = wb.createCellStyle();//样式 // cell = row.createCell(20); //设定值
style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中 // cell.setCellValue(personPostAbnormalEntity.getNatureOfTheInternal());
style.setAlignment(HSSFCellStyle.ALIGN_LEFT); // cell = row.createCell(21); //设定值
style.setWrapText(true);//设置自动换行 // cell.setCellValue(personPostAbnormalEntity.getNatureOfTheInformation());
HSSFFont font = wb.createFont(); // cell = row.createCell(22); //设定值
font.setFontHeightInPoints((short) 12); // cell.setCellValue(personPostAbnormalEntity.getFirstWhite());
style.setFont(font); // cell = row.createCell(23); //设定值
row = sheet.createRow(0); //创建下标为0的单元格 // cell.setCellValue(personPostAbnormalEntity.getErrCode());
row.setHeightInPoints(Short.parseShort("20"));//设置行高 //// cell = row.createCell(24); //设定值
HSSFCell cell = row.createCell(0); //设定值 //// cell.setCellValue(personPostAbnormalEntity.getCheck_Date());
cell.setCellValue("上报受理编号"); // }
cell = row.createCell(1); //设定值 // //第六步将生成excel文件保存到指定路径下
cell.setCellValue("处理状态"); // FileOutputStream fout = null;
cell = row.createCell(2); //设定值 // try {
cell.setCellValue("备注"); //// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls");
cell = row.createCell(3); //设定值 // fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "邮寄错误信息表" + ".xls");
cell.setCellValue("导入时间"); // wb.write(fout);
cell = row.createCell(4); //设定值 // fout.close();
cell.setCellValue("生成任务单时间"); // } catch (IOException e) {
cell = row.createCell(5); //设定值 // e.printStackTrace();
cell.setCellValue("数据核验时间"); // }
cell = row.createCell(6); //设定值 //
cell.setCellValue("膜打印时间"); // System.out.println("Excel文件生成成功..." + new Date());
cell = row.createCell(7); //设定值 //// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
cell.setCellValue("预订位时间"); // return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "邮寄错误信息表" + ".xls";
cell = row.createCell(8); //设定值 // }
cell.setCellValue("分拣时间"); //
cell = row.createCell(9); //设定值 // /**
cell.setCellValue("质检时间"); // * 导出个人制证状态信息表
cell = row.createCell(10); //设定值 // * @param personalProgressStatusEntities
cell.setCellValue("出库时间"); // * @return
cell = row.createCell(11); //设定值 // */
cell.setCellValue("下发时间"); // public static String exportPersonalProgressStatusExcel(List<PersonalProgressStatusEntity> personalProgressStatusEntities){
cell = row.createCell(12); //设定值 // SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
cell.setCellValue("签收时间"); // //第一步创建workbook
// HSSFWorkbook wb = new HSSFWorkbook();
for (int i =0;i<personalProgressStatusEntities.size();i++){ // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
PersonalProgressStatusEntity personalProgressStatusEntity = personalProgressStatusEntities.get(i); // HSSFSheet sheet = wb.createSheet("个人制证状态信息表");
row = sheet.createRow(i + 1); // sheet.setColumnWidth(0, 30 * 110);
cell = row.createCell(0); //设定值 // sheet.setColumnWidth(1, 30 * 110);
cell.setCellValue(personalProgressStatusEntity.getUploadNo()); // sheet.setColumnWidth(2, 30 * 110);
cell = row.createCell(1); //设定值 // sheet.setColumnWidth(3, 30 * 110);
cell.setCellValue(personalProgressStatusEntity.getProgressStatus()); // sheet.setColumnWidth(4, 30 * 110);
cell = row.createCell(2); //设定值 // sheet.setColumnWidth(5, 30 * 110);
cell.setCellValue(personalProgressStatusEntity.getNote()); // sheet.setColumnWidth(6, 30 * 110);
cell = row.createCell(3); //设定值 // sheet.setColumnWidth(7, 30 * 110);
cell.setCellValue(formatter.format(personalProgressStatusEntity.getImportDate())); // sheet.setColumnWidth(8, 30 * 110);
cell = row.createCell(4); //设定值 // sheet.setColumnWidth(9, 30 * 110);
cell.setCellValue(formatter.format(personalProgressStatusEntity.getCreateTaskDate())); // sheet.setColumnWidth(10, 30 * 110);
cell = row.createCell(5); //设定值 // sheet.setColumnWidth(11, 30 * 110);
cell.setCellValue(formatter.format(personalProgressStatusEntity.getDataCheckDate())); // sheet.setColumnWidth(12, 30 * 110);
cell = row.createCell(6); //设定值 // //第三步创建行row:添加表头0行
cell.setCellValue(formatter.format(personalProgressStatusEntity.getFilmPrintDate())); // HSSFRow row = sheet.createRow(0);
cell = row.createCell(7); //设定值 // HSSFCellStyle style = wb.createCellStyle();//样式
cell.setCellValue(formatter.format(personalProgressStatusEntity.getPositionDate())); // style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中
cell = row.createCell(8); //设定值 // style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
cell.setCellValue(formatter.format(personalProgressStatusEntity.getSortDate())); // style.setWrapText(true);//设置自动换行
cell = row.createCell(9); //设定值 // HSSFFont font = wb.createFont();
cell.setCellValue(formatter.format(personalProgressStatusEntity.getQualityTestDate())); // font.setFontHeightInPoints((short) 12);
cell = row.createCell(10); //设定值 // style.setFont(font);
cell.setCellValue(formatter.format(personalProgressStatusEntity.getOutStorageDate())); // row = sheet.createRow(0); //创建下标为0的单元格
cell = row.createCell(11); //设定值 // row.setHeightInPoints(Short.parseShort("20"));//设置行高
cell.setCellValue(formatter.format(personalProgressStatusEntity.getHandOutDate())); // HSSFCell cell = row.createCell(0); //设定值
cell = row.createCell(12); //设定值 // cell.setCellValue("上报受理编号");
cell.setCellValue(formatter.format(personalProgressStatusEntity.getSignInDate())); // cell = row.createCell(1); //设定值
} // cell.setCellValue("处理状态");
//第六步将生成excel文件保存到指定路径下 // cell = row.createCell(2); //设定值
FileOutputStream fout = null; // cell.setCellValue("备注");
try { // cell = row.createCell(3); //设定值
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls"); // cell.setCellValue("导入时间");
fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "个人制证状态信息表" + ".xls"); // cell = row.createCell(4); //设定值
wb.write(fout); // cell.setCellValue("生成任务单时间");
fout.close(); // cell = row.createCell(5); //设定值
} catch (IOException e) { // cell.setCellValue("数据核验时间");
e.printStackTrace(); // cell = row.createCell(6); //设定值
} // cell.setCellValue("膜打印时间");
// cell = row.createCell(7); //设定值
System.out.println("Excel文件生成成功..." + new Date()); // cell.setCellValue("预订位时间");
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls"; // cell = row.createCell(8); //设定值
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "个人制证状态信息表" + ".xls"; // cell.setCellValue("分拣时间");
} // cell = row.createCell(9); //设定值
// cell.setCellValue("质检时间");
/** // cell = row.createCell(10); //设定值
* 导出临时证件信息表 // cell.setCellValue("出库时间");
* @param temporaryCertificateEntities // cell = row.createCell(11); //设定值
* @return // cell.setCellValue("下发时间");
*/ // cell = row.createCell(12); //设定值
public static String exportTemporaryCertificateExcel(List<TemporaryCertificateEntity> temporaryCertificateEntities){ // cell.setCellValue("签收时间");
//第一步创建workbook //
HSSFWorkbook wb = new HSSFWorkbook(); // for (int i =0;i<personalProgressStatusEntities.size();i++){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); // PersonalProgressStatusEntity personalProgressStatusEntity = personalProgressStatusEntities.get(i);
HSSFSheet sheet = wb.createSheet("临时证件信息表"); // row = sheet.createRow(i + 1);
sheet.setColumnWidth(0, 30 * 110); // cell = row.createCell(0); //设定值
sheet.setColumnWidth(1, 30 * 110); // cell.setCellValue(personalProgressStatusEntity.getUploadNo());
sheet.setColumnWidth(2, 30 * 110); // cell = row.createCell(1); //设定值
sheet.setColumnWidth(3, 30 * 110); // cell.setCellValue(personalProgressStatusEntity.getProgressStatus());
sheet.setColumnWidth(4, 30 * 110); // cell = row.createCell(2); //设定值
sheet.setColumnWidth(5, 30 * 110); // cell.setCellValue(personalProgressStatusEntity.getNote());
sheet.setColumnWidth(6, 30 * 110); // cell = row.createCell(3); //设定值
sheet.setColumnWidth(7, 30 * 110); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getImportDate()));
sheet.setColumnWidth(8, 30 * 110); // cell = row.createCell(4); //设定值
sheet.setColumnWidth(9, 30 * 110); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getCreateTaskDate()));
//第三步创建行row:添加表头0行 // cell = row.createCell(5); //设定值
HSSFRow row = sheet.createRow(0); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getDataCheckDate()));
HSSFCellStyle style = wb.createCellStyle();//样式 // cell = row.createCell(6); //设定值
style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中 // cell.setCellValue(formatter.format(personalProgressStatusEntity.getFilmPrintDate()));
style.setAlignment(HSSFCellStyle.ALIGN_LEFT); // cell = row.createCell(7); //设定值
style.setWrapText(true);//设置自动换行 // cell.setCellValue(formatter.format(personalProgressStatusEntity.getPositionDate()));
HSSFFont font = wb.createFont(); // cell = row.createCell(8); //设定值
font.setFontHeightInPoints((short) 12); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getSortDate()));
style.setFont(font); // cell = row.createCell(9); //设定值
row = sheet.createRow(0); //创建下标为0的单元格 // cell.setCellValue(formatter.format(personalProgressStatusEntity.getQualityTestDate()));
row.setHeightInPoints(Short.parseShort("20"));//设置行高 // cell = row.createCell(10); //设定值
HSSFCell cell = row.createCell(0); //设定值 // cell.setCellValue(formatter.format(personalProgressStatusEntity.getOutStorageDate()));
cell.setCellValue("临时证件id"); // cell = row.createCell(11); //设定值
cell = row.createCell(1); //设定值 // cell.setCellValue(formatter.format(personalProgressStatusEntity.getHandOutDate()));
cell.setCellValue("姓名"); // cell = row.createCell(12); //设定值
cell = row.createCell(2); //设定值 // cell.setCellValue(formatter.format(personalProgressStatusEntity.getSignInDate()));
cell.setCellValue("身份证号码"); // }
cell = row.createCell(3); //设定值 // //第六步将生成excel文件保存到指定路径下
cell.setCellValue("联系电话"); // FileOutputStream fout = null;
cell = row.createCell(4); //设定值 // try {
cell.setCellValue("上一个有效期"); //// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls");
cell = row.createCell(5); //设定值 // fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "个人制证状态信息表" + ".xls");
cell.setCellValue("收到日期"); // wb.write(fout);
cell = row.createCell(6); //设定值 // fout.close();
cell.setCellValue("交待日期"); // } catch (IOException e) {
cell = row.createCell(7); //设定值 // e.printStackTrace();
cell.setCellValue("返给车间日期"); // }
cell = row.createCell(8); //设定值 //
cell.setCellValue("交给当事人日期"); // System.out.println("Excel文件生成成功..." + new Date());
cell = row.createCell(9); //设定值 //// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
cell.setCellValue("备注"); // return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "个人制证状态信息表" + ".xls";
// }
for (int i =0;i<temporaryCertificateEntities.size();i++){ //
TemporaryCertificateEntity temporaryCertificateEntity = temporaryCertificateEntities.get(i); // /**
row = sheet.createRow(i + 1); // * 导出临时证件信息表
cell = row.createCell(0); //设定值 // * @param temporaryCertificateEntities
cell.setCellValue(temporaryCertificateEntity.getTemporaryCertificateId()); // * @return
cell = row.createCell(1); //设定值 // */
cell.setCellValue(temporaryCertificateEntity.getName()); // public static String exportTemporaryCertificateExcel(List<TemporaryCertificateEntity> temporaryCertificateEntities){
cell = row.createCell(2); //设定值 // //第一步创建workbook
cell.setCellValue(temporaryCertificateEntity.getCardId()); // HSSFWorkbook wb = new HSSFWorkbook();
cell = row.createCell(3); //设定值 // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
cell.setCellValue(temporaryCertificateEntity.getPhone()); // HSSFSheet sheet = wb.createSheet("临时证件信息表");
cell = row.createCell(4); //设定值 // sheet.setColumnWidth(0, 30 * 110);
cell.setCellValue(temporaryCertificateEntity.getLastDurationOfStatus()); // sheet.setColumnWidth(1, 30 * 110);
cell = row.createCell(5); //设定值 // sheet.setColumnWidth(2, 30 * 110);
cell.setCellValue(temporaryCertificateEntity.getReceiptDate()); // sheet.setColumnWidth(3, 30 * 110);
cell = row.createCell(6); //设定值 // sheet.setColumnWidth(4, 30 * 110);
cell.setCellValue(temporaryCertificateEntity.getDateOfHandOverToTreat()); // sheet.setColumnWidth(5, 30 * 110);
cell = row.createCell(7); //设定值 // sheet.setColumnWidth(6, 30 * 110);
cell.setCellValue(temporaryCertificateEntity.getBackWorkshopDate()); // sheet.setColumnWidth(7, 30 * 110);
cell = row.createCell(8); //设定值 // sheet.setColumnWidth(8, 30 * 110);
cell.setCellValue(temporaryCertificateEntity.getDeliverToParty()); // sheet.setColumnWidth(9, 30 * 110);
cell = row.createCell(9); //设定值 // //第三步创建行row:添加表头0行
cell.setCellValue(temporaryCertificateEntity.getNote()); // HSSFRow row = sheet.createRow(0);
} // HSSFCellStyle style = wb.createCellStyle();//样式
//第六步将生成excel文件保存到指定路径下 // style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中
FileOutputStream fout = null; // style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
try { // style.setWrapText(true);//设置自动换行
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls"); // HSSFFont font = wb.createFont();
fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "临时证件信息表" + ".xls"); // font.setFontHeightInPoints((short) 12);
wb.write(fout); // style.setFont(font);
fout.close(); // row = sheet.createRow(0); //创建下标为0的单元格
} catch (IOException e) { // row.setHeightInPoints(Short.parseShort("20"));//设置行高
e.printStackTrace(); // HSSFCell cell = row.createCell(0); //设定值
} // cell.setCellValue("临时证件id");
// cell = row.createCell(1); //设定值
System.out.println("Excel文件生成成功..." + new Date()); // cell.setCellValue("姓名");
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls"; // cell = row.createCell(2); //设定值
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "临时证件信息表" + ".xls"; // cell.setCellValue("身份证号码");
} // cell = row.createCell(3); //设定值
// cell.setCellValue("联系电话");
/** // cell = row.createCell(4); //设定值
* 导出重做登记信息表 // cell.setCellValue("上一个有效期");
* @param redoRegistrationEntities // cell = row.createCell(5); //设定值
* @return // cell.setCellValue("收到日期");
*/ // cell = row.createCell(6); //设定值
public static String exportRedoRegistrationExcel(List<RedoRegistrationEntity> redoRegistrationEntities){ // cell.setCellValue("交待日期");
//第一步创建workbook // cell = row.createCell(7); //设定值
HSSFWorkbook wb = new HSSFWorkbook(); // cell.setCellValue("返给车间日期");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); // cell = row.createCell(8); //设定值
HSSFSheet sheet = wb.createSheet("重做登记信息表"); // cell.setCellValue("交给当事人日期");
sheet.setColumnWidth(0, 30 * 110); // cell = row.createCell(9); //设定值
sheet.setColumnWidth(1, 30 * 110); // cell.setCellValue("备注");
sheet.setColumnWidth(2, 30 * 110); //
sheet.setColumnWidth(3, 30 * 110); // for (int i =0;i<temporaryCertificateEntities.size();i++){
sheet.setColumnWidth(4, 30 * 110); // TemporaryCertificateEntity temporaryCertificateEntity = temporaryCertificateEntities.get(i);
sheet.setColumnWidth(5, 30 * 110); // row = sheet.createRow(i + 1);
sheet.setColumnWidth(6, 30 * 110); // cell = row.createCell(0); //设定值
sheet.setColumnWidth(7, 30 * 110); // cell.setCellValue(temporaryCertificateEntity.getTemporaryCertificateId());
sheet.setColumnWidth(8, 30 * 110); // cell = row.createCell(1); //设定值
sheet.setColumnWidth(9, 30 * 110); // cell.setCellValue(temporaryCertificateEntity.getName());
//第三步创建行row:添加表头0行 // cell = row.createCell(2); //设定值
HSSFRow row = sheet.createRow(0); // cell.setCellValue(temporaryCertificateEntity.getCardId());
HSSFCellStyle style = wb.createCellStyle();//样式 // cell = row.createCell(3); //设定值
style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中 // cell.setCellValue(temporaryCertificateEntity.getPhone());
style.setAlignment(HSSFCellStyle.ALIGN_LEFT); // cell = row.createCell(4); //设定值
style.setWrapText(true);//设置自动换行 // cell.setCellValue(temporaryCertificateEntity.getLastDurationOfStatus());
HSSFFont font = wb.createFont(); // cell = row.createCell(5); //设定值
font.setFontHeightInPoints((short) 12); // cell.setCellValue(temporaryCertificateEntity.getReceiptDate());
style.setFont(font); // cell = row.createCell(6); //设定值
row = sheet.createRow(0); //创建下标为0的单元格 // cell.setCellValue(temporaryCertificateEntity.getDateOfHandOverToTreat());
row.setHeightInPoints(Short.parseShort("20"));//设置行高 // cell = row.createCell(7); //设定值
HSSFCell cell = row.createCell(0); //设定值 // cell.setCellValue(temporaryCertificateEntity.getBackWorkshopDate());
cell.setCellValue("重做登记表id"); // cell = row.createCell(8); //设定值
cell = row.createCell(1); //设定值 // cell.setCellValue(temporaryCertificateEntity.getDeliverToParty());
cell.setCellValue("上传日期"); // cell = row.createCell(9); //设定值
cell = row.createCell(2); //设定值 // cell.setCellValue(temporaryCertificateEntity.getNote());
cell.setCellValue("区县代码"); // }
cell = row.createCell(3); //设定值 // //第六步将生成excel文件保存到指定路径下
cell.setCellValue("公安机关代码"); // FileOutputStream fout = null;
cell = row.createCell(4); //设定值 // try {
cell.setCellValue("姓名"); //// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls");
cell = row.createCell(5); //设定值 // fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "临时证件信息表" + ".xls");
cell.setCellValue("身份证号"); // wb.write(fout);
cell = row.createCell(6); //设定值 // fout.close();
cell.setCellValue("重做原因"); // } catch (IOException e) {
cell = row.createCell(7); //设定值 // e.printStackTrace();
cell.setCellValue("来电日期"); // }
cell = row.createCell(8); //设定值 //
cell.setCellValue("返回日期"); // System.out.println("Excel文件生成成功..." + new Date());
cell = row.createCell(9); //设定值 //// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
cell.setCellValue("备注"); // return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "临时证件信息表" + ".xls";
// }
for (int i =0;i<redoRegistrationEntities.size();i++){ //
RedoRegistrationEntity redoRegistrationEntity = redoRegistrationEntities.get(i); // /**
row = sheet.createRow(i + 1); // * 导出重做登记信息表
cell = row.createCell(0); //设定值 // * @param redoRegistrationEntities
cell.setCellValue(redoRegistrationEntity.getRedoRegistrationId()); // * @return
cell = row.createCell(1); //设定值 // */
cell.setCellValue(redoRegistrationEntity.getSubmitDate()); // public static String exportRedoRegistrationExcel(List<RedoRegistrationEntity> redoRegistrationEntities){
cell = row.createCell(2); //设定值 // //第一步创建workbook
cell.setCellValue(redoRegistrationEntity.getCountyCode()); // HSSFWorkbook wb = new HSSFWorkbook();
cell = row.createCell(3); //设定值 // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
cell.setCellValue(redoRegistrationEntity.getPoliceCode()); // HSSFSheet sheet = wb.createSheet("重做登记信息表");
cell = row.createCell(4); //设定值 // sheet.setColumnWidth(0, 30 * 110);
cell.setCellValue(redoRegistrationEntity.getName()); // sheet.setColumnWidth(1, 30 * 110);
cell = row.createCell(5); //设定值 // sheet.setColumnWidth(2, 30 * 110);
cell.setCellValue(redoRegistrationEntity.getCardId()); // sheet.setColumnWidth(3, 30 * 110);
cell = row.createCell(6); //设定值 // sheet.setColumnWidth(4, 30 * 110);
cell.setCellValue(redoRegistrationEntity.getRedoReason()); // sheet.setColumnWidth(5, 30 * 110);
cell = row.createCell(7); //设定值 // sheet.setColumnWidth(6, 30 * 110);
cell.setCellValue(redoRegistrationEntity.getCallDate()); // sheet.setColumnWidth(7, 30 * 110);
cell = row.createCell(8); //设定值 // sheet.setColumnWidth(8, 30 * 110);
cell.setCellValue(redoRegistrationEntity.getBackDate()); // sheet.setColumnWidth(9, 30 * 110);
cell = row.createCell(9); //设定值 // //第三步创建行row:添加表头0行
cell.setCellValue(redoRegistrationEntity.getNote()); // HSSFRow row = sheet.createRow(0);
} // HSSFCellStyle style = wb.createCellStyle();//样式
//第六步将生成excel文件保存到指定路径下 // style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中
FileOutputStream fout = null; // style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
try { // style.setWrapText(true);//设置自动换行
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls"); // HSSFFont font = wb.createFont();
fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "重做登记信息表" + ".xls"); // font.setFontHeightInPoints((short) 12);
wb.write(fout); // style.setFont(font);
fout.close(); // row = sheet.createRow(0); //创建下标为0的单元格
} catch (IOException e) { // row.setHeightInPoints(Short.parseShort("20"));//设置行高
e.printStackTrace(); // HSSFCell cell = row.createCell(0); //设定值
} // cell.setCellValue("重做登记表id");
// cell = row.createCell(1); //设定值
System.out.println("Excel文件生成成功..." + new Date()); // cell.setCellValue("上传日期");
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls"; // cell = row.createCell(2); //设定值
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "重做登记信息表" + ".xls"; // cell.setCellValue("区县代码");
} // cell = row.createCell(3); //设定值
// cell.setCellValue("公安机关代码");
// cell = row.createCell(4); //设定值
} // cell.setCellValue("姓名");
// cell = row.createCell(5); //设定值
// cell.setCellValue("身份证号");
// cell = row.createCell(6); //设定值
// cell.setCellValue("重做原因");
// cell = row.createCell(7); //设定值
// cell.setCellValue("来电日期");
// cell = row.createCell(8); //设定值
// cell.setCellValue("返回日期");
// cell = row.createCell(9); //设定值
// cell.setCellValue("备注");
//
// for (int i =0;i<redoRegistrationEntities.size();i++){
// RedoRegistrationEntity redoRegistrationEntity = redoRegistrationEntities.get(i);
// row = sheet.createRow(i + 1);
// cell = row.createCell(0); //设定值
// cell.setCellValue(redoRegistrationEntity.getRedoRegistrationId());
// cell = row.createCell(1); //设定值
// cell.setCellValue(redoRegistrationEntity.getSubmitDate());
// cell = row.createCell(2); //设定值
// cell.setCellValue(redoRegistrationEntity.getCountyCode());
// cell = row.createCell(3); //设定值
// cell.setCellValue(redoRegistrationEntity.getPoliceCode());
// cell = row.createCell(4); //设定值
// cell.setCellValue(redoRegistrationEntity.getName());
// cell = row.createCell(5); //设定值
// cell.setCellValue(redoRegistrationEntity.getCardId());
// cell = row.createCell(6); //设定值
// cell.setCellValue(redoRegistrationEntity.getRedoReason());
// cell = row.createCell(7); //设定值
// cell.setCellValue(redoRegistrationEntity.getCallDate());
// cell = row.createCell(8); //设定值
// cell.setCellValue(redoRegistrationEntity.getBackDate());
// cell = row.createCell(9); //设定值
// cell.setCellValue(redoRegistrationEntity.getNote());
// }
// //第六步将生成excel文件保存到指定路径下
// FileOutputStream fout = null;
// try {
//// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls");
// fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "重做登记信息表" + ".xls");
// wb.write(fout);
// fout.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// System.out.println("Excel文件生成成功..." + new Date());
//// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
// return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "重做登记信息表" + ".xls";
// }
//
//
//}
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