package com.tmerclub.cloud.delivery.feign;

import com.tmerclub.cloud.api.delivery.feign.StationFeignClient;
import com.tmerclub.cloud.api.delivery.vo.StationVO;
import com.tmerclub.cloud.common.order.vo.OrderSelfStationVO;
import com.tmerclub.cloud.common.order.vo.OrderStationSpuDTO;
import com.tmerclub.cloud.common.order.vo.UserDeliveryInfoVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.delivery.service.StationService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lanhai
 */
@DubboService
public class StationFeignController implements StationFeignClient {
    @Autowired
    private StationService stationService;

    @Override
    public ServerResponseEntity<StationVO> getStationByInside(Long stationId) {
        return ServerResponseEntity.success(stationService.getByStationId(stationId));
    }

    @Override
    public List<StationVO> listStationByIds(List<Long> stationIds) {
        return stationService.listByStationId(stationIds);
    }

    @Override
    public OrderSelfStationVO getOrderStation(UserDeliveryInfoVO userDeliveryInfoVO, ArrayList<OrderStationSpuDTO> orderStationSpuList) {
        return stationService.getOrderStation(userDeliveryInfoVO, orderStationSpuList);
    }

    @Override
    public Integer getStationSize(Long shopId) {
        return stationService.listByShopId(shopId).size();
    }
}
