| | |
| | | private final InvoiceLedgerMapper invoiceLedgerMapper; |
| | | |
| | | private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper; |
| | | private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | |
| | | LambdaQueryWrapper<SalesLedgerScheduling> in = new LambdaQueryWrapper<SalesLedgerScheduling>() |
| | | .in(SalesLedgerScheduling::getSalesLedgerId, idList); |
| | | salesLedgerSchedulingMapper.delete(in); |
| | | LambdaQueryWrapper<InvoiceRegistrationProduct> InvoiceRegistrationProductWrapper = new LambdaQueryWrapper<>(); |
| | | InvoiceRegistrationProductWrapper.in(InvoiceRegistrationProduct::getSalesLedgerId, idList); |
| | | List<InvoiceRegistrationProduct> invoiceRegistrationProducts = invoiceRegistrationProductMapper.selectList(InvoiceRegistrationProductWrapper); |
| | | if (!CollectionUtils.isEmpty(invoiceRegistrationProducts)) { |
| | | List<Integer> InvoiceRegistrationProductIds = invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getId).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<InvoiceLedger> invoiceLedgerQuery = new LambdaQueryWrapper<>(); |
| | | invoiceLedgerQuery.in(InvoiceLedger::getInvoiceRegistrationProductId, InvoiceRegistrationProductIds); |
| | | invoiceLedgerMapper.delete(invoiceLedgerQuery); |
| | | } |
| | | // 2. 再删除主表数据 |
| | | return salesLedgerMapper.deleteBatchIds(idList); |
| | | } |
| | |
| | | } else { |
| | | salesLedgerMapper.updateById(salesLedger); |
| | | SalesLedger salesLedgerDB = salesLedgerMapper.selectById(salesLedger.getId()); |
| | | AccountIncome accountIncomeDB = accountIncomeService.getByInvoiceNumber(salesLedger.getSalesContractNo()); |
| | | if (ObjectUtils.isEmpty(accountIncomeDB)) { |
| | | throw new BaseException("收入管理无该销售合同的收入记录"); |
| | | List<AccountIncome> accountIncomeDBs = accountIncomeService.getByInvoiceNumberList(salesLedger.getSalesContractNo()); |
| | | if (!CollectionUtils.isEmpty(accountIncomeDBs)) { |
| | | accountIncomeDBs.forEach(accountIncomeDB ->{ |
| | | accountIncomeDB.setCustomerName(salesLedgerDB.getCustomerName()); |
| | | accountIncomeDB.setIncomeMoney(salesLedgerDB.getContractAmount()); |
| | | accountIncomeDB.setIncomeDescribed("销售合同:" + salesLedgerDB.getSalesContractNo()); |
| | | accountIncomeDB.setInvoiceNumber(salesLedgerDB.getSalesContractNo()); |
| | | accountIncomeDB.setInputTime(new Date()); |
| | | accountIncomeDB.setInputUser(salesLedgerDB.getEntryPerson()); |
| | | accountIncomeService.updateById(accountIncomeDB); |
| | | }); |
| | | } |
| | | accountIncomeDB.setCustomerName(salesLedgerDB.getCustomerName()); |
| | | accountIncomeDB.setIncomeMoney(salesLedgerDB.getContractAmount()); |
| | | accountIncomeDB.setIncomeDescribed("销售合同:" + salesLedgerDB.getSalesContractNo()); |
| | | accountIncomeDB.setInvoiceNumber(salesLedgerDB.getSalesContractNo()); |
| | | accountIncomeDB.setInputTime(new Date()); |
| | | accountIncomeDB.setInputUser(salesLedgerDB.getEntryPerson()); |
| | | accountIncomeService.updateById(accountIncomeDB); |
| | | |
| | | } |
| | | |
| | | // 4. 处理子表数据 |