package com.xhpc.common.api.factory;

import com.xhpc.common.api.ActivityInternetService;
import com.xhpc.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author yuyang
 * @date 2022/4/8 16:40
 */
@Component
public class ActivityInternetfAllbackFactory implements FallbackFactory<ActivityInternetService> {

    private static final Logger logger = LoggerFactory.getLogger(ActivityInternetfAllbackFactory.class);

    @Override
    public ActivityInternetService create(Throwable cause) {

       return new ActivityInternetService() {
           @Override
           public R<Map<String, Object>> getActivityStationTime(Long internetUserId, String startTime, String endTime, Long chargingStationId, String tenantId) {
               return R.fail(3886,"获取活动信息失败:" + cause.getMessage());
           }

           @Override
           public R<Map<String, Object>> getActivityFormulaTime(Integer activityId, String startTime, String endTime) {
               return R.fail(3886,"获取活动时间段信息失败:" + cause.getMessage());
           }
       };
    }
}
