From 386cf68cd13b2f6d085c4d6c57422c16f38fa363 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 25 Feb 2022 13:33:44 +0800 Subject: [PATCH 1/8] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a7dd1fd772..ae8731a389 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.cn-qingdao.aliyuncs.com/dataease/fabric8-java-alpine-openjdk8-jre:edge +FROM registry.cn-qingdao.aliyuncs.com/dataease/fabric8-java-alpine-openjdk8-jre:edge-chromium # RUN echo -e 'https://dl-cdn.alpinelinux.org/alpine/edge/main/\nhttps://dl-cdn.alpinelinux.org/alpine/edge/community/' > /etc/apk/repositories From 03a2e922544d6b466c9e50a25e75d7006a2a1a8d Mon Sep 17 00:00:00 2001 From: taojinlong Date: Fri, 25 Feb 2022 17:32:17 +0800 Subject: [PATCH 2/8] =?UTF-8?q?fix:=20api=20=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E8=A1=A5=E5=85=A8=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/dataease/auth/api/demo.java | 11 +++----- .../commons/utils/HttpClientUtil.java | 21 ++++++++------- .../provider/datasource/ApiProvider.java | 16 +++++------- .../service/datasource/DatasourceService.java | 26 +++++++++++-------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/backend/src/main/java/io/dataease/auth/api/demo.java b/backend/src/main/java/io/dataease/auth/api/demo.java index 1fcab1b099..04d7ce9c57 100644 --- a/backend/src/main/java/io/dataease/auth/api/demo.java +++ b/backend/src/main/java/io/dataease/auth/api/demo.java @@ -3,13 +3,10 @@ package io.dataease.auth.api; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; -import com.github.xiaoymin.knife4j.annotations.ApiSupport; -import io.dataease.base.domain.DatasetTableFunction; -import io.swagger.annotations.Api; + import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; -import java.util.List; @RestController @@ -19,10 +16,10 @@ public class demo { @GetMapping("demo") public Object listByTableId() { JSONArray jsonArray = new JSONArray(); - for(int i=0;i<100;i++){ + for(int i=0;i<10;i++){ JSONObject jsonObject = new JSONObject(); - for(int j=0;j<10;j++){ - jsonObject.set("column" + j, "value"+j); + for(int j=0;j<1;j++){ + jsonObject.set("column" +i + j, "value"+i+j); } jsonArray.put(jsonObject); } diff --git a/backend/src/main/java/io/dataease/commons/utils/HttpClientUtil.java b/backend/src/main/java/io/dataease/commons/utils/HttpClientUtil.java index d00974d658..fb71455a64 100755 --- a/backend/src/main/java/io/dataease/commons/utils/HttpClientUtil.java +++ b/backend/src/main/java/io/dataease/commons/utils/HttpClientUtil.java @@ -1,8 +1,8 @@ package io.dataease.commons.utils; +import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; import org.apache.http.client.entity.EntityBuilder; import org.apache.http.client.entity.UrlEncodedFormEntity; @@ -90,8 +90,7 @@ public class HttpClientUtil { httpGet.addHeader(HTTP.CONTENT_ENCODING, config.getCharset()); HttpResponse response = httpClient.execute(httpGet); - HttpEntity entity = response.getEntity(); - return getResponseStr(response, entity, config); + return getResponseStr(response, config); } catch (Exception e) { logger.error("HttpClient查询失败", e); throw new RuntimeException("HttpClient查询失败: " + e.getMessage()); @@ -136,8 +135,7 @@ public class HttpClientUtil { httpPost.setEntity(requestEntity); HttpResponse response = httpClient.execute(httpPost); - HttpEntity entity = response.getEntity(); - return getResponseStr(response, entity, config); + return getResponseStr(response, config); } catch (Exception e) { logger.error("HttpClient查询失败", e); throw new RuntimeException("HttpClient查询失败: " + e.getMessage()); @@ -198,8 +196,7 @@ public class HttpClientUtil { } HttpResponse response = httpClient.execute(httpPost); - HttpEntity entity = response.getEntity(); - return getResponseStr(response, entity, config); + return getResponseStr(response, config); } catch (Exception e) { logger.error("HttpClient查询失败", e); throw new RuntimeException("HttpClient查询失败: " + e.getMessage()); @@ -212,10 +209,14 @@ public class HttpClientUtil { } } - private static String getResponseStr(HttpResponse response, HttpEntity entity, HttpClientConfig config) throws Exception{ + private static String getResponseStr(HttpResponse response, HttpClientConfig config) throws Exception{ if(response.getStatusLine().getStatusCode() >= 400){ - throw new Exception(EntityUtils.toString(entity, config.getCharset())); + String msg = EntityUtils.toString(response.getEntity(), config.getCharset()); + if(StringUtils.isEmpty(msg)){ + msg = "StatusCode: " + response.getStatusLine().getStatusCode(); + } + throw new Exception(msg); } - return EntityUtils.toString(entity, config.getCharset()); + return EntityUtils.toString(response.getEntity(), config.getCharset()); } } diff --git a/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java b/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java index 42a800f1c5..56ebf17f63 100644 --- a/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java +++ b/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java @@ -28,7 +28,7 @@ public class ApiProvider extends DatasourceProvider{ public List getData(DatasourceRequest datasourceRequest) throws Exception { ApiDefinition apiDefinition = checkApiDefinition(datasourceRequest); String response = execHttpRequest(apiDefinition); - return fetchResult(response, apiDefinition.getDataPath()); + return fetchResult(response, apiDefinition); } @Override @@ -64,7 +64,7 @@ public class ApiProvider extends DatasourceProvider{ fieldList = getTableFileds(datasourceRequest); result.put("fieldList", fieldList); - dataList = fetchResult(response, apiDefinition.getDataPath()); + dataList = fetchResult(response, apiDefinition); result.put("dataList", dataList); return result; } @@ -170,16 +170,14 @@ public class ApiProvider extends DatasourceProvider{ return response; } - private List fetchResult(String result, String path){ + private List fetchResult(String result, ApiDefinition apiDefinition){ List dataList = new LinkedList<>(); - List datas = JsonPath.read(result, path); + List datas = JsonPath.read(result, apiDefinition.getDataPath()); for (LinkedHashMap data : datas) { - String[] row = new String[data.entrySet().size()]; - Iterator it = data.entrySet().iterator(); + String[] row = new String[apiDefinition.getFields().size()]; int i = 0; - while (it.hasNext()){ - Map.Entry entry = (Map.Entry)it.next(); - row[i] = Optional.ofNullable(entry.getValue()).orElse("").toString().replaceAll("\n", " ").replaceAll("\r", " "); + for (DatasetTableField field : apiDefinition.getFields()) { + row[i] = Optional.ofNullable(data.get(field.getOriginName())).orElse("").toString().replaceAll("\n", " ").replaceAll("\r", " "); i++; } dataList.add(row); diff --git a/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java b/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java index b71b93638b..7a20a5bd39 100644 --- a/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java +++ b/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java @@ -362,18 +362,16 @@ public class DatasourceService { List dataList = new ArrayList<>(); List fields = new ArrayList<>(); - Boolean getFileds = true; - + Set fieldKeys = new HashSet<>(); + //第一遍获取 field for (LinkedHashMap data : datas) { - JSONObject jsonObject = new JSONObject(); - Iterator it = data.entrySet().iterator(); - while (it.hasNext()){ - Map.Entry entry = (Map.Entry)it.next(); - jsonObject.put((String) entry.getKey(), Optional.ofNullable(entry.getValue()).orElse("").toString().replaceAll("\n", " ").replaceAll("\r", " ")); - if(getFileds) { + Set keys = data.keySet(); + for (String key : keys) { + if(!fieldKeys.contains(key)){ + fieldKeys.add(key); DatasetTableField tableField = new DatasetTableField(); - tableField.setOriginName((String) entry.getKey()); - tableField.setName((String) entry.getKey()); + tableField.setOriginName(key); + tableField.setName(key); tableField.setSize(65535); tableField.setDeExtractType(0); tableField.setDeType(0); @@ -381,7 +379,13 @@ public class DatasourceService { fields.add(tableField); } } - getFileds = false; + } + //第二遍获取 data + for (LinkedHashMap data : datas) { + JSONObject jsonObject = new JSONObject(); + for (String key : fieldKeys) { + jsonObject.put(key, Optional.ofNullable(data.get(key)).orElse("").toString().replaceAll("\n", " ").replaceAll("\r", " ")); + } dataList.add(jsonObject); } apiDefinition.setDatas(dataList); From 9c7ad6f04ac3b2275b5d03189e69f452c50d6f3d Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 25 Feb 2022 17:44:15 +0800 Subject: [PATCH 3/8] =?UTF-8?q?fix:=20=E4=BB=AA=E8=A1=A8=E6=9D=BF=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E8=A7=86=E5=9B=BE=E8=A2=AB=E5=88=A0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/resources/db/migration/V32__1.8.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/resources/db/migration/V32__1.8.sql b/backend/src/main/resources/db/migration/V32__1.8.sql index 3ffa33fe71..61f01b28b8 100644 --- a/backend/src/main/resources/db/migration/V32__1.8.sql +++ b/backend/src/main/resources/db/migration/V32__1.8.sql @@ -365,7 +365,7 @@ ALTER TABLE `datasource` ALTER TABLE `panel_view` ADD COLUMN `copy_from_panel` varchar(255) NULL AFTER `position`, ADD COLUMN `copy_from_view` varchar(255) NULL AFTER `copy_from_panel`, -ADD COLUMN `copy_from` varchar(255) NOT NULL COMMENT '如果有复制 最近一次的复制来源id' AFTER `copy_from_view`, +ADD COLUMN `copy_from` varchar(255) NULL COMMENT '如果有复制 最近一次的复制来源id' AFTER `copy_from_view`, ADD COLUMN `copy_id` varchar(255) NULL COMMENT '本次复制的执行ID' AFTER `copy_from`; ALTER TABLE `panel_view_linkage` From 04730cb4ac7713b8c821c1d2c173f8d0c3545a79 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 25 Feb 2022 17:47:44 +0800 Subject: [PATCH 4/8] =?UTF-8?q?refactor:=20flyway=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=8B=93=E5=B1=95=E6=8F=92=E4=BB=B6=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/resources/db/migration/V32__1.8.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/resources/db/migration/V32__1.8.sql b/backend/src/main/resources/db/migration/V32__1.8.sql index 61f01b28b8..5153b77c38 100644 --- a/backend/src/main/resources/db/migration/V32__1.8.sql +++ b/backend/src/main/resources/db/migration/V32__1.8.sql @@ -315,7 +315,7 @@ ALTER TABLE `chart_view` ADD COLUMN `is_plugin` bit(1) NULL COMMENT '是否插件' AFTER `chart_type`; -INSERT INTO `my_plugin` VALUES (2, '视图默认插件', 'default', 0, 20000, 'view', '默认视图插件', '1.0-SNAPSHOT', NULL, 'fit2cloud-chenyw', 0, NULL, NULL, 'deplugin-view-backend', NULL); +INSERT INTO `my_plugin` VALUES (2, '视图默认插件', 'default', 0, 20000, 'view', '默认视图插件', '1.0-SNAPSHOT', NULL, 'fit2cloud-chenyw', 0, NULL, NULL, 'dataease-extensions-backend', NULL); SET NAMES utf8mb4; From b2403405d70a3bce1efcf808cc9f871280ade603 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 25 Feb 2022 17:47:44 +0800 Subject: [PATCH 5/8] =?UTF-8?q?refactor:=20flyway=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=8B=93=E5=B1=95=E6=8F=92=E4=BB=B6=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/resources/db/migration/V32__1.8.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/resources/db/migration/V32__1.8.sql b/backend/src/main/resources/db/migration/V32__1.8.sql index 3ffa33fe71..7ff10256c3 100644 --- a/backend/src/main/resources/db/migration/V32__1.8.sql +++ b/backend/src/main/resources/db/migration/V32__1.8.sql @@ -315,7 +315,7 @@ ALTER TABLE `chart_view` ADD COLUMN `is_plugin` bit(1) NULL COMMENT '是否插件' AFTER `chart_type`; -INSERT INTO `my_plugin` VALUES (2, '视图默认插件', 'default', 0, 20000, 'view', '默认视图插件', '1.0-SNAPSHOT', NULL, 'fit2cloud-chenyw', 0, NULL, NULL, 'deplugin-view-backend', NULL); +INSERT INTO `my_plugin` VALUES (2, '视图默认插件', 'default', 0, 20000, 'view', '默认视图插件', '1.0-SNAPSHOT', NULL, 'fit2cloud-chenyw', 0, NULL, NULL, 'dataease-extensions-backend', NULL); SET NAMES utf8mb4; From 3d458316a9aea17e570003850916b8840c03f9e6 Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 25 Feb 2022 18:28:49 +0800 Subject: [PATCH 6/8] =?UTF-8?q?refactor:=20=E5=8E=BB=E9=99=A4=E5=A0=86?= =?UTF-8?q?=E5=8F=A0=E6=9F=B1=E7=8A=B6=E5=9B=BE=E6=9F=B1=E9=97=B4=E9=9A=94?= =?UTF-8?q?=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/components/shape-attr/SizeSelector.vue | 2 +- frontend/src/views/chart/view/ChartEdit.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue index 5fe74d9514..0a96d990d7 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue @@ -8,7 +8,7 @@ - + diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index be24d248c7..6a28dce9ff 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -622,7 +622,7 @@ /> From 1e407b49bb9638543f53ec85a7ebb1ddeff53014 Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 25 Feb 2022 18:28:49 +0800 Subject: [PATCH 7/8] =?UTF-8?q?refactor:=20=E5=8E=BB=E9=99=A4=E5=A0=86?= =?UTF-8?q?=E5=8F=A0=E6=9F=B1=E7=8A=B6=E5=9B=BE=E6=9F=B1=E9=97=B4=E9=9A=94?= =?UTF-8?q?=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/components/shape-attr/SizeSelector.vue | 2 +- frontend/src/views/chart/view/ChartEdit.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue index 5fe74d9514..0a96d990d7 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue @@ -8,7 +8,7 @@ - + diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index be24d248c7..6a28dce9ff 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -622,7 +622,7 @@ /> From 0ef9e7a001479ec61281db8628fbdaf96d7b3651 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 25 Feb 2022 18:36:32 +0800 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20=E4=BB=AA=E8=A1=A8=E6=9D=BF=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E5=90=8E=E6=89=93=E5=BC=80=E7=9A=84=E6=98=AF=E6=97=A7?= =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E6=9D=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/dataease/service/panel/PanelGroupService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java index d5ece3cc9e..aedb1af684 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java @@ -131,7 +131,7 @@ public class PanelGroupService { panelGroupMapper.insertSelective(newDefaultPanel); } else if ("copy".equals(request.getOptType())) { try { - this.panelGroupCopy(request, null, true); + panelId = this.panelGroupCopy(request, null, true); } catch (Exception e) { e.printStackTrace(); LOGGER.error("更新panelView出错panelId:{}", request.getId());