Browse Source

REPORT-83773 && REPORT-83838 && REPORT-83716 && REPORT-83738 数据脱敏二期迭代bug

【问题原因】rt
【改动思路】主要是:
1. 添加埋点
2. 设计器端限制服务器数据集中脱敏配置的修改
3. 一些逻辑bug修改
【review建议】
feature/x
Yvan-欧阳帆 2 years ago
parent
commit
21b9a73045
  1. 12
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  2. 51
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  3. 13
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java
  4. 10
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleEditPane.java

12
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -661,4 +661,14 @@ public abstract class DesignTableDataManager {
public static void setThreadLocal(String value) {
threadLocal.set(value);
}
}
/**
* 根据数据集名称判断是否为服务器数据集或服务器存储过程
*
* @param tableDataName 数据集名称
* @return
*/
public static boolean isGlobalTableData(String tableDataName) {
return globalDsCache.containsKey(tableDataName);
}
}

51
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -33,6 +33,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.ui.util.UIUtil;
import com.fr.esd.query.StrategicTableData;
import com.fr.function.TIME;
import com.fr.general.FRFont;
import com.fr.general.data.DataModel;
@ -223,6 +224,18 @@ public class PreviewTablePane extends BasicPane {
* 点击脱敏配置后的操作
*/
public void clickDesensitizationLabel() {
// 埋点记录
recordDesensitization();
// 判断数据集类型
if (isGlobalTableData()) {
// 服务器数据集不允许在设计器端修改脱敏配置
FineJOptionPane.showMessageDialog(
this,
Toolkit.i18nText("Fine-Design_Report_Cannot_Modify_Desensitization_Config_Of_ServerTableData"),
Toolkit.i18nText("Fine-Design_Basic_Alert"),
FineJOptionPane.WARNING_MESSAGE);
return;
}
TableDataDesensitizationSettingPane settingPane = new TableDataDesensitizationSettingPane((DesensitizationTableData) tableData);
settingPane.populateBean((DesensitizationTableData) tableData);
BasicDialog dialog = settingPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(PreviewTablePane.this), new DialogActionAdapter() {
@ -248,25 +261,41 @@ public class PreviewTablePane extends BasicPane {
}
/**
* 设置脱敏设置的个数
* 触发数据脱敏埋点记录
*
* @return 数据脱敏字段数量
*/
private int recordDesensitization() {
return getCurrentTableDataDesensitizaitionCount();
}
/**
* 当前tableData是否为服务器数据集或服务器存储过程
*
* @param model
* @return
*/
private void setDesensitizationCount(TableModel model) {
desensitizationPane.setDesensitizationCount(isDesensitizeOpened(),
model instanceof DesensitizedPreviewTableModel ?
((DesensitizedPreviewTableModel) model).getDesensitizeColumnsCount() :
0);
public boolean isGlobalTableData() {
return this.tableData instanceof StrategicTableData &&
DesignTableDataManager.isGlobalTableData(((StrategicTableData) this.tableData).getDsName());
}
/**
* 根据TableData设置脱敏设置的个数
*/
private void setDesensitizationCountByTableData() {
desensitizationPane.setDesensitizationCount(isDesensitizeOpened(),
this.tableData instanceof DesensitizationTableData ?
((DesensitizationTableData) this.tableData).getDesensitizationConfig().getDesensitizationItems().size() :
0);
desensitizationPane.setDesensitizationCount(isDesensitizeOpened(), getCurrentTableDataDesensitizaitionCount());
desensitizationPane.dealWithTableDataType(isGlobalTableData());
}
/**
* 获取当前数据集中设置脱敏规则的个数
*
* @return
*/
private int getCurrentTableDataDesensitizaitionCount() {
return this.tableData instanceof DesensitizationTableData ?
((DesensitizationTableData) this.tableData).getDesensitizationConfig().getDesensitizationItems().size() :
0;
}
/**

13
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java

@ -112,9 +112,22 @@ public class PreviewTableDesensitizationPane extends JPanel {
return previewToggle;
}
/**
* 设置Label的值主要是需要动态修改配置的脱敏规则的数量
*
* @param desensitizeOpen
* @param count
*/
public void setDesensitizationCount(boolean desensitizeOpen, int count) {
desensitizationLabel.setText(desensitizeOpen ?
DATA_DESENSITIZATION_CONFIG + LEFT_BRACKET + count + RIGHT_BRACKET + COUNT :
DATA_DESENSITIZATION_CONFIG);
}
/**
* 服务器数据集时Label需要置灰
*/
public void dealWithTableDataType(boolean globalTableData) {
desensitizationLabel.setForeground(globalTableData ? UIConstants.DISABLED_ICON_COLOR : UIConstants.NORMAL_BLUE);
}
}

10
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleEditPane.java

@ -2,6 +2,7 @@ package com.fr.design.data.datapane.preview.desensitization.view.rule;
import com.fr.data.desensitize.rule.base.DesensitizationCondition;
import com.fr.data.desensitize.rule.base.DesensitizationRule;
import com.fr.data.desensitize.rule.base.DesensitizationRuleSource;
import com.fr.data.desensitize.rule.base.DesensitizationRuleType;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.UIConstants;
@ -271,6 +272,15 @@ public class DesensitizationRuleEditPane extends BasicBeanPane<DesensitizationRu
@Override
public DesensitizationRule updateBean() {
rule.setRuleName(this.ruleNameTextField.getText());
rule.setRuleSource(DesensitizationRuleSource.CUSTOM);
DesensitizationRuleType ruleType = DesensitizationRuleType.matchByTypeName(String.valueOf(this.ruleTypeComboBox.getSelectedItem()));
rule.setRuleType(ruleType);
rule.getCondition().setRetainFront((int) this.retainFrontTextField.getValue());
rule.getCondition().setRetainBack((int) this.retainBackTextField.getValue());
rule.getCondition().setSymbol(ruleType == DesensitizationRuleType.CHARACTER_REPLACE ?
this.firstSymbolTextField.getText() :
this.secondSymbolTextField.getText());
rule.setEnable(true);
return rule;
}

Loading…
Cancel
Save