|
|
@@ -16,6 +16,7 @@ import com.usoftchina.smartschool.school.po.TempletSet;
|
|
|
import com.usoftchina.smartschool.utils.CollectionUtils;
|
|
|
import com.usoftchina.smartschool.utils.DateUtils;
|
|
|
import com.usoftchina.smartschool.utils.RegexpUtils;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
|
|
import org.apache.poi.hssf.util.HSSFColor;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
@@ -178,6 +179,7 @@ public class ExcelServiceImpl implements ExcelService {
|
|
|
difference = true;
|
|
|
validateCode.add(codeValue);
|
|
|
dd.setDd_codevalue(codeValue);
|
|
|
+ value = value.replaceAll("#","");
|
|
|
}
|
|
|
//检查是否是同一单
|
|
|
if (set.isCodefield() && "".equals(value)) {
|
|
|
@@ -362,11 +364,20 @@ public class ExcelServiceImpl implements ExcelService {
|
|
|
//判断cell类型
|
|
|
switch(cell.getCellType()){
|
|
|
case Cell.CELL_TYPE_NUMERIC:{
|
|
|
- cellValue = String.valueOf(cell.getNumericCellValue());
|
|
|
- cellValue = RegexpUtils.replaceSpecialCharacterNotcodefield(cellValue);
|
|
|
- //判断是否为INT类型
|
|
|
- if (Double.valueOf(cellValue.toString()).intValue() - Double.valueOf(cellValue.toString()) == 0) {
|
|
|
- return cellValue.toString().substring(0, cellValue.toString().indexOf("."));
|
|
|
+ //POI在解析时,会将日期格式也解析为NUMERIC(数字类型);可查看API中CellType.java
|
|
|
+ if (!HSSFDateUtil.isCellDateFormatted(cell)) {
|
|
|
+ cellValue = String.valueOf(cell.getNumericCellValue());
|
|
|
+ cellValue = RegexpUtils.replaceSpecialCharacterNotcodefield(cellValue);
|
|
|
+ //判断是否为INT类型
|
|
|
+ if (Double.valueOf(cellValue.toString()).intValue() - Double.valueOf(cellValue.toString()) == 0) {
|
|
|
+ return cellValue.toString().substring(0, cellValue.toString().indexOf("."));
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (cell.getDateCellValue().getTime() > 0){
|
|
|
+ cellValue = DateUtils.format(cell.getDateCellValue(), null);
|
|
|
+ }else {
|
|
|
+ cellValue = DateUtils.format(cell.getDateCellValue(), "hh:mm:ss");
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
}
|