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

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import com.prolog.framework.common.message.RestMessage;
import com.prolog.product.core.tools.util.LogUtils;
import com.prolog.rdc.tms.model.dto.IntfErrorLogDTO;
import com.prolog.rdc.tms.model.dto.ShipAndLoadingBillDTO;
import com.prolog.rdc.tms.model.dto.ShipbillAndLoadingbillInfoDTO;
import com.prolog.rdc.tms.model.vo.ClearFieldByExtendedObjectVO;
import com.prolog.rdc.tms.model.vo.GpsDataVO;
import com.prolog.rdc.tms.model.vo.IntfShipbillHeaderVO;
import com.prolog.rdc.tms.model.vo.IntfShipbillPackageVO;
import com.prolog.rdc.tms.model.vo.ShipbillLocationVO;
import com.prolog.rdc.tms.model.vo.ShipbillOperateLogSaveNewVO;
import com.prolog.rdc.tms.model.vo.business.ShipInfoSaveVO;
import com.prolog.rdc.tms.rmi.feign.BusinessComingRecordFeign;

import feign.hystrix.FallbackFactory;

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

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

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

		return new BusinessComingRecordFeign() {
			@Override
			public RestMessage<String> clearFieldExecute(ClearFieldByExtendedObjectVO clearFieldByExtendedObjectVO) {
				return RestMessage.newInstance(false, "【upcloud-rdc-tms-business-service|扩展字段置空|clearFieldExecute|服务请求失败！", null);
			}

			@Override
			public RestMessage<List<IntfErrorLogDTO>> saveShipbillInterfaceExecute(List<IntfShipbillHeaderVO> intfShipbillHeaderVOs) {
				return RestMessage.newInstance(false, "【upcloud-rdc-tms-business-service|运单接口转TMS|saveShipbillInterfaceExecute】请求服务失败！", null);
			}

			@Override
			public RestMessage<List<IntfErrorLogDTO>> saveShipbillPackageInterfaceExecute(List<IntfShipbillPackageVO> intfShipbillPackageVOs) {
				return RestMessage.newInstance(false, "【upcloud-rdc-tms-business-service|运单包裹接口转TMS|saveShipbillPackageInterfaceExecute】请求服务失败！", null);
			}

			@Override
			public RestMessage<String> addLog(ShipbillOperateLogSaveNewVO logModel) {
				return null;
			}

			@Override
			public RestMessage<ShipbillAndLoadingbillInfoDTO> getInfoByDriverId(String shipbillId) {
				return RestMessage.newInstance(false, "【upcloud-rdc-tms-business-service|装车单信息查询|getInfoByDriverId】请求服务失败！", null);
			}

			@Override
			public RestMessage<List<ShipAndLoadingBillDTO>> getAllShipBillById(String shipBillId) {
				return RestMessage.newInstance(false, "【upcloud-rdc-tms-business-service|通过运单ID查询所有父级运单信息|getAllShipBillById】请求服务失败！", null);
			}

			@Override
			public RestMessage<Object> saveShipInfoFromIntf(ShipInfoSaveVO vo) {
				return RestMessage.newInstance(false, "【upcloud-rdc-tms-business-service|发货信息同步接口转业务|saveShipInfoFromIntf】请求服务失败！", null);
			}

			@Override
			public RestMessage<String> modifyShipbillHeaderLocationExecute(List<ShipbillLocationVO> shipbillLocationVOS) {
				return RestMessage.newInstance(false, "【modifyShipbillHeaderLocationExecute】更新运单定位信息服务失败！", null);
			}

			@Override
			public RestMessage<List<IntfErrorLogDTO>> saveGpsExecute(List<GpsDataVO> gpsDataVOs) {
				return RestMessage.newInstance(false, "【upcloud-rdc-tms-business-service|GPS数据保存|saveGpsExecute】请求服务失败！", null);
			}

		};
	}
}