网关接口详情调整
This commit is contained in:
parent
c9c0575014
commit
074ff9d67b
@ -126,7 +126,7 @@ public class GatewayInterfaceInfoDetailedVO {
|
||||
private String mockDefaultResponse;
|
||||
|
||||
@ApiModelProperty("Mock默认响应,json格式")
|
||||
private List<GatewayInterfaceMock> mockExpectations;
|
||||
private List<GatewayInterfaceMockVO> mockExpectations;
|
||||
|
||||
|
||||
public static GatewayInterfaceInfoDetailedVO convert(GatewayInterfaceInfo gatewayInterfaceInfo
|
||||
@ -155,7 +155,8 @@ public class GatewayInterfaceInfoDetailedVO {
|
||||
vo.setMockDefaultHttpStatus(gatewayInterfaceInfo.getMockDefaultHttpStatus());
|
||||
vo.setMockDefaultResponse(gatewayInterfaceInfo.getMockDefaultResponse());
|
||||
// mock配置
|
||||
vo.setMockExpectations(mockExpectations);
|
||||
List<GatewayInterfaceMockVO> mockExpectationVOs = mockExpectations.stream().map(GatewayInterfaceMockVO::convert).collect(Collectors.toList());
|
||||
vo.setMockExpectations(mockExpectationVOs);
|
||||
// 策略信息
|
||||
List<GatewayStrategyListVO> strategyListVOList = strategyList.stream()
|
||||
.map(GatewayStrategyListVO::convert)
|
||||
|
@ -0,0 +1,69 @@
|
||||
package com.sf.service.gateway.domain.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.sf.service.gateway.domain.GatewayInterfaceMock;
|
||||
import com.sf.service.gateway.domain.GatewayRoute;
|
||||
import com.sf.vertx.api.pojo.MockMatchCondition;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 网关服务-接口Mock
|
||||
*/
|
||||
@Data
|
||||
public class GatewayInterfaceMockVO {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ApiModelProperty("ID")
|
||||
private Long id;
|
||||
/**
|
||||
* 接口id
|
||||
*/
|
||||
@ApiModelProperty("接口id")
|
||||
private Long interfaceId;
|
||||
/**
|
||||
* http状态码
|
||||
*/
|
||||
@ApiModelProperty("http状态码")
|
||||
private Integer httpStatus;
|
||||
/**
|
||||
* 匹配条件
|
||||
*/
|
||||
@ApiModelProperty("匹配条件")
|
||||
private List<MockMatchCondition> matchConditions;
|
||||
/**
|
||||
* Mock响应,JSON字符串
|
||||
*/
|
||||
@ApiModelProperty("Mock响应,JSON字符串")
|
||||
private String mockResponse;
|
||||
/**
|
||||
* 状态(0停用 1启用)
|
||||
*/
|
||||
@ApiModelProperty("状态(0停用 1启用)")
|
||||
private String status;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ApiModelProperty("排序")
|
||||
private Integer orderNum;
|
||||
|
||||
public static GatewayInterfaceMockVO convert(GatewayInterfaceMock mock){
|
||||
if (mock == null) {
|
||||
return null;
|
||||
}
|
||||
GatewayInterfaceMockVO vo = new GatewayInterfaceMockVO();
|
||||
vo.setId(mock.getId());
|
||||
vo.setInterfaceId(mock.getInterfaceId());
|
||||
vo.setHttpStatus(mock.getHttpStatus());
|
||||
vo.setMatchConditions(JSON.parseArray(mock.getMatchConditions(),MockMatchCondition.class));
|
||||
vo.setMockResponse(mock.getMockResponse());
|
||||
vo.setStatus(mock.getStatus());
|
||||
vo.setOrderNum(mock.getOrderNum());
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user