diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 5dbad3701..9e9648842 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -4,13 +4,14 @@ import com.mhd.common.core.constant.ServiceNameConstants; import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.system.api.domain.*; import com.mhd.system.api.factory.RemoteBmsFeignFallbackFactory; +import com.mhd.system.api.factory.RemoteOmsFeignFallbackFactory; import com.mhd.system.api.feign.FeignAutoConfiguration; import io.swagger.annotations.ApiOperation; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE, fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE, fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteOmsFeignFallbackFactory.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteOmsFeignFallbackFactory.java new file mode 100644 index 000000000..ff04d9baf --- /dev/null +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteOmsFeignFallbackFactory.java @@ -0,0 +1,58 @@ +package com.mhd.system.api.factory; + +import com.mhd.common.core.domain.dto.BusinessDataPushDTO; +import com.mhd.common.core.web.domain.AjaxResult; +import com.mhd.system.api.BmsServiceFeign; +import com.mhd.system.api.OmsServiceFeign; +import com.mhd.system.api.domain.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.openfeign.FallbackFactory; +import org.springframework.stereotype.Component; + +import java.util.Set; + + +/** + * @Description + * @Author zg + * @Version 1.0 + * @Date 2023/11/3 14:37 + */ +@Component +public class RemoteOmsFeignFallbackFactory implements FallbackFactory { + + private static final Logger log = LoggerFactory.getLogger(RemoteOmsFeignFallbackFactory.class); + + @Override + public OmsServiceFeign create(Throwable throwable) { + log.error("系统服务调用失败:{}", throwable.getMessage()); + return new OmsServiceFeign() { + + @Override + public AjaxResult pushInOrder(StockInOrderTZPD stockInOrder) { + return null; + } + + @Override + public AjaxResult pushInOrderDetail(InMaterialDetailTZPD inMaterialDetail) { + return null; + } + + @Override + public AjaxResult pushOutOrder(StockOutOrderTZPD stockOutOrder) { + return null; + } + + @Override + public AjaxResult pushOutOrderDetail(OutMaterialDetailTZPD outMaterialDetail) { + return null; + } + + @Override + public AjaxResult omsEdit(MaterialInventoryOmsParamDO materialInventoryOmsParamDO) { + return null; + } + }; + } +} \ No newline at end of file