package com.prolog.rdc.tms.rmi.hystrix;

import com.prolog.framework.common.message.RestMessage;
import com.prolog.product.core.tools.util.LogUtils;
import com.prolog.rdc.tms.model.dto.DriverledgerBillDTO;
import com.prolog.rdc.tms.model.dto.ShipbillResultDTO;
import com.prolog.rdc.tms.model.vo.BillDownloadVO;
import com.prolog.rdc.tms.model.vo.DriverledgerBillPageVO;
import com.prolog.rdc.tms.model.vo.ShipBillVO;
import com.prolog.rdc.tms.rmi.feign.ShipBillRecordFeign;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * 
 *
 * 业务服务调用
 *
 * @className :BusinessComingRecordBack
 * @author :fanzw
 * @creationTime :2022/05/12
 * @description :
 *
 * @modifier :fanzw
 * @modifyTime :2022/05/12
 * @reviseRemarks:
 *
 * @version :1.0.0
 *
 */
@Component
public class ShipBillRecordBack implements FallbackFactory<ShipBillRecordFeign> {

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

	@Override
	public ShipBillRecordFeign create(Throwable cause) {
		if (null != cause && StringUtils.hasLength(cause.getMessage())) {
			LogUtils.error(logger, cause.getMessage(), cause);
		}

		return new ShipBillRecordFeign() {

			@Override
			public RestMessage<List<ShipbillResultDTO>> save(ShipBillVO vo) {
				return RestMessage.newInstance(false, "【save】请求服务失败！", null);
			}
			@Override
			public RestMessage<Object> downloadSave(List<BillDownloadVO> billDownloadVOS) {
				return RestMessage.newInstance(false, "【downloadSave】请求服务失败！", null);
			}
			@Override
			public RestMessage<List<DriverledgerBillDTO>> queryDriverFeeByBillExecute(DriverledgerBillPageVO driverledgerBillPageVO) {
				return RestMessage.newInstance(false, "【queryDriverFeeByBillExecute】司机费用请求服务失败！", null);
			}

		};
	}
}