调整接口文档存储方式
This commit is contained in:
parent
b8429e1d6a
commit
56b34917be
@ -59,6 +59,9 @@ public class SysOssServiceImpl implements ISysOssService {
|
||||
*/
|
||||
@Override
|
||||
public SysOss selectSysOssById(String id) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return null;
|
||||
}
|
||||
return sysOssMapper.selectSysOssById(id);
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,10 @@
|
||||
<artifactId>sf-vertx-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.smarterFramework</groupId>
|
||||
<artifactId>sf-file</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,14 +1,13 @@
|
||||
package com.sf.service.gateway.controller;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.sf.common.utils.AppUtils;
|
||||
import com.sf.file.domain.SysOss;
|
||||
import com.sf.file.service.ISysOssService;
|
||||
import com.sf.service.gateway.domain.GatewayInterfaceInfo;
|
||||
import com.sf.service.gateway.domain.GatewayInterfaceLinkStrategy;
|
||||
import com.sf.service.gateway.domain.GatewayServer;
|
||||
@ -18,7 +17,6 @@ import com.sf.service.gateway.domain.dto.UpdateDataStatusDTO;
|
||||
import com.sf.service.gateway.domain.dto.UpdateGatewayInterfaceInfoDTO;
|
||||
import com.sf.service.gateway.domain.vo.GatewayInterfaceInfoDetailedVO;
|
||||
import com.sf.service.gateway.domain.vo.GatewayInterfaceInfoListVO;
|
||||
import com.sf.service.gateway.domain.vo.GatewayStrategyListVO;
|
||||
import com.sf.service.gateway.enums.GatewayDataStatus;
|
||||
import com.sf.service.gateway.service.IGatewayInterfaceInfoService;
|
||||
import com.sf.service.gateway.service.IGatewayServerService;
|
||||
@ -62,6 +60,9 @@ public class GatewayInterfaceInfoController extends BaseController {
|
||||
@Autowired
|
||||
private IGatewayStrategyService gatewayStrategyService;
|
||||
|
||||
@Autowired
|
||||
private ISysOssService sysOssService;
|
||||
|
||||
@ApiOperation("查询接口信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('gateway:interface:list')")
|
||||
@GetMapping("/list")
|
||||
@ -100,7 +101,8 @@ public class GatewayInterfaceInfoController extends BaseController {
|
||||
List<GatewayInterfaceLinkStrategy> linkList = gatewayInterfaceInfoService.selectGatewayInterfaceLinkStrategyByInterfaceIds(Collections.singleton(id));
|
||||
GatewayServer gatewayServer = gatewayServerService.selectGatewayServerById(gatewayInterfaceInfo.getServerId());
|
||||
List<GatewayStrategy> strategyList = gatewayStrategyService.selectGatewayStrategyByIds(linkList.stream().map(GatewayInterfaceLinkStrategy::getStrategyId).collect(Collectors.toSet()));
|
||||
GatewayInterfaceInfoDetailedVO vo = GatewayInterfaceInfoDetailedVO.convert(gatewayInterfaceInfo,gatewayServer,strategyList);
|
||||
SysOss document = sysOssService.selectSysOssById(gatewayInterfaceInfo.getDocument());
|
||||
GatewayInterfaceInfoDetailedVO vo = GatewayInterfaceInfoDetailedVO.convert(gatewayInterfaceInfo,gatewayServer,strategyList,document);
|
||||
// TODO 调用次数和平均时间暂时没有来源
|
||||
vo.setNumberOfCalls(0L);
|
||||
vo.setAverageResponseTime(0L);
|
||||
|
@ -2,6 +2,7 @@ package com.sf.service.gateway.domain.dto;
|
||||
|
||||
import com.sf.common.annotation.Excel;
|
||||
import com.sf.common.core.domain.BaseEntity;
|
||||
import com.sf.file.domain.SysOss;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -55,7 +56,7 @@ public class InsertGatewayInterfaceInfoDTO {
|
||||
private String version;
|
||||
|
||||
@ApiModelProperty("接口文档(文档地址)")
|
||||
private String document;
|
||||
private SysOss document;
|
||||
|
||||
@NotNull(message = "网关服务不能为空")
|
||||
@ApiModelProperty("网关服务id")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.sf.service.gateway.domain.dto;
|
||||
|
||||
import com.sf.common.annotation.Excel;
|
||||
import com.sf.file.domain.SysOss;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -58,7 +59,7 @@ public class UpdateGatewayInterfaceInfoDTO {
|
||||
private String version;
|
||||
|
||||
@ApiModelProperty("接口文档(文档地址)")
|
||||
private String document;
|
||||
private SysOss document;
|
||||
|
||||
@NotNull(message = "网关服务不能为空")
|
||||
@ApiModelProperty("网关服务id")
|
||||
|
@ -2,6 +2,7 @@ package com.sf.service.gateway.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.sf.common.annotation.Excel;
|
||||
import com.sf.file.domain.SysOss;
|
||||
import com.sf.service.gateway.domain.GatewayInterfaceInfo;
|
||||
import com.sf.service.gateway.domain.GatewayServer;
|
||||
import com.sf.service.gateway.domain.GatewayStrategy;
|
||||
@ -88,7 +89,7 @@ public class GatewayInterfaceInfoDetailedVO {
|
||||
*/
|
||||
@Excel(name = "接口文档", readConverterExp = "文档地址")
|
||||
@ApiModelProperty("接口文档(文档地址)")
|
||||
private String document;
|
||||
private SysOss document;
|
||||
|
||||
@ApiModelProperty("调用次数")
|
||||
private Long numberOfCalls;
|
||||
@ -119,7 +120,9 @@ public class GatewayInterfaceInfoDetailedVO {
|
||||
|
||||
public static GatewayInterfaceInfoDetailedVO convert(GatewayInterfaceInfo gatewayInterfaceInfo
|
||||
, GatewayServer gatewayServer
|
||||
, List<GatewayStrategy> strategyList) {
|
||||
, List<GatewayStrategy> strategyList
|
||||
, SysOss document
|
||||
) {
|
||||
GatewayInterfaceInfoDetailedVO vo = new GatewayInterfaceInfoDetailedVO();
|
||||
vo.setId(gatewayInterfaceInfo.getId());
|
||||
vo.setInterfaceName(gatewayInterfaceInfo.getInterfaceName());
|
||||
@ -129,7 +132,7 @@ public class GatewayInterfaceInfoDetailedVO {
|
||||
vo.setDescription(gatewayInterfaceInfo.getDescription());
|
||||
vo.setVersion(gatewayInterfaceInfo.getVersion());
|
||||
vo.setStatus(gatewayInterfaceInfo.getStatus());
|
||||
vo.setDocument(gatewayInterfaceInfo.getDocument());
|
||||
vo.setDocument(document);
|
||||
vo.setCreateTime(gatewayInterfaceInfo.getCreateTime());
|
||||
vo.setUpdateTime(gatewayInterfaceInfo.getUpdateTime());
|
||||
vo.setServerId(gatewayInterfaceInfo.getServerId());
|
||||
|
@ -2,11 +2,8 @@ package com.sf.service.gateway.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.sf.common.annotation.Excel;
|
||||
import com.sf.common.core.domain.BaseEntity;
|
||||
import com.sf.service.gateway.domain.GatewayInterfaceInfo;
|
||||
import com.sf.service.gateway.domain.GatewayRoute;
|
||||
import com.sf.service.gateway.domain.GatewayServer;
|
||||
import com.sf.service.gateway.enums.GatewayServiceModel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -26,6 +26,8 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.EMPTY;
|
||||
|
||||
/**
|
||||
* 接口管理Service业务层处理
|
||||
*
|
||||
@ -186,7 +188,8 @@ public class GatewayInterfaceInfoServiceImpl implements IGatewayInterfaceInfoSer
|
||||
gatewayInterfaceInfo.setDescription(dto.getDescription());
|
||||
gatewayInterfaceInfo.setVersion(dto.getVersion());
|
||||
gatewayInterfaceInfo.setStatus(GatewayDataStatus.DISABLE.getCode());
|
||||
gatewayInterfaceInfo.setDocument(dto.getDocument());
|
||||
String document = dto.getDocument() == null ? EMPTY : dto.getDocument().getId();
|
||||
gatewayInterfaceInfo.setDocument(document);
|
||||
gatewayInterfaceInfo.setServerId(dto.getServerId());
|
||||
gatewayInterfaceInfo.setMockStatus(dto.getMockStatus());
|
||||
gatewayInterfaceInfo.setMockResponse(dto.getMockResponse());
|
||||
@ -212,7 +215,8 @@ public class GatewayInterfaceInfoServiceImpl implements IGatewayInterfaceInfoSer
|
||||
gatewayInterfaceInfo.setRequestMethod(dto.getRequestMethod());
|
||||
gatewayInterfaceInfo.setDescription(dto.getDescription());
|
||||
gatewayInterfaceInfo.setVersion(dto.getVersion());
|
||||
gatewayInterfaceInfo.setDocument(dto.getDocument());
|
||||
String document = dto.getDocument() == null ? EMPTY : dto.getDocument().getId();
|
||||
gatewayInterfaceInfo.setDocument(document);
|
||||
gatewayInterfaceInfo.setServerId(dto.getServerId());
|
||||
gatewayInterfaceInfo.setMockStatus(dto.getMockStatus());
|
||||
gatewayInterfaceInfo.setMockResponse(dto.getMockResponse());
|
||||
|
Loading…
x
Reference in New Issue
Block a user