| | |
| | | public void importDept(List<DeptImportExcel> data, Boolean isCovered) { |
| | | List<Dept> list = new ArrayList<>(); |
| | | data.forEach(deptExcel -> { |
| | | // 校验必填字段 |
| | | if (deptExcel.getDeptName() == null || deptExcel.getDeptName().trim().isEmpty()) { |
| | | throw new RuntimeException("机构名称不能为空"); |
| | | } |
| | | if (deptExcel.getAreaCode() == null || deptExcel.getAreaCode().trim().isEmpty()) { |
| | | throw new RuntimeException("所属区划编码不能为空"); |
| | | } |
| | | if (deptExcel.getRemark() == null || deptExcel.getRemark().trim().isEmpty()) { |
| | | throw new RuntimeException("机构描述不能为空"); |
| | | } |
| | | if (deptExcel.getStatus() == null || deptExcel.getStatus().trim().isEmpty()) { |
| | | throw new RuntimeException("机构状态不能为空"); |
| | | } |
| | | // 转换数据 |
| | | Dept dept = BeanUtil.copy(deptExcel, Dept.class); |
| | | list.add(dept); |
| | | }); |