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. symfony2取得web目录绝对路径、相对路径、网址的函数是什么

    对于你的需求,Symfony2通过DIC提供了kernel服务,以及request(请求)的封装. 在controller里(在其他地方你可以自行注入kernel,这个服务是HttpKernel库里的 ...

  2. Mybatis原理分析之二:框架整体设计

    1.引言 本文主要讲解Mybatis的整体程序设计,理清楚框架的主要脉络.后面文章我们再详细讲解各个组件. 2.整体设计 2.1 总体流程 (1)加载配置并初始化       触发条件:加载配置文件 ...

  3. python 中__name__ = '__main__' 的作用

    有句话经典的概括了这段代码的意义: "Make a script both importable and executable" 意思就是说让你写的脚本模块既可以导入到别的模块中用 ...

  4. c# winform 窗体起始位置 设置

    窗体起始位置为顶部中间,WinForm居中显示: ; ; this.StartPosition = FormStartPosition.Manual; //窗体的位置由Location属性决定 thi ...

  5. 用openvswitch配置跨节点的docker网络环境

    在一篇随笔中,我们已经尝试了在不依赖工具的情况下设置docker的ip,连我都想吐槽,MD单机都这么麻烦,在多机的环境中岂不是要了我的小命! 本文就是为了多机环境中各个节点的容器通信而做的,网络拓朴如 ...

  6. 如何让input框自动获得焦点

    项目中有个需求  一个用扫描枪输入的input框 为了避免每次都需要人为点击 需要做成当打开页面时该input框自动获取焦点 <input type="text" name= ...

  7. Scala的几个小tips

    1. Main方法只能写在object而不是class里 2. Unit test只能针对class或者trait,不能给object做,解决方法,把object里面要测的方法拿出来放到trait里, ...

  8. oracle and 和 or

    源地址:https://zhidao.baidu.com/question/350891282.html (FirstName='Thomas' OR FirstName='William') AND ...

  9. 前端模板之EasyUI常用控件及参数

    CSS类定义 div easyui-window window窗口样式 属性如下: 1) modal:是否生成模态窗口.true[是] false[否] 2) shadow:是否显示窗口阴影.true ...

  10. Cookie实现商品浏览记录--方式二:JS实现

    使用Cookie实现商品浏览记录:方式二:JS方法实现cookie的获取以及写入.当某一个产品被点击时,触发JS方法.利用JS方法判断一下,此产品是否在浏览记录中.如果不存在,则将产品ID加入到coo ...