/**
 * @filename:0ayableAccountsServiceImpl 2024-11-05
 * @project KJT v1.1.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
 */
package com.trade.service.business.payableaccounts.service.impl;

import com.trade.service.business.payableaccounts.domain.PayableAccounts;
import com.trade.service.business.payableaccounts.dto.PayableAccountsSearchDto;
import com.trade.service.business.payableaccounts.dto.ServiceFeeDto;
import com.trade.service.business.payableaccounts.mapper.PayableAccountsMapper;
import com.trade.service.business.payableaccounts.service.PayableAccountsService;
import com.trade.service.finance.constant.BillingConstant;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description:应付账款关联表服务实现
 * @version: v1.1.0
 * @author: wanglang
 */
@Service
public class PayableAccountsServiceImpl extends ServiceImpl<PayableAccountsMapper, PayableAccounts> implements PayableAccountsService {

    @Override
    public List<PayableAccounts> queryByPage(PayableAccountsSearchDto searchDto) {
        return this.baseMapper.selectByPage(searchDto);
    }

    @Override
    public boolean saveTaxRefundServiceFee(ServiceFeeDto refundServiceFeeDto) {
        PayableAccounts payableAccounts = new PayableAccounts();
        payableAccounts.setCustomerUserId(refundServiceFeeDto.getCustomerUserId());
        payableAccounts.setPaymentAmount(refundServiceFeeDto.getPaymentAmount());
        payableAccounts.setPaymentCurrency(refundServiceFeeDto.getPaymentCurrency());
        payableAccounts.setPaymentDeadline(refundServiceFeeDto.getPaymentDeadline());
        payableAccounts.setPayeeName(refundServiceFeeDto.getPayeeName());
        payableAccounts.setStatus(BillingConstant.PAYMENT_STATUS_WAIT);
        payableAccounts.setPayeeType(BillingConstant.PAYEE_TYPE_CHANGYIN_TECHNOLOGY);
        payableAccounts.setPaymentType(BillingConstant.PAYMENT_TYPE_TAX_REFUND_FEE);
        payableAccounts.setSource(2);
        return this.save(payableAccounts);
    }
}
