mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
sonarqube质量修复
This commit is contained in:
+4
-4
@@ -2,7 +2,7 @@ package com.cf.imes.module.infra.service.db;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.cf.imes.module.infra.dal.dataobject.db.DataSourceConfigDO;
|
||||
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
|
||||
@@ -31,8 +31,8 @@ public class DatabaseTableServiceImpl implements DatabaseTableService {
|
||||
@Override
|
||||
public List<TableInfo> getTableList(Long dataSourceConfigId, String nameLike, String commentLike) {
|
||||
List<TableInfo> tables = getTableList0(dataSourceConfigId, null);
|
||||
return tables.stream().filter(tableInfo -> (StrUtil.isEmpty(nameLike) || tableInfo.getName().contains(nameLike))
|
||||
&& (StrUtil.isEmpty(commentLike) || tableInfo.getComment().contains(commentLike)))
|
||||
return tables.stream().filter(tableInfo -> (CharSequenceUtil.isEmpty(nameLike) || tableInfo.getName().contains(nameLike))
|
||||
&& (CharSequenceUtil.isEmpty(commentLike) || tableInfo.getComment().contains(commentLike)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DatabaseTableServiceImpl implements DatabaseTableService {
|
||||
DataSourceConfig dataSourceConfig = new DataSourceConfig.Builder(config.getUrl(), config.getUsername(),
|
||||
config.getPassword()).build();
|
||||
StrategyConfig.Builder strategyConfig = new StrategyConfig.Builder();
|
||||
if (StrUtil.isNotEmpty(name)) {
|
||||
if (CharSequenceUtil.isNotEmpty(name)) {
|
||||
strategyConfig.addInclude(name);
|
||||
} else {
|
||||
// 移除工作流和定时任务前缀的表名 // TODO 未来做成可配置
|
||||
|
||||
+8
-6
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.infra.service.file;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.io.FileUtils;
|
||||
import com.cf.imes.framework.file.core.client.FileClient;
|
||||
@@ -35,6 +35,8 @@ public class FileServiceImpl implements FileService {
|
||||
@Resource
|
||||
private FileMapper fileMapper;
|
||||
|
||||
private static final String CLIENT_ERR_NOTIFICATION = "客户端({}) 不能为空";
|
||||
|
||||
@Override
|
||||
public PageResult<FileDO> getFilePage(FilePageReqVO pageReqVO) {
|
||||
return fileMapper.selectPage(pageReqVO);
|
||||
@@ -45,11 +47,11 @@ public class FileServiceImpl implements FileService {
|
||||
public String createFile(String name, String path, byte[] content) {
|
||||
// 计算默认的 path 名
|
||||
String type = FileTypeUtils.getMineType(content, name);
|
||||
if (StrUtil.isEmpty(path)) {
|
||||
if (CharSequenceUtil.isEmpty(path)) {
|
||||
path = FileUtils.generatePath(content, name);
|
||||
}
|
||||
// 如果 name 为空,则使用 path 填充
|
||||
if (StrUtil.isEmpty(name)) {
|
||||
if (CharSequenceUtil.isEmpty(name)) {
|
||||
name = path;
|
||||
}
|
||||
|
||||
@@ -77,7 +79,7 @@ public class FileServiceImpl implements FileService {
|
||||
|
||||
// 从文件存储器中删除
|
||||
FileClient client = fileConfigService.getFileClient(file.getConfigId());
|
||||
Assert.notNull(client, "客户端({}) 不能为空", file.getConfigId());
|
||||
Assert.notNull(client, CLIENT_ERR_NOTIFICATION, file.getConfigId());
|
||||
client.delete(file.getPath());
|
||||
|
||||
// 删除记录
|
||||
@@ -95,7 +97,7 @@ public class FileServiceImpl implements FileService {
|
||||
@Override
|
||||
public byte[] getFileContent(Long configId, String path) throws Exception {
|
||||
FileClient client = fileConfigService.getFileClient(configId);
|
||||
Assert.notNull(client, "客户端({}) 不能为空", configId);
|
||||
Assert.notNull(client, CLIENT_ERR_NOTIFICATION, configId);
|
||||
return client.getContent(path);
|
||||
}
|
||||
|
||||
@@ -108,7 +110,7 @@ public class FileServiceImpl implements FileService {
|
||||
}
|
||||
// 从文件存储器中删除
|
||||
FileClient client = fileConfigService.getFileClient(fileDO.getConfigId());
|
||||
Assert.notNull(client, "客户端({}) 不能为空", fileDO.getConfigId());
|
||||
Assert.notNull(client, CLIENT_ERR_NOTIFICATION, fileDO.getConfigId());
|
||||
try {
|
||||
client.delete(path);
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user