|
@@ -20,6 +20,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
|
+import org.apache.poi.ss.usermodel.DateUtil;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
@@ -2943,7 +2944,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
public R importTree(MultipartFile file, Long pkeyId) throws IOException {
|
|
public R importTree(MultipartFile file, Long pkeyId) throws IOException {
|
|
|
//最高节点
|
|
//最高节点
|
|
|
WbsTreeContract wbsTreeContractRoot = baseMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda().eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
WbsTreeContract wbsTreeContractRoot = baseMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda().eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
- bladeRedis.set("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId(), "0");
|
|
|
|
|
|
|
+ //bladeRedis.set("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId(), "0");
|
|
|
try (InputStream inputStream = file.getInputStream()) {
|
|
try (InputStream inputStream = file.getInputStream()) {
|
|
|
// 立即处理文件流
|
|
// 立即处理文件流
|
|
|
Workbook workbook = new XSSFWorkbook(inputStream);
|
|
Workbook workbook = new XSSFWorkbook(inputStream);
|
|
@@ -3498,7 +3499,23 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
*/
|
|
*/
|
|
|
private static Object getCellValue1(Cell cell) {
|
|
private static Object getCellValue1(Cell cell) {
|
|
|
if (cell == null) return null;
|
|
if (cell == null) return null;
|
|
|
- return cell.getStringCellValue();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ switch (cell.getCellTypeEnum()) {
|
|
|
|
|
+ case STRING:
|
|
|
|
|
+ return cell.getStringCellValue();
|
|
|
|
|
+ case NUMERIC:
|
|
|
|
|
+ if (DateUtil.isCellDateFormatted(cell)) {
|
|
|
|
|
+ return cell.getDateCellValue();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return cell.getNumericCellValue();
|
|
|
|
|
+ }
|
|
|
|
|
+ case BOOLEAN:
|
|
|
|
|
+ return cell.getBooleanCellValue();
|
|
|
|
|
+ case FORMULA:
|
|
|
|
|
+ return cell.getCellFormula();
|
|
|
|
|
+ default:
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|