浏览代码

分摊比例导入修改

yurk 2 年之前
父节点
当前提交
496ddbd18c

+ 7 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectPercentageServiceImpl.java

@@ -16,6 +16,7 @@ import com.taobao.api.internal.util.StringUtils;
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -190,7 +191,9 @@ public class ProjectPercentageServiceImpl extends ServiceImpl<ProjectPercentageM
                     msg.setError(MessageUtils.message("staff.nameNullByRow",rowIndex));
                     return msg;
                 }
-                String username = row.getCell(0).getStringCellValue().trim();
+                Cell userNameCell = row.getCell(0);
+                if (userNameCell!=null)userNameCell.setCellType(CellType.STRING);
+                String username = userNameCell.getStringCellValue().trim();
                 if(!userNameList.contains(username)&&!StringUtils.isEmpty(username)){
                     userNameList.add(username);
                 }
@@ -252,7 +255,9 @@ public class ProjectPercentageServiceImpl extends ServiceImpl<ProjectPercentageM
                         msg.setError(MessageUtils.message("staff.nameNullByRow",dataCount));
                         return msg;
                     }
-                    String username = row.getCell(0).getStringCellValue().trim();
+                    Cell userNameCell = row.getCell(0);
+                    if (userNameCell!=null)userNameCell.setCellType(CellType.STRING);
+                    String username = userNameCell.getStringCellValue().trim();
                     //检查人员是否存在
                     Optional<User> userOp;
                     if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){