feat(XPack): 定时报告过滤组件功能

This commit is contained in:
wangjiahao 2024-06-26 19:21:14 +08:00
parent a07ef5fe3c
commit 4eb4dc93b2
18 changed files with 75 additions and 248 deletions

View File

@ -1,150 +0,0 @@
package io.dataease.visualization.dao.auto.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @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 +
"}";
}
}

View File

@ -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;
/**
* <p>
* Mapper 接口
* </p>
*
* @author fit2cloud
* @since 2024-06-25
*/
@Mapper
public interface VisualizationReportFilterMapper extends BaseMapper<VisualizationReportFilter> {
}

View File

@ -49,7 +49,7 @@ public interface ExtDataVisualizationMapper {
List<VisualizationViewTableDTO> getVisualizationViewDetails(@Param("dvId") Long dvId);
List<VisualizationReportFilterVO> queryReportFilter(@Param("dvId") Long dvId,@Param("reportId") Long reportId);
List<VisualizationReportFilterVO> queryReportFilter(@Param("dvId") Long dvId,@Param("taskId") Long taskId);
}

View File

@ -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<VisualizationReportFilterVO> filterVOS = extDataVisualizationMapper.queryReportFilter(dvId,request.getReportId());
List<VisualizationReportFilterVO> filterVOS = extDataVisualizationMapper.queryReportFilter(dvId,request.getTaskId());
if (!CollectionUtils.isEmpty(filterVOS)) {
Map<Long, VisualizationReportFilterVO> reportFilterInfo = filterVOS.stream().collect(Collectors.toMap(VisualizationReportFilterVO::getFilterId, filterVo ->filterVo));
result.setReportFilterInfo(reportFilterInfo);

View File

@ -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',

View File

@ -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',

View File

@ -406,17 +406,9 @@
<select id="queryReportFilter" resultType="io.dataease.api.visualization.vo.VisualizationReportFilterVO">
SELECT
`id`,
`resource_id`,
`dv_type`,
`component_id`,
`filter_id`,
`filter_info`,
`filter_version`,
`create_time`,
`create_user`
`id`, `report_id`, `resource_id`, `dv_type`, `component_id`, `filter_id`, `filter_info`, `filter_version`, `create_time`, `create_user`
FROM
visualization_report_filter
where visualization_report_filter.resource_id = #{dvId} and visualization_report_filter.id = #{reportId}
where visualization_report_filter.resource_id = #{dvId} and visualization_report_filter.task_id = #{taskId}
</select>
</mapper>

View File

@ -20,14 +20,18 @@ export const findCopyResource = async (dvId, busiFlag): Promise<IResponse> => {
return request.get({ url: '/dataVisualization/findCopyResource/' + dvId + '/' + busiFlag })
}
export const findById = async (dvId, busiFlag, source = 'main'): Promise<IResponse> => {
export const findById = async (
dvId,
busiFlag,
attachInfo = { source: 'main' }
): Promise<IResponse> => {
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 })
}

View File

@ -1,3 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.25469 8C7.51964 6.18652 9.62125 5 12 5C15.866 5 19 8.13401 19 12C19 15.866 15.866 19 12 19C8.82898 19 6.15043 16.8915 5.28988 14H3.22302C4.13248 18.008 7.71683 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C9.17273 3 6.64996 4.30367 5 6.34267V3.5C5 3.22386 4.77614 3 4.5 3H3.5C3.22386 3 3 3.22386 3 3.5V9C3 9.55228 3.44772 10 4 10H9.5C9.77614 10 10 9.77614 10 9.5V8.5C10 8.22386 9.77614 8 9.5 8H6.25469Z" fill="#1F2329"/>
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M6.25469 8C7.51964 6.18652 9.62125 5 12 5C15.866 5 19 8.13401 19 12C19 15.866 15.866 19 12 19C8.82898 19 6.15043 16.8915 5.28988 14H3.22302C4.13248 18.008 7.71683 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C9.17273 3 6.64996 4.30367 5 6.34267V3.5C5 3.22386 4.77614 3 4.5 3H3.5C3.22386 3 3 3.22386 3 3.5V9C3 9.55228 3.44772 10 4 10H9.5C9.77614 10 10 9.77614 10 9.5V8.5C10 8.22386 9.77614 8 9.5 8H6.25469Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 526 B

View File

@ -205,7 +205,7 @@ defineExpose({
</script>
<template>
<div class="list-item top-item" v-if="curComponent.displayType === '8'">
<div class="list-item top-item" v-if="curComponent.displayType === '8'" @click.stop>
<div class="label">设置默认值</div>
<div class="value">
<div class="condition-type">

View File

@ -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
}
}

View File

@ -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

View File

@ -1,18 +0,0 @@
package io.dataease.visualization.dao.auto.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
/**
* <p>
* 前端控制器
* </p>
*
* @author fit2cloud
* @since 2024-06-25
*/
@Controller
@RequestMapping("/visualizationReportFilter")
public class VisualizationReportFilterController {
}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.dataease.visualization.dao.auto.mapper.VisualizationReportFilterMapper">
</mapper>

View File

@ -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;
/**
* <p>
* 服务实现类
* </p>
*
* @author fit2cloud
* @since 2024-06-25
*/
@Service
public class VisualizationReportFilterServiceImpl extends ServiceImpl<VisualizationReportFilterMapper, VisualizationReportFilter> implements IVisualizationReportFilterService {
}

View File

@ -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<VisualizationReportFilterVO> reportFilter;
}

View File

@ -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;

View File

@ -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 +
"}";
}
}