package com.ho.business.feignclient;

import com.ho.business.entity.HeartbeatResp;
import com.ho.business.entity.OrderIssuedReqVO;
import com.ho.business.entity.OrderPlanPowerReq;
import com.ho.business.entity.OrderProcessResp;
import com.ho.business.vo.req.StationReq;
import com.ho.common.tools.annotation.TokenIgnore;
import com.ho.common.tools.constant.ContextConstant;
import com.ho.common.tools.entity.WeatherRespVo;
import com.ho.common.tools.exception.DataResult;
import com.ho.common.tools.vo.req.CardInfoReqVo;
import com.ho.common.tools.vo.req.WeatherReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @描述 调用file-center
 * @创建时间 2021/8/9
 * @修改人
 */
@FeignClient(value = ContextConstant.FILE_CENTER, fallback = FileCenterFeignClientFallBack.class)
public interface FileCenterFeignClient {

    // 查天气
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.MEDIA_CONTEXT + "/weather/getWeatherForOther")
    DataResult<WeatherRespVo> queryWeather(@RequestBody WeatherReq weatherReq);

    //根据sn判断通道是否在线
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FILE_CENTER + "outerApi/getBySnIsOnline")
    Boolean getBySnIsOnline(@RequestBody String sn);

    //根据电站查询天气
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.MEDIA_CONTEXT + "weather/stationWeatherInfo")
    DataResult<WeatherRespVo> getByStationIdWeather(@RequestBody StationReq stationReq);


    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.MEDIA_CONTEXT + "file/fileUploadForStation",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    DataResult<HeartbeatResp> fileUploadForDevice(@RequestBody MultipartFile file, @RequestParam("stationId") Integer stationId, @RequestParam("serialNo") String serialNo, @RequestParam("filePath") String filePath);

    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.MEDIA_CONTEXT + "orderSend/orderIssued4plan")
    DataResult<HeartbeatResp> orderIssued(@RequestBody OrderIssuedReqVO vo);

    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.MEDIA_CONTEXT + "orderSend/progressBar")
    DataResult<OrderProcessResp> progressBar(@RequestBody OrderIssuedReqVO vo);


    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.MEDIA_CONTEXT + "orderSend/sendPlanPowerOrder")
    DataResult<HeartbeatResp> sendPlanPowerOrder(@RequestBody OrderPlanPowerReq vo);

    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FILE_CENTER + "outerApi/selectByCondition")
    DataResult<List<CardInfoReqVo>> selectByCondition(CardInfoReqVo cardInfo);

    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FILE_CENTER + "outerApi/insertValue")
    void insertValue(CardInfoReqVo cardInfo);

    @PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FILE_CENTER + "outerApi/updateValue")
    void updateValue(CardInfoReqVo cardInfo);

    @DeleteMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.FILE_CENTER + "outerApi/deleteByCardIds")
    void deleteByPrimaryKey(List<Integer> carIdList);
}

