package com.brilliance.isc.common.bop.cfa.controller;

import com.brilliance.isc.bo.model.Cfagit;
import com.brilliance.isc.common.bop.cfa.cfagit.service.impl.GIStoreContractServiceImpl;
import com.brilliance.isc.common.bopset.service.CfagitService;
import com.brilliance.isc.common.context.SettleContext;
import com.brilliance.isc.common.vo.BizAmdInfoVo;
import com.brilliance.isc.common.vo.BizInfoVo;
import com.brilliance.isc.vo.ResponseSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @version 1.0
 * @description:
 * @data 2023/6/13 15:16
 */
public class CfaBopController<T1 extends BizInfoVo, T2 extends BizAmdInfoVo> {

    Logger cspsLogger = LoggerFactory.getLogger(CfaBopController.class);

    @Autowired
    GIStoreContractServiceImpl giStoreContractServiceImpl;


    @Autowired
    CfagitService cfagitService;

    @Autowired
    private SettleContext settleContext;

    @PostMapping("/cfabop/gisav")
    public ResponseSet cfaGISav(@RequestBody Cfagit<T1,T2> cfagit){
        cfagitService.setCfaType("eba");
        settleContext.loadSettleSession(cfagit.getTransName(), cfagit.getUserId(), cfagit.getRec(), cfagit.getPtsList());
        cfagitService.cfaBopSaveData(cfagit);
        return ResponseSet.simpleSuccess(cfagit);
    }

    @PostMapping("/cfabop/gidata")
    public ResponseSet cfaGIData(@RequestBody Cfagit<T1,T2> cfagit){
        settleContext.loadSettleSession(cfagit.getTransName(), cfagit.getUserId(), cfagit.getRec(), cfagit.getPtsList());
        return ResponseSet.simpleSuccess(cfagitService.cfaMappingData(cfagit));
    }
}
