Merge pull request #10871 from dataease/pr@dev-v2@feat_copilot

feat: 新增copilot所需接口
This commit is contained in:
Junjun 2024-07-10 09:47:20 +08:00 committed by GitHub
commit 4c5439a781
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,6 +12,7 @@ import io.dataease.dataset.manage.DatasetDataManage;
import io.dataease.dataset.manage.DatasetSQLManage; import io.dataease.dataset.manage.DatasetSQLManage;
import io.dataease.dataset.manage.DatasetTableFieldManage; import io.dataease.dataset.manage.DatasetTableFieldManage;
import io.dataease.dataset.manage.PermissionManage; import io.dataease.dataset.manage.PermissionManage;
import io.dataease.dataset.utils.FieldUtils;
import io.dataease.engine.constant.DeTypeConstants; import io.dataease.engine.constant.DeTypeConstants;
import io.dataease.engine.utils.Utils; import io.dataease.engine.utils.Utils;
import io.dataease.exception.DEException; import io.dataease.exception.DEException;
@ -221,6 +222,7 @@ public class CopilotManage {
} }
List<TableField> fields = (List<TableField>) data.get("fields"); List<TableField> fields = (List<TableField>) data.get("fields");
fields = transField(fields);
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
// 重新构造data // 重新构造data
Map<String, Object> previewData = buildPreviewData(data, fields, desensitizationList); Map<String, Object> previewData = buildPreviewData(data, fields, desensitizationList);
@ -327,6 +329,14 @@ public class CopilotManage {
return dto; return dto;
} }
public List<TableField> transField(List<TableField> fields) {
fields.forEach(field -> {
field.setDeExtractType(FieldUtils.transType2DeType(field.getFieldType()));
field.setDeType(FieldUtils.transType2DeType(field.getFieldType()));
});
return fields;
}
public Map<String, Object> buildPreviewData(Map<String, Object> data, List<TableField> fields, Map<String, ColumnPermissionItem> desensitizationList) { public Map<String, Object> buildPreviewData(Map<String, Object> data, List<TableField> fields, Map<String, ColumnPermissionItem> desensitizationList) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
List<String[]> dataList = (List<String[]>) data.get("data"); List<String[]> dataList = (List<String[]>) data.get("data");