public void fileImport(Ufile ufile) throws Exception {
String filePath = ufile.getFilePath();
List<AuthTransaction> parseResult = ExcelUtils.parseExcelInterface(filePath, new ParseExcelSheets<AuthTransaction>() {
@Override
public List<AuthTransaction> doParse(List<Sheet> sheets) {
List<AuthTransaction> tempResult = new ArrayList<AuthTransaction>();
DecimalFormat df = new DecimalFormat("0");
for (Sheet sheet : sheets) {
int rowCount = sheet.getPhysicalNumberOfRows();// 总行数
int startRowIndex = 1;
int endRowIndex = rowCount;
int startColumnIndex = 0;
int endColumnIndex = 50;
for (int i = startRowIndex; i < endRowIndex; i++) {
try {
int flag=0;
AuthTransaction authTransaction = new AuthTransaction();
Row row = sheet.getRow(i);
if(row==null){
break;
}
for (int j = startColumnIndex; j < endColumnIndex; j++) {
Cell cell = row.getCell(j);
if(cell==null){
flag=1;
break;
}
switch (j % endColumnIndex) {
case 0:// 年份 ->编号

if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
df = new DecimalFormat("########");
String cellValue = df.format(cell.getNumericCellValue());
authTransaction.setAuthApplicationNo(cellValue);
flag=0;
break;
//authTransaction.setAuthApplicationYear(cellValue);
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isInteger(cellValue)) {
authTransaction.setAuthApplicationNo(cellValue);
}
flag=0;
break;
}else{
flag=1;
break;
}

case 1:// 编号->船名
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setShipName(cellValue);
//authTransaction.setAuthApplicationNo(cellValue);
}
break;
case 2:// 船名->船舶类型
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setShipTypeName(cellValue);
Dictionary dictionary = dictionaryService.getEntityByName(cellValue);
if (dictionary != null) {
authTransaction.setShipTypeId(dictionary.getId());
} else {
throw new ServiceException("请先在用户字典中维护船型:" + cellValue);
}
}
else {
throw new ServiceException(authTransaction.getShipName() + "为设置船型");
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setShipName(cellValue);
}
break;*/
case 3:// 曾用名->船舶识别号
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setShipRegisterNo(cellValue);
} else if (cell != null && cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
String cellValue = df.format(cell.getNumericCellValue());
authTransaction.setShipRegisterNo(cellValue);
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setShipFormerName(cellValue);
}
break;*/
case 4:// 船型->初次登记号码
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setFirstRegisterNo(cellValue);
} else if (cell != null && cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
String cellValue = df.format(cell.getNumericCellValue());
authTransaction.setFirstRegisterNo(cellValue);
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setShipTypeName(cellValue);
Dictionary dictionary = dictionaryService.getEntityByName(cellValue);
if (dictionary != null) {
authTransaction.setShipTypeId(dictionary.getId());
} else {
throw new ServiceException("请先在用户字典中维护船型:" + cellValue);
}
} else {
throw new ServiceException(authTransaction.getShipName() + "为设置船型");
}
break;*/
case 5:// 船舶登记号->总吨
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setGrossTon(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setGrossTon(Double.valueOf(cellValue));
}
}
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setShipRegisterNo(cellValue);
} else if (cell != null && cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
String cellValue = df.format(cell.getNumericCellValue());
authTransaction.setShipRegisterNo(cellValue);
}
break;*/
case 6:// 总吨 ->净吨
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setNetTon(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setNetTon(cell.getNumericCellValue());
}
}
}
break;
/* if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setGrossTon(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setGrossTon(Double.valueOf(cellValue));
}
}
}
break;*/
case 7:// 载重吨
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setDeadWeight(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setDeadWeight(Double.valueOf(cellValue));
}
}
}
break;
case 8:// 船龄-> 成交价格
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
String cellValue = df.format(cell.getNumericCellValue());
if (DataUtils.isInteger(cellValue)) {
authTransaction.setPrice(Double.valueOf(cellValue));
}
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isInteger(cellValue)) {
authTransaction.setPrice(Double.valueOf(cellValue));
}
}
}
break;
/*if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
String cellValue = df.format(cell.getNumericCellValue());
if (DataUtils.isInteger(cellValue)) {
authTransaction.setShipAge(Integer.valueOf(cellValue));
}
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isInteger(cellValue)) {
authTransaction.setShipAge(Integer.valueOf(cellValue));
}
}
}
break;*/
case 9:// 建造年份->成交日期
if (cell != null && HSSFDateUtil.isCellDateFormatted(cell)) {
authTransaction.setTradeDate(cell.getDateCellValue());
}
break;
/*if (cell != null && HSSFDateUtil.isCellDateFormatted(cell)) {
authTransaction.setBuildDate(cell.getDateCellValue());
}
break;*/
case 10:// 建造船厂->鉴证费
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setBuildShipyard(cellValue);
}
break;*/
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setAuthCharge(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setAuthCharge(Double.valueOf(cellValue));
}
}
}
break;
case 11:// 船籍港->鉴证日期
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setHomePort(cellValue);
}
break;*/
if (cell != null && HSSFDateUtil.isCellDateFormatted(cell)) {
authTransaction.setAuthDate(cell.getDateCellValue());
}
break;
case 12:// 海、河船->船龄
if (cell != null) {
df = new DecimalFormat("#.0");
String cellValue = df.format(cell.getNumericCellValue());
authTransaction.setShipAge(Double.valueOf(cellValue));
/*if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setShipAge(Double.valueOf(cellValue));
}
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setShipAge(Double.valueOf(cellValue));
}
}*/
}
break;
/*authTransaction.setIsShip(0);//默认河船
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (cellValue.equals("海船")) {
authTransaction.setIsShip(1);
}
}
break;*/
case 13:// 船级->建造年份
if (cell != null && HSSFDateUtil.isCellDateFormatted(cell)) {
authTransaction.setBuildDate(cell.getDateCellValue());
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setClassificationSociety(cellValue);
}
break;*/
case 14:// 航区 ->建造船厂
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setBuildShipyard(cellValue);
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setNavigationArea(cellValue);
}
break;*/
case 15:// 总长->建造地点
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setBuildArea(cellValue);
}
break;
/*if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setShipLength(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setShipLength(Double.valueOf(cellValue));
}
}
}
break;*/
case 16:// 型宽->船名(原)
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setShipFormerName(cellValue);
}
break;
/*if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setShipWidth(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setShipWidth(Double.valueOf(cellValue));
}
}
}
break;*/
case 17:// 型深->船名(现)不解析
/*if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setShipHeight(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setShipHeight(Double.valueOf(cellValue));
}
}
}*/
break;
case 18:// 主机型号->船籍港(原)
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setHomePort(cellValue);
}
break;
/* if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setHostModel(cellValue);
}
break;*/
case 19:// 主机功率—>船籍港(现)不解析
/*if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setHostPower(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setHostPower(Double.valueOf(cellValue));
}
}
}
break;*/
case 20:// 主机转速->海/河船
authTransaction.setIsShip(0);//默认河船
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (cellValue.equals("海船")) {
authTransaction.setIsShip(1);
}
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setShipRateType(cellValue);
}
break;*/
/*if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setHostSpeed(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setHostSpeed(Double.valueOf(cellValue));
}
}
}
break;*/
case 21:// 主机台数->船检机构
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setShipCheck(cellValue);
}
break;
/*if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
String cellValue = df.format(cell.getNumericCellValue());
if (DataUtils.isInteger(cellValue)) {
authTransaction.setHosts(Integer.valueOf(cellValue));
}
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isInteger(cellValue)) {
authTransaction.setHosts(Integer.valueOf(cellValue));
}
}
}
break;*/
case 22:// 主机制造厂->航区
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setNavigationArea(cellValue);
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setHostFactory(cellValue);
}
break;*/
case 23:// 副机型号->总长
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setShipLength(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setShipLength(Double.valueOf(cellValue));
}
}
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setSideModel(cellValue);
}
break;*/
case 24:// 副机台数->型宽.
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setShipWidth(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setShipWidth(Double.valueOf(cellValue));
}
}
}
break;
/*if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
String cellValue = df.format(cell.getNumericCellValue());
if (DataUtils.isInteger(cellValue)) {
authTransaction.setSides(Integer.valueOf(cellValue));
}
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isInteger(cellValue)) {
authTransaction.setSides(Integer.valueOf(cellValue));
}
}
}
break;*/
case 25:// 副机制造厂->型深
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setShipHeight(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setShipHeight(Double.valueOf(cellValue));
}
}
}
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setSideFactory(cellValue);
}
break;*/
case 26:// 成交价格->主机型号
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setHostModel(cellValue);
}
break;
/*if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setPrice(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setPrice(Double.valueOf(cellValue));
}
}
}
break;*/
case 27:// 成交日期->主机功率
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setHostPower(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setHostPower(Double.valueOf(cellValue));
}
}
}
break;
/* if (cell != null && HSSFDateUtil.isCellDateFormatted(cell)) {
authTransaction.setTradeDate(cell.getDateCellValue());
}
break;*/
case 28:// 鉴证费->主机转速
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setHostSpeed(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setHostSpeed(Double.valueOf(cellValue));
}
}
}
break;
/*if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
authTransaction.setAuthCharge(cell.getNumericCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isNumeric(cellValue)) {
authTransaction.setAuthCharge(Double.valueOf(cellValue));
}
}
}
break;*/
case 29:// 鉴证日期->主机台数
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
String cellValue = df.format(cell.getNumericCellValue());
if (DataUtils.isInteger(cellValue)) {
authTransaction.setHosts(Integer.valueOf(cellValue));
}
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isInteger(cellValue)) {
authTransaction.setHosts(Integer.valueOf(cellValue));
}
}
}
break;
/*if (cell != null && HSSFDateUtil.isCellDateFormatted(cell)) {
authTransaction.setAuthDate(cell.getDateCellValue());
}
break;*/
case 30:// 卖方->主机制造厂
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setHostFactory(cellValue);
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setSeller(cellValue);
}
break;*/
case 31:// 卖方所在地->副机型号
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setSideModel(cellValue);
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setSellerLocation(cellValue);
}
break;*/
case 32:// 买方->副机台数
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
String cellValue = df.format(cell.getNumericCellValue());
if (DataUtils.isInteger(cellValue)) {
authTransaction.setSides(Integer.valueOf(cellValue));
}
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
if (DataUtils.isInteger(cellValue)) {
authTransaction.setSides(Integer.valueOf(cellValue));
}
}
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setBuyer(cellValue);
}
break;*/
case 33:// 买方所在地->最近一次船检时间
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setRecentlyCheckTime(cellValue);
}
break;
case 34:// 下一次船检时间
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setNextCheckTime(cellValue);
}
break;
/*if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setBuyerLocation(cellValue);
}
break;*/
case 35:// 卖方所在地->保险
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setBuySafe(cellValue);
}
break;
case 36:// 下一次船检时间
if (cell != null && HSSFDateUtil.isCellDateFormatted(cell)) {
authTransaction.setBuyTime(cell.getDateCellValue());
}
break;
case 38://卖方
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setSeller(cellValue);
}
break;
case 39://卖方所在地
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setSellerLocation(cellValue);
}
break;
case 40://卖方联系方式
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setSellPhone(cellValue);
}
break;
case 41://买方
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setBuyer(cellValue);
}
break;
case 42://买方所在地
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setBuyerLocation(cellValue);
}
break;
case 43://买方联系方式
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setBuyPhone(cellValue);
}
break;
case 44://经纪人
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setAgent(cellValue);
}
break;
case 45://经纪人联系方式
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setAgentPhone(cellValue);
}
break;
case 49://备注
if (cell != null && cell.getCellType() == Cell.CELL_TYPE_STRING && StringUtils.isNotBlank(cell.getStringCellValue())) {
String cellValue = cell.getStringCellValue().trim();
authTransaction.setBref(cellValue);
}
break;
default:
break;
}
if(flag == 0)
continue;
else if(flag == 1)
break;
}

authTransaction.setStatus(AuditStatus.NEW.getValue());
if(StringUtils.isNotEmpty(authTransaction.getAuthApplicationNo())){
tempResult.add(authTransaction);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
return tempResult;
}
});

if (CollectionUtils.isNotEmpty(parseResult)) {
for (AuthTransaction obj : parseResult) {
this.saveEntity(obj);
}
} else {
throw new Exception("导入数据为空");
}
}

excel解析二维数组结构的excel的更多相关文章

  1. PHP导出excel文件,第二步先实现自写二维数组加入模板excel文件后导出

    今天主要研究数据加入EXCEL并导出的问题,先不从数据库提取数据导出,自己先写一个二维数组,然后遍历二维数组写入excel模板中导出,首先根据模板excel的内容书写对应的二维数组 $arr=arra ...

  2. 将一,二维数组转化为Excel格式

    首先,我们来看一下一维数组的, 其代码可以如下: import numpy as np import pandas as pd x = pd.Series([1, 3, 5, np.nan]) pri ...

  3. Highcharts使用二维数组生成图表

    Highcharts使用二维数组生成图表 二维数组是更为灵活的一种数据存储方式.在Highcharts中.能够使用配置项column和rows二维数组.对于使用columns构建的二维数组,Highc ...

  4. Java读取excel指定sheet中的各行数据,存入二维数组,包括首行,并打印

    1. 读取 //读取excel指定sheet中的各行数据,存入二维数组,包括首行 public static String[][] getSheetData(XSSFSheet sheet) thro ...

  5. Excel 二维数组(数据块)旋转/翻转技巧

    Excel 二维数组(数据块)旋转/翻转技巧 原创 2017-12-30 久石六 久石六 工作中遇到个问题,需要将Excel中的数据块或者说二维数组向右旋转90度,才能再加工处理.当然,不是旋转文本方 ...

  6. 使用POI对excel进行操作生成二维数组

    import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import ja ...

  7. php上传excle文件,csv文件解析为二维数组

    解析上传的CSV文件不是什么难事,直接读取转成你想要的数组样子就OK了. public function putStoreStockIn ($filePath = '') { $file = fope ...

  8. jquery解析php通过ajax传过来的json二维数组对象

    ajax获得php传过来的json二维数组对象,jquery解析 php代码: <?php $news = array( '武汉'=>array(1,2,3), '广州'=>arra ...

  9. C语言一维数组、二维数组、结构体的初始化

    C语言数组的初始化表示方法 一.C语言一维数组初始化: (1)在定义数组时对数组元素赋以初值.如: static int a[10]={0,1,2,3,4,5,6,7,8,9}; 经过上面的定义和初始 ...

随机推荐

  1. C++ 取得系统当前时间

    #include <time.h> //* 方法一 time_t tt = time(NULL);//这句返回的只是一个时间cuo tm* t= localtime(&tt); p ...

  2. split 转义

    问题:str.split("?");报错了 原因: .?*+!^$[]()\在正则里需要转义 转义需双反斜线.splt("\\+");

  3. Who is using Asio?

    https://think-async.com/Asio/WhoIsUsingAsio

  4. AMBA

    基于IP复用的设计方法在SOC设计中得到了广泛的应用,设计过程中,片上总线的设计师最关键的问题. AMBA是由ARM公司退出的片上总线,是一种流行的工业标准片上结构. AMBA规范主要包括了AHB(A ...

  5. 用msbuild构建应用

    msbuild是微软提供的一个用于生成应用程序的平台,你可以通过一个xml配置文件来控制和处理你的软件工程.它也集成到了vs里面,它不依赖于vs. xml配置(架构)的组成元素: 项目文件 属性 项 ...

  6. linux 维护常见场景小命令 (未完待续)

    1.安装KDE桌面 [root@rhel06 ~]# yum -y groupinstall "X Windows System" "KDE Desktop" ...

  7. ubuntu死机怎么办

    在使用ubuntu的时候由于各种复杂的因素,如软件不兼容,误操作等问题导致"死机"怎么办呢?下面我们来看看如何解决这问题...   可以打开终端模拟器   1 ctrl+alt+t ...

  8. ubuntu下postgreSQL安装配置

    一.安装并配置,并设置远程登陆的用户名和密码 1.安装postgreSQL sudo apt-get update sudo apt-get install postgresql-9.4 在Ubunt ...

  9. DataGridView 导出到Excel

    #region 导出四个表格到Excel /// <summary> /// 导出四个表格到Excel /// </summary> /// <param name=&q ...

  10. Linux disk_partition_dev_马士兵_note

    一般装Linux会遇到的问题: 找不到硬件驱动 现在主流的一些硬件 不支持Linux驱动   尽量找主流的硬件,尽量找老一点的硬件   装系统: 1.记下 系统 ---->到时候要找驱动   2 ...