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 = row.createCell(24); //设定值
cell.setCellValue("检查日期"); // cell.setCellValue("检查日期");
for (int i =0;i<personPostAbnormalEntities.size();i++){ // for (int i =0;i<personPostAbnormalEntities.size();i++){
PersonPostAbnormalEntity personPostAbnormalEntity = personPostAbnormalEntities.get(i); // PersonPostAbnormalEntity personPostAbnormalEntity = personPostAbnormalEntities.get(i);
row = sheet.createRow(i + 1); // row = sheet.createRow(i + 1);
cell = row.createCell(0); //设定值 // cell = row.createCell(0); //设定值
cell.setCellValue(personPostAbnormalEntity.getWaybillNumber()); // cell.setCellValue(personPostAbnormalEntity.getWaybillNumber());
cell = row.createCell(1); //设定值 // cell = row.createCell(1); //设定值
cell.setCellValue(personPostAbnormalEntity.getBackWaybillNumber()); // cell.setCellValue(personPostAbnormalEntity.getBackWaybillNumber());
cell = row.createCell(2); //设定值 // cell = row.createCell(2); //设定值
cell.setCellValue(personPostAbnormalEntity.getOrderNumber()); // cell.setCellValue(personPostAbnormalEntity.getOrderNumber());
cell = row.createCell(3); //设定值 // cell = row.createCell(3); //设定值
cell.setCellValue(personPostAbnormalEntity.getCreateDate()); // cell.setCellValue(personPostAbnormalEntity.getCreateDate());
cell = row.createCell(4); //设定值 // cell = row.createCell(4); //设定值
cell.setCellValue(personPostAbnormalEntity.getOpenid()); // cell.setCellValue(personPostAbnormalEntity.getOpenid());
cell = row.createCell(5); //设定值 // cell = row.createCell(5); //设定值
cell.setCellValue(personPostAbnormalEntity.getWcPlayOrderNumber()); // cell.setCellValue(personPostAbnormalEntity.getWcPlayOrderNumber());
cell = row.createCell(6); //设定值 // cell = row.createCell(6); //设定值
cell.setCellValue(personPostAbnormalEntity.getPlayState()); // cell.setCellValue(personPostAbnormalEntity.getPlayState());
cell = row.createCell(7); //设定值 // cell = row.createCell(7); //设定值
cell.setCellValue(personPostAbnormalEntity.getOrderState()); // cell.setCellValue(personPostAbnormalEntity.getOrderState());
cell = row.createCell(8); //设定值 // cell = row.createCell(8); //设定值
cell.setCellValue(personPostAbnormalEntity.getApplicantName()); // cell.setCellValue(personPostAbnormalEntity.getApplicantName());
cell = row.createCell(9); //设定值 // cell = row.createCell(9); //设定值
cell.setCellValue(personPostAbnormalEntity.getSenderName()); // cell.setCellValue(personPostAbnormalEntity.getSenderName());
cell = row.createCell(10); //设定值 // cell = row.createCell(10); //设定值
cell.setCellValue(personPostAbnormalEntity.getSenderPhone()); // cell.setCellValue(personPostAbnormalEntity.getSenderPhone());
cell = row.createCell(11); //设定值 // cell = row.createCell(11); //设定值
cell.setCellValue(personPostAbnormalEntity.getRecipientName()); // cell.setCellValue(personPostAbnormalEntity.getRecipientName());
cell = row.createCell(12); //设定值 // cell = row.createCell(12); //设定值
cell.setCellValue(personPostAbnormalEntity.getRecipientPhone()); // cell.setCellValue(personPostAbnormalEntity.getRecipientPhone());
cell = row.createCell(13); //设定值 // cell = row.createCell(13); //设定值
cell.setCellValue(personPostAbnormalEntity.getRecipientAddress()); // cell.setCellValue(personPostAbnormalEntity.getRecipientAddress());
cell = row.createCell(14); //设定值 // cell = row.createCell(14); //设定值
cell.setCellValue(personPostAbnormalEntity.getOrderBlankNumber()); // cell.setCellValue(personPostAbnormalEntity.getOrderBlankNumber());
cell = row.createCell(15); //设定值 // cell = row.createCell(15); //设定值
cell.setCellValue(personPostAbnormalEntity.getGetToProvince()); // cell.setCellValue(personPostAbnormalEntity.getGetToProvince());
cell = row.createCell(16); //设定值 // cell = row.createCell(16); //设定值
cell.setCellValue(personPostAbnormalEntity.getGetToCity()); // cell.setCellValue(personPostAbnormalEntity.getGetToCity());
cell = row.createCell(17); //设定值 // cell = row.createCell(17); //设定值
cell.setCellValue(personPostAbnormalEntity.getGetToCounty()); // cell.setCellValue(personPostAbnormalEntity.getGetToCounty());
cell = row.createCell(18); //设定值 // cell = row.createCell(18); //设定值
cell.setCellValue(personPostAbnormalEntity.getBusinessType()); // cell.setCellValue(personPostAbnormalEntity.getBusinessType());
cell = row.createCell(19); //设定值 // cell = row.createCell(19); //设定值
cell.setCellValue(personPostAbnormalEntity.getLatticeMouthInformation()); // cell.setCellValue(personPostAbnormalEntity.getLatticeMouthInformation());
cell = row.createCell(20); //设定值 // cell = row.createCell(20); //设定值
cell.setCellValue(personPostAbnormalEntity.getNatureOfTheInternal()); // cell.setCellValue(personPostAbnormalEntity.getNatureOfTheInternal());
cell = row.createCell(21); //设定值 // cell = row.createCell(21); //设定值
cell.setCellValue(personPostAbnormalEntity.getNatureOfTheInformation()); // cell.setCellValue(personPostAbnormalEntity.getNatureOfTheInformation());
cell = row.createCell(22); //设定值 // cell = row.createCell(22); //设定值
cell.setCellValue(personPostAbnormalEntity.getFirstWhite()); // cell.setCellValue(personPostAbnormalEntity.getFirstWhite());
cell = row.createCell(23); //设定值 // cell = row.createCell(23); //设定值
cell.setCellValue(personPostAbnormalEntity.getErrCode()); // cell.setCellValue(personPostAbnormalEntity.getErrCode());
// cell = row.createCell(24); //设定值 //// cell = row.createCell(24); //设定值
// cell.setCellValue(personPostAbnormalEntity.getCheck_Date()); //// cell.setCellValue(personPostAbnormalEntity.getCheck_Date());
} // }
//第六步将生成excel文件保存到指定路径下 // //第六步将生成excel文件保存到指定路径下
FileOutputStream fout = null; // FileOutputStream fout = null;
try { // try {
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls"); //// 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"); // fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "邮寄错误信息表" + ".xls");
wb.write(fout); // wb.write(fout);
fout.close(); // fout.close();
} catch (IOException e) { // } catch (IOException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
//
System.out.println("Excel文件生成成功..." + new Date()); // System.out.println("Excel文件生成成功..." + new Date());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls"; //// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "邮寄错误信息表" + ".xls"; // return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "邮寄错误信息表" + ".xls";
} // }
//
/** // /**
* 导出个人制证状态信息表 // * 导出个人制证状态信息表
* @param personalProgressStatusEntities // * @param personalProgressStatusEntities
* @return // * @return
*/ // */
public static String exportPersonalProgressStatusExcel(List<PersonalProgressStatusEntity> personalProgressStatusEntities){ // public static String exportPersonalProgressStatusExcel(List<PersonalProgressStatusEntity> personalProgressStatusEntities){
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); // SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
//第一步创建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 * 110); // sheet.setColumnWidth(0, 30 * 110);
sheet.setColumnWidth(1, 30 * 110); // sheet.setColumnWidth(1, 30 * 110);
sheet.setColumnWidth(2, 30 * 110); // sheet.setColumnWidth(2, 30 * 110);
sheet.setColumnWidth(3, 30 * 110); // sheet.setColumnWidth(3, 30 * 110);
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);
//第三步创建行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("生成任务单时间"); // cell.setCellValue("生成任务单时间");
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(11); //设定值 // cell = row.createCell(11); //设定值
cell.setCellValue("下发时间"); // cell.setCellValue("下发时间");
cell = row.createCell(12); //设定值 // cell = row.createCell(12); //设定值
cell.setCellValue("签收时间"); // cell.setCellValue("签收时间");
//
for (int i =0;i<personalProgressStatusEntities.size();i++){ // for (int i =0;i<personalProgressStatusEntities.size();i++){
PersonalProgressStatusEntity personalProgressStatusEntity = personalProgressStatusEntities.get(i); // PersonalProgressStatusEntity personalProgressStatusEntity = personalProgressStatusEntities.get(i);
row = sheet.createRow(i + 1); // row = sheet.createRow(i + 1);
cell = row.createCell(0); //设定值 // cell = row.createCell(0); //设定值
cell.setCellValue(personalProgressStatusEntity.getUploadNo()); // cell.setCellValue(personalProgressStatusEntity.getUploadNo());
cell = row.createCell(1); //设定值 // cell = row.createCell(1); //设定值
cell.setCellValue(personalProgressStatusEntity.getProgressStatus()); // cell.setCellValue(personalProgressStatusEntity.getProgressStatus());
cell = row.createCell(2); //设定值 // cell = row.createCell(2); //设定值
cell.setCellValue(personalProgressStatusEntity.getNote()); // cell.setCellValue(personalProgressStatusEntity.getNote());
cell = row.createCell(3); //设定值 // cell = row.createCell(3); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getImportDate())); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getImportDate()));
cell = row.createCell(4); //设定值 // cell = row.createCell(4); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getCreateTaskDate())); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getCreateTaskDate()));
cell = row.createCell(5); //设定值 // cell = row.createCell(5); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getDataCheckDate())); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getDataCheckDate()));
cell = row.createCell(6); //设定值 // cell = row.createCell(6); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getFilmPrintDate())); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getFilmPrintDate()));
cell = row.createCell(7); //设定值 // cell = row.createCell(7); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getPositionDate())); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getPositionDate()));
cell = row.createCell(8); //设定值 // cell = row.createCell(8); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getSortDate())); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getSortDate()));
cell = row.createCell(9); //设定值 // cell = row.createCell(9); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getQualityTestDate())); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getQualityTestDate()));
cell = row.createCell(10); //设定值 // cell = row.createCell(10); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getOutStorageDate())); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getOutStorageDate()));
cell = row.createCell(11); //设定值 // cell = row.createCell(11); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getHandOutDate())); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getHandOutDate()));
cell = row.createCell(12); //设定值 // cell = row.createCell(12); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getSignInDate())); // cell.setCellValue(formatter.format(personalProgressStatusEntity.getSignInDate()));
} // }
//第六步将生成excel文件保存到指定路径下 // //第六步将生成excel文件保存到指定路径下
FileOutputStream fout = null; // FileOutputStream fout = null;
try { // try {
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls"); //// 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"); // fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "个人制证状态信息表" + ".xls");
wb.write(fout); // wb.write(fout);
fout.close(); // fout.close();
} catch (IOException e) { // } catch (IOException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
//
System.out.println("Excel文件生成成功..." + new Date()); // System.out.println("Excel文件生成成功..." + new Date());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls"; //// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "个人制证状态信息表" + ".xls"; // return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "个人制证状态信息表" + ".xls";
} // }
//
/** // /**
* 导出临时证件信息表 // * 导出临时证件信息表
* @param temporaryCertificateEntities // * @param temporaryCertificateEntities
* @return // * @return
*/ // */
public static String exportTemporaryCertificateExcel(List<TemporaryCertificateEntity> temporaryCertificateEntities){ // public static String exportTemporaryCertificateExcel(List<TemporaryCertificateEntity> temporaryCertificateEntities){
//第一步创建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 * 110); // sheet.setColumnWidth(0, 30 * 110);
sheet.setColumnWidth(1, 30 * 110); // sheet.setColumnWidth(1, 30 * 110);
sheet.setColumnWidth(2, 30 * 110); // sheet.setColumnWidth(2, 30 * 110);
sheet.setColumnWidth(3, 30 * 110); // sheet.setColumnWidth(3, 30 * 110);
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);
//第三步创建行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("临时证件id"); // cell.setCellValue("临时证件id");
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("上一个有效期"); // cell.setCellValue("上一个有效期");
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("备注");
//
for (int i =0;i<temporaryCertificateEntities.size();i++){ // for (int i =0;i<temporaryCertificateEntities.size();i++){
TemporaryCertificateEntity temporaryCertificateEntity = temporaryCertificateEntities.get(i); // TemporaryCertificateEntity temporaryCertificateEntity = temporaryCertificateEntities.get(i);
row = sheet.createRow(i + 1); // row = sheet.createRow(i + 1);
cell = row.createCell(0); //设定值 // cell = row.createCell(0); //设定值
cell.setCellValue(temporaryCertificateEntity.getTemporaryCertificateId()); // cell.setCellValue(temporaryCertificateEntity.getTemporaryCertificateId());
cell = row.createCell(1); //设定值 // cell = row.createCell(1); //设定值
cell.setCellValue(temporaryCertificateEntity.getName()); // cell.setCellValue(temporaryCertificateEntity.getName());
cell = row.createCell(2); //设定值 // cell = row.createCell(2); //设定值
cell.setCellValue(temporaryCertificateEntity.getCardId()); // cell.setCellValue(temporaryCertificateEntity.getCardId());
cell = row.createCell(3); //设定值 // cell = row.createCell(3); //设定值
cell.setCellValue(temporaryCertificateEntity.getPhone()); // cell.setCellValue(temporaryCertificateEntity.getPhone());
cell = row.createCell(4); //设定值 // cell = row.createCell(4); //设定值
cell.setCellValue(temporaryCertificateEntity.getLastDurationOfStatus()); // cell.setCellValue(temporaryCertificateEntity.getLastDurationOfStatus());
cell = row.createCell(5); //设定值 // cell = row.createCell(5); //设定值
cell.setCellValue(temporaryCertificateEntity.getReceiptDate()); // cell.setCellValue(temporaryCertificateEntity.getReceiptDate());
cell = row.createCell(6); //设定值 // cell = row.createCell(6); //设定值
cell.setCellValue(temporaryCertificateEntity.getDateOfHandOverToTreat()); // cell.setCellValue(temporaryCertificateEntity.getDateOfHandOverToTreat());
cell = row.createCell(7); //设定值 // cell = row.createCell(7); //设定值
cell.setCellValue(temporaryCertificateEntity.getBackWorkshopDate()); // cell.setCellValue(temporaryCertificateEntity.getBackWorkshopDate());
cell = row.createCell(8); //设定值 // cell = row.createCell(8); //设定值
cell.setCellValue(temporaryCertificateEntity.getDeliverToParty()); // cell.setCellValue(temporaryCertificateEntity.getDeliverToParty());
cell = row.createCell(9); //设定值 // cell = row.createCell(9); //设定值
cell.setCellValue(temporaryCertificateEntity.getNote()); // cell.setCellValue(temporaryCertificateEntity.getNote());
} // }
//第六步将生成excel文件保存到指定路径下 // //第六步将生成excel文件保存到指定路径下
FileOutputStream fout = null; // FileOutputStream fout = null;
try { // try {
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls"); //// 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"); // fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "临时证件信息表" + ".xls");
wb.write(fout); // wb.write(fout);
fout.close(); // fout.close();
} catch (IOException e) { // } catch (IOException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
//
System.out.println("Excel文件生成成功..." + new Date()); // System.out.println("Excel文件生成成功..." + new Date());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls"; //// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "临时证件信息表" + ".xls"; // return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "临时证件信息表" + ".xls";
} // }
//
/** // /**
* 导出重做登记信息表 // * 导出重做登记信息表
* @param redoRegistrationEntities // * @param redoRegistrationEntities
* @return // * @return
*/ // */
public static String exportRedoRegistrationExcel(List<RedoRegistrationEntity> redoRegistrationEntities){ // public static String exportRedoRegistrationExcel(List<RedoRegistrationEntity> redoRegistrationEntities){
//第一步创建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 * 110); // sheet.setColumnWidth(0, 30 * 110);
sheet.setColumnWidth(1, 30 * 110); // sheet.setColumnWidth(1, 30 * 110);
sheet.setColumnWidth(2, 30 * 110); // sheet.setColumnWidth(2, 30 * 110);
sheet.setColumnWidth(3, 30 * 110); // sheet.setColumnWidth(3, 30 * 110);
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);
//第三步创建行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("重做登记表id"); // cell.setCellValue("重做登记表id");
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("姓名"); // cell.setCellValue("姓名");
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("备注");
//
for (int i =0;i<redoRegistrationEntities.size();i++){ // for (int i =0;i<redoRegistrationEntities.size();i++){
RedoRegistrationEntity redoRegistrationEntity = redoRegistrationEntities.get(i); // RedoRegistrationEntity redoRegistrationEntity = redoRegistrationEntities.get(i);
row = sheet.createRow(i + 1); // row = sheet.createRow(i + 1);
cell = row.createCell(0); //设定值 // cell = row.createCell(0); //设定值
cell.setCellValue(redoRegistrationEntity.getRedoRegistrationId()); // cell.setCellValue(redoRegistrationEntity.getRedoRegistrationId());
cell = row.createCell(1); //设定值 // cell = row.createCell(1); //设定值
cell.setCellValue(redoRegistrationEntity.getSubmitDate()); // cell.setCellValue(redoRegistrationEntity.getSubmitDate());
cell = row.createCell(2); //设定值 // cell = row.createCell(2); //设定值
cell.setCellValue(redoRegistrationEntity.getCountyCode()); // cell.setCellValue(redoRegistrationEntity.getCountyCode());
cell = row.createCell(3); //设定值 // cell = row.createCell(3); //设定值
cell.setCellValue(redoRegistrationEntity.getPoliceCode()); // cell.setCellValue(redoRegistrationEntity.getPoliceCode());
cell = row.createCell(4); //设定值 // cell = row.createCell(4); //设定值
cell.setCellValue(redoRegistrationEntity.getName()); // cell.setCellValue(redoRegistrationEntity.getName());
cell = row.createCell(5); //设定值 // cell = row.createCell(5); //设定值
cell.setCellValue(redoRegistrationEntity.getCardId()); // cell.setCellValue(redoRegistrationEntity.getCardId());
cell = row.createCell(6); //设定值 // cell = row.createCell(6); //设定值
cell.setCellValue(redoRegistrationEntity.getRedoReason()); // cell.setCellValue(redoRegistrationEntity.getRedoReason());
cell = row.createCell(7); //设定值 // cell = row.createCell(7); //设定值
cell.setCellValue(redoRegistrationEntity.getCallDate()); // cell.setCellValue(redoRegistrationEntity.getCallDate());
cell = row.createCell(8); //设定值 // cell = row.createCell(8); //设定值
cell.setCellValue(redoRegistrationEntity.getBackDate()); // cell.setCellValue(redoRegistrationEntity.getBackDate());
cell = row.createCell(9); //设定值 // cell = row.createCell(9); //设定值
cell.setCellValue(redoRegistrationEntity.getNote()); // cell.setCellValue(redoRegistrationEntity.getNote());
} // }
//第六步将生成excel文件保存到指定路径下 // //第六步将生成excel文件保存到指定路径下
FileOutputStream fout = null; // FileOutputStream fout = null;
try { // try {
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls"); //// 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"); // fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "重做登记信息表" + ".xls");
wb.write(fout); // wb.write(fout);
fout.close(); // fout.close();
} catch (IOException e) { // } catch (IOException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
//
System.out.println("Excel文件生成成功..." + new Date()); // System.out.println("Excel文件生成成功..." + new Date());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls"; //// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "重做登记信息表" + ".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