forked from github/dataease
fix: 数据集脱敏
This commit is contained in:
parent
fe2ce6ef58
commit
65ae8e84b4
@ -1106,11 +1106,11 @@ public class ChartDataBuild {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (originStr.length() >= columnPermissionItem.getDesensitizationRule().getM() && originStr.length() >= columnPermissionItem.getDesensitizationRule().getN()) {
|
if (originStr.length() >= columnPermissionItem.getDesensitizationRule().getM() && originStr.length() >= columnPermissionItem.getDesensitizationRule().getN()) {
|
||||||
desensitizationStr = StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, columnPermissionItem.getDesensitizationRule().getN()) + "***";
|
desensitizationStr = "***" + StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, columnPermissionItem.getDesensitizationRule().getN()) + "***";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (originStr.length() >= columnPermissionItem.getDesensitizationRule().getM() && originStr.length() < columnPermissionItem.getDesensitizationRule().getN()) {
|
if (originStr.length() >= columnPermissionItem.getDesensitizationRule().getM() && originStr.length() < columnPermissionItem.getDesensitizationRule().getN()) {
|
||||||
desensitizationStr = StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, originStr.length()) + "***";
|
desensitizationStr = "***" + StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, originStr.length());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -34,7 +34,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
|
|
||||||
public class ExcelUtils {
|
public class ExcelUtils {
|
||||||
|
public static final String UFEFF = "\uFEFF";
|
||||||
private static String path = "/opt/dataease/data/excel/";
|
private static String path = "/opt/dataease/data/excel/";
|
||||||
private static ObjectMapper objectMapper = new ObjectMapper();
|
private static ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -450,6 +450,9 @@ public class ExcelUtils {
|
|||||||
if(StringUtils.isEmpty(filedName)){
|
if(StringUtils.isEmpty(filedName)){
|
||||||
DEException.throwException("首行行中不允许有空单元格!");
|
DEException.throwException("首行行中不允许有空单元格!");
|
||||||
}
|
}
|
||||||
|
if (filedName.startsWith(UFEFF)) {
|
||||||
|
filedName = filedName.replace(UFEFF, "");
|
||||||
|
}
|
||||||
TableField tableFiled = new TableField();
|
TableField tableFiled = new TableField();
|
||||||
tableFiled.setName(filedName);
|
tableFiled.setName(filedName);
|
||||||
tableFiled.setOriginName(filedName);
|
tableFiled.setOriginName(filedName);
|
||||||
|
@ -144,8 +144,10 @@ public class DatasourceServer implements DatasourceApi {
|
|||||||
private void filterDs(List<BusiNodeVO> busiNodeVOS, List<Long> ids, String type, Long id) {
|
private void filterDs(List<BusiNodeVO> busiNodeVOS, List<Long> ids, String type, Long id) {
|
||||||
for (BusiNodeVO busiNodeVO : busiNodeVOS) {
|
for (BusiNodeVO busiNodeVO : busiNodeVOS) {
|
||||||
if (busiNodeVO.getType() != null && busiNodeVO.getType().equalsIgnoreCase(type)) {
|
if (busiNodeVO.getType() != null && busiNodeVO.getType().equalsIgnoreCase(type)) {
|
||||||
if (id != null && !busiNodeVO.getId().equals(id)) {
|
if (id != null) {
|
||||||
ids.add(busiNodeVO.getId());
|
if (!busiNodeVO.getId().equals(id)) {
|
||||||
|
ids.add(busiNodeVO.getId());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ids.add(busiNodeVO.getId());
|
ids.add(busiNodeVO.getId());
|
||||||
}
|
}
|
||||||
@ -166,7 +168,7 @@ public class DatasourceServer implements DatasourceApi {
|
|||||||
List<Long> ids = new ArrayList<>();
|
List<Long> ids = new ArrayList<>();
|
||||||
filterDs(busiNodeVOS, ids, dataSourceDTO.getType(), dataSourceDTO.getId());
|
filterDs(busiNodeVOS, ids, dataSourceDTO.getType(), dataSourceDTO.getId());
|
||||||
|
|
||||||
if(CollectionUtil.isEmpty(ids)){
|
if (CollectionUtil.isEmpty(ids)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QueryWrapper<CoreDatasource> wrapper = new QueryWrapper<>();
|
QueryWrapper<CoreDatasource> wrapper = new QueryWrapper<>();
|
||||||
@ -181,7 +183,7 @@ public class DatasourceServer implements DatasourceApi {
|
|||||||
boolean hasRepeat = false;
|
boolean hasRepeat = false;
|
||||||
for (CoreDatasource datasource : datasources) {
|
for (CoreDatasource datasource : datasources) {
|
||||||
if (Arrays.asList("API", "Excel", "folder").contains(datasource.getType())) {
|
if (Arrays.asList("API", "Excel", "folder").contains(datasource.getType())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DatasourceConfiguration compare = JsonUtil.parseObject(datasource.getConfiguration(), DatasourceConfiguration.class);
|
DatasourceConfiguration compare = JsonUtil.parseObject(datasource.getConfiguration(), DatasourceConfiguration.class);
|
||||||
switch (dataSourceDTO.getType()) {
|
switch (dataSourceDTO.getType()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user