| | |
| | | public class DataExcelServiceImpl extends ServiceImpl<DataExcelMapper, DataExcel> implements DataExcelService { |
| | | |
| | | @Override |
| | | public IPage<DataExcel> getDataExcelPage(Long current, Long size, String unitName, String transactionNo, String accountingPeriod, List<String> permissionDeptCodes) { |
| | | public IPage<DataExcel> getDataExcelPage(Long current, Long size, String unitCode, String transactionNo, String accountingPeriod, List<String> permissionDeptCodes) { |
| | | Page<DataExcel> page = new Page<>(current, size); |
| | | page.setOptimizeJoinOfCountSql(false); |
| | | page.setOptimizeCountSql(false); |
| | | LambdaQueryWrapper<DataExcel> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.like(unitName != null && !unitName.isEmpty(), DataExcel::getUnitName, unitName) |
| | | wrapper.eq(unitCode != null && !unitCode.isEmpty(), DataExcel::getUnitCode, unitCode) |
| | | .like(transactionNo != null && !transactionNo.isEmpty(), DataExcel::getTransactionNo, transactionNo) |
| | | .eq(accountingPeriod != null && !accountingPeriod.isEmpty(), DataExcel::getAccountingPeriod, accountingPeriod) |
| | | .in(permissionDeptCodes != null && !permissionDeptCodes.isEmpty(), DataExcel::getUnitCode, permissionDeptCodes) |
| | |
| | | List<DataExcel> updateList = new ArrayList<>(); |
| | | List<String> errorMsgs = new ArrayList<>(); |
| | | int[] counts = new int[2]; |
| | | int[] counts2 = new int[2]; |
| | | |
| | | try { |
| | | EasyExcel.read(file.getInputStream(), DataExcelImport.class, new ReadListener<DataExcelImport>() { |
| | |
| | | if (existData != null) { |
| | | entity.setId(existData.getId()); |
| | | updateList.add(entity); |
| | | counts[1]++; |
| | | counts2[0]++; |
| | | } else { |
| | | insertList.add(entity); |
| | | counts[0]++; |
| | |
| | | if (counts[0] > 0) { |
| | | result.append("成功新增 ").append(counts[0]).append(" 条记录"); |
| | | } |
| | | if (counts[1] > 0) { |
| | | if (counts2[0] > 0) { |
| | | if (result.length() > 0) { |
| | | result.append(","); |
| | | } |
| | | result.append("成功更新 ").append(counts[1]).append(" 条记录"); |
| | | result.append("成功更新 ").append(counts2[0]).append(" 条记录"); |
| | | } |
| | | if (!errorMsgs.isEmpty()) { |
| | | if (result.length() > 0) { |