注释完善
This commit is contained in:
@@ -4,7 +4,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -17,6 +16,9 @@ import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 程序启动器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-11-27
|
||||
*/
|
||||
@EnableScheduling
|
||||
@SpringBootApplication
|
||||
@@ -39,11 +41,13 @@ public class Application extends SpringBootServletInitializer {
|
||||
String hostAddress = InetAddress.getLocalHost().getHostAddress();
|
||||
String serverPort = env.getProperty("server.port");
|
||||
String urlCtx = hostAddress + ":" + serverPort + "/" + contextPath;
|
||||
String localCtx = "local.zyplayer.com:" + serverPort + "/" + contextPath;
|
||||
logger.info("\n----------------------------------------------------------\n\t" +
|
||||
"\t\t地址列表\n\t" +
|
||||
"管理地址:http://{}\n" +
|
||||
"\t\t地址列表\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;
|
||||
|
||||
import com.github.dozermapper.core.Mapper;
|
||||
import com.github.dozermapper.core.DozerBeanMapperBuilder;
|
||||
import com.github.dozermapper.core.DozerConverter;
|
||||
import com.github.dozermapper.core.Mapper;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -12,31 +12,36 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* mapper配置类
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年12月15日
|
||||
*/
|
||||
@Configuration
|
||||
public class MapperConfig {
|
||||
|
||||
|
||||
@Bean
|
||||
public Mapper dozerBeanMapper() {
|
||||
DozerBeanMapperBuilder builder = DozerBeanMapperBuilder.create()
|
||||
.withCustomConverter(new DateStringConvert(Date.class, String.class))
|
||||
.withCustomConverter(new BigdecimalToStringConvert(BigDecimal.class, String.class));
|
||||
return builder.build();
|
||||
// return DozerBeanMapperBuilder.buildDefault();
|
||||
}
|
||||
|
||||
|
||||
private class DateStringConvert extends DozerConverter<Date, String> {
|
||||
private DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
|
||||
public DateStringConvert(Class<Date> prototypeA, Class<String> prototypeB) {
|
||||
super(prototypeA, prototypeB);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String convertTo(Date source, String destination) {
|
||||
destination = dateFormat.format(source);
|
||||
return destination;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Date convertFrom(String source, Date destination) {
|
||||
try {
|
||||
@@ -47,18 +52,18 @@ public class MapperConfig {
|
||||
return destination;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class BigdecimalToStringConvert extends DozerConverter<BigDecimal, String> {
|
||||
|
||||
|
||||
public BigdecimalToStringConvert(Class<BigDecimal> prototypeA, Class<String> prototypeB) {
|
||||
super(prototypeA, prototypeB);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String convertTo(BigDecimal source, String destination) {
|
||||
return source.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BigDecimal convertFrom(String source, BigDecimal destination) {
|
||||
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 javax.annotation.Resource;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* WEB控制相关配置
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年11月27日
|
||||
*/
|
||||
@Component
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
@@ -57,7 +62,9 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
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 {
|
||||
|
||||
@EnableDocWiki
|
||||
public class enableDocWiki{}
|
||||
public class enableDocWiki {
|
||||
}
|
||||
|
||||
@EnableDocDubbo
|
||||
public class enableDocDubbo{}
|
||||
public class enableDocDubbo {
|
||||
}
|
||||
|
||||
@EnableDocDb
|
||||
public class enableDocDb{}
|
||||
public class enableDocDb {
|
||||
}
|
||||
|
||||
@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.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.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.springframework.stereotype.Service;
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* dubbo相关的文档存储服务
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月19日
|
||||
*/
|
||||
@@ -23,7 +24,7 @@ import java.util.stream.Collectors;
|
||||
public class MgDubboStorageServiceImpl implements MgDubboStorageService {
|
||||
@Resource
|
||||
ZyplayerStorageService zyplayerStorageService;
|
||||
|
||||
|
||||
/**
|
||||
* 使用数据库来存储,例: storageMapper.select(key);
|
||||
*/
|
||||
@@ -37,7 +38,7 @@ public class MgDubboStorageServiceImpl implements MgDubboStorageService {
|
||||
}
|
||||
return zyplayerStorage.getDocValue();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<MgDubboStorage> like(String key, String value) {
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 使用数据库来存储,例: 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;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zyplayer.doc.core.exception.ConfirmException;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import org.slf4j.Logger;
|
||||
@@ -17,6 +16,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 全局异常处理器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年12月8日
|
||||
*/
|
||||
@Component
|
||||
public class GlobalHandlerExceptionResolver extends SimpleMappingExceptionResolver {
|
||||
@@ -41,12 +43,7 @@ public class GlobalHandlerExceptionResolver extends SimpleMappingExceptionResolv
|
||||
responseJson = DocResponseJson.warn("系统错误");
|
||||
}
|
||||
}
|
||||
try {
|
||||
String jsonStr = JSON.toJSONString(responseJson);
|
||||
response.getWriter().write(jsonStr);
|
||||
} catch (Exception e) {
|
||||
logger.warn("write error:" + e.getMessage());
|
||||
}
|
||||
responseJson.send(response);
|
||||
return new ModelAndView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.zyplayer.doc.manage.framework.filter;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
@Configuration
|
||||
public class DocUserFilter implements Filter{
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletRequest httpRequest = (HttpServletRequest) request;
|
||||
Cookie[] cookies = httpRequest.getCookies();
|
||||
boolean haveCtx = false;
|
||||
Object ctxObj = httpRequest.getServletContext().getAttribute("ctx");
|
||||
String ctxStr = String.valueOf(ctxObj);
|
||||
if (cookies != null && cookies.length > 0) {
|
||||
for (Cookie cookie : cookies) {
|
||||
if ("ctx".equals(cookie.getName()) && ctxStr.equals(cookie.getValue())) {
|
||||
haveCtx = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!haveCtx) {
|
||||
// 前后端分离的,前段拿不到项目名,直接写/是不对的,只有后端放到cookie里给前端
|
||||
HttpServletResponse httpResponse = (HttpServletResponse) response;
|
||||
Cookie cookieAdd = new Cookie("ctx", ctxStr);
|
||||
cookieAdd.setPath("/");
|
||||
httpResponse.addCookie(cookieAdd);
|
||||
}
|
||||
chain.doFilter(httpRequest, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.zyplayer.doc.manage.framework.interceptor;
|
||||
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.HttpConst;
|
||||
import com.zyplayer.doc.core.util.ThreadLocalUtil;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import org.apache.catalina.util.RequestUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -25,6 +22,9 @@ import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 用户登录拦截
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年11月21日
|
||||
*/
|
||||
@Component
|
||||
public class UserLoginInterceptor implements HandlerInterceptor {
|
||||
@@ -42,7 +42,6 @@ public class UserLoginInterceptor implements HandlerInterceptor {
|
||||
long totalTime = System.currentTimeMillis() - startTime;
|
||||
String clientIP = ServletUtil.getClientIP(request);
|
||||
logger.info("IP:{},总耗时:{}ms,URI:{}", clientIP, totalTime, request.getRequestURI());
|
||||
ThreadLocalUtil.clean();
|
||||
startTimeThreadLocal.remove();
|
||||
// 清理用户信息
|
||||
DocUserUtil.clean();
|
||||
@@ -55,7 +54,6 @@ public class UserLoginInterceptor implements HandlerInterceptor {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||
startTimeThreadLocal.set(System.currentTimeMillis());
|
||||
ThreadLocalUtil.setHttpServletRequest(request);
|
||||
// 指定域名可跨域访问
|
||||
if (StringUtils.isNotBlank(originDomainRegex)) {
|
||||
String origin = request.getHeader("Origin");
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.zyplayer.doc.manage.task;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zyplayer.doc.core.util.ZyplayerDocVersion;
|
||||
import com.zyplayer.doc.manage.utils.UpgradeUtil;
|
||||
import com.zyplayer.doc.manage.utils.bean.UpgradeInfo;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -15,8 +15,15 @@ import java.io.StringReader;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* 定时器,用于访问gitee获取最新版本和升级内容
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019年4月27日
|
||||
*/
|
||||
@Component
|
||||
public class SchedulerTask {
|
||||
private static Logger logger = LoggerFactory.getLogger(SchedulerTask.class);
|
||||
|
||||
@Value("${zyplayer.doc.manage.upgradePropertiesUrl:}")
|
||||
private String upgradePropertiesUrl;
|
||||
@@ -45,7 +52,7 @@ public class SchedulerTask {
|
||||
UpgradeUtil.upgradeInfo = JSON.parseObject(jsonString, UpgradeInfo.class);
|
||||
UpgradeUtil.upgradeInfo.setNowVersion(ZyplayerDocVersion.version);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取升级内容失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.zyplayer.doc.manage.utils.bean;
|
||||
package com.zyplayer.doc.manage.task;
|
||||
|
||||
/**
|
||||
* 升级信息对象
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019年4月27日
|
||||
*/
|
||||
public class UpgradeInfo {
|
||||
private String nowVersion;
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.zyplayer.doc.manage.utils;
|
||||
package com.zyplayer.doc.manage.task;
|
||||
|
||||
import com.zyplayer.doc.core.util.ZyplayerDocVersion;
|
||||
import com.zyplayer.doc.manage.utils.bean.UpgradeInfo;
|
||||
|
||||
/**
|
||||
* 升级工具类
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019年4月27日
|
||||
*/
|
||||
public class UpgradeUtil {
|
||||
public static UpgradeInfo upgradeInfo = new UpgradeInfo();
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.zyplayer.doc.manage.utils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* 日志工具类
|
||||
*/
|
||||
public class LogHelper {
|
||||
// 通用日志,包括sql
|
||||
public static final Logger LOG_COMMON = LoggerFactory.getLogger("LOG_COMMON");
|
||||
// 错误的日志打印
|
||||
public static final Logger LOG_ERROR = LoggerFactory.getLogger("LOG_ERROR");
|
||||
}
|
||||
@@ -1,35 +1,41 @@
|
||||
package com.zyplayer.doc.manage.web.manage;
|
||||
package com.zyplayer.doc.manage.web;
|
||||
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.AuthInfo;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocAuthConst;
|
||||
import com.zyplayer.doc.data.service.manage.AuthInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户授权信息控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/auth/info")
|
||||
@AuthMan(DocAuthConst.AUTH_MANAGE)
|
||||
public class AuthInfoController {
|
||||
|
||||
@Autowired
|
||||
|
||||
@Resource
|
||||
AuthInfoService authInfoService;
|
||||
|
||||
|
||||
@PostMapping("/list")
|
||||
public ResponseJson<Object> list() {
|
||||
List<AuthInfo> authList = authInfoService.list();
|
||||
return DocResponseJson.ok(authList);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/delete")
|
||||
public ResponseJson<Object> delete(Long id) {
|
||||
AuthInfo authInfo = authInfoService.getById(id);
|
||||
@@ -39,7 +45,7 @@ public class AuthInfoController {
|
||||
authInfoService.removeById(id);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/update")
|
||||
public ResponseJson<Object> update(Long id, String authName, String authDesc) {
|
||||
AuthInfo authInfo = new AuthInfo();
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zyplayer.doc.manage.web.manage;
|
||||
package com.zyplayer.doc.manage.web;
|
||||
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -8,6 +8,9 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* 使用路劲的方式访问页面
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-06-05
|
||||
*/
|
||||
@Controller
|
||||
public class DocSystemController {
|
||||
@@ -49,12 +52,4 @@ public class DocSystemController {
|
||||
modelAndView.setStatus(HttpStatus.OK);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@AuthMan
|
||||
@GetMapping("/doc-es")
|
||||
public ModelAndView es() {
|
||||
ModelAndView modelAndView = new ModelAndView("/doc-es.html");
|
||||
modelAndView.setStatus(HttpStatus.OK);
|
||||
return modelAndView;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zyplayer.doc.manage.web.manage;
|
||||
package com.zyplayer.doc.manage.web;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
@@ -9,7 +8,7 @@ import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserInfo;
|
||||
import com.zyplayer.doc.data.service.manage.UserAuthService;
|
||||
import com.zyplayer.doc.data.service.manage.UserInfoService;
|
||||
import com.zyplayer.doc.manage.web.manage.param.LdapPerson;
|
||||
import com.zyplayer.doc.manage.web.param.LdapPerson;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -33,6 +32,9 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户登录控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-08
|
||||
*/
|
||||
@RestController
|
||||
public class LoginController {
|
||||
@@ -1,19 +1,25 @@
|
||||
package com.zyplayer.doc.manage.web.manage;
|
||||
package com.zyplayer.doc.manage.web;
|
||||
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.manage.utils.UpgradeUtil;
|
||||
import com.zyplayer.doc.manage.task.UpgradeUtil;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 系统信息控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-04-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/info")
|
||||
public class SystemInfoController {
|
||||
|
||||
|
||||
@PostMapping("/upgrade")
|
||||
public ResponseJson<Object> upgradeInfo() {
|
||||
return DocResponseJson.ok(UpgradeUtil.upgradeInfo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.zyplayer.doc.manage.web.manage;
|
||||
package com.zyplayer.doc.manage.web;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.AuthInfo;
|
||||
@@ -16,20 +16,27 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户权限控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/auth")
|
||||
@AuthMan(DocAuthConst.AUTH_ASSIGN)
|
||||
public class UserAuthController {
|
||||
|
||||
@Autowired
|
||||
|
||||
@Resource
|
||||
AuthInfoService authInfoService;
|
||||
@Autowired
|
||||
@Resource
|
||||
UserAuthService userAuthService;
|
||||
|
||||
|
||||
@PostMapping("/list")
|
||||
public ResponseJson<Object> list(Long userId) {
|
||||
QueryWrapper<UserAuth> userAuthWrapper = new QueryWrapper<>();
|
||||
@@ -43,13 +50,13 @@ public class UserAuthController {
|
||||
List<AuthInfo> authList = authInfoService.list(authQueryWrapper);
|
||||
return DocResponseJson.ok(authList);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/delete")
|
||||
public ResponseJson<Object> delete(Long id) {
|
||||
userAuthService.removeById(id);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/insert")
|
||||
public ResponseJson<Object> insert(Long id, Long userId, Long authId) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
@@ -66,5 +73,5 @@ public class UserAuthController {
|
||||
}
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zyplayer.doc.manage.web.manage;
|
||||
package com.zyplayer.doc.manage.web;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
@@ -22,10 +22,16 @@ import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户分组控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-02-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/group")
|
||||
public class UserGroupController {
|
||||
|
||||
|
||||
@Resource
|
||||
UserGroupService userGroupService;
|
||||
@Resource
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.zyplayer.doc.manage.web.manage;
|
||||
package com.zyplayer.doc.manage.web;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.dozermapper.core.Mapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
@@ -18,12 +19,11 @@ import com.zyplayer.doc.data.repository.support.consts.DocAuthConst;
|
||||
import com.zyplayer.doc.data.service.manage.AuthInfoService;
|
||||
import com.zyplayer.doc.data.service.manage.UserAuthService;
|
||||
import com.zyplayer.doc.data.service.manage.UserInfoService;
|
||||
import com.zyplayer.doc.manage.web.manage.param.UserListParam;
|
||||
import com.zyplayer.doc.manage.web.manage.vo.AuthInfoVo;
|
||||
import com.zyplayer.doc.manage.web.manage.vo.UserAuthVo;
|
||||
import com.zyplayer.doc.manage.web.manage.vo.UserInfoAuthVo;
|
||||
import com.zyplayer.doc.manage.web.param.UserListParam;
|
||||
import com.zyplayer.doc.manage.web.vo.AuthInfoVo;
|
||||
import com.zyplayer.doc.manage.web.vo.UserAuthVo;
|
||||
import com.zyplayer.doc.manage.web.vo.UserInfoAuthVo;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import com.github.dozermapper.core.Mapper;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -34,10 +34,16 @@ import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户信息控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/info")
|
||||
public class UserInfoController {
|
||||
|
||||
|
||||
@Resource
|
||||
UserInfoService userInfoService;
|
||||
@Resource
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zyplayer.doc.manage.web.manage;
|
||||
package com.zyplayer.doc.manage.web;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -1,118 +0,0 @@
|
||||
package com.zyplayer.doc.manage.web.manage.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-05
|
||||
*/
|
||||
public class AuthInfoVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否选中
|
||||
*/
|
||||
private Integer checked;
|
||||
|
||||
/**
|
||||
* 权限名
|
||||
*/
|
||||
private String authName;
|
||||
|
||||
/**
|
||||
* 权限说明
|
||||
*/
|
||||
private String authDesc;
|
||||
|
||||
/**
|
||||
* 是否可编辑 0=否 1=是
|
||||
*/
|
||||
private Integer canEdit;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUid;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date creationTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getAuthName() {
|
||||
return authName;
|
||||
}
|
||||
|
||||
public void setAuthName(String authName) {
|
||||
this.authName = authName;
|
||||
}
|
||||
public String getAuthDesc() {
|
||||
return authDesc;
|
||||
}
|
||||
|
||||
public void setAuthDesc(String authDesc) {
|
||||
this.authDesc = authDesc;
|
||||
}
|
||||
public Integer getCanEdit() {
|
||||
return canEdit;
|
||||
}
|
||||
|
||||
public void setCanEdit(Integer canEdit) {
|
||||
this.canEdit = canEdit;
|
||||
}
|
||||
public Long getCreateUid() {
|
||||
return createUid;
|
||||
}
|
||||
|
||||
public void setCreateUid(Long createUid) {
|
||||
this.createUid = createUid;
|
||||
}
|
||||
public Date getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AuthInfo{" +
|
||||
"id=" + id +
|
||||
", authName=" + authName +
|
||||
", authDesc=" + authDesc +
|
||||
", canEdit=" + canEdit +
|
||||
", createUid=" + createUid +
|
||||
", creationTime=" + creationTime +
|
||||
"}";
|
||||
}
|
||||
|
||||
public Integer getChecked() {
|
||||
return checked;
|
||||
}
|
||||
|
||||
public void setChecked(Integer checked) {
|
||||
this.checked = checked;
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package com.zyplayer.doc.manage.web.manage.param;
|
||||
|
||||
package com.zyplayer.doc.manage.web.param;
|
||||
|
||||
/**
|
||||
* 域账号用户信息
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年8月2日
|
||||
*/
|
||||
public class LdapPerson {
|
||||
|
||||
/**
|
||||
@@ -1,5 +1,11 @@
|
||||
package com.zyplayer.doc.manage.web.manage.param;
|
||||
package com.zyplayer.doc.manage.web.param;
|
||||
|
||||
/**
|
||||
* 域账号用户列表查询参数
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年8月2日
|
||||
*/
|
||||
public class UserListParam {
|
||||
private Integer type;
|
||||
private String keyword;
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.zyplayer.doc.manage.web.swagger;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.ZyplayerStorageMapper;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/zyplayer/storage")
|
||||
public class ZyplayerStorageController {
|
||||
|
||||
@Autowired
|
||||
ZyplayerStorageMapper zyplayerStorageMapper;
|
||||
|
||||
@RequestMapping("/mapper")
|
||||
public String mapper() {
|
||||
Integer selectTop = zyplayerStorageMapper.selectTop();
|
||||
return "selectTop:" + selectTop;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.zyplayer.doc.manage.web.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户授权信息
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-15
|
||||
*/
|
||||
public class AuthInfoVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否选中
|
||||
*/
|
||||
private Integer checked;
|
||||
|
||||
/**
|
||||
* 权限名
|
||||
*/
|
||||
private String authName;
|
||||
|
||||
/**
|
||||
* 权限说明
|
||||
*/
|
||||
private String authDesc;
|
||||
|
||||
/**
|
||||
* 是否可编辑 0=否 1=是
|
||||
*/
|
||||
private Integer canEdit;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUid;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date creationTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAuthName() {
|
||||
return authName;
|
||||
}
|
||||
|
||||
public void setAuthName(String authName) {
|
||||
this.authName = authName;
|
||||
}
|
||||
|
||||
public String getAuthDesc() {
|
||||
return authDesc;
|
||||
}
|
||||
|
||||
public void setAuthDesc(String authDesc) {
|
||||
this.authDesc = authDesc;
|
||||
}
|
||||
|
||||
public Integer getCanEdit() {
|
||||
return canEdit;
|
||||
}
|
||||
|
||||
public void setCanEdit(Integer canEdit) {
|
||||
this.canEdit = canEdit;
|
||||
}
|
||||
|
||||
public Long getCreateUid() {
|
||||
return createUid;
|
||||
}
|
||||
|
||||
public void setCreateUid(Long createUid) {
|
||||
this.createUid = createUid;
|
||||
}
|
||||
|
||||
public Date getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AuthInfo{" +
|
||||
"id=" + id +
|
||||
", authName=" + authName +
|
||||
", authDesc=" + authDesc +
|
||||
", canEdit=" + canEdit +
|
||||
", createUid=" + createUid +
|
||||
", creationTime=" + creationTime +
|
||||
"}";
|
||||
}
|
||||
|
||||
public Integer getChecked() {
|
||||
return checked;
|
||||
}
|
||||
|
||||
public void setChecked(Integer checked) {
|
||||
this.checked = checked;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
package com.zyplayer.doc.manage.web.manage.vo;
|
||||
package com.zyplayer.doc.manage.web.vo;
|
||||
|
||||
/**
|
||||
* 用户权限信息
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-15
|
||||
*/
|
||||
public class UserAuthVo {
|
||||
private boolean userManage;
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package com.zyplayer.doc.manage.web.manage.vo;
|
||||
package com.zyplayer.doc.manage.web.vo;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserInfo;
|
||||
|
||||
/**
|
||||
* 用户授权信息
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-05
|
||||
*/
|
||||
public class UserInfoAuthVo {
|
||||
private UserInfo userInfo;
|
||||
private UserAuthVo userAuth;
|
||||
Reference in New Issue
Block a user