package com.inkasso.factoring.purchManagement.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.inkasso.factoring.common.util.ElectronicSignatureUtil;
import com.inkasso.factoring.file.entity.FileStorageDO;
import com.inkasso.factoring.file.enums.FileTypeEnum;
import com.inkasso.factoring.file.service.FileService;
import com.inkasso.factoring.purchManagement.entity.CPurchContractBasicInfo;
import com.inkasso.factoring.purchManagement.entity.CPurchContractElectronicInfo;
import com.inkasso.factoring.purchManagement.dao.CPurchContractElectronicInfoMapper;
import com.inkasso.factoring.purchManagement.entity.CPurchContractManagement;
import com.inkasso.factoring.purchManagement.service.ICPurchContractBasicInfoService;
import com.inkasso.factoring.purchManagement.service.ICPurchContractElectronicInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.inkasso.factoring.purchManagement.service.ICPurchContractManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 采购合同-电子合同信息表 服务实现类
 * </p>
 *
 * @author yafan
 * @since 2023-12-13
 */
@Service
public class CPurchContractElectronicInfoServiceImpl extends ServiceImpl<CPurchContractElectronicInfoMapper, CPurchContractElectronicInfo>
        implements ICPurchContractElectronicInfoService {

    @Autowired
    private ICPurchContractManagementService purchContractService;
    @Autowired
    private ICPurchContractBasicInfoService purchContractBasicInfoService;
    @Autowired
    private FileService fileService;

    @Override
    public void flushUrl(Long businessKey) {
        CPurchContractManagement purchContractManagement = purchContractService.getById(businessKey);
        CPurchContractBasicInfo purch = purchContractBasicInfoService.getOne(new QueryWrapper<CPurchContractBasicInfo>()
                .eq("c_purch_contract_management_id",businessKey));
        //删除合同对应的最新签署信息
        lambdaUpdate().eq(CPurchContractElectronicInfo::getcPurchContractBasicInfoId,purch.getId()).remove();
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void doSignCallBackByQuery(String contractId,Boolean downloadContract) {

    }

}
