| | |
| | | import com.ruoyi.sales.mapper.*; |
| | | import com.ruoyi.sales.pojo.*; |
| | | import com.ruoyi.sales.service.InvoiceLedgerService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.YearMonth; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class InvoiceLedgerServiceImpl extends ServiceImpl<InvoiceLedgerMapper, InvoiceLedger> implements InvoiceLedgerService { |
| | | |
| | | @Value("${ruoyi.profile}") |
| | | private String uploadFile; |
| | | |
| | | @Autowired |
| | | private InvoiceLedgerMapper invoiceLedgerMapper; |
| | | |
| | | @Autowired |
| | | private InvoiceLedgerFileMapper invoiceLedgerFileMapper; |
| | | |
| | | @Autowired |
| | | private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | |
| | | @Autowired |
| | | private ReceiptPaymentMapper receiptPaymentMapper; |
| | | |
| | | @Autowired |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | @Autowired |
| | | private CommonFileMapper commonFileMapper; |
| | | private final InvoiceLedgerMapper invoiceLedgerMapper; |
| | | private final InvoiceLedgerFileMapper invoiceLedgerFileMapper; |
| | | private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | private final ReceiptPaymentMapper receiptPaymentMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | |
| | | /** |
| | | * 开票台账新增 |
| | |
| | | if(ObjectUtils.isEmpty(invoiceRegistrationProductDto)){ |
| | | throw new RuntimeException("产品开票台账查找失败"); |
| | | } |
| | | List<InvoiceRegistrationProduct> invoiceRegistrationProducts = invoiceRegistrationProductMapper.selectList(new LambdaQueryWrapper<InvoiceRegistrationProduct>() |
| | | .eq(InvoiceRegistrationProduct::getSalesLedgerProductId, invoiceRegistrationProductDto.getSalesLedgerProductId())); |
| | | if(CollectionUtils.isNotEmpty(invoiceRegistrationProducts)){ |
| | | invoiceRegistrationProductDto.setNoInvoiceNum(invoiceRegistrationProductDto.getQuantity() |
| | | .subtract(invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getInvoiceNum).reduce(BigDecimal.ZERO, BigDecimal::add))); |
| | | invoiceRegistrationProductDto.setNoInvoiceAmount(invoiceRegistrationProductDto.getTaxInclusiveTotalPrice() |
| | | .subtract(invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getInvoiceAmount).reduce(BigDecimal.ZERO, BigDecimal::add))); |
| | | } |
| | | // 查询附件 |
| | | QueryWrapper<InvoiceLedgerFile> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("invoice_ledger_id", invoiceRegistrationProductDto.getInvoiceLedgerId()); |