From 46dde2ccfc908248eb5303e7f0136c16268aaf58 Mon Sep 17 00:00:00 2001 From: qianming Date: Wed, 26 Jan 2022 16:20:44 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E6=8A=98=E7=BA=BF=E5=AF=B9=E6=AF=94?= =?UTF-8?q?=E5=9B=BE=E5=9B=BE=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/line/widgetLineCompareChart.vue | 68 +++++++++++++------ 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineCompareChart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineCompareChart.vue index b7c057e6..e71d3b6c 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineCompareChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineCompareChart.vue @@ -533,9 +533,9 @@ export default { const legend = this.options.legend; legend.show = optionsSetup.isShowLegend; legend.left = optionsSetup.lateralPosition; - legend.top = optionsSetup.longitudinalPosition == "top" ? 0 : "auto"; + legend.top = optionsSetup.longitudinalPosition; legend.bottom = - optionsSetup.longitudinalPosition == "bottom" ? 0 : "auto"; + optionsSetup.longitudinalPosition; legend.orient = optionsSetup.layoutFront; legend.textStyle = { color: optionsSetup.lengedColor, @@ -543,6 +543,25 @@ export default { }; legend.itemWidth = optionsSetup.lengedWidth; }, + // 图例名称设置 + setOptionsLegendName(name){ + const optionsSetup = this.optionsSetup; + const series = this.options.series; + const legendName = optionsSetup.legendName; + // 图例没有手动写则显示原值,写了则显示新值 + if (null == legendName || legendName == '') { + for (let i = 0; i < name.length; i++) { + series[i].name = name[i]; + } + this.options.legend['data'] = name; + }else { + const arr = legendName.split('|'); + for (let i = 0; i < arr.length; i++) { + series[i].name = arr[i]; + } + this.options.legend['data'] = arr + } + }, // 颜色修改、宽度修改 setOptionsColor() { const optionsSetup = this.optionsSetup; @@ -591,19 +610,20 @@ export default { let xAxisList = []; let yAxisList = []; let arrayList = []; + const legendName = []; for (const i in val) { - xAxisList[i] = val[i].axis - yAxisList[i] = val[i].name + xAxisList[i] = val[i].axis; + yAxisList[i] = val[i].name; } - xAxisList = this.setUnique(xAxisList) - yAxisList = this.setUnique(yAxisList) + xAxisList = this.setUnique(xAxisList); + yAxisList = this.setUnique(yAxisList); for (const i in yAxisList) { - const data = new Array(yAxisList.length).fill(0) + const data = new Array(yAxisList.length).fill(0); for (const j in xAxisList) { for (const k in val) { if (val[k].name == yAxisList[i]) { if (val[k].axis == xAxisList[j]) { - data[j] = val[k].data + data[j] = val[k].data; } } } @@ -612,13 +632,16 @@ export default { name: yAxisList[i], data: data }) + legendName.push(yAxisList[i]); } - this.options.series[0]['name'] = arrayList[0].name - this.options.series[0]['data'] = arrayList[0].data - this.options.series[1]['name'] = arrayList[1].name - this.options.series[1]['data'] = arrayList[1].data - this.options.xAxis[0]['data'] = xAxisList - this.options.xAxis[1]['data'] = xAxisList + this.options.series[0]['name'] = arrayList[0].name; + this.options.series[0]['data'] = arrayList[0].data; + this.options.series[1]['name'] = arrayList[1].name; + this.options.series[1]['data'] = arrayList[1].data; + this.options.xAxis[0]['data'] = xAxisList; + this.options.xAxis[1]['data'] = xAxisList; + this.options.legend['data'] = legendName; + this.setOptionsLegendName(legendName); }, // 动态数据 dynamicDataFn(val, refreshTime, optionsSetup) { @@ -639,14 +662,19 @@ export default { }); }, renderingFn(optionsSetup, val) { - this.options.xAxis[0]['data'] = val.xAxis - this.options.xAxis[1]['data'] = val.xAxis + const legendName = []; + this.options.xAxis[0]['data'] = val.xAxis; + this.options.xAxis[1]['data'] = val.xAxis; if (val.series[0].type == "line") { - this.options.series[0]['name'] = val.series[0].name - this.options.series[0]['data'] = val.series[0].data - this.options.series[1]['name'] = val.series[1].name - this.options.series[1]['data'] = val.series[1].data + this.options.series[0]['name'] = val.series[0].name; + this.options.series[0]['data'] = val.series[0].data; + this.options.series[1]['name'] = val.series[1].name; + this.options.series[1]['data'] = val.series[1].data; + legendName.push(val.series[0].name); + legendName.push(val.series[1].name); } + this.options.legend['data'] = legendName; + this.setOptionsLegendName(legendName); } } }; -- Gitee From 04a7864e1a83e1c6fade38a88547b17b6b248626 Mon Sep 17 00:00:00 2001 From: qianlishi <1432731663@qq.com> Date: Thu, 27 Jan 2022 12:39:25 +0800 Subject: [PATCH 02/17] =?UTF-8?q?update=20=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigscreenDesigner/designer/index.vue | 56 +++++-------------- 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/report-ui/src/views/bigscreenDesigner/designer/index.vue b/report-ui/src/views/bigscreenDesigner/designer/index.vue index 53365880..a72a81c9 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/index.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/index.vue @@ -140,36 +140,6 @@ -
{ - if(el.name == 'width'){ - el.value = this.bigscreenWidth - }else if(el.name == 'height'){ - el.value = this.bigscreenHeight + if (el.name == "width") { + el.value = this.bigscreenWidth; + } else if (el.name == "height") { + el.value = this.bigscreenHeight; } - newSetup.push(el) + newSetup.push(el); }); - this.widgetOptions.setup = newSetup + this.widgetOptions.setup = newSetup; } else { for (let i = 0; i < this.widgets.length; i++) { if (this.widgetIndex == i) { @@ -964,7 +934,7 @@ export default { border: 1px solid #3a4659; background: #282a30; } - .tools-item-text{ + .tools-item-text { } } } -- Gitee From cb8f3c5d8273e921ebdf8c694a7645ec2e247a45 Mon Sep 17 00:00:00 2001 From: qianming Date: Thu, 27 Jan 2022 12:49:12 +0800 Subject: [PATCH 03/17] 0.9.6.1 --- report-ui/src/views/layout/components/Sidebar/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/report-ui/src/views/layout/components/Sidebar/index.vue b/report-ui/src/views/layout/components/Sidebar/index.vue index 9e311120..44442209 100644 --- a/report-ui/src/views/layout/components/Sidebar/index.vue +++ b/report-ui/src/views/layout/components/Sidebar/index.vue @@ -3,7 +3,7 @@
- V0.9.6 + V0.9.6.1
Date: Fri, 18 Feb 2022 06:46:55 +0000 Subject: [PATCH 04/17] update README.md. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e3ffc8a..afb681aa 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ AJ-Report使用[Apache2.0开源协议](http://www.apache.org/licenses/LICENSE-2. ## 技术支持 **如有问题,请提交 [Issue](https://gitee.com/anji-plus/report/issues)
** -个人企业微信:
+个人企业微信:加微信进群备注AJ-Report或者Report
#### 开源不易,劳烦各位star ☺ -- Gitee From 2ee40bcbff67bbceb7916e0ca32abe583b279b80 Mon Sep 17 00:00:00 2001 From: Foming Date: Fri, 25 Feb 2022 02:58:16 +0000 Subject: [PATCH 05/17] update README.md. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index afb681aa..013c73aa 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ + ## 简介     AJ-Report是全开源的一个BI平台,酷炫大屏展示,能随时随地掌控业务动态,让每个决策都有数据支撑。
    多数据源支持,内置mysql、elasticsearch、kudu驱动,支持自定义数据集省去数据接口开发,目前已支持20种大屏组件/图表,不会开发,照着设计稿也可以制作大屏。
    三步轻松完成大屏设计:配置数据源---->写SQL配置数据集---->拖拽配置大屏---->保存发布。欢迎体验。 -## 在线体验 +## 在线体验 +**在线体验暂时下线** ####   [在线体验](https://report.anji-plus.com/index.html "链接"): https://report.anji-plus.com/index.html  体验账号:guest 密码:guest -- Gitee From 60c3230e7eb41d2a97b182579ed76c0d41882410 Mon Sep 17 00:00:00 2001 From: qianming Date: Fri, 25 Feb 2022 12:24:41 +0800 Subject: [PATCH 06/17] update --- README.en.md | 2 -- README.md | 33 --------------------------------- 2 files changed, 35 deletions(-) diff --git a/README.en.md b/README.en.md index 27ef5db8..6b93e520 100644 --- a/README.en.md +++ b/README.en.md @@ -1,6 +1,4 @@ ## Online experience -####   Computer online experience: [https://report.anji-plus.com/](https://report.anji-plus.com/ "链接")  account:guest password:guest -####   Online documents: [https://report.anji-plus.com/report-doc/](https://report.anji-plus.com/report-doc/ "doc")
####   issues: [https://gitee.com/anji-plus/report/issues](https://gitee.com/anji-plus/report/issues "issue") ## Function overview diff --git a/README.md b/README.md index 013c73aa..d093d0dc 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,6 @@ ## 在线体验 **在线体验暂时下线** -####   [在线体验](https://report.anji-plus.com/index.html "链接"): https://report.anji-plus.com/index.html  体验账号:guest 密码:guest - -####   [在线文档](https://report.anji-plus.com/report-doc/ "doc"): https://report.anji-plus.com/report-doc/
- ####   [在线提问](https://gitee.com/anji-plus/report/issues "issue"): https://gitee.com/anji-plus/report/issues
## 发行版本 @@ -26,10 +22,6 @@ ![操作](https://images.gitee.com/uploads/images/2021/0703/094742_c0243f70_1728982.gif "2021-07-03_09-43-50.gif") -![视频](https://report.anji-plus.com/report-doc/static/Rhea.mp4)
- -**[更多社区大屏案例](https://report.anji-plus.com/report-doc/guide/bigScreenCase.html)**
- ## 数据流程图 ![An image](https://images.gitee.com/uploads/images/2021/0630/160451_31bb9052_1728982.png) @@ -117,20 +109,10 @@ bin/start.bat Windows修改第4行的JAVA_HOME后(去掉rem注释),双击启 http://serverip:9095 ``` -**[运行环境参考文档](https://report.anji-plus.com/report-doc/guide/quicklyDevelop.html)**
- -**[源码编译部署参考文档](https://report.anji-plus.com/report-doc/guide/quicklySource.html)**
- -**[发行版部署参考文档](https://report.anji-plus.com/report-doc/guide/quicklyDistribution.html)**
- -**[前后端分离部署参考文档](https://report.anji-plus.com/report-doc/guide/quicklySeparate.html)**
- ## 操作手册 新建数据源(重置mysql数据源) --> 新建数据集(编写sql) --> 新建大屏(设计大屏)
-**[在线文档](https://report.anji-plus.com/report-doc/guide/datasource.html)** - ## SQL初始化 sql文件的目录在:report-core --> src --> main --> resources -- > db.migration
@@ -138,19 +120,6 @@ sql文件的目录在:report-core --> src --> main --> resources -- > db.migra 系统初始化时flyway会自动的将该目录下的sql文件执行,不需要手动执行sql文件。
执行完将会创建 aj_report(存放系统基础数据) 和 aj_report_init(存放示例数据) 俩个库。
-## 谁在使用 - -希望你们的logo出现在此,[请点此Issue进行登记](https://gitee.com/anji-plus/report/issues/I3ZXT4) ,我们将优先进行技术支持
- - - - - -
- - - - ## 未来计划 - 大屏宽高动态可视化 @@ -172,8 +141,6 @@ sql文件的目录在:report-core --> src --> main --> resources -- > db.migra - Jdk 11 - Mysql 8.0(8.0.23/26版本没有问题,8.0.21版本存在问题) -**[常见问题](https://report.anji-plus.com/report-doc/guide/question.html)** - ## 商业授权 AJ-Report使用[Apache2.0开源协议](http://www.apache.org/licenses/LICENSE-2.0.html)
-- Gitee From cf556d1ca17fd76ee1d9696aa08fd68d11b54a8b Mon Sep 17 00:00:00 2001 From: Foming Date: Wed, 2 Mar 2022 08:11:47 +0000 Subject: [PATCH 07/17] update README.md. --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index d093d0dc..2e154832 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +# **在线体验暂时下线,不要在问了** ## 简介 @@ -8,6 +9,10 @@ ## 在线体验 **在线体验暂时下线** +####   [在线体验](https://report.anji-plus.com/index.html "链接"): https://report.anji-plus.com/index.html  体验账号:guest 密码:guest + +####   [在线文档](https://report.anji-plus.com/report-doc/ "doc"): https://report.anji-plus.com/report-doc/
+ ####   [在线提问](https://gitee.com/anji-plus/report/issues "issue"): https://gitee.com/anji-plus/report/issues
## 发行版本 @@ -22,6 +27,10 @@ ![操作](https://images.gitee.com/uploads/images/2021/0703/094742_c0243f70_1728982.gif "2021-07-03_09-43-50.gif") +![视频](https://report.anji-plus.com/report-doc/static/Rhea.mp4)
+ +**[更多社区大屏案例](https://report.anji-plus.com/report-doc/guide/bigScreenCase.html)**
+ ## 数据流程图 ![An image](https://images.gitee.com/uploads/images/2021/0630/160451_31bb9052_1728982.png) @@ -109,10 +118,20 @@ bin/start.bat Windows修改第4行的JAVA_HOME后(去掉rem注释),双击启 http://serverip:9095 ``` +**[运行环境参考文档](https://report.anji-plus.com/report-doc/guide/quicklyDevelop.html)**
+ +**[源码编译部署参考文档](https://report.anji-plus.com/report-doc/guide/quicklySource.html)**
+ +**[发行版部署参考文档](https://report.anji-plus.com/report-doc/guide/quicklyDistribution.html)**
+ +**[前后端分离部署参考文档](https://report.anji-plus.com/report-doc/guide/quicklySeparate.html)**
+ ## 操作手册 新建数据源(重置mysql数据源) --> 新建数据集(编写sql) --> 新建大屏(设计大屏)
+**[在线文档](https://report.anji-plus.com/report-doc/guide/datasource.html)** + ## SQL初始化 sql文件的目录在:report-core --> src --> main --> resources -- > db.migration
@@ -120,6 +139,19 @@ sql文件的目录在:report-core --> src --> main --> resources -- > db.migra 系统初始化时flyway会自动的将该目录下的sql文件执行,不需要手动执行sql文件。
执行完将会创建 aj_report(存放系统基础数据) 和 aj_report_init(存放示例数据) 俩个库。
+## 谁在使用 + +希望你们的logo出现在此,[请点此Issue进行登记](https://gitee.com/anji-plus/report/issues/I3ZXT4) ,我们将优先进行技术支持
+ + + + + +
+ + + + ## 未来计划 - 大屏宽高动态可视化 @@ -141,6 +173,8 @@ sql文件的目录在:report-core --> src --> main --> resources -- > db.migra - Jdk 11 - Mysql 8.0(8.0.23/26版本没有问题,8.0.21版本存在问题) +**[常见问题](https://report.anji-plus.com/report-doc/guide/question.html)** + ## 商业授权 AJ-Report使用[Apache2.0开源协议](http://www.apache.org/licenses/LICENSE-2.0.html)
-- Gitee From e7cfc3bd56e4e164a2943eddb21ee7e10f970bf6 Mon Sep 17 00:00:00 2001 From: Foming Date: Wed, 2 Mar 2022 08:14:11 +0000 Subject: [PATCH 08/17] update README.md. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e154832..59a9cc38 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# **在线体验暂时下线,不要在问了** +# **在线体验暂时下线 !!!** ## 简介 -- Gitee From bacaed737a5402e76463b96d6b22f3887e93c5e6 Mon Sep 17 00:00:00 2001 From: Foming Date: Thu, 3 Mar 2022 09:03:24 +0000 Subject: [PATCH 09/17] update README.md. --- README.md | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/README.md b/README.md index 59a9cc38..d00d554c 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,6 @@ ## 在线体验 **在线体验暂时下线** -####   [在线体验](https://report.anji-plus.com/index.html "链接"): https://report.anji-plus.com/index.html  体验账号:guest 密码:guest - -####   [在线文档](https://report.anji-plus.com/report-doc/ "doc"): https://report.anji-plus.com/report-doc/
- ####   [在线提问](https://gitee.com/anji-plus/report/issues "issue"): https://gitee.com/anji-plus/report/issues
## 发行版本 @@ -27,9 +23,6 @@ ![操作](https://images.gitee.com/uploads/images/2021/0703/094742_c0243f70_1728982.gif "2021-07-03_09-43-50.gif") -![视频](https://report.anji-plus.com/report-doc/static/Rhea.mp4)
- -**[更多社区大屏案例](https://report.anji-plus.com/report-doc/guide/bigScreenCase.html)**
## 数据流程图 @@ -118,19 +111,10 @@ bin/start.bat Windows修改第4行的JAVA_HOME后(去掉rem注释),双击启 http://serverip:9095 ``` -**[运行环境参考文档](https://report.anji-plus.com/report-doc/guide/quicklyDevelop.html)**
- -**[源码编译部署参考文档](https://report.anji-plus.com/report-doc/guide/quicklySource.html)**
- -**[发行版部署参考文档](https://report.anji-plus.com/report-doc/guide/quicklyDistribution.html)**
- -**[前后端分离部署参考文档](https://report.anji-plus.com/report-doc/guide/quicklySeparate.html)**
- ## 操作手册 新建数据源(重置mysql数据源) --> 新建数据集(编写sql) --> 新建大屏(设计大屏)
-**[在线文档](https://report.anji-plus.com/report-doc/guide/datasource.html)** ## SQL初始化 @@ -139,18 +123,6 @@ sql文件的目录在:report-core --> src --> main --> resources -- > db.migra 系统初始化时flyway会自动的将该目录下的sql文件执行,不需要手动执行sql文件。
执行完将会创建 aj_report(存放系统基础数据) 和 aj_report_init(存放示例数据) 俩个库。
-## 谁在使用 - -希望你们的logo出现在此,[请点此Issue进行登记](https://gitee.com/anji-plus/report/issues/I3ZXT4) ,我们将优先进行技术支持
- - - - - -
- - - ## 未来计划 @@ -173,7 +145,6 @@ sql文件的目录在:report-core --> src --> main --> resources -- > db.migra - Jdk 11 - Mysql 8.0(8.0.23/26版本没有问题,8.0.21版本存在问题) -**[常见问题](https://report.anji-plus.com/report-doc/guide/question.html)** ## 商业授权 -- Gitee From 693b7506ff44a85e2164fa5afa6b4f7b88f85f25 Mon Sep 17 00:00:00 2001 From: Foming Date: Thu, 17 Mar 2022 00:53:47 +0000 Subject: [PATCH 10/17] update README.md. --- README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d00d554c..50acd119 100644 --- a/README.md +++ b/README.md @@ -87,8 +87,27 @@ - [vuedraggable](https://github.com/SortableJS/Vue.Draggable/): 是一款基于Sortable.js实现的vue拖拽插件。 - [luckysheet](https://gitee.com/mengshukeji/Luckysheet): Luckysheet ,一款纯前端类似excel的在线表格,功能强大、配置简单、完全开源。 -## 编译打包 +## 部署方式 +源码 doc -> docs -> guide 目录下即所有文档 + + +### 发行版部署 +``` +下载最新发行版,解压 +cd aj-report-xxxx +vim conf/bootstrap.yml 修改数据库连接等信息 +sh bin/start.sh Linux启动 +bin/start.bat Windows修改第4行的JAVA_HOME后(去掉rem注释),双击启动 + +启动后访问 +http://serverip:9095 +用户名密码:admin/123456 + +登陆后修改"数据源->mysql数据源"用户名密码 +``` + +### 源码编译部署 在Linux上先准备好maven、node.js、jdk - [Apache Maven] 3.5
@@ -109,6 +128,9 @@ bin/start.bat Windows修改第4行的JAVA_HOME后(去掉rem注释),双击启 启动后访问 http://serverip:9095 +用户名密码:admin/123456 + +登陆后修改"数据源->mysql数据源"用户名密码 ``` ## 操作手册 -- Gitee From 4faf2bee341e37acc96a4a9f0608f870293c318c Mon Sep 17 00:00:00 2001 From: Foming Date: Thu, 17 Mar 2022 03:13:31 +0000 Subject: [PATCH 11/17] update README.md. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 50acd119..66ccd2bc 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ AJ-Report使用[Apache2.0开源协议](http://www.apache.org/licenses/LICENSE-2. ## 技术支持 **如有问题,请提交 [Issue](https://gitee.com/anji-plus/report/issues)
** -个人企业微信:加微信进群备注AJ-Report或者Report
+个人企业微信:加微信进群备注AJ-Report或者Report (不备注是看不到的)
#### 开源不易,劳烦各位star ☺ -- Gitee From 4d32d064e2daf5a432bd60da35a23c996e4d3a4f Mon Sep 17 00:00:00 2001 From: qianming Date: Fri, 15 Apr 2022 17:48:25 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E6=96=B0=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 22 ++++++++--- README.md | 39 +++++++++++++++---- doc/docs/guide/README.md | 2 +- doc/docs/guide/bigScreenCase.md | 10 ++--- doc/docs/guide/briefUsing.md | 12 +++--- doc/docs/guide/question.md | 2 +- .../designer/tools/configure/widget-iframe.js | 4 +- .../bigscreenDesigner/designer/tools/index.js | 4 +- 8 files changed, 65 insertions(+), 30 deletions(-) diff --git a/README.en.md b/README.en.md index 6b93e520..1e4b7f40 100644 --- a/README.en.md +++ b/README.en.md @@ -1,12 +1,20 @@ ## Online experience -####   issues: [https://gitee.com/anji-plus/report/issues](https://gitee.com/anji-plus/report/issues "issue") + +####   Computer online experience: [https://ajreport.beliefteam.cn/](https://ajreport.beliefteam.cn/ "链接")  account:guest password:guest + +####   Online documents: [https://ajreport.beliefteam.cn/report-doc/](https://ajreport.beliefteam.cn/report-doc/ "doc")
+ +####   issues: [https://gitee.com/anji-plus/report/issues](https://gitee.com/anji-plus/report/issues "issue") ## Function overview -####   Component introduction -   (AJ-Report)is a visual drag edit, intuitive, cool, with a sense of science and technology chart tool full open source project. -The built-in basic functions include data source, data set, report management, and some screenshots of the project are shown below.。
+####   Component introduction + +   (AJ-Report)is a visual drag edit, intuitive, cool, with a sense of science and technology chart tool full +open source project. +The built-in basic functions include data source, data set, report management, and some screenshots of the project are +shown below.。
## Packaging directory @@ -24,6 +32,7 @@ The built-in basic functions include data source, data set, report management, a ``` ## System directory + ``` ├── doc │ ├── docs @@ -38,11 +47,12 @@ The built-in basic functions include data source, data set, report management, a ├── README.md ``` - ## Short term plan -####   Enrich more chart components + +####   Enrich more chart components ## technical support + If you have any questions, please submit to [Issue](https://gitee.com/anji-plus/report/issues) #### Open source is not easy, please, star ☺ diff --git a/README.md b/README.md index 66ccd2bc..d053c6e5 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,11 @@     多数据源支持,内置mysql、elasticsearch、kudu驱动,支持自定义数据集省去数据接口开发,目前已支持20种大屏组件/图表,不会开发,照着设计稿也可以制作大屏。
    三步轻松完成大屏设计:配置数据源---->写SQL配置数据集---->拖拽配置大屏---->保存发布。欢迎体验。 -## 在线体验 -**在线体验暂时下线** +## 在线体验 + +####   [在线体验](https://ajreport.beliefteam.cn/index.html "链接"): https://ajreport.beliefteam.cn/index.html  体验账号:guest 密码:guest + +####   [在线文档](https://ajreport.beliefteam.cn/report-doc/ "doc"): https://ajreport.beliefteam.cn/report-doc/
####   [在线提问](https://gitee.com/anji-plus/report/issues "issue"): https://gitee.com/anji-plus/report/issues
@@ -22,7 +25,8 @@    大屏设计(AJ-Report)是一个可视化拖拽编辑的,直观,酷炫,具有科技感的图表工具全开源项目。 内置的基础功能包括数据源,数据集,报表管理,项目部分截图如下。
![操作](https://images.gitee.com/uploads/images/2021/0703/094742_c0243f70_1728982.gif "2021-07-03_09-43-50.gif") - +![视频](https://ajreport.beliefteam.cn/report-doc/static/Rhea.mp4)
+**[更多社区大屏案例](https://ajreport.beliefteam.cn/report-doc/guide/bigScreenCase.html)**
## 数据流程图 @@ -89,10 +93,11 @@ ## 部署方式 -源码 doc -> docs -> guide 目录下即所有文档 - +**注意版本兼容性**
+源码 doc -> docs -> guide 目录下即所有文档
### 发行版部署 + ``` 下载最新发行版,解压 cd aj-report-xxxx @@ -108,6 +113,7 @@ http://serverip:9095 ``` ### 源码编译部署 + 在Linux上先准备好maven、node.js、jdk - [Apache Maven] 3.5
@@ -133,10 +139,18 @@ http://serverip:9095 登陆后修改"数据源->mysql数据源"用户名密码 ``` +**[运行环境参考文档](https://ajreport.beliefteam.cn/report-doc/guide/quicklyDevelop.html)**
+ +**[源码编译部署参考文档](https://ajreport.beliefteam.cn/report-doc/guide/quicklySource.html)**
+ +**[发行版部署参考文档](https://ajreport.beliefteam.cn/report-doc/guide/quicklyDistribution.html)**
+ +**[前后端分离部署参考文档](https://ajreport.beliefteam.cn/report-doc/guide/quicklySeparate.html)**
+ ## 操作手册 新建数据源(重置mysql数据源) --> 新建数据集(编写sql) --> 新建大屏(设计大屏)
- +**[在线文档](https://ajreport.beliefteam.cn/report-doc/guide/datasource.html)** ## SQL初始化 @@ -145,6 +159,17 @@ sql文件的目录在:report-core --> src --> main --> resources -- > db.migra 系统初始化时flyway会自动的将该目录下的sql文件执行,不需要手动执行sql文件。
执行完将会创建 aj_report(存放系统基础数据) 和 aj_report_init(存放示例数据) 俩个库。
+## 谁在使用 + +希望你们的logo出现在此,[请点此Issue进行登记](https://gitee.com/anji-plus/report/issues/I3ZXT4) ,我们将优先进行技术支持
+ + + + + +
+ + ## 未来计划 @@ -166,7 +191,7 @@ sql文件的目录在:report-core --> src --> main --> resources -- > db.migra - openJdk - Jdk 11 - Mysql 8.0(8.0.23/26版本没有问题,8.0.21版本存在问题) - + **[常见问题](https://ajreport.beliefteam.cn/report-doc/guide/question.html)** ## 商业授权 diff --git a/doc/docs/guide/README.md b/doc/docs/guide/README.md index 6af10628..ef54e6f9 100644 --- a/doc/docs/guide/README.md +++ b/doc/docs/guide/README.md @@ -10,7 +10,7 @@ ## 在线体验 -####   [在线体验](https://report.anji-plus.com/index.html "链接"): https://report.anji-plus.com/index.html  体验账号:guest 密码:guest +####   [在线体验](https://ajreport.beliefteam.cn/index.html "链接"): https://ajreport.beliefteam.cn/index.html  体验账号:guest 密码:guest ####   [在线提问](https://gitee.com/anji-plus/report/issues "issue"): https://gitee.com/anji-plus/report/issues
diff --git a/doc/docs/guide/bigScreenCase.md b/doc/docs/guide/bigScreenCase.md index e9accfd9..88e92c1b 100644 --- a/doc/docs/guide/bigScreenCase.md +++ b/doc/docs/guide/bigScreenCase.md @@ -1,22 +1,22 @@ ## 案例一 由社区 **[~无痕~@tengzhouboy](https://gitee.com/tengzhouboy)** 提供
-[AJ-Report分享链接](https://report.anji-plus.com/index.html#/aj/mtwbjPot)
+[AJ-Report分享链接](https://ajreport.beliefteam.cn/index.html#/aj/mtwbjPot)
![img.png](../picture/bigScreenCase/img.png)
## 案例二 由社区 **[心瘾丶 @yi_shan_liu](https://gitee.com/yi_shan_liu)** 提供
-[AJ-Report分享链接](https://report.anji-plus.com/index.html#/aj/hkBJgLW0)
+[AJ-Report分享链接](https://ajreport.beliefteam.cn/index.html#/aj/hkBJgLW0)
![img1](../picture/bigScreenCase/img1.png)
-[AJ-Report分享链接](https://report.anji-plus.com/index.html#/aj/Hgfi4pj5)
+[AJ-Report分享链接](https://ajreport.beliefteam.cn/index.html#/aj/Hgfi4pj5)
![img2](../picture/bigScreenCase/img2.png)
-[AJ-Report分享链接](https://report.anji-plus.com/index.html#/aj/zJa5Wwey)
+[AJ-Report分享链接](https://ajreport.beliefteam.cn/index.html#/aj/zJa5Wwey)
![img3](../picture/bigScreenCase/img3.png)
-[AJ-Report分享链接](https://report.anji-plus.com/index.html#/aj/D0cpO4re)
+[AJ-Report分享链接](https://ajreport.beliefteam.cn/index.html#/aj/D0cpO4re)
![img4](../picture/bigScreenCase/img4.png)
\ No newline at end of file diff --git a/doc/docs/guide/briefUsing.md b/doc/docs/guide/briefUsing.md index 089a9210..c5a1d33f 100644 --- a/doc/docs/guide/briefUsing.md +++ b/doc/docs/guide/briefUsing.md @@ -1,9 +1,9 @@ 希望你们的logo出现在此,[请点此Issue进行登记](https://gitee.com/anji-plus/report/issues/I3ZXT4)
- + - - - -
- \ No newline at end of file + + + +
+ \ No newline at end of file diff --git a/doc/docs/guide/question.md b/doc/docs/guide/question.md index 3721505d..0eb8ba97 100644 --- a/doc/docs/guide/question.md +++ b/doc/docs/guide/question.md @@ -12,7 +12,7 @@
-## 版本问题:[开发环境参考](https://report.anji-plus.com/report-doc/guide/quicklyDevelop.html) +## 版本问题:[开发环境参考](https://ajreport.beliefteam.cn/report-doc/guide/quicklyDevelop.html) - 底层数据库为Mysql8.0+时,flyway执行SQL报错
- Node.js是V16版本时 npm install失败
diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-iframe.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-iframe.js index a38ba983..8aa78f08 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-iframe.js +++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-iframe.js @@ -1,6 +1,6 @@ /* * @Descripttion: iframe json - * @version: + * @version: * @Author: qianlishi * @Date: 2021-08-29 07:17:55 * @LastEditors: qianlishi @@ -28,7 +28,7 @@ export const widgetIframe = { name: 'iframeAdress', required: false, placeholder: '', - value: 'https://report.anji-plus.com/index.html', + value: 'https://ajreport.beliefteam.cn/index.html', }, ], // 数据 diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/index.js b/report-ui/src/views/bigscreenDesigner/designer/tools/index.js index 80531869..40c3974d 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/tools/index.js +++ b/report-ui/src/views/bigscreenDesigner/designer/tools/index.js @@ -1,6 +1,6 @@ /* * @Descripttion: 主文件 - * @version: + * @version: * @Author: qianlishi * @Date: 2021-08-29 06:43:07 * @LastEditors: qianlishi @@ -59,7 +59,7 @@ const screenConfig = { name: 'backgroundImage', required: false, placeholder: '', - value: 'https://report.anji-plus.com/file/download/bf566e48-ccad-40e1-8ee9-228427e5466b', + value: 'https://ajreport.beliefteam.cn/file/download/bf566e48-ccad-40e1-8ee9-228427e5466b', }, ], data: [], -- Gitee From dac4210e6940cdca0547d1d7b30dec5f1407d75d Mon Sep 17 00:00:00 2001 From: qianming Date: Fri, 15 Apr 2022 17:49:29 +0800 Subject: [PATCH 13/17] update --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index d053c6e5..52c4cc64 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -# **在线体验暂时下线 !!!** - ## 简介     AJ-Report是全开源的一个BI平台,酷炫大屏展示,能随时随地掌控业务动态,让每个决策都有数据支撑。
-- Gitee From e33272b1a86f42fda967b67cfc3987533ac6a7de Mon Sep 17 00:00:00 2001 From: Foming Date: Tue, 26 Apr 2022 02:43:57 +0000 Subject: [PATCH 14/17] update README.md. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 52c4cc64..173f5170 100644 --- a/README.md +++ b/README.md @@ -202,12 +202,13 @@ AJ-Report使用[Apache2.0开源协议](http://www.apache.org/licenses/LICENSE-2. - 在二次开发后商业发布的产品中,使用了多个开源软件,则必须包含一个Notice文件,在Notice文件中需要带有AJ-Report LICENSE。你可以在Notice中增加自己的许可,但不可以表现为对AJ-Report LICENSE构成更改。 -如果您需要商业化增值服务,请加下面的微信沟通。 +如果您需要商业化增值服务,请加下面的微信沟通,并直接说明来意。 ## 技术支持 **如有问题,请提交 [Issue](https://gitee.com/anji-plus/report/issues)
** -个人企业微信:加微信进群备注AJ-Report或者Report (不备注是看不到的)
+个人企业微信:加微信进群备注 AJ-Report 或者 Report
+如果不是为了进群,请直接说明来意,每天加群的都很多,企微也是我们自己的工作企微,会有很多消息会被刷下去,如果半天没有回复你,请发送多次
#### 开源不易,劳烦各位star ☺ -- Gitee From 441efd59a2410fdaa29d0cd44385ec9885a06b91 Mon Sep 17 00:00:00 2001 From: yuanxiaobin Date: Fri, 29 Apr 2022 18:23:06 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E6=96=B0=E5=A2=9ESAP=20Hana=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93JDBC=E6=A8=A1=E5=BC=8F=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-core/pom.xml | 6 ++++ .../service/impl/DataSourceServiceImpl.java | 33 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/report-core/pom.xml b/report-core/pom.xml index 423b3b05..4c89c99f 100644 --- a/report-core/pom.xml +++ b/report-core/pom.xml @@ -151,6 +151,12 @@ poi-ooxml-schemas 4.1.2 + + + com.sap.cloud.db.jdbc + ngdbc + 2.3.62 + diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasource/service/impl/DataSourceServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasource/service/impl/DataSourceServiceImpl.java index 0485a294..3633681f 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasource/service/impl/DataSourceServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasource/service/impl/DataSourceServiceImpl.java @@ -1,6 +1,7 @@ package com.anjiplus.template.gaea.business.modules.datasource.service.impl; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.anji.plus.gaea.constant.BaseOperationEnum; @@ -23,6 +24,7 @@ import com.anjiplus.template.gaea.business.util.JdbcConstants; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -144,6 +146,13 @@ public class DataSourceServiceImpl implements DataSourceService { public long total(DataSourceDto sourceDto, DataSetDto dto) { //区分数据类型 String sourceType = sourceDto.getSourceType(); + + String driverName = JSON.parseObject(sourceDto.getSourceConfig()).getString("driverName"); + if (StringUtils.equalsIgnoreCase(driverName, "com.sap.db.jdbc.Driver")) { + return sapHanaTotal(sourceDto, dto); + } + + switch (sourceType) { case JdbcConstants.ELASTIC_SEARCH_SQL: return 0; @@ -155,6 +164,30 @@ public class DataSourceServiceImpl implements DataSourceService { } + + /** + * 获取Sap Hana count 和添加limit分页信息 + * + * @param sourceDto + * @param dto + * @return + */ + public long sapHanaTotal(DataSourceDto sourceDto, DataSetDto dto) { + String dynSentence = sourceDto.getDynSentence(); + String sql = "select count(1) as count from (" + dynSentence + ") as gaeaExecute"; + sourceDto.setDynSentence(sql); + List result = execute(sourceDto); + + //sql 拼接 limit 分页信息 + int pageNumber = Integer.parseInt(dto.getContextData().getOrDefault("pageNumber", "1").toString()); + int pageSize = Integer.parseInt(dto.getContextData().getOrDefault("pageSize", "10").toString()); + String sqlLimit = " limit " + pageSize + " offset " + (pageNumber - 1) * pageSize; + sourceDto.setDynSentence(dynSentence.concat(sqlLimit)); + log.info("当前total:{}, 添加分页参数,sql语句:{}", JSONObject.toJSONString(result), sourceDto.getDynSentence()); + return result.get(0).getLongValue("count"); + } + + /** * 获取mysql count 和添加limit分页信息 * @param sourceDto -- Gitee From 85bf9cb2a253a62e023fcf0c3c02ba66576828b1 Mon Sep 17 00:00:00 2001 From: yuanxiaobin Date: Thu, 5 May 2022 16:09:25 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E9=85=8D=E6=8A=A5=E8=A1=A8=E6=9D=83=E9=99=90=E5=88=B0?= =?UTF-8?q?=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AccessRoleController.java | 62 ++++-- .../dao/AccessRoleReportMapper.java | 14 ++ .../dao/entity/AccessRoleReport.java | 42 ++++ .../accessrole/service/AccessRoleService.java | 34 +++- .../service/impl/AccessRoleServiceImpl.java | 100 ++++++++- .../service/impl/DataSourceServiceImpl.java | 2 +- .../report/controller/ReportController.java | 20 ++ .../modules/report/service/ReportService.java | 10 +- .../service/impl/ReportServiceImpl.java | 25 ++- .../service/impl/ReportExcelServiceImpl.java | 190 ++++++++++-------- .../migration/V1.0.15_create_role_report.sql | 6 + report-ui/src/api/accessRole.js | 19 +- .../accessRole/components/RoleReport.vue | 92 +++++++++ report-ui/src/views/accessRole/index.vue | 22 +- .../src/views/excelreport/viewer/index.vue | 36 +++- 15 files changed, 542 insertions(+), 132 deletions(-) create mode 100644 report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/dao/AccessRoleReportMapper.java create mode 100644 report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/dao/entity/AccessRoleReport.java create mode 100644 report-core/src/main/resources/db/migration/V1.0.15_create_role_report.sql create mode 100644 report-ui/src/views/accessRole/components/RoleReport.vue diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/controller/AccessRoleController.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/controller/AccessRoleController.java index 5614a308..5d3ab2fc 100755 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/controller/AccessRoleController.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/controller/AccessRoleController.java @@ -2,30 +2,30 @@ package com.anjiplus.template.gaea.business.modules.accessrole.controller; import com.anji.plus.gaea.annotation.Permission; -import com.anji.plus.gaea.annotation.AccessKey; import com.anji.plus.gaea.bean.ResponseBean; -import com.anji.plus.gaea.bean.TreeNode; import com.anji.plus.gaea.curd.controller.GaeaBaseController; import com.anji.plus.gaea.curd.service.GaeaBaseService; import com.anji.plus.gaea.holder.UserContentHolder; -import com.anji.plus.gaea.utils.GaeaBeanUtils; -import com.anji.plus.gaea.utils.GaeaUtils; -import com.anjiplus.template.gaea.business.modules.accessrole.dao.entity.AccessRole; -import com.anjiplus.template.gaea.business.modules.accessrole.service.AccessRoleService; import com.anjiplus.template.gaea.business.modules.accessrole.controller.dto.AccessRoleDto; import com.anjiplus.template.gaea.business.modules.accessrole.controller.param.AccessRoleParam; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import com.anjiplus.template.gaea.business.modules.accessrole.dao.entity.AccessRole; +import com.anjiplus.template.gaea.business.modules.accessrole.service.AccessRoleService; import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; -import java.util.List; import java.util.Map; /** -* @desc 角色管理 controller -* @author 木子李·De -* @date 2019-02-17 08:50:14.136 -**/ + * @author 木子李·De + * @desc 角色管理 controller + * @date 2019-02-17 08:50:14.136 + **/ @RestController @Api(tags = "角色管理管理") @RequestMapping("/accessRole") @@ -52,23 +52,51 @@ public class AccessRoleController extends GaeaBaseController { + +} \ No newline at end of file diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/dao/entity/AccessRoleReport.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/dao/entity/AccessRoleReport.java new file mode 100644 index 00000000..7df4a7b4 --- /dev/null +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/dao/entity/AccessRoleReport.java @@ -0,0 +1,42 @@ +package com.anjiplus.template.gaea.business.modules.accessrole.dao.entity; + +import com.anji.plus.gaea.curd.entity.GaeaBaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +/** + * @Author: Magic_yuan + * @Date: 2022/5/5 14:59 + */ +@TableName(keepGlobalPrefix=true, value="access_role_report") +@Data +public class AccessRoleReport extends GaeaBaseEntity { + + /** + * 角色编码 + */ + private String roleCode; + + /** + * 报表编码 + */ + private String reportCode; + + @TableField(exist = false) + private String createBy; + + @TableField(exist = false) + private Date createTime; + + @TableField(exist = false) + private String updateBy; + + @TableField(exist = false) + private Date updateTime; + + @TableField(exist = false) + private Integer version; +} diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/service/AccessRoleService.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/service/AccessRoleService.java index 639fd1a2..5bd47cf9 100755 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/service/AccessRoleService.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/accessrole/service/AccessRoleService.java @@ -1,24 +1,23 @@ package com.anjiplus.template.gaea.business.modules.accessrole.service; -import com.anji.plus.gaea.bean.ResponseBean; +import com.anji.plus.gaea.curd.service.GaeaBaseService; import com.anjiplus.template.gaea.business.modules.accessrole.controller.dto.AccessRoleDto; -import com.anjiplus.template.gaea.business.modules.accessrole.dao.entity.AccessRole; import com.anjiplus.template.gaea.business.modules.accessrole.controller.param.AccessRoleParam; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.anji.plus.gaea.curd.service.GaeaBaseService; +import com.anjiplus.template.gaea.business.modules.accessrole.dao.entity.AccessRole; import java.util.Map; /** -* @desc AccessRole 角色管理服务接口 -* @author 木子李·De -* @date 2019-02-17 08:50:14.136 -**/ + * @author 木子李·De + * @desc AccessRole 角色管理服务接口 + * @date 2019-02-17 08:50:14.136 + **/ public interface AccessRoleService extends GaeaBaseService { - /** 查询某角色的权限树 + /** + * 查询某角色的权限树 + * * @param roleCode 被操作的对象 * @param operator 当前登录者 * @return @@ -26,9 +25,22 @@ public interface AccessRoleService extends GaeaBaseService -* @date 2019-02-17 08:50:14.136 -**/ + * @author 木子李·De + * @desc AccessRole 角色管理服务实现 + * @date 2019-02-17 08:50:14.136 + **/ @Service public class AccessRoleServiceImpl implements AccessRoleService { @@ -37,12 +42,89 @@ public class AccessRoleServiceImpl implements AccessRoleService { @Autowired private AccessRoleAuthorityMapper accessRoleAuthorityMapper; + @Autowired + private AccessRoleReportMapper accessRoleReportMapper; + @Autowired private AccessAuthorityService accessAuthorityService; + @Autowired + private ReportService reportService; + @Override public GaeaBaseMapper getMapper() { - return accessRoleMapper; + return accessRoleMapper; + } + + + @Override + public Map authorityReportTree(String roleCode, String operator) { + Map result = new HashMap(); + + // 菜单按钮树 + List reportList = reportService.findAll(); + List parentNodes = new ArrayList<>(); + TreeNode screenNode = new TreeNode(); + screenNode.setLabel("大屏报表"); + screenNode.setId("screen"); + TreeNode excelNod = new TreeNode(); + excelNod.setLabel("Excel报表"); + excelNod.setId("excel"); + for (Report report : reportList) { + TreeNode tempNode = new TreeNode(); + tempNode.setLabel(report.getReportName()); + tempNode.setId(report.getReportCode()); + if (StringUtils.equalsIgnoreCase(report.getReportType(), "report_screen")) { + if (screenNode.getChildren() == null) { + screenNode.setChildren(new ArrayList<>()); + } + screenNode.getChildren().add(tempNode); + } else { + if (excelNod.getChildren() == null) { + excelNod.setChildren(new ArrayList<>()); + } + excelNod.getChildren().add(tempNode); + } + } + + parentNodes.add(screenNode); + parentNodes.add(excelNod); + + List accessRoleReportList = accessRoleReportMapper.selectList(Wrappers.lambdaQuery().eq(AccessRoleReport::getRoleCode, roleCode)); + List checkedKeys = accessRoleReportList.stream() + .map(accessRoleReport -> accessRoleReport.getReportCode()).distinct().collect(Collectors.toList()); + + result.put("treeData", parentNodes); + result.put("checkedKeys", checkedKeys); + return result; + } + + + @Override + public Boolean saveRoleReportTree(AccessRoleDto accessRoleDto) { + // 校验 + String roleCode = accessRoleDto.getRoleCode(); + List authorityList = accessRoleDto.getAuthorityList(); + if (StringUtils.isBlank(roleCode)) { + throw BusinessExceptionBuilder.build(ResponseCode.NOT_EMPTY, roleCode); + } + if (authorityList == null || authorityList.isEmpty()) { + throw BusinessExceptionBuilder.build(ResponseCode.NOT_EMPTY, authorityList); + } + + // 先清除该角色已保存的报表权限 + accessRoleReportMapper.delete(Wrappers.lambdaUpdate().eq(AccessRoleReport::getRoleCode, roleCode)); + + // 保存勾选的报表权限 + List accessRoleReports = new ArrayList<>(); + for (String reportCode : authorityList) { + AccessRoleReport accessRoleReport = new AccessRoleReport(); + accessRoleReport.setRoleCode(roleCode); + accessRoleReport.setReportCode(reportCode); + accessRoleReports.add(accessRoleReport); + } + accessRoleReportMapper.insertBatch(accessRoleReports); + return true; } @Override @@ -72,10 +154,10 @@ public class AccessRoleServiceImpl implements AccessRoleService { // 校验 String roleCode = accessRoleDto.getRoleCode(); List authorityList = accessRoleDto.getAuthorityList(); - if(StringUtils.isBlank(roleCode)){ + if (StringUtils.isBlank(roleCode)) { throw BusinessExceptionBuilder.build(ResponseCode.NOT_EMPTY, roleCode); } - if(authorityList == null || authorityList.isEmpty()){ + if (authorityList == null || authorityList.isEmpty()) { throw BusinessExceptionBuilder.build(ResponseCode.NOT_EMPTY, authorityList); } @@ -86,7 +168,7 @@ public class AccessRoleServiceImpl implements AccessRoleService { // 保存勾选的权限(菜单和按钮) authorityList.stream().forEach(authorityStr -> { - if(!authorityStr.contains("_")){ + if (!authorityStr.contains("_")) { return; } String[] array = authorityStr.split("_"); diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasource/service/impl/DataSourceServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasource/service/impl/DataSourceServiceImpl.java index 3633681f..2dcfc9fd 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasource/service/impl/DataSourceServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasource/service/impl/DataSourceServiceImpl.java @@ -184,7 +184,7 @@ public class DataSourceServiceImpl implements DataSourceService { String sqlLimit = " limit " + pageSize + " offset " + (pageNumber - 1) * pageSize; sourceDto.setDynSentence(dynSentence.concat(sqlLimit)); log.info("当前total:{}, 添加分页参数,sql语句:{}", JSONObject.toJSONString(result), sourceDto.getDynSentence()); - return result.get(0).getLongValue("count"); + return result.get(0).getLongValue("COUNT"); } diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/controller/ReportController.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/controller/ReportController.java index 6269e7d0..b74e8994 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/controller/ReportController.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/controller/ReportController.java @@ -5,10 +5,14 @@ import com.anji.plus.gaea.annotation.log.GaeaAuditLog; import com.anji.plus.gaea.bean.ResponseBean; import com.anji.plus.gaea.curd.controller.GaeaBaseController; import com.anji.plus.gaea.curd.service.GaeaBaseService; +import com.anji.plus.gaea.utils.GaeaBeanUtils; import com.anjiplus.template.gaea.business.modules.report.controller.dto.ReportDto; import com.anjiplus.template.gaea.business.modules.report.controller.param.ReportParam; import com.anjiplus.template.gaea.business.modules.report.dao.entity.Report; import com.anjiplus.template.gaea.business.modules.report.service.ReportService; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -16,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * TODO * @@ -46,6 +52,20 @@ public class ReportController extends GaeaBaseController wrapper = reportService.getWrapper(param); + wrapper.in("report_code", reportService.getReportListByRoles()); + IPage iPage = reportService.page(param, wrapper); + List records = iPage.getRecords(); + List list = GaeaBeanUtils.copyList(records, ReportDto.class); + this.pageResultHandler(list); + Page pageDto = new Page(); + pageDto.setCurrent(iPage.getCurrent()).setRecords(list).setPages(iPage.getPages()).setTotal(iPage.getTotal()).setSize(iPage.getSize()); + return this.responseSuccessWithData(pageDto); + } + @DeleteMapping("/delReport") @Permission(code = "delete", name = "删除") @GaeaAuditLog(pageTitle = "删除") diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/ReportService.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/ReportService.java index a09efd08..747ce04f 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/ReportService.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/ReportService.java @@ -5,8 +5,9 @@ import com.anjiplus.template.gaea.business.modules.report.controller.dto.ReportD import com.anjiplus.template.gaea.business.modules.report.controller.param.ReportParam; import com.anjiplus.template.gaea.business.modules.report.dao.entity.Report; +import java.util.List; + /** - * * @author chenkening * @date 2021/3/26 10:35 */ @@ -16,7 +17,14 @@ public interface ReportService extends GaeaBaseService { /** * 下载次数+1 + * * @param reportCode */ void downloadStatistics(String reportCode); + + /** + * 根据角色ID集合获取报表集合 + * + */ + List getReportListByRoles(); } diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/impl/ReportServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/impl/ReportServiceImpl.java index e5b32704..43bd4750 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/impl/ReportServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/impl/ReportServiceImpl.java @@ -3,15 +3,23 @@ package com.anjiplus.template.gaea.business.modules.report.service.impl; import com.anji.plus.gaea.constant.BaseOperationEnum; import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper; import com.anji.plus.gaea.exception.BusinessException; +import com.anji.plus.gaea.holder.UserContentHolder; +import com.anjiplus.template.gaea.business.modules.accessrole.dao.AccessRoleReportMapper; +import com.anjiplus.template.gaea.business.modules.accessrole.dao.entity.AccessRoleReport; +import com.anjiplus.template.gaea.business.modules.accessuser.dao.AccessUserRoleMapper; +import com.anjiplus.template.gaea.business.modules.accessuser.dao.entity.AccessUserRole; import com.anjiplus.template.gaea.business.modules.report.controller.dto.ReportDto; import com.anjiplus.template.gaea.business.modules.report.dao.ReportMapper; import com.anjiplus.template.gaea.business.modules.report.dao.entity.Report; import com.anjiplus.template.gaea.business.modules.report.service.ReportService; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.stream.Collectors; + /** - * * @author chenkening * @date 2021/3/26 10:35 */ @@ -21,11 +29,24 @@ public class ReportServiceImpl implements ReportService { @Autowired private ReportMapper reportMapper; + @Autowired + private AccessUserRoleMapper accessUserRoleMapper; + + @Autowired + private AccessRoleReportMapper accessRoleReportMapper; + @Override public GaeaBaseMapper getMapper() { return reportMapper; } + @Override + public List getReportListByRoles() { + List roleList = accessUserRoleMapper.selectList(Wrappers.lambdaQuery().eq(AccessUserRole::getLoginName, UserContentHolder.getContext().getUsername())).stream().map(accessUserRole -> accessUserRole.getRoleCode()).distinct().collect(Collectors.toList()); + List accessRoleReportList = accessRoleReportMapper.selectList(Wrappers.lambdaQuery().in(AccessRoleReport::getRoleCode, roleList)); + return accessRoleReportList.stream() + .map(accessRoleReport -> accessRoleReport.getReportCode()).distinct().collect(Collectors.toList()); + } @Override public void delReport(ReportDto reportDto) { @@ -46,7 +67,7 @@ public class ReportServiceImpl implements ReportService { Long downloadCount = report.getDownloadCount(); if (null == downloadCount) { downloadCount = 0L; - }else { + } else { downloadCount++; } report.setDownloadCount(downloadCount); diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java index 865dd7dd..627457f5 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java @@ -23,7 +23,6 @@ import com.anjiplus.template.gaea.business.modules.reportexcel.dao.ReportExcelMa import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel; import com.anjiplus.template.gaea.business.modules.reportexcel.service.ReportExcelService; import com.anjiplus.template.gaea.business.modules.reportexcel.util.CellType; -import com.anjiplus.template.gaea.business.modules.reportexcel.util.XlsSheetUtil; import com.anjiplus.template.gaea.business.modules.reportexcel.util.XlsUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.commons.lang3.StringUtils; @@ -34,8 +33,15 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import java.io.*; -import java.util.*; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; /** * TODO @@ -125,7 +131,7 @@ public class ReportExcelServiceImpl implements ReportExcelService { // 数据集解析 String jsonStr = analysisReportData(reportExcelDto); reportExcelDto.setJsonStr(jsonStr); -// reportExcelDto.setTotal(jsonObject.getJSONObject("rows").size()); + //reportExcelDto.setTotal(jsonObject.getJSONObject("rows").size()); return reportExcelDto; } @@ -138,7 +144,7 @@ public class ReportExcelServiceImpl implements ReportExcelService { ReportExcelDto report = detailByReportCode(reportCode); reportExcelDto.setJsonStr(report.getJsonStr()); String jsonStr = analysisReportData(reportExcelDto); - List lists=(List ) JSON.parse(jsonStr); + List lists = (List) JSON.parse(jsonStr); OutputStream out; try { String fileId = UUID.randomUUID().toString(); @@ -175,7 +181,7 @@ public class ReportExcelServiceImpl implements ReportExcelService { if (dbObjectList != null && dbObjectList.size() > 0) { for (int x = 0; x < dbObjectList.size(); x++) { - analysisSheetCellData(dbObjectList.get(x), setParam); + analysisSheetCellData(dbObjectList.get(x), setParam, reportExcelDto); } } //fastjson $ref 循环引用 @@ -230,7 +236,6 @@ public class ReportExcelServiceImpl implements ReportExcelService { } - } } @@ -248,7 +253,7 @@ public class ReportExcelServiceImpl implements ReportExcelService { * * @param dbObject */ - private void analysisSheetCellData(JSONObject dbObject, String setParam) { + private void analysisSheetCellData(JSONObject dbObject, String setParam, ReportExcelDto reportExcelDto) { //清空data值 dbObject.remove("data"); //celldata是一个一维数组 @@ -257,31 +262,32 @@ public class ReportExcelServiceImpl implements ReportExcelService { celldata.addAll((List) dbObject.get("celldata")); //整理celldata数据,转换为map格式,方便后续使用单元格位置获取对应的cell对象 - Map cellDataMap = cellDataList2Map(celldata); + Map cellDataMap = cellDataList2Map(celldata); //清除原有的数据 dbObject.getJSONArray("celldata").clear(); //获取配置项中的合并属性 JSONObject merge = dbObject.getJSONObject("config").getJSONObject("merge"); - if(merge != null) merge.clear(); + if (merge != null) merge.clear(); //定义存储每一列动态扩展的行数 - Map colAddCntMap = new HashMap<>(); + Map colAddCntMap = new HashMap<>(); // 遍历已存在的单元格,查看是否存在动态参数 for (int i = 0; i < celldata.size(); i++) { //单元格对象 JSONObject cellObj = celldata.get(i); //fastjson深拷贝问题 String cellStr = cellObj.toJSONString(); - analysisCellData(cellObj,setParam,colAddCntMap,cellStr,merge, dbObject,cellDataMap); + analysisCellData(cellObj, setParam, colAddCntMap, cellStr, merge, dbObject, cellDataMap, reportExcelDto); } } } /** * 开始解析并渲染 cellData + * * @param cellObject */ - public void analysisCellData(JSONObject cellObject,String setParam,Map colAddCntMap,String cellStr, - JSONObject merge,JSONObject dbObject,Map cellDataMap){ + public void analysisCellData(JSONObject cellObject, String setParam, Map colAddCntMap, String cellStr, + JSONObject merge, JSONObject dbObject, Map cellDataMap, ReportExcelDto reportExcelDto) { //获取行号 Integer cellR = cellObject.getInteger("r"); //获取列数 @@ -290,7 +296,7 @@ public class ReportExcelServiceImpl implements ReportExcelService { int cnt = colAddCntMap.get(cellC) == null ? 0 : colAddCntMap.get(cellC); //获取单元格类型 CellType cellType = getCellType(cellObject); - switch (cellType){ + switch (cellType) { case BLACK: //空数据单元格不处理 break; @@ -299,17 +305,18 @@ public class ReportExcelServiceImpl implements ReportExcelService { //处理动态单元格 String v = cellObject.getJSONObject("v").getString("v"); DataSetDto dataSet = getDataSet(v, setParam); - handleDynamicCellObject(dataSet,v,cellStr,cnt,cellR,cellC,merge,dbObject,colAddCntMap); + handleDynamicCellObject(dataSet, v, cellStr, cnt, cellR, cellC, merge, dbObject, colAddCntMap, reportExcelDto); break; default: //处理静态单元格 - handleStaticCellObject(cellStr,dbObject,cnt,cellR,cellC,cellDataMap,setParam,merge,colAddCntMap,cellType); + handleStaticCellObject(cellStr, dbObject, cnt, cellR, cellC, cellDataMap, setParam, merge, colAddCntMap, cellType); break; } } /** * 处理动态数据单元格自动扩展 + * * @param dataSet * @param v * @param cellStr @@ -320,13 +327,14 @@ public class ReportExcelServiceImpl implements ReportExcelService { * @param dbObject * @param colAddCntMap */ - public void handleDynamicCellObject(DataSetDto dataSet,String v,String cellStr,int cnt,int r,int c, - JSONObject merge,JSONObject dbObject,Map colAddCntMap){ + public void handleDynamicCellObject(DataSetDto dataSet, String v, String cellStr, int cnt, int r, int c, + JSONObject merge, JSONObject dbObject, Map colAddCntMap, ReportExcelDto reportExcelDto) { //获取动态数据 OriginalDataDto originalDataDto = dataSetService.getData(dataSet); + reportExcelDto.setTotal(originalDataDto.getTotal()); List cellDynamicData = originalDataDto.getData(); - if(cellDynamicData != null){ + if (cellDynamicData != null) { //循环数据赋值 for (int j = 0; j < cellDynamicData.size(); j++) { //新增的行数据 @@ -337,25 +345,25 @@ public class ReportExcelServiceImpl implements ReportExcelService { //转字符串,解决深拷贝问题 JSONObject addCellData = JSONObject.parseObject(cellStr); - addCellData.put("r", cnt + r + j); //行数增加 + addCellData.put("r", cnt + r + j); //行数增加 addCellData.put("c", c); addCellData.getJSONObject("v").put("v", replace); addCellData.getJSONObject("v").put("m", replace); JSONObject cellMc = addCellData.getJSONObject("v").getJSONObject("mc"); //判断是否是合并单元格 - if(null != cellMc){ + if (null != cellMc) { //处理合并单元格 Integer rs = cellMc.getInteger("rs"); - cellMc.put("r", cnt + r + rs*j); //行数增加 + cellMc.put("r", cnt + r + rs * j); //行数增加 cellMc.put("c", c); - addCellData.put("r", cnt + r + rs*j); + addCellData.put("r", cnt + r + rs * j); //合并单元格需要处理config.merge - merge.put(cellMc.getString("r")+"_"+cellMc.getString("c"),cellMc); + merge.put(cellMc.getString("r") + "_" + cellMc.getString("c"), cellMc); //处理单元格扩展之后此列扩展的总行数 - colAddCntMap.put(c,cnt + rs * cellDynamicData.size() - 1); - }else{ + colAddCntMap.put(c, cnt + rs * cellDynamicData.size() - 1); + } else { //处理单元格扩展之后此列扩展的总行数 - colAddCntMap.put(c,cnt + cellDynamicData.size() - 1); + colAddCntMap.put(c, cnt + cellDynamicData.size() - 1); } dbObject.getJSONArray("celldata").add(addCellData); } @@ -364,6 +372,7 @@ public class ReportExcelServiceImpl implements ReportExcelService { /** * 处理静态单元格数据 + * * @param cellStr * @param dbObject * @param cnt @@ -375,49 +384,49 @@ public class ReportExcelServiceImpl implements ReportExcelService { * @param colAddCntMap * @param cellType */ - public void handleStaticCellObject(String cellStr,JSONObject dbObject,int cnt,int r,int c, - Map cellDataMap,String setParam, - JSONObject merge,Map colAddCntMap,CellType cellType){ + public void handleStaticCellObject(String cellStr, JSONObject dbObject, int cnt, int r, int c, + Map cellDataMap, String setParam, + JSONObject merge, Map colAddCntMap, CellType cellType) { //转字符串,解决深拷贝问题 JSONObject addCellData = JSONObject.parseObject(cellStr); int rows = 0; - switch(cellType){ + switch (cellType) { case STATIC: case STATIC_MERGE: //静态不扩展单元格只需要初始化位置就可以 - initCellPosition(addCellData,cnt,merge); + initCellPosition(addCellData, cnt, merge); break; case STATIC_AUTO: //获取静态单元格右侧动态单元格的总行数 - rows = getRightDynamicCellRows(addCellData,cellDataMap,setParam,rows,cellType); - initCellPosition(addCellData,cnt,merge); - if(rows > 1){ + rows = getRightDynamicCellRows(addCellData, cellDataMap, setParam, rows, cellType); + initCellPosition(addCellData, cnt, merge); + if (rows > 1) { //需要把这个静态扩展单元格 改变为 静态合并扩展单元格,就是增加合并属性 mc 以及merge配置 JSONObject mc = new JSONObject(); - mc.put("rs",rows); - mc.put("cs",1); - mc.put("r",addCellData.getIntValue("r")); - mc.put("c",addCellData.getIntValue("c")); - addCellData.getJSONObject("v").put("mc",mc); + mc.put("rs", rows); + mc.put("cs", 1); + mc.put("r", addCellData.getIntValue("r")); + mc.put("c", addCellData.getIntValue("c")); + addCellData.getJSONObject("v").put("mc", mc); //合并单元格需要处理config.merge - merge.put((mc.getInteger("r")) + "_" + mc.getString("c"),mc); + merge.put((mc.getInteger("r")) + "_" + mc.getString("c"), mc); //处理单元格扩展之后此列扩展的总行数 - colAddCntMap.put(c,cnt + rows - 1); + colAddCntMap.put(c, cnt + rows - 1); } break; case STATIC_MERGE_AUTO: //获取静态单元格右侧动态单元格的总行数 - rows = getRightDynamicCellRows(addCellData,cellDataMap,setParam,rows,cellType); - initCellPosition(addCellData,cnt,merge); - if(rows > 0){ + rows = getRightDynamicCellRows(addCellData, cellDataMap, setParam, rows, cellType); + initCellPosition(addCellData, cnt, merge); + if (rows > 0) { //需要修改单元格mc中的rs JSONObject cellMc = addCellData.getJSONObject("v").getJSONObject("mc"); int addCnt = cellMc.getInteger("rs"); - cellMc.put("rs",rows); + cellMc.put("rs", rows); //合并单元格需要处理config.merge - merge.put((cellMc.getInteger("r")) + "_" + cellMc.getString("c"),cellMc); + merge.put((cellMc.getInteger("r")) + "_" + cellMc.getString("c"), cellMc); //处理单元格扩展之后此列扩展的总行数 - colAddCntMap.put(c,cnt + rows - addCnt); + colAddCntMap.put(c, cnt + rows - addCnt); } break; } @@ -426,31 +435,34 @@ public class ReportExcelServiceImpl implements ReportExcelService { /** * 初始化单元格位置,主要是这一列已经动态增加的行数 + * * @param addCellData * @param cnt * @param merge */ - public void initCellPosition(JSONObject addCellData,int cnt,JSONObject merge){ + public void initCellPosition(JSONObject addCellData, int cnt, JSONObject merge) { addCellData.put("r", cnt + addCellData.getInteger("r"));//行数增加 //是否是合并单元格 JSONObject mc = addCellData.getJSONObject("v").getJSONObject("mc"); - if(mc != null){ - mc.put("r",addCellData.getInteger("r")); - initCellMerge(merge,mc); + if (mc != null) { + mc.put("r", addCellData.getInteger("r")); + initCellMerge(merge, mc); } } /** * 初始化单元格合并属性的行数 + * * @param merge * @param mc */ - public void initCellMerge(JSONObject merge,JSONObject mc){ - merge.put((mc.getInteger("r"))+"_"+mc.getString("c"),mc); + public void initCellMerge(JSONObject merge, JSONObject mc) { + merge.put((mc.getInteger("r")) + "_" + mc.getString("c"), mc); } /** * 获取合并单元格右侧的动态扩展行数,用来设置当前单元格的实际 + * * @param addCellData * @param cellDataMap * @param setParam @@ -458,18 +470,18 @@ public class ReportExcelServiceImpl implements ReportExcelService { * @param cellType * @return */ - public int getRightDynamicCellRows(JSONObject addCellData,Map cellDataMap,String setParam,int sumRows,CellType cellType){ + public int getRightDynamicCellRows(JSONObject addCellData, Map cellDataMap, String setParam, int sumRows, CellType cellType) { //1、获取此单元格右侧关联的所有单元格 - List rightCellList = getRightDynamicCell(addCellData,cellDataMap,cellType); + List rightCellList = getRightDynamicCell(addCellData, cellDataMap, cellType); //2、循环获取每个单元格的扩展行数 for (JSONObject rightCell : rightCellList) { //首先判断这个单元格是否也是【静态扩展单元格】 CellType rightCellType = getCellType(rightCell); - switch (rightCellType){ + switch (rightCellType) { case STATIC_AUTO: case STATIC_MERGE_AUTO: //递归查找 - sumRows = getRightDynamicCellRows(rightCell,cellDataMap,setParam,sumRows,rightCellType); + sumRows = getRightDynamicCellRows(rightCell, cellDataMap, setParam, sumRows, rightCellType); break; case BLACK: case STATIC: @@ -479,11 +491,11 @@ public class ReportExcelServiceImpl implements ReportExcelService { sumRows += rightCell.getJSONObject("v").getJSONObject("mc").getInteger("rs"); break; default: - List cellDynamicData = getDynamicDataList(rightCell.getJSONObject("v").getString("v"),setParam); - if(cellDynamicData != null && cellDynamicData.size() > 1){ + List cellDynamicData = getDynamicDataList(rightCell.getJSONObject("v").getString("v"), setParam); + if (cellDynamicData != null && cellDynamicData.size() > 1) { int size = cellDynamicData.size(); sumRows += size; - }else{ + } else { sumRows++; } break; @@ -494,12 +506,13 @@ public class ReportExcelServiceImpl implements ReportExcelService { /** * 获取扩展单元格右侧相邻的所有单元格实体 + * * @param addCellData * @param cellDataMap * @param cellType * @return */ - public List getRightDynamicCell(JSONObject addCellData,Map cellDataMap,CellType cellType){ + public List getRightDynamicCell(JSONObject addCellData, Map cellDataMap, CellType cellType) { //静态数据合并单元格需要根据右侧的单元格进行自动向下扩展 //1、先获取右侧一列的关联的单元格,根据自身的位置,以及自己合并的合并的信息推断 //如果自己位置是 2,5,并且本身合并 行数2,列数3,则需要推断出两个单元格的位置 @@ -508,7 +521,7 @@ public class ReportExcelServiceImpl implements ReportExcelService { Integer cellC = addCellData.getInteger("c"); Integer cellRs = 0; Integer cellCs = 0; - switch (cellType){ + switch (cellType) { case STATIC_AUTO: cellRs = 1; cellCs = 1; @@ -519,11 +532,11 @@ public class ReportExcelServiceImpl implements ReportExcelService { break; } List rightCells = new ArrayList<>(); - for(int nums = 0;nums < cellRs;nums++){ + for (int nums = 0; nums < cellRs; nums++) { int r = cellR + nums; int c = cellC + cellCs; String key = r + "," + c; - if(cellDataMap.containsKey(key)){ + if (cellDataMap.containsKey(key)) { JSONObject cellData = cellDataMap.get(r + "," + c); rightCells.add(cellData); } @@ -533,48 +546,50 @@ public class ReportExcelServiceImpl implements ReportExcelService { /** * 判断单元格类型 + * * @param cellObject * @return */ - public CellType getCellType(JSONObject cellObject){ + public CellType getCellType(JSONObject cellObject) { JSONObject cellV1 = cellObject.getJSONObject("v"); if (null != cellV1 && cellV1.containsKey("v") && StringUtils.isNotBlank(cellV1.getString("v"))) { String cellV2 = cellObject.getJSONObject("v").getString("v"); String auto = cellObject.getJSONObject("v").getString("auto"); JSONObject mc = cellObject.getJSONObject("v").getJSONObject("mc"); - if(cellV2.contains("#{") && cellV2.contains("}") ){ + if (cellV2.contains("#{") && cellV2.contains("}")) { //动态单元格 - if(mc != null){ + if (mc != null) { return CellType.DYNAMIC_MERGE; - }else{ + } else { return CellType.DYNAMIC; } - }else{ + } else { //静态单元格 - if(mc != null && "1".equals(auto)){ + if (mc != null && "1".equals(auto)) { return CellType.STATIC_MERGE_AUTO; - }else { - if("1".equals(auto)){ + } else { + if ("1".equals(auto)) { return CellType.STATIC_AUTO; - }else if(mc != null){ + } else if (mc != null) { return CellType.STATIC_MERGE; - }else{ + } else { return CellType.STATIC; } } } - }else{ + } else { return CellType.BLACK; } } /** * list转为map结构,方便使用行列号查找对应cell对象 + * * @param cellDataList * @return */ - public Map cellDataList2Map(List cellDataList){ - Map cellDataMap = new HashMap<>(); + public Map cellDataList2Map(List cellDataList) { + Map cellDataMap = new HashMap<>(); for (JSONObject cellData : cellDataList) { String r = cellData.getString("r"); String c = cellData.getString("c"); @@ -585,6 +600,7 @@ public class ReportExcelServiceImpl implements ReportExcelService { /** * 解析 #{xxxx.xxxxx} 数据 + * * @param v * @return */ @@ -598,7 +614,7 @@ public class ReportExcelServiceImpl implements ReportExcelService { String substring = v.substring(start, end); if (substring.contains(".")) { String[] split = substring.split("\\."); - dto.setSetCode( split[0]); + dto.setSetCode(split[0]); dto.setFieldLabel(split[1]); getContextData(setParam, dto); return dto; @@ -610,27 +626,29 @@ public class ReportExcelServiceImpl implements ReportExcelService { /** * 获取单元格对应的动态数据集 + * * @param v * @param setParam * @return */ - private List getDynamicDataList(String v, String setParam){ - if(StringUtils.isNotBlank(v)){ - DataSetDto dataSet = getDataSet(v,setParam); - if(dataSet != null){ + private List getDynamicDataList(String v, String setParam) { + if (StringUtils.isNotBlank(v)) { + DataSetDto dataSet = getDataSet(v, setParam); + if (dataSet != null) { OriginalDataDto originalDataDto = dataSetService.getData(dataSet); List cellDynamicData = originalDataDto.getData(); return cellDynamicData; - }else{ + } else { return null; } - }else{ + } else { return null; } } /** * 动态参数替换 + * * @param setParam * @param dto */ diff --git a/report-core/src/main/resources/db/migration/V1.0.15_create_role_report.sql b/report-core/src/main/resources/db/migration/V1.0.15_create_role_report.sql new file mode 100644 index 00000000..36828df8 --- /dev/null +++ b/report-core/src/main/resources/db/migration/V1.0.15_create_role_report.sql @@ -0,0 +1,6 @@ +CREATE TABLE `access_role_report` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', + `role_code` varchar(32) COLLATE utf8_bin NOT NULL COMMENT '角色名称', + `report_code` varchar(64) COLLATE utf8_bin NOT NULL COMMENT '报表编码', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=DYNAMIC COMMENT='运营角色报表关联表'; \ No newline at end of file diff --git a/report-ui/src/api/accessRole.js b/report-ui/src/api/accessRole.js index 0c0a4a49..eff50469 100755 --- a/report-ui/src/api/accessRole.js +++ b/report-ui/src/api/accessRole.js @@ -46,6 +46,8 @@ export function accessRoleAuthorityTree (roleCode) { }) } + + export function saveAuthorityTree (data) { return request({ url: 'accessRole/saveAuthorityTree', @@ -55,4 +57,19 @@ export function saveAuthorityTree (data) { } -export default { accessRoleList, accessRoleAdd, accessRoleDeleteBatch, accessRoleUpdate, accessRoleDetail, accessRoleAuthorityTree, saveAuthorityTree } +export function authorityReportTree (roleCode) { + return request({ + url: 'accessRole/authorityReportTree/' + roleCode, + method: 'get', + }) +} + +export function saveAuthorityReportTree (data) { + return request({ + url: 'accessRole/saveAuthorityReportTree', + method: 'post', + data + }) +} + +export default { accessRoleList, accessRoleAdd, accessRoleDeleteBatch, accessRoleUpdate, accessRoleDetail, accessRoleAuthorityTree, saveAuthorityTree, authorityReportTree, saveAuthorityReportTree } diff --git a/report-ui/src/views/accessRole/components/RoleReport.vue b/report-ui/src/views/accessRole/components/RoleReport.vue new file mode 100644 index 00000000..bd13a3c4 --- /dev/null +++ b/report-ui/src/views/accessRole/components/RoleReport.vue @@ -0,0 +1,92 @@ + + + diff --git a/report-ui/src/views/accessRole/index.vue b/report-ui/src/views/accessRole/index.vue index 3e762e23..ada32f8f 100755 --- a/report-ui/src/views/accessRole/index.vue +++ b/report-ui/src/views/accessRole/index.vue @@ -13,8 +13,12 @@ type="text" @click="handleOpenDialogSetAuthorityForRole(props)" v-permission="'roleManage:grantAuthority'" - >分配权限 + >分配权限 + 关联报表 @@ -35,15 +44,18 @@ import { accessRoleDetail } from "@/api/accessRole"; import RoleAuthority from "@/views/accessRole/components/RoleAuthority"; +import RoleReport from "@/views/accessRole/components/RoleReport"; export default { name: "AccessRole", components: { - RoleAuthority: RoleAuthority + RoleAuthority: RoleAuthority, + RoleReport: RoleReport }, data() { return { // 选中一个角色,点设定权限时,弹出对话框 dialogVisibleSetAuthorityForRole: false, + dialogVisibleSetReportForRole: false, roleCode: "", // 页面渲染使用 @@ -202,6 +214,10 @@ export default { handleOpenDialogSetAuthorityForRole(props) { this.roleCode = props.msg.roleCode; this.dialogVisibleSetAuthorityForRole = true; + }, + handleOpenDialogSetReportForRole(props) { + this.roleCode = props.msg.roleCode; + this.dialogVisibleSetReportForRole = true; } } }; diff --git a/report-ui/src/views/excelreport/viewer/index.vue b/report-ui/src/views/excelreport/viewer/index.vue index b94dd9a9..7aed447b 100644 --- a/report-ui/src/views/excelreport/viewer/index.vue +++ b/report-ui/src/views/excelreport/viewer/index.vue @@ -23,25 +23,32 @@

表格查询

+

{{ item.name }}

+
+
查询
-
+
@@ -57,6 +64,10 @@ export default { return { options: {}, sheet: {}, + total: 0, + loading: false, + currentPage4: 1, + pageSize: 100, reportId: null, reportCode: null, reportName: null, @@ -70,15 +81,27 @@ export default { }; }, mounted() { + this.loading = true; this.preview(); }, created() { this.reportCode = this.$route.query.reportCode; }, methods: { + handleSizeChange(val){ + this.pageSize = val; + this.currentPage4 = 1; + this.searchPreview(); + }, + handleCurrentChange(val){ + this.currentPage4 = val; + this.searchPreview(); + }, async searchPreview() { + this.loading = true; const arr = this.toObject(this.tableData2); this.params.setParam = JSON.stringify(arr); + //每次都重新加载需要改成刷新 this.preview(); }, @@ -86,6 +109,7 @@ export default { this.excelData = {}; this.params.reportCode = this.reportCode; const { code, data } = await preview(this.params); + this.loading = false; if (code != 200) return; this.reportName = JSON.parse(data.jsonStr).name; // 渲染查询表单 @@ -101,6 +125,7 @@ export default { } this.tableData2 = extendArry; + this.total = data.total; this.excelData = data.jsonStr; this.sheetData = data == null ? [{}] : JSON.parse(data.jsonStr); // console.log(this.excelData) @@ -132,8 +157,17 @@ export default { for (const key in objfirst) { const newObj = {}; objfirst[key].map(ev => { + console.log(ev.name); + if(ev.name == 'pageSize'){ + ev.value = this.pageSize; + } + + if(ev.name == 'pageNumber'){ + ev.value = this.currentPage4; + } Object.assign(newObj, { [ev.name]: ev.value }); }); + objSecond[key] = newObj; } return objSecond; -- Gitee From 1fb5223d3b2be828d581a279efd20bc461c2a4f0 Mon Sep 17 00:00:00 2001 From: yuanxiaobin Date: Thu, 5 May 2022 16:52:55 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E9=85=8D=E6=8A=A5=E8=A1=A8=E6=9D=83=E9=99=90=E5=88=B0?= =?UTF-8?q?=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...15_create_role_report.sql => V1.0.15__create_role_report.sql} | 1 + 1 file changed, 1 insertion(+) rename report-core/src/main/resources/db/migration/{V1.0.15_create_role_report.sql => V1.0.15__create_role_report.sql} (90%) diff --git a/report-core/src/main/resources/db/migration/V1.0.15_create_role_report.sql b/report-core/src/main/resources/db/migration/V1.0.15__create_role_report.sql similarity index 90% rename from report-core/src/main/resources/db/migration/V1.0.15_create_role_report.sql rename to report-core/src/main/resources/db/migration/V1.0.15__create_role_report.sql index 36828df8..bda12c7f 100644 --- a/report-core/src/main/resources/db/migration/V1.0.15_create_role_report.sql +++ b/report-core/src/main/resources/db/migration/V1.0.15__create_role_report.sql @@ -1,3 +1,4 @@ +DROP TABLE IF EXISTS `access_role_report`; CREATE TABLE `access_role_report` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `role_code` varchar(32) COLLATE utf8_bin NOT NULL COMMENT '角色名称', -- Gitee