liding
昨天 c7ce2c2342f427bbad0263ab9e35585f6b98ee93
src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
@@ -6,6 +6,9 @@
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.mapper.AccountExpenseMapper;
import com.ruoyi.account.pojo.AccountExpense;
import com.ruoyi.account.service.AccountExpenseService;
import com.ruoyi.basic.mapper.SupplierManageMapper;
import com.ruoyi.basic.pojo.SupplierManage;
import com.ruoyi.common.utils.DateUtils;
@@ -60,6 +63,8 @@
    private ProductRecordMapper productRecordMapper;
    private AccountExpenseService accountExpenseService;
    /**
     * 查询付款登记
     *
@@ -98,7 +103,7 @@
     */
    @Override
    public int insertPaymentRegistration(List<PaymentRegistration> paymentRegistrationList) {
        Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
        LoginUser userId = SecurityUtils.getLoginUser();
        for (PaymentRegistration paymentRegistration : paymentRegistrationList) {
            PaymentRegistration byId = paymentRegistration;
            if (!ObjectUtils.isEmpty(paymentRegistration.getId())){
@@ -114,11 +119,24 @@
            }
            paymentRegistration.setCreateTime(DateUtils.getNowDate());
            paymentRegistration.setUpdateTime(DateUtils.getNowDate());
            paymentRegistration.setRegistrantId(userId);
            paymentRegistration.setRegistrantId(userId.getUserId());
            salesLedgerProduct.setTicketsTotal(salesLedgerProduct.getTicketsTotal().add(paymentRegistration.getCurrentPaymentAmount()));
            salesLedgerProduct.setPendingTicketsTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getTicketsTotal()));
            paymentRegistrationMapper.insert(paymentRegistration);
            salesLedgerProductMapper.updateById(salesLedgerProduct);
            // 2. 处理账户收入
            AccountExpense accountExpense = new AccountExpense();
            accountExpense.setExpenseDate(purchaseLedger.getEntryDate());
            accountExpense.setExpenseType("0");
            accountExpense.setSupplierName(purchaseLedger.getSupplierName());
            accountExpense.setExpenseMoney(paymentRegistration.getCurrentPaymentAmount());
            accountExpense.setExpenseDescribed("付款支出");
            accountExpense.setExpenseMethod("0");
            accountExpense.setBusinessId(paymentRegistration.getId());
            accountExpense.setBusinessType(1);
            accountExpense.setInputTime(new Date());
            accountExpense.setInputUser(userId.getNickName());
            accountExpenseService.save(accountExpense);
        }
        return 1;
@@ -458,6 +476,16 @@
        return paymentRegistrationMapper.deleteById(id);
    }
    @Override
    public IPage<PaymentRegistrationDto> supplierNameListPage(Page page, PaymentLedgerDto paymentLedgerDto) {
        return paymentRegistrationMapper.supplierNameListPage(page, paymentLedgerDto);
    }
    @Override
    public List<PaymentRegistrationDto> supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto) {
        return paymentRegistrationMapper.supplierNameListPageDetails(paymentLedgerDto);
    }
    // 批量查询采购台账(当月)
    private Map<Long, List<PurchaseLedger>> batchQueryPurchaseLedgers(List<Long> supplierIds, LocalDate startDate, LocalDate endDate) {
        LambdaQueryWrapper<PurchaseLedger> query = new LambdaQueryWrapper<>();