This commit is contained in:
六如
2024-12-22 23:09:46 +08:00
parent 02fb5a9e85
commit 403e8111f4
1239 changed files with 4764 additions and 702 deletions

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-website-backend</artifactId>
<version>5.0.0-SNAPSHOT</version>
</parent>
<artifactId>website-web</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>website-service</artifactId>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,65 @@
package com.gitee.sop.website.controller.website;
import com.gitee.sop.admin.service.doc.dto.DocAppDTO;
import com.gitee.sop.website.controller.website.vo.DocAppVO;
import com.gitee.sop.website.controller.website.vo.DocInfoTreeVO;
import com.gitee.sop.website.controller.website.vo.DocInfoViewVO;
import com.gitee.sop.website.common.resp.Result;
import com.gitee.sop.website.common.util.CopyUtil;
import com.gitee.sop.website.service.doc.dto.DocInfoTreeDTO;
import com.gitee.sop.website.service.doc.dto.DocInfoViewDTO;
import com.gitee.sop.website.service.website.WebsiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 提供给网站的接口,不需要校验token
*
* @author 六如
*/
@RestController
@RequestMapping("website")
public class WebsiteController {
@Autowired
private WebsiteService websiteService;
/**
* 获取文档应用列表
*/
@GetMapping("docapp/list")
public Result<List<DocAppVO>> listDocApp() {
List<DocAppDTO> docAppDTOS = websiteService.listDocApp();
List<DocAppVO> docAppVOS = CopyUtil.deepCopyList(docAppDTOS, DocAppVO.class);
return Result.ok(docAppVOS);
}
/**
* 获取文档菜单树
*
* @param docAppId 应用id
*/
@GetMapping("docinfo/tree")
public Result<List<DocInfoTreeVO>> listDocMenuTree(Long docAppId) {
List<DocInfoTreeDTO> docInfoTreeDTOS = websiteService.listDocMenuTree(docAppId);
List<DocInfoTreeVO> docAppVOS = CopyUtil.deepCopyList(docInfoTreeDTOS, DocInfoTreeVO.class);
return Result.ok(docAppVOS);
}
/**
* 获取文档详情
*
* @param id id
*/
@GetMapping("docinfo/detail")
public Result<DocInfoViewVO> getDocDetail(Long id) {
DocInfoViewDTO docInfoViewDTO = websiteService.getDocDetail(id);
DocInfoViewVO docInfoViewVO = CopyUtil.deepCopy(docInfoViewDTO, DocInfoViewVO.class);
return Result.ok(docInfoViewVO);
}
}

View File

@@ -0,0 +1,17 @@
package com.gitee.sop.website.controller.website;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class WebsiteHomeController {
private static final String REDIRECT_INDEX = "forward:index.html";
// 后台admin入口地址
@GetMapping("/")
public String index() {
return REDIRECT_INDEX;
}
}

View File

@@ -0,0 +1,24 @@
package com.gitee.sop.website.controller.website.vo;
import lombok.Data;
/**
* 备注:文档应用
*
* @author 六如
*/
@Data
public class DocAppVO {
/**
* id
*/
private Long id;
/**
* 应用名称
*/
private String appName;
}

View File

@@ -0,0 +1,14 @@
package com.gitee.sop.website.controller.website.vo;
import lombok.Data;
/**
* @author 六如
*/
@Data
public class DocInfoConfigVO {
private String openProdUrl;
private String openSandboxUrl;
}

View File

@@ -0,0 +1,99 @@
package com.gitee.sop.website.controller.website.vo;
import com.gitee.fastmybatis.core.support.TreeNode;
import lombok.Data;
import java.util.List;
import java.util.Objects;
/**
* 备注:文档信息
*
* @author 六如
*/
@Data
public class DocInfoTreeVO implements TreeNode<DocInfoTreeVO, Long> {
/**
* id
*/
private Long id;
/**
* doc_app.id
*/
private Long docAppId;
/**
* 文档id
*/
private Long docId;
/**
* 文档标题
*/
private String docTitle;
/**
* 文档code
*/
private String docCode;
/**
* 文档类型,1-dubbo,2-富文本,3-Markdown
*/
private Integer docType;
/**
* 来源类型,1-torna,2-自建
*/
private Integer sourceType;
/**
* 文档名称
*/
private String docName;
/**
* 版本号
*/
private String docVersion;
/**
* 描述
*/
private String description;
/**
* 是否分类
*/
private Integer isFolder;
/**
* 父节点id
*/
private Long parentId;
private List<DocInfoTreeVO> children;
@Override
public Long takeId() {
return docId;
}
@Override
public Long takeParentId() {
return parentId;
}
public String getDocName() {
if (Objects.equals(isFolder, 1)) {
return "";
}
return docName;
}
}

View File

@@ -0,0 +1,15 @@
package com.gitee.sop.website.controller.website.vo;
import lombok.Data;
/**
* @author 六如
*/
@Data
public class DocInfoViewVO {
private TornaDocInfoViewVO docInfoView;
private DocInfoConfigVO docInfoConfig;
}

View File

@@ -0,0 +1,179 @@
package com.gitee.sop.website.controller.website.vo;
import com.gitee.sop.website.service.doc.dto.torna.TornaDocParamDTO;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
/**
* @author tanghc
*/
@Data
public class TornaDocInfoViewVO {
private Long id;
/**
* 文档名称
*/
private String name;
/**
* 文档概述
*/
private String description;
/**
* 0:http,1:dubbo
*/
private Byte type;
/**
* 访问URL
*/
private String url;
/**
* 版本号
*/
private String version = "";
private String docKey;
/**
* http方法
*/
private String httpMethod;
/**
* contentType
*/
private String contentType;
/**
* 是否是分类0不是1
*/
private Byte isFolder;
/**
* 父节点
*/
private Long parentId;
/**
* 模块idmodule.id
*/
private Long moduleId;
/**
* 项目id
*/
private Long projectId;
/**
* 是否使用全局请求参数
*/
private Byte isUseGlobalHeaders;
/**
* 是否使用全局请求参数
*/
private Byte isUseGlobalParams;
/**
* 是否使用全局返回参数
*/
private Byte isUseGlobalReturns;
/**
* 是否请求数组
*/
private Byte isRequestArray;
/**
* 是否返回数组
*/
private Byte isResponseArray;
/**
* 请求数组时元素类型
*/
private String requestArrayType;
/**
* 返回数组时元素类型
*/
private String responseArrayType;
/**
* 文档状态
*/
private Byte status;
private String remark;
private Integer orderIndex;
/**
* 数据库字段gmt_create
*/
private LocalDateTime gmtCreate;
/**
* 数据库字段gmt_modified
*/
private LocalDateTime gmtModified;
private List<TornaDocParamDTO> pathParams = Collections.emptyList();
private List<TornaDocParamDTO> headerParams = Collections.emptyList();
private List<TornaDocParamDTO> headerParamsRaw = Collections.emptyList();
private List<TornaDocParamDTO> queryParams = Collections.emptyList();
private List<TornaDocParamDTO> requestParams = Collections.emptyList();
private List<TornaDocParamDTO> responseParams = Collections.emptyList();
private List<TornaDocParamDTO> errorCodeParams = Collections.emptyList();
private List<TornaDocParamDTO> globalHeaders = Collections.emptyList();
private List<TornaDocParamDTO> globalParams = Collections.emptyList();
private List<TornaDocParamDTO> globalReturns = Collections.emptyList();
private String errorCodeInfo;
private List<TornaDocInfoViewVO> children = Collections.emptyList();
public String getDocName() {
return url;
}
public String getDocTitle() {
return name;
}
}