diff --git a/Doc/DataEase源码修改.md b/Doc/DataEase源码修改.md index 488e24ad..55fabad4 100644 --- a/Doc/DataEase源码修改.md +++ b/Doc/DataEase源码修改.md @@ -73,11 +73,146 @@ https://blog.csdn.net/chajinglong/article/details/142666079 **$vue3$ $history$模式配置及$nginx$服务器配置** ``` -https://www.cnblogs.com/shog808/p/15935465.html - https://blog.csdn.net/jay100500/article/details/130072520 ``` **切换到$V2.10.1$版本** -![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202412110806315.png) \ No newline at end of file +![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202412110806315.png) + + + +$NodeJs$与$NPM$版本 + +``` + v16.15.0 + 8.5.5 +``` + + + +### 三、遇到的问题 + +``` +D:\dsWork\DataEaseV2.10.1\core\core-frontend\src\custom-component\v-query\DynamicTimeFiltering.vue +D:\dsWork\DataEaseV2.10.1\core\core-frontend\src\custom-component\v-query\DynamicTimeRangeFiltering.vue +``` + +**改正前**: + +```javascript +timeGranularityMultiple: { + type: String as PropType, + default: () => { + return 'yearrange' + } + } +``` + +**改正后**: + +```javascript + timeGranularityMultiple: { + type: Object as PropType, + default: () => { + return { type: 'yearrange' } + } + } +``` + + + +**$core-frontend$前端打包失败** + +``` +**报错:** on project core-frontend: Failed to run task: 'npm run build:distributed' failed. +**原因:**在core-frontend/package.json中 "build:distributed": "NODE_OPTIONS=--max_old_space_size=4096 vite build --mode distributed && npm run +``` + +build:flush",而在**$Windows$系统不支持$NODE\_OPTIONS$命令** +**解决方案:** + +``` +使用npm install cross-env --save-dev 安装cross-env +``` + +![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202412111339690.png) + +在`core-frontend/package.json`中添加`cross-env`命令 + +![(https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202412111339065.png) + +![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202412111341686.png) + +### 四、去掉$Vue$中的#号 + +```javascript +D:\dsWork\DataEaseV2.10.1\core\core-frontend\src\router\index.ts + +//import { createRouter, createWebHashHistory } from 'vue-router' +import { createRouter, createWebHistory } from 'vue-router' + +const router = createRouter({ + //history: createWebHashHistory(), + history: createWebHistory(), + routes: routes as RouteRecordRaw[] +}) + +``` + +然后前端重新打包,漫长的等待... + +![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202412111557806.png) + + + +**配置好的$Nginx$配置文件** + +```nginx +upstream dataease { + server 10.10.14.203:8100; +} + +location /de2api { + client_max_body_size 600m; + client_body_buffer_size 128k; + proxy_connect_timeout 600; + proxy_read_timeout 600; + proxy_send_timeout 600; + proxy_buffer_size 64k; + proxy_buffers 4 32k; + proxy_busy_buffers_size 64k; + proxy_temp_file_write_size 64k; + + proxy_pass http://dataease; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +``` + + + + + +### 五、参考资料 + +**官方:源码部署** + +``` +https://dataease.io/docs/v2/installation/deployment_installation/ +``` + +**手把手教你搭建$DataEase$二次开发环境$Windows$** + +``` +https://segmentfault.com/a/1190000045261128 +``` + +**用户名与密码** + +``` +admin +DataEase@123456 +``` + diff --git a/有问题/南华县.docx b/Doc/有问题/南华县.docx similarity index 100% rename from 有问题/南华县.docx rename to Doc/有问题/南华县.docx diff --git a/有问题/(图1为图片并数据显示不全,图2为图片,缺少图3)南华县.docx b/Doc/有问题/(图1为图片并数据显示不全,图2为图片,缺少图3)南华县.docx similarity index 100% rename from 有问题/(图1为图片并数据显示不全,图2为图片,缺少图3)南华县.docx rename to Doc/有问题/(图1为图片并数据显示不全,图2为图片,缺少图3)南华县.docx diff --git a/有问题/(图2缺少乡村人口、缺少图3)蒙自市人口变化趋势对基础教育的影响(修改).docx b/Doc/有问题/(图2缺少乡村人口、缺少图3)蒙自市人口变化趋势对基础教育的影响(修改).docx similarity index 100% rename from 有问题/(图2缺少乡村人口、缺少图3)蒙自市人口变化趋势对基础教育的影响(修改).docx rename to Doc/有问题/(图2缺少乡村人口、缺少图3)蒙自市人口变化趋势对基础教育的影响(修改).docx diff --git a/src/main/java/com/dsideal/base/DataEase/Controller/DataEaseController.java b/src/main/java/com/dsideal/base/DataEase/Controller/DataEaseController.java index efd725fb..13f6dadf 100644 --- a/src/main/java/com/dsideal/base/DataEase/Controller/DataEaseController.java +++ b/src/main/java/com/dsideal/base/DataEase/Controller/DataEaseController.java @@ -28,7 +28,6 @@ import java.io.IOException; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.UUID; @ApiDoc public class DataEaseController extends Controller { @@ -92,6 +91,7 @@ public class DataEaseController extends Controller { } + /** * 市级路由 * diff --git a/src/main/java/com/dsideal/base/Test/CityScreenCopy.java b/src/main/java/com/dsideal/base/Test/CityScreenCopy.java new file mode 100644 index 00000000..88c8daef --- /dev/null +++ b/src/main/java/com/dsideal/base/Test/CityScreenCopy.java @@ -0,0 +1,119 @@ +package com.dsideal.base.Test; + +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; +import com.dsideal.base.BaseApplication; +import com.dsideal.base.DataEase.Model.DataEaseModel; +import com.dsideal.base.Tools.Util.LocalMysqlConnectUtil; +import com.jfinal.plugin.activerecord.Db; +import com.jfinal.plugin.activerecord.Record; +import net.sf.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class CityScreenCopy { + //获取数据可视化名称 + public static String dataVisualizationName = BaseApplication.PropKit.get("dataEase.dataVisualizationName"); + + /** + * 利用雪花算法获取唯一ID + * + * @return + */ + public static long getSnowId() { + //雪花算法生成唯一ID + Snowflake snowflake = IdUtil.createSnowflake(1, 1); + return snowflake.nextId(); + } + + /** + * 生成随机字符串 + * @param len + * @return + */ + static String randomString(int len) { + String alphabetsInUpperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + String alphabetsInLowerCase = "abcdefghijklmnopqrstuvwxyz"; + String numbers = "0123456789"; + String allCharacters = alphabetsInLowerCase + alphabetsInUpperCase + numbers; + StringBuilder randomString = new StringBuilder(); + Random random = new Random(); + for (int i = 0; i < len; i++) { + int randomIndex = random.nextInt(allCharacters.length()); + randomString.append(allCharacters.charAt(randomIndex)); + } + return randomString.toString(); + } + + public static void main(String[] args) { + LocalMysqlConnectUtil.Init(); + //1、获取母屏数据 + String sql = "select * from data_visualization_info where name =?"; + Record motherRecord = Db.use(DataEaseModel.DB_NAME).findFirst(sql, dataVisualizationName); + long motherId = motherRecord.getLong("id"); + //妈妈的细节表 + sql = "select * from core_chart_view where scene_id=?"; + List motherChartList = Db.use(DataEaseModel.DB_NAME).find(sql, motherId); + + //妈妈的共享链接 + sql = "SELECT * FROM xpack_share WHERE resource_id=?"; + Record motherShareRecord = Db.use(DataEaseModel.DB_NAME).findFirst(sql, motherId); + + //2、需要生成16个城市,这16个城市是哪些 + DataEaseModel dm = new DataEaseModel(); + List cityNameList = dm.getCityNameList(); + + for (String cityName : cityNameList) { + //(1)复制16个大屏 + //复制record对象 + Record cityRecord = new Record().setColumns(motherRecord); + cityRecord.set("name", "教育决策支持系统【市州】" + cityName); + long bigScreenId = getSnowId(); + cityRecord.set("id", bigScreenId); + Db.save("data_visualization_info", "id", cityRecord); + + // (2) 复制16个大屏的细节配置信息 + List writeList = new ArrayList<>(); + for (Record rMotherChart : motherChartList) { + Record rCityChart = new Record().setColumns(rMotherChart);//克隆出来 + //修改大屏ID + rCityChart.set("scene_id", bigScreenId); + writeList.add(rCityChart); + } + //批量保存 + Db.use(DataEaseModel.DB_NAME).batchSave("core_chart_view", writeList, 100); + + // (3) 修改地图中城市 + List list = dm.getMap(bigScreenId); + //core_chart_view表 + for (Record record : list) { + long id = record.getLong("id"); + JSONObject jo = JSONObject.fromObject(record.getStr("custom_attr")); + //获取城市编码 + String area_code = dm.getCityCode(cityName); + //修改前 + System.out.println("修改前=" + jo.getJSONObject("map")); + + //修改城市编码 + jo.getJSONObject("map").put("id", area_code); + jo.getJSONObject("map").put("level", "city"); + + System.out.println("修改后=" + jo.getJSONObject("map")); + //写到数据库 + String jsonString = jo.toString(); + Db.use(DataEaseModel.DB_NAME).update("update core_chart_view set custom_attr=? where id=?", jsonString, id); + } + + // (4) 发布共享链接 + Record shareRecord = new Record().setColumns(motherShareRecord); + shareRecord.set("resource_id", bigScreenId); + shareRecord.set("id", getSnowId()); + shareRecord.set("uuid",randomString(8));//大小写字母和数字组合,长度为8 + Db.save("xpack_share", "id", shareRecord); + } + + System.out.println("生成完毕"); + } +}