Ver Fonte

导入箱信息

sunhz há 3 anos atrás
pai
commit
d8f7a19c2d

+ 5 - 4
ruoyi-shipping/src/main/java/com/ruoyi/shipping/service/impl/TCntrnoServiceImpl.java

@@ -37,6 +37,7 @@ import org.springframework.stereotype.Service;
 import com.ruoyi.shipping.service.ITCntrnoService;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.util.ObjectUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import static com.ruoyi.common.utils.poi.Excel.filter;
@@ -411,7 +412,7 @@ public class TCntrnoServiceImpl implements ITCntrnoService {
                     continue;
                 }
                 TCntrnoExcel companyMsg = new TCntrnoExcel();
-                for (int a = 0; a < rows.getPhysicalNumberOfCells(); a++) {
+                for (int a = 0; a <= rows.getPhysicalNumberOfCells(); a++) {
                     Cell cell = rows.getCell(a);
                     if (cell == null){
                         continue;
@@ -518,12 +519,12 @@ public class TCntrnoServiceImpl implements ITCntrnoService {
                             companyMsg.setfPactDealHorn(cell.getStringCellValue());
                             break;
                         case "起租时间":
-                            cell.setCellType(CellType.STRING);
-                            if (StringUtils.isEmpty(cell.getStringCellValue())) {
+                            cell.setCellType(CellType.NUMERIC);
+                            if (ObjectUtils.isEmpty(cell.getDateCellValue())) {
                                 /*return AjaxResult.error("Excel箱信息数据第" + line + "行数据缺少起租时间");*/
                                 break;
                             }
-                            companyMsg.setOnHireStart(DateUtils.parseDate(cell.getStringCellValue()));
+                            companyMsg.setOnHireStart(cell.getDateCellValue());
                             break;
                         /*case "箱来源":
                             //设置单元格类型