傅行帆 5 vuotta sitten
vanhempi
commit
4815125fee

+ 27
- 5
src/main/java/com/huiju/estateagents/service/impl/TaHousingResourcesServiceImpl.java Näytä tiedosto

@@ -414,11 +414,33 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
414 414
                 String blockName = row.getCell(1).getStringCellValue().trim();
415 415
                 String unitName = row.getCell(2).getStringCellValue().trim();
416 416
                 String floorName = row.getCell(3).getStringCellValue().trim();
417
-                String roomName = row.getCell(4).getStringCellValue().trim();
418
-                BigDecimal price = BigDecimal.valueOf(row.getCell(5).getNumericCellValue());
419
-                String heatString = String.valueOf(row.getCell(6).getNumericCellValue());
420
-                String split = heatString.substring(0, heatString.indexOf("."));
421
-                Integer heat = Integer.valueOf(split);
417
+
418
+                String roomName = "";
419
+                try{
420
+                    roomName = row.getCell(4).getStringCellValue().trim();
421
+                }catch (Exception e){
422
+                    String roomNameString = String.valueOf(row.getCell(4).getNumericCellValue());
423
+                    roomName = roomNameString.substring(0, roomNameString.indexOf("."));
424
+                }
425
+
426
+                BigDecimal price;
427
+                try {
428
+                    price = BigDecimal.valueOf(row.getCell(5).getNumericCellValue());
429
+                }catch (Exception e){
430
+                    price = new BigDecimal(row.getCell(5).getStringCellValue());
431
+                }
432
+
433
+                Integer heat = 0;
434
+                try {
435
+                    String heatString = String.valueOf(row.getCell(6).getNumericCellValue());
436
+                    String split = heatString.substring(0, heatString.indexOf("."));
437
+                    heat = Integer.valueOf(split);
438
+                }catch (Exception e){
439
+                    String heatString = row.getCell(6).getStringCellValue();
440
+                    heat = Integer.valueOf(heatString);
441
+                }
442
+
443
+
422 444
                 Integer status = row.getCell(7).getStringCellValue().trim().equals("是") ? 1 : 0;
423 445
 
424 446
                 int currentRow = j + 1;