@@ -22,11 +22,16 @@ import java.util.Optional;
|
|||||||
* 程序启动器
|
* 程序启动器
|
||||||
*
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
|
* @author Sh1yu 2023年6月15日
|
||||||
* @since 2018-11-27
|
* @since 2018-11-27
|
||||||
*/
|
*/
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@ComponentScan(basePackages = {"com.zyplayer.doc"})
|
@ComponentScan(basePackages = {
|
||||||
|
"com.zyplayer.doc.manage",
|
||||||
|
"com.zyplayer.doc.data",
|
||||||
|
"com.zyplayer.doc.core"
|
||||||
|
})
|
||||||
public class Application extends SpringBootServletInitializer {
|
public class Application extends SpringBootServletInitializer {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(Application.class);
|
private static Logger logger = LoggerFactory.getLogger(Application.class);
|
||||||
@@ -38,19 +43,6 @@ public class Application extends SpringBootServletInitializer {
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
ConfigurableApplicationContext application = SpringApplication.run(Application.class, args);
|
ConfigurableApplicationContext application = SpringApplication.run(Application.class, args);
|
||||||
Environment env = application.getEnvironment();
|
|
||||||
String contextPath = env.getProperty("server.servlet.context-path");
|
|
||||||
contextPath = Optional.ofNullable(contextPath).orElse("").replaceFirst("/", "");
|
|
||||||
contextPath = (contextPath.length() <= 0 || contextPath.endsWith("/")) ? contextPath : contextPath + "/";
|
|
||||||
String hostAddress = InetAddress.getLocalHost().getHostAddress();
|
|
||||||
String serverPort = env.getProperty("server.port");
|
|
||||||
String urlCtx = hostAddress + ":" + serverPort + "/" + contextPath;
|
|
||||||
logger.info("\n----------------------------------------------------------\n\t" +
|
|
||||||
"\tzyplayer-doc启动完成,当前版本:{}\n" +
|
|
||||||
"\t访问地址:http://{}\n" +
|
|
||||||
"----------------------------------------------------------",
|
|
||||||
ZyplayerDocVersion.version, urlCtx
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.zyplayer.doc.manage.framework.config;
|
|||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||||
|
import com.zyplayer.doc.manage.framework.interceptor.MoudleMissingInterceptor;
|
||||||
import com.zyplayer.doc.manage.framework.interceptor.UserLoginInterceptor;
|
import com.zyplayer.doc.manage.framework.interceptor.UserLoginInterceptor;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -24,6 +25,7 @@ import java.util.List;
|
|||||||
* WEB控制相关配置
|
* WEB控制相关配置
|
||||||
*
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
|
* @author Sh1yu 2023年6月15日
|
||||||
* @since 2018年11月27日
|
* @since 2018年11月27日
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@@ -32,6 +34,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
UserLoginInterceptor userLoginInterceptor;
|
UserLoginInterceptor userLoginInterceptor;
|
||||||
|
@Resource
|
||||||
|
MoudleMissingInterceptor moudleMissingInterceptor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addFormatters(FormatterRegistry registry) {
|
public void addFormatters(FormatterRegistry registry) {
|
||||||
@@ -65,6 +69,9 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||||||
registry.addInterceptor(userLoginInterceptor)
|
registry.addInterceptor(userLoginInterceptor)
|
||||||
.excludePathPatterns("/", "/doc-wiki", "/doc-db", "/doc-swagger-plus")
|
.excludePathPatterns("/", "/doc-wiki", "/doc-db", "/doc-swagger-plus")
|
||||||
.excludePathPatterns("/**/*.js", "/**/*.css", "/**/*.png", "/**/*.gif", "/**/*.jpg", "/**/*.jpeg", "/**/fonts/*");
|
.excludePathPatterns("/**/*.js", "/**/*.css", "/**/*.png", "/**/*.gif", "/**/*.jpg", "/**/*.jpeg", "/**/fonts/*");
|
||||||
|
registry.addInterceptor(moudleMissingInterceptor)
|
||||||
|
.excludePathPatterns("/", "/doc-wiki", "/doc-db", "/doc-swagger-plus")
|
||||||
|
.excludePathPatterns("/**/*.js", "/**/*.css", "/**/*.png", "/**/*.gif", "/**/*.jpg", "/**/*.jpeg", "/**/fonts/*");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,26 +3,40 @@ package com.zyplayer.doc.manage.framework.config;
|
|||||||
import com.zyplayer.doc.api.framework.config.EnableDocApi;
|
import com.zyplayer.doc.api.framework.config.EnableDocApi;
|
||||||
import com.zyplayer.doc.db.framework.configuration.EnableDocDb;
|
import com.zyplayer.doc.db.framework.configuration.EnableDocDb;
|
||||||
import com.zyplayer.doc.wiki.framework.config.EnableDocWiki;
|
import com.zyplayer.doc.wiki.framework.config.EnableDocWiki;
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按需开启zyplayer-doc所有的服务
|
* 按需开启zyplayer-doc所有的服务
|
||||||
*
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
|
* @author Sh1yu 2023年6月15日
|
||||||
* @since 2019年3月31日
|
* @since 2019年3月31日
|
||||||
|
* 规范:添加模块的类,命名需要和前端接受模块开启状态的参数一致,即 enbaleXxxxx enable模块名
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ZyplayerDocConfig {
|
public class ZyplayerDocConfig {
|
||||||
|
@EnableDocWiki
|
||||||
|
//wiki模块加载注解条件化,配合配置文件决定是否加载
|
||||||
|
@ConditionalOnProperty(prefix = "zyplayer.doc.manage.enable", name = "wiki", matchIfMissing = true)
|
||||||
|
public class enableWiki {
|
||||||
|
}
|
||||||
|
|
||||||
@EnableDocWiki
|
@EnableDocDb
|
||||||
public class enableDocWiki {
|
//db模块加载注解条件化,配合配置文件决定是否加载
|
||||||
}
|
@ConditionalOnProperty(prefix = "zyplayer.doc.manage.enable", name = "db", matchIfMissing = true)
|
||||||
|
public class enableDb {
|
||||||
|
}
|
||||||
|
|
||||||
@EnableDocDb
|
@EnableDocApi
|
||||||
public class enableDocDb {
|
//api模块加载注解条件化,配合配置文件决定是否加载
|
||||||
}
|
@ConditionalOnProperty(prefix = "zyplayer.doc.manage.enable", name = "api", matchIfMissing = true)
|
||||||
|
public class enableApi {
|
||||||
@EnableDocApi
|
}
|
||||||
public class enableDocApi {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.zyplayer.doc.manage.framework.config;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按照类加载的情况获取模块的加载状态
|
||||||
|
*
|
||||||
|
* @author Sh1yu
|
||||||
|
* @since 2023年6月15日
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class ZyplayerMoudleKeeper implements ApplicationContextAware {
|
||||||
|
HashMap<String, Boolean> moudleInfo = new HashMap<>();
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取模块是否启动
|
||||||
|
public boolean isMoudleStarted(Class<?> clazz) {
|
||||||
|
if (moudleInfo.size() < 1) {
|
||||||
|
getMoudleInfo();
|
||||||
|
}
|
||||||
|
return moudleInfo.get(clazz.getName().split("\\$")[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//提供模块开启状态数组,给前端控制页面展示
|
||||||
|
public HashMap<String, Boolean> getMoudleInfo() {
|
||||||
|
if (moudleInfo.size() < 1) {
|
||||||
|
synchronized (ZyplayerMoudleKeeper.class) {
|
||||||
|
Class<? extends ZyplayerDocConfig> clazz = ZyplayerDocConfig.class;
|
||||||
|
Class<?>[] innerClasses = clazz.getClasses();
|
||||||
|
for (Class<?> innerClass : innerClasses) {
|
||||||
|
moudleInfo.put(innerClass.getName().split("\\$")[1], isMoudleConfigLoadUp(innerClass));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return moudleInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Boolean isMoudleConfigLoadUp(Class<?> innerClass) {
|
||||||
|
Object bean = null;
|
||||||
|
try {
|
||||||
|
bean = applicationContext.getBean(innerClass);
|
||||||
|
} catch (BeansException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return null != bean;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.zyplayer.doc.manage.framework.console;
|
||||||
|
|
||||||
|
import com.zyplayer.doc.core.util.ZyplayerDocVersion;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动后打印应用信息
|
||||||
|
*
|
||||||
|
* @author Sh1yu
|
||||||
|
* @since 2023年6月16日
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ApplicationInfoConsolePrint implements IConsolePrint {
|
||||||
|
@Resource
|
||||||
|
Environment environment;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildPrintInfo(StringBuffer printInfo) throws Exception {
|
||||||
|
String contextPath = environment.getProperty("server.servlet.context-path");
|
||||||
|
contextPath = Optional.ofNullable(contextPath).orElse("").replaceFirst("/", "");
|
||||||
|
contextPath = (contextPath.length() <= 0 || contextPath.endsWith("/")) ? contextPath : contextPath + "/";
|
||||||
|
String hostAddress = InetAddress.getLocalHost().getHostAddress();
|
||||||
|
String serverPort = environment.getProperty("server.port");
|
||||||
|
String urlCtx = hostAddress + ":" + serverPort + "/" + contextPath;
|
||||||
|
printInfo.append("\t zyplayer-doc启动完成,当前版本:")
|
||||||
|
.append(ZyplayerDocVersion.version)
|
||||||
|
.append("\n\t访问地址:http://")
|
||||||
|
.append(urlCtx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOrder() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.zyplayer.doc.manage.framework.console;
|
||||||
|
|
||||||
|
import org.springframework.core.Ordered;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动后打印信息接口
|
||||||
|
*
|
||||||
|
* @author Sh1yu
|
||||||
|
* @since 2023年6月16日
|
||||||
|
*/
|
||||||
|
public interface IConsolePrint extends Ordered {
|
||||||
|
public void buildPrintInfo(StringBuffer printInfo) throws Exception;
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.zyplayer.doc.manage.framework.console;
|
||||||
|
|
||||||
|
import com.zyplayer.doc.manage.framework.config.ZyplayerMoudleKeeper;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动后打印模块信息
|
||||||
|
*
|
||||||
|
* @author Sh1yu
|
||||||
|
* @since 2023年6月16日
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class MoudleInfoConsolePrint implements IConsolePrint {
|
||||||
|
@Resource
|
||||||
|
ZyplayerMoudleKeeper moudleKeeper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildPrintInfo(StringBuffer printInfo) throws Exception {
|
||||||
|
printInfo.append("\n\n\t\t\t\t↓zyplayer-doc模块的启动情况\n")
|
||||||
|
.append("\t\t\t\t------------------------\n");
|
||||||
|
HashMap<String, Boolean> moudleInfos = moudleKeeper.getMoudleInfo();
|
||||||
|
for (Map.Entry<String, Boolean> moudleInfo : moudleInfos.entrySet()) {
|
||||||
|
printInfo.append(getPerfectPosString(moudleInfo.getKey()))
|
||||||
|
.append("模块启动情况为:")
|
||||||
|
.append(false == moudleInfo.getValue() ? "未启动\n" : "启动成功\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getPerfectPosString(String beforeString) {
|
||||||
|
final int pointLeft = 19;
|
||||||
|
String afterOptin = beforeString.replace("enable", "");
|
||||||
|
int length = afterOptin.length();
|
||||||
|
int rightOffset = pointLeft - length;
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
for (int i = 0; i < rightOffset; i++) {
|
||||||
|
stringBuffer.append(" ");
|
||||||
|
}
|
||||||
|
stringBuffer.append(afterOptin);
|
||||||
|
return stringBuffer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOrder() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.zyplayer.doc.manage.framework.console;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.ObjectProvider;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 程序启动后内容打印,新增打印内容只需要继承IConsolePrint
|
||||||
|
* @author 暮光:城中城
|
||||||
|
* @author Sh1yu
|
||||||
|
* @since 2023年6月15日
|
||||||
|
* @See IConsolePrint
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ZyplayerConsolePrint implements CommandLineRunner {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ZyplayerConsolePrint.class);
|
||||||
|
StringBuffer logInfoHolder = new StringBuffer();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ObjectProvider<List<IConsolePrint>> print;
|
||||||
|
|
||||||
|
public void run(String... args) throws Exception {
|
||||||
|
if (logger.isInfoEnabled()) {
|
||||||
|
List<IConsolePrint> prints = print.getIfAvailable();
|
||||||
|
if (prints.size() < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logInfoHolder.append("\n--------------------------------------------------------------\n\t");
|
||||||
|
List<IConsolePrint> collect = prints.stream().sorted((a, b) -> {
|
||||||
|
int aOrder = a.getOrder();
|
||||||
|
int bOrder = b.getOrder();
|
||||||
|
if (aOrder > bOrder) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (aOrder < bOrder) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
for (IConsolePrint consolePrint : collect) {
|
||||||
|
consolePrint.buildPrintInfo(logInfoHolder);
|
||||||
|
}
|
||||||
|
logInfoHolder.append("--------------------------------------------------------------\n\t");
|
||||||
|
logger.info(logInfoHolder.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.zyplayer.doc.manage.framework.interceptor;
|
||||||
|
|
||||||
|
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||||
|
import com.zyplayer.doc.manage.framework.config.ZyplayerDocConfig;
|
||||||
|
import com.zyplayer.doc.manage.framework.config.ZyplayerMoudleKeeper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块未开启时判定失败响应拦截器
|
||||||
|
*
|
||||||
|
* @author Sh1yu
|
||||||
|
* @since 2023年6月15日
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class MoudleMissingInterceptor implements HandlerInterceptor {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(MoudleMissingInterceptor.class);
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ZyplayerMoudleKeeper moudleKeeper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||||
|
String requestURI = request.getRequestURI();
|
||||||
|
String simpleMoudleUri = requestURI.replace("/zyplayer-doc/", "");
|
||||||
|
if (simpleMoudleUri.startsWith("zyplayer-doc-wiki") && !moudleKeeper.isMoudleStarted(ZyplayerDocConfig.enableWiki.class)) {
|
||||||
|
doFailResponse(response, "wiki模块未启动,无法提供相应功能");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (simpleMoudleUri.startsWith("zyplayer-doc-db") && !moudleKeeper.isMoudleStarted(ZyplayerDocConfig.enableDb.class)) {
|
||||||
|
doFailResponse(response, "db模块未启动,无法提供相应功能");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (simpleMoudleUri.startsWith("zyplayer-doc-api") && !moudleKeeper.isMoudleStarted(ZyplayerDocConfig.enableApi.class)) {
|
||||||
|
doFailResponse(response, "api模块未启动,无法提供相应功能");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doFailResponse(HttpServletResponse response, String msg) {
|
||||||
|
DocResponseJson.warn(msg).send(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.zyplayer.doc.manage.task;
|
package com.zyplayer.doc.manage.framework.upgrade;
|
||||||
|
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.zyplayer.doc.manage.task;
|
package com.zyplayer.doc.manage.framework.upgrade;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.zyplayer.doc.manage.task;
|
package com.zyplayer.doc.manage.framework.upgrade;
|
||||||
|
|
||||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||||
import com.alibaba.druid.sql.ast.statement.*;
|
import com.alibaba.druid.sql.ast.statement.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.zyplayer.doc.manage.task;
|
package com.zyplayer.doc.manage.framework.upgrade;
|
||||||
|
|
||||||
import com.zyplayer.doc.core.util.ZyplayerDocVersion;
|
import com.zyplayer.doc.core.util.ZyplayerDocVersion;
|
||||||
|
|
||||||
@@ -2,24 +2,38 @@ package com.zyplayer.doc.manage.web;
|
|||||||
|
|
||||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||||
import com.zyplayer.doc.core.json.ResponseJson;
|
import com.zyplayer.doc.core.json.ResponseJson;
|
||||||
import com.zyplayer.doc.manage.task.UpgradeUtil;
|
import com.zyplayer.doc.manage.framework.config.ZyplayerDocConfig;
|
||||||
|
import com.zyplayer.doc.manage.framework.config.ZyplayerMoudleKeeper;
|
||||||
|
import com.zyplayer.doc.manage.framework.upgrade.UpgradeUtil;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统信息控制器
|
* 系统信息控制器
|
||||||
*
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
|
* @author Sh1yu 2023年6月15日
|
||||||
* @since 2019-04-21
|
* @since 2019-04-21
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/info")
|
@RequestMapping("/system/info")
|
||||||
public class SystemInfoController {
|
public class SystemInfoController {
|
||||||
|
|
||||||
@PostMapping("/upgrade")
|
@Resource
|
||||||
public ResponseJson<Object> upgradeInfo() {
|
ZyplayerMoudleKeeper moudleKeeper;
|
||||||
return DocResponseJson.ok(UpgradeUtil.upgradeInfo);
|
|
||||||
}
|
@PostMapping("/upgrade")
|
||||||
|
public ResponseJson<Object> upgradeInfo() {
|
||||||
|
return DocResponseJson.ok(UpgradeUtil.upgradeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/moudle")
|
||||||
|
public ResponseJson<Object> moudleInfo() {
|
||||||
|
return DocResponseJson.ok(moudleKeeper.getMoudleInfo());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ zyplayer:
|
|||||||
doc:
|
doc:
|
||||||
# ------zyplayer_doc_manage相关配置------
|
# ------zyplayer_doc_manage相关配置------
|
||||||
manage:
|
manage:
|
||||||
|
enable:
|
||||||
|
#wiki模块的是否加载,没有此配置也为true,只有填写false才是不加载
|
||||||
|
wiki: true
|
||||||
|
#db模块的是否加载,没有此配置也为true,只有填写false才是不加载
|
||||||
|
db: true
|
||||||
|
#api模块的是否加载,没有此配置也为true,只有填写false才是不加载
|
||||||
|
api: true
|
||||||
# 版本和升级信息获取地址
|
# 版本和升级信息获取地址
|
||||||
upgradePropertiesUrl: https://gitee.com/zyplayer/zyplayer-doc/raw/master/upgrade.properties
|
upgradePropertiesUrl: https://gitee.com/zyplayer/zyplayer-doc/raw/master/upgrade.properties
|
||||||
# 系统根域名,调试UI时需要使用,同时需要在host文件里配置:127.0.0.1 local.zyplayer.com
|
# 系统根域名,调试UI时需要使用,同时需要在host文件里配置:127.0.0.1 local.zyplayer.com
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon-console.png><title>文档管理系统</title><link href=css/chunk-vendors.8924efc6.css rel=preload as=style><link href=css/index.d05463e0.css rel=preload as=style><link href=js/chunk-vendors.cdec70f7.js rel=preload as=script><link href=js/index.38f10493.js rel=preload as=script><link href=css/chunk-vendors.8924efc6.css rel=stylesheet><link href=css/index.d05463e0.css rel=stylesheet></head><body><noscript><strong>We're sorry but zyplayer-console-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.cdec70f7.js></script><script src=js/index.38f10493.js></script></body></html>
|
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon-console.png><title>文档管理系统</title><link href=css/chunk-vendors.8924efc6.css rel=preload as=style><link href=css/index.d05463e0.css rel=preload as=style><link href=js/chunk-vendors.cdec70f7.js rel=preload as=script><link href=js/index.8c8d6867.js rel=preload as=script><link href=css/chunk-vendors.8924efc6.css rel=stylesheet><link href=css/index.d05463e0.css rel=stylesheet></head><body><noscript><strong>We're sorry but zyplayer-console-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.cdec70f7.js></script><script src=js/index.8c8d6867.js></script></body></html>
|
||||||
File diff suppressed because one or more lines are too long
1
zyplayer-doc-manage/src/main/resources/dist/js/index.8c8d6867.js
vendored
Normal file
1
zyplayer-doc-manage/src/main/resources/dist/js/index.8c8d6867.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -5,4 +5,7 @@ export default {
|
|||||||
systemUpgradeInfo: data => {
|
systemUpgradeInfo: data => {
|
||||||
return request({url: '/system/info/upgrade', method: 'post', data: Qs.stringify(data)});
|
return request({url: '/system/info/upgrade', method: 'post', data: Qs.stringify(data)});
|
||||||
},
|
},
|
||||||
|
fetchMoudleData: data => {
|
||||||
|
return request({url: '/system/info/moudle', method: 'get', data: Qs.stringify(data)});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,15 +7,15 @@
|
|||||||
<span>所有产品</span>
|
<span>所有产品</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="product-list">
|
<div class="product-list">
|
||||||
<div class="item" v-on:click="jumpToDocPage('doc-api')">
|
<div class="item" v-on:click="jumpToDocPage('doc-api')" v-if="this.moudleInfo.enableApi">
|
||||||
<div class="logo-text text1">API</div>
|
<div class="logo-text text1">API</div>
|
||||||
<div>API接口文档</div>
|
<div>API接口文档</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item" v-on:click="jumpToDocPage('doc-db')">
|
<div class="item" v-on:click="jumpToDocPage('doc-db')" v-if="this.moudleInfo.enableDb">
|
||||||
<div class="logo-text text2">DB</div>
|
<div class="logo-text text2">DB</div>
|
||||||
<div>数据库文档</div>
|
<div>数据库文档</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item" v-on:click="jumpToDocPage('doc-wiki')">
|
<div class="item" v-on:click="jumpToDocPage('doc-wiki')" v-if="this.moudleInfo.enableWiki">
|
||||||
<div class="logo-text text3">WIKI</div>
|
<div class="logo-text text3">WIKI</div>
|
||||||
<div>WIKI文档</div>
|
<div>WIKI文档</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -27,14 +27,35 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import systemApi from "../../common/api/system";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
moudleInfo:{
|
||||||
|
enableWiki:true,
|
||||||
|
enableDb:true,
|
||||||
|
enableApi:true,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
},
|
},
|
||||||
|
created(){
|
||||||
|
this.fetchMoudle()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
fetchMoudle(){
|
||||||
|
systemApi.fetchMoudleData().then(json => {
|
||||||
|
if(!!json.data){
|
||||||
|
this.moudleInfo = json.data;
|
||||||
|
console.log(
|
||||||
|
"wiki模块启动状态" +this.moudleInfo.enableWiki+
|
||||||
|
"db模块启动状态" +this.moudleInfo.enableDb+
|
||||||
|
"api模块启动状态" +this.moudleInfo.enableApi
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
jumpToDocPage(val) {
|
jumpToDocPage(val) {
|
||||||
window.open(val);
|
window.open(val);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user