Commit 1b6124a0dbbcdb2979f5a1564ce523812d485f74

Authored by YunaiV
1 parent c3f95aa9

集成 Go-View 大屏设计器

Showing 50 changed files with 1023 additions and 64 deletions
README.md
... ... @@ -34,7 +34,7 @@
34 34 * 高效率开发,使用代码生成器可以一键生成前后端代码 + 单元测试 + Swagger 接口文档 + Validator 参数校验
35 35 * 集成微信小程序、微信公众号、企业微信、钉钉等三方登陆,集成支付宝、微信等支付与退款
36 36 * 集成阿里云、腾讯云等短信渠道,集成 MinIO、阿里云、腾讯云、七牛云等云存储服务
37   -* 集成报表设计器,支持数据报表、图形报表、打印设计等
  37 +* 集成报表设计器、大屏设计器,通过拖拽即可生成酷炫的报表与大屏
38 38  
39 39 | 项目名 | 说明 | 传送门 |
40 40 |----------------------|------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
... ... @@ -171,10 +171,10 @@ ps:核心功能已经实现,正在对接微信小程序中...
171 171  
172 172 ### 数据报表
173 173  
174   -| | 功能 | 描述 |
175   -|-----|----------|----------------------------------------------|
176   -| 🚀 | 报表设计器 | 支持数据报表、图形报表、打印设计等 |
177   -| 🚀 | 大屏设计器 | 建设中... 拖拽式实现可视化数据大屏 |
  174 +| | 功能 | 描述 |
  175 +|-----|-------|--------------------|
  176 +| 🚀 | 报表设计器 | 支持数据报表、图形报表、打印设计等 |
  177 +| 🚀 | 大屏设计器 | 拖拽生成数据大屏,内置几十种图表组件 |
178 178  
179 179 ### 微信公众号
180 180  
... ... @@ -207,23 +207,23 @@ ps:核心功能已经实现,正在对接微信小程序中...
207 207  
208 208 ## 🐨 技术栈
209 209  
210   -| 项目 | 说明 |
211   -|------------------------------|--------------------|
212   -| `yudao-dependencies` | Maven 依赖版本管理 |
213   -| `yudao-framework` | Java 框架拓展 |
214   -| `yudao-server` | 管理后台 + 用户 APP 的服务端 |
215   -| `yudao-ui-admin` | 管理后台的 Vue2 前端项目 |
216   -| `yudao-ui-admin-vue3` | 管理后台的 Vue3 前端项目 |
217   -| `yudao-ui-admin-uniapp` | 管理后台的 uni-app 多端项目 |
218   -| `yudao-ui-app` | 用户 APP 的 UI 界面 |
219   -| `yudao-module-system` | 系统功能的 Module 模块 |
220   -| `yudao-module-member` | 会员中心的 Module 模块 |
221   -| `yudao-module-infra` | 基础设施的 Module 模块 |
222   -| `yudao-module-bpm` | 工作流程的 Module 模块 |
223   -| `yudao-module-pay` | 支付系统的 Module 模块 |
224   -| `yudao-module-mall` | 商城系统的 Module 模块 |
225   -| `yudao-module-mp` | 微信公众号的 Module 模块 |
226   -| `yudao-module-visualization` | 大屏报表 Module 模块 |
  210 +| 项目 | 说明 |
  211 +|-------------------------|--------------------|
  212 +| `yudao-dependencies` | Maven 依赖版本管理 |
  213 +| `yudao-framework` | Java 框架拓展 |
  214 +| `yudao-server` | 管理后台 + 用户 APP 的服务端 |
  215 +| `yudao-ui-admin` | 管理后台的 Vue2 前端项目 |
  216 +| `yudao-ui-admin-vue3` | 管理后台的 Vue3 前端项目 |
  217 +| `yudao-ui-admin-uniapp` | 管理后台的 uni-app 多端项目 |
  218 +| `yudao-ui-app` | 用户 APP 的 UI 界面 |
  219 +| `yudao-module-system` | 系统功能的 Module 模块 |
  220 +| `yudao-module-member` | 会员中心的 Module 模块 |
  221 +| `yudao-module-infra` | 基础设施的 Module 模块 |
  222 +| `yudao-module-bpm` | 工作流程的 Module 模块 |
  223 +| `yudao-module-pay` | 支付系统的 Module 模块 |
  224 +| `yudao-module-mall` | 商城系统的 Module 模块 |
  225 +| `yudao-module-mp` | 微信公众号的 Module 模块 |
  226 +| `yudao-module-report` | 大屏报表 Module 模块 |
227 227  
228 228 ### 后端
229 229  
... ... @@ -324,9 +324,10 @@ ps:核心功能已经实现,正在对接微信小程序中...
324 324  
325 325 ### 数据报表
326 326  
327   -| 模块 | biu | biu | biu |
328   -|---------|------------------------------------------------------------------|------------------------------------------------------------------------|------------------------------------------------------------------------|
  327 +| 模块 | biu | biu | biu |
  328 +|-------|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|
329 329 | 报表设计器 | ![数据报表](https://static.iocoder.cn/images/ruoyi-vue-pro/报表设计器-数据报表.jpg?imageView2/2/format/webp/w/1280) | ![图形报表](https://static.iocoder.cn/images/ruoyi-vue-pro/报表设计器-图形报表.jpg?imageView2/2/format/webp/w/1280) | ![报表设计器-打印设计](https://static.iocoder.cn/images/ruoyi-vue-pro/报表设计器-打印设计.jpg?imageView2/2/format/webp/w/1280) |
  330 +| 大屏设计器 | ![大屏列表](https://static.iocoder.cn/images/ruoyi-vue-pro/大屏设计器-列表.jpg?imageView2/2/format/webp/w/1280) | ![大屏预览](https://static.iocoder.cn/images/ruoyi-vue-pro/大屏设计器-预览.jpg?imageView2/2/format/webp/w/1280) | ![大屏编辑](https://static.iocoder.cn/images/ruoyi-vue-pro/大屏设计器-编辑.jpg?imageView2/2/format/webp/w/1280) |
330 331  
331 332 ### 移动端(管理后台)
332 333  
... ...
... ... @@ -18,7 +18,7 @@
18 18 <module>yudao-module-infra</module>
19 19 <module>yudao-module-pay</module>
20 20 <!-- <module>yudao-module-bpm</module>-->
21   -<!-- <module>yudao-module-visualization</module>-->
  21 +<!-- <module>yudao-module-report</module>-->
22 22 <!-- <module>yudao-module-mp</module>-->
23 23 <!-- <module>yudao-module-mall</module>-->
24 24 <!-- 示例项目 -->
... ...
sql/mysql/optional/go-view.sql 0 → 100644
  1 +/*
  2 + Navicat Premium Data Transfer
  3 +
  4 + Source Server : 127.0.0.1 MySQL
  5 + Source Server Type : MySQL
  6 + Source Server Version : 80026
  7 + Source Host : localhost:3306
  8 + Source Schema : ruoyi-vue-pro
  9 +
  10 + Target Server Type : MySQL
  11 + Target Server Version : 80026
  12 + File Encoding : 65001
  13 +
  14 + Date: 07/02/2023 22:00:03
  15 +*/
  16 +
  17 +SET NAMES utf8mb4;
  18 +SET FOREIGN_KEY_CHECKS = 0;
  19 +
  20 +-- ----------------------------
  21 +-- Table structure for report_go_view_project
  22 +-- ----------------------------
  23 +DROP TABLE IF EXISTS `report_go_view_project`;
  24 +CREATE TABLE `report_go_view_project` (
  25 + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
  26 + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '项目名称',
  27 + `pic_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '预览图片 URL',
  28 + `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '报表内容',
  29 + `status` tinyint NOT NULL COMMENT '发布状态',
  30 + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '项目备注',
  31 + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  32 + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  33 + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  34 + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  35 + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  36 + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  37 + PRIMARY KEY (`id`) USING BTREE
  38 +) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'GoView 项目表';
  39 +
  40 +-- ----------------------------
  41 +-- Records of report_go_view_project
  42 +-- ----------------------------
  43 +BEGIN;
  44 +INSERT INTO `report_go_view_project` (`id`, `name`, `pic_url`, `content`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (6, 'HTTP示例', 'http://test.yudao.iocoder.cn/7c0cb26b09cfa97cae0b3e5d19b210978eed0ab184dd0bff1b66b3daf70a01fc.png', '{\n \"editCanvasConfig\": {\n \"projectName\": \"HTTP示例\",\n \"width\": 1920,\n \"height\": 1080,\n \"filterShow\": false,\n \"hueRotate\": 0,\n \"saturate\": 1,\n \"contrast\": 1,\n \"brightness\": 1,\n \"opacity\": 1,\n \"rotateZ\": 0,\n \"rotateX\": 0,\n \"rotateY\": 0,\n \"skewX\": 0,\n \"skewY\": 0,\n \"blendMode\": \"normal\",\n \"background\": null,\n \"backgroundImage\": null,\n \"selectColor\": true,\n \"chartThemeColor\": \"dark\",\n \"chartThemeSetting\": {\n \"title\": {\n \"show\": true,\n \"textStyle\": {\n \"color\": \"#BFBFBF\",\n \"fontSize\": 18\n },\n \"subtextStyle\": {\n \"color\": \"#A2A2A2\",\n \"fontSize\": 14\n }\n },\n \"xAxis\": {\n \"show\": true,\n \"name\": \"\",\n \"nameGap\": 15,\n \"nameTextStyle\": {\n \"color\": \"#B9B8CE\",\n \"fontSize\": 12\n },\n \"inverse\": false,\n \"axisLabel\": {\n \"show\": true,\n \"fontSize\": 12,\n \"color\": \"#B9B8CE\",\n \"rotate\": 0\n },\n \"position\": \"bottom\",\n \"axisLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#B9B8CE\",\n \"width\": 1\n },\n \"onZero\": true\n },\n \"axisTick\": {\n \"show\": true,\n \"length\": 5\n },\n \"splitLine\": {\n \"show\": false,\n \"lineStyle\": {\n \"color\": \"#484753\",\n \"width\": 1,\n \"type\": \"solid\"\n }\n }\n },\n \"yAxis\": {\n \"show\": true,\n \"name\": \"\",\n \"nameGap\": 15,\n \"nameTextStyle\": {\n \"color\": \"#B9B8CE\",\n \"fontSize\": 12\n },\n \"inverse\": false,\n \"axisLabel\": {\n \"show\": true,\n \"fontSize\": 12,\n \"color\": \"#B9B8CE\",\n \"rotate\": 0\n },\n \"position\": \"left\",\n \"axisLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#B9B8CE\",\n \"width\": 1\n },\n \"onZero\": true\n },\n \"axisTick\": {\n \"show\": true,\n \"length\": 5\n },\n \"splitLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#484753\",\n \"width\": 1,\n \"type\": \"solid\"\n }\n }\n },\n \"legend\": {\n \"show\": true,\n \"top\": \"5%\",\n \"textStyle\": {\n \"color\": \"#B9B8CE\"\n }\n },\n \"grid\": {\n \"show\": false,\n \"left\": \"10%\",\n \"top\": \"60\",\n \"right\": \"10%\",\n \"bottom\": \"60\"\n },\n \"dataset\": null\n },\n \"previewScaleType\": \"fit\"\n },\n \"componentList\": [\n {\n \"id\": \"4vxgys8nh6g000\",\n \"isGroup\": false,\n \"attr\": {\n \"x\": 7,\n \"y\": 11,\n \"w\": 1898,\n \"h\": 1066,\n \"offsetX\": 0,\n \"offsetY\": 0,\n \"zIndex\": -1\n },\n \"styles\": {\n \"filterShow\": false,\n \"hueRotate\": 0,\n \"saturate\": 1,\n \"contrast\": 1,\n \"brightness\": 1,\n \"opacity\": 1,\n \"rotateZ\": 0,\n \"rotateX\": 0,\n \"rotateY\": 0,\n \"skewX\": 0,\n \"skewY\": 0,\n \"blendMode\": \"normal\",\n \"animations\": []\n },\n \"status\": {\n \"lock\": false,\n \"hide\": false\n },\n \"request\": {\n \"requestDataType\": 1,\n \"requestHttpType\": \"get\",\n \"requestUrl\": \"http://127.0.0.1:48080/admin-api/report/go-view/data/get-by-http\",\n \"requestInterval\": null,\n \"requestIntervalUnit\": \"second\",\n \"requestContentType\": 0,\n \"requestParamsBodyType\": \"none\",\n \"requestSQLContent\": {\n \"sql\": \"select * from where\"\n },\n \"requestParams\": {\n \"Body\": {\n \"form-data\": {},\n \"x-www-form-urlencoded\": {},\n \"json\": \"\",\n \"xml\": \"\"\n },\n \"Header\": {},\n \"Params\": {}\n }\n },\n \"filter\": null,\n \"events\": {\n \"baseEvent\": {\n \"click\": null,\n \"dblclick\": null,\n \"mouseenter\": null,\n \"mouseleave\": null\n },\n \"advancedEvents\": {\n \"vnodeMounted\": null,\n \"vnodeBeforeMount\": null\n }\n },\n \"key\": \"LineCommon\",\n \"chartConfig\": {\n \"key\": \"LineCommon\",\n \"chartKey\": \"VLineCommon\",\n \"conKey\": \"VCLineCommon\",\n \"title\": \"折线图\",\n \"category\": \"Lines\",\n \"categoryName\": \"折线图\",\n \"package\": \"Charts\",\n \"chartFrame\": \"echarts\",\n \"image\": \"line.png\"\n },\n \"option\": {\n \"legend\": {\n \"show\": true,\n \"top\": \"5%\",\n \"textStyle\": {\n \"color\": \"#B9B8CE\"\n }\n },\n \"xAxis\": {\n \"show\": true,\n \"name\": \"\",\n \"nameGap\": 15,\n \"nameTextStyle\": {\n \"color\": \"#B9B8CE\",\n \"fontSize\": 12\n },\n \"inverse\": false,\n \"axisLabel\": {\n \"show\": true,\n \"fontSize\": 12,\n \"color\": \"#B9B8CE\",\n \"rotate\": 0\n },\n \"position\": \"bottom\",\n \"axisLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#B9B8CE\",\n \"width\": 1\n },\n \"onZero\": true\n },\n \"axisTick\": {\n \"show\": true,\n \"length\": 5\n },\n \"splitLine\": {\n \"show\": false,\n \"lineStyle\": {\n \"color\": \"#484753\",\n \"width\": 1,\n \"type\": \"solid\"\n }\n },\n \"type\": \"category\"\n },\n \"yAxis\": {\n \"show\": true,\n \"name\": \"\",\n \"nameGap\": 15,\n \"nameTextStyle\": {\n \"color\": \"#B9B8CE\",\n \"fontSize\": 12\n },\n \"inverse\": false,\n \"axisLabel\": {\n \"show\": true,\n \"fontSize\": 12,\n \"color\": \"#B9B8CE\",\n \"rotate\": 0\n },\n \"position\": \"left\",\n \"axisLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#B9B8CE\",\n \"width\": 1\n },\n \"onZero\": true\n },\n \"axisTick\": {\n \"show\": true,\n \"length\": 5\n },\n \"splitLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#484753\",\n \"width\": 1,\n \"type\": \"solid\"\n }\n },\n \"type\": \"value\"\n },\n \"grid\": {\n \"show\": false,\n \"left\": \"10%\",\n \"top\": \"60\",\n \"right\": \"10%\",\n \"bottom\": \"60\"\n },\n \"tooltip\": {\n \"show\": true,\n \"trigger\": \"axis\",\n \"axisPointer\": {\n \"type\": \"line\"\n }\n },\n \"dataset\": {\n \"dimensions\": [\n \"日期\",\n \"PV\",\n \"UV\"\n ],\n \"source\": [\n {\n \"UV\": 518,\n \"日期\": \"2021-01\",\n \"PV\": 7954\n },\n {\n \"UV\": 135,\n \"日期\": \"2021-02\",\n \"PV\": 9402\n },\n {\n \"UV\": 905,\n \"日期\": \"2021-03\",\n \"PV\": 1665\n },\n {\n \"UV\": 157,\n \"日期\": \"2021-04\",\n \"PV\": 2633\n },\n {\n \"UV\": 849,\n \"日期\": \"2021-05\",\n \"PV\": 7650\n },\n {\n \"UV\": 563,\n \"日期\": \"2021-06\",\n \"PV\": 2399\n },\n {\n \"UV\": 427,\n \"日期\": \"2021-07\",\n \"PV\": 9952\n },\n {\n \"UV\": 158,\n \"日期\": \"2021-08\",\n \"PV\": 9232\n },\n {\n \"UV\": 894,\n \"日期\": \"2021-09\",\n \"PV\": 3013\n },\n {\n \"UV\": 343,\n \"日期\": \"2021-10\",\n \"PV\": 6181\n },\n {\n \"UV\": 294,\n \"日期\": \"2021-11\",\n \"PV\": 8949\n },\n {\n \"UV\": 452,\n \"日期\": \"2021-12\",\n \"PV\": 8730\n }\n ]\n },\n \"series\": [\n {\n \"type\": \"line\",\n \"label\": {\n \"show\": true,\n \"position\": \"top\",\n \"color\": \"#fff\",\n \"fontSize\": 12\n },\n \"symbolSize\": 5,\n \"itemStyle\": {\n \"color\": null,\n \"borderRadius\": 0\n },\n \"lineStyle\": {\n \"type\": \"solid\",\n \"width\": 3,\n \"color\": null\n }\n },\n {\n \"type\": \"line\",\n \"label\": {\n \"show\": true,\n \"position\": \"top\",\n \"color\": \"#fff\",\n \"fontSize\": 12\n },\n \"symbolSize\": 5,\n \"itemStyle\": {\n \"color\": null,\n \"borderRadius\": 0\n },\n \"lineStyle\": {\n \"type\": \"solid\",\n \"width\": 3,\n \"color\": null\n }\n }\n ],\n \"backgroundColor\": \"rgba(0,0,0,0)\"\n }\n }\n ],\n \"requestGlobalConfig\": {\n \"requestDataPond\": [],\n \"requestOriginUrl\": \"\",\n \"requestInterval\": 30,\n \"requestIntervalUnit\": \"second\",\n \"requestParams\": {\n \"Body\": {\n \"form-data\": {},\n \"x-www-form-urlencoded\": {},\n \"json\": \"\",\n \"xml\": \"\"\n },\n \"Header\": {},\n \"Params\": {}\n }\n }\n}', 0, NULL, '1', '2023-02-07 11:38:22', '1', '2023-02-07 17:27:43', b'0', 1), (7, 'SQL示例', 'http://test.yudao.iocoder.cn/c1f570bad6ec7e7fa4a0a7c8f563da4ea158fde6e731da4dd1abe8ba9b6baeed.png', '{\n \"editCanvasConfig\": {\n \"projectName\": \"SQL示例\",\n \"width\": 1920,\n \"height\": 1080,\n \"filterShow\": false,\n \"hueRotate\": 0,\n \"saturate\": 1,\n \"contrast\": 1,\n \"brightness\": 1,\n \"opacity\": 1,\n \"rotateZ\": 0,\n \"rotateX\": 0,\n \"rotateY\": 0,\n \"skewX\": 0,\n \"skewY\": 0,\n \"blendMode\": \"normal\",\n \"background\": null,\n \"backgroundImage\": null,\n \"selectColor\": true,\n \"chartThemeColor\": \"dark\",\n \"chartThemeSetting\": {\n \"title\": {\n \"show\": true,\n \"textStyle\": {\n \"color\": \"#BFBFBF\",\n \"fontSize\": 18\n },\n \"subtextStyle\": {\n \"color\": \"#A2A2A2\",\n \"fontSize\": 14\n }\n },\n \"xAxis\": {\n \"show\": true,\n \"name\": \"\",\n \"nameGap\": 15,\n \"nameTextStyle\": {\n \"color\": \"#B9B8CE\",\n \"fontSize\": 12\n },\n \"inverse\": false,\n \"axisLabel\": {\n \"show\": true,\n \"fontSize\": 12,\n \"color\": \"#B9B8CE\",\n \"rotate\": 0\n },\n \"position\": \"bottom\",\n \"axisLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#B9B8CE\",\n \"width\": 1\n },\n \"onZero\": true\n },\n \"axisTick\": {\n \"show\": true,\n \"length\": 5\n },\n \"splitLine\": {\n \"show\": false,\n \"lineStyle\": {\n \"color\": \"#484753\",\n \"width\": 1,\n \"type\": \"solid\"\n }\n }\n },\n \"yAxis\": {\n \"show\": true,\n \"name\": \"\",\n \"nameGap\": 15,\n \"nameTextStyle\": {\n \"color\": \"#B9B8CE\",\n \"fontSize\": 12\n },\n \"inverse\": false,\n \"axisLabel\": {\n \"show\": true,\n \"fontSize\": 12,\n \"color\": \"#B9B8CE\",\n \"rotate\": 0\n },\n \"position\": \"left\",\n \"axisLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#B9B8CE\",\n \"width\": 1\n },\n \"onZero\": true\n },\n \"axisTick\": {\n \"show\": true,\n \"length\": 5\n },\n \"splitLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#484753\",\n \"width\": 1,\n \"type\": \"solid\"\n }\n }\n },\n \"legend\": {\n \"show\": true,\n \"top\": \"5%\",\n \"textStyle\": {\n \"color\": \"#B9B8CE\"\n }\n },\n \"grid\": {\n \"show\": false,\n \"left\": \"10%\",\n \"top\": \"60\",\n \"right\": \"10%\",\n \"bottom\": \"60\"\n },\n \"dataset\": null\n },\n \"previewScaleType\": \"fit\"\n },\n \"componentList\": [\n {\n \"id\": \"5cqrghfle9g000\",\n \"isGroup\": false,\n \"attr\": {\n \"x\": 27,\n \"y\": 3,\n \"w\": 1870,\n \"h\": 1051,\n \"offsetX\": 0,\n \"offsetY\": 0,\n \"zIndex\": -1\n },\n \"styles\": {\n \"filterShow\": false,\n \"hueRotate\": 0,\n \"saturate\": 1,\n \"contrast\": 1,\n \"brightness\": 1,\n \"opacity\": 1,\n \"rotateZ\": 0,\n \"rotateX\": 0,\n \"rotateY\": 0,\n \"skewX\": 0,\n \"skewY\": 0,\n \"blendMode\": \"normal\",\n \"animations\": [\n \"headShake\"\n ]\n },\n \"status\": {\n \"lock\": false,\n \"hide\": false\n },\n \"request\": {\n \"requestDataType\": 1,\n \"requestHttpType\": \"post\",\n \"requestUrl\": \"http://127.0.0.1:48080/admin-api/report/go-view/data/get-by-sql\",\n \"requestInterval\": null,\n \"requestIntervalUnit\": \"second\",\n \"requestContentType\": 0,\n \"requestParamsBodyType\": \"none\",\n \"requestSQLContent\": {\n \"sql\": \"SELECT DATE_FORMAT(create_time, \\\"%Y-%m\\\") AS time, COUNT(*) AS \'次数\', COUNT(DISTINCT(user_id)) AS \'人数\' FROM system_login_log GROUP BY DATE_FORMAT(create_time, \\\"%Y-%m\\\")\"\n },\n \"requestParams\": {\n \"Body\": {\n \"form-data\": {},\n \"x-www-form-urlencoded\": {},\n \"json\": \"\",\n \"xml\": \"\"\n },\n \"Header\": {},\n \"Params\": {}\n }\n },\n \"filter\": null,\n \"events\": {\n \"baseEvent\": {\n \"click\": null,\n \"dblclick\": null,\n \"mouseenter\": null,\n \"mouseleave\": null\n },\n \"advancedEvents\": {\n \"vnodeMounted\": null,\n \"vnodeBeforeMount\": null\n }\n },\n \"key\": \"LineCommon\",\n \"chartConfig\": {\n \"key\": \"LineCommon\",\n \"chartKey\": \"VLineCommon\",\n \"conKey\": \"VCLineCommon\",\n \"title\": \"折线图\",\n \"category\": \"Lines\",\n \"categoryName\": \"折线图\",\n \"package\": \"Charts\",\n \"chartFrame\": \"echarts\",\n \"image\": \"line.png\"\n },\n \"option\": {\n \"legend\": {\n \"show\": true,\n \"top\": \"5%\",\n \"textStyle\": {\n \"color\": \"#B9B8CE\"\n }\n },\n \"xAxis\": {\n \"show\": true,\n \"name\": \"\",\n \"nameGap\": 15,\n \"nameTextStyle\": {\n \"color\": \"#B9B8CE\",\n \"fontSize\": 12\n },\n \"inverse\": false,\n \"axisLabel\": {\n \"show\": true,\n \"fontSize\": 12,\n \"color\": \"#B9B8CE\",\n \"rotate\": 0\n },\n \"position\": \"bottom\",\n \"axisLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#B9B8CE\",\n \"width\": 1\n },\n \"onZero\": true\n },\n \"axisTick\": {\n \"show\": true,\n \"length\": 5\n },\n \"splitLine\": {\n \"show\": false,\n \"lineStyle\": {\n \"color\": \"#484753\",\n \"width\": 1,\n \"type\": \"solid\"\n }\n },\n \"type\": \"category\"\n },\n \"yAxis\": {\n \"show\": true,\n \"name\": \"\",\n \"nameGap\": 15,\n \"nameTextStyle\": {\n \"color\": \"#B9B8CE\",\n \"fontSize\": 12\n },\n \"inverse\": false,\n \"axisLabel\": {\n \"show\": true,\n \"fontSize\": 12,\n \"color\": \"#B9B8CE\",\n \"rotate\": 0\n },\n \"position\": \"left\",\n \"axisLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#B9B8CE\",\n \"width\": 1\n },\n \"onZero\": true\n },\n \"axisTick\": {\n \"show\": true,\n \"length\": 5\n },\n \"splitLine\": {\n \"show\": true,\n \"lineStyle\": {\n \"color\": \"#484753\",\n \"width\": 1,\n \"type\": \"solid\"\n }\n },\n \"type\": \"value\"\n },\n \"grid\": {\n \"show\": false,\n \"left\": \"10%\",\n \"top\": \"60\",\n \"right\": \"10%\",\n \"bottom\": \"60\"\n },\n \"tooltip\": {\n \"show\": true,\n \"trigger\": \"axis\",\n \"axisPointer\": {\n \"type\": \"line\"\n }\n },\n \"dataset\": {\n \"dimensions\": [\n \"time\",\n \"次数\",\n \"人数\"\n ],\n \"source\": [\n {\n \"次数\": 94,\n \"time\": \"2022-05\",\n \"人数\": 5\n },\n {\n \"次数\": 120,\n \"time\": \"2022-06\",\n \"人数\": 2\n },\n {\n \"次数\": 118,\n \"time\": \"2022-07\",\n \"人数\": 5\n },\n {\n \"次数\": 37,\n \"time\": \"2022-08\",\n \"人数\": 2\n },\n {\n \"次数\": 65,\n \"time\": \"2022-09\",\n \"人数\": 2\n },\n {\n \"次数\": 35,\n \"time\": \"2022-10\",\n \"人数\": 2\n },\n {\n \"次数\": 86,\n \"time\": \"2022-11\",\n \"人数\": 1\n },\n {\n \"次数\": 49,\n \"time\": \"2022-12\",\n \"人数\": 3\n },\n {\n \"次数\": 45,\n \"time\": \"2023-01\",\n \"人数\": 1\n },\n {\n \"次数\": 70,\n \"time\": \"2023-02\",\n \"人数\": 1\n }\n ]\n },\n \"series\": [\n {\n \"type\": \"line\",\n \"label\": {\n \"show\": true,\n \"position\": \"top\",\n \"color\": \"#fff\",\n \"fontSize\": 12\n },\n \"symbolSize\": 5,\n \"itemStyle\": {\n \"color\": null,\n \"borderRadius\": 0\n },\n \"lineStyle\": {\n \"type\": \"solid\",\n \"width\": 3,\n \"color\": null\n }\n },\n {\n \"type\": \"line\",\n \"label\": {\n \"show\": true,\n \"position\": \"top\",\n \"color\": \"#fff\",\n \"fontSize\": 12\n },\n \"symbolSize\": 5,\n \"itemStyle\": {\n \"color\": null,\n \"borderRadius\": 0\n },\n \"lineStyle\": {\n \"type\": \"solid\",\n \"width\": 3,\n \"color\": null\n }\n }\n ],\n \"backgroundColor\": \"rgba(0,0,0,0)\"\n }\n }\n ],\n \"requestGlobalConfig\": {\n \"requestDataPond\": [],\n \"requestOriginUrl\": \"\",\n \"requestInterval\": 30,\n \"requestIntervalUnit\": \"second\",\n \"requestParams\": {\n \"Body\": {\n \"form-data\": {},\n \"x-www-form-urlencoded\": {},\n \"json\": \"\",\n \"xml\": \"\"\n },\n \"Header\": {},\n \"Params\": {}\n }\n }\n}', 0, NULL, '1', '2023-02-07 11:43:57', '1', '2023-02-07 17:27:40', b'0', 1), (8, '57q2gor533g000', NULL, NULL, 1, NULL, '1', '2023-02-07 19:27:09', '1', '2023-02-07 19:27:09', b'0', 1);
  45 +COMMIT;
  46 +
  47 +SET FOREIGN_KEY_CHECKS = 1;
... ...
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/exception/enums/ServiceErrorCodeRange.java
... ... @@ -31,6 +31,7 @@ public class ServiceErrorCodeRange {
31 31  
32 32 // 模块 infra 错误码区间 [1-001-000-000 ~ 1-002-000-000)
33 33 // 模块 system 错误码区间 [1-002-000-000 ~ 1-003-000-000)
  34 + // 模块 report 错误码区间 [1-003-000-000 ~ 1-004-000-000)
34 35 // 模块 member 错误码区间 [1-004-000-000 ~ 1-005-000-000)
35 36 // 模块 pay 错误码区间 [1-007-000-000 ~ 1-008-000-000)
36 37 // 模块 bpm 错误码区间 [1-009-000-000 ~ 1-010-000-000)
... ...
yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java
... ... @@ -33,8 +33,8 @@ public class BannerApplicationRunner implements ApplicationRunner {
33 33 "https://t.zsxq.com/02B6ujIee");
34 34  
35 35 // 数据报表
36   - if (isNotPresent("cn.iocoder.yudao.module.visualization.framework.security.config.SecurityConfiguration")) {
37   - System.out.println("[报表模块 yudao-module-visualization - 已禁用][参考 https://doc.iocoder.cn/report/ 开启]");
  36 + if (isNotPresent("cn.iocoder.yudao.module.report.framework.security.config.SecurityConfiguration")) {
  37 + System.out.println("[报表模块 yudao-module-report - 已禁用][参考 https://doc.iocoder.cn/report/ 开启]");
38 38 }
39 39 // 工作流
40 40 if (isNotPresent("cn.iocoder.yudao.framework.flowable.config.YudaoFlowableConfiguration")) {
... ...
yudao-module-visualization/pom.xml renamed to yudao-module-report/pom.xml
... ... @@ -9,15 +9,15 @@
9 9 </parent>
10 10 <modelVersion>4.0.0</modelVersion>
11 11 <modules>
12   - <module>yudao-module-visualization-api</module>
13   - <module>yudao-module-visualization-biz</module>
  12 + <module>yudao-module-report-api</module>
  13 + <module>yudao-module-report-biz</module>
14 14 </modules>
15   - <artifactId>yudao-module-visualization</artifactId>
  15 + <artifactId>yudao-module-report</artifactId>
16 16 <packaging>pom</packaging>
17 17  
18 18 <name>${project.artifactId}</name>
19 19 <description>
20   - visualization 模块,主要实现数据可视化报表等功能。
  20 + report 模块,主要实现数据可视化报表等功能。
21 21 </description>
22 22  
23   -</project>
24 23 \ No newline at end of file
  24 +</project>
... ...
yudao-module-visualization/yudao-module-visualization-api/pom.xml renamed to yudao-module-report/yudao-module-report-api/pom.xml
... ... @@ -4,17 +4,17 @@
4 4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5 5 <parent>
6 6 <groupId>cn.iocoder.boot</groupId>
7   - <artifactId>yudao-module-visualization</artifactId>
  7 + <artifactId>yudao-module-report</artifactId>
8 8 <version>${revision}</version>
9 9 </parent>
10 10 <modelVersion>4.0.0</modelVersion>
11 11  
12   - <artifactId>yudao-module-visualization-api</artifactId>
  12 + <artifactId>yudao-module-report-api</artifactId>
13 13 <packaging>jar</packaging>
14 14  
15 15 <name>${project.artifactId}</name>
16 16 <description>
17   - visualization 模块 API,暴露给其它模块调用
  17 + report 模块 API,暴露给其它模块调用
18 18 </description>
19 19  
20 20 <dependencies>
... ... @@ -23,4 +23,4 @@
23 23 <artifactId>yudao-common</artifactId>
24 24 </dependency>
25 25 </dependencies>
26   -</project>
27 26 \ No newline at end of file
  27 +</project>
... ...
yudao-module-report/yudao-module-report-api/src/main/java/cn/iocoder/yudao/module/report/api/package-info.java 0 → 100644
  1 +/**
  2 + * 占位,避免 api 目录无文件时,git 无法提交
  3 + */
  4 +package cn.iocoder.yudao.module.report.api;
... ...
yudao-module-report/yudao-module-report-api/src/main/java/cn/iocoder/yudao/module/report/enums/ErrorCodeConstants.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.enums;
  2 +
  3 +import cn.iocoder.yudao.framework.common.exception.ErrorCode;
  4 +
  5 +/**
  6 + * Report 错误码枚举类
  7 + *
  8 + * system 系统,使用 1-003-000-000 段
  9 + */
  10 +public interface ErrorCodeConstants {
  11 +
  12 + // ========== AUTH 模块 1003000000 ==========
  13 + ErrorCode GO_VIEW_PROJECT_NOT_EXISTS = new ErrorCode(1003000000, "GoView 项目不存在");
  14 +
  15 +}
... ...
yudao-module-visualization/yudao-module-visualization-biz/pom.xml renamed to yudao-module-report/yudao-module-report-biz/pom.xml
... ... @@ -4,23 +4,23 @@
4 4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5 5 <parent>
6 6 <groupId>cn.iocoder.boot</groupId>
7   - <artifactId>yudao-module-visualization</artifactId>
  7 + <artifactId>yudao-module-report</artifactId>
8 8 <version>${revision}</version>
9 9 </parent>
10 10 <modelVersion>4.0.0</modelVersion>
11 11  
12   - <artifactId>yudao-module-visualization-biz</artifactId>
  12 + <artifactId>yudao-module-report-biz</artifactId>
13 13 <packaging>jar</packaging>
14 14  
15 15 <name>${project.artifactId}</name>
16 16 <description>
17   - visualization 模块,主要实现数据可视化报表等功能:
  17 + report 模块,主要实现数据可视化报表等功能:
18 18 1. 基于「积木报表」实现,打印设计、报表设计、图形设计、大屏设计等。
19 19 </description>
20 20 <dependencies>
21 21 <dependency>
22 22 <groupId>cn.iocoder.boot</groupId>
23   - <artifactId>yudao-module-visualization-api</artifactId>
  23 + <artifactId>yudao-module-report-api</artifactId>
24 24 <version>${revision}</version>
25 25 </dependency>
26 26  
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ajreport/package-info.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.controller.admin.ajreport;
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/goview/GoViewDataController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.controller.admin.goview;
  2 +
  3 +import cn.hutool.core.map.MapUtil;
  4 +import cn.hutool.core.util.RandomUtil;
  5 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  6 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  7 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.data.GoViewDataGetBySqlReqVO;
  8 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.data.GoViewDataRespVO;
  9 +import cn.iocoder.yudao.module.report.service.goview.GoViewDataService;
  10 +import io.swagger.v3.oas.annotations.Operation;
  11 +import io.swagger.v3.oas.annotations.tags.Tag;
  12 +import org.springframework.security.access.prepost.PreAuthorize;
  13 +import org.springframework.validation.annotation.Validated;
  14 +import org.springframework.web.bind.annotation.RequestBody;
  15 +import org.springframework.web.bind.annotation.RequestMapping;
  16 +import org.springframework.web.bind.annotation.RequestParam;
  17 +import org.springframework.web.bind.annotation.RestController;
  18 +
  19 +import javax.annotation.Resource;
  20 +import javax.validation.Valid;
  21 +
  22 +import java.util.*;
  23 +
  24 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  25 +
  26 +@Tag(name = "管理后台 - GoView 数据", description = "提供 SQL、HTTP 等数据查询的能力")
  27 +@RestController
  28 +@RequestMapping("/report/go-view/data")
  29 +@Validated
  30 +public class GoViewDataController {
  31 +
  32 + @Resource
  33 + private GoViewDataService goViewDataService;
  34 +
  35 + @RequestMapping("/get-by-sql")
  36 + @Operation(summary = "使用 SQL 查询数据")
  37 + @PreAuthorize("@ss.hasPermission('report:go-view-data:get-by-sql')")
  38 + @OperateLog(enable = false) // 不记录操作日志,因为不需要
  39 + public CommonResult<GoViewDataRespVO> getDataBySQL(@Valid @RequestBody GoViewDataGetBySqlReqVO reqVO) {
  40 + return success(goViewDataService.getDataBySQL(reqVO.getSql()));
  41 + }
  42 +
  43 + @RequestMapping("/get-by-http")
  44 + @Operation(summary = "使用 HTTP 查询数据", description = "这个只是示例接口,实际应该每个查询,都要写一个接口")
  45 + @PreAuthorize("@ss.hasPermission('report:go-view-data:get-by-http')")
  46 + @OperateLog(enable = false) // 不记录操作日志,因为不需要
  47 + public CommonResult<GoViewDataRespVO> getDataByHttp(
  48 + @RequestParam(required = false) Map<String, String> params,
  49 + @RequestBody(required = false) String body) { // params、body 按照需要去接收,这里仅仅是示例
  50 + GoViewDataRespVO respVO = new GoViewDataRespVO();
  51 + // 1. 数据维度
  52 + respVO.setDimensions(Arrays.asList("日期", "PV", "UV")); // PV 是每天访问次数;UV 是每天访问人数
  53 + // 2. 明细数据列表
  54 + // 目前通过随机的方式生成。一般来说,这里你可以写逻辑来实现数据的返回
  55 + respVO.setSource(new LinkedList<>());
  56 + for (int i = 1; i <= 12; i++) {
  57 + String date = "2021-" + (i < 10 ? "0" + i : i);
  58 + Integer pv = RandomUtil.randomInt(1000, 10000);
  59 + Integer uv = RandomUtil.randomInt(100, 1000);
  60 + respVO.getSource().add(MapUtil.<String, Object>builder().put("日期", date)
  61 + .put("PV", pv).put("UV", uv).build());
  62 + }
  63 + return success(respVO);
  64 + }
  65 +
  66 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/goview/GoViewProjectController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.controller.admin.goview;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectCreateReqVO;
  7 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectRespVO;
  8 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectUpdateReqVO;
  9 +import cn.iocoder.yudao.module.report.convert.goview.GoViewProjectConvert;
  10 +import cn.iocoder.yudao.module.report.dal.dataobject.goview.GoViewProjectDO;
  11 +import cn.iocoder.yudao.module.report.service.goview.GoViewProjectService;
  12 +import io.swagger.v3.oas.annotations.Operation;
  13 +import io.swagger.v3.oas.annotations.Parameter;
  14 +import io.swagger.v3.oas.annotations.tags.Tag;
  15 +import org.springframework.jdbc.core.JdbcTemplate;
  16 +import org.springframework.security.access.prepost.PreAuthorize;
  17 +import org.springframework.validation.annotation.Validated;
  18 +import org.springframework.web.bind.annotation.*;
  19 +
  20 +import javax.annotation.Resource;
  21 +import javax.validation.Valid;
  22 +
  23 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  24 +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
  25 +
  26 +@Tag(name = "管理后台 - GoView 项目")
  27 +@RestController
  28 +@RequestMapping("/report/go-view/project")
  29 +@Validated
  30 +public class GoViewProjectController {
  31 +
  32 + @Resource
  33 + private GoViewProjectService goViewProjectService;
  34 +
  35 + @PostMapping("/create")
  36 + @Operation(summary = "创建项目")
  37 + @PreAuthorize("@ss.hasPermission('report:go-view-project:create')")
  38 + public CommonResult<Long> createProject(@Valid @RequestBody GoViewProjectCreateReqVO createReqVO) {
  39 + return success(goViewProjectService.createProject(createReqVO));
  40 + }
  41 +
  42 + @PutMapping("/update")
  43 + @Operation(summary = "更新项目")
  44 + @PreAuthorize("@ss.hasPermission('report:go-view-project:update')")
  45 + public CommonResult<Boolean> updateProject(@Valid @RequestBody GoViewProjectUpdateReqVO updateReqVO) {
  46 + goViewProjectService.updateProject(updateReqVO);
  47 + return success(true);
  48 + }
  49 +
  50 + @DeleteMapping("/delete")
  51 + @Operation(summary = "删除 GoView 项目")
  52 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  53 + @PreAuthorize("@ss.hasPermission('report:go-view-project:delete')")
  54 + public CommonResult<Boolean> deleteProject(@RequestParam("id") Long id) {
  55 + goViewProjectService.deleteProject(id);
  56 + return success(true);
  57 + }
  58 +
  59 + @GetMapping("/get")
  60 + @Operation(summary = "获得项目")
  61 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  62 + @PreAuthorize("@ss.hasPermission('report:go-view-project:query')")
  63 + public CommonResult<GoViewProjectRespVO> getProject(@RequestParam("id") Long id) {
  64 + GoViewProjectDO project = goViewProjectService.getProject(id);
  65 + return success(GoViewProjectConvert.INSTANCE.convert(project));
  66 + }
  67 +
  68 + @GetMapping("/my-page")
  69 + @Operation(summary = "获得我的项目分页")
  70 + @PreAuthorize("@ss.hasPermission('report:go-view-project:query')")
  71 + public CommonResult<PageResult<GoViewProjectRespVO>> getMyProjectPage(@Valid PageParam pageVO) {
  72 + PageResult<GoViewProjectDO> pageResult = goViewProjectService.getMyProjectPage(
  73 + pageVO, getLoginUserId());
  74 + return success(GoViewProjectConvert.INSTANCE.convertPage(pageResult));
  75 + }
  76 +
  77 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/goview/vo/data/GoViewDataGetBySqlReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.controller.admin.goview.vo.data;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.Data;
  5 +
  6 +import javax.validation.constraints.NotEmpty;
  7 +
  8 +@Schema(description = "管理后台 - GoView 使用 SQL 查询数据 Request VO")
  9 +@Data
  10 +public class GoViewDataGetBySqlReqVO {
  11 +
  12 + @Schema(description = "SQL 语句", required = true, example = "SELECT * FROM user")
  13 + @NotEmpty(message = "SQL 语句不能为空")
  14 + private String sql;
  15 +
  16 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/goview/vo/data/GoViewDataRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.controller.admin.goview.vo.data;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.Data;
  5 +
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
  9 +@Schema(description = "管理后台 - GoView 数据 Response VO")
  10 +@Data
  11 +public class GoViewDataRespVO {
  12 +
  13 + @Schema(description = "数据维度", required = true, example = "['product', 'data1', 'data2']")
  14 + private List<String> dimensions;
  15 +
  16 + @Schema(description = "数据明细列表", required = true)
  17 + private List<Map<String, Object>> source;
  18 +
  19 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/goview/vo/project/GoViewProjectCreateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.controller.admin.goview.vo.project;
  2 +
  3 +import lombok.*;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
  5 +import javax.validation.constraints.*;
  6 +
  7 +@Schema(description = "管理后台 - GoView 项目创建 Request VO")
  8 +@Data
  9 +public class GoViewProjectCreateReqVO {
  10 +
  11 + @Schema(description = "项目名称", required = true, example = "王五")
  12 + @NotEmpty(message = "项目名称不能为空")
  13 + private String name;
  14 +
  15 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/goview/vo/project/GoViewProjectRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.controller.admin.goview.vo.project;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +
  6 +import java.time.LocalDateTime;
  7 +
  8 +@Schema(description = "管理后台 - GoView 项目 Response VO")
  9 +@Data
  10 +public class GoViewProjectRespVO {
  11 +
  12 + @Schema(description = "编号", required = true, example = "18993")
  13 + private Long id;
  14 +
  15 + @Schema(description = "项目名称", required = true, example = "王五")
  16 + private String name;
  17 +
  18 + @Schema(description = "发布状态", required = true, example = "1")
  19 + private Integer status;
  20 +
  21 + @Schema(description = "报表内容") // JSON 格式
  22 + private String content;
  23 +
  24 + @Schema(description = "预览图片 URL", example = "https://www.iocoder.cn")
  25 + private String picUrl;
  26 +
  27 + @Schema(description = "项目备注", example = "你猜")
  28 + private String remark;
  29 +
  30 + @Schema(description = "创建人编号", required = true, example = "1024")
  31 + private String creator;
  32 +
  33 + @Schema(description = "创建时间", required = true)
  34 + private LocalDateTime createTime;
  35 +
  36 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/goview/vo/project/GoViewProjectUpdateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.controller.admin.goview.vo.project;
  2 +
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  4 +import cn.iocoder.yudao.framework.common.validation.InEnum;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import lombok.*;
  7 +
  8 +import javax.validation.constraints.*;
  9 +
  10 +@Schema(description = "管理后台 - GoView 项目更新 Request VO")
  11 +@Data
  12 +public class GoViewProjectUpdateReqVO {
  13 +
  14 + @Schema(description = "编号", required = true, example = "18993")
  15 + @NotNull(message = "编号不能为空")
  16 + private Long id;
  17 +
  18 + @Schema(description = "项目名称", required = true, example = "王五")
  19 + private String name;
  20 +
  21 + @Schema(description = "发布状态", required = true, example = "1")
  22 + @InEnum(value = CommonStatusEnum.class, message = "发布状态必须是 {value}")
  23 + private Integer status;
  24 +
  25 + @Schema(description = "报表内容") // JSON 格式
  26 + private String content;
  27 +
  28 + @Schema(description = "预览图片 URL", example = "https://www.iocoder.cn")
  29 + private String picUrl;
  30 +
  31 + @Schema(description = "项目备注", example = "你猜")
  32 + private String remark;
  33 +
  34 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/package-info.java 0 → 100644
  1 +/**
  2 + * 提供 RESTful API 给前端:
  3 + * 1. admin 包:提供给管理后台 yudao-ui-admin 前端项目
  4 + * 2. app 包:提供给用户 APP yudao-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分
  5 + */
  6 +package cn.iocoder.yudao.module.report.controller;
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/convert/ajreport/package-info.java 0 → 100644
  1 +/**
  2 + * TODO 占位,后续删除
  3 + */
  4 +package cn.iocoder.yudao.module.report.convert.ajreport;
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/convert/goview/GoViewProjectConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.convert.goview;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectCreateReqVO;
  5 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectRespVO;
  6 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectUpdateReqVO;
  7 +import cn.iocoder.yudao.module.report.dal.dataobject.goview.GoViewProjectDO;
  8 +import org.mapstruct.Mapper;
  9 +import org.mapstruct.factory.Mappers;
  10 +
  11 +@Mapper
  12 +public interface GoViewProjectConvert {
  13 +
  14 + GoViewProjectConvert INSTANCE = Mappers.getMapper(GoViewProjectConvert.class);
  15 +
  16 + GoViewProjectDO convert(GoViewProjectCreateReqVO bean);
  17 +
  18 + GoViewProjectDO convert(GoViewProjectUpdateReqVO bean);
  19 +
  20 + GoViewProjectRespVO convert(GoViewProjectDO bean);
  21 +
  22 + PageResult<GoViewProjectRespVO> convertPage(PageResult<GoViewProjectDO> page);
  23 +
  24 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/dataobject/ajreport/package-info.java 0 → 100644
  1 +/**
  2 + * TODO 芋艿:占位,待删除
  3 + */
  4 +package cn.iocoder.yudao.module.report.dal.dataobject.ajreport;
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/dataobject/goview/GoViewProjectDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.dal.dataobject.goview;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import com.baomidou.mybatisplus.annotation.KeySequence;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import lombok.*;
  8 +
  9 +/**
  10 + * GoView 项目表
  11 + *
  12 + * 每个大屏图标,对应一个项目
  13 + *
  14 + * @author 芋道源码
  15 + */
  16 +@TableName(value = "report_go_view_project", autoResultMap = true) // 由于 SQL Server 的 system_user 是关键字,所以使用 system_users
  17 +@KeySequence("report_go_view_project_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  18 +@Data
  19 +@EqualsAndHashCode(callSuper = true)
  20 +@Builder
  21 +@NoArgsConstructor
  22 +@AllArgsConstructor
  23 +public class GoViewProjectDO extends BaseDO {
  24 +
  25 + /**
  26 + * 编号,数据库自增
  27 + */
  28 + @TableId
  29 + private Long id;
  30 + /**
  31 + * 项目名称
  32 + */
  33 + private String name;
  34 + /**
  35 + * 预览图片 URL
  36 + */
  37 + private String picUrl;
  38 + /**
  39 + * 报表内容
  40 + *
  41 + * JSON 配置,使用字符串存储
  42 + */
  43 + private String content;
  44 + /**
  45 + * 发布状态
  46 + *
  47 + * 0 - 已发布
  48 + * 1 - 未发布
  49 + *
  50 + * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
  51 + */
  52 + private Integer status;
  53 + /**
  54 + * 项目备注
  55 + */
  56 + private String remark;
  57 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/mysql/ajreport/package-info.java 0 → 100644
  1 +/**
  2 + * TODO 芋艿:占位,待删除
  3 + */
  4 +package cn.iocoder.yudao.module.report.dal.mysql.ajreport;
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/mysql/goview/GoViewProjectMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.dal.mysql.goview;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  5 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.module.report.dal.dataobject.goview.GoViewProjectDO;
  8 +import org.apache.ibatis.annotations.Mapper;
  9 +
  10 +@Mapper
  11 +public interface GoViewProjectMapper extends BaseMapperX<GoViewProjectDO> {
  12 +
  13 + default PageResult<GoViewProjectDO> selectPage(PageParam reqVO, Long userId) {
  14 + return selectPage(reqVO, new LambdaQueryWrapperX<GoViewProjectDO>()
  15 + .eq(GoViewProjectDO::getCreator, userId)
  16 + .orderByDesc(GoViewProjectDO::getId));
  17 + }
  18 +
  19 +}
... ...
yudao-module-visualization/yudao-module-visualization-biz/src/main/java/cn/iocoder/yudao/module/visualization/framework/jmreport/config/JmReportConfiguration.java renamed to yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/jmreport/config/JmReportConfiguration.java
1   -package cn.iocoder.yudao.module.visualization.framework.jmreport.config;
  1 +package cn.iocoder.yudao.module.report.framework.jmreport.config;
2 2  
3 3 import cn.iocoder.yudao.framework.security.config.SecurityProperties;
4 4 import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi;
5   -import cn.iocoder.yudao.module.visualization.framework.jmreport.core.service.JmReportTokenServiceImpl;
  5 +import cn.iocoder.yudao.module.report.framework.jmreport.core.service.JmReportTokenServiceImpl;
6 6 import org.jeecg.modules.jmreport.api.JmReportTokenServiceI;
7 7 import org.springframework.context.annotation.Bean;
8 8 import org.springframework.context.annotation.ComponentScan;
... ...
yudao-module-visualization/yudao-module-visualization-biz/src/main/java/cn/iocoder/yudao/module/visualization/framework/jmreport/core/service/JmReportTokenServiceImpl.java renamed to yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/jmreport/core/service/JmReportTokenServiceImpl.java
1   -package cn.iocoder.yudao.module.visualization.framework.jmreport.core.service;
  1 +package cn.iocoder.yudao.module.report.framework.jmreport.core.service;
2 2  
3 3 import cn.hutool.core.util.ObjectUtil;
4 4 import cn.hutool.core.util.StrUtil;
... ...
yudao-module-visualization/yudao-module-visualization-biz/src/main/java/cn/iocoder/yudao/module/visualization/framework/jmreport/core/web/package-info.java renamed to yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/jmreport/core/web/package-info.java
1 1 /**
2   - * 占位,后续会基于 Filter 实现积木报表的认证等功能,替代 {@link cn.iocoder.yudao.module.visualization.framework.jmreport.core.service.JmReportTokenServiceImpl}
  2 + * 占位,后续会基于 Filter 实现积木报表的认证等功能,替代 {@link cn.iocoder.yudao.module.report.framework.jmreport.core.service.JmReportTokenServiceImpl}
3 3 */
4   -package cn.iocoder.yudao.module.visualization.framework.jmreport.core.web;
  4 +package cn.iocoder.yudao.module.report.framework.jmreport.core.web;
... ...
yudao-module-visualization/yudao-module-visualization-biz/src/main/java/cn/iocoder/yudao/module/visualization/framework/package-info.java renamed to yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/package-info.java
1 1 /**
2   - * 属于 visualization 模块的 framework 封装
  2 + * 属于 report 模块的 framework 封装
3 3 *
4 4 * @author 芋道源码
5 5 */
6   -package cn.iocoder.yudao.module.visualization.framework;
  6 +package cn.iocoder.yudao.module.report.framework;
... ...
yudao-module-visualization/yudao-module-visualization-biz/src/main/java/cn/iocoder/yudao/module/visualization/framework/security/config/SecurityConfiguration.java renamed to yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/security/config/SecurityConfiguration.java
1   -package cn.iocoder.yudao.module.visualization.framework.security.config;
  1 +package cn.iocoder.yudao.module.report.framework.security.config;
2 2  
3 3 import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer;
4 4 import org.springframework.context.annotation.Bean;
... ... @@ -7,12 +7,12 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity;
7 7 import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
8 8  
9 9 /**
10   - * Visualization 模块的 Security 配置
  10 + * Report 模块的 Security 配置
11 11 */
12   -@Configuration("visualizationSecurityConfiguration")
  12 +@Configuration("reportSecurityConfiguration")
13 13 public class SecurityConfiguration {
14 14  
15   - @Bean("visualizationAuthorizeRequestsCustomizer")
  15 + @Bean("reportAuthorizeRequestsCustomizer")
16 16 public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
17 17 return new AuthorizeRequestsCustomizer() {
18 18  
... ...
yudao-module-visualization/yudao-module-visualization-biz/src/main/java/cn/iocoder/yudao/module/visualization/framework/security/core/package-info.java renamed to yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/security/core/package-info.java
1 1 /**
2 2 * 占位
3 3 */
4   -package cn.iocoder.yudao.module.visualization.framework.security.core;
  4 +package cn.iocoder.yudao.module.report.framework.security.core;
... ...
yudao-module-visualization/yudao-module-visualization-biz/src/main/java/cn/iocoder/yudao/module/visualization/framework/ureport/package-info.java renamed to yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/package-info.java
... ... @@ -4,4 +4,4 @@
4 4 * ureport2 和 jimurepot 是相同类型的产品,不过停更了,最好发布时间是 2018 年。
5 5 * 它们之间的功能对比,可见 https://juejin.cn/post/6939836480269320200 地址
6 6 */
7   -package cn.iocoder.yudao.module.visualization.framework.ureport;
  7 +package cn.iocoder.yudao.module.report.framework.ureport;
... ...
yudao-module-visualization/yudao-module-visualization-biz/src/main/java/cn/iocoder/yudao/module/visualization/package-info.java renamed to yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/package-info.java
1 1 /**
2   - * visualization 模块,主要实现数据可视化报表等功能:
  2 + * report 模块,主要实现数据可视化报表等功能:
3 3 * 1. 基于「积木报表」实现,打印设计、报表设计、图形设计、大屏设计等。URL 前缀是 /jmreport,表名前缀是 jimu_
4 4 *
5 5 * 由于「积木报表」的大屏设计器需要收费,后续会自研,对应的是:
6   - * 1. Controller URL:以 /visualization/ 开头,避免和其它 Module 冲突
7   - * 2. DataObject 表名:以 visualization_ 开头,方便在数据库中区分
  6 + * 1. Controller URL:以 /report/ 开头,避免和其它 Module 冲突
  7 + * 2. DataObject 表名:以 report_ 开头,方便在数据库中区分
8 8 */
9   -package cn.iocoder.yudao.module.visualization;
  9 +package cn.iocoder.yudao.module.report;
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ajreport/package-info.java 0 → 100644
  1 +/**
  2 + * TODO 芋艿:占位,待删除
  3 + */
  4 +package cn.iocoder.yudao.module.report.service.ajreport;
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/goview/GoViewDataService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.service.goview;
  2 +
  3 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.data.GoViewDataRespVO;
  4 +
  5 +/**
  6 + * GoView 数据 Service 接口
  7 + *
  8 + * @author 芋道源码
  9 + */
  10 +public interface GoViewDataService {
  11 +
  12 + /**
  13 + * 使用 SQL 查询数据
  14 + *
  15 + * @param sql SQL 语句
  16 + * @return 数据
  17 + */
  18 + GoViewDataRespVO getDataBySQL(String sql);
  19 +
  20 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/goview/GoViewDataServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.service.goview;
  2 +
  3 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.data.GoViewDataRespVO;
  4 +import com.google.common.collect.Maps;
  5 +import org.springframework.jdbc.core.JdbcTemplate;
  6 +import org.springframework.jdbc.support.rowset.SqlRowSet;
  7 +import org.springframework.jdbc.support.rowset.SqlRowSetMetaData;
  8 +import org.springframework.stereotype.Service;
  9 +import org.springframework.validation.annotation.Validated;
  10 +
  11 +import javax.annotation.Resource;
  12 +import java.util.Arrays;
  13 +import java.util.LinkedList;
  14 +import java.util.Map;
  15 +
  16 +/**
  17 + * GoView 数据 Service 实现类
  18 + *
  19 + * 补充说明:
  20 + * 1. 目前默认使用 jdbcTemplate 查询项目配置的数据源。如果你想查询其它数据源,可以新建对应数据源的 jdbcTemplate 来实现。
  21 + * 2. 默认数据源是 MySQL 关系数据源,可能数据量比较大的情况下,会比较慢,可以考虑后续使用 Click House 等等。
  22 + *
  23 + * @author 芋道源码
  24 + */
  25 +@Service
  26 +@Validated
  27 +public class GoViewDataServiceImpl implements GoViewDataService {
  28 +
  29 + @Resource
  30 + private JdbcTemplate jdbcTemplate;
  31 +
  32 + @Override
  33 + public GoViewDataRespVO getDataBySQL(String sql) {
  34 + // 1. 执行查询
  35 + SqlRowSet sqlRowSet = jdbcTemplate.queryForRowSet(sql);
  36 +
  37 + // 2. 构建返回结果
  38 + GoViewDataRespVO respVO = new GoViewDataRespVO();
  39 + // 2.1 解析元数据
  40 + SqlRowSetMetaData metaData = sqlRowSet.getMetaData();
  41 + String[] columnNames = metaData.getColumnNames();
  42 + respVO.setDimensions(Arrays.asList(columnNames));
  43 + // 2.2 解析数据明细
  44 + respVO.setSource(new LinkedList<>()); // 由于数据量不确认,使用 LinkedList 虽然内存占用大一点,但是不存在扩容复制的问题
  45 + while (sqlRowSet.next()) {
  46 + Map<String, Object> data = Maps.newHashMapWithExpectedSize(columnNames.length);
  47 + for (String columnName : columnNames) {
  48 + data.put(columnName, sqlRowSet.getObject(columnName));
  49 + }
  50 + respVO.getSource().add(data);
  51 + }
  52 + return respVO;
  53 + }
  54 +
  55 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/goview/GoViewProjectService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.service.goview;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  5 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectCreateReqVO;
  6 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectUpdateReqVO;
  7 +import cn.iocoder.yudao.module.report.dal.dataobject.goview.GoViewProjectDO;
  8 +
  9 +import javax.validation.Valid;
  10 +
  11 +/**
  12 + * GoView 项目 Service 接口
  13 + *
  14 + * @author 芋道源码
  15 + */
  16 +public interface GoViewProjectService {
  17 +
  18 + /**
  19 + * 创建项目
  20 + *
  21 + * @param createReqVO 创建信息
  22 + * @return 编号
  23 + */
  24 + Long createProject(@Valid GoViewProjectCreateReqVO createReqVO);
  25 +
  26 + /**
  27 + * 更新项目
  28 + *
  29 + * @param updateReqVO 更新信息
  30 + */
  31 + void updateProject(@Valid GoViewProjectUpdateReqVO updateReqVO);
  32 +
  33 + /**
  34 + * 删除项目
  35 + *
  36 + * @param id 编号
  37 + */
  38 + void deleteProject(Long id);
  39 +
  40 + /**
  41 + * 获得项目
  42 + *
  43 + * @param id 编号
  44 + * @return 项目
  45 + */
  46 + GoViewProjectDO getProject(Long id);
  47 +
  48 + /**
  49 + * 获得我的项目分页
  50 + *
  51 + * @param pageReqVO 分页查询
  52 + * @param userId 用户编号
  53 + * @return GoView 项目分页
  54 + */
  55 + PageResult<GoViewProjectDO> getMyProjectPage(PageParam pageReqVO, Long userId);
  56 +
  57 +}
... ...
yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/goview/GoViewProjectServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.service.goview;
  2 +
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectCreateReqVO;
  7 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectUpdateReqVO;
  8 +import cn.iocoder.yudao.module.report.convert.goview.GoViewProjectConvert;
  9 +import cn.iocoder.yudao.module.report.dal.dataobject.goview.GoViewProjectDO;
  10 +import cn.iocoder.yudao.module.report.dal.mysql.goview.GoViewProjectMapper;
  11 +import org.springframework.stereotype.Service;
  12 +import org.springframework.validation.annotation.Validated;
  13 +
  14 +import javax.annotation.Resource;
  15 +
  16 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  17 +import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.GO_VIEW_PROJECT_NOT_EXISTS;
  18 +
  19 +/**
  20 + * GoView 项目 Service 实现类
  21 + *
  22 + * @author 芋道源码
  23 + */
  24 +@Service
  25 +@Validated
  26 +public class GoViewProjectServiceImpl implements GoViewProjectService {
  27 +
  28 + @Resource
  29 + private GoViewProjectMapper goViewProjectMapper;
  30 +
  31 + @Override
  32 + public Long createProject(GoViewProjectCreateReqVO createReqVO) {
  33 + // 插入
  34 + GoViewProjectDO goViewProject = GoViewProjectConvert.INSTANCE.convert(createReqVO)
  35 + .setStatus(CommonStatusEnum.DISABLE.getStatus());
  36 + goViewProjectMapper.insert(goViewProject);
  37 + // 返回
  38 + return goViewProject.getId();
  39 + }
  40 +
  41 + @Override
  42 + public void updateProject(GoViewProjectUpdateReqVO updateReqVO) {
  43 + // 校验存在
  44 + validateProjectExists(updateReqVO.getId());
  45 + // 更新
  46 + GoViewProjectDO updateObj = GoViewProjectConvert.INSTANCE.convert(updateReqVO);
  47 + goViewProjectMapper.updateById(updateObj);
  48 + }
  49 +
  50 + @Override
  51 + public void deleteProject(Long id) {
  52 + // 校验存在
  53 + validateProjectExists(id);
  54 + // 删除
  55 + goViewProjectMapper.deleteById(id);
  56 + }
  57 +
  58 + private void validateProjectExists(Long id) {
  59 + if (goViewProjectMapper.selectById(id) == null) {
  60 + throw exception(GO_VIEW_PROJECT_NOT_EXISTS);
  61 + }
  62 + }
  63 +
  64 + @Override
  65 + public GoViewProjectDO getProject(Long id) {
  66 + return goViewProjectMapper.selectById(id);
  67 + }
  68 +
  69 + @Override
  70 + public PageResult<GoViewProjectDO> getMyProjectPage(PageParam pageReqVO, Long userId) {
  71 + return goViewProjectMapper.selectPage(pageReqVO, userId);
  72 + }
  73 +
  74 +}
... ...
yudao-module-report/yudao-module-report-biz/src/test/java/cn/iocoder/yudao/module/report/service/goview/GoViewDataServiceImplTest.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.service.goview;
  2 +
  3 +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
  4 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.data.GoViewDataRespVO;
  5 +import org.junit.jupiter.api.Test;
  6 +import org.springframework.boot.test.mock.mockito.MockBean;
  7 +import org.springframework.context.annotation.Import;
  8 +import org.springframework.jdbc.core.JdbcTemplate;
  9 +import org.springframework.jdbc.support.rowset.SqlRowSet;
  10 +import org.springframework.jdbc.support.rowset.SqlRowSetMetaData;
  11 +
  12 +import javax.annotation.Resource;
  13 +import java.util.Arrays;
  14 +
  15 +import static org.junit.jupiter.api.Assertions.assertEquals;
  16 +import static org.mockito.ArgumentMatchers.eq;
  17 +import static org.mockito.Mockito.mock;
  18 +import static org.mockito.Mockito.when;
  19 +
  20 +@Import(GoViewDataServiceImpl.class)
  21 +public class GoViewDataServiceImplTest extends BaseDbUnitTest {
  22 +
  23 + @Resource
  24 + private GoViewDataServiceImpl goViewDataService;
  25 +
  26 + @MockBean
  27 + private JdbcTemplate jdbcTemplate;
  28 +
  29 + @Test
  30 + public void testGetDataBySQL() {
  31 + // 准备参数
  32 + String sql = "SELECT id, name FROM system_users";
  33 + // mock 方法
  34 + SqlRowSet sqlRowSet = mock(SqlRowSet.class);
  35 + when(jdbcTemplate.queryForRowSet(eq(sql))).thenReturn(sqlRowSet);
  36 + // mock 元数据
  37 + SqlRowSetMetaData metaData = mock(SqlRowSetMetaData.class);
  38 + when(sqlRowSet.getMetaData()).thenReturn(metaData);
  39 + when(metaData.getColumnNames()).thenReturn(new String[]{"id", "name"});
  40 + // mock 数据明细
  41 + when(sqlRowSet.next()).thenReturn(true).thenReturn(true).thenReturn(false);
  42 + when(sqlRowSet.getObject("id")).thenReturn(1L).thenReturn(2L);
  43 + when(sqlRowSet.getObject("name")).thenReturn("芋道源码").thenReturn("芋道");
  44 +
  45 + // 调用
  46 + GoViewDataRespVO dataBySQL = goViewDataService.getDataBySQL(sql);
  47 + // 断言
  48 + assertEquals(Arrays.asList("id", "name"), dataBySQL.getDimensions());
  49 + assertEquals(2, dataBySQL.getDimensions().size());
  50 + assertEquals(2, dataBySQL.getSource().get(0).size());
  51 + assertEquals(1L, dataBySQL.getSource().get(0).get("id"));
  52 + assertEquals("芋道源码", dataBySQL.getSource().get(0).get("name"));
  53 + assertEquals(2, dataBySQL.getSource().get(1).size());
  54 + assertEquals(2L, dataBySQL.getSource().get(1).get("id"));
  55 + assertEquals("芋道", dataBySQL.getSource().get(1).get("name"));
  56 + }
  57 +
  58 +}
... ...
yudao-module-report/yudao-module-report-biz/src/test/java/cn/iocoder/yudao/module/report/service/goview/GoViewProjectServiceImplTest.java 0 → 100644
  1 +package cn.iocoder.yudao.module.report.service.goview;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  5 +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
  6 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectCreateReqVO;
  7 +import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewProjectUpdateReqVO;
  8 +import cn.iocoder.yudao.module.report.dal.dataobject.goview.GoViewProjectDO;
  9 +import cn.iocoder.yudao.module.report.dal.mysql.goview.GoViewProjectMapper;
  10 +import org.junit.jupiter.api.Test;
  11 +import org.springframework.context.annotation.Import;
  12 +
  13 +import javax.annotation.Resource;
  14 +
  15 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
  16 +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
  17 +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
  18 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
  19 +import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.GO_VIEW_PROJECT_NOT_EXISTS;
  20 +import static org.junit.jupiter.api.Assertions.*;
  21 +
  22 +/**
  23 + * {@link GoViewProjectServiceImpl} 的单元测试类
  24 + *
  25 + * @author 芋道源码
  26 + */
  27 +@Import(GoViewProjectServiceImpl.class)
  28 +public class GoViewProjectServiceImplTest extends BaseDbUnitTest {
  29 +
  30 + @Resource
  31 + private GoViewProjectServiceImpl goViewProjectService;
  32 +
  33 + @Resource
  34 + private GoViewProjectMapper goViewProjectMapper;
  35 +
  36 + @Test
  37 + public void testCreateProject_success() {
  38 + // 准备参数
  39 + GoViewProjectCreateReqVO reqVO = randomPojo(GoViewProjectCreateReqVO.class);
  40 +
  41 + // 调用
  42 + Long goViewProjectId = goViewProjectService.createProject(reqVO);
  43 + // 断言
  44 + assertNotNull(goViewProjectId);
  45 + // 校验记录的属性是否正确
  46 + GoViewProjectDO goViewProject = goViewProjectMapper.selectById(goViewProjectId);
  47 + assertPojoEquals(reqVO, goViewProject);
  48 + }
  49 +
  50 + @Test
  51 + public void testUpdateProject_success() {
  52 + // mock 数据
  53 + GoViewProjectDO dbGoViewProject = randomPojo(GoViewProjectDO.class);
  54 + goViewProjectMapper.insert(dbGoViewProject);// @Sql: 先插入出一条存在的数据
  55 + // 准备参数
  56 + GoViewProjectUpdateReqVO reqVO = randomPojo(GoViewProjectUpdateReqVO.class, o -> {
  57 + o.setId(dbGoViewProject.getId()); // 设置更新的 ID
  58 + o.setStatus(randomCommonStatus());
  59 + });
  60 +
  61 + // 调用
  62 + goViewProjectService.updateProject(reqVO);
  63 + // 校验是否更新正确
  64 + GoViewProjectDO goViewProject = goViewProjectMapper.selectById(reqVO.getId()); // 获取最新的
  65 + assertPojoEquals(reqVO, goViewProject);
  66 + }
  67 +
  68 + @Test
  69 + public void testUpdateProject_notExists() {
  70 + // 准备参数
  71 + GoViewProjectUpdateReqVO reqVO = randomPojo(GoViewProjectUpdateReqVO.class);
  72 +
  73 + // 调用, 并断言异常
  74 + assertServiceException(() -> goViewProjectService.updateProject(reqVO), GO_VIEW_PROJECT_NOT_EXISTS);
  75 + }
  76 +
  77 + @Test
  78 + public void testDeleteProject_success() {
  79 + // mock 数据
  80 + GoViewProjectDO dbGoViewProject = randomPojo(GoViewProjectDO.class);
  81 + goViewProjectMapper.insert(dbGoViewProject);// @Sql: 先插入出一条存在的数据
  82 + // 准备参数
  83 + Long id = dbGoViewProject.getId();
  84 +
  85 + // 调用
  86 + goViewProjectService.deleteProject(id);
  87 + // 校验数据不存在了
  88 + assertNull(goViewProjectMapper.selectById(id));
  89 + }
  90 +
  91 + @Test
  92 + public void testDeleteProject_notExists() {
  93 + // 准备参数
  94 + Long id = randomLongId();
  95 +
  96 + // 调用, 并断言异常
  97 + assertServiceException(() -> goViewProjectService.deleteProject(id), GO_VIEW_PROJECT_NOT_EXISTS);
  98 + }
  99 +
  100 + @Test
  101 + public void testGetProject() {
  102 + // mock 数据
  103 + GoViewProjectDO dbGoViewProject = randomPojo(GoViewProjectDO.class);
  104 + goViewProjectMapper.insert(dbGoViewProject);// @Sql: 先插入出一条存在的数据
  105 + // 准备参数
  106 + Long id = dbGoViewProject.getId();
  107 +
  108 + // 调用
  109 + GoViewProjectDO goViewProject = goViewProjectService.getProject(id);
  110 + // 断言
  111 + assertPojoEquals(dbGoViewProject, goViewProject);
  112 + }
  113 +
  114 + @Test
  115 + public void testGetMyGoViewProjectPage() {
  116 + // mock 数据
  117 + GoViewProjectDO dbGoViewProject = randomPojo(GoViewProjectDO.class, o -> { // 等会查询到
  118 + o.setCreator("1");
  119 + });
  120 + goViewProjectMapper.insert(dbGoViewProject);
  121 + // 测试 userId 不匹配
  122 + goViewProjectMapper.insert(cloneIgnoreId(dbGoViewProject, o -> o.setCreator("2")));
  123 + // 准备参数
  124 + PageParam reqVO = new PageParam();
  125 + Long userId = 1L;
  126 +
  127 + // 调用
  128 + PageResult<GoViewProjectDO> pageResult = goViewProjectService.getMyProjectPage(reqVO, userId);
  129 + // 断言
  130 + assertEquals(1, pageResult.getTotal());
  131 + assertEquals(1, pageResult.getList().size());
  132 + assertPojoEquals(dbGoViewProject, pageResult.getList().get(0));
  133 + }
  134 +
  135 +}
... ...
yudao-module-report/yudao-module-report-biz/src/test/resources/application-unit-test.yaml 0 → 100644
  1 +spring:
  2 + main:
  3 + lazy-initialization: true # 开启懒加载,加快速度
  4 + banner-mode: off # 单元测试,禁用 Banner
  5 +
  6 +--- #################### 数据库相关配置 ####################
  7 +
  8 +spring:
  9 + # 数据源配置项
  10 + datasource:
  11 + name: ruoyi-vue-pro
  12 + url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=value; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写
  13 + driver-class-name: org.h2.Driver
  14 + username: sa
  15 + password:
  16 + druid:
  17 + async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度
  18 + initial-size: 1 # 单元测试,配置为 1,提升启动速度
  19 + sql:
  20 + init:
  21 + schema-locations: classpath:/sql/create_tables.sql
  22 +
  23 + # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
  24 + redis:
  25 + host: 127.0.0.1 # 地址
  26 + port: 16379 # 端口(单元测试,使用 16379 端口)
  27 + database: 0 # 数据库索引
  28 +
  29 +
  30 +mybatis:
  31 + lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试
  32 +
  33 +--- #################### 定时任务相关配置 ####################
  34 +
  35 +--- #################### 配置中心相关配置 ####################
  36 +
  37 +--- #################### 服务保障相关配置 ####################
  38 +
  39 +# Lock4j 配置项(单元测试,禁用 Lock4j)
  40 +
  41 +# Resilience4j 配置项
  42 +
  43 +--- #################### 监控相关配置 ####################
  44 +
  45 +--- #################### 芋道相关配置 ####################
  46 +
  47 +# 芋道配置项,设置当前项目所有自定义的配置
  48 +yudao:
  49 + info:
  50 + base-package: cn.iocoder.yudao.module
  51 + captcha:
  52 + timeout: 5m
  53 + width: 160
  54 + height: 60
  55 + enable: true
... ...
yudao-module-report/yudao-module-report-biz/src/test/resources/logback.xml 0 → 100644
  1 +<configuration>
  2 + <!-- 引用 Spring Boot 的 logback 基础配置 -->
  3 + <include resource="org/springframework/boot/logging/logback/defaults.xml" />
  4 +</configuration>
... ...
yudao-module-report/yudao-module-report-biz/src/test/resources/sql/clean.sql 0 → 100644
  1 +DELETE FROM "report_go_view_project";
... ...
yudao-module-report/yudao-module-report-biz/src/test/resources/sql/create_tables.sql 0 → 100644
  1 +CREATE TABLE IF NOT EXISTS "report_go_view_project" (
  2 + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  3 + "name" varchar NOT NULL,
  4 + "pic_url" varchar,
  5 + "content" varchar,
  6 + "status" varchar NOT NULL,
  7 + "remark" varchar,
  8 + "creator" varchar DEFAULT '',
  9 + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  10 + "updater" varchar DEFAULT '',
  11 + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  12 + "deleted" bit NOT NULL DEFAULT FALSE,
  13 + PRIMARY KEY ("id")
  14 +) COMMENT 'GoView 项目表';
... ...
yudao-server/pom.xml
... ... @@ -44,7 +44,7 @@
44 44 <!-- 数据报表 -->
45 45 <!-- <dependency>-->
46 46 <!-- <groupId>cn.iocoder.boot</groupId>-->
47   -<!-- <artifactId>yudao-module-visualization-biz</artifactId>-->
  47 +<!-- <artifactId>yudao-module-report-biz</artifactId>-->
48 48 <!-- <version>${revision}</version>-->
49 49 <!-- </dependency>-->
50 50 <!-- 工作流 -->
... ...
yudao-ui-admin-vue3/pnpm-lock.yaml
... ... @@ -45,7 +45,7 @@ specifiers:
45 45 eslint-plugin-prettier: ^4.2.1
46 46 eslint-plugin-vue: ^9.9.0
47 47 fast-xml-parser: ^4.0.13
48   - highlight.js: ^9.18.5
  48 + highlight.js: ^11.7.0
49 49 intro.js: ^6.0.0
50 50 jsencrypt: ^3.3.1
51 51 lint-staged: ^13.1.0
... ... @@ -63,6 +63,7 @@ specifiers:
63 63 rimraf: ^4.1.2
64 64 rollup: ^3.11.0
65 65 sass: ^1.57.1
  66 + steady-xml: ^0.1.0
66 67 stylelint: ^14.16.1
67 68 stylelint-config-html: ^1.1.0
68 69 stylelint-config-prettier: ^9.0.4
... ... @@ -117,7 +118,7 @@ dependencies:
117 118 echarts-wordcloud: 2.1.0_echarts@5.4.1
118 119 element-plus: 2.2.28_vue@3.2.45
119 120 fast-xml-parser: 4.0.15
120   - highlight.js: 9.18.5
  121 + highlight.js: 11.7.0
121 122 intro.js: 6.0.0
122 123 jsencrypt: 3.3.1
123 124 lodash-es: 4.17.21
... ... @@ -127,6 +128,7 @@ dependencies:
127 128 pinia: 2.0.29_typescript@4.9.4+vue@3.2.45
128 129 qrcode: 1.5.1
129 130 qs: 6.11.0
  131 + steady-xml: 0.1.0
130 132 url: 0.11.0
131 133 vue: 3.2.45
132 134 vue-i18n: 9.2.2_vue@3.2.45
... ... @@ -3944,10 +3946,9 @@ packages:
3944 3946 hasBin: true
3945 3947 dev: true
3946 3948  
3947   - /highlight.js/9.18.5:
3948   - resolution: {integrity: sha512-a5bFyofd/BHCX52/8i8uJkjr9DYwXIPnM/plwI6W7ezItLGqzt7X2G2nXuYSfsIJdkwwj/g9DG1LkcGJI/dDoA==}
3949   - deprecated: Support has ended for 9.x series. Upgrade to @latest
3950   - requiresBuild: true
  3949 + /highlight.js/11.7.0:
  3950 + resolution: {integrity: sha512-1rRqesRFhMO/PRF+G86evnyJkCgaZFOI+Z6kdj15TA18funfoqJXvgPCLSf0SWq3SRfg1j3HlDs8o4s3EGq1oQ==}
  3951 + engines: {node: '>=12.0.0'}
3951 3952 dev: false
3952 3953  
3953 3954 /hosted-git-info/2.8.9:
... ... @@ -5908,6 +5909,11 @@ packages:
5908 5909 object-copy: 0.1.0
5909 5910 dev: true
5910 5911  
  5912 + /steady-xml/0.1.0:
  5913 + resolution: {integrity: sha512-5sk17qO2wWRtonTNoBhoKAB35OSsGJOa3+NEa6D+1GS+de+ujDWxnflMkXBrviOfkNrPTUqduAdXhrMJs89nAw==}
  5914 + engines: {node: '>=12.0.0'}
  5915 + dev: false
  5916 +
5911 5917 /strict-uri-encode/1.1.0:
5912 5918 resolution: {integrity: sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==}
5913 5919 engines: {node: '>=0.10.0'}
... ...
yudao-ui-admin-vue3/src/views/report/goview/index.vue 0 → 100644
  1 +<template>
  2 + <ContentWrap>
  3 + <IFrame :src="src" />
  4 + </ContentWrap>
  5 +</template>
  6 +<script setup lang="ts" name="GoView">
  7 +const src = 'http://127.0.0.1:3000'
  8 +</script>
... ...
yudao-ui-admin-vue3/src/views/visualization/jmreport/index.vue renamed to yudao-ui-admin-vue3/src/views/report/jmreport/index.vue
yudao-ui-admin/src/views/report/goview/index.vue 0 → 100644
  1 +<template>
  2 + <div>
  3 + <doc-alert title="大屏设计器" url="https://doc.iocoder.cn/report/" />
  4 + <i-frame :src="url" />
  5 + </div>
  6 +</template>
  7 +<script>
  8 +import iFrame from "@/components/iFrame/index";
  9 +export default {
  10 + name: "GoView",
  11 + components: { iFrame },
  12 + data() {
  13 + return {
  14 + url: 'http://127.0.0.1:3000',
  15 + };
  16 + },
  17 +};
  18 +</script>
... ...
yudao-ui-admin/src/views/visualization/jmreport/index.vue renamed to yudao-ui-admin/src/views/report/jmreport/index.vue