package com.friday.custody.service.basicService.impl;

import com.friday.custody.service.basicService.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("updateTongyiTemporaryTableService")
@Slf4j
public class UpdateTongyiTemporaryTableServiceImpl implements UpdateTongyiTemporaryTableService {
    @Autowired
    TongyiUnissuedDataService tongyiUnissuedDataService;
    @Autowired
    TongyiDirectionalupDataService tongyiDirectionalupDataService;
    @Autowired
    TongyiConvertibleBondsDataService tongyiConvertibleBondsDataService;
    @Autowired
    TongyiCeliverableBondDataService tongyiCeliverableBondDataService;
    @Autowired
    TongyiDirectionalConvertibleBondsService tongyiDirectionalConvertibleBondsService;

    @Override
    public Boolean updateTongyiTemporaryTable() {
        log.info("全市场待发行 更新");
        boolean b = tongyiUnissuedDataService.updateTongyiUnissuedToTempTable();
        log.info("定增 更新");
        boolean b1 = tongyiDirectionalupDataService.updateTongyiDirectionalupToTempTable();
        log.info("可转债已发行 更新");
        boolean b2 = tongyiConvertibleBondsDataService.updateTongyiConvertibleBondsToTempTable();
        log.info("定向可转债 更新");
        boolean b3 = tongyiDirectionalConvertibleBondsService.updateDirectionalConvertibleBondsToTempTable();
        log.info("可交债 更新");
       boolean b4 = tongyiCeliverableBondDataService.updateTongyiCeliverableToTempTable();
        if (!b || !b1 || !b2 || !b3 || !b4) {
            return false;
        }
        return true;
    }
}
