|
@@ -314,6 +314,28 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
|
|
|
BigDecimal bigDecimal = new BigDecimal(0);
|
|
|
List<ExpenseItem> expenseItemList = new ArrayList<>();
|
|
|
int i=0;
|
|
|
+ String errorAboutProject="";
|
|
|
+ for (int rowIndex = 5; rowIndex <= rowNum; rowIndex++) {
|
|
|
+ XSSFRow row = sheet.getRow(rowIndex);
|
|
|
+ if (row == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //跳过空行
|
|
|
+ if (ExcelUtil.isRowEmpty(row)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //项目编号 费用日期 发拍种类 费用类型 费用金额 发票号 税率 税额 备注
|
|
|
+ XSSFCell codeCell = row.getCell(0);
|
|
|
+ if (codeCell != null) codeCell.setCellType(CellType.STRING);
|
|
|
+ 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()) {
|
|
|
+ errorAboutProject+=codeCell.getStringCellValue()+"/";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!errorAboutProject.equals("")){
|
|
|
+ throw new Exception("项目编号/项目名称为[" +errorAboutProject+"]的项目不存在");
|
|
|
+ }
|
|
|
for (int rowIndex = 5; rowIndex <= rowNum; rowIndex++) {
|
|
|
XSSFRow row = sheet.getRow(rowIndex);
|
|
|
if (row == null) {
|
|
@@ -351,8 +373,6 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
|
|
|
|| (StringUtils.isEmpty(pro.getProjectName())?"":pro.getProjectName()).equals(codeCell.getStringCellValue())).findFirst();
|
|
|
if (project.isPresent()) {
|
|
|
expenseItem.setProjectId(project.get().getId());
|
|
|
- } else {
|
|
|
- throw new Exception("项目编号/项目名称为[" + codeCell.getStringCellValue() + "]的项目不存在");
|
|
|
}
|
|
|
expenseItem.setExpenseId(expenseSheet.getId());
|
|
|
if(happenDateCell!=null && !happenDateCell.toString().trim().equals("")){
|