excel
This commit is contained in:
parent
489d6e391c
commit
99b090bcc0
@ -11,6 +11,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
@ -86,18 +88,41 @@ public class ContractInfoScribeExcelController {
|
||||
return R.FALSE("批处理数据不能大于1万条");
|
||||
}
|
||||
|
||||
for(int i=5;i<=worksheet.getPhysicalNumberOfRows() ;i++) {
|
||||
for(int i=1;i<worksheet.getPhysicalNumberOfRows() ;i++) {
|
||||
|
||||
try {
|
||||
XSSFRow row = worksheet.getRow(i);
|
||||
ScribeExcelVo vo = new ScribeExcelVo();
|
||||
vo.setName(row.getCell(0).getStringCellValue());
|
||||
vo.setTs_code(row.getCell(1).getStringCellValue());
|
||||
vo.setIdname(row.getCell(2).getStringCellValue());
|
||||
vo.setScribe_value(BigDecimal.valueOf(row.getCell(3).getNumericCellValue()));
|
||||
vo.setScribe_shor_name(row.getCell(4).getStringCellValue());
|
||||
vo.setScribe_id(Double.valueOf(row.getCell(5).getNumericCellValue()).intValue());
|
||||
vo.setScribe_name(row.getCell(6).getStringCellValue());
|
||||
|
||||
XSSFCell cell0 = row.getCell(0);
|
||||
if(cell0!=null && CellType.STRING==cell0.getCellType()) {
|
||||
vo.setName(cell0.getStringCellValue());
|
||||
}
|
||||
XSSFCell cell1 = row.getCell(1);
|
||||
if(cell1!=null && CellType.STRING==cell1.getCellType()) {
|
||||
vo.setTs_code(cell1.getStringCellValue());
|
||||
}else {continue;}
|
||||
XSSFCell cell2 = row.getCell(2);
|
||||
if(cell2!=null && CellType.STRING==cell2.getCellType()) {
|
||||
vo.setIdname(cell2.getStringCellValue());
|
||||
}
|
||||
XSSFCell cell3 = row.getCell(3);
|
||||
if(cell3!=null && CellType.NUMERIC==cell3.getCellType()) {
|
||||
vo.setScribe_value(BigDecimal.valueOf(cell3.getNumericCellValue()));
|
||||
}else {continue;}
|
||||
XSSFCell cell4 = row.getCell(4);
|
||||
if(cell4!=null && CellType.STRING==cell4.getCellType()) {
|
||||
vo.setScribe_shor_name(cell4.getStringCellValue());
|
||||
}
|
||||
XSSFCell cell5 = row.getCell(5);
|
||||
if(cell5!=null && CellType.NUMERIC==cell5.getCellType()) {
|
||||
vo.setScribe_id(Double.valueOf(cell5.getNumericCellValue()).intValue());
|
||||
}else {continue;}
|
||||
XSSFCell cell6 = row.getCell(6);
|
||||
if(cell6!=null && CellType.STRING==cell6.getCellType()) {
|
||||
vo.setScribe_name(cell6.getStringCellValue());
|
||||
}
|
||||
|
||||
list.add(vo);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -128,18 +153,41 @@ public class ContractInfoScribeExcelController {
|
||||
return R.FALSE("批处理数据不能大于1万条");
|
||||
}
|
||||
|
||||
for(int i=5;i<=worksheet.getPhysicalNumberOfRows() ;i++) {
|
||||
for(int i=1;i<=worksheet.getPhysicalNumberOfRows() ;i++) {
|
||||
|
||||
try {
|
||||
XSSFRow row = worksheet.getRow(i);
|
||||
ScribeExcelVo vo = new ScribeExcelVo();
|
||||
vo.setName(row.getCell(0).getStringCellValue());
|
||||
vo.setTs_code(row.getCell(1).getStringCellValue());
|
||||
vo.setIdname(row.getCell(2).getStringCellValue());
|
||||
vo.setScribe_value(BigDecimal.valueOf(row.getCell(3).getNumericCellValue()));
|
||||
vo.setScribe_shor_name(row.getCell(4).getStringCellValue());
|
||||
vo.setScribe_id(Double.valueOf(row.getCell(5).getNumericCellValue()).intValue());
|
||||
vo.setScribe_name(row.getCell(6).getStringCellValue());
|
||||
|
||||
XSSFCell cell0 = row.getCell(0);
|
||||
if(cell0!=null && CellType.STRING==cell0.getCellType()) {
|
||||
vo.setName(cell0.getStringCellValue());
|
||||
}
|
||||
XSSFCell cell1 = row.getCell(1);
|
||||
if(cell1!=null && CellType.STRING==cell1.getCellType()) {
|
||||
vo.setTs_code(cell1.getStringCellValue());
|
||||
}else {continue;}
|
||||
XSSFCell cell2 = row.getCell(2);
|
||||
if(cell2!=null && CellType.STRING==cell2.getCellType()) {
|
||||
vo.setIdname(cell2.getStringCellValue());
|
||||
}
|
||||
XSSFCell cell3 = row.getCell(3);
|
||||
if(cell3!=null && CellType.NUMERIC==cell3.getCellType()) {
|
||||
vo.setScribe_value(BigDecimal.valueOf(cell3.getNumericCellValue()));
|
||||
}else {continue;}
|
||||
XSSFCell cell4 = row.getCell(4);
|
||||
if(cell4!=null && CellType.STRING==cell4.getCellType()) {
|
||||
vo.setScribe_shor_name(cell4.getStringCellValue());
|
||||
}
|
||||
XSSFCell cell5 = row.getCell(5);
|
||||
if(cell5!=null && CellType.NUMERIC==cell5.getCellType()) {
|
||||
vo.setScribe_id(Double.valueOf(cell5.getNumericCellValue()).intValue());
|
||||
}else {continue;}
|
||||
XSSFCell cell6 = row.getCell(6);
|
||||
if(cell6!=null && CellType.STRING==cell6.getCellType()) {
|
||||
vo.setScribe_name(cell6.getStringCellValue());
|
||||
}
|
||||
|
||||
list.add(vo);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user