Browse Source

离线文档

Progr1mmer 6 years ago
parent
commit
4cc0c78106

+ 2 - 1
.gitignore

@ -10,7 +10,6 @@
.idea/
data/*
.idea_modules/
build/*.jar
.settings
.cache
.generated-mima*
@ -79,3 +78,5 @@ sql/hive-thriftserver/test_warehouses
# For R session data
.RHistory
.RData
build/
docs/

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/function/FunctionDO.java

@ -9,6 +9,7 @@ import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * 功能 - Entity
 * WlyyFunction entity. @author MyEclipse Persistence Tools
 */
@Entity

+ 62 - 74
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/base/FunctionVO.java

@ -1,65 +1,60 @@
package com.yihu.jw.restmodel.base.base;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.*;
/**
 * Created by chenweida on 2017/5/19.
 */
public class FunctionVO {
    private String id;
    private String name; //功能名称
    private String saasId; // saasid
    private String parentCode; //父功能code
    private Integer status; //状态 -1 删除 0 禁用 可用
@ApiModel(value = "FunctionVO", description = "功能")
public class FunctionVO implements Serializable {
    @ApiModelProperty(value = "id", example = "1" )
    protected Integer id;
    @ApiModelProperty(value = "创建日期", example = "2018-03-14 11:35:34" )
    protected Date createTime;
    @ApiModelProperty(value = "创建者", example = "0dae0003590016e5b3865e377b2f8615" )
    protected String createUser;
    @ApiModelProperty(value = "创建者用户名", example = "Progr1mmer" )
    protected String createUserName;
    @ApiModelProperty(value = "修改日期", example = "2018-03-14 11:35:34" )
    protected Date updateTime;
    @ApiModelProperty(value = "修改者", example = "0dae0003590016e5b3865e377b2f8615" )
    protected String updateUser;
    @ApiModelProperty(value = "修改者用户名", example = "Progr1mmer" )
    protected String updateUserName;
    //功能名称
    @ApiModelProperty(value = "名称", example = "功能1" )
    private String name;
    //网关url前缀
    @ApiModelProperty(value = "网关url前缀", example = "/base" )
    private String prefix;
    //功能对应的后台url路径
    @ApiModelProperty(value = "功能对应的后台url路径", example = "/function/list" )
    private String url;
    private String createUser;
    private String createUserName;
    private Date createTime;
    private String updateUser;
    private String updateUserName;
    private Date updateTime;
    private String remark; //备注
    private List<FunctionVO> children = new ArrayList<>();
    private String text;
    public String getId() {
    //备注
    @ApiModelProperty(value = "备注", example = "我是备注" )
    private String remark;
    public Integer getId() {
        return id;
    }
    public void setId(String id) {
    public void setId(Integer id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getParentCode() {
        return parentCode;
    }
    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }
    public Integer getStatus() {
        return status;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Date getCreateTime() {
        return createTime;
    }
    public void setStatus(Integer status) {
        this.status = status;
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
@ -78,12 +73,13 @@ public class FunctionVO {
        this.createUserName = createUserName;
    }
    public Date getCreateTime() {
        return createTime;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
@ -102,36 +98,20 @@ public class FunctionVO {
        this.updateUserName = updateUserName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public List<FunctionVO> getChildren() {
        return children;
    public String getName() {
        return name;
    }
    public void setChildren(List<FunctionVO> children) {
        this.children = children;
    public void setName(String name) {
        this.name = name;
    }
    public String getText() {
        return name;
    public String getPrefix() {
        return prefix;
    }
    public void setText(String text) {
        this.text = text;
    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }
    public String getUrl() {
@ -141,4 +121,12 @@ public class FunctionVO {
    public void setUrl(String url) {
        this.url = url;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 1 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/Envelop.java

@ -12,7 +12,7 @@ import java.io.Serializable;
 * 快速集成 {@link com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint}
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "基础实体")
@ApiModel(value = "Envelop", description = "基础实体")
public class Envelop implements Serializable {
    @ApiModelProperty("信息")

+ 2 - 2
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/ListEnvelop.java

@ -22,10 +22,10 @@ import java.util.List;
 * @author llh
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "ListResult", description = "获取实体列表返回定义")
@ApiModel(value = "ListEnvelop<T>", description = "获取实体列表返回")
public class ListEnvelop<T> extends Envelop {
    @ApiModelProperty("列表内容")
    @ApiModelProperty(value = "列表内容")
    private List<T> detailModelList = new ArrayList<>(0);
    public List<T> getDetailModelList() {

+ 2 - 2
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/MixEnvelop.java

@ -23,7 +23,7 @@ import java.util.List;
 * @author llh
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "ListResult", description = "通用的实体")
@ApiModel(value = "MixEnvelop<T, J>", description = "通用的实体")
public class MixEnvelop<T, J> extends Envelop {
    private static final long serialVersionUID = 2076324875575488461L;
@ -43,7 +43,7 @@ public class MixEnvelop<T, J> extends Envelop {
    @ApiModelProperty("列表内容")
    private List<T> detailModelList = new ArrayList<>(0);
    @ApiModelProperty("内容")
    @ApiModelProperty("实体内容")
    private J obj = (J)new HashMap<>(0);
    public int getCurrPage() {

+ 1 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/ObjEnvelop.java

@ -21,7 +21,7 @@ import java.util.HashMap;
 * @author llh
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "获取单个实体信息返回")
@ApiModel(value = "ObjEnvelop<J>", description = "获取单个实体信息返回")
public class ObjEnvelop<J> extends Envelop {
    @ApiModelProperty("内容")

+ 1 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/PageEnvelop.java

@ -23,7 +23,7 @@ import java.util.List;
 * @author llh
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "EnvelopPage<T>", description = "分页查询返回")
@ApiModel(value = "PageEnvelop<T>", description = "分页查询返回")
public class PageEnvelop<T> extends Envelop implements Serializable {
    private static final long serialVersionUID = 2076324875575488461L;

+ 42 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/config/SwaggerDocs.java

@ -0,0 +1,42 @@
package com.yihu.jw.base.config;
import io.github.swagger2markup.GroupBy;
import io.github.swagger2markup.Language;
import io.github.swagger2markup.Swagger2MarkupConfig;
import io.github.swagger2markup.Swagger2MarkupConverter;
import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
import io.github.swagger2markup.markup.builder.MarkupLanguage;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
 * Created by progr1mmer on 2018/8/21.
 */
public class SwaggerDocs {
    public static void main(String[] args) throws Exception {
        //1.请求 http://ip:port/swagger-resources获取group
        String group = "Default";
        //2.定义请求地址 new URL("http://ip:port/v2/api-docs?group=" + groupName)
        URL remoteSwaggerFile = new URL("http://127.0.0.1:10020/v2/api-docs?group=" + group); //项目的swagger-ui地址
        //3.定义文件输出路径
        String prefix = Thread.currentThread().getContextClassLoader().getResource("").getPath();
        Path outputFile = Paths.get(prefix.substring(prefix.lastIndexOf(":") + 1, prefix.indexOf("target") - 1) + "/build/" + group); //文档输出地址
        Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
                .withMarkupLanguage(MarkupLanguage.ASCIIDOC)
                .withOutputLanguage(Language.ZH)
                .withPathsGroupedBy(GroupBy.TAGS)
                .withGeneratedExamples()
                .withoutInlineSchema()
                //.withBasePathPrefix()
                .build();
        Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(remoteSwaggerFile)
                .withConfig(config)
                .build();
        converter.toFile(outputFile);
    }
}

+ 12 - 10
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/function/FunctionEndpoint.java

@ -2,6 +2,7 @@ package com.yihu.jw.base.endpoint.function;
import com.yihu.jw.base.service.FunctionService;
import com.yihu.jw.entity.base.function.FunctionDO;
import com.yihu.jw.restmodel.base.base.FunctionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -30,12 +32,12 @@ public class FunctionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = BaseRequestMapping.Function.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<FunctionDO> create (
    public ObjEnvelop<FunctionVO> create (
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        FunctionDO functionDO = toEntity(jsonData, FunctionDO.class);
        functionDO = functionService.save(functionDO);
        return success(functionDO);
        return success(convertToModel(functionDO, FunctionVO.class));
    }
    @PostMapping(value = BaseRequestMapping.Function.DELETE)
@ -49,20 +51,20 @@ public class FunctionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = BaseRequestMapping.Function.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public Envelop update (
    public ObjEnvelop<FunctionVO> update (
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        FunctionDO functionDO = toEntity(jsonData, FunctionDO.class);
        if (null == functionDO.getId()) {
            return failed("ID不能为空", Envelop.class);
            return failed("ID不能为空", ObjEnvelop.class);
        }
        functionDO = functionService.save(functionDO);
        return success(functionDO);
        return success(convertToModel(functionDO, FunctionVO.class));
    }
    @GetMapping(value = BaseRequestMapping.Function.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<FunctionDO> page (
    public PageEnvelop<FunctionVO> page (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -73,14 +75,14 @@ public class FunctionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<FunctionDO> functionDOS = functionService.search(fields, filters, sorts, page, size);
        List<FunctionVO> functionDOS = functionService.search(fields, filters, sorts, page, size);
        int count = (int)functionService.getCount(filters);
        return success(functionDOS, count, page, size);
        return success(convertToModels(functionDOS, new ArrayList<>(), FunctionVO.class), count, page, size);
    }
    @GetMapping(value = BaseRequestMapping.Function.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<FunctionDO> list (
    public ListEnvelop<FunctionVO> list (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -88,7 +90,7 @@ public class FunctionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<FunctionDO> functionDOS = functionService.search(fields, filters, sorts);
        return success(functionDOS);
        return success(convertToModels(functionDOS, new ArrayList<>(), FunctionVO.class));
    }
}

+ 1 - 1
wlyy-parent-pom/pom.xml

@ -371,7 +371,7 @@
                <version>${asciidoctor.maven.plugin.version}</version>
                <configuration>
                    <sourceDirectory>build</sourceDirectory>
                    <outputDirectory>build/asciidoc/${project.version}</outputDirectory>
                    <outputDirectory>docs/${project.version}</outputDirectory>
                    <headerFooter>true</headerFooter>
                    <doctype>book</doctype>
                    <sourceHighlighter>coderay</sourceHighlighter>