package cn.superdesk.uniorder.config.biz.accounting;

import cn.superdesk.uniorder.dto._variable.ThirdpartJdAccountingVariable;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 2022/7/6 10:15 上午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/7/6 10:15 上午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Slf4j
@Configuration
@ConditionalOnProperty(prefix = "uniorder.setting", name = "enabled", havingValue = "true")
public class ThirdpartJdAccountingConfiguration {

    @Value("${uniorder.setting.thirdpart.jd.accounting.OpCompareOrderAndCheckUp.is_limit_sale:true}")
    private Boolean isLimitSale;

    @Value("${uniorder.setting.thirdpart.jd.accounting.OpCompareOrderAndCheckUp.is_open_thread_pool:false}")
    private Boolean isOpenThreadPool;
    @Value("${uniorder.setting.thirdpart.jd.accounting.OpCompareOrderAndCheckUp.core_pool_size:5}")
    private Integer corePoolSize;
    @Value("${uniorder.setting.thirdpart.jd.accounting.OpCompareOrderAndCheckUp.max_pool_size:10}")
    private Integer maxPoolSize;

    @Bean
    public ThirdpartJdAccountingVariable thirdpartJdAccountingVariable() {

        return ThirdpartJdAccountingVariable
                .builder()
                // 供应商结算-京东对账-导入账单 比对订单时 是否受限于选择的供应商订单 是-只能是选择的供应商;否-全部供应商
                .isLimitSale(isLimitSale)

                .isOpenThreadPool(isOpenThreadPool)
                .corePoolSize(corePoolSize)
                .maxPoolSize(maxPoolSize)

                .build();
    }
}
