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

feat: 新增copilot所需接口
This commit is contained in:
Junjun 2024-07-08 13:25:36 +08:00 committed by GitHub
commit 0798920738
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 40 additions and 4 deletions

View File

@ -219,6 +219,10 @@ public class DatasetTableFieldManage {
wrapper.eq("checked", true);
wrapper.eq("ext_field", 0);
List<DatasetTableFieldDTO> list = transDTO(coreDatasetTableFieldMapper.selectList(wrapper));
Map<String, ColumnPermissionItem> desensitizationList = new HashMap<>();
list = permissionManage.filterColumnPermissions(list, desensitizationList, id, null);
List<DatasetTableFieldDTO> dimensionList = list.stream().filter(ele -> StringUtils.equalsIgnoreCase(ele.getGroupType(), "d")).collect(Collectors.toList());
List<DatasetTableFieldDTO> quotaList = list.stream().filter(ele -> StringUtils.equalsIgnoreCase(ele.getGroupType(), "q")).collect(Collectors.toList());
Map<String, List<DatasetTableFieldDTO>> map = new LinkedHashMap<>();

View File

@ -32,10 +32,7 @@ import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
import static io.dataease.result.ResultCode.SYSTEM_INNER_ERROR;
@ -222,6 +219,41 @@ public class HttpClientUtil {
}
}
public static HttpResponse postWithHeaders(String url, String json, HttpClientConfig config) {
CloseableHttpClient httpClient = null;
try {
httpClient = buildHttpClient(url);
HttpPost httpPost = new HttpPost(url);
if (config == null) {
config = new HttpClientConfig();
}
httpPost.setConfig(config.buildRequestConfig());
Map<String, String> header = config.getHeader();
for (String key : header.keySet()) {
httpPost.addHeader(key, header.get(key));
}
EntityBuilder entityBuilder = EntityBuilder.create();
entityBuilder.setText(json);
entityBuilder.setContentType(ContentType.APPLICATION_JSON);
HttpEntity requestEntity = entityBuilder.build();
httpPost.setEntity(requestEntity);
HttpResponse response = httpClient.execute(httpPost);
return response;
} catch (Exception e) {
logger.error("HttpClient查询失败", e);
throw new DEException(SYSTEM_INNER_ERROR.code(), "HttpClient查询失败: " + e.getMessage());
} finally {
try {
if (httpClient != null) {
httpClient.close();
}
} catch (Exception e) {
logger.error("HttpClient关闭连接失败", e);
}
}
}
public static String put(String url, String json, HttpClientConfig config) {
CloseableHttpClient httpClient = null;
try {