From d4f6d2c64ee16003236d7a45863671b33c62879c Mon Sep 17 00:00:00 2001 From: qianming Date: Mon, 14 Feb 2022 15:12:55 +0800 Subject: [PATCH 01/62] =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/docs/guide/quicklySeparate.md | 1 + doc/docs/guide/quicklySource.md | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/docs/guide/quicklySeparate.md b/doc/docs/guide/quicklySeparate.md index d31a3557..7917ce58 100644 --- a/doc/docs/guide/quicklySeparate.md +++ b/doc/docs/guide/quicklySeparate.md @@ -51,6 +51,7 @@ report-core --> src --> main --> resources --> bootstrap.yml
**打包之前如果系统用的不止mysql数据源,需要自己在pom文件中加入对应的数据库的驱动,登陆系统之后,数据源提示无驱动,则选择通用JDBC数据源,这里不做演示了**
使用 maven package
**注**:不要使用maven install
+**注**:此方式不会打包 lib目录下的驱动,详情可查看 **数据源 扩展**
![img10](../picture/quickly/img_10.png)
### linux启动jar包 diff --git a/doc/docs/guide/quicklySource.md b/doc/docs/guide/quicklySource.md index 867ff652..9c272a68 100644 --- a/doc/docs/guide/quicklySource.md +++ b/doc/docs/guide/quicklySource.md @@ -15,7 +15,9 @@ http://serverip:9095 ## 编译环境 -请在Linux上先准备好maven、node.js、jdk +请在Linux上先准备好maven、node.js、jdk
+如果在Win10上部署,还需要下载一个 Git 软件,软件名就是 Git
+以下内容需要特别注意的地方会有对应提示。
- [Apache Maven] 3.5
- [Node.js] v14.16.0
@@ -34,6 +36,9 @@ git clone https://gitee.com/anji-plus/report.git
![img_4.png](../picture/quickly/img_4.png)
编译完成后是放在当前目录下的build文件夹中:aj-report-xxxx.zip
+**注:** 如果Win10部署的话,如图用git执行sh build.sh就行了。Linux就直接去report目录下执行sh build.sh就行。
+**特别注意:** 如果是Win10编译,那么几个启动脚本的格式则是win的格式,放linux上执行会报错的,反之放linux编译在win10启动也会报错,需要转格式。
+ ## 修改mysql连接 解压aj-report-xxxx.zip,找到bootstrap.yml
@@ -56,11 +61,12 @@ linux启动:
aj-report-XXX --> bin --> start.sh
sh bin/start.sh
-注意啊,如果你在linux打包,然后在win上执行,要转化start.bat文件的格式,反之也是一样。 +win10启动:
+aj-report-XXX --> bin --> start.bat
+双击start.bat启动
## 日志位置 -看到控制台提示“The AJ-Report started!”,说明report正在启动,可以看看日志以确定程序启动到哪里了。
日志的位置是:report-xxx/logs/aj-report.log
## 访问 From dbe0abc99f62d31ff686660e268a78f398fee847 Mon Sep 17 00:00:00 2001 From: qianming Date: Tue, 15 Feb 2022 14:12:30 +0800 Subject: [PATCH 02/62] =?UTF-8?q?=E5=A0=86=E5=8F=A0=E5=AF=B9=E6=AF=94?= =?UTF-8?q?=E5=9B=BE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-ui/src/mixins/queryform.js | 2 +- .../designer/widget/bar/widgetBarCompareChart.vue | 2 +- .../designer/widget/bar/widgetBarStackChart.vue | 2 +- .../designer/widget/line/widgetLineCompareChart.vue | 2 +- .../designer/widget/line/widgetLineStackChart.vue | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/report-ui/src/mixins/queryform.js b/report-ui/src/mixins/queryform.js index 4454041d..23a9ea75 100644 --- a/report-ui/src/mixins/queryform.js +++ b/report-ui/src/mixins/queryform.js @@ -175,7 +175,7 @@ export default { for (const key in chartProperties) { if (chartProperties[key] !== 'yAxis' && !chartProperties[key].startsWith('xAxis')) { Object.keys(dataGroup).forEach(item => { - const data = new Array(yAxisList.length).fill(0) + const data = new Array(xAxisList.length).fill(0) dataGroup[item].forEach(res => { data[xAxisList.indexOf(res[xAxisField])]= res[key] }) diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarCompareChart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarCompareChart.vue index 17adedba..d0ce849c 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarCompareChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarCompareChart.vue @@ -572,7 +572,7 @@ export default { 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(xAxisList.length).fill(0); for (const j in xAxisList) { for (const k in val) { if (val[k].name == yAxisList[i]) { diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarStackChart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarStackChart.vue index dc06b0b4..c275db89 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarStackChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarStackChart.vue @@ -314,7 +314,7 @@ export default { 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(xAxisList.length).fill(0); for (const j in xAxisList) { for (const k in val) { if (val[k].name == yAxisList[i]) { 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 e71d3b6c..729ee3b9 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineCompareChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineCompareChart.vue @@ -618,7 +618,7 @@ export default { 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(xAxisList.length).fill(0); for (const j in xAxisList) { for (const k in val) { if (val[k].name == yAxisList[i]) { diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineStackChart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineStackChart.vue index c06ec3d4..6bfd591f 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineStackChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineStackChart.vue @@ -332,7 +332,7 @@ export default { 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(xAxisList.length).fill(0); for (const j in xAxisList) { for (const k in val) { if (val[k].name == yAxisList[i]) { From 0b251147a7ad4f472a3b0e08a38bd587459b56e6 Mon Sep 17 00:00:00 2001 From: qianming Date: Tue, 22 Feb 2022 08:49:29 +0800 Subject: [PATCH 03/62] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigscreenDesigner/designer/components/customUpload.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/report-ui/src/views/bigscreenDesigner/designer/components/customUpload.vue b/report-ui/src/views/bigscreenDesigner/designer/components/customUpload.vue index 6456b522..43c1b76a 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/components/customUpload.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/components/customUpload.vue @@ -47,7 +47,7 @@ export default { if (type === "image") { this.upload(file); } else { - this.$message.warn("只能上次图片格式"); + this.$message.warn("只能上传图片格式"); } }, upload(imgUrl) { From 482c865f92cecf073da71b9e9875299529c9d8fe Mon Sep 17 00:00:00 2001 From: tclqwl <33955341@qq.com> Date: Tue, 22 Feb 2022 17:35:04 +0800 Subject: [PATCH 04/62] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E6=92=A4=E9=94=80?= =?UTF-8?q?=E5=92=8C=E6=81=A2=E5=A4=8D=E5=8A=9F=E8=83=BD=202.=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BB=8E=E5=B7=A5=E5=85=B7=E6=A0=8F=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=88=B0=E7=94=BB=E5=B8=83=E6=97=B6=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=88=9D=E5=A7=8B=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-ui/src/utils/revoke.js | 102 ++++++++++++++++++ .../bigscreenDesigner/designer/index.vue | 64 +++++++++++ 2 files changed, 166 insertions(+) create mode 100644 report-ui/src/utils/revoke.js diff --git a/report-ui/src/utils/revoke.js b/report-ui/src/utils/revoke.js new file mode 100644 index 00000000..119b7699 --- /dev/null +++ b/report-ui/src/utils/revoke.js @@ -0,0 +1,102 @@ +/** + 撤销重做功能 + * @Author: eyas66 + * @Mail: 33955341@qq.com + * @Date: 2021-12-13 10:09:23 + * @Last Modified by: eyas66 + * @Last Modified time: 2021-12-13 10:09:23 + */ +export class Revoke { + // 历史记录 + recordList = []; + + // 撤销记录,用于重做 + redoList = []; + + // 当前记录用currentRecord变量暂时存储,当用户修改时,再存放到recordList + currentRecord = null; + + // 上次插入数据时间 + time = 0; + + /** + * @description: 插入历史记录 + * @param {object}record + * @return {boolean} + */ + push(record) { + const nowTime = Date.now(); + // 防止添加重复的时间,当添加间隔小于100ms时,则替换当前记录并取消执行添加 + if (this.time + 100 > nowTime) { + this.currentRecord = JSON.stringify(record); + return false; + } + + this.time = nowTime; + + // 判断之前是否已经存在currentRecord记录,有则存储到recordList + if (this.currentRecord) { + this.recordList.push(this.currentRecord); + //(清空记录)增加记录后则应该清空重做记录 + //splice() 方法向/从数组添加/删除项目,并返回删除的项目。 + this.redoList.splice(0, this.redoList.length); + } + + // 将json转成字符串存储 + this.currentRecord = JSON.stringify(record); + + // 最多存储2000条记录,超过2000条记录则删除之前的记录 + if (this.length > 2000) { + //unshift() 方法将新项添加到数组的开头,并返回新的长度。 + this.recordList.unshift(); + } + + return true; + } + + /** + * @description: 撤销操作 + * @param {*} + * @return {object} + */ + undo() { + // 没有记录时,返回false + // 新建的recordList里面,不知为什么会存在一条记录,未找到原因,所以就判断长度为1时就不能撤销了。 + if (this.recordList.length === 1 ) { + return false; + } + //pop(): 方法用于删除并返回数组的最后一个元素。 + const record = this.recordList.pop(); + + // 将当前记录添加到重做记录里面 + if (this.currentRecord) { + this.redoList.push(this.currentRecord); + } + // 丢弃当前记录,防止重复添加 + this.currentRecord = null; + //返回撤销的记录 + return JSON.parse(record); + } + + /** + * @description: 重做操作 + * @param {*} + * @return {*} + */ + redo() { + // 没有重做记录时,返回false + if (this.redoList.length === 0) { + return false; + } + //pop(): 方法用于删除并返回数组的最后一个元素。 + const record = this.redoList.pop(); + // 添加到重做记录里面 + if (this.currentRecord) { + this.recordList.push(this.currentRecord); + } + // 丢弃当前记录,防止重复添加 + this.currentRecord = null; + + return JSON.parse(record); + } +} diff --git a/report-ui/src/views/bigscreenDesigner/designer/index.vue b/report-ui/src/views/bigscreenDesigner/designer/index.vue index a72a81c9..8109f0c2 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/index.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/index.vue @@ -88,6 +88,29 @@ + + + + 撤销 + + + + + + 恢复 + + + { + this.revoke.push(this.widgets) + }) }, deep: true } }, + created() { + /* 以下是记录历史的 */ + this.revoke = new Revoke() + }, mounted() { // 如果是新的设计工作台 this.initEchartData(); @@ -408,6 +441,30 @@ export default { }); }, methods: { + /** + * @description: 恢复 + * @param {*} + * @return {*} + */ + handleUndo() { + const record = this.revoke.undo() + if (!record) { + return false + } + this.widgets = record + }, + /** + * @description: 重做 + * @param {*} + * @return {*} + */ + handleRedo() { + const record = this.revoke.redo() + if (!record) { + return false + } + this.widgets = record + }, handlerLayerWidget(val) { const layerWidgetArr = []; for (let i = 0; i < val.length; i++) { @@ -639,6 +696,13 @@ export default { }; // 处理默认值 const widgetJsonValue = this.handleDefaultValue(widgetJson); + + //2022年02月22日 修复:可以拖拽放到鼠标的位置 + widgetJsonValue.value.position.left = + x - widgetJsonValue.value.position.width / 2 + widgetJsonValue.value.position.top = + y - widgetJsonValue.value.position.height / 2 + // 将选中的复制组件,放到工作区中去 this.widgets.push(this.deepClone(widgetJsonValue)); // 激活新组件的配置属性 From f09c737461061664f9b4480f82479d7b1e9e401f Mon Sep 17 00:00:00 2001 From: Raod <1130305001@qq.com> Date: Wed, 23 Feb 2022 12:57:18 +0800 Subject: [PATCH 05/62] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=EF=BC=9Agroov?= =?UTF-8?q?y=E6=89=A7=E8=A1=8Cjava=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-core/pom.xml | 7 ++ .../gaea/business/code/ResponseCode.java | 1 + .../service/IGroovyHandler.java | 14 ++++ .../impl/GroovyTransformServiceImpl.java | 65 +++++++++++++++++++ .../service/impl/JsTransformServiceImpl.java | 1 + .../db/migration/V1.0.15__update_javaBean.sql | 1 + .../resources/i18n/messages_en_US.properties | 1 + .../resources/i18n/messages_zh_CN.properties | 1 + .../src/test/java/com/DemoGroovyHandler.java | 18 +++++ report-core/src/test/java/com/GroovyTest.java | 58 +++++++++++++++++ .../resultset/components/EditDataSet.vue | 48 ++++++++------ 11 files changed, 194 insertions(+), 21 deletions(-) create mode 100644 report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/IGroovyHandler.java create mode 100644 report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/impl/GroovyTransformServiceImpl.java create mode 100644 report-core/src/main/resources/db/migration/V1.0.15__update_javaBean.sql create mode 100644 report-core/src/test/java/com/DemoGroovyHandler.java create mode 100644 report-core/src/test/java/com/GroovyTest.java diff --git a/report-core/pom.xml b/report-core/pom.xml index 423b3b05..7118783c 100644 --- a/report-core/pom.xml +++ b/report-core/pom.xml @@ -151,6 +151,13 @@ poi-ooxml-schemas 4.1.2 + + + org.codehaus.groovy + groovy + 3.0.9 + + diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/code/ResponseCode.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/code/ResponseCode.java index 94494b03..f0fe7039 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/code/ResponseCode.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/code/ResponseCode.java @@ -131,6 +131,7 @@ public interface ResponseCode { String SET_CODE_ISEXIST = "4008"; String SOURCE_CODE_ISEXIST = "4009"; String CLASS_NOT_FOUND = "4010"; + String EXECUTE_GROOVY_ERROR = "4011"; String REPORT_SHARE_LINK_INVALID = "report.share.link.invalid"; diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/IGroovyHandler.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/IGroovyHandler.java new file mode 100644 index 00000000..eb03cdaa --- /dev/null +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/IGroovyHandler.java @@ -0,0 +1,14 @@ +package com.anjiplus.template.gaea.business.modules.datasettransform.service; + +import com.alibaba.fastjson.JSONObject; + +import java.util.List; + +/** + * @author: Raod + * @since: 2022-02-23 + */ +public interface IGroovyHandler { + + List transform(List data); +} diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/impl/GroovyTransformServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/impl/GroovyTransformServiceImpl.java new file mode 100644 index 00000000..dc2de478 --- /dev/null +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/impl/GroovyTransformServiceImpl.java @@ -0,0 +1,65 @@ +package com.anjiplus.template.gaea.business.modules.datasettransform.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.anji.plus.gaea.exception.BusinessExceptionBuilder; +import com.anjiplus.template.gaea.business.code.ResponseCode; +import com.anjiplus.template.gaea.business.modules.datasettransform.controller.dto.DataSetTransformDto; +import com.anjiplus.template.gaea.business.modules.datasettransform.service.IGroovyHandler; +import com.anjiplus.template.gaea.business.modules.datasettransform.service.TransformStrategy; +import groovy.lang.GroovyClassLoader; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.script.Invocable; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import java.util.List; + +/** + * Created by raodeming on 2021/3/23. + */ +@Component +@Slf4j +public class GroovyTransformServiceImpl implements TransformStrategy { + + private GroovyClassLoader groovyClassLoader = new GroovyClassLoader(); + + /** + * 数据清洗转换 类型 + * + * @return + */ + @Override + public String type() { + return "javaBean"; + } + + /*** + * 清洗转换算法接口 + * @param def + * @param data + * @return + */ + @Override + public List transform(DataSetTransformDto def, List data) { + String transformScript = def.getTransformScript(); + Class clazz = groovyClassLoader.parseClass(transformScript); + if (clazz != null) { + try { + Object instance = clazz.newInstance(); + if (instance!=null) { + if (instance instanceof IGroovyHandler) { + IGroovyHandler handler = (IGroovyHandler) instance; + return handler.transform(data); + } else { + System.err.println("转换失败!"); + } + } + } catch (Exception e) { + log.info("执行javaBean异常", e); + throw BusinessExceptionBuilder.build(ResponseCode.EXECUTE_GROOVY_ERROR, e.getMessage()); + } + } + return data; + } +} diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/impl/JsTransformServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/impl/JsTransformServiceImpl.java index 082a2796..a33a7dff 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/impl/JsTransformServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasettransform/service/impl/JsTransformServiceImpl.java @@ -58,6 +58,7 @@ public class JsTransformServiceImpl implements TransformStrategy { } } catch (Exception ex) { + log.info("执行js异常", ex); throw BusinessExceptionBuilder.build(ResponseCode.EXECUTE_JS_ERROR, ex.getMessage()); } return null; diff --git a/report-core/src/main/resources/db/migration/V1.0.15__update_javaBean.sql b/report-core/src/main/resources/db/migration/V1.0.15__update_javaBean.sql new file mode 100644 index 00000000..9d1b9738 --- /dev/null +++ b/report-core/src/main/resources/db/migration/V1.0.15__update_javaBean.sql @@ -0,0 +1 @@ +UPDATE `aj_report`.`gaea_dict_item` SET `dict_code` = 'TRANSFORM_TYPE', `item_name` = 'java脚本', `item_value` = 'javaBean', `item_extend` = NULL, `enabled` = 1, `locale` = 'zh', `remark` = NULL, `sort` = 2, `create_by` = 'admin', `create_time` = '2021-03-23 10:54:08', `update_by` = 'admin', `update_time` = '2021-03-23 10:54:08', `version` = 1 WHERE `id` = 151; diff --git a/report-core/src/main/resources/i18n/messages_en_US.properties b/report-core/src/main/resources/i18n/messages_en_US.properties index 4219c464..43cf12ef 100644 --- a/report-core/src/main/resources/i18n/messages_en_US.properties +++ b/report-core/src/main/resources/i18n/messages_en_US.properties @@ -47,5 +47,6 @@ Component.load.check.error={0} Component not load 4008=The set code does not allow duplication 4009=The source code does not allow duplication 4010=Can't auto find match driver class +4011=execute javaBean error report.share.link.invalid=report share link invalid diff --git a/report-core/src/main/resources/i18n/messages_zh_CN.properties b/report-core/src/main/resources/i18n/messages_zh_CN.properties index c25afa66..a8e54261 100644 --- a/report-core/src/main/resources/i18n/messages_zh_CN.properties +++ b/report-core/src/main/resources/i18n/messages_zh_CN.properties @@ -48,6 +48,7 @@ Component.load.check.error={0}\u7EC4\u4EF6\u672A\u52A0\u8F7D 4008=\u6570\u636E\u96C6\u7F16\u7801\u4E0D\u5141\u8BB8\u91CD\u590D 4009=\u6570\u636E\u6E90\u7F16\u7801\u4E0D\u5141\u8BB8\u91CD\u590D 4010=\u9A71\u52A8\u5305\u4E0D\u5B58\u5728 +4011=\u6267\u884CjavaBean\u5931\u8D25 6001={0} 7001=\u89E3\u6790\u5931\u8D25 diff --git a/report-core/src/test/java/com/DemoGroovyHandler.java b/report-core/src/test/java/com/DemoGroovyHandler.java new file mode 100644 index 00000000..1ec6cb54 --- /dev/null +++ b/report-core/src/test/java/com/DemoGroovyHandler.java @@ -0,0 +1,18 @@ +package com; + +import com.alibaba.fastjson.JSONObject; +import com.anjiplus.template.gaea.business.modules.datasettransform.service.IGroovyHandler; + +import java.util.List; + +/** + * 建议在idea写好复制整个类到此处,位置report-core/src/test/java/com/DemoGroovyHandler.java + */ +public class DemoGroovyHandler implements IGroovyHandler { + + @Override + public List transform(List data) { + + return data; + } +} diff --git a/report-core/src/test/java/com/GroovyTest.java b/report-core/src/test/java/com/GroovyTest.java new file mode 100644 index 00000000..b695c361 --- /dev/null +++ b/report-core/src/test/java/com/GroovyTest.java @@ -0,0 +1,58 @@ +package com; + +import com.alibaba.fastjson.JSONObject; +import com.anjiplus.template.gaea.business.modules.datasettransform.service.IGroovyHandler; +import groovy.lang.GroovyClassLoader; + +import java.util.List; + +/** + * @author: Raod + * @since: 2022-02-23 + */ +public class GroovyTest { + + + public static void main(String[] args) throws InstantiationException, IllegalAccessException { + // codeSource来自DemoGroovyHandler + String codeSource = "package com;\n" + + "\n" + + "import com.alibaba.fastjson.JSONObject;\n" + + "import com.anjiplus.template.gaea.business.modules.datasettransform.service.IGroovyHandler;\n" + + "\n" + + "import java.util.ArrayList;\n" + + "import java.util.List;\n" + + "\n" + + "/**\n" + + " * @author: Raod\n" + + " * @since: 2022-02-23\n" + + " */\n" + + "public class DemoGroovyHandler implements IGroovyHandler {\n" + + "\n" + + " @Override\n" + + " public List transform(List data) {\n" + + " List result = new ArrayList<>();\n" + + " JSONObject jsonObject = new JSONObject();\n" + + " jsonObject.put(\"test\", \"demo\");\n" + + " result.add(jsonObject);\n" + + " return result;\n" + + " }\n" + + "}"; + GroovyClassLoader groovyClassLoader = new GroovyClassLoader(); + Class clazz = groovyClassLoader.parseClass(codeSource); + if (clazz != null) { + Object instance = clazz.newInstance(); + if (instance!=null) { + if (instance instanceof IGroovyHandler) { + IGroovyHandler handler = (IGroovyHandler) instance; + List transform = handler.transform(null); + System.out.println(JSONObject.toJSONString(transform)); + + } else { + System.err.println("转换失败!"); + } + } + } + } + +} diff --git a/report-ui/src/views/resultset/components/EditDataSet.vue b/report-ui/src/views/resultset/components/EditDataSet.vue index 966d17b2..562a78b9 100644 --- a/report-ui/src/views/resultset/components/EditDataSet.vue +++ b/report-ui/src/views/resultset/components/EditDataSet.vue @@ -229,7 +229,8 @@ -
+
transform(List data) { + + return data; + } +}`; + this.transformScript = item.transformScript + ? item.transformScript + : fnCont; } }, // js 脚本编辑确定 From 743141290c7e21f3a0c2982b7e8799102ad16dde Mon Sep 17 00:00:00 2001 From: qianming Date: Wed, 23 Feb 2022 13:49:14 +0800 Subject: [PATCH 06/62] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-core/src/main/resources/bootstrap.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/report-core/src/main/resources/bootstrap.yml b/report-core/src/main/resources/bootstrap.yml index b694ce45..2d3581a3 100644 --- a/report-core/src/main/resources/bootstrap.yml +++ b/report-core/src/main/resources/bootstrap.yml @@ -66,9 +66,10 @@ logging: customer: # 开发测试用本地文件,如果是生产,请考虑使用对象存储 file: - #上传对应本地全路径,路径必须是真实存在的 + #上传对应本地全路径,目录必须是真实存在的,注意 Win是 \ 且有盘符,linux是 / 无盘符 dist-path: /app/disk/upload/ - white-list: .png|.jpg|.gif|.icon|.pdf|.xlsx|.xls|.csv|.mp4|.avi + #dist-path: D:\Download + white-list: .png|.jpg|.jpeg|.gif|.icon|.pdf|.xlsx|.xls|.csv|.mp4|.avi excelSuffix: .xlsx|.xls|.csv #上传对应下载的下载链接路径 http://serverip:9095/file/download downloadPath: http://10.108.26.197:9095/file/download From 91625411c8d0008fdcf465d6b126b4a2bc10b626 Mon Sep 17 00:00:00 2001 From: jian_fei_zhang <1790200889@qq.com> Date: Fri, 25 Feb 2022 21:28:46 +0800 Subject: [PATCH 07/62] =?UTF-8?q?=E5=9B=BE=E7=89=87=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=8B=E8=BD=AC=E9=80=9F=E5=BA=A6=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-ui/src/assets/styles/anji.scss | 18 ++++++++++++++++ .../designer/tools/configure/widget-image.js | 10 ++++++++- .../designer/widget/widgetImage.vue | 21 +++---------------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/report-ui/src/assets/styles/anji.scss b/report-ui/src/assets/styles/anji.scss index 1cfe79a4..ee5d1587 100644 --- a/report-ui/src/assets/styles/anji.scss +++ b/report-ui/src/assets/styles/anji.scss @@ -77,3 +77,21 @@ .el-table td { padding: 6px 0; } + +@keyframes turn { + 0% { + -webkit-transform: rotate(0deg); + } + 25% { + -webkit-transform: rotate(90deg); + } + 50% { + -webkit-transform: rotate(180deg); + } + 75% { + -webkit-transform: rotate(270deg); + } + 100% { + -webkit-transform: rotate(360deg); + } +} diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-image.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-image.js index 9e039cb3..37fff15b 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-image.js +++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-image.js @@ -1,6 +1,6 @@ /* * @Descripttion: 图片json - * @version: + * @version: * @Author: qianlishi * @Date: 2021-08-29 07:07:23 * @LastEditors: qianlishi @@ -30,6 +30,14 @@ export const widgetImage = { placeholder: '', value: false, }, + { + type: 'el-slider', + label: '旋转速度', + name: 'rotationSpeed', + required: false, + placeholder: '', + value: 70 + }, { type: 'el-slider', label: '透明度', diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/widgetImage.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/widgetImage.vue index afbd2eab..16794c43 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/widgetImage.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/widgetImage.vue @@ -41,7 +41,8 @@ export default { return { imageAdress: this.transStyle.imageAdress, "border-radius": this.transStyle.borderRadius + "px", - opacity: this.transStyle.transparency / 100 + opacity: this.transStyle.transparency / 100, + animation: this.transStyle.startRotate? "turn "+(101-this.transStyle.rotationSpeed)/10+"s linear infinite":"none" }; } }, @@ -74,21 +75,5 @@ export default { .startImg { animation: turn 1s linear infinite; } -@keyframes turn { - 0% { - -webkit-transform: rotate(0deg); - } - 25% { - -webkit-transform: rotate(90deg); - } - 50% { - -webkit-transform: rotate(180deg); - } - 75% { - -webkit-transform: rotate(270deg); - } - 100% { - -webkit-transform: rotate(360deg); - } -} + From 8bea4e8a59cf5d013ce3b7168e77cee599d261df Mon Sep 17 00:00:00 2001 From: Raod <1130305001@qq.com> Date: Thu, 3 Mar 2022 15:59:28 +0800 Subject: [PATCH 08/62] =?UTF-8?q?hotfix-----windows=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E4=B9=B1=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/gaea/business/util/FileUtil.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/util/FileUtil.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/util/FileUtil.java index 8a81f0c1..6fcdbacf 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/util/FileUtil.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/util/FileUtil.java @@ -8,6 +8,7 @@ import org.springframework.web.multipart.MultipartFile; import java.io.*; import java.net.URL; import java.nio.channels.FileChannel; +import java.nio.charset.StandardCharsets; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; import java.util.Enumeration; @@ -116,9 +117,11 @@ public class FileUtil { */ public static String readFile(File file) { BufferedReader reader = null; + InputStreamReader isr = null; StringBuilder sbf = new StringBuilder(); try { - reader = new BufferedReader(new FileReader(file)); + isr = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8); + reader = new BufferedReader(isr); String tempStr; while ((tempStr = reader.readLine()) != null) { sbf.append(tempStr); @@ -129,6 +132,13 @@ public class FileUtil { log.error("读文件失败", e); throw BusinessExceptionBuilder.build(ResponseCode.FAIL_CODE, e.getMessage()); } finally { + if (null != isr) { + try { + isr.close(); + } catch (IOException e) { + throw BusinessExceptionBuilder.build(ResponseCode.FAIL_CODE, e.getMessage()); + } + } if (reader != null) { try { reader.close(); From 7574eea59bf15762ef569863ef7ce6540bf8b06a Mon Sep 17 00:00:00 2001 From: qianlishi <1432731663@qq.com> Date: Wed, 9 Mar 2022 10:05:15 +0800 Subject: [PATCH 09/62] =?UTF-8?q?=E6=9B=B4=E6=96=B0anji-crud=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnjiPlus/anji-crud/anji-crud.vue | 249 ++++++++++++------ report-ui/src/mixins/common.js | 1 + report-ui/src/views/accessAuthority/index.vue | 46 +++- report-ui/src/views/accessRole/index.vue | 62 ++++- report-ui/src/views/accessUser/index.vue | 61 ++++- .../bigscreenDesigner/designer/designer.js | 0 .../designer/widget/widget.vue | 15 +- report-ui/src/views/datasource/index.vue | 66 +++-- report-ui/src/views/dict/dict-item.vue | 44 +++- report-ui/src/views/dict/index.vue | 69 ++++- report-ui/src/views/fileManagement/index.vue | 44 +++- report-ui/src/views/reportManage/index.vue | 82 ++++-- report-ui/src/views/resultset/index.vue | 70 +++-- 13 files changed, 593 insertions(+), 216 deletions(-) create mode 100644 report-ui/src/views/bigscreenDesigner/designer/designer.js diff --git a/report-ui/src/components/AnjiPlus/anji-crud/anji-crud.vue b/report-ui/src/components/AnjiPlus/anji-crud/anji-crud.vue index 74cdc33c..60bfe835 100644 --- a/report-ui/src/components/AnjiPlus/anji-crud/anji-crud.vue +++ b/report-ui/src/components/AnjiPlus/anji-crud/anji-crud.vue @@ -147,38 +147,57 @@ -
- - 新增 - 删除 - -
+ +
@@ -282,59 +301,108 @@ align="center" fixed="right" label="操作" - :width=" - option.buttons.customButton && - option.buttons.customButton.operationWidth - ? option.buttons.customButton.operationWidth - : 100 - " + :width="option.buttons.rowButtonsWidth || 100" > + @@ -668,6 +736,21 @@ export default { }; this.$emit("handleCustomValue", obj); }, + handlegetLable(item, label) { + if (typeof label == "function") { + return label(item); + } else { + return label; + } + }, + // 是否disabled + isDisabledButton(item, row) { + if (typeof item.isDisable === "function") { + return item.isDisable(row); + } else { + return !!item.disabled; + } + }, // 弹框被关闭时的回调事件 editDialogClosedEvent(value) { // 把列表页中弹框打开标记改成已关闭 diff --git a/report-ui/src/mixins/common.js b/report-ui/src/mixins/common.js index 8ea3bf87..da60b501 100644 --- a/report-ui/src/mixins/common.js +++ b/report-ui/src/mixins/common.js @@ -272,6 +272,7 @@ export default { return { top: top, left: left } }, objToOne (obj) { + console.log(obj) let tmpData = {} for (let index in obj) { if (typeof obj[index] == 'object' && !this.isArrayFn(obj[index])) { diff --git a/report-ui/src/views/accessAuthority/index.vue b/report-ui/src/views/accessAuthority/index.vue index 153aaa66..09aec50c 100755 --- a/report-ui/src/views/accessAuthority/index.vue +++ b/report-ui/src/views/accessAuthority/index.vue @@ -4,7 +4,7 @@ * @Author: qianlishi * @Date: 2021-12-11 14:48:27 * @LastEditors: qianlishi - * @LastEditTime: 2021-12-13 12:20:56 + * @LastEditTime: 2022-03-09 09:22:40 -->