| | |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.mapper.PaymentRegistrationMapper; |
| | | import com.ruoyi.purchase.mapper.ProductRecordMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.mapper.TicketRegistrationMapper; |
| | | import com.ruoyi.purchase.pojo.PaymentRegistration; |
| | | import com.ruoyi.purchase.pojo.ProductRecord; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.purchase.pojo.TicketRegistration; |
| | |
| | | |
| | | private final ProductRecordMapper productRecordMapper; |
| | | |
| | | private final PaymentRegistrationMapper paymentRegistrationMapper; |
| | | |
| | | private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | |
| | | private final StringRedisTemplate redisTemplate; |
| | |
| | | if(ObjectUtils.isNotEmpty(loginUser) && null != loginUser.getTenantId()) { |
| | | purchaseLedger.setTenantId(loginUser.getTenantId()); |
| | | } |
| | | purchaseLedger.setSalesContractNo(ObjectUtils.isNotEmpty(salesLedger) ? salesLedger.getSalesContractNo() : null); |
| | | purchaseLedger.setSalesContractNo(ObjectUtils.isNotEmpty(salesLedger) ? salesLedger.getSalesContractNo() : ""); |
| | | purchaseLedger.setSalesLedgerId(ObjectUtils.isNotEmpty(salesLedger) ? salesLedger.getId() : -1); |
| | | purchaseLedger.setSupplierName(supplierManage.getSupplierName()); |
| | | purchaseLedger.setRecorderId(purchaseLedgerDto.getRecorderId()); |
| | | purchaseLedger.setRecorderName(sysUser.getNickName()); |
| | |
| | | salesLedgerProductMapper.delete(queryWrapper); |
| | | // 批量删除关联的采购台账的来票登记 |
| | | LambdaQueryWrapper<TicketRegistration> ticketRegistrationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | ticketRegistrationLambdaQueryWrapper.in(TicketRegistration::getSalesLedgerId,ids); |
| | | ticketRegistrationLambdaQueryWrapper.in(TicketRegistration::getPurchaseLedgerId,ids); |
| | | ticketRegistrationMapper.delete(ticketRegistrationLambdaQueryWrapper); |
| | | // 批量删除关联的采购台账的来票登记记录 |
| | | LambdaQueryWrapper<ProductRecord> productRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | productRecordLambdaQueryWrapper.in(ProductRecord::getPurchaseLedgerId,ids); |
| | | productRecordMapper.delete(productRecordLambdaQueryWrapper); |
| | | // 批量删除付款登记 |
| | | LambdaQueryWrapper<PaymentRegistration> paymentRegistrationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | paymentRegistrationLambdaQueryWrapper.in(PaymentRegistration::getPurchaseLedgerId,ids); |
| | | paymentRegistrationMapper.delete(paymentRegistrationLambdaQueryWrapper); |
| | | // 批量删除采购台账 |
| | | return purchaseLedgerMapper.deleteBatchIds(Arrays.asList(ids)); |
| | | } |
| | |
| | | |
| | | // 3.查询上传文件 |
| | | LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerFileWrapper.eq(CommonFile::getCommonId, purchaseLedger.getId()); |
| | | salesLedgerFileWrapper.eq(CommonFile::getCommonId, purchaseLedger.getId()) |
| | | .eq(CommonFile::getType, FileNameType.PURCHASE.getValue()); |
| | | List<CommonFile> salesLedgerFiles = commonFileMapper.selectList(salesLedgerFileWrapper); |
| | | |
| | | // 4. 转换 DTO |
| | |
| | | public IPage<PurchaseLedgerDto> selectPurchaseLedgerListPage(IPage ipage, PurchaseLedgerDto purchaseLedger) { |
| | | IPage<PurchaseLedgerDto> purchaseLedgerDtoIPage = purchaseLedgerMapper.selectPurchaseLedgerListPage(ipage, purchaseLedger); |
| | | purchaseLedgerDtoIPage.getRecords().forEach(purchaseLedgerDto -> { |
| | | List<CommonFile> commonFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, purchaseLedgerDto.getId()).eq(CommonFile::getType, FileNameType.PURCHASELEDGER.getValue())); |
| | | List<CommonFile> commonFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, purchaseLedgerDto.getId()).eq(CommonFile::getType, FileNameType.PURCHASE.getValue())); |
| | | purchaseLedgerDto.setSalesLedgerFiles(commonFiles); |
| | | }); |
| | | return purchaseLedgerDtoIPage; |