package com.zcxk.rmcp.web.service;

import com.zcxk.rmcp.core.entity.ImportFile;
import com.zcxk.rmcp.web.excel.resolver.ResolverExcelTemplate;
import com.zcxk.rmcp.web.excel.resolver.service.InstallHandleExcelServiceImpl;
import com.zcxk.rmcp.web.excel.resolver.service.InstallPlanHandleExcelService;
import com.zcxk.rmcp.web.excel.resolver.service.WaterDeviceHandleExcelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author linqingwei
 * @date 2021-07-23 16:05
 */
@Slf4j
@Service
public class AsyncTaskImportService {

    @Autowired
    private WaterDeviceHandleExcelService waterDeviceHandleExcelService;
    @Autowired
    private InstallHandleExcelServiceImpl installHandleExcelService;
    @Autowired
    private InstallPlanHandleExcelService installPlanHandleExcelService;

    @Async
    public void executeAsyncDeviceTask(ImportFile importFile, Integer sysId){
        log.info("begin executeAsyncDeviceTask!");
        ResolverExcelTemplate template = new ResolverExcelTemplate(waterDeviceHandleExcelService);
        template.build(importFile);
        log.info("end executeAsyncDeviceTask!");
    }

    @Async
    public void executeAsyncInstallTask(ImportFile importFile, Integer sysId){
        log.info("begin executeAsyncInstallTask!");
        ResolverExcelTemplate template = new ResolverExcelTemplate(installHandleExcelService);
        template.build(importFile);
        log.info("end executeAsyncInstallTask!");
    }

    @Async
    public void executeAsyncInstallPanTask(ImportFile importFile, Integer sysId){
        log.info("begin executeAsyncInstallTask!");
        ResolverExcelTemplate template = new ResolverExcelTemplate(installPlanHandleExcelService);
        template.build(importFile);
        log.info("end executeAsyncInstallTask!");
    }
}
