package com.jwipc.inquiry.impl;

import com.jwipc.inquiry.client.InquiryClient;
import com.jwipc.inquiry.dto.CalculateQuotaDTO;
import com.jwipc.inquiry.dto.InquiryDetailByIdDetailClientDTO;
import com.jwipc.inquiry.logic.InquiryLogic;
import com.jwipc.inquiry.logic.InquiryMaterialSupplierLogic;
import com.jwipc.inquiry.model.po.InquiryDetailByIdDetailPO;
import com.jwipc.inquiry.service.IInquiryService;
import com.jwipc.inquiry.service.IInquirySupplierService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shenyang.ou
 * @date 2024/4/24 10:09
 * @desc
 */
@Service
@RequiredArgsConstructor
public class InquiryClientImpl implements InquiryClient {

    private final InquiryLogic inquiryLogic;
    private final IInquiryService iInquiryService;
    private final IInquirySupplierService supplierService;
    private final InquiryMaterialSupplierLogic inquiryMaterialSupplierLogic;

    /**
     * 计算配额
     *
     * @param calculateQuotaDTOS 待计算配额
     * @return 已计算配额
     */
    @Override
    public List<CalculateQuotaDTO> calculateQuotaClient(List<CalculateQuotaDTO> calculateQuotaDTOS) {
        return inquiryMaterialSupplierLogic.calculateQuotaClient(calculateQuotaDTOS);
    }

    @Override
    public List<InquiryDetailByIdDetailClientDTO> formDeatilById(Long xjId , String supplierId ) {
        return inquiryLogic.formMaterialDeatilById(xjId,supplierId);
    }

    @Override
    public List<InquiryDetailByIdDetailClientDTO> formDetailByMaterialSupplierId(List<String> inquiryIdList, String supplierId) {
        return inquiryLogic.formDetailByMaterialSupplierId(inquiryIdList,supplierId);
    }

    @Override
    public void updateConState(Long xjdetailId , Integer state) {
        supplierService.updateConState(xjdetailId,state );
    }

    @Override
    public void updateConStateByNos(String dataSourcesNos,String supplierCode, Integer state) {
        inquiryLogic.updateConStateByNos(dataSourcesNos,supplierCode,state);
    }
}
