fix 标准拆分条款信息-导入 标题为空时自动填充了0。

This commit is contained in:
lijiarao
2024-08-26 17:55:59 +08:00
parent fe4b182d18
commit 0fc60e2f5f
@@ -2634,18 +2634,24 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
continue; continue;
} }
String cellValue = null; String cellValue = null;
String stringCellValue = cell.getStringCellValue();
if (!(CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell))) { if (!(CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell))) {
//设置单元格类型 //设置单元格类型
if (y == 0){ if (y == 0){
// 条文号精度丢失问题 // 条文号精度丢失问题
try { try {
double numericCellValue = cell.getNumericCellValue(); if (StringUtils.isNotBlank(stringCellValue)){
BigDecimal bigDecimal = BigDecimal.valueOf(numericCellValue); double numericCellValue = cell.getNumericCellValue();
String str = String.valueOf(bigDecimal); BigDecimal bigDecimal = BigDecimal.valueOf(numericCellValue);
if (str.endsWith(".0")){ String str = String.valueOf(bigDecimal);
str = str.substring(0, str.length() - 2); if (str.endsWith(".0")){
str = str.substring(0, str.length() - 2);
}
cell.setCellValue(str);
}else {
cell.setCellValue("");
} }
cell.setCellValue(str);
} catch (Exception e) { } catch (Exception e) {
} }
} }
@@ -2663,7 +2669,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
cellValue = df.format(d); cellValue = df.format(d);
}else { }else {
cellValue = cell.getStringCellValue(); cellValue = stringCellValue;
} }
} }
// //