package com.yd.csf.api.service.impl;

import com.yd.common.exception.BusinessException;
import com.yd.csf.api.service.ApiCommissionConditionService;
import com.yd.csf.service.model.PolicyFollow;
import com.yd.csf.service.service.PolicyFollowService;
import com.yd.product.feign.client.announcementcommissionratio.ApiAnnouncementCommissionRatioFeignClient;
import com.yd.product.feign.response.announcementcommissionratio.ApiAnnouncementCommissionRatioListResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 佣金条件服务类
 */
@Slf4j
@Service
public class ApiCommissionConditionServiceImpl implements ApiCommissionConditionService {

    @Autowired
    private ApiAnnouncementCommissionRatioFeignClient ratioFeignClient;

    @Autowired
    private PolicyFollowService policyFollowService;

    /**
     * 根据保单号查询保单所参与过滤产品发佣率数据筛选的字段列表数据
     * @param policyNo
     * @return
     */
    public List<ApiAnnouncementCommissionRatioListResponse> getCommissionRatioList(String policyNo) {
        //根据保单号查询保单跟进表数据
        PolicyFollow policyFollow = policyFollowService.queryOneByPolicyNo(policyNo);
        if (policyFollow == null) {
            throw new BusinessException("新单跟进表信息不存在");
        }
        //列出固定几个需要参与发佣率筛选数据的保单字段
        //供款年期（数字）
        Integer issueNumber = Integer.parseInt(policyFollow.getIssueNumber().toString());
        //投保年龄（区间值）
        //期缴保费（区间值）
        //专业投资者（Yes/No）（选项）
        //保单币种（选项）
        //保障年期（数字）
        return null;
    }


}
