package com.brilliance.isc.common.bop.cfa.cfabop.register.impl;

import com.brilliance.mda.runtime.mda.util.MdaUtils;
import com.brilliance.isc.bo.model.Cfabop;
import com.brilliance.isc.bo.model.CfaecaBizInfo;
import com.brilliance.isc.common.bop.cfa.cfabop.register.CfabopRegister;
import com.brilliance.isc.vo.collection.BodBizInfoVo;
import org.springframework.stereotype.Service;

@Service("bod.cfabopRegister")
public class BodCfabopRegisterImpl implements CfabopRegister {
    @Override
    public void registerCfabopBizInfo(Cfabop cfabop, String cfatyp) {
        if(MdaUtils.isEmpty(cfatyp)){
            cspsLogger.warn("报送类型为空，组数结束!");
            return;
        }

        BodBizInfoVo bodbiz = (BodBizInfoVo) cfabop.getRec();

        //依据报送类型 进行报送要素提取
        switch (cfatyp)
        {
            case "ECA":
                CfaecaBizInfo cfaecaBizInfo = cfabop.getCfaeca().getCfaecaBizInfo();
                cfaecaBizInfo.setFinownref(bodbiz.getBptbckVo().getWrkbpdgrp().getRec().getOwnref());
                cfaecaBizInfo.setStttendat(bodbiz.getBptbckVo().getWrkbpdgrp().getRec().getOpndat());
                cfaecaBizInfo.setMatdat(bodbiz.getBptbckVo().getWrkbpdgrp().getRec().getMatdat());
                cfaecaBizInfo.setCfarat(bodbiz.getBptbckVo().getWrkbpdgrp().getRec().getTolrat());
                cfaecaBizInfo.setFincod(bodbiz.getBptbckVo().getWrkfinmod().getFincod());
                cfaecaBizInfo.setFinamt(bodbiz.getBptbckVo().getWrkfinmod().getCbs().getCbe().getAmt());
                cfaecaBizInfo.setIntamt(bodbiz.getBptbckVo().getWrkfinmod().getIntamt());
                cfaecaBizInfo.setTotint(bodbiz.getBptbckVo().getWrkfinmod().getCbs().getTotint());
                cfaecaBizInfo.setMaxcur(bodbiz.getBptbckVo().getWrkbpdgrp().getCbs().getMax().getCur());
                cfaecaBizInfo.setMaxamt(bodbiz.getBptbckVo().getWrkbpdgrp().getCbs().getMax().getAmt());
                break;
            case "EAD":

                break;
            default:
                break;
        }
    }
}
