package com.base.plan.aysc;


import com.base.api.client.PointRpcService;
import com.base.api.model.PointRpcDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.concurrent.Future;

@Slf4j
@Component
@Async
public class AsyncTask {

    @Resource
    PointRpcService pointRpcService;

    public Future<String> addPointList(List<PointRpcDTO> pointInfos) {
        try {
            pointRpcService.addPointList(pointInfos);
            return new AsyncResult<String>("async insert point is success!");
        } catch (Exception e) {
            log.error("~~~~~~~~~rpc base-biz-server is fail msg is {}", e.getMessage());
            e.printStackTrace();
            return null;
        }

    }
}
