1 Star 3 Fork 2

dpwgc / docc-document-center

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

DOCC-Document-Center

基于 DDD + CQRS + GraphQL 的文档检索中心(文档中台系统)

在写


实现功能

  • 文档管理与检索
  • 评论管理与展示
  • 标签统计与查询
  • 专栏管理与展示
  • 分类树的构建与展示
对外提供文档管理、文档多条件组合检索、评论管理、评论查询、标签统计与查询、专栏管理与查询、树型分类结构生成、分类查询等操作接口,可供博客应用、文库应用、公告应用等需要依靠文档检索功能的前台系统快速接入使用。

(注:所有更新操作均采用乐观锁机制,更新失败重试次数可在配置文件里设置)

ddd


系统架构

ddd

  • 基于领域驱动与CQRS架构设计,四层架构(ui -> app -> domain -> infrastructure),代码层面读写分类。
  • 数据存储:Elasticsearch与MariaDB,Elasticsearch存储文档数据,MariaDB存储分类、标签与评论数据。

水平分层

  • command 写入模块
  • query 查询模块
    • document 文档模块
    • category 分类模块
    • tag 标签模块
    • comment 评论模块
    • column 专栏模块

垂直分层

  • sdk sdk:提供表示层所需的传输对象
  • ui 表现层:提供对外接口服务以及配置服务
  • app 应用层:处理业务逻辑
  • domain 领域层:提供仓储服务,封装底层数据
  • infrastructure 基础服务层:提供DB、ES、以及常用工具服务

接口文档

启动项目后访问:http://localhost:8000/doc.html

ddd


存储格式

Elasticsearch索引(文档存储)

索引名称:docc-document-center-product
如果没有创建该索引,项目启动时会自动创建索引,但是mapping要自行用kibana创建
字段名称 字段解释 字段类型
id ES主键id keyword
app_id 文档所属应用id keyword
category_id 文档所属分类id keyword
column_id 文档所属专栏id(允许多个) keyword
author_id 文档作者id(允许多个) keyword
document_id 文档id keyword
title 文档标题 keyword
content 文档内容 keyword
tag 文档标签(允许多个) keyword
remarks 文档备注 keyword
extra 文档附加内容(自定义) keyword
summary 文档总结摘要 keyword
auth_level 文档查看权限级别(0~99自定义,用户权限等级如果低于authLevel,则不能查看该文章) Long
score 文档推荐分值(自定义,可按此字段对文档进行排序,用于热门文档推荐)` Long
love_num 文档收藏数(可按此字段对文档进行排序) Long
like_num 文档点赞数(可按此字段对文档进行排序) Long
read_num 文档阅读数(可按此字段对文档进行排序) Long
share_num 文档分享数(可按此字段对文档进行排序) Long
comment_num 文档评论数(可按此字段对文档进行排序) Long
filter 文档检索过滤条件(自定义,允许多个,例:1-仅自己可见、2-所有人可见) Long
attr 文档属性(自定义,允许多个,例:1-转载文章、2-原创文章) Long
type 文档类型(自定义,例:0-普通文章,1-官方公告) Long
status 文档状态(0-删除,1-正常) Long
create_time 文档创建时间 Long
update_time 文档更新时间 Long

MariaDB索引(分类专栏标签评论子评论存储)

create table `category`
(
    id            bigint unsigned auto_increment
        primary key,
    app_id        varchar(63)  not null comment '应用id',
    category_id   varchar(63)  not null comment '分类id',
    parent_id     varchar(63)  not null comment '父类id',
    category_name varchar(127) not null default '' comment '分类名称',
    detail        text                  default '' comment '详情',
    extra         text                  default '' comment '附加内容',
    score         bigint       not null default 0 comment '排序权值',
    attr          int          not null default 0 comment '属性',
    type          int          not null default 0 comment '类型',
    status        int          not null default 1 comment '状态(1-正常、0-删除)',
    version       bigint       not null default 0 comment '版本号(乐观锁)',
    create_time   bigint       not null default 0 comment '创建时间',
    update_time   bigint       not null default 0 comment '更新时间'
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;

create table `author_column`
(
  id            bigint unsigned auto_increment
    primary key,
  app_id        varchar(63)  not null comment '应用id',
  category_id   varchar(63)  not null comment '分类id',
  column_id     varchar(63)  not null comment '专栏id',
  author_id     varchar(63)  not null comment '作者id',
  column_name   varchar(127) not null default '' comment '专栏名称',
  detail        text                  default '' comment '详情',
  extra         text                  default '' comment '附加内容',
  score         bigint       not null default 0 comment '排序权值',
  document_num  bigint       not null default 0 comment '该专栏下的文档数量',
  attr          int          not null default 0 comment '属性',
  type          int          not null default 0 comment '类型',
  status        int          not null default 1 comment '状态(1-正常、0-删除)',
  version       bigint       not null default 0 comment '版本号(乐观锁)',
  create_time   bigint       not null default 0 comment '创建时间',
  update_time   bigint       not null default 0 comment '更新时间'
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;

create table `tag`
(
    id          bigint unsigned auto_increment
        primary key,
    app_id      varchar(63)  not null comment '应用id',
    tag_name    varchar(127) not null default '' comment '标签名称',
    number      bigint       not null default 0 comment '带有该标签的文档数量',
    status      int          not null default 1 comment '状态(1-正常、0-删除)',
    version     bigint       not null default 0 comment '版本号(乐观锁)',
    create_time bigint       not null default 0 comment '创建时间',
    update_time bigint       not null default 0 comment '更新时间'
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;

create table `comment`
(
    id              bigint unsigned auto_increment
        primary key,
    app_id          varchar(63) not null comment '应用id',
    document_id     varchar(63) not null comment '文档id',
    comment_id      varchar(63) not null comment '评论id',
    author_id       varchar(63) not null comment '作者id',
    content         text                 default '' comment '主体内容',
    extra           text                 default '' comment '附加内容',
    like_num        bigint      not null default 0 comment '点赞数',
    love_num        bigint      not null default 0 comment '收藏数',
    share_num       bigint      not null default 0 comment '转发数',
    sub_comment_num bigint      not null default 0 comment '子评论数',
    attr            int         not null default 0 comment '属性',
    type            int         not null default 0 comment '类型',
    status          int         not null default 1 comment '状态(1-正常、0-删除)',
    version         bigint      not null default 0 comment '版本号(乐观锁)',
    create_time     bigint      not null default 0 comment '创建时间',
    update_time     bigint      not null default 0 comment '更新时间'
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;

create table `sub_comment`
(
    id             bigint unsigned auto_increment
        primary key,
    app_id         varchar(63) not null comment '应用id',
    document_id    varchar(63) not null comment '文档id',
    comment_id     varchar(63) not null comment '评论id',
    sub_comment_id varchar(63) not null comment '子评论id',
    author_id      varchar(63) not null comment '作者id',
    reply_to       varchar(63) not null comment '回复对象id',
    content        text                 default '' comment '主体内容',
    extra          text                 default '' comment '附加内容',
    like_num       bigint      not null default 0 comment '点赞数',
    love_num       bigint      not null default 0 comment '收藏数',
    share_num      bigint      not null default 0 comment '转发数',
    attr           int         not null default 0 comment '属性',
    type           int         not null default 0 comment '类型',
    status         int         not null default 1 comment '状态(1-正常、0-删除)',
    version        bigint      not null default 0 comment '版本号(乐观锁)',
    create_time    bigint      not null default 0 comment '创建时间',
    update_time    bigint      not null default 0 comment '更新时间'
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;
MIT License Copyright (c) 2022 dpwgc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于Elasticsearch与MariaDB的文档检索中心(文档中台系统)。基于领域驱动设计与CQRS架构实现。 展开 收起
Java 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/dpwgc/docc-document-center.git
git@gitee.com:dpwgc/docc-document-center.git
dpwgc
docc-document-center
docc-document-center
master

搜索帮助