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

import cn.superdesk.uniorder.dto._variable.AccountingScoreCustomerVariable;
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: 2021/3/2 下午2:02
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/3/2 下午2:02
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Slf4j
@Configuration
@ConditionalOnProperty(prefix = "uniorder.setting", name = "enabled", havingValue = "true")
public class AccountingScoreCustomerConfiguration {

	/**************************************** AccountingScoreCustomer start ****************************************/

	/**
	 * 对账单存在“未完成/售后中”的订单流水，不允许创建对账单
	 */

	@Value("${uniorder.setting.accounting.score.customer.opCreate.insist_on_able:false}")
	private Boolean opCreateInsistOnAble;

	/**************************************** AccountingScoreCustomer start ****************************************/


	/**
	 * initExcelExportConstant
	 *
	 * @return
	 */
	@Bean
	public AccountingScoreCustomerVariable accountingScoreCustomerVariable() {

		return AccountingScoreCustomerVariable
				.builder()
				// 积分结算-未对账流水-创建对账单 对账单存在 未完成/售后中 的订单流水，是否能创建对账单 是-允许 否-不允许
				.opCreateInsistOnAble(opCreateInsistOnAble)

				.build();
	}

}
