package com.brilliance.isc.common.bopset.controller;

import com.brilliance.isc.bo.model.Boprem;
import com.brilliance.isc.common.bopset.service.BopremService;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

@Api("收支申报境内外汇款服务")
public class AbstractBopremController<T1 extends BizInfoVo, T2 extends BizAmdInfoVo> {

    @Autowired
    private BopremService bopremService;
    @Autowired
    private SettleContext settleContext;

    Logger logger = LoggerFactory.getLogger(AbstractBopremController.class);

    @ApiOperation("收支申报boprem前端数据交互（试算）")
    public ResponseSet<Boprem> mappingBopgatData(Boprem<T1, T2>  boprem) {
        try {
            settleContext.loadSettleSession(boprem.getTransName(), boprem.getUserId(), boprem.getRec(), boprem.getPtsList());
            return ResponseSet.simpleSuccess(bopremService.mappingBopremDataAAAAAA(boprem));
        } catch (Exception ex) {
            logger.error("收支申报boprem前端试算异常",ex);
            throw ex;
        } finally {
            SettleContext.removeUserSession();
        }
    }

}
