注释完善

This commit is contained in:
暮光:城中城
2021-11-24 23:28:49 +08:00
parent aae8a9994a
commit 4408525b45
144 changed files with 923 additions and 854 deletions

View File

@@ -2,11 +2,17 @@ package com.zyplayer.doc.core.annotation;
import java.lang.annotation.*; import java.lang.annotation.*;
@Target({ElementType.METHOD,ElementType.TYPE}) /**
* 用户登录校验注解
*
* @author 暮光:城中城
* @since 2019年5月29日
*/
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface AuthMan { public @interface AuthMan {
String[] value() default {}; String[] value() default {};
String authUrl() default "common/authfailed";
boolean all() default false; boolean all() default false;
} }

View File

@@ -1,5 +0,0 @@
package com.zyplayer.doc.core.bean.swagger;
public class Contact {
}

View File

@@ -1,42 +0,0 @@
package com.zyplayer.doc.core.bean.swagger;
public class Info {
private String description;
private String version;
private String title;
private Contact contact;
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
public void setVersion(String version) {
this.version = version;
}
public String getVersion() {
return version;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setContact(Contact contact) {
this.contact = contact;
}
public Contact getContact() {
return contact;
}
}

View File

@@ -1,5 +0,0 @@
package com.zyplayer.doc.core.bean.swagger;
public class Paths {
}

View File

@@ -1,62 +0,0 @@
package com.zyplayer.doc.core.bean.swagger;
import java.util.List;
public class SwaggerApiDocs {
private String swagger;
private Info info;
private String host;
private String basePath;
private List<String> tags;
private Paths paths;
public void setSwagger(String swagger) {
this.swagger = swagger;
}
public String getSwagger() {
return swagger;
}
public void setInfo(Info info) {
this.info = info;
}
public Info getInfo() {
return info;
}
public void setHost(String host) {
this.host = host;
}
public String getHost() {
return host;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public void setTags(List<String> tags) {
this.tags = tags;
}
public List<String> getTags() {
return tags;
}
public void setPaths(Paths paths) {
this.paths = paths;
}
public Paths getPaths() {
return paths;
}
}

View File

@@ -2,6 +2,9 @@ package com.zyplayer.doc.core.exception;
/** /**
* 前端提示异常 * 前端提示异常
*
* @author 暮光:城中城
* @since 2018年12月8日
*/ */
public class ConfirmException extends RuntimeException { public class ConfirmException extends RuntimeException {

View File

@@ -1,67 +1,18 @@
package com.zyplayer.doc.core.json; package com.zyplayer.doc.core.json;
/**
* http静态资源定义
*
* @author 暮光:城中城
* @since 2019年05月29日
*/
public class HttpConst { public class HttpConst {
/**
/** 每页显示条数 **/ * 会话连接
public static final int PAGE_NUMBER = 50; */
/** 默认当前页 **/
public static final int CURRENT_PAGE = 1;
/** 图片验证码 **/
public static final String SESSION_VERIFY_CODE = "SESSION_VERIFY_CODE";
/** 邮箱验证码 **/
public static final String SESSION_EMAIL_CODE = "SESSION_EMAIL_CODE";
/** 请求失败的原因 **/
public static final String SESSION_FAIL_REASON = "SESSION_FAIL_REASON";
/** operator */
public static final String OPERATOR = "OPERATOR";
/** 分页-总条数 */
public static final String PAGE_TOTAL = "PAGE_TOTAL";
/** 分页-当前页数 */
public static final String PAGE_NOWPAGE = "PAGE_NOWPAGE";
/** 分页-总页数 */
public static final String PAGE_PAGECOUNT = "PAGE_PAGECOUNT";
/** 分页-每页多少条 */
public static final String PAGE_SIZE = "PAGE_SIZE";
/** 会话连接 */
public static final String ACCESS_TOKEN = "accessToken"; public static final String ACCESS_TOKEN = "accessToken";
/** 存在于ThreadLocal的http request */ /**
public static final String HTTP_SERVLET_REQUEST = "HTTP_SERVLET_REQUEST"; * accessToken非法或过期需要重新登录
/** 存在于ThreadLocal的HTTP_SESSION */ **/
public static final String HTTP_SESSION = "HTTP_SESSION";
/** 存于operator中权限的缓存头 **/
public static final String AUTH_CACHE_HEAD = "AUTH_CACHE_HEAD_";
/** 存于operator中的用户信息 **/
public static final String CACHE_OPERATOR_USER_INFO = "USER_INFO";
/** 存于operator中的城市信息 **/
public static final String CACHE_OPERATOR_CITY_ID = "CITY_ID";
/** 存于operator中的token绑定的访问信息使得换一台电脑不能使用此token **/
public static final String CACHE_OPERATOR_ACCESS_TOKEN_VALIDATE = "ACCESS_TOKEN_VALIDATE";
/** 存于operator中的token信息 **/
public static final String CACHE_OPERATOR_ACCESS_TOKEN = "accessToken";
/** 存于operator中的微信sessionKey信息 **/
public static final String CACHE_OPERATOR_SESSION_KEY = "sessionKey";
// 新版本使用的错误码
/** 成功 **/
public static final int SUCCESS = 200;
/** 提示性状态 需要客户端配合展示 **/
public static final int CONFIRM_CODE = 300;
/** accessToken非法或过期需要重新登录 **/
public static final int TOKEN_TIMEOUT = 400; public static final int TOKEN_TIMEOUT = 400;
/** 业务接口缺少参数errMsg会返回错误信息 **/
public static final int MISSING_PARAMETER = 401;
/** API 未授权 **/
public static final int UNAUTHORIZED = 402;
/** 接口调用频率超限 **/
public static final int CALL_FREQUENCY_GAUGE = 403;
/** 微信未扫码登录异常 **/
public static final int WX_NOT_LOGIN = 404;
/** 请升级至新版使用此功能 **/
public static final int NEED_UPGRADE = 405;
/** 服务器端未知错误 **/
public static final int OTHER_FAIL = 500;
} }

View File

@@ -1,46 +0,0 @@
package com.zyplayer.doc.core.util;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* 字符串操作类
*/
public final class StringUtil {
/**
* 获取错误信息
*
* @param e
* @return
* @author 暮光:城中城
*/
public static String getException(Throwable e) {
StringWriter sw = null;
PrintWriter pw = null;
try {
sw = new StringWriter();
pw = new PrintWriter(sw);
e.printStackTrace(pw);
pw.flush();
sw.flush();
return sw.toString();
} finally {
if (sw != null) {
try {
sw.close();
} catch (Exception e1) {
e1.printStackTrace();
}
}
if (pw != null) {
try {
pw.close();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
}
}

View File

@@ -1,20 +0,0 @@
package com.zyplayer.doc.core.util;
import javax.servlet.http.HttpServletRequest;
public class ThreadLocalUtil {
private static ThreadLocal<HttpServletRequest> request = new ThreadLocal<>();
public static void setHttpServletRequest(HttpServletRequest request) {
ThreadLocalUtil.request.set(request);
}
public static HttpServletRequest getHttpServletRequest() {
return ThreadLocalUtil.request.get();
}
public static void clean() {
ThreadLocalUtil.request.remove();
}
}

View File

@@ -2,6 +2,8 @@ package com.zyplayer.doc.core.util;
/** /**
* zyplayer-doc版本号 * zyplayer-doc版本号
*
* @author 暮光:城中城
* @since 2021-06-06 * @since 2021-06-06
*/ */
public class ZyplayerDocVersion { public class ZyplayerDocVersion {

View File

@@ -3,11 +3,9 @@ package com.zyplayer.doc.data.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInterceptor; import com.github.pagehelper.PageInterceptor;
import com.zyplayer.doc.data.repository.support.interceptor.SqlLogInterceptor; import com.zyplayer.doc.data.repository.support.interceptor.SqlLogInterceptor;
import com.zyplayer.doc.data.utils.DruidDataSourceUtil; import com.zyplayer.doc.data.utils.DruidDataSourceUtil;
import org.apache.ibatis.plugin.Interceptor;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@@ -17,10 +15,12 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.util.Properties;
/** /**
* mybatis plus数据库配置 * mybatis plus数据库配置
*
* @author 暮光:城中城
* @since 2019-02-16
*/ */
@Configuration @Configuration
public class MybatisPlusConfig { public class MybatisPlusConfig {

View File

@@ -2,6 +2,12 @@ package com.zyplayer.doc.data.config.security;
import java.util.Set; import java.util.Set;
/**
* 登录用户信息
*
* @author 暮光:城中城
* @since 2018-12-02
*/
public class DocUserDetails { public class DocUserDetails {
private Long userId; private Long userId;
private String username; private String username;

View File

@@ -7,12 +7,13 @@ import java.util.Set;
/** /**
* 用户工具类 * 用户工具类
*
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2019年05月25日 * @since 2019年05月25日
*/ */
public class DocUserUtil { public class DocUserUtil {
private static ThreadLocal<DocUserDetails> DOC_USER_DETAILS = new ThreadLocal<>(); private static final ThreadLocal<DocUserDetails> DOC_USER_DETAILS = new ThreadLocal<>();
private static ThreadLocal<String> ACCESS_TOKEN = new ThreadLocal<>(); private static final ThreadLocal<String> ACCESS_TOKEN = new ThreadLocal<>();
public static void setAccessToken(String accessToken) { public static void setAccessToken(String accessToken) {
DocUserUtil.ACCESS_TOKEN.set(accessToken); DocUserUtil.ACCESS_TOKEN.set(accessToken);

View File

@@ -2,6 +2,12 @@ package com.zyplayer.doc.data.repository.manage.param;
import java.util.List; import java.util.List;
/**
* 文档搜索参数
*
* @author 暮光:城中城
* @since 2019-07-10
*/
public class SearchByEsParam { public class SearchByEsParam {
private Long spaceId; private Long spaceId;
private String keywords; private String keywords;

View File

@@ -2,6 +2,7 @@ package com.zyplayer.doc.data.repository.manage.param;
/** /**
* 表关系请求参数 * 表关系请求参数
*
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2021-06-07 * @since 2021-06-07
*/ */

View File

@@ -2,6 +2,12 @@ package com.zyplayer.doc.data.repository.manage.vo;
import java.util.Date; import java.util.Date;
/**
* 最新文档信息
*
* @author 暮光:城中城
* @since 2019-06-14
*/
public class SpaceNewsVo { public class SpaceNewsVo {
private String space; private String space;
private Long spaceId; private Long spaceId;

View File

@@ -4,6 +4,7 @@ import java.util.List;
/** /**
* 表关系结构 * 表关系结构
*
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2021-06-07 * @since 2021-06-07
*/ */

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.data.repository.support.consts; package com.zyplayer.doc.data.repository.support.consts;
/**
* 授权信息静态类
*
* @author 暮光:城中城
* @since 2019-08-22
*/
public class DocAuthConst { public class DocAuthConst {
public static final String DB = "DB_"; public static final String DB = "DB_";
public static final String WIKI = "WIKI_"; public static final String WIKI = "WIKI_";

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.data.repository.support.consts; package com.zyplayer.doc.data.repository.support.consts;
/**
* 系统类型枚举
*
* @author 暮光:城中城
* @since 2020-06-26
*/
public enum UserMsgSysType { public enum UserMsgSysType {
// 系统类型 1=manage 2=wiki 3=db // 系统类型 1=manage 2=wiki 3=db
MANAGE(1), WIKI(2), DB(2), MANAGE(1), WIKI(2), DB(2),

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.data.repository.support.consts; package com.zyplayer.doc.data.repository.support.consts;
/**
* 用户消息类型
*
* @author 暮光:城中城
* @since 2020-06-26
*/
public enum UserMsgType { public enum UserMsgType {
// 消息类型 1=普通文本消息 2=wiki文档创建 3=wiki文档删除 4=wiki文档编辑 5=wiki文档权限修改 // 消息类型 1=普通文本消息 2=wiki文档创建 3=wiki文档删除 4=wiki文档编辑 5=wiki文档权限修改
// 6=wiki文档评论 7=wiki文档删除评论 8=wiki文档上传附件 9=wiki文档修改了父级 10=wiki文档点赞 11=wiki文档附件删除 // 6=wiki文档评论 7=wiki文档删除评论 8=wiki文档上传附件 9=wiki文档修改了父级 10=wiki文档点赞 11=wiki文档附件删除

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.data.repository.support.consts; package com.zyplayer.doc.data.repository.support.consts;
/**
* 用户自定义配置的key
*
* @author 暮光:城中城
* @since 2021-02-09
*/
public class UserSettingConst { public class UserSettingConst {
public static final String WIKI_ONLY_SHOW_FAVORITE = "wiki_only_show_favorite"; public static final String WIKI_ONLY_SHOW_FAVORITE = "wiki_only_show_favorite";
} }

View File

@@ -7,6 +7,12 @@ import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import java.util.Collections; import java.util.Collections;
/**
* 代码生成器
*
* @author 暮光:城中城
* @since 2019-02-26
*/
public class CodeGenerator { public class CodeGenerator {
public static void main(String[] args) { public static void main(String[] args) {

View File

@@ -20,6 +20,12 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Properties; import java.util.Properties;
/**
* 日志拦截
*
* @author 暮光:城中城
* @since 2019-02-26
*/
@Intercepts({ @Intercepts({
@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class}), @Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}), @Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@@ -107,12 +113,13 @@ public class SqlLogInterceptor implements Interceptor {
/** /**
* 替换?占位符 * 替换?占位符
* @author 暮光:城中城 *
* @since 2018年10月27日
* @param sql * @param sql
* @param fromIndex * @param fromIndex
* @param replaceStr * @param replaceStr
* @return * @return
* @author 暮光:城中城
* @since 2018年10月27日
*/ */
private int replacePlaceholder(StringBuilder sql, int fromIndex, String replaceStr) { private int replacePlaceholder(StringBuilder sql, int fromIndex, String replaceStr) {
int index = sql.indexOf("?", fromIndex); int index = sql.indexOf("?", fromIndex);

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.data.utils; package com.zyplayer.doc.data.utils;
/**
* 缓存前缀
*
* @author 暮光:城中城
* @since 2019-08-27
*/
public class CachePrefix { public class CachePrefix {
public static final String WIKI_LOCK_PAGE = "WIKI_LOCK_PAGE_"; public static final String WIKI_LOCK_PAGE = "WIKI_LOCK_PAGE_";
public static final String DB_EDITOR_DATA_CACHE = "DB_EDITOR_DATA_CACHE_"; public static final String DB_EDITOR_DATA_CACHE = "DB_EDITOR_DATA_CACHE_";

View File

@@ -53,6 +53,7 @@ public class CacheUtil {
/** /**
* 放入缓存默认12小时按最后一次访问的12小时 * 放入缓存默认12小时按最后一次访问的12小时
*
* @param key * @param key
* @param value * @param value
*/ */
@@ -62,6 +63,7 @@ public class CacheUtil {
/** /**
* 放入缓存,有访问则继续有效 * 放入缓存,有访问则继续有效
*
* @param key * @param key
* @param value * @param value
* @param seconds 缓存时长 秒 * @param seconds 缓存时长 秒
@@ -75,6 +77,7 @@ public class CacheUtil {
/** /**
* 删除缓存 * 删除缓存
*
* @param key * @param key
*/ */
public static void remove(String key) { public static void remove(String key) {
@@ -86,6 +89,7 @@ public class CacheUtil {
/** /**
* 获取缓存 * 获取缓存
*
* @param key * @param key
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -102,7 +106,9 @@ public class CacheUtil {
} }
private static class CacheData { private static class CacheData {
/**缓存时长 秒*/ /**
* 缓存时长 秒
*/
private Long seconds; private Long seconds;
private Long lastVisitTime; private Long lastVisitTime;
private Object data; private Object data;

View File

@@ -7,6 +7,12 @@ import com.zyplayer.doc.core.exception.ConfirmException;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
/**
* Druid连接池工具类
*
* @author 暮光:城中城
* @since 2020-04-08
*/
public class DruidDataSourceUtil { public class DruidDataSourceUtil {
private static AtomicLong nameId = new AtomicLong(0); private static AtomicLong nameId = new AtomicLong(0);

View File

@@ -4,6 +4,12 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/**
* 线程池工具类
*
* @author 暮光:城中城
* @since 2019-10-06
*/
public class ThreadPoolUtil { public class ThreadPoolUtil {
private static final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(20, 100, 30, TimeUnit.SECONDS, new LinkedBlockingQueue<>()); private static final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(20, 100, 30, TimeUnit.SECONDS, new LinkedBlockingQueue<>());

View File

@@ -82,6 +82,7 @@ public class DatabaseDocController {
/** /**
* 获取数据源基本信息 * 获取数据源基本信息
*
* @param sourceId 数据源ID * @param sourceId 数据源ID
* @return 基本信息 * @return 基本信息
*/ */

View File

@@ -7,7 +7,6 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.util.TypeUtils; import com.alibaba.fastjson.util.TypeUtils;
import com.zyplayer.doc.core.annotation.AuthMan; import com.zyplayer.doc.core.annotation.AuthMan;
import com.zyplayer.doc.core.json.ResponseJson; import com.zyplayer.doc.core.json.ResponseJson;
import com.zyplayer.doc.core.util.StringUtil;
import com.zyplayer.doc.db.controller.download.FormatDownloadConst; import com.zyplayer.doc.db.controller.download.FormatDownloadConst;
import com.zyplayer.doc.db.controller.download.FormatDownloadService; import com.zyplayer.doc.db.controller.download.FormatDownloadService;
import com.zyplayer.doc.db.controller.param.DataViewParam; import com.zyplayer.doc.db.controller.param.DataViewParam;
@@ -23,6 +22,7 @@ import com.zyplayer.doc.db.service.database.DbBaseService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -170,7 +170,7 @@ public class DbDataViewController {
return sqlExecutor.execute(executeParam); return sqlExecutor.execute(executeParam);
} catch (Exception e) { } catch (Exception e) {
logger.error("执行出错", e); logger.error("执行出错", e);
return ExecuteResult.error(StringUtil.getException(e), executeSql); return ExecuteResult.error(ExceptionUtils.getFullStackTrace(e), executeSql);
} }
} }
} }

View File

@@ -9,7 +9,6 @@ import com.zyplayer.doc.core.json.ResponseJson;
import com.zyplayer.doc.data.config.security.DocUserDetails; import com.zyplayer.doc.data.config.security.DocUserDetails;
import com.zyplayer.doc.data.config.security.DocUserUtil; import com.zyplayer.doc.data.config.security.DocUserUtil;
import com.zyplayer.doc.data.repository.manage.entity.DbDatasource; import com.zyplayer.doc.data.repository.manage.entity.DbDatasource;
import com.zyplayer.doc.data.repository.manage.entity.UserInfo;
import com.zyplayer.doc.data.repository.support.consts.DocAuthConst; import com.zyplayer.doc.data.repository.support.consts.DocAuthConst;
import com.zyplayer.doc.data.service.manage.DbDatasourceService; import com.zyplayer.doc.data.service.manage.DbDatasourceService;
import com.zyplayer.doc.db.framework.configuration.DatasourceUtil; import com.zyplayer.doc.db.framework.configuration.DatasourceUtil;

View File

@@ -195,6 +195,7 @@ public class DbProcedureController {
/** /**
* 创建日志对象 * 创建日志对象
*
* @param sourceId * @param sourceId
* @param dbName * @param dbName
* @param typeName * @param typeName

View File

@@ -66,7 +66,7 @@ public class DbTableRelationController {
relationVoChildren.setTableName(param.getTableName()); relationVoChildren.setTableName(param.getTableName());
relationVoChildren.setName(columnDto.getName()); relationVoChildren.setName(columnDto.getName());
relationVoChildren.setColumnName(columnDto.getName()); relationVoChildren.setColumnName(columnDto.getName());
relationVoChildren.setChildren(this.getRelation(param.getSourceId(), param.getDbName(), param.getTableName(), columnDto.getName(), drillPath,1)); relationVoChildren.setChildren(this.getRelation(param.getSourceId(), param.getDbName(), param.getTableName(), columnDto.getName(), drillPath, 1));
childrenRelationList.add(relationVoChildren); childrenRelationList.add(relationVoChildren);
} }
relationVo.setChildren(childrenRelationList); relationVo.setChildren(childrenRelationList);

View File

@@ -15,10 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;

View File

@@ -2,6 +2,8 @@ package com.zyplayer.doc.db.controller.download;
/** /**
* 下载类型枚举 * 下载类型枚举
* @author 暮光:城中城
* @since 2021-08-14
*/ */
public class FormatDownloadConst { public class FormatDownloadConst {
/** /**

View File

@@ -2,6 +2,8 @@ package com.zyplayer.doc.db.controller.download;
/** /**
* 下载类型枚举 * 下载类型枚举
* @author 暮光:城中城
* @since 2021-08-14
*/ */
public enum FormatDownloadEnum { public enum FormatDownloadEnum {
INSERT(FormatDownloadConst.INSERT), INSERT(FormatDownloadConst.INSERT),

View File

@@ -4,6 +4,12 @@ import com.zyplayer.doc.db.controller.param.DataViewParam;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/**
* 下载服务
*
* @author 暮光:城中城
* @since 2021-08-14
*/
public interface FormatDownloadService { public interface FormatDownloadService {
public void download(HttpServletResponse response, DataViewParam param, String[] tableNameArr) throws Exception; public void download(HttpServletResponse response, DataViewParam param, String[] tableNameArr) throws Exception;

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.db.controller.param; package com.zyplayer.doc.db.controller.param;
/**
* 数据预览查询参数
*
* @author 暮光:城中城
* @since 2021-05-20
*/
public class DataViewParam { public class DataViewParam {
// 基本信息 // 基本信息
private String executeId; private String executeId;

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.db.controller.param; package com.zyplayer.doc.db.controller.param;
/**
* 存储过程列表查询参数
*
* @author 暮光:城中城
* @since 2021-04-25
*/
public class ProcedureListParam { public class ProcedureListParam {
private Long sourceId; private Long sourceId;
private String dbName; private String dbName;

View File

@@ -1,11 +1,17 @@
package com.zyplayer.doc.db.controller.vo; package com.zyplayer.doc.db.controller.vo;
import java.util.List;
import java.util.Map;
import com.zyplayer.doc.db.controller.vo.TableColumnVo.TableInfoVo; import com.zyplayer.doc.db.controller.vo.TableColumnVo.TableInfoVo;
import com.zyplayer.doc.db.framework.db.dto.TableColumnDescDto; import com.zyplayer.doc.db.framework.db.dto.TableColumnDescDto;
import java.util.List;
import java.util.Map;
/**
* 数据库表导出
*
* @author 暮光:城中城
* @since 2018-11-27
*/
public class DatabaseExportVo { public class DatabaseExportVo {
private Map<String, List<TableColumnDescDto>> columnList; private Map<String, List<TableColumnDescDto>> columnList;

View File

@@ -1,11 +1,17 @@
package com.zyplayer.doc.db.controller.vo; package com.zyplayer.doc.db.controller.vo;
import java.util.List;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.zyplayer.doc.db.framework.db.dto.TableColumnDescDto; import com.zyplayer.doc.db.framework.db.dto.TableColumnDescDto;
import java.util.List;
/**
* 表字段信息
*
* @author 暮光:城中城
* @since 2018-11-27
*/
public class TableColumnVo { public class TableColumnVo {
private List<TableColumnDescDto> columnList; private List<TableColumnDescDto> columnList;

View File

@@ -4,6 +4,12 @@ import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum;
import java.util.Objects; import java.util.Objects;
/**
* 表ddl信息
*
* @author 暮光:城中城
* @since 2021-04-23
*/
public class TableDdlVo { public class TableDdlVo {
private String current; private String current;
private String mysql; private String mysql;

View File

@@ -2,6 +2,12 @@ package com.zyplayer.doc.db.controller.vo;
import java.util.Date; import java.util.Date;
/**
* 表基本信息
*
* @author 暮光:城中城
* @since 2019-09-04
*/
public class TableStatusVo { public class TableStatusVo {
private String name; private String name;
private String engine; private String engine;

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.db.controller.vo; package com.zyplayer.doc.db.controller.vo;
/**
* 用户数据库授权信息
*
* @author 暮光:城中城
* @since 2019-08-22
*/
public class UserDbAuthVo { public class UserDbAuthVo {
private String userName; private String userName;
private Long userId; private Long userId;

View File

@@ -4,6 +4,12 @@ import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/**
* 应用启动监听
*
* @author 暮光:城中城
* @since 2018-11-27
*/
@Component @Component
public class ApplicationListenerBean implements ApplicationListener<ContextRefreshedEvent> { public class ApplicationListenerBean implements ApplicationListener<ContextRefreshedEvent> {

View File

@@ -16,6 +16,12 @@ import org.springframework.core.io.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* 数据库连接工具类
*
* @author 暮光:城中城
* @since 2019-07-04
*/
public class DatasourceUtil { public class DatasourceUtil {
private static final SqlLogInterceptor sqlLogInterceptor = new SqlLogInterceptor(); private static final SqlLogInterceptor sqlLogInterceptor = new SqlLogInterceptor();
// url解析 // url解析

View File

@@ -5,6 +5,12 @@ import org.springframework.context.annotation.Configuration;
import java.lang.annotation.*; import java.lang.annotation.*;
/**
* 开启db模块的注解
*
* @author 暮光:城中城
* @since 2018-11-27
*/
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented

View File

@@ -3,6 +3,12 @@ package com.zyplayer.doc.db.framework.configuration.analysis;
import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean; import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
/**
* 数据库链接url解析api
*
* @author 暮光:城中城
* @since 2021-05-13
*/
public interface AnalysisApi { public interface AnalysisApi {
Resource[] process(String dbUrl, DatabaseFactoryBean databaseFactoryBean) throws Exception; Resource[] process(String dbUrl, DatabaseFactoryBean databaseFactoryBean) throws Exception;

View File

@@ -5,6 +5,12 @@ import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
/**
* hive链接url解析
*
* @author 暮光:城中城
* @since 2021-05-13
*/
public class HiveAnalysis implements AnalysisApi { public class HiveAnalysis implements AnalysisApi {
@Override @Override

View File

@@ -5,6 +5,12 @@ import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
/**
* mysql链接url解析
*
* @author 暮光:城中城
* @since 2021-05-13
*/
public class MysqlAnalysis implements AnalysisApi { public class MysqlAnalysis implements AnalysisApi {
@Override @Override

View File

@@ -5,6 +5,12 @@ import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
/**
* Oracle链接url解析
*
* @author 暮光:城中城
* @since 2021-05-13
*/
public class OracleAnalysis implements AnalysisApi { public class OracleAnalysis implements AnalysisApi {
@Override @Override

View File

@@ -5,6 +5,12 @@ import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
/**
* Postgresql链接url解析
*
* @author 暮光:城中城
* @since 2021-05-13
*/
public class PostgresqlAnalysis implements AnalysisApi { public class PostgresqlAnalysis implements AnalysisApi {
@Override @Override

View File

@@ -5,6 +5,12 @@ import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
/**
* Sqlserver链接url解析
*
* @author 暮光:城中城
* @since 2021-05-13
*/
public class SqlserverAnalysis implements AnalysisApi { public class SqlserverAnalysis implements AnalysisApi {
@Override @Override

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.db.framework.consts; package com.zyplayer.doc.db.framework.consts;
/**
* 数据库授权前缀
*
* @author 暮光:城中城
* @since 2019-08-22
*/
public enum DbAuthType { public enum DbAuthType {
NO_AUTH(0, "DB_NO_AUTH_"), NO_AUTH(0, "DB_NO_AUTH_"),
VIEW(1, "DB_VIEW_"), VIEW(1, "DB_VIEW_"),

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.db.framework.db.dto; package com.zyplayer.doc.db.framework.db.dto;
/**
* 字段信息
*
* @author 暮光:城中城
* @since 2018-11-27
*/
public class ColumnInfoDto { public class ColumnInfoDto {
private String isNullable; private String isNullable;
private String columnType; private String columnType;

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.db.framework.db.dto; package com.zyplayer.doc.db.framework.db.dto;
/**
* 数据库信息
*
* @author 暮光:城中城
* @since 2018-11-27
*/
public class DatabaseInfoDto { public class DatabaseInfoDto {
private String dbName; private String dbName;

View File

@@ -2,6 +2,9 @@ package com.zyplayer.doc.db.framework.db.dto;
/** /**
* 存储过程信息 * 存储过程信息
*
* @author 暮光:城中城
* @since 2021-04-25
*/ */
public class ProcedureDto { public class ProcedureDto {
private String db; private String db;

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.db.framework.db.dto; package com.zyplayer.doc.db.framework.db.dto;
/**
* 表字段注释信息
*
* @author 暮光:城中城
* @since 2018-11-27
*/
public class QueryTableColumnDescDto { public class QueryTableColumnDescDto {
private String tableName; private String tableName;
private String columnName; private String columnName;

View File

@@ -3,6 +3,12 @@ package com.zyplayer.doc.db.framework.db.dto;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ColumnWidth;
/**
* 表字段注释信息
*
* @author 暮光:城中城
* @since 2018-11-27
*/
public class TableColumnDescDto { public class TableColumnDescDto {
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty("表名") @ExcelProperty("表名")

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.db.framework.db.dto; package com.zyplayer.doc.db.framework.db.dto;
/**
* 表注释信息
*
* @author 暮光:城中城
* @since 2018-11-27
*/
public class TableDescDto { public class TableDescDto {
private String tableName; private String tableName;
private String description; private String description;

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.db.framework.db.dto; package com.zyplayer.doc.db.framework.db.dto;
/**
* 表信息
*
* @author 暮光:城中城
* @since 2018-11-27
*/
public class TableInfoDto { public class TableInfoDto {
private String dbName; private String dbName;
private String tableName; private String tableName;

View File

@@ -2,6 +2,9 @@ package com.zyplayer.doc.db.framework.db.enums;
/** /**
* 数据库类型枚举 * 数据库类型枚举
*
* @author 暮光:城中城
* @since 2021-05-13
*/ */
public enum DatabaseProductEnum { public enum DatabaseProductEnum {
MYSQL("com.mysql.jdbc.Driver"), MYSQL("com.mysql.jdbc.Driver"),

View File

@@ -1,5 +1,6 @@
package com.zyplayer.doc.db.framework.db.interceptor; package com.zyplayer.doc.db.framework.db.interceptor;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor; import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.MappedStatement;
@@ -19,9 +20,16 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Properties; import java.util.Properties;
/**
* 日志拦截
*
* @author 暮光:城中城
* @since 2019-02-26
*/
@Intercepts({ @Intercepts({
@Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }), @Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class}),
@Signature(type = Executor.class, method = "query", args = { MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class }) @Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}),
}) })
public class SqlLogInterceptor implements Interceptor { public class SqlLogInterceptor implements Interceptor {

View File

@@ -1,62 +0,0 @@
package com.zyplayer.doc.db.framework.db.interceptor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.ParameterMapping;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class SqlLogUtil {
private static final Logger logger = LoggerFactory.getLogger(SqlLogUtil.class);
private static String getParameterValue(Object obj) {
String value;
if (obj instanceof String) {
value = "'" + obj.toString() + "'";
} else if (obj instanceof Date) {
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.CHINA);
value = "'" + formatter.format(obj) + "'";
} else {
value = (obj == null) ? "'null'" : obj.toString();
}
return value;
}
public static String getSqlString(Map<String, Object> paramMap, BoundSql boundSql) {
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
StringBuilder sqlSb = new StringBuilder(boundSql.getSql().replaceAll("[\\s]+", " "));
int fromIndex = 0;
if (parameterMappings.size() > 0) {
for (ParameterMapping parameterMapping : parameterMappings) {
String propertyName = parameterMapping.getProperty();
Object obj = paramMap.get(propertyName);
fromIndex = replacePlaceholder(sqlSb, fromIndex, getParameterValue(obj));
}
}
return sqlSb.toString();
}
/**
* 替换?占位符
*
* @param sql
* @param fromIndex
* @param replaceStr
* @return
* @author 暮光:城中城
* @since 2018年10月27日
*/
private static int replacePlaceholder(StringBuilder sql, int fromIndex, String replaceStr) {
int index = sql.indexOf("?", fromIndex);
if (index >= 0) {
sql.replace(index, index + 1, replaceStr);
}
return index + replaceStr.length();
}
}

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.db.framework.db.mapper.base; package com.zyplayer.doc.db.framework.db.mapper.base;
/**
* 执行类型
*
* @author 暮光:城中城
* @since 2019-08-22
*/
public enum ExecuteType { public enum ExecuteType {
ALL, SELECT, ALL, SELECT,
} }

View File

@@ -2,7 +2,6 @@ package com.zyplayer.doc.db.framework.db.mapper.base;
import com.alibaba.druid.pool.DruidPooledConnection; import com.alibaba.druid.pool.DruidPooledConnection;
import com.baomidou.mybatisplus.core.MybatisConfiguration; import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.zyplayer.doc.core.util.StringUtil;
import com.zyplayer.doc.data.service.manage.DbHistoryService; import com.zyplayer.doc.data.service.manage.DbHistoryService;
import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean; import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean;
import com.zyplayer.doc.db.framework.db.bean.DatabaseRegistrationBean; import com.zyplayer.doc.db.framework.db.bean.DatabaseRegistrationBean;

View File

@@ -2,6 +2,12 @@ package com.zyplayer.doc.db.framework.db.parser;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
/**
* 参数填充接口
*
* @author 暮光:城中城
* @since 2021-06-27
*/
public interface FillParamParser { public interface FillParamParser {
/** /**

View File

@@ -1,12 +1,12 @@
/** /**
* Copyright 2009-2017 the original author or authors. * Copyright 2009-2017 the original author or authors.
* * <p>
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,6 +19,7 @@ import org.apache.ibatis.parsing.TokenHandler;
/** /**
* 参数预处理类 * 参数预处理类
*
* @author Clinton Begin * @author Clinton Begin
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2019-10-10 * @since 2019-10-10

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.db.framework.db.transfer; package com.zyplayer.doc.db.framework.db.transfer;
/**
* 数据互导状态类
*
* @author 暮光:城中城
* @since 2019-10-06
*/
public enum TransferTaskStatus { public enum TransferTaskStatus {
// 最后执行状态 0=未执行 1=执行中 2=执行成功 3=执行失败 4=取消执行 // 最后执行状态 0=未执行 1=执行中 2=执行成功 3=执行失败 4=取消执行
NOT_START(0), EXECUTING(1), SUCCESS(2), ERROR(3), CANCEL(4); NOT_START(0), EXECUTING(1), SUCCESS(2), ERROR(3), CANCEL(4);

View File

@@ -6,6 +6,12 @@ import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
/**
* json工具类
*
* @author 暮光:城中城
* @since 2021-05-20
*/
public class JSONUtil { public class JSONUtil {
public static SerializeConfig serializeConfig = new SerializeConfig(); public static SerializeConfig serializeConfig = new SerializeConfig();

View File

@@ -7,6 +7,12 @@ import com.zyplayer.doc.db.framework.consts.DbAuthType;
import com.zyplayer.doc.db.framework.db.mapper.base.ExecuteType; import com.zyplayer.doc.db.framework.db.mapper.base.ExecuteType;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/**
* 执行权限判断类
*
* @author 暮光:城中城
* @since 2021-08-14
*/
@Service @Service
public class ExecuteAuthService { public class ExecuteAuthService {

View File

@@ -14,6 +14,12 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 数据库服务工厂类
*
* @author 暮光:城中城
* @since 2021-02-01
*/
@Service @Service
public class DatabaseServiceFactory { public class DatabaseServiceFactory {
@@ -45,6 +51,7 @@ public class DatabaseServiceFactory {
/** /**
* 获取下载服务 * 获取下载服务
*
* @param databaseProductEnum 数据库类型 * @param databaseProductEnum 数据库类型
* @return 下载服务 * @return 下载服务
*/ */

View File

@@ -14,6 +14,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* hive数据查询服务实现类
*
* @author 暮光:城中城
* @since 2021-05-11
*/
@Service @Service
public class HiveServiceImpl extends DbBaseService { public class HiveServiceImpl extends DbBaseService {

View File

@@ -20,6 +20,12 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
/**
* MySQL数据查询服务实现类
*
* @author 暮光:城中城
* @since 2021-02-01
*/
@Service @Service
public class MysqlServiceImpl extends DbBaseService { public class MysqlServiceImpl extends DbBaseService {

View File

@@ -3,6 +3,12 @@ package com.zyplayer.doc.db.service.database;
import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum; import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/**
* Oracle数据查询服务实现类
*
* @author 暮光:城中城
* @since 2021-02-01
*/
@Service @Service
public class OracleServiceImpl extends DbBaseService { public class OracleServiceImpl extends DbBaseService {

View File

@@ -3,6 +3,12 @@ package com.zyplayer.doc.db.service.database;
import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum; import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/**
* Postgresql数据查询服务实现类
*
* @author 暮光:城中城
* @since 2021-02-01
*/
@Service @Service
public class PostgresqlServiceImpl extends DbBaseService { public class PostgresqlServiceImpl extends DbBaseService {

View File

@@ -14,6 +14,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* Sqlserver数据查询服务实现类
*
* @author 暮光:城中城
* @since 2021-02-01
*/
@Service @Service
public class SqlserverServiceImpl extends DbBaseService { public class SqlserverServiceImpl extends DbBaseService {

View File

@@ -30,6 +30,9 @@ import java.util.regex.Pattern;
/** /**
* 基础的数据导出服务类按照MySQL规范写的不满足的可新增类来实现 * 基础的数据导出服务类按照MySQL规范写的不满足的可新增类来实现
*
* @author 暮光:城中城
* @since 2021-06-05
*/ */
@Service @Service
public class BaseDownloadService implements DownloadService { public class BaseDownloadService implements DownloadService {

View File

@@ -9,6 +9,12 @@ import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
/**
* 下载服务
*
* @author 暮光:城中城
* @since 2021-06-17
*/
@Service @Service
public interface DownloadService { public interface DownloadService {

View File

@@ -21,6 +21,9 @@ import java.util.regex.Pattern;
/** /**
* SQLServer的数据导出服务类 * SQLServer的数据导出服务类
*
* @author 暮光:城中城
* @since 2021-06-17
*/ */
@Service @Service
public class SqlserverDownloadService implements DownloadService { public class SqlserverDownloadService implements DownloadService {

View File

@@ -7,6 +7,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* dubbo信息对象
*
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2019年1月10日 * @since 2019年1月10日
**/ **/

View File

@@ -2,6 +2,12 @@ package com.zyplayer.doc.dubbo.controller.vo;
import java.util.List; import java.util.List;
/**
* nacos服务信息对象
*
* @author 暮光:城中城
* @since 2019年1月10日
**/
public class NacosServiceInfoVo { public class NacosServiceInfoVo {
private int count; private int count;

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.dubbo.controller.vo; package com.zyplayer.doc.dubbo.controller.vo;
/**
* nacos服务列表信息
*
* @author 暮光:城中城
* @since 2019年1月10日
**/
public class NacosServiceListVo { public class NacosServiceListVo {
private String name; private String name;
private int clusterCount; private int clusterCount;

View File

@@ -5,6 +5,8 @@ import com.alibaba.fastjson.annotation.JSONField;
import java.util.List; import java.util.List;
/** /**
* dubbo信息
*
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2019年1月10日 * @since 2019年1月10日
**/ **/

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.dubbo.framework.bean; package com.zyplayer.doc.dubbo.framework.bean;
/**
* 接口类型
*
* @author 暮光:城中城
* @since 2019年1月10日
**/
public enum InterfaceType { public enum InterfaceType {
map, list, set, arr map, list, set, arr
} }

View File

@@ -5,6 +5,8 @@ import com.alibaba.fastjson.annotation.JSONField;
import java.util.List; import java.util.List;
/** /**
* nacos中dubbo的信息
*
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2019年1月10日 * @since 2019年1月10日
**/ **/

View File

@@ -9,6 +9,8 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
* 引用配置信息
*
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2019年1月10日 * @since 2019年1月10日
**/ **/

View File

@@ -5,6 +5,13 @@ import org.springframework.context.annotation.Configuration;
import java.lang.annotation.*; import java.lang.annotation.*;
/**
* 开启dubbo模块注解
*
* @author 暮光:城中城
* @since 2019年2月12日
**/
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented

View File

@@ -5,6 +5,12 @@ import org.apache.commons.lang.StringUtils;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
/**
* 基本数据类型
*
* @author 暮光:城中城
* @since 2020年10月31日
**/
public class BaseType { public class BaseType {
private static final Set<String> baseType = new HashSet<String>() {{ private static final Set<String> baseType = new HashSet<String>() {{

View File

@@ -1,8 +1,10 @@
package com.zyplayer.doc.dubbo.framework.constant; package com.zyplayer.doc.dubbo.framework.constant;
/** /**
* dubbo静态类
*
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2020年11月08日 * @since 2020年11月18日
*/ */
public class DubboDocConst { public class DubboDocConst {
/**上传的文档jar文件名*/ /**上传的文档jar文件名*/

View File

@@ -1,7 +1,7 @@
package com.zyplayer.doc.dubbo.framework.service; package com.zyplayer.doc.dubbo.framework.service;
/** /**
* * classloader回调接口类
* *
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2018年8月19日 * @since 2018年8月19日

View File

@@ -4,6 +4,7 @@ import java.io.Serializable;
/** /**
* 数据类型 * 数据类型
*
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2018-11-27 * @since 2018-11-27
*/ */

View File

@@ -5,6 +5,7 @@ import java.util.List;
/** /**
* 实现此类才能使用服务器端的存贮功能 * 实现此类才能使用服务器端的存贮功能
* dubbo的文档需要手动写的比较重要所以重起一个存储service实现类尽量操作另外的库 * dubbo的文档需要手动写的比较重要所以重起一个存储service实现类尽量操作另外的库
*
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2018年8月19日 * @since 2018年8月19日
*/ */
@@ -12,37 +13,41 @@ public interface MgDubboStorageService {
/** /**
* 获取存储的值 * 获取存储的值
* @author 暮光:城中城 *
* @since 2018年8月19日
* @param key 参数 * @param key 参数
* @return 值 * @return 值
* @author 暮光:城中城
* @since 2018年8月19日
*/ */
String get(String key); String get(String key);
/** /**
* 模糊获取存储的值 * 模糊获取存储的值
* @author 暮光:城中城 *
* @since 2018年8月19日
* @param key 参数 * @param key 参数
* @param value 值 * @param value 值
* @return 值 * @return 值
* @author 暮光:城中城
* @since 2018年8月19日
*/ */
List<MgDubboStorage> like(String key, String value); List<MgDubboStorage> like(String key, String value);
/** /**
* 存储数据 * 存储数据
* @author 暮光:城中城 *
* @since 2018年8月19日
* @param key 参数 * @param key 参数
* @param value 值 * @param value 值
* @author 暮光:城中城
* @since 2018年8月19日
*/ */
void put(String key, String value); void put(String key, String value);
/** /**
* 删除数据 * 删除数据
*
* @param key 参数
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2018年8月19日 * @since 2018年8月19日
* @param key 参数
*/ */
void remove(String key); void remove(String key);
} }

View File

@@ -4,7 +4,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
@@ -17,6 +16,9 @@ import java.util.Optional;
/** /**
* 程序启动器 * 程序启动器
*
* @author 暮光:城中城
* @since 2018-11-27
*/ */
@EnableScheduling @EnableScheduling
@SpringBootApplication @SpringBootApplication
@@ -39,11 +41,13 @@ public class Application extends SpringBootServletInitializer {
String hostAddress = InetAddress.getLocalHost().getHostAddress(); String hostAddress = InetAddress.getLocalHost().getHostAddress();
String serverPort = env.getProperty("server.port"); String serverPort = env.getProperty("server.port");
String urlCtx = hostAddress + ":" + serverPort + "/" + contextPath; String urlCtx = hostAddress + ":" + serverPort + "/" + contextPath;
String localCtx = "local.zyplayer.com:" + serverPort + "/" + contextPath;
logger.info("\n----------------------------------------------------------\n\t" + logger.info("\n----------------------------------------------------------\n\t" +
"\t\t地址列表\n\t" + "\t\t地址列表\n" +
"管理地址http://{}\n" + "\t管理地址http://{}\n" +
"\t域名访问http://{}\n" +
"----------------------------------------------------------", "----------------------------------------------------------",
urlCtx urlCtx, localCtx
); );
} }
} }

View File

@@ -1,24 +0,0 @@
package com.zyplayer.doc.manage.framework.config;
import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
/**
* 自定义错误页面
* @author 暮光:城中城
* @since 2018年11月11日
*/
@Configuration
public class CustomizationBean implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {
@Override
public void customize(ConfigurableServletWebServerFactory factory) {
factory.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN, "/statics/common/403.html"));
factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/statics/common/404.html"));
factory.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/statics/common/500.html"));
}
}

View File

@@ -1,8 +1,8 @@
package com.zyplayer.doc.manage.framework.config; package com.zyplayer.doc.manage.framework.config;
import com.github.dozermapper.core.Mapper;
import com.github.dozermapper.core.DozerBeanMapperBuilder; import com.github.dozermapper.core.DozerBeanMapperBuilder;
import com.github.dozermapper.core.DozerConverter; import com.github.dozermapper.core.DozerConverter;
import com.github.dozermapper.core.Mapper;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@@ -12,6 +12,12 @@ import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
/**
* mapper配置类
*
* @author 暮光:城中城
* @since 2018年12月15日
*/
@Configuration @Configuration
public class MapperConfig { public class MapperConfig {
@@ -21,7 +27,6 @@ public class MapperConfig {
.withCustomConverter(new DateStringConvert(Date.class, String.class)) .withCustomConverter(new DateStringConvert(Date.class, String.class))
.withCustomConverter(new BigdecimalToStringConvert(BigDecimal.class, String.class)); .withCustomConverter(new BigdecimalToStringConvert(BigDecimal.class, String.class));
return builder.build(); return builder.build();
// return DozerBeanMapperBuilder.buildDefault();
} }
private class DateStringConvert extends DozerConverter<Date, String> { private class DateStringConvert extends DozerConverter<Date, String> {

View File

@@ -15,12 +15,17 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* WEB控制相关配置
*
* @author 暮光:城中城
* @since 2018年11月27日
*/
@Component @Component
@Configuration @Configuration
public class WebMvcConfig implements WebMvcConfigurer { public class WebMvcConfig implements WebMvcConfigurer {
@@ -57,7 +62,9 @@ public class WebMvcConfig implements WebMvcConfigurer {
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(userLoginInterceptor).excludePathPatterns("/**/*.js", "/**/*.css", "/**/*.png", "/**/*.gif", "/**/*.jpg", "/**/*.jpeg", "/**/fonts/*"); registry.addInterceptor(userLoginInterceptor)
.excludePathPatterns("/", "/doc-wiki", "/doc-db", "/doc-swagger-plus", "/doc-dubbo")
.excludePathPatterns("/**/*.js", "/**/*.css", "/**/*.png", "/**/*.gif", "/**/*.jpg", "/**/*.jpeg", "/**/fonts/*");
} }
} }

View File

@@ -16,14 +16,18 @@ import org.springframework.context.annotation.Configuration;
public class ZyplayerDocConfig { public class ZyplayerDocConfig {
@EnableDocWiki @EnableDocWiki
public class enableDocWiki{} public class enableDocWiki {
}
@EnableDocDubbo @EnableDocDubbo
public class enableDocDubbo{} public class enableDocDubbo {
}
@EnableDocDb @EnableDocDb
public class enableDocDb{} public class enableDocDb {
}
@EnableDocSwaggerPlus @EnableDocSwaggerPlus
public class enableDocSwaggerPlus{} public class enableDocSwaggerPlus {
}
} }

View File

@@ -2,10 +2,10 @@ package com.zyplayer.doc.manage.framework.config.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.zyplayer.doc.dubbo.framework.service.MgDubboStorage;
import com.zyplayer.doc.dubbo.framework.service.MgDubboStorageService;
import com.zyplayer.doc.data.repository.manage.entity.ZyplayerStorage; import com.zyplayer.doc.data.repository.manage.entity.ZyplayerStorage;
import com.zyplayer.doc.data.service.manage.ZyplayerStorageService; import com.zyplayer.doc.data.service.manage.ZyplayerStorageService;
import com.zyplayer.doc.dubbo.framework.service.MgDubboStorage;
import com.zyplayer.doc.dubbo.framework.service.MgDubboStorageService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -16,6 +16,7 @@ import java.util.stream.Collectors;
/** /**
* dubbo相关的文档存储服务 * dubbo相关的文档存储服务
*
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2018年8月19日 * @since 2018年8月19日
*/ */

View File

@@ -1,99 +0,0 @@
//package com.zyplayer.doc.manage.framework.config.impl;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
//import com.zyplayer.doc.data.repository.manage.entity.ZyplayerStorage;
//import com.zyplayer.doc.data.service.manage.ZyplayerStorageService;
//import com.zyplayer.doc.swagger.framework.service.MgStorage;
//import com.zyplayer.doc.swagger.framework.service.MgStorageService;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//import java.util.Arrays;
//import java.util.Collections;
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * 申明为@Service之后网页上才能使用存储能力同时需要在@EnableSwagger2的地方添加@EnableSwaggerMgUi注解
// * 才能开启存储的接口<br/>
// * 开放存储能力的好处:<br/>
// * 所有网页的配置、调试值都可以存储到服务器的数据库中,便于团队所有人的调试,一人配置,所有人受益<br/>
// * 如果不开启的话数据是存放在浏览器的localStorage中每个人、每个浏览器都得配置一次才能使用<br/>
// *
// * @author 暮光:城中城
// * @since 2018年8月19日
// */
//@Service
//public class MgStorageServiceImpl implements MgStorageService {
//
// @Value("${zyplayer.doc.swagger.proxy-request.white-domain}")
// private String proxyRequestWhiteDomain;
// @Resource
// ZyplayerStorageService zyplayerStorageService;
//
// /**
// * 使用数据库来存储,例: storageMapper.select(key);
// */
// @Override
// public String get(String key) {
// QueryWrapper<ZyplayerStorage> wrapper = new QueryWrapper<>();
// wrapper.eq("doc_key", key);
// ZyplayerStorage zyplayerStorage = zyplayerStorageService.getOne(wrapper);
// if (zyplayerStorage == null) {
// return null;
// }
// return zyplayerStorage.getDocValue();
// }
//
// @Override
// public List<MgStorage> like(String key, String value) {
// QueryWrapper<ZyplayerStorage> wrapper = new QueryWrapper<>();
// wrapper.like(StringUtils.isNotBlank(key), "doc_key", key);
// wrapper.like(StringUtils.isNotBlank(value), "doc_value", value);
// List<ZyplayerStorage> storageList = zyplayerStorageService.list(wrapper);
// if (storageList == null || storageList.isEmpty()) {
// return Collections.emptyList();
// }
// return storageList.stream().map(val -> new MgStorage(val.getDocKey(), val.getDocValue())).collect(Collectors.toList());
// }
//
// /**
// * 使用数据库来存储,例: storageMapper.updateOrInsert(key, value);
// */
// @Override
// public void put(String key, String value) {
// ZyplayerStorage entity = new ZyplayerStorage();
// entity.setDocValue(value);
// UpdateWrapper<ZyplayerStorage> updateWrapper = new UpdateWrapper<>();
// updateWrapper.eq("doc_key", key);
// boolean update = zyplayerStorageService.update(entity, updateWrapper);
// if (!update) {
// entity = new ZyplayerStorage();
// entity.setDocValue(value);
// entity.setDocKey(key);
// zyplayerStorageService.save(entity);
// }
// }
//
// /**
// * 删除一个key
// */
// @Override
// public void remove(String key) {
// UpdateWrapper<ZyplayerStorage> queryWrapper = new UpdateWrapper<>();
// queryWrapper.eq("doc_key", key);
// zyplayerStorageService.remove(queryWrapper);
// }
//
// @Override
// public List<String> getProxyRequestWhiteDomain() {
// if (StringUtils.isBlank(proxyRequestWhiteDomain)) {
// return Collections.emptyList();
// }
// return Arrays.asList(proxyRequestWhiteDomain.split(";"));
// }
//
//}

View File

@@ -1,6 +1,5 @@
package com.zyplayer.doc.manage.framework.exception; package com.zyplayer.doc.manage.framework.exception;
import com.alibaba.fastjson.JSON;
import com.zyplayer.doc.core.exception.ConfirmException; import com.zyplayer.doc.core.exception.ConfirmException;
import com.zyplayer.doc.core.json.DocResponseJson; import com.zyplayer.doc.core.json.DocResponseJson;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -17,6 +16,9 @@ import javax.servlet.http.HttpServletResponse;
/** /**
* 全局异常处理器 * 全局异常处理器
*
* @author 暮光:城中城
* @since 2018年12月8日
*/ */
@Component @Component
public class GlobalHandlerExceptionResolver extends SimpleMappingExceptionResolver { public class GlobalHandlerExceptionResolver extends SimpleMappingExceptionResolver {
@@ -41,12 +43,7 @@ public class GlobalHandlerExceptionResolver extends SimpleMappingExceptionResolv
responseJson = DocResponseJson.warn("系统错误"); responseJson = DocResponseJson.warn("系统错误");
} }
} }
try { responseJson.send(response);
String jsonStr = JSON.toJSONString(responseJson);
response.getWriter().write(jsonStr);
} catch (Exception e) {
logger.warn("write error" + e.getMessage());
}
return new ModelAndView(); return new ModelAndView();
} }
} }

Some files were not shown because too many files have changed in this diff Show More