Commit d1200b74 authored by eddie.woo's avatar eddie.woo

modify

parent 5b4cc79a
...@@ -43,6 +43,9 @@ public class POIUtil { ...@@ -43,6 +43,9 @@ public class POIUtil {
public static void cloneSheet(Sheet sheet, Sheet targetSheet) { public static void cloneSheet(Sheet sheet, Sheet targetSheet) {
for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) { for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r); Row row = sheet.getRow(r);
if (null == row) {
continue;
}
Row targetRow = targetSheet.createRow(r); Row targetRow = targetSheet.createRow(r);
for (int c = row.getFirstCellNum(); c <= row.getLastCellNum(); c++) { for (int c = row.getFirstCellNum(); c <= row.getLastCellNum(); c++) {
Cell cell = row.getCell(c); Cell cell = row.getCell(c);
......
...@@ -172,7 +172,7 @@ public class DataInitTest extends CommonIT { ...@@ -172,7 +172,7 @@ public class DataInitTest extends CommonIT {
@Test @Test
public void initOutput() throws Exception { public void initOutput() throws Exception {
Workbook workbook = WorkbookFactory.create(new File("C:\\Users\\Eddie Wu\\Desktop\\导入/导入模板_销项主表_绿能_201809(1).xlsx")); Workbook workbook = WorkbookFactory.create(new File("C:\\Users\\Eddie Wu\\Desktop\\导入/导入模板_销项主表_乐叶_201807(1).xlsx"));
Sheet sheet = workbook.getSheetAt(0); Sheet sheet = workbook.getSheetAt(0);
for (int r = 1; r <= sheet.getLastRowNum(); r++) { for (int r = 1; r <= sheet.getLastRowNum(); r++) {
try { try {
...@@ -200,8 +200,8 @@ public class DataInitTest extends CommonIT { ...@@ -200,8 +200,8 @@ public class DataInitTest extends CommonIT {
outputInvoice.setHJJE(sheet.getRow(r).getCell(33).getStringCellValue()); outputInvoice.setHJJE(sheet.getRow(r).getCell(33).getStringCellValue());
outputInvoice.setHJSE(sheet.getRow(r).getCell(34).getStringCellValue()); outputInvoice.setHJSE(sheet.getRow(r).getCell(34).getStringCellValue());
outputInvoice.setJSHJ(sheet.getRow(r).getCell(35).getStringCellValue()); outputInvoice.setJSHJ(sheet.getRow(r).getCell(35).getStringCellValue());
outputInvoice.setSLV(sheet.getRow(r).getCell(42).getStringCellValue()); // outputInvoice.setSLV(sheet.getRow(r).getCell(42).getStringCellValue());
outputInvoice.setHTBH(sheet.getRow(r).getCell(54).getStringCellValue()); // outputInvoice.setHTBH(sheet.getRow(r).getCell(54).getStringCellValue());
outputInvoiceMapper.insertSelective(outputInvoice); outputInvoiceMapper.insertSelective(outputInvoice);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
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