对一大波idea提醒需要优化的地方进行处理
This commit is contained in:
@@ -36,7 +36,7 @@ import java.util.stream.Collectors;
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/doc/auth")
|
||||
public class ApiDocAuthController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiDocAuthController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(ApiDocAuthController.class);
|
||||
|
||||
@Resource
|
||||
UserAuthService userAuthService;
|
||||
@@ -93,7 +93,7 @@ public class ApiDocAuthController {
|
||||
if (CollectionUtils.isNotEmpty(userModuleAuthList)) {
|
||||
UserAuth userAuth = userModuleAuthList.remove(0);
|
||||
// 错误数据兼容移除
|
||||
if (userModuleAuthList.size() > 0) {
|
||||
if (!userModuleAuthList.isEmpty()) {
|
||||
List<Long> authIdList = userModuleAuthList.stream().map(UserAuth::getId).collect(Collectors.toList());
|
||||
userAuthService.removeByIds(authIdList);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.Objects;
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/doc")
|
||||
public class ApiDocumentController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiDocumentController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(ApiDocumentController.class);
|
||||
|
||||
@Resource
|
||||
ApiDocAuthJudgeService apiDocAuthJudgeService;
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.Optional;
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/global-param")
|
||||
public class ApiGlobalParamController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiGlobalParamController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(ApiGlobalParamController.class);
|
||||
|
||||
@Resource
|
||||
private ApiGlobalParamService apiGlobalParamService;
|
||||
|
||||
@@ -30,7 +30,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/proxy")
|
||||
public class ApiPoxyRequestController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiPoxyRequestController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(ApiPoxyRequestController.class);
|
||||
|
||||
@Resource
|
||||
ApiCustomNodeService apiCustomNodeService;
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/request-param")
|
||||
public class ApiRequestParamController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiRequestParamController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(ApiRequestParamController.class);
|
||||
|
||||
@Resource
|
||||
private ApiRequestParamService apiRequestParamService;
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.Objects;
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/share")
|
||||
public class ApiShareDocumentController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiShareDocumentController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(ApiShareDocumentController.class);
|
||||
|
||||
@Resource
|
||||
private ApiDocService swaggerDocService;
|
||||
|
||||
@@ -42,15 +42,15 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
@Service
|
||||
public class SwaggerHttpRequestService {
|
||||
private static Logger logger = LoggerFactory.getLogger(SwaggerHttpRequestService.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(SwaggerHttpRequestService.class);
|
||||
|
||||
@Resource
|
||||
private ApiGlobalParamService apiGlobalParamService;
|
||||
|
||||
private static final Map<String, Method> requestMethodMap = Stream.of(Method.values()).collect(Collectors.toMap(val -> val.name().toLowerCase(), val -> val));
|
||||
|
||||
List<String> domainHeaderKeys = Arrays.asList("referer", "origin");
|
||||
List<String> needRequestHeaderKeys = Arrays.asList("user-agent");
|
||||
final List<String> domainHeaderKeys = Arrays.asList("referer", "origin");
|
||||
final List<String> needRequestHeaderKeys = Collections.singletonList("user-agent");
|
||||
|
||||
/**
|
||||
* 请求真实的swagger文档内容
|
||||
@@ -72,13 +72,12 @@ public class SwaggerHttpRequestService {
|
||||
requestHeaders.put("host", SwaggerDocUtil.getDomainHost(docDomain));
|
||||
}
|
||||
// 执行请求
|
||||
String resultStr = HttpRequest.get(docUrl)
|
||||
return HttpRequest.get(docUrl)
|
||||
.form(globalFormParamMap)
|
||||
.addHeaders(requestHeaders)
|
||||
.header("Accept", "application/json, text/javascript, */*; q=0.01")
|
||||
.cookie(this.getHttpCookie(request, globalCookieParamMap, null))
|
||||
.timeout(10000).execute().body();
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,7 +175,7 @@ public class SwaggerHttpRequestService {
|
||||
multiResource.add(new BytesResource(file.getBytes(), file.getOriginalFilename()));
|
||||
}
|
||||
httpRequest.form(originKey, multiResource);
|
||||
} else if (fileList.size() > 0) {
|
||||
} else if (!fileList.isEmpty()) {
|
||||
MultipartFile multipartFile = fileList.get(0);
|
||||
httpRequest.form(originKey, multipartFile.getBytes(), multipartFile.getOriginalFilename());
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ public enum PageFileSource {
|
||||
PASTE_FILES(2, "页面粘贴的图片或文件"),
|
||||
;
|
||||
@Getter
|
||||
private Integer source;
|
||||
private final Integer source;
|
||||
@Getter
|
||||
private String desc;
|
||||
private final String desc;
|
||||
|
||||
PageFileSource(Integer source, String desc) {
|
||||
this.source = source;
|
||||
|
||||
@@ -15,8 +15,8 @@ public enum SystemConfigEnum {
|
||||
DOC_SYSTEM_VERSION("doc_system_version", "系统当前的版本号"),
|
||||
;
|
||||
|
||||
private String key;
|
||||
private String desc;
|
||||
private final String key;
|
||||
private final String desc;
|
||||
|
||||
SystemConfigEnum(String key, String desc) {
|
||||
this.key = key;
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.Objects;
|
||||
* @since 2018年8月21日
|
||||
*/
|
||||
public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
private static SerializeConfig mapping = new SerializeConfig();
|
||||
private static final SerializeConfig mapping = new SerializeConfig();
|
||||
|
||||
static {
|
||||
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
|
||||
@@ -134,7 +134,7 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
* @since 2018年8月7日
|
||||
*/
|
||||
public static <T> DocResponseJson<T> warn(String errMsg) {
|
||||
return new DocResponseJson<T>(300, errMsg);
|
||||
return new DocResponseJson<>(300, errMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,7 +145,7 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
* @since 2018年8月7日
|
||||
*/
|
||||
public static <T> DocResponseJson<T> error(String errMsg) {
|
||||
return new DocResponseJson<T>(500, errMsg);
|
||||
return new DocResponseJson<>(500, errMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,7 +156,7 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
* @since 2018年8月7日
|
||||
*/
|
||||
public static <T> DocResponseJson<T> failure(int errCode, String errMsg) {
|
||||
return new DocResponseJson<T>(errCode, errMsg);
|
||||
return new DocResponseJson<>(errCode, errMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.ResultType;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageTemplate;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.WikiPageTemplateInfoVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageTemplate;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.WikiPageTemplateInfoVo;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.WikiTemplateTagVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageZan;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.zyplayer.doc.data.repository.manage.vo;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 模板与文档信息的Vo
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.zyplayer.doc.data.repository.manage.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -7,7 +7,7 @@ package com.zyplayer.doc.data.repository.support.consts;
|
||||
* @since 2020-06-26
|
||||
*/
|
||||
public class DocSysModuleType {
|
||||
public static enum Manage {
|
||||
public enum Manage {
|
||||
USER_MANAGE(1, "用户管理权限"),
|
||||
;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class DocSysModuleType {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Wiki {
|
||||
public enum Wiki {
|
||||
PAGE(1, "空间"),
|
||||
;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class DocSysModuleType {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Db {
|
||||
public enum Db {
|
||||
DATASOURCE(1, "数据源管理"),
|
||||
;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class DocSysModuleType {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Api {
|
||||
public enum Api {
|
||||
DOC(1, "api文档管理"),
|
||||
;
|
||||
|
||||
|
||||
@@ -29,23 +29,19 @@ public class CodeGenerator {
|
||||
.dateType(DateType.ONLY_DATE)
|
||||
.fileOverride(); // 覆盖已生成文件
|
||||
})
|
||||
.packageConfig(builder -> {
|
||||
builder.parent("com.zyplayer.doc.data") // 设置父包名
|
||||
.moduleName("") // 设置父包模块名
|
||||
.controller("web.generator")
|
||||
.entity("repository.manage.entity")
|
||||
.mapper("repository.manage.mapper")
|
||||
.service("service.manage")
|
||||
.serviceImpl("service.manage.impl")
|
||||
.pathInfo(Collections.singletonMap(OutputFile.mapperXml, mapperDir));
|
||||
})
|
||||
.strategyConfig(builder -> {
|
||||
builder.addInclude(tableName) // 设置需要生成的表名
|
||||
.enableCapitalMode()
|
||||
.serviceBuilder()
|
||||
.formatServiceFileName("%sService")
|
||||
.formatServiceImplFileName("%sServiceImpl");
|
||||
})
|
||||
.packageConfig(builder -> builder.parent("com.zyplayer.doc.data") // 设置父包名
|
||||
.moduleName("") // 设置父包模块名
|
||||
.controller("web.generator")
|
||||
.entity("repository.manage.entity")
|
||||
.mapper("repository.manage.mapper")
|
||||
.service("service.manage")
|
||||
.serviceImpl("service.manage.impl")
|
||||
.pathInfo(Collections.singletonMap(OutputFile.mapperXml, mapperDir)))
|
||||
.strategyConfig(builder -> builder.addInclude(tableName) // 设置需要生成的表名
|
||||
.enableCapitalMode()
|
||||
.serviceBuilder()
|
||||
.formatServiceFileName("%sService")
|
||||
.formatServiceImplFileName("%sServiceImpl"))
|
||||
.templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板
|
||||
.execute();
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SqlLogInterceptor implements Interceptor {
|
||||
private String getParameterValue(Object obj) {
|
||||
String value = null;
|
||||
if (obj instanceof String) {
|
||||
value = "'" + obj.toString() + "'";
|
||||
value = "'" + obj + "'";
|
||||
} else if (obj instanceof Date) {
|
||||
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.CHINA);
|
||||
value = "'" + formatter.format(obj) + "'";
|
||||
@@ -87,7 +87,7 @@ public class SqlLogInterceptor implements Interceptor {
|
||||
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
|
||||
StringBuilder sqlSb = new StringBuilder(boundSql.getSql().replaceAll("[\\s]+", " "));
|
||||
int fromIndex = 0;
|
||||
if (parameterMappings.size() > 0 && parameterObject != null) {
|
||||
if (!parameterMappings.isEmpty() && parameterObject != null) {
|
||||
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
|
||||
if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
|
||||
//sqlSb = sqlSb.replaceFirst("\\?", getParameterValue(parameterObject));
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiCustomParams;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiCustomDocVo;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiCustomVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zyplayer.doc.data.service.manage;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbTableRelation;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zyplayer.doc.data.repository.manage.param.TableRelationParam;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.TableRelationVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -20,5 +20,5 @@ public interface WikiPageService extends IService<WikiPage> {
|
||||
|
||||
void deletePage(WikiPage wikiPage);
|
||||
|
||||
public List<WikiPageTemplateInfoVo> wikiPageTemplateInfos(Long spaceId);
|
||||
List<WikiPageTemplateInfoVo> wikiPageTemplateInfos(Long spaceId);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageTemplate;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.WikiPageTemplateInfoVo;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.WikiTemplateTagVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -22,7 +20,7 @@ public interface WikiPageTemplateService extends IService<WikiPageTemplate> {
|
||||
/**
|
||||
* 根据模板的公开情况获取模板标签
|
||||
*/
|
||||
public List<WikiTemplateTagVo> getAllTags( Long user, boolean open);
|
||||
List<WikiTemplateTagVo> getAllTags(Long user, boolean open);
|
||||
|
||||
/**
|
||||
* 根据条件获取模板
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.*;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.ApiCustomNodeMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiCustomDocVo;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiCustomVo;
|
||||
import com.zyplayer.doc.data.service.common.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomNodeService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Service
|
||||
public class WikiPageHistoryServiceImpl extends ServiceImpl<WikiPageHistoryMapper, WikiPageHistory> implements WikiPageHistoryService {
|
||||
private static Logger logger = LoggerFactory.getLogger(WikiPageHistoryServiceImpl.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(WikiPageHistoryServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public WikiPageHistory saveRecord(Long spaceId, Long pageId, String content) {
|
||||
|
||||
@@ -23,8 +23,7 @@ import java.util.List;
|
||||
public class WikiPageTemplateServiceImpl extends ServiceImpl<WikiPageTemplateMapper, WikiPageTemplate> implements WikiPageTemplateService {
|
||||
@Override
|
||||
public List<WikiTemplateTagVo> getAllTags(Long user, boolean open) {
|
||||
List<WikiTemplateTagVo> all = getBaseMapper().getAllTags(user,open);
|
||||
return all;
|
||||
return getBaseMapper().getAllTags(user,open);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,23 +31,20 @@ public class WikiPageTemplateServiceImpl extends ServiceImpl<WikiPageTemplateMap
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("space_id", spaceId);
|
||||
queryWrapper.eq("page_id", pageId);
|
||||
WikiPageTemplate template = getBaseMapper().selectOne(queryWrapper);
|
||||
return template;
|
||||
return getBaseMapper().selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WikiPageTemplateInfoVo> filterAll(Long user, String name, boolean open, List<String> tags, Long pageNum) {
|
||||
Long offset = 0L;
|
||||
long offset = 0L;
|
||||
if (null != pageNum && pageNum != 0L) {
|
||||
offset = (pageNum - 1) * 8;
|
||||
}
|
||||
List<WikiPageTemplateInfoVo> all = getBaseMapper().getAllTemplate(user, StringUtils.isBlank(name) ? null : "%" + name + "%", open, tags, offset);
|
||||
return all;
|
||||
return getBaseMapper().getAllTemplate(user, StringUtils.isBlank(name) ? null : "%" + name + "%", open, tags, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long total(Long user, String name, boolean open, List<String> tags) {
|
||||
Long num = getBaseMapper().getAllTemplateCount(user, name, open, tags);
|
||||
return num;
|
||||
return getBaseMapper().getAllTemplateCount(user, name, open, tags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* @since 2019年05月25日
|
||||
*/
|
||||
public class CacheUtil {
|
||||
private static Logger logger = LoggerFactory.getLogger(CacheUtil.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(CacheUtil.class);
|
||||
|
||||
// 定期清除过期的key
|
||||
static {
|
||||
@@ -49,7 +49,7 @@ public class CacheUtil {
|
||||
}
|
||||
|
||||
// 现在是内存缓存,不支持分布式部署,后期考虑放到redis,但感觉也没必要。。
|
||||
private static Map<String, CacheData> cacheDataMap = new ConcurrentHashMap<>();
|
||||
private static final Map<String, CacheData> cacheDataMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 放入缓存,默认12小时,按最后一次访问的12小时
|
||||
|
||||
@@ -15,9 +15,9 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
*/
|
||||
public class DruidDataSourceUtil {
|
||||
|
||||
private static AtomicLong nameId = new AtomicLong(0);
|
||||
private static final AtomicLong nameId = new AtomicLong(0);
|
||||
|
||||
public static DruidDataSource createDataSource(String driverClassName, String url, String username, String password, boolean breakAfterAcquireFailure) throws Exception {
|
||||
public static DruidDataSource createDataSource(String driverClassName, String url, String username, String password, boolean breakAfterAcquireFailure) {
|
||||
// 数据源配置
|
||||
DruidDataSource dataSource = new DruidDataSource();
|
||||
dataSource.setDriverClassName(driverClassName);
|
||||
|
||||
@@ -40,7 +40,7 @@ import java.util.stream.Stream;
|
||||
@AuthMan(DocAuthConst.DB_DATASOURCE_MANAGE)
|
||||
@RequestMapping("/zyplayer-doc-db/auth")
|
||||
public class DbDataSourceAuthController {
|
||||
private static Logger logger = LoggerFactory.getLogger(DbDataSourceAuthController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(DbDataSourceAuthController.class);
|
||||
|
||||
@Resource
|
||||
UserInfoService userInfoService;
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.*;
|
||||
@RestController
|
||||
@RequestMapping("/zyplayer-doc-db/data-view")
|
||||
public class DbDataViewController {
|
||||
private static Logger logger = LoggerFactory.getLogger(DbDataViewController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(DbDataViewController.class);
|
||||
|
||||
@Resource
|
||||
ExecuteAuthService executeAuthService;
|
||||
|
||||
@@ -40,7 +40,7 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/zyplayer-doc-db/procedure")
|
||||
public class DbProcedureController {
|
||||
private static Logger logger = LoggerFactory.getLogger(DbProcedureController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(DbProcedureController.class);
|
||||
|
||||
@Resource
|
||||
DatabaseServiceFactory databaseServiceFactory;
|
||||
|
||||
@@ -46,7 +46,7 @@ import java.util.*;
|
||||
@RestController
|
||||
@RequestMapping("/zyplayer-doc-db/executor")
|
||||
public class DbSqlExecutorController {
|
||||
private static Logger logger = LoggerFactory.getLogger(DbSqlExecutorController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(DbSqlExecutorController.class);
|
||||
|
||||
@Resource
|
||||
ColumnSqlExecutor columnSqlExecutor;
|
||||
@@ -87,10 +87,10 @@ public class DbSqlExecutorController {
|
||||
// 参数处理
|
||||
Map<String, Object> paramMap = JSON.parseObject(params);
|
||||
// 解析出多个执行的SQL
|
||||
List<Map<String,Object>> analysisQuerySqlList = new LinkedList<Map<String,Object>>();
|
||||
List<Map<String,Object>> analysisQuerySqlList = new LinkedList<>();
|
||||
try {
|
||||
String driverClassName = dbBaseService.getDatabaseProduct().getDriverClassName();
|
||||
List<SQLStatement> sqlStatements = new ArrayList<SQLStatement>();
|
||||
List<SQLStatement> sqlStatements;
|
||||
//根据驱动程序类名获取数据库类型
|
||||
DbType dbType = SQLTransformUtils.getDbTypeByDriverClassName(driverClassName);
|
||||
sqlStatements = new SQLStatementParser(sql,dbType).parseStatementList();
|
||||
@@ -99,7 +99,7 @@ public class DbSqlExecutorController {
|
||||
if(sb.length()>0&&';' == (sb.charAt(sb.length()-1))){
|
||||
sb.deleteCharAt(sb.length()-1);
|
||||
}
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
//原始sql
|
||||
map.put("originalSql",sb);
|
||||
//sql解析类型
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.*;
|
||||
@RestController
|
||||
@RequestMapping("/zyplayer-doc-db/table-relation")
|
||||
public class DbTableRelationController {
|
||||
private static Logger logger = LoggerFactory.getLogger(DbTableRelationController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(DbTableRelationController.class);
|
||||
|
||||
@Resource
|
||||
DatabaseServiceFactory databaseServiceFactory;
|
||||
|
||||
@@ -61,7 +61,7 @@ public class CommonFormatDownloadService implements FormatDownloadService {
|
||||
StringBuilder resultSb = new StringBuilder("/*\n" +
|
||||
" 数据库 : " + param.getDbName() + "\n" +
|
||||
" 数据库类型 : " + dbBaseService.getDatabaseProduct().name() + "\n" +
|
||||
" 导出时间 : " + DateTime.now().toString() + "\n" +
|
||||
" 导出时间 : " + DateTime.now() + "\n" +
|
||||
" 导出软件 : zyplayer-doc\n" +
|
||||
" 软件版本 : " + ZyplayerDocVersion.version + "\n" +
|
||||
"*/\n\n");
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
@Service(FormatDownloadConst.EXCEL)
|
||||
public class ExcelFormatDownloadService implements FormatDownloadService {
|
||||
private static Logger logger = LoggerFactory.getLogger(ExcelFormatDownloadService.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(ExcelFormatDownloadService.class);
|
||||
|
||||
@Resource
|
||||
ExecuteAuthService executeAuthService;
|
||||
|
||||
@@ -16,5 +16,4 @@ public class FormatDownloadConst {
|
||||
public static final String JSON = "json";
|
||||
public static final String EXCEL = "excel";
|
||||
public static final String CVS = "cvs";
|
||||
;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
public interface FormatDownloadService {
|
||||
|
||||
public void download(HttpServletResponse response, DataViewParam param, String[] tableNameArr) throws Exception;
|
||||
void download(HttpServletResponse response, DataViewParam param, String[] tableNameArr) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DatasourceUtil {
|
||||
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
|
||||
sqlSessionFactoryBean.setDataSource(dataSource);
|
||||
sqlSessionFactoryBean.setMapperLocations(resources);
|
||||
sqlSessionFactoryBean.setPlugins(new Interceptor[]{sqlLogInterceptor});
|
||||
sqlSessionFactoryBean.setPlugins(sqlLogInterceptor);
|
||||
SqlSessionTemplate sqlSessionTemplate = new SqlSessionTemplate(sqlSessionFactoryBean.getObject());
|
||||
// 组装自定义的bean
|
||||
databaseFactoryBean.setId(dbDatasource.getId());
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SqlLogInterceptor implements Interceptor {
|
||||
private String getParameterValue(Object obj) {
|
||||
String value = null;
|
||||
if (obj instanceof String) {
|
||||
value = "'" + obj.toString() + "'";
|
||||
value = "'" + obj + "'";
|
||||
} else if (obj instanceof Date) {
|
||||
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.CHINA);
|
||||
value = "'" + formatter.format(obj) + "'";
|
||||
@@ -87,7 +87,7 @@ public class SqlLogInterceptor implements Interceptor {
|
||||
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
|
||||
StringBuilder sqlSb = new StringBuilder(boundSql.getSql().replaceAll("[\\s]+", " "));
|
||||
int fromIndex = 0;
|
||||
if (parameterMappings.size() > 0 && parameterObject != null) {
|
||||
if (!parameterMappings.isEmpty() && parameterObject != null) {
|
||||
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
|
||||
if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
|
||||
//sqlSb = sqlSb.replaceFirst("\\?", getParameterValue(parameterObject));
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BackupJob implements Job {
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
public void execute(JobExecutionContext context) {
|
||||
// 解析参数
|
||||
BackupJobVO jobVO = JSONObject.parseObject(context.getJobDetail().getJobDataMap().getString(QuartzManagerUtils.PARAM_KEY), BackupJobVO.class);
|
||||
// TODO 保存备份记录
|
||||
|
||||
@@ -53,9 +53,9 @@ public class ColumnExecuteResult {
|
||||
}
|
||||
|
||||
public static class ExecuteResultCode {
|
||||
public static Integer SUCCESS = 0;
|
||||
public static Integer WARN = -1;
|
||||
public static Integer ERROR = -2;
|
||||
public static final Integer SUCCESS = 0;
|
||||
public static final Integer WARN = -1;
|
||||
public static final Integer ERROR = -2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
@Repository
|
||||
public class ColumnSqlExecutor {
|
||||
private static Logger logger = LoggerFactory.getLogger(SqlExecutor.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(SqlExecutor.class);
|
||||
|
||||
@Resource
|
||||
DatabaseRegistrationBean databaseRegistrationBean;
|
||||
@@ -119,7 +119,7 @@ public class ColumnSqlExecutor {
|
||||
statementMap.put(executeParam.getExecuteId(), preparedStatement);
|
||||
List<ParameterMapping> parameterMappings = executeParam.getParameterMappings();
|
||||
List<Object> paramDataList = executeParam.getParamList();
|
||||
if (parameterMappings.size() > 0 && paramDataList.size() > 0) {
|
||||
if (!parameterMappings.isEmpty() && !paramDataList.isEmpty()) {
|
||||
int parameterCount = 99999;
|
||||
try {
|
||||
parameterCount = preparedStatement.getParameterMetaData().getParameterCount();
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
@Repository
|
||||
public class SqlExecutor {
|
||||
private static Logger logger = LoggerFactory.getLogger(SqlExecutor.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(SqlExecutor.class);
|
||||
|
||||
@Resource
|
||||
DatabaseRegistrationBean databaseRegistrationBean;
|
||||
@@ -113,7 +113,7 @@ public class SqlExecutor {
|
||||
statementMap.put(executeParam.getExecuteId(), preparedStatement);
|
||||
List<ParameterMapping> parameterMappings = executeParam.getParameterMappings();
|
||||
List<Object> paramDataList = executeParam.getParamList();
|
||||
if (parameterMappings != null && paramDataList != null && parameterMappings.size() > 0 && paramDataList.size() > 0) {
|
||||
if (parameterMappings != null && paramDataList != null && !parameterMappings.isEmpty() && !paramDataList.isEmpty()) {
|
||||
for (int i = 0; i < parameterMappings.size(); i++) {
|
||||
preparedStatement.setObject(i + 1, paramDataList.get(i));
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class GenericTokenParser {
|
||||
if (text == null || text.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
int start = text.indexOf(openToken, 0);
|
||||
int start = text.indexOf(openToken);
|
||||
if (start == -1) {
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface MethodInvoke {
|
||||
Method method = ReflectionUtils.findMethod(this.getClass(), expr.getMethodName().toLowerCase(), SQLMethodInvokeExpr.class);
|
||||
if (null != method) {
|
||||
try {
|
||||
method.invoke(this, new Object[]{expr});
|
||||
method.invoke(this, expr);
|
||||
} catch (Exception e) {
|
||||
log.error("method invoke error", e);
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -113,8 +113,8 @@ public class MySqlToOracleOutputVisitor extends MySqlOutputVisitor {
|
||||
}else if(sqlTableElement instanceof MySqlPrimaryKey){
|
||||
OraclePrimaryKey oraclePrimaryKey = new OraclePrimaryKey();
|
||||
List<SQLSelectOrderByItem> list = ((MySqlPrimaryKey) sqlTableElement).getIndexDefinition().getColumns();
|
||||
for(int i=0;i<list.size();i++){
|
||||
SQLIdentifierExpr sQLIdentifierExpr = (SQLIdentifierExpr)list.get(i).getExpr();
|
||||
for (SQLSelectOrderByItem sqlSelectOrderByItem : list) {
|
||||
SQLIdentifierExpr sQLIdentifierExpr = (SQLIdentifierExpr) sqlSelectOrderByItem.getExpr();
|
||||
sQLIdentifierExpr.setName(sQLIdentifierExpr.getName().replaceAll("`", ""));
|
||||
oraclePrimaryKey.addColumn(sQLIdentifierExpr);
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ public class MySqlToSqlServerOutputVisitor extends MySqlOutputVisitor {
|
||||
}else if(sqlTableElement instanceof MySqlPrimaryKey){
|
||||
SQLPrimaryKeyImpl sqlserverPrimaryKey = new SQLPrimaryKeyImpl();
|
||||
List<SQLSelectOrderByItem> list = ((MySqlPrimaryKey) sqlTableElement).getIndexDefinition().getColumns();
|
||||
for(int i=0;i<list.size();i++){
|
||||
SQLIdentifierExpr sQLIdentifierExpr = (SQLIdentifierExpr)list.get(i).getExpr();
|
||||
for (SQLSelectOrderByItem sqlSelectOrderByItem : list) {
|
||||
SQLIdentifierExpr sQLIdentifierExpr = (SQLIdentifierExpr) sqlSelectOrderByItem.getExpr();
|
||||
sQLIdentifierExpr.setName(sQLIdentifierExpr.getName().replaceAll("`", ""));
|
||||
sqlserverPrimaryKey.addColumn(sQLIdentifierExpr);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class MySqlSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
|| nameHash == FnvHash.Constants.INT
|
||||
|| nameHash == FnvHash.Constants.BIGINT
|
||||
|| nameHash == FnvHash.Constants.TINYINT) {
|
||||
if(argumentns.size() > 0){
|
||||
if(!argumentns.isEmpty()){
|
||||
int len;
|
||||
SQLExpr arg0 = argumentns.get(0);
|
||||
if (arg0 instanceof SQLNumericLiteralExpr) {
|
||||
@@ -54,7 +54,7 @@ public class MySqlSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
|| nameHash == FnvHash.Constants.DECIMAL) {
|
||||
dataType = new SQLDataTypeImpl("DECIMAL");
|
||||
int precision = 0;
|
||||
if (argumentns.size() > 0) {
|
||||
if (!argumentns.isEmpty()) {
|
||||
precision = ((SQLIntegerExpr) argumentns.get(0)).getNumber().intValue();
|
||||
dataType = new SQLDataTypeImpl("DECIMAL",precision);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class MySqlSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
|
||||
} else if (nameHash == FnvHash.Constants.VARCHAR
|
||||
||nameHash == FnvHash.Constants.CHAR) {
|
||||
if(argumentns.size() > 0){
|
||||
if(!argumentns.isEmpty()){
|
||||
int len;
|
||||
SQLExpr arg0 = argumentns.get(0);
|
||||
if (arg0 instanceof SQLNumericLiteralExpr) {
|
||||
|
||||
@@ -108,8 +108,8 @@ public class OracleToMySqlOutputVisitor extends OracleOutputVisitor {
|
||||
MySqlPrimaryKey mySqlPrimaryKey = new MySqlPrimaryKey();
|
||||
mySqlPrimaryKey.setName("primary key");
|
||||
List<SQLSelectOrderByItem> list = ((OraclePrimaryKey) sqlTableElement).getIndexDefinition().getColumns();
|
||||
for(int i=0;i<list.size();i++){
|
||||
mySqlPrimaryKey.addColumn(list.get(i));
|
||||
for (SQLSelectOrderByItem sqlSelectOrderByItem : list) {
|
||||
mySqlPrimaryKey.addColumn(sqlSelectOrderByItem);
|
||||
}
|
||||
mySqlCreateTableStatement.getTableElementList().add(mySqlPrimaryKey);
|
||||
}else if(sqlTableElement instanceof OracleUnique) {
|
||||
|
||||
@@ -61,7 +61,7 @@ public class OracleSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
dataType = new SQLDataTypeImpl("double");
|
||||
|
||||
} else if (nameHash == FnvHash.Constants.NUMBER) {
|
||||
if (argumentns.size() == 0) {
|
||||
if (argumentns.isEmpty()) {
|
||||
dataType = new SQLDataTypeImpl("decimal", 38);
|
||||
} else {
|
||||
SQLExpr arg0 = argumentns.get(0);
|
||||
@@ -112,7 +112,7 @@ public class OracleSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
dataType.setName("decimal");
|
||||
|
||||
int precision = 0;
|
||||
if (argumentns.size() > 0) {
|
||||
if (!argumentns.isEmpty()) {
|
||||
precision = ((SQLIntegerExpr) argumentns.get(0)).getNumber().intValue();
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class OracleSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
} else if (nameHash == FnvHash.Constants.RAW) {
|
||||
int len;
|
||||
|
||||
if (argumentns.size() == 0) {
|
||||
if (argumentns.isEmpty()) {
|
||||
len = -1;
|
||||
} else if (argumentns.size() == 1) {
|
||||
SQLExpr arg0 = argumentns.get(0);
|
||||
@@ -163,7 +163,7 @@ public class OracleSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
} else {
|
||||
dataType = new SQLCharacterDataType("varchar", len);
|
||||
}
|
||||
} else if (argumentns.size() == 0) {
|
||||
} else if (argumentns.isEmpty()) {
|
||||
dataType = new SQLCharacterDataType("char");
|
||||
} else {
|
||||
throw new UnsupportedOperationException(SQLUtils.toOracleString(x));
|
||||
@@ -185,14 +185,14 @@ public class OracleSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
} else {
|
||||
dataType = new SQLCharacterDataType("nvarchar", len);
|
||||
}
|
||||
} else if (argumentns.size() == 0) {
|
||||
} else if (argumentns.isEmpty()) {
|
||||
dataType = new SQLCharacterDataType("nchar");
|
||||
} else {
|
||||
throw new UnsupportedOperationException(SQLUtils.toOracleString(x));
|
||||
}
|
||||
|
||||
} else if (nameHash == FnvHash.Constants.VARCHAR2) {
|
||||
if (argumentns.size() > 0) {
|
||||
if (!argumentns.isEmpty()) {
|
||||
int len;
|
||||
SQLExpr arg0 = argumentns.get(0);
|
||||
if (arg0 instanceof SQLNumericLiteralExpr) {
|
||||
@@ -210,7 +210,7 @@ public class OracleSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
}
|
||||
|
||||
} else if (nameHash == FnvHash.Constants.NVARCHAR2) {
|
||||
if (argumentns.size() > 0) {
|
||||
if (!argumentns.isEmpty()) {
|
||||
int len;
|
||||
SQLExpr arg0 = argumentns.get(0);
|
||||
if (arg0 instanceof SQLNumericLiteralExpr) {
|
||||
@@ -229,7 +229,7 @@ public class OracleSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
} else if (nameHash == FnvHash.Constants.DATE
|
||||
|| nameHash == FnvHash.Constants.TIMESTAMP) {
|
||||
int len = -1;
|
||||
if (argumentns.size() > 0) {
|
||||
if (!argumentns.isEmpty()) {
|
||||
SQLExpr arg0 = argumentns.get(0);
|
||||
if (arg0 instanceof SQLNumericLiteralExpr) {
|
||||
len = ((SQLNumericLiteralExpr) arg0).getNumber().intValue();
|
||||
|
||||
@@ -119,8 +119,8 @@ public class SqlServerToMySqlOutputVisitor extends SQLServerOutputVisitor {
|
||||
SQLPrimaryKeyImpl sQLPrimaryKeyImpl = (SQLPrimaryKeyImpl) ((SQLAlterTableAddConstraint) item).getConstraint();
|
||||
SQLIndexDefinition sQLIndexDefinition = sQLPrimaryKeyImpl.getIndexDefinition();
|
||||
List<SQLSelectOrderByItem> list = sQLIndexDefinition.getColumns();
|
||||
for(int i=0;i<list.size();i++){
|
||||
SQLIdentifierExpr sQLIdentifierExpr = (SQLIdentifierExpr)list.get(i).getExpr();
|
||||
for (SQLSelectOrderByItem sqlSelectOrderByItem : list) {
|
||||
SQLIdentifierExpr sQLIdentifierExpr = (SQLIdentifierExpr) sqlSelectOrderByItem.getExpr();
|
||||
sQLIdentifierExpr.setName(sQLIdentifierExpr.getName().replaceAll("\\[", "").replaceAll("\\]", ""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class SqlServerSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
SQLDataType dataType;
|
||||
if (nameHash == FnvHash.Constants.SMALLINT) {
|
||||
int precision = 0;
|
||||
if (argumentns.size() > 0) {
|
||||
if (!argumentns.isEmpty()) {
|
||||
precision = ((SQLIntegerExpr) argumentns.get(0)).getNumber().intValue();
|
||||
}
|
||||
dataType = new SQLDataTypeImpl("int", precision);
|
||||
@@ -43,7 +43,7 @@ public class SqlServerSQLDataTypeTransformUtil extends SQLTransformUtils {
|
||||
|
||||
} else if(nameHash == FnvHash.Constants.NVARCHAR){
|
||||
int precision = 0;
|
||||
if (argumentns.size() > 0) {
|
||||
if (!argumentns.isEmpty()) {
|
||||
precision = ((SQLIntegerExpr) argumentns.get(0)).getNumber().intValue();
|
||||
}
|
||||
dataType = new SQLDataTypeImpl("varchar", precision);
|
||||
|
||||
@@ -109,7 +109,7 @@ public class SqlParseUtil {
|
||||
resultParamList.add(paramMap.get(parameterMapping.getProperty()));
|
||||
}
|
||||
}
|
||||
sqlBuilder.append(itemsSb.toString());
|
||||
sqlBuilder.append(itemsSb);
|
||||
}
|
||||
// pagehelper 使用了jsqlparser包,而且版本很低,,低版本没这个方法
|
||||
// if (insert.isUseSet()) {
|
||||
@@ -232,15 +232,13 @@ public class SqlParseUtil {
|
||||
if (select.getFromItem() != null) {
|
||||
countSql.append(" FROM ").append(select.getFromItem());
|
||||
if (select.getJoins() != null) {
|
||||
Iterator<Join> it = select.getJoins().iterator();
|
||||
while (it.hasNext()) {
|
||||
Join join = it.next();
|
||||
if (join.isSimple()) {
|
||||
countSql.append(", ").append(join);
|
||||
} else {
|
||||
countSql.append(" ").append(join);
|
||||
}
|
||||
}
|
||||
for (Join join : select.getJoins()) {
|
||||
if (join.isSimple()) {
|
||||
countSql.append(", ").append(join);
|
||||
} else {
|
||||
countSql.append(" ").append(join);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (select.getWhere() != null) {
|
||||
countSql.append(" WHERE ").append(select.getWhere());
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.zyplayer.doc.db.framework.db.transfer;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.zyplayer.doc.core.exception.ConfirmException;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
@@ -42,7 +41,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
*/
|
||||
@Service
|
||||
public class TransferDataServer {
|
||||
private static Logger logger = LoggerFactory.getLogger(TransferDataServer.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TransferDataServer.class);
|
||||
|
||||
@Resource
|
||||
SqlExecutor sqlExecutor;
|
||||
@@ -163,7 +162,7 @@ public class TransferDataServer {
|
||||
}
|
||||
});
|
||||
// 不足100的数据
|
||||
if (selectResultList.size() > 0) {
|
||||
if (!selectResultList.isEmpty()) {
|
||||
this.writeData(storageSourceId, storageSql, selectResultList);
|
||||
}
|
||||
if (StringUtils.isNotBlank(executeResult.getErrMsg())) {
|
||||
|
||||
@@ -23,7 +23,7 @@ public interface DbSseEmitterService {
|
||||
* @author diantu
|
||||
* @date 2023/7/17
|
||||
**/
|
||||
public SseEmitter createSseConnect(String clientId, Boolean setHeartBeat, Boolean defaultHeartbeat, Consumer<DbCommonSseParam> consumer);
|
||||
SseEmitter createSseConnect(String clientId, Boolean setHeartBeat, Boolean defaultHeartbeat, Consumer<DbCommonSseParam> consumer);
|
||||
|
||||
/**
|
||||
* 关闭连接
|
||||
@@ -31,7 +31,7 @@ public interface DbSseEmitterService {
|
||||
* @author diantu
|
||||
* @date 2023/7/17
|
||||
**/
|
||||
public void closeSseConnect(String clientId);
|
||||
void closeSseConnect(String clientId);
|
||||
|
||||
/**
|
||||
* 推送消息到所有客户端
|
||||
@@ -39,7 +39,7 @@ public interface DbSseEmitterService {
|
||||
* @author diantu
|
||||
* @date 2023/7/17
|
||||
**/
|
||||
public void sendMessageToAllClient(String msg);
|
||||
void sendMessageToAllClient(String msg);
|
||||
|
||||
/**
|
||||
* 根据clientId发送消息给某一客户端
|
||||
@@ -47,5 +47,5 @@ public interface DbSseEmitterService {
|
||||
* @author diantu
|
||||
* @date 2023/7/17
|
||||
**/
|
||||
public void sendMessageToOneClient(String clientId, String msg);
|
||||
void sendMessageToOneClient(String clientId, String msg);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class DbSseCacheUtil {
|
||||
/**
|
||||
* 创建一个容器来存储所有的 SseEmitter(使用ConcurrentHashMap是因为它是线程安全的)。
|
||||
*/
|
||||
public static Map<String, Map<String,Object>> sseCache = new ConcurrentHashMap<>();
|
||||
public static final Map<String, Map<String,Object>> sseCache = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -96,7 +96,7 @@ public class DbSseCacheUtil {
|
||||
* @date 2023/7/17
|
||||
**/
|
||||
public static boolean existSseCache() {
|
||||
return sseCache.size()>0;
|
||||
return !sseCache.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,7 +249,7 @@ public class DbSseCacheUtil {
|
||||
**/
|
||||
public static void sendMessageToClientByClientId(String clientId, DocDbResponseJson message) {
|
||||
Map<String, Object> map = sseCache.get(clientId);
|
||||
if (map==null||map.size()==0) {
|
||||
if (map==null|| map.isEmpty()) {
|
||||
log.error("推送消息失败:客户端{}未创建长链接,失败消息:{}",clientId, message.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ public class DatabaseBackupUtils {
|
||||
//@TODO 存入备份记录信息
|
||||
// 备份文件上传至文件服务器
|
||||
if (!jobVO.getIsUpload()) {
|
||||
return;
|
||||
}
|
||||
//@TODO 备份文件上传至文件服务器
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Date;
|
||||
*/
|
||||
public class JSONUtil {
|
||||
|
||||
public static SerializeConfig serializeConfig = new SerializeConfig();
|
||||
public static final SerializeConfig serializeConfig = new SerializeConfig();
|
||||
|
||||
static {
|
||||
serializeConfig.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
@@ -15,7 +15,7 @@ public class MapCacheUtil {
|
||||
private static Map<String,Object> cacheMap;
|
||||
|
||||
private MapCacheUtil(){
|
||||
cacheMap = new HashMap<String, Object>();
|
||||
cacheMap = new HashMap<>();
|
||||
}
|
||||
|
||||
public static MapCacheUtil getInstance(){
|
||||
|
||||
@@ -47,14 +47,12 @@ public class PoiUtil {
|
||||
"\n" +
|
||||
" 数据库 : " + dbName + "\n" +
|
||||
" 数据库类型 : " + dbType + "\n" +
|
||||
" 导出时间 : " + DateTime.now().toString() + "\n" +
|
||||
" 导出时间 : " + DateTime.now() + "\n" +
|
||||
" 软件版本 : " + ZyplayerDocVersion.version + "\n" +
|
||||
"*/\n\n");
|
||||
for (Map.Entry<String, String> entry : ddlSqlMap.entrySet()) {
|
||||
ddlSqlSb.append("-- ----------------------------\n")
|
||||
.append("-- 表结构:" + entry.getKey() + "\n")
|
||||
.append("-- ----------------------------\n")
|
||||
.append("DROP TABLE IF EXISTS `" + entry.getKey() + "`;\n")
|
||||
ddlSqlSb.append("-- ----------------------------\n").append("-- 表结构:").append(entry.getKey()).append("\n")
|
||||
.append("-- ----------------------------\n").append("DROP TABLE IF EXISTS `").append(entry.getKey()).append("`;\n")
|
||||
.append(entry.getValue()).append("\n\n");
|
||||
}
|
||||
IoUtil.write(response.getOutputStream(), "utf-8", true, ddlSqlSb.toString());
|
||||
@@ -121,7 +119,7 @@ public class PoiUtil {
|
||||
// 写入表信息
|
||||
PoiUtil.createEmptyLine(document);
|
||||
document.createParagraph().createRun().setText("数据库名:" + dbName);
|
||||
document.createParagraph().createRun().setText("导出时间:" + DateTime.now().toString());
|
||||
document.createParagraph().createRun().setText("导出时间:" + DateTime.now());
|
||||
document.createParagraph().createRun().setText("导出说明:本文档使用zyplayer-doc生成并导出");
|
||||
document.createParagraph().createRun().setText("所有库表:");
|
||||
List<List<String>> baseDataList = new LinkedList<>();
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
public class QuartzManagerUtils {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(QuartzManagerUtils.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(QuartzManagerUtils.class);
|
||||
|
||||
/**
|
||||
* 参数传递key
|
||||
|
||||
@@ -38,12 +38,11 @@ public class SQLTransformUtils {
|
||||
StringBuilder out = new StringBuilder();
|
||||
OracleToMySqlOutputVisitor visitor = new OracleToMySqlOutputVisitor(out, false);
|
||||
|
||||
for(int i = 0; i < stmtList.size(); ++i) {
|
||||
((SQLStatement)stmtList.get(i)).accept(visitor);
|
||||
for (SQLStatement sqlStatement : stmtList) {
|
||||
sqlStatement.accept(visitor);
|
||||
}
|
||||
|
||||
String mysqlSql = out.toString();
|
||||
return mysqlSql;
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,12 +55,11 @@ public class SQLTransformUtils {
|
||||
StringBuilder out = new StringBuilder();
|
||||
SqlServerToMySqlOutputVisitor visitor = new SqlServerToMySqlOutputVisitor(out, false);
|
||||
|
||||
for(int i = 0; i < stmtList.size(); ++i) {
|
||||
((SQLStatement)stmtList.get(i)).accept(visitor);
|
||||
for (SQLStatement sqlStatement : stmtList) {
|
||||
sqlStatement.accept(visitor);
|
||||
}
|
||||
|
||||
String mysqlSql = out.toString();
|
||||
return mysqlSql;
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,12 +72,11 @@ public class SQLTransformUtils {
|
||||
StringBuilder out = new StringBuilder();
|
||||
MySqlToOracleOutputVisitor visitor = new MySqlToOracleOutputVisitor(out, false);
|
||||
|
||||
for(int i = 0; i < stmtList.size(); ++i) {
|
||||
((SQLStatement)stmtList.get(i)).accept(visitor);
|
||||
for (SQLStatement sqlStatement : stmtList) {
|
||||
sqlStatement.accept(visitor);
|
||||
}
|
||||
|
||||
String oracleSql = out.toString();
|
||||
return oracleSql;
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,12 +89,11 @@ public class SQLTransformUtils {
|
||||
StringBuilder out = new StringBuilder();
|
||||
MySqlToSqlServerOutputVisitor visitor = new MySqlToSqlServerOutputVisitor(out, false);
|
||||
|
||||
for(int i = 0; i < stmtList.size(); ++i) {
|
||||
((SQLStatement)stmtList.get(i)).accept(visitor);
|
||||
for (SQLStatement sqlStatement : stmtList) {
|
||||
sqlStatement.accept(visitor);
|
||||
}
|
||||
|
||||
String sqlserverSql = out.toString();
|
||||
return sqlserverSql;
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,7 +110,7 @@ public class SQLTransformUtils {
|
||||
java.io.Reader is = clob.getCharacterStream();
|
||||
BufferedReader br = new BufferedReader(is);
|
||||
String s = br.readLine();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// 执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING
|
||||
while (s != null) {
|
||||
sb.append(s);
|
||||
|
||||
@@ -20,7 +20,7 @@ public class SqlLogUtil {
|
||||
private static String getParameterValue(Object obj) {
|
||||
String value;
|
||||
if (obj instanceof String) {
|
||||
value = "'" + obj.toString() + "'";
|
||||
value = "'" + obj + "'";
|
||||
} else if (obj instanceof Number) {
|
||||
value = obj.toString();
|
||||
} else if (obj instanceof Date) {
|
||||
@@ -35,7 +35,7 @@ public class SqlLogUtil {
|
||||
public static String parseLogSql(String sql, List<ParameterMapping> parameterMappings, List<Object> paramList) {
|
||||
StringBuilder sqlSb = new StringBuilder(sql.replaceAll(" {2,}", " "));
|
||||
int fromIndex = 0;
|
||||
if (parameterMappings.size() > 0) {
|
||||
if (!parameterMappings.isEmpty()) {
|
||||
for (int i = 0; i < parameterMappings.size(); i++) {
|
||||
Object obj = paramList.get(i);
|
||||
fromIndex = replacePlaceholder(sqlSb, fromIndex, getParameterValue(obj));
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
*/
|
||||
public class BackupTaskServiceImpl implements BackupTaskService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(BackupTaskServiceImpl.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(BackupTaskServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private Scheduler scheduler;
|
||||
|
||||
@@ -41,7 +41,7 @@ import java.util.Set;
|
||||
* @since 2018年8月8日
|
||||
*/
|
||||
public abstract class DbBaseService {
|
||||
private static Logger logger = LoggerFactory.getLogger(DbBaseService.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(DbBaseService.class);
|
||||
|
||||
@Resource
|
||||
SqlExecutor sqlExecutor;
|
||||
@@ -140,7 +140,7 @@ public abstract class DbBaseService {
|
||||
TableColumnVo.TableInfoVo tableInfoVo = new TableColumnVo.TableInfoVo();
|
||||
List<TableDescDto> tableDescList = baseMapper.getTableDescList(dbName, tableName);
|
||||
String description = null;
|
||||
if (tableDescList.size() > 0) {
|
||||
if (!tableDescList.isEmpty()) {
|
||||
TableDescDto descDto = tableDescList.get(0);
|
||||
description = descDto.getDescription();
|
||||
}
|
||||
@@ -334,11 +334,10 @@ public abstract class DbBaseService {
|
||||
* @since 2023年2月22日
|
||||
*/
|
||||
public String getQueryPageSqlBySql(String sql,Integer pageSize,Integer pageNum) {
|
||||
StringBuilder sqlSb = new StringBuilder();
|
||||
sqlSb.append(String.format("select * from (%s) r", sql));
|
||||
Integer offset = (pageNum-1)*pageSize;
|
||||
sqlSb.append(String.format(" limit %s offset %s", pageSize, offset));
|
||||
return sqlSb.toString();
|
||||
String sqlSb = String.format("select * from (%s) r", sql) +
|
||||
String.format(" limit %s offset %s", pageSize, offset);
|
||||
return sqlSb;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,8 +65,8 @@ public class OracleServiceImpl extends DbBaseService {
|
||||
sqlSb.append(String.format(" order by %s %s", "\""+dataViewParam.getOrderColumn()+"\"", dataViewParam.getOrderType()));
|
||||
}
|
||||
StringBuilder sqlSbFinal = new StringBuilder();
|
||||
Integer pageSize = dataViewParam.getPageSize() * dataViewParam.getPageNum();
|
||||
Integer pageNum = dataViewParam.getPageSize() * (dataViewParam.getPageNum() - 1) + 1;
|
||||
int pageSize = dataViewParam.getPageSize() * dataViewParam.getPageNum();
|
||||
int pageNum = dataViewParam.getPageSize() * (dataViewParam.getPageNum() - 1) + 1;
|
||||
sqlSbFinal.append(String.format("select %s ,ZYPLAYDBROWID from ( select %s ,rowidtochar(rowid) as ZYPLAYDBROWID from %s",queryColumns, queryColumns + ",rownum rn", "(" + sqlSb + ") where rownum<=" + pageSize + " ) t2 where t2.rn >=" + pageNum));
|
||||
return sqlSbFinal.toString();
|
||||
}
|
||||
@@ -80,11 +80,9 @@ public class OracleServiceImpl extends DbBaseService {
|
||||
*/
|
||||
@Override
|
||||
public String getQueryPageSqlBySql(String sql,Integer pageSize,Integer pageNum) {
|
||||
StringBuilder sqlSb = new StringBuilder();
|
||||
Integer pageSizeFinal = pageSize * pageNum;
|
||||
Integer pageNumFinal = pageSize * (pageNum - 1) + 1;
|
||||
sqlSb.append(String.format("select * from ( select r.*,rownum rn from %s", "(" + sql + ") r where rownum<=" + pageSizeFinal + " ) t2 where t2.rn >=" + pageNumFinal));
|
||||
return sqlSb.toString();
|
||||
int pageSizeFinal = pageSize * pageNum;
|
||||
int pageNumFinal = pageSize * (pageNum - 1) + 1;
|
||||
return String.format("select * from ( select r.*,rownum rn from %s", "(" + sql + ") r where rownum<=" + pageSizeFinal + " ) t2 where t2.rn >=" + pageNumFinal);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,9 +101,7 @@ public class OracleServiceImpl extends DbBaseService {
|
||||
String oracleSql = "";
|
||||
try {
|
||||
oracleSql = SQLTransformUtils.ClobToString((Clob)tableDdlList.get(0).get("CREATETABLE"));
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IOException e) {
|
||||
} catch (SQLException | IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
tableDdlVo.setOracle(SQLUtils.formatOracle(oracleSql));
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
@Service
|
||||
public class BaseDownloadService implements DownloadService {
|
||||
private static Logger logger = LoggerFactory.getLogger(BaseDownloadService.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(BaseDownloadService.class);
|
||||
|
||||
@Resource
|
||||
SqlExecutor sqlExecutor;
|
||||
@@ -55,7 +55,7 @@ public class BaseDownloadService implements DownloadService {
|
||||
* @since 2020年6月5日
|
||||
*/
|
||||
@Override
|
||||
public String downloadDataByInsert(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) throws Exception {
|
||||
public String downloadDataByInsert(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) {
|
||||
String dbTableName = String.format("`%s`.`%s`", param.getDbName(), param.getTableName());
|
||||
StringBuilder resultSb = new StringBuilder();
|
||||
if (Objects.equals(param.getCreateTableFlag(), 1)) {
|
||||
@@ -109,7 +109,7 @@ public class BaseDownloadService implements DownloadService {
|
||||
* @since 2020年6月5日
|
||||
*/
|
||||
@Override
|
||||
public String downloadDataByUpdate(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) throws Exception {
|
||||
public String downloadDataByUpdate(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) {
|
||||
String dbTableName = String.format("`%s`.`%s`", param.getDbName(), param.getTableName());
|
||||
StringBuilder resultSb = new StringBuilder();
|
||||
Pattern pattern = Pattern.compile("\t|\r\n|\r|\n|\\s+");
|
||||
@@ -157,7 +157,7 @@ public class BaseDownloadService implements DownloadService {
|
||||
* @since 2020年6月5日
|
||||
*/
|
||||
@Override
|
||||
public String downloadDataByJson(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) throws Exception {
|
||||
public String downloadDataByJson(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) {
|
||||
StringBuilder resultSb = new StringBuilder();
|
||||
resultSb.append("[");
|
||||
sqlExecutor.execute(executeParam, item -> {
|
||||
|
||||
@@ -26,7 +26,7 @@ public interface DownloadService {
|
||||
* @author 暮光:城中城
|
||||
* @since 2020年6月5日
|
||||
*/
|
||||
String downloadDataByInsert(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) throws Exception;
|
||||
String downloadDataByInsert(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet);
|
||||
|
||||
/**
|
||||
* 导出数据为update语句格式
|
||||
@@ -34,7 +34,7 @@ public interface DownloadService {
|
||||
* @author 暮光:城中城
|
||||
* @since 2020年6月5日
|
||||
*/
|
||||
String downloadDataByUpdate(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) throws Exception;
|
||||
String downloadDataByUpdate(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet);
|
||||
|
||||
/**
|
||||
* 导出数据为json格式
|
||||
@@ -42,7 +42,7 @@ public interface DownloadService {
|
||||
* @author 暮光:城中城
|
||||
* @since 2020年6月5日
|
||||
*/
|
||||
String downloadDataByJson(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) throws Exception;
|
||||
String downloadDataByJson(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
@Service
|
||||
public class SqlserverDownloadService implements DownloadService {
|
||||
private static Logger logger = LoggerFactory.getLogger(SqlserverDownloadService.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(SqlserverDownloadService.class);
|
||||
|
||||
@Resource
|
||||
SqlExecutor sqlExecutor;
|
||||
@@ -46,7 +46,7 @@ public class SqlserverDownloadService implements DownloadService {
|
||||
* @since 2020年6月5日
|
||||
*/
|
||||
@Override
|
||||
public String downloadDataByInsert(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) throws Exception {
|
||||
public String downloadDataByInsert(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) {
|
||||
String dbTableName = String.format("%s..%s", param.getDbName(), param.getTableName());
|
||||
StringBuilder resultSb = new StringBuilder();
|
||||
if (Objects.equals(param.getCreateTableFlag(), 1)) {
|
||||
@@ -100,7 +100,7 @@ public class SqlserverDownloadService implements DownloadService {
|
||||
* @since 2020年6月5日
|
||||
*/
|
||||
@Override
|
||||
public String downloadDataByUpdate(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) throws Exception {
|
||||
public String downloadDataByUpdate(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) {
|
||||
String dbTableName = String.format("%s..%s", param.getDbName(), param.getTableName());
|
||||
StringBuilder resultSb = new StringBuilder();
|
||||
Pattern pattern = Pattern.compile("\t|\r\n|\r|\n|\\s+");
|
||||
@@ -148,7 +148,7 @@ public class SqlserverDownloadService implements DownloadService {
|
||||
* @since 2020年6月5日
|
||||
*/
|
||||
@Override
|
||||
public String downloadDataByJson(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) throws Exception {
|
||||
public String downloadDataByJson(DataViewParam param, ExecuteParam executeParam, List<TableColumnDescDto> dataCols, Set<String> conditionSet) {
|
||||
StringBuilder resultSb = new StringBuilder();
|
||||
resultSb.append("[");
|
||||
sqlExecutor.execute(executeParam, item -> {
|
||||
|
||||
@@ -1,23 +1,15 @@
|
||||
package com.zyplayer.doc.manage;
|
||||
|
||||
import com.zyplayer.doc.core.util.ZyplayerDocVersion;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.BeanNameGenerator;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 程序启动器
|
||||
*
|
||||
@@ -34,14 +26,14 @@ import java.util.Optional;
|
||||
})
|
||||
public class Application extends SpringBootServletInitializer {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(Application.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(Application.class);
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(Application.class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
public static void main(String[] args) {
|
||||
ConfigurableApplicationContext application = SpringApplication.run(Application.class, args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,9 @@ package com.zyplayer.doc.manage.framework.config;
|
||||
import com.zyplayer.doc.api.framework.config.EnableDocApi;
|
||||
import com.zyplayer.doc.db.framework.configuration.EnableDocDb;
|
||||
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 java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 按需开启zyplayer-doc所有的服务
|
||||
*
|
||||
@@ -25,18 +19,18 @@ public class ZyplayerDocConfig {
|
||||
@EnableDocWiki
|
||||
//wiki模块加载注解条件化,配合配置文件决定是否加载
|
||||
@ConditionalOnProperty(prefix = "zyplayer.doc.manage.enable", name = "wiki", matchIfMissing = true)
|
||||
public class enableWiki {
|
||||
public static class enableWiki {
|
||||
}
|
||||
|
||||
@EnableDocDb
|
||||
//db模块加载注解条件化,配合配置文件决定是否加载
|
||||
@ConditionalOnProperty(prefix = "zyplayer.doc.manage.enable", name = "db", matchIfMissing = true)
|
||||
public class enableDb {
|
||||
public static class enableDb {
|
||||
}
|
||||
|
||||
@EnableDocApi
|
||||
//api模块加载注解条件化,配合配置文件决定是否加载
|
||||
@ConditionalOnProperty(prefix = "zyplayer.doc.manage.enable", name = "api", matchIfMissing = true)
|
||||
public class enableApi {
|
||||
public static class enableApi {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.HashMap;
|
||||
*/
|
||||
@Configuration
|
||||
public class ZyplayerModuleKeeper implements ApplicationContextAware {
|
||||
HashMap<String, Boolean> moduleInfo = new HashMap<>();
|
||||
final HashMap<String, Boolean> moduleInfo = new HashMap<>();
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
@@ -26,7 +26,7 @@ public class ZyplayerModuleKeeper implements ApplicationContextAware {
|
||||
|
||||
//获取模块是否启动
|
||||
public boolean ismoduleStarted(Class<?> clazz) {
|
||||
if (moduleInfo.size() < 1) {
|
||||
if (moduleInfo.isEmpty()) {
|
||||
getmoduleInfo();
|
||||
}
|
||||
return moduleInfo.get(clazz.getName().split("\\$")[1]);
|
||||
@@ -34,7 +34,7 @@ public class ZyplayerModuleKeeper implements ApplicationContextAware {
|
||||
|
||||
//提供模块开启状态数组,给前端控制页面展示
|
||||
public HashMap<String, Boolean> getmoduleInfo() {
|
||||
if (moduleInfo.size() < 1) {
|
||||
if (moduleInfo.isEmpty()) {
|
||||
synchronized (ZyplayerModuleKeeper.class) {
|
||||
Class<? extends ZyplayerDocConfig> clazz = ZyplayerDocConfig.class;
|
||||
Class<?>[] innerClasses = clazz.getClasses();
|
||||
@@ -54,6 +54,6 @@ public class ZyplayerModuleKeeper implements ApplicationContextAware {
|
||||
} catch (BeansException e) {
|
||||
return false;
|
||||
}
|
||||
return null != bean;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ApplicationInfoConsolePrint implements IConsolePrint {
|
||||
public void buildPrintInfo(StringBuilder 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 + "/";
|
||||
contextPath = (contextPath.isEmpty() || contextPath.endsWith("/")) ? contextPath : contextPath + "/";
|
||||
String hostAddress = InetAddress.getLocalHost().getHostAddress();
|
||||
String serverPort = environment.getProperty("server.port");
|
||||
String urlCtx = hostAddress + ":" + serverPort + "/" + contextPath;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.zyplayer.doc.manage.framework.console;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* 启动后打印信息接口
|
||||
@@ -12,5 +9,5 @@ import java.net.UnknownHostException;
|
||||
* @since 2023年6月16日
|
||||
*/
|
||||
public interface IConsolePrint extends Ordered {
|
||||
public void buildPrintInfo(StringBuilder printInfo) throws Exception;
|
||||
void buildPrintInfo(StringBuilder printInfo) throws Exception;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ModuleInfoConsolePrint implements IConsolePrint {
|
||||
ZyplayerModuleKeeper moduleKeeper;
|
||||
|
||||
@Override
|
||||
public void buildPrintInfo(StringBuilder printInfo) throws Exception {
|
||||
public void buildPrintInfo(StringBuilder printInfo) {
|
||||
printInfo.append("\n\n\t\t\t\t↓zyplayer-doc模块的启动情况\n")
|
||||
.append("\t\t\t\t------------------------\n");
|
||||
HashMap<String, Boolean> moduleInfoMap = moduleKeeper.getmoduleInfo();
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.stream.Collectors;
|
||||
public class ZyplayerConsolePrint implements CommandLineRunner {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ZyplayerConsolePrint.class);
|
||||
StringBuilder logInfoHolder = new StringBuilder();
|
||||
final StringBuilder logInfoHolder = new StringBuilder();
|
||||
|
||||
@Resource
|
||||
ObjectProvider<List<IConsolePrint>> consolePrintListProvider;
|
||||
|
||||
@@ -8,7 +8,6 @@ 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;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Properties;
|
||||
*/
|
||||
@Component
|
||||
public class SchedulerTask {
|
||||
private static Logger logger = LoggerFactory.getLogger(SchedulerTask.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(SchedulerTask.class);
|
||||
|
||||
@Value("${zyplayer.doc.manage.upgradePropertiesUrl:}")
|
||||
private String upgradePropertiesUrl;
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.Objects;
|
||||
*/
|
||||
@RestController
|
||||
public class LoginController {
|
||||
private static Logger logger = LoggerFactory.getLogger(LoginController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(LoginController.class);
|
||||
|
||||
@Resource
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@@ -2,7 +2,6 @@ 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.framework.config.ZyplayerDocConfig;
|
||||
import com.zyplayer.doc.manage.framework.config.ZyplayerModuleKeeper;
|
||||
import com.zyplayer.doc.manage.framework.upgrade.UpgradeUtil;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.zyplayer.doc.data.repository.manage.entity.UserAuth;
|
||||
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 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;
|
||||
|
||||
@@ -119,7 +119,7 @@ public class UserInfoController {
|
||||
if (StringUtils.isBlank(userInfo.getUserName())) {
|
||||
return DocResponseJson.warn("用户名必填");
|
||||
}
|
||||
Long userId = Optional.ofNullable(userInfo.getId()).orElse(0L);
|
||||
long userId = Optional.ofNullable(userInfo.getId()).orElse(0L);
|
||||
QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_no", userInfo.getUserNo());
|
||||
queryWrapper.ne(userId > 0, "id", userInfo.getId());
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.LinkedList;
|
||||
* @since 20230713
|
||||
*/
|
||||
public class DocEntry {
|
||||
LinkedList<MediaEntry> medias = new LinkedList<>();
|
||||
final LinkedList<MediaEntry> medias = new LinkedList<>();
|
||||
String context = "";
|
||||
String name = "";
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Component
|
||||
public class ConditionalStrategySelector {
|
||||
Map<Class<?>,ConditionalStrategySeletorUnit> cache = new HashMap<>();
|
||||
final Map<Class<?>,ConditionalStrategySeletorUnit> cache = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 注册所有策略
|
||||
@@ -44,17 +44,14 @@ public class ConditionalStrategySelector {
|
||||
return null;
|
||||
}
|
||||
T strategy = (T) conditionalStrategySeletorUnit.getStrategy(condition);
|
||||
if (null == strategy) {
|
||||
return null;
|
||||
}
|
||||
return strategy;
|
||||
}
|
||||
|
||||
class ConditionalStrategySeletorUnit<T extends IConditionalStrategy> {
|
||||
List<T> strategys;
|
||||
static class ConditionalStrategySeletorUnit<T extends IConditionalStrategy> {
|
||||
final List<T> strategys;
|
||||
|
||||
//策略集体实现到二层缓存
|
||||
ConcurrentHashMap<String, T> cache = new ConcurrentHashMap<>();
|
||||
final ConcurrentHashMap<String, T> cache = new ConcurrentHashMap<>();
|
||||
|
||||
public ConditionalStrategySeletorUnit(List<T> strategys) {
|
||||
this.strategys = strategys;
|
||||
|
||||
@@ -8,9 +8,9 @@ package com.zyplayer.doc.wiki.batch.strategy.base;
|
||||
* @since 20230713
|
||||
*/
|
||||
public interface IConditionalStrategy {
|
||||
public String getCondition();
|
||||
String getCondition();
|
||||
|
||||
public default boolean matchCondition(String key){
|
||||
default boolean matchCondition(String key){
|
||||
return key.equals(getCondition());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@ import java.util.ArrayList;
|
||||
* @since 20230717
|
||||
*/
|
||||
public interface ICombDependencyStrategy extends IConditionalStrategy {
|
||||
public void comb(ArrayList<DocEntry> docs, File file);
|
||||
void comb(ArrayList<DocEntry> docs, File file);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ public class MDCombDependencyStrategy implements ICombDependencyStrategy {
|
||||
docEntry.setName(FileUtil.getName(file));
|
||||
String info = FileUtil.readUtf8String(file);
|
||||
docEntry.setContext(info);
|
||||
while (info.indexOf(LEFT_TAG) >= 0 && info.indexOf(RIGHT_TAG) >= 0) {
|
||||
while (info.contains(LEFT_TAG) && info.contains(RIGHT_TAG)) {
|
||||
String window = info;
|
||||
while(window.indexOf(LEFT_TAG)>=0){
|
||||
while(window.contains(LEFT_TAG)){
|
||||
int leftOffset = window.indexOf(LEFT_TAG)+2;
|
||||
window= window.substring(leftOffset);
|
||||
int rightOffset = window.indexOf(")")+1;
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.hutool.core.io.IoUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageFile;
|
||||
import com.zyplayer.doc.data.service.manage.WikiPageService;
|
||||
import com.zyplayer.doc.wiki.service.WikiPageFileServiceEx;
|
||||
import com.zyplayer.doc.wiki.service.WikiPageUploadService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.codec.Charsets;
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -104,7 +105,7 @@ public class WikiCommonController {
|
||||
response.setHeader("Content-disposition", "inline;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
||||
// response.setHeader("Content-disposition", "inline;filename=" + fileName);
|
||||
// response.setHeader("Content-Disposition", "inline; fileName=" + fileName + ";filename*=utf-8''" + URLEncoder.encode(fileName, "UTF-8"));
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
InputStream inputStream = Files.newInputStream(file.toPath());
|
||||
OutputStream os = response.getOutputStream();
|
||||
byte[] b = new byte[2048];
|
||||
int length;
|
||||
|
||||
@@ -141,7 +141,7 @@ public class WikiOpenApiController {
|
||||
pageFile.setFileUrl("zyplayer-doc-wiki/common/file?uuid=" + pageFile.getUuid());
|
||||
}
|
||||
// 高并发下会有覆盖问题,但不重要~
|
||||
Integer viewNum = Optional.ofNullable(wikiPageSel.getViewNum()).orElse(0);
|
||||
int viewNum = Optional.ofNullable(wikiPageSel.getViewNum()).orElse(0);
|
||||
WikiPage wikiPageUp = new WikiPage();
|
||||
wikiPageUp.setId(wikiPageSel.getId());
|
||||
wikiPageUp.setViewNum(viewNum + 1);
|
||||
|
||||
@@ -114,7 +114,7 @@ public class WikiPageAuthController {
|
||||
UserAuth userAuth = this.createUserAuth(pageId, currentUser.getUserId(), authVo.getUserId(), authId);
|
||||
userAuthList.add(userAuth);
|
||||
}
|
||||
if (userAuthList.size() <= 0) {
|
||||
if (userAuthList.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
// 保存权限,重新登录后可用,后期可以考虑在这里直接修改缓存里的用户权限
|
||||
|
||||
@@ -146,7 +146,7 @@ public class WikiPageController {
|
||||
vo.setCanUploadFile((canUploadFile == null) ? 1 : 0);
|
||||
vo.setCanConfigAuth((canConfigAuth == null) ? 1 : 0);
|
||||
// 高并发下会有覆盖问题,但不重要~
|
||||
Integer viewNum = Optional.ofNullable(wikiPageSel.getViewNum()).orElse(0);
|
||||
int viewNum = Optional.ofNullable(wikiPageSel.getViewNum()).orElse(0);
|
||||
WikiPage wikiPageUp = new WikiPage();
|
||||
wikiPageUp.setId(wikiPageSel.getId());
|
||||
wikiPageUp.setViewNum(viewNum + 1);
|
||||
@@ -216,7 +216,7 @@ public class WikiPageController {
|
||||
|
||||
public boolean isLassoDoll(WikiPage wikiPage, Long moveToPageId) {
|
||||
if (0L != moveToPageId) {
|
||||
if (wikiPage.getId() == moveToPageId) {
|
||||
if (wikiPage.getId().equals(moveToPageId)) {
|
||||
return true;
|
||||
}
|
||||
UpdateWrapper<WikiPage> wrapper = new UpdateWrapper<>();
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.zyplayer.doc.wiki.controller;
|
||||
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
|
||||
@@ -4,48 +4,23 @@ import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.exception.ConfirmException;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.*;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageContentMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.param.SearchByEsParam;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.SpaceNewsVo;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.WikiPageTemplateInfoVo;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.WikiTemplateTagVo;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.UserMsgType;
|
||||
import com.zyplayer.doc.data.service.manage.*;
|
||||
import com.zyplayer.doc.data.utils.CachePrefix;
|
||||
import com.zyplayer.doc.data.utils.CacheUtil;
|
||||
import com.zyplayer.doc.wiki.controller.vo.WikiPageContentVo;
|
||||
import com.zyplayer.doc.wiki.controller.vo.WikiPageVo;
|
||||
import com.zyplayer.doc.wiki.framework.consts.SpaceType;
|
||||
import com.zyplayer.doc.wiki.service.WikiPageUploadService;
|
||||
import com.zyplayer.doc.wiki.service.common.WikiPageAuthService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.docx4j.XmlUtils;
|
||||
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
|
||||
import org.docx4j.openpackaging.parts.WordprocessingML.AltChunkType;
|
||||
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -74,7 +49,7 @@ public class WikiPageTemplateController {
|
||||
WikiPageTemplate exist = wikiPageTemplateService.getWikiPageTemplateBySpaceAndPage(wikiPageTemplate.getSpaceId(), wikiPageTemplate.getPageId());
|
||||
if (null == exist) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
if (wikiPageTemplate.getTagName().equals("")) {
|
||||
if (wikiPageTemplate.getTagName().isEmpty()) {
|
||||
wikiPageTemplate.setTagName("无标签");
|
||||
}
|
||||
wikiPageTemplate.setCreated(new Date());
|
||||
@@ -107,7 +82,7 @@ public class WikiPageTemplateController {
|
||||
tagList.add(param.getValue()[0]);
|
||||
}
|
||||
});
|
||||
if (tagList.size() < 1) {
|
||||
if (tagList.isEmpty()) {
|
||||
tagList.add("");
|
||||
}
|
||||
List<WikiPageTemplateInfoVo> wikiPageTemplateInfoVos = wikiPageTemplateService.filterAll(currentUser.getUserId(), name, open, tagList, pageNum);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zyplayer.doc.wiki.controller;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -28,7 +27,6 @@ import com.zyplayer.doc.wiki.framework.consts.WikiAuthType;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -192,7 +190,7 @@ public class WikiSpaceController {
|
||||
this.createUserAuth(userAuthList, authVo.getPageFileUpload(), spaceId, WikiAuthType.PAGE_FILE_UPLOAD, authVo.getGroupId());
|
||||
this.createUserAuth(userAuthList, authVo.getPageFileDelete(), spaceId, WikiAuthType.PAGE_FILE_DELETE, authVo.getGroupId());
|
||||
this.createUserAuth(userAuthList, authVo.getPageAuthManage(), spaceId, WikiAuthType.PAGE_AUTH_MANAGE, authVo.getGroupId());
|
||||
if (userAuthList.size() > 0) {
|
||||
if (!userAuthList.isEmpty()) {
|
||||
userGroupAuthService.saveBatch(userAuthList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import javax.annotation.PostConstruct;
|
||||
*/
|
||||
@Component
|
||||
public class CheckWikiFileSavePath {
|
||||
private static Logger logger = LoggerFactory.getLogger(CheckWikiFileSavePath.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(CheckWikiFileSavePath.class);
|
||||
|
||||
@Value("${zyplayer.doc.wiki.upload-path:}")
|
||||
private String uploadPath;
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserMessage;
|
||||
|
||||
@@ -2,14 +2,12 @@ package com.zyplayer.doc.wiki.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.zyplayer.doc.core.exception.ConfirmException;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserMessage;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageContent;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiSpace;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageContentMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageMapper;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.UserMsgType;
|
||||
|
||||
Reference in New Issue
Block a user