wujianwei
2025-12-23 f7e996bc2687221557f3364d00cc4151070b812c
tms/src/main/java/com/ruoyi/tms/service/impl/TmsCustomerInfoServiceImpl.java
@@ -2,8 +2,12 @@
import java.util.List;
import com.ruoyi.common.enums.SystemDataNoEnum;
import com.ruoyi.common.utils.DateUtils;
import javax.annotation.Resource;
import com.ruoyi.system.service.ISystemDataNoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import org.springframework.scheduling.annotation.Async;
@@ -15,6 +19,8 @@
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.core.service.BaseService;
import com.ruoyi.cwgl.service.IBankAccountConfigService;
import com.ruoyi.cwgl.service.IInvoiceInfoService;
import com.ruoyi.tms.mapper.TmsCustomerInfoMapper;
import com.ruoyi.tms.domain.TmsCustomerInfo;
import com.ruoyi.tms.service.ITmsCustomerInfoService;
@@ -33,7 +39,14 @@
    protected final Logger logger = LoggerFactory.getLogger(getClass());
    @Resource
    private TmsCustomerInfoMapper tmsCustomerInfoMapper;
    @Autowired
    ISystemDataNoService systemDataNoService;
    @Autowired
    IInvoiceInfoService invoiceInfoService;
    @Autowired
    IBankAccountConfigService bankAccountConfigService;
    /**
     * 查询客户信息
@@ -102,8 +115,35 @@
    @Override
    public int insertTmsCustomerInfo(TmsCustomerInfo tmsCustomerInfo)
    {
        tmsCustomerInfo.setCustomerCode(systemDataNoService.getNoByKey(SystemDataNoEnum.CUST));
        tmsCustomerInfo.setCreateTime(DateUtils.getNowDate());
        return tmsCustomerInfoMapper.insertTmsCustomerInfo(tmsCustomerInfo);
        // 保存客户信息
        int result = tmsCustomerInfoMapper.insertTmsCustomerInfo(tmsCustomerInfo);
        // 获取客户ID和客户名称
        Integer customerId = tmsCustomerInfo.getId();
        String customerName = tmsCustomerInfo.getCustomerFullName();
        // 保存发票信息列表
        if (tmsCustomerInfo.getInvoiceInfoList() != null && !tmsCustomerInfo.getInvoiceInfoList().isEmpty()) {
            tmsCustomerInfo.getInvoiceInfoList().forEach(invoiceInfo -> {
                invoiceInfo.setCustomerId(customerId);
                invoiceInfo.setCustomerName(customerName);
            });
            invoiceInfoService.insertInvoiceInfoBatch(tmsCustomerInfo.getInvoiceInfoList());
        }
        // 保存银行账号配置列表
        if (tmsCustomerInfo.getBankAccountConfigList() != null && !tmsCustomerInfo.getBankAccountConfigList().isEmpty()) {
            tmsCustomerInfo.getBankAccountConfigList().forEach(bankAccountConfig -> {
                bankAccountConfig.setCustomerId(customerId);
                bankAccountConfig.setCustomerName(customerName);
            });
            bankAccountConfigService.insertBankAccountConfigBatch(tmsCustomerInfo.getBankAccountConfigList());
        }
        return result;
    }
    /**