Przeglądaj źródła

批量导入费用报销数据修改

yurk 3 lat temu
rodzic
commit
c053482390

+ 4 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ExpenseSheetServiceImpl.java

@@ -320,13 +320,16 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
                     if (invoiceNoCell != null) invoiceNoCell.setCellType(CellType.STRING);
                     if (taxPercentCell != null) taxPercentCell.setCellType(CellType.NUMERIC);
                     if (remarkCell != null) remarkCell.setCellType(CellType.STRING);
+                    if(codeCell==null){
+                        throw  new Exception("项目编号/项目名称不能为空");
+                    }
                     ExpenseItem expenseItem = new ExpenseItem();
                     Optional<Project> project = projectList.stream().filter(pro ->(StringUtils.isEmpty(pro.getProjectCode())?"":pro.getProjectCode()).equals(codeCell.getStringCellValue())
                             || (StringUtils.isEmpty(pro.getProjectName())?"":pro.getProjectName()).equals(codeCell.getStringCellValue())).findFirst();
                     if (project.isPresent()) {
                         expenseItem.setProjectId(project.get().getId());
                     } else {
-                        throw new Exception("项目编号为[" + codeCell.getStringCellValue() + "]的项目不存在");
+                        throw new Exception("项目编号/项目名称为[" + codeCell.getStringCellValue() + "]的项目不存在");
                     }
                     expenseItem.setExpenseId(expenseSheet.getId());
                     LocalDate happenDate = Instant.ofEpochMilli(happenDateCell.getDateCellValue().getTime())