From 4eb4dc93b20b43c18a78d2503443477c91464f71 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 26 Jun 2024 19:21:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(XPack):=20=E5=AE=9A=E6=97=B6=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E8=BF=87=E6=BB=A4=E7=BB=84=E4=BB=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/VisualizationReportFilter.java | 150 ------------------ .../VisualizationReportFilterMapper.java | 18 --- .../mapper/ExtDataVisualizationMapper.java | 2 +- .../server/DataVisualizationServer.java | 6 +- .../main/resources/db/desktop/V2.8__ddl.sql | 5 +- .../main/resources/db/migration/V2.8__ddl.sql | 4 +- .../mybatis/ExtDataVisualizationMapper.xml | 12 +- .../api/visualization/dataVisualization.ts | 8 +- .../src/assets/svg/icon_reset_outlined.svg | 4 +- .../v-query/ConditionDefaultConfiguration.vue | 2 +- .../src/utils/CanvasInfoTransUtils.ts | 10 +- .../data-visualization/PreviewCanvas.vue | 2 +- null/VisualizationReportFilterController.java | 18 --- null/VisualizationReportFilterMapper.xml | 5 - .../VisualizationReportFilterServiceImpl.java | 20 --- .../api/report/dto/ReportCreator.java | 3 + .../request/DataVisualizationBaseRequest.java | 3 + .../vo/VisualizationReportFilterVO.java | 51 ++++-- 18 files changed, 75 insertions(+), 248 deletions(-) delete mode 100644 core/core-backend/src/main/java/io/dataease/visualization/dao/auto/entity/VisualizationReportFilter.java delete mode 100644 core/core-backend/src/main/java/io/dataease/visualization/dao/auto/mapper/VisualizationReportFilterMapper.java delete mode 100644 null/VisualizationReportFilterController.java delete mode 100644 null/VisualizationReportFilterMapper.xml delete mode 100644 null/VisualizationReportFilterServiceImpl.java diff --git a/core/core-backend/src/main/java/io/dataease/visualization/dao/auto/entity/VisualizationReportFilter.java b/core/core-backend/src/main/java/io/dataease/visualization/dao/auto/entity/VisualizationReportFilter.java deleted file mode 100644 index baa6456131..0000000000 --- a/core/core-backend/src/main/java/io/dataease/visualization/dao/auto/entity/VisualizationReportFilter.java +++ /dev/null @@ -1,150 +0,0 @@ -package io.dataease.visualization.dao.auto.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; - -/** - *

- * - *

- * - * @author fit2cloud - * @since 2024-06-25 - */ -@TableName("visualization_report_filter") -public class VisualizationReportFilter implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 报告ID - */ - private Long id; - - /** - * 资源id - */ - private Long resourceId; - - /** - * 资源类型 - */ - private String dvType; - - /** - * 组件id - */ - private Long componentId; - - /** - * 过滤项id - */ - private Long filterId; - - /** - * 过滤组件内容 - */ - private String filterInfo; - - /** - * 过滤组件版本 - */ - private Integer filterVersion; - - /** - * 创建时间 - */ - private Long createTime; - - /** - * 创建人 - */ - private String createUser; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getResourceId() { - return resourceId; - } - - public void setResourceId(Long resourceId) { - this.resourceId = resourceId; - } - - public String getDvType() { - return dvType; - } - - public void setDvType(String dvType) { - this.dvType = dvType; - } - - public Long getComponentId() { - return componentId; - } - - public void setComponentId(Long componentId) { - this.componentId = componentId; - } - - public Long getFilterId() { - return filterId; - } - - public void setFilterId(Long filterId) { - this.filterId = filterId; - } - - public String getFilterInfo() { - return filterInfo; - } - - public void setFilterInfo(String filterInfo) { - this.filterInfo = filterInfo; - } - - public Integer getFilterVersion() { - return filterVersion; - } - - public void setFilterVersion(Integer filterVersion) { - this.filterVersion = filterVersion; - } - - public Long getCreateTime() { - return createTime; - } - - public void setCreateTime(Long createTime) { - this.createTime = createTime; - } - - public String getCreateUser() { - return createUser; - } - - public void setCreateUser(String createUser) { - this.createUser = createUser; - } - - @Override - public String toString() { - return "VisualizationReportFilter{" + - "id = " + id + - ", resourceId = " + resourceId + - ", dvType = " + dvType + - ", componentId = " + componentId + - ", filterId = " + filterId + - ", filterInfo = " + filterInfo + - ", filterVersion = " + filterVersion + - ", createTime = " + createTime + - ", createUser = " + createUser + - "}"; - } -} diff --git a/core/core-backend/src/main/java/io/dataease/visualization/dao/auto/mapper/VisualizationReportFilterMapper.java b/core/core-backend/src/main/java/io/dataease/visualization/dao/auto/mapper/VisualizationReportFilterMapper.java deleted file mode 100644 index 2d4ad4c351..0000000000 --- a/core/core-backend/src/main/java/io/dataease/visualization/dao/auto/mapper/VisualizationReportFilterMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package io.dataease.visualization.dao.auto.mapper; - -import io.dataease.visualization.dao.auto.entity.VisualizationReportFilter; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** - *

- * Mapper 接口 - *

- * - * @author fit2cloud - * @since 2024-06-25 - */ -@Mapper -public interface VisualizationReportFilterMapper extends BaseMapper { - -} diff --git a/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtDataVisualizationMapper.java b/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtDataVisualizationMapper.java index bc2bda435a..f2b9a54ede 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtDataVisualizationMapper.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtDataVisualizationMapper.java @@ -49,7 +49,7 @@ public interface ExtDataVisualizationMapper { List getVisualizationViewDetails(@Param("dvId") Long dvId); - List queryReportFilter(@Param("dvId") Long dvId,@Param("reportId") Long reportId); + List queryReportFilter(@Param("dvId") Long dvId,@Param("taskId") Long taskId); } diff --git a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java index 3143814dd4..62ed92a576 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java @@ -36,10 +36,10 @@ import io.dataease.utils.*; import io.dataease.visualization.dao.auto.entity.DataVisualizationInfo; import io.dataease.visualization.dao.auto.entity.VisualizationWatermark; import io.dataease.visualization.dao.auto.mapper.DataVisualizationInfoMapper; -import io.dataease.visualization.dao.auto.mapper.VisualizationReportFilterMapper; import io.dataease.visualization.dao.auto.mapper.VisualizationWatermarkMapper; import io.dataease.visualization.dao.ext.mapper.ExtDataVisualizationMapper; import io.dataease.visualization.manage.CoreVisualizationManage; +import io.dataease.xpack.base.report.dao.auto.mapper.VisualizationReportFilterMapper; import jakarta.annotation.Resource; import org.apache.commons.lang3.ObjectUtils; import org.springframework.transaction.annotation.Transactional; @@ -124,9 +124,9 @@ public class DataVisualizationServer implements DataVisualizationApi { BeanUtils.copyBean(watermarkVO, watermark); result.setWatermarkInfo(watermarkVO); - if(DataVisualizationConstants.QUERY_SOURCE.REPORT.equals(request.getSource()) && request.getReportId() != null){ + if(DataVisualizationConstants.QUERY_SOURCE.REPORT.equals(request.getSource()) && request.getTaskId() != null){ //获取定时报告过自定义过滤组件信息 - List filterVOS = extDataVisualizationMapper.queryReportFilter(dvId,request.getReportId()); + List filterVOS = extDataVisualizationMapper.queryReportFilter(dvId,request.getTaskId()); if (!CollectionUtils.isEmpty(filterVOS)) { Map reportFilterInfo = filterVOS.stream().collect(Collectors.toMap(VisualizationReportFilterVO::getFilterId, filterVo ->filterVo)); result.setReportFilterInfo(reportFilterInfo); diff --git a/core/core-backend/src/main/resources/db/desktop/V2.8__ddl.sql b/core/core-backend/src/main/resources/db/desktop/V2.8__ddl.sql index 6f4a6902cb..e35487efd8 100644 --- a/core/core-backend/src/main/resources/db/desktop/V2.8__ddl.sql +++ b/core/core-backend/src/main/resources/db/desktop/V2.8__ddl.sql @@ -34,10 +34,11 @@ CREATE TABLE `core_share_ticket` `access_time` bigint DEFAULT NULL COMMENT '首次访问时间', PRIMARY KEY (`id`) ) COMMENT ='分享Ticket表'; - DROP TABLE IF EXISTS `visualization_report_filter`; CREATE TABLE `visualization_report_filter` ( - `id` bigint NOT NULL COMMENT '报告ID', + `id` bigint NOT NULL COMMENT 'id', + `report_id` bigint DEFAULT NULL COMMENT '定时报告id', + `task_id` bigint DEFAULT NULL COMMENT '任务id', `resource_id` bigint DEFAULT NULL COMMENT '资源id', `dv_type` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '资源类型', `component_id` bigint DEFAULT NULL COMMENT '组件id', diff --git a/core/core-backend/src/main/resources/db/migration/V2.8__ddl.sql b/core/core-backend/src/main/resources/db/migration/V2.8__ddl.sql index 6f4a6902cb..069894a733 100644 --- a/core/core-backend/src/main/resources/db/migration/V2.8__ddl.sql +++ b/core/core-backend/src/main/resources/db/migration/V2.8__ddl.sql @@ -37,7 +37,9 @@ CREATE TABLE `core_share_ticket` DROP TABLE IF EXISTS `visualization_report_filter`; CREATE TABLE `visualization_report_filter` ( - `id` bigint NOT NULL COMMENT '报告ID', + `id` bigint NOT NULL COMMENT 'id', + `report_id` bigint DEFAULT NULL COMMENT '定时报告id', + `task_id` bigint DEFAULT NULL COMMENT '任务id', `resource_id` bigint DEFAULT NULL COMMENT '资源id', `dv_type` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '资源类型', `component_id` bigint DEFAULT NULL COMMENT '组件id', diff --git a/core/core-backend/src/main/resources/mybatis/ExtDataVisualizationMapper.xml b/core/core-backend/src/main/resources/mybatis/ExtDataVisualizationMapper.xml index 55958b2a87..07d6558cf8 100644 --- a/core/core-backend/src/main/resources/mybatis/ExtDataVisualizationMapper.xml +++ b/core/core-backend/src/main/resources/mybatis/ExtDataVisualizationMapper.xml @@ -406,17 +406,9 @@ diff --git a/core/core-frontend/src/api/visualization/dataVisualization.ts b/core/core-frontend/src/api/visualization/dataVisualization.ts index 3998639690..f6f444b697 100644 --- a/core/core-frontend/src/api/visualization/dataVisualization.ts +++ b/core/core-frontend/src/api/visualization/dataVisualization.ts @@ -20,14 +20,18 @@ export const findCopyResource = async (dvId, busiFlag): Promise => { return request.get({ url: '/dataVisualization/findCopyResource/' + dvId + '/' + busiFlag }) } -export const findById = async (dvId, busiFlag, source = 'main'): Promise => { +export const findById = async ( + dvId, + busiFlag, + attachInfo = { source: 'main' } +): Promise => { let busiFlagResult = busiFlag if (!busiFlagResult) { await findDvType(dvId).then(res => { busiFlagResult = res.data }) } - const data = { id: dvId, busiFlag: busiFlagResult, source } + const data = { id: dvId, busiFlag: busiFlagResult, ...attachInfo } return request.post({ url: '/dataVisualization/findById', data }) } diff --git a/core/core-frontend/src/assets/svg/icon_reset_outlined.svg b/core/core-frontend/src/assets/svg/icon_reset_outlined.svg index 3fc7d49ebd..46107360de 100644 --- a/core/core-frontend/src/assets/svg/icon_reset_outlined.svg +++ b/core/core-frontend/src/assets/svg/icon_reset_outlined.svg @@ -1,3 +1,3 @@ - - + + diff --git a/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue b/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue index 00dba34bfc..7788a85741 100644 --- a/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue +++ b/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue @@ -205,7 +205,7 @@ defineExpose({
+
设置默认值
diff --git a/core/core-frontend/src/utils/CanvasInfoTransUtils.ts b/core/core-frontend/src/utils/CanvasInfoTransUtils.ts index 075ec9a493..5edbed01af 100644 --- a/core/core-frontend/src/utils/CanvasInfoTransUtils.ts +++ b/core/core-frontend/src/utils/CanvasInfoTransUtils.ts @@ -4,9 +4,13 @@ export default function defaultConditionTrans(canvasInfo) { const { reportFilterInfo, componentData } = canvasInfo const componentDataArray = JSON.parse(componentData) const allFilter = [] + const componentMap = {} // 获取所有查询条件 componentDataArray.forEach(item => { if (item.component === 'VQuery') { + item.propValue.forEach(filterItem => { + componentMap[filterItem.id] = item + }) Array.prototype.push.apply(allFilter, item.propValue) } }) @@ -15,13 +19,15 @@ export default function defaultConditionTrans(canvasInfo) { if (reportFilterInfo) { allFilter.forEach((itemFilter, index) => { if (reportFilterInfo[itemFilter.id]) { - allDefaultFilter.splice(index, 1, JSON.parse(reportFilterInfo[itemFilter.id])) + allDefaultFilter.splice(index, 1, JSON.parse(reportFilterInfo[itemFilter.id].filterInfo)) } }) } return { sourceFilter: allFilter, - defaultFilter: allDefaultFilter + defaultFilter: allDefaultFilter, + sourceDefaultFilter: deepCopy(allDefaultFilter), + componentMap: componentMap } } diff --git a/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue b/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue index b2bf88b1a3..4794644783 100644 --- a/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue +++ b/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue @@ -121,7 +121,7 @@ const XpackLoaded = () => p(true) onMounted(async () => { await new Promise(r => (p = r)) const dvId = embeddedStore.dvId || router.currentRoute.value.query.dvId - const { dvType, callBackFlag } = router.currentRoute.value.query + const { dvType, callBackFlag, taskId } = router.currentRoute.value.query if (dvId) { loadCanvasDataAsync(dvId, dvType) return diff --git a/null/VisualizationReportFilterController.java b/null/VisualizationReportFilterController.java deleted file mode 100644 index 2b48922c26..0000000000 --- a/null/VisualizationReportFilterController.java +++ /dev/null @@ -1,18 +0,0 @@ -package io.dataease.visualization.dao.auto.controller; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author fit2cloud - * @since 2024-06-25 - */ -@Controller -@RequestMapping("/visualizationReportFilter") -public class VisualizationReportFilterController { - -} diff --git a/null/VisualizationReportFilterMapper.xml b/null/VisualizationReportFilterMapper.xml deleted file mode 100644 index 4e22897581..0000000000 --- a/null/VisualizationReportFilterMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/null/VisualizationReportFilterServiceImpl.java b/null/VisualizationReportFilterServiceImpl.java deleted file mode 100644 index fd02dcac10..0000000000 --- a/null/VisualizationReportFilterServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.dataease.visualization.dao.auto.service.impl; - -import io.dataease.visualization.dao.auto.entity.VisualizationReportFilter; -import io.dataease.visualization.dao.auto.mapper.VisualizationReportFilterMapper; -import io.dataease.visualization.dao.auto.service.IVisualizationReportFilterService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author fit2cloud - * @since 2024-06-25 - */ -@Service -public class VisualizationReportFilterServiceImpl extends ServiceImpl implements IVisualizationReportFilterService { - -} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportCreator.java b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportCreator.java index 1d969e7281..391b794266 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportCreator.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportCreator.java @@ -2,6 +2,7 @@ package io.dataease.api.report.dto; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.dataease.api.visualization.vo.VisualizationReportFilterVO; import lombok.Data; import java.io.Serial; @@ -51,4 +52,6 @@ public class ReportCreator implements Serializable { private Long startTime; private Long endTime; + + private List reportFilter; } diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/visualization/request/DataVisualizationBaseRequest.java b/sdk/api/api-base/src/main/java/io/dataease/api/visualization/request/DataVisualizationBaseRequest.java index adcf02d952..eb8af2743a 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/visualization/request/DataVisualizationBaseRequest.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/visualization/request/DataVisualizationBaseRequest.java @@ -34,6 +34,9 @@ public class DataVisualizationBaseRequest extends DataVisualizationVO { // 定时报告id private Long reportId; + // 定时报告任务id + private Long taskId; + public DataVisualizationBaseRequest(Long id,String busiFlag) { this.busiFlag = busiFlag; diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/visualization/vo/VisualizationReportFilterVO.java b/sdk/api/api-base/src/main/java/io/dataease/api/visualization/vo/VisualizationReportFilterVO.java index 0363eba4c3..d649aa9666 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/visualization/vo/VisualizationReportFilterVO.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/visualization/vo/VisualizationReportFilterVO.java @@ -13,14 +13,23 @@ import java.io.Serializable; * @since 2024-06-25 */ public class VisualizationReportFilterVO implements Serializable { - private static final long serialVersionUID = 1L; /** - * 报告ID + * id */ private Long id; + /** + * 定时报告id + */ + private Long reportId; + + /** + * 任务id + */ + private Long taskId; + /** * 资源id */ @@ -69,6 +78,22 @@ public class VisualizationReportFilterVO implements Serializable { this.id = id; } + public Long getReportId() { + return reportId; + } + + public void setReportId(Long reportId) { + this.reportId = reportId; + } + + public Long getTaskId() { + return taskId; + } + + public void setTaskId(Long taskId) { + this.taskId = taskId; + } + public Long getResourceId() { return resourceId; } @@ -136,15 +161,17 @@ public class VisualizationReportFilterVO implements Serializable { @Override public String toString() { return "VisualizationReportFilter{" + - "id = " + id + - ", resourceId = " + resourceId + - ", dvType = " + dvType + - ", componentId = " + componentId + - ", filterId = " + filterId + - ", filterInfo = " + filterInfo + - ", filterVersion = " + filterVersion + - ", createTime = " + createTime + - ", createUser = " + createUser + - "}"; + "id = " + id + + ", reportId = " + reportId + + ", taskId = " + taskId + + ", resourceId = " + resourceId + + ", dvType = " + dvType + + ", componentId = " + componentId + + ", filterId = " + filterId + + ", filterInfo = " + filterInfo + + ", filterVersion = " + filterVersion + + ", createTime = " + createTime + + ", createUser = " + createUser + + "}"; } }