注释完善
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package com.zyplayer.doc.core.bean.swagger;
|
|
||||||
|
|
||||||
public class Contact {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package com.zyplayer.doc.core.bean.swagger;
|
|
||||||
|
|
||||||
public class Paths {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -2,29 +2,32 @@ package com.zyplayer.doc.core.exception;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 前端提示异常
|
* 前端提示异常
|
||||||
|
*
|
||||||
|
* @author 暮光:城中城
|
||||||
|
* @since 2018年12月8日
|
||||||
*/
|
*/
|
||||||
public class ConfirmException extends RuntimeException {
|
public class ConfirmException extends RuntimeException {
|
||||||
|
|
||||||
private static final long serialVersionUID = -7084066605197111614L;
|
private static final long serialVersionUID = -7084066605197111614L;
|
||||||
|
|
||||||
public ConfirmException() {
|
public ConfirmException() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfirmException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
public ConfirmException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||||
super(message, cause, enableSuppression, writableStackTrace);
|
super(message, cause, enableSuppression, writableStackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfirmException(String message, Throwable cause) {
|
public ConfirmException(String message, Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfirmException(String message) {
|
public ConfirmException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfirmException(Throwable cause) {
|
public ConfirmException(Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zyplayer.doc.data.repository.manage.param;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 表关系请求参数
|
* 表关系请求参数
|
||||||
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
* @since 2021-06-07
|
* @since 2021-06-07
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 表关系结构
|
* 表关系结构
|
||||||
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
* @since 2021-06-07
|
* @since 2021-06-07
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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_";
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
@@ -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文档附件删除
|
||||||
|
|||||||
@@ -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";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -20,15 +20,21 @@ 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}),
|
@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 {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(SqlLogInterceptor.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(SqlLogInterceptor.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object intercept(Invocation invocation) throws Throwable {
|
public Object intercept(Invocation invocation) throws Throwable {
|
||||||
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
|
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
|
||||||
@@ -44,7 +50,7 @@ public class SqlLogInterceptor implements Interceptor {
|
|||||||
// 执行结果
|
// 执行结果
|
||||||
return invocation.proceed();
|
return invocation.proceed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object plugin(Object target) {
|
public Object plugin(Object target) {
|
||||||
if (target instanceof Executor) {
|
if (target instanceof Executor) {
|
||||||
@@ -53,11 +59,11 @@ public class SqlLogInterceptor implements Interceptor {
|
|||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProperties(Properties properties) {
|
public void setProperties(Properties properties) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getParameterValue(Object obj) {
|
private String getParameterValue(Object obj) {
|
||||||
String value = null;
|
String value = null;
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
@@ -75,7 +81,7 @@ public class SqlLogInterceptor implements Interceptor {
|
|||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSqlString(Configuration configuration, BoundSql boundSql) {
|
public String getSqlString(Configuration configuration, BoundSql boundSql) {
|
||||||
Object parameterObject = boundSql.getParameterObject();
|
Object parameterObject = boundSql.getParameterObject();
|
||||||
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
|
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
|
||||||
@@ -104,15 +110,16 @@ public class SqlLogInterceptor implements Interceptor {
|
|||||||
}
|
}
|
||||||
return sqlSb.toString();
|
return sqlSb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 替换?占位符
|
* 替换?占位符
|
||||||
* @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);
|
||||||
|
|||||||
@@ -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_";
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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<>());
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ public class DatabaseDocController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取数据源基本信息
|
* 获取数据源基本信息
|
||||||
|
*
|
||||||
* @param sourceId 数据源ID
|
* @param sourceId 数据源ID
|
||||||
* @return 基本信息
|
* @return 基本信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -37,12 +36,12 @@ import java.util.stream.Collectors;
|
|||||||
@AuthMan(DocAuthConst.DB_DATASOURCE_MANAGE)
|
@AuthMan(DocAuthConst.DB_DATASOURCE_MANAGE)
|
||||||
@RequestMapping("/zyplayer-doc-db/datasource")
|
@RequestMapping("/zyplayer-doc-db/datasource")
|
||||||
public class DbDatasourceController {
|
public class DbDatasourceController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
DatabaseRegistrationBean databaseRegistrationBean;
|
DatabaseRegistrationBean databaseRegistrationBean;
|
||||||
@Resource
|
@Resource
|
||||||
DbDatasourceService dbDatasourceService;
|
DbDatasourceService dbDatasourceService;
|
||||||
|
|
||||||
@PostMapping(value = "/list")
|
@PostMapping(value = "/list")
|
||||||
public ResponseJson list(Integer pageNum, Integer pageSize, String name, String groupName) {
|
public ResponseJson list(Integer pageNum, Integer pageSize, String name, String groupName) {
|
||||||
QueryWrapper<DbDatasource> wrapper = new QueryWrapper<>();
|
QueryWrapper<DbDatasource> wrapper = new QueryWrapper<>();
|
||||||
@@ -56,7 +55,7 @@ public class DbDatasourceController {
|
|||||||
}
|
}
|
||||||
return DocDbResponseJson.ok(page);
|
return DocDbResponseJson.ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/groups")
|
@PostMapping(value = "/groups")
|
||||||
public ResponseJson groups() {
|
public ResponseJson groups() {
|
||||||
QueryWrapper<DbDatasource> wrapper = new QueryWrapper<>();
|
QueryWrapper<DbDatasource> wrapper = new QueryWrapper<>();
|
||||||
@@ -93,7 +92,7 @@ public class DbDatasourceController {
|
|||||||
}
|
}
|
||||||
return DocDbResponseJson.ok();
|
return DocDbResponseJson.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/update")
|
@PostMapping(value = "/update")
|
||||||
public ResponseJson update(DbDatasource dbDatasource) {
|
public ResponseJson update(DbDatasource dbDatasource) {
|
||||||
if (StringUtils.isBlank(dbDatasource.getName())) {
|
if (StringUtils.isBlank(dbDatasource.getName())) {
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ public class DbProcedureController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建日志对象
|
* 创建日志对象
|
||||||
|
*
|
||||||
* @param sourceId
|
* @param sourceId
|
||||||
* @param dbName
|
* @param dbName
|
||||||
* @param typeName
|
* @param typeName
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.zyplayer.doc.db.controller.download;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载类型枚举
|
* 下载类型枚举
|
||||||
|
* @author 暮光:城中城
|
||||||
|
* @since 2021-08-14
|
||||||
*/
|
*/
|
||||||
public class FormatDownloadConst {
|
public class FormatDownloadConst {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
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;
|
||||||
|
|
||||||
private List<TableInfoVo> tableList;
|
private List<TableInfoVo> tableList;
|
||||||
|
|
||||||
public DatabaseExportVo(Map<String, List<TableColumnDescDto>> columnList, List<TableInfoVo> tableList) {
|
public DatabaseExportVo(Map<String, List<TableColumnDescDto>> columnList, List<TableInfoVo> tableList) {
|
||||||
@@ -20,17 +26,17 @@ public class DatabaseExportVo {
|
|||||||
public Map<String, List<TableColumnDescDto>> getColumnList() {
|
public Map<String, List<TableColumnDescDto>> getColumnList() {
|
||||||
return columnList;
|
return columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColumnList(Map<String, List<TableColumnDescDto>> columnList) {
|
public void setColumnList(Map<String, List<TableColumnDescDto>> columnList) {
|
||||||
this.columnList = columnList;
|
this.columnList = columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TableInfoVo> getTableList() {
|
public List<TableInfoVo> getTableList() {
|
||||||
return tableList;
|
return tableList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTableList(List<TableInfoVo> tableList) {
|
public void setTableList(List<TableInfoVo> tableList) {
|
||||||
this.tableList = tableList;
|
this.tableList = tableList;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
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;
|
||||||
|
|
||||||
private TableInfoVo tableInfo;
|
private TableInfoVo tableInfo;
|
||||||
|
|
||||||
public static class TableInfoVo {
|
public static class TableInfoVo {
|
||||||
|
|
||||||
@ColumnWidth(20)
|
@ColumnWidth(20)
|
||||||
@@ -21,38 +27,38 @@ public class TableColumnVo {
|
|||||||
@ColumnWidth(80)
|
@ColumnWidth(80)
|
||||||
@ExcelProperty("表注释")
|
@ExcelProperty("表注释")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return tableName;
|
return tableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTableName(String tableName) {
|
public void setTableName(String tableName) {
|
||||||
this.tableName = tableName;
|
this.tableName = tableName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TableColumnDescDto> getColumnList() {
|
public List<TableColumnDescDto> getColumnList() {
|
||||||
return columnList;
|
return columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColumnList(List<TableColumnDescDto> columnList) {
|
public void setColumnList(List<TableColumnDescDto> columnList) {
|
||||||
this.columnList = columnList;
|
this.columnList = columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TableInfoVo getTableInfo() {
|
public TableInfoVo getTableInfo() {
|
||||||
return tableInfo;
|
return tableInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTableInfo(TableInfoVo tableInfo) {
|
public void setTableInfo(TableInfoVo tableInfo) {
|
||||||
this.tableInfo = tableInfo;
|
this.tableInfo = tableInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -2,21 +2,27 @@ 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;
|
||||||
private Long version;
|
private Long version;
|
||||||
private String rowFormat;
|
private String rowFormat;
|
||||||
private Long rows;
|
private Long rows;
|
||||||
private Long avgRowLength;
|
private Long avgRowLength;
|
||||||
private Long dataLength;
|
private Long dataLength;
|
||||||
private Long maxDataLength;
|
private Long maxDataLength;
|
||||||
private Long indexLength;
|
private Long indexLength;
|
||||||
private Long dataFree;
|
private Long dataFree;
|
||||||
private Long autoIncrement;
|
private Long autoIncrement;
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
private Date checkTime;
|
private Date checkTime;
|
||||||
private String collation;
|
private String collation;
|
||||||
private String checksum;
|
private String checksum;
|
||||||
private String createOptions;
|
private String createOptions;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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> {
|
||||||
|
|
||||||
|
|||||||
@@ -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解析
|
||||||
|
|||||||
@@ -5,12 +5,18 @@ 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
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan(basePackages = {
|
@ComponentScan(basePackages = {
|
||||||
"com.zyplayer.doc.db",
|
"com.zyplayer.doc.db",
|
||||||
})
|
})
|
||||||
public @interface EnableDocDb {
|
public @interface EnableDocDb {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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_"),
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
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;
|
||||||
|
|
||||||
public String getDbName() {
|
public String getDbName() {
|
||||||
return dbName;
|
return dbName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDbName(String dbName) {
|
public void setDbName(String dbName) {
|
||||||
this.dbName = dbName;
|
this.dbName = dbName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -1,30 +1,36 @@
|
|||||||
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;
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return tableName;
|
return tableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTableName(String tableName) {
|
public void setTableName(String tableName) {
|
||||||
this.tableName = tableName;
|
this.tableName = tableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getColumnName() {
|
public String getColumnName() {
|
||||||
return columnName;
|
return columnName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColumnName(String columnName) {
|
public void setColumnName(String columnName) {
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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("表名")
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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"),
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -2,13 +2,19 @@ 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 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行时间处理
|
* 执行时间处理
|
||||||
*
|
*
|
||||||
* @param dateTime 时间
|
* @param dateTime 时间
|
||||||
* @param paramOne 第一个参数
|
* @param paramOne 第一个参数
|
||||||
* @param paramThree 第三个参数
|
* @param paramThree 第三个参数
|
||||||
* @return 时间格式化
|
* @return 时间格式化
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
/**
|
/**
|
||||||
* 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.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.zyplayer.doc.db.framework.db.parser;
|
package com.zyplayer.doc.db.framework.db.parser;
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -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 下载服务
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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日
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -37,4 +43,4 @@ public class NacosServiceListVo {
|
|||||||
public void setHealthyInstanceCount(int healthyInstanceCount) {
|
public void setHealthyInstanceCount(int healthyInstanceCount) {
|
||||||
this.healthyInstanceCount = healthyInstanceCount;
|
this.healthyInstanceCount = healthyInstanceCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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日
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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日
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -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日
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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>() {{
|
||||||
|
|||||||
@@ -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文件名*/
|
||||||
|
|||||||
@@ -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日
|
||||||
|
|||||||
@@ -4,15 +4,16 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型
|
* 数据类型
|
||||||
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
* @since 2018-11-27
|
* @since 2018-11-27
|
||||||
*/
|
*/
|
||||||
public class MgDubboStorage implements Serializable {
|
public class MgDubboStorage implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
public MgDubboStorage() {
|
public MgDubboStorage() {
|
||||||
@@ -23,25 +24,25 @@ public class MgDubboStorage implements Serializable {
|
|||||||
this.key = key;
|
this.key = key;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKey(String key) {
|
public void setKey(String key) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getSerialversionuid() {
|
public static long getSerialversionuid() {
|
||||||
return serialVersionUID;
|
return serialVersionUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存储数据
|
* 存储数据
|
||||||
|
*
|
||||||
|
* @param key 参数
|
||||||
|
* @param value 值
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
* @since 2018年8月19日
|
* @since 2018年8月19日
|
||||||
* @param key 参数
|
|
||||||
* @param value 值
|
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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,31 +12,36 @@ 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 {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Mapper dozerBeanMapper() {
|
public Mapper dozerBeanMapper() {
|
||||||
DozerBeanMapperBuilder builder = DozerBeanMapperBuilder.create()
|
DozerBeanMapperBuilder builder = DozerBeanMapperBuilder.create()
|
||||||
.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> {
|
||||||
private DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
private DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
public DateStringConvert(Class<Date> prototypeA, Class<String> prototypeB) {
|
public DateStringConvert(Class<Date> prototypeA, Class<String> prototypeB) {
|
||||||
super(prototypeA, prototypeB);
|
super(prototypeA, prototypeB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convertTo(Date source, String destination) {
|
public String convertTo(Date source, String destination) {
|
||||||
destination = dateFormat.format(source);
|
destination = dateFormat.format(source);
|
||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date convertFrom(String source, Date destination) {
|
public Date convertFrom(String source, Date destination) {
|
||||||
try {
|
try {
|
||||||
@@ -47,18 +52,18 @@ public class MapperConfig {
|
|||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class BigdecimalToStringConvert extends DozerConverter<BigDecimal, String> {
|
private class BigdecimalToStringConvert extends DozerConverter<BigDecimal, String> {
|
||||||
|
|
||||||
public BigdecimalToStringConvert(Class<BigDecimal> prototypeA, Class<String> prototypeB) {
|
public BigdecimalToStringConvert(Class<BigDecimal> prototypeA, Class<String> prototypeB) {
|
||||||
super(prototypeA, prototypeB);
|
super(prototypeA, prototypeB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convertTo(BigDecimal source, String destination) {
|
public String convertTo(BigDecimal source, String destination) {
|
||||||
return source.toString();
|
return source.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal convertFrom(String source, BigDecimal destination) {
|
public BigDecimal convertFrom(String source, BigDecimal destination) {
|
||||||
return BigDecimal.valueOf(Double.parseDouble(source));
|
return BigDecimal.valueOf(Double.parseDouble(source));
|
||||||
|
|||||||
@@ -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/*");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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日
|
||||||
*/
|
*/
|
||||||
@@ -23,7 +24,7 @@ import java.util.stream.Collectors;
|
|||||||
public class MgDubboStorageServiceImpl implements MgDubboStorageService {
|
public class MgDubboStorageServiceImpl implements MgDubboStorageService {
|
||||||
@Resource
|
@Resource
|
||||||
ZyplayerStorageService zyplayerStorageService;
|
ZyplayerStorageService zyplayerStorageService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用数据库来存储,例: storageMapper.select(key);
|
* 使用数据库来存储,例: storageMapper.select(key);
|
||||||
*/
|
*/
|
||||||
@@ -37,7 +38,7 @@ public class MgDubboStorageServiceImpl implements MgDubboStorageService {
|
|||||||
}
|
}
|
||||||
return zyplayerStorage.getDocValue();
|
return zyplayerStorage.getDocValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MgDubboStorage> like(String key, String value) {
|
public List<MgDubboStorage> like(String key, String value) {
|
||||||
QueryWrapper<ZyplayerStorage> wrapper = new QueryWrapper<>();
|
QueryWrapper<ZyplayerStorage> wrapper = new QueryWrapper<>();
|
||||||
@@ -49,7 +50,7 @@ public class MgDubboStorageServiceImpl implements MgDubboStorageService {
|
|||||||
}
|
}
|
||||||
return storageList.stream().map(val -> new MgDubboStorage(val.getDocKey(), val.getDocValue())).collect(Collectors.toList());
|
return storageList.stream().map(val -> new MgDubboStorage(val.getDocKey(), val.getDocValue())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用数据库来存储,例: storageMapper.updateOrInsert(key, value);
|
* 使用数据库来存储,例: storageMapper.updateOrInsert(key, value);
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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(";"));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
@@ -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
Reference in New Issue
Block a user