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.lc.BedBizInfoVo;
import org.springframework.stereotype.Service;

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

        BedBizInfoVo bedbiz = (BedBizInfoVo) cfabop.getRec();

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

                break;
            default:
                break;
        }
    }
}
