Forráskód Böngészése

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

山水共长天一色 3 éve
szülő
commit
b439f0ea19

+ 12 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/CustomerInfoServiceImpl.java

@@ -11,6 +11,7 @@ import com.management.platform.util.HttpRespMsg;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.*;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
@@ -89,13 +90,17 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
                     nameList.add(row.getCell(1).toString());
                 CustomerInfo customerInfo=new CustomerInfo();
                 List<CustomerInfo> collect = allCustomerInfo.stream().filter(sv -> sv.getCustomerName().equals(row.getCell(1).toString())).collect(Collectors.toList());
-                customerInfo.setCustomerCode(row.getCell(0).toString());
-                customerInfo.setCustomerName(row.getCell(1).toString());
-                customerInfo.setContactName(row.getCell(2).toString());
-                row.getCell(3).setCellType(CellType.STRING);
-                customerInfo.setContactPhone(row.getCell(3).getStringCellValue());
-                customerInfo.setEmail(row.getCell(4).toString());
-                customerInfo.setAddress(row.getCell(5).toString());
+                customerInfo.setCustomerCode(StringUtils.isEmpty(row.getCell(0))?"":row.getCell(0).toString());
+                customerInfo.setCustomerName(StringUtils.isEmpty(row.getCell(1))?"":row.getCell(1).toString());
+                customerInfo.setContactName(StringUtils.isEmpty(row.getCell(2))?"":row.getCell(2).toString());
+                if(StringUtils.isEmpty(row.getCell(3))){
+                    customerInfo.setContactPhone("");
+                }else {
+                    row.getCell(3).setCellType(CellType.STRING);
+                    customerInfo.setContactPhone(row.getCell(3).getStringCellValue());
+                }
+                customerInfo.setEmail(StringUtils.isEmpty(row.getCell(3))?"":row.getCell(3).toString());
+                customerInfo.setAddress(StringUtils.isEmpty(row.getCell(4))?"":row.getCell(4).toString());
                 customerInfo.setCompanyId(companyId);
                 if(collect.size()>0){
                     Integer id=collect.get(0).getId();