This commit is contained in:
sxu 2023-12-08 20:02:02 +08:00
parent c4b43e5ee6
commit ad76f4b307
5 changed files with 45 additions and 7 deletions

View File

@ -0,0 +1,16 @@
package com.bonus.zlpt.equip.api;
import com.bonus.zlpt.common.core.constant.ServiceNameConstants;
import com.bonus.zlpt.common.core.web.domain.AjaxResult;
import com.bonus.zlpt.equip.api.factory.DevInfoServiceApiFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@FeignClient(contextId = "remoteDevInfoService", value = ServiceNameConstants.EQUIP_SERVICE, fallbackFactory = DevInfoServiceApiFallbackFactory.class)
public interface RemoteDevInfoService
{
@GetMapping(value = "/dev/{maId}")
public AjaxResult getInfo(@PathVariable("maId") Long maId);
}

View File

@ -0,0 +1,18 @@
package com.bonus.zlpt.equip.api.factory;
import com.bonus.zlpt.equip.api.RemoteDevInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
@Component
public class DevInfoServiceApiFallbackFactory implements FallbackFactory<RemoteDevInfoService>
{
private static final Logger log = LoggerFactory.getLogger(DevInfoServiceApiFallbackFactory.class);
@Override
public RemoteDevInfoService create(Throwable cause) {
return null;
}
}

View File

@ -1 +1,2 @@
com.bonus.zlpt.equip.api.factory.TypeInfoServiceApiFallBackFotory
com.bonus.zlpt.equip.api.factory.DevInfoServiceApiFallbackFactory

View File

@ -79,6 +79,12 @@
<groupId>com.bonus.zlpt</groupId>
<artifactId>zlpt-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.bonus.zlpt</groupId>
<artifactId>zlpt-api-equip</artifactId>
<version>3.6.3</version>
<scope>compile</scope>
</dependency>
<!-- RuoYi Common Swagger -->

View File

@ -3,7 +3,6 @@ package com.bonus.zlpt.order.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.bonus.zlpt.common.core.domain.order.vo.OrderInfoVo;
import com.bonus.zlpt.common.core.utils.poi.ExcelUtil;
import com.bonus.zlpt.common.core.web.controller.BaseController;
@ -12,7 +11,7 @@ import com.bonus.zlpt.common.core.web.page.TableDataInfo;
import com.bonus.zlpt.common.log.annotation.Log;
import com.bonus.zlpt.common.log.enums.BusinessType;
import com.bonus.zlpt.common.security.annotation.RequiresPermissions;
import com.bonus.zlpt.order.feign.EquipClient;
import com.bonus.zlpt.equip.api.RemoteDevInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,9 +24,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bonus.zlpt.common.core.domain.order.OrderInfo;
import com.bonus.zlpt.order.service.IOrderInfoService;
import static com.bonus.zlpt.common.core.web.domain.AjaxResult.DATA_TAG;
/**
@ -46,7 +43,7 @@ public class OrderInfoController extends BaseController
@Autowired
private IOrderInfoService orderInfoService;
@Autowired
EquipClient equipClient;
RemoteDevInfoService remoteDevInfoService;
/**
* 查询订单信息列表
@ -60,7 +57,7 @@ public class OrderInfoController extends BaseController
List<OrderInfoVo> list = orderInfoService.selectOrderInfoList(orderInfo);
if (!CollectionUtils.isEmpty(list)) {
for (OrderInfoVo orderInfoVo : list) {
Map map1 = (Map) equipClient.getInfo(orderInfoVo.getMaId());
Map map1 = (Map) remoteDevInfoService.getInfo(orderInfoVo.getMaId());
if (map1 != null) {
Map map2 = (Map) map1.get(DATA_TAG);
if (map2 != null) {
@ -101,7 +98,7 @@ public class OrderInfoController extends BaseController
public AjaxResult getInfo(@PathVariable("orderId") Long orderId)
{
OrderInfoVo orderInfo = orderInfoService.selectOrderInfoByOrderId(orderId);
Map map1 = (Map) equipClient.getInfo(orderInfo.getMaId());
Map map1 = (Map) remoteDevInfoService.getInfo(orderInfo.getMaId());
if (map1 != null) {
Map map2 = (Map) map1.get(DATA_TAG);
if (map2 != null) {