/*
* Datart
* <p>
* Copyright 2021
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package datart.server.service.impl;
import datart.core.base.consts.Const;
import datart.core.base.consts.FileOwner;
import datart.core.base.exception.Exceptions;
import datart.core.base.exception.NotFoundException;
import datart.core.base.exception.ParamException;
import datart.core.common.DateUtils;
import datart.core.common.FileUtils;
import datart.core.common.UUIDGenerator;
import datart.core.entity.*;
import datart.core.mappers.ext.*;
import datart.security.base.ResourceType;
import datart.security.util.PermissionHelper;
import datart.server.base.dto.DashboardBaseInfo;
import datart.server.base.dto.DashboardDetail;
import datart.server.base.dto.WidgetDetail;
import datart.server.base.params.*;
import datart.server.base.transfer.ImportStrategy;
import datart.server.base.transfer.TransferConfig;
import datart.server.base.transfer.model.DashboardResourceModel;
import datart.server.base.transfer.model.DashboardTemplateModel;
import datart.server.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.FileSystemUtils;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service
public class DashboardServiceImpl extends BaseService implements DashboardService {
private final DashboardMapperExt dashboardMapper;
private final WidgetMapperExt widgetMapper;
private final RelWidgetElementMapperExt rweMapper;
private final RelWidgetWidgetMapperExt rwwMapper;
private final RelRoleResourceMapperExt rrrMapper;
private final RoleService roleService;
private final FileService fileService;
private final FolderMapperExt folderMapper;
private final ViewMapperExt viewMapper;
private final DatachartMapperExt datachartMapper;
private final WidgetService widgetService;
private final FolderService folderService;
private final VariableService variableService;
private final ViewService viewService;
private final DatachartService datachartService;
public DashboardServiceImpl(DashboardMapperExt dashboardMapper,
WidgetMapperExt widgetMapper,
RelWidgetElementMapperExt rweMapper,
RelWidgetWidgetMapperExt rwwMapper,
RelRoleResourceMapperExt rrrMapper, RoleService roleService,
FileService fileService,
FolderMapperExt folderMapper,
ViewMapperExt viewMapper,
DatachartMapperExt datachartMapper,
WidgetService widgetService,
FolderService folderService,
VariableService variableService,
ViewService viewService,
DatachartService datachartService) {
this.dashboardMapper = dashboardMapper;
this.widgetMapper = widgetMapper;
this.rweMapper = rweMapper;
this.rwwMapper = rwwMapper;
this.rrrMapper = rrrMapper;
this.roleService = roleService;
this.fileService = fileService;
this.folderMapper = folderMapper;
this.viewMapper = viewMapper;
this.datachartMapper = datachartMapper;
this.widgetService = widgetService;
this.folderService = folderService;
this.variableService = variableService;
this.viewService = viewService;
this.datachartService = datachartService;
}
@Override
public List<DashboardBaseInfo> listDashboard(String orgId) {
List<Dashboard> dashboards = dashboardMapper.listByOrgId(orgId);
return dashboards.stream().filter(dashboard -> securityManager
.hasPermission(PermissionHelper.vizPermission(dashboard.getOrgId(), "*", dashboard.getId(), Const.READ)))
.map(DashboardBaseInfo::new)
.collect(Collectors.toList());
}
@Override
@Transactional
public boolean delete(String dashboardId) {
//remove from folder
DashboardService.super.delete(dashboardId);
return 1 == folderMapper.deleteByRelTypeAndId(ResourceType.DASHBOARD.name(), dashboardId);
}
@Override
public void deleteReference(Dashboard dashboard) {
dashboardMapper.deleteDashboard(dashboard.getId());
}
@Override
@Transactional
public boolean archive(String id) {
DashboardService.super.archive(id);
//remove from folder
return folderMapper.deleteByRelTypeAndId(ResourceType.DASHBOARD.name(), id) == 1;
}
@Override
public DashboardDetail getDashboardDetail(String dashboardId) {
Dashboard dashboard = retrieve(dashboardId);
DashboardDetail dashboardDetail = new DashboardDetail();
BeanUtils.copyProperties(dashboard, dashboardDetail);
//folder index
Folder folder = folderMapper.selectByRelTypeAndId(ResourceType.DASHBOARD.name(), dashboardId);
if (folder != null) {
dashboardDetail.setParentId(folder.getParentId());
dashboardDetail.setIndex(folder.getIndex());
}
Set<String> viewIds = new HashSet<>();
Set<String> datachartIds = new HashSet<>();
// get all widgets details
List<WidgetDetail> widgetDetails = getWidgets(dashboardId, datachartIds, viewIds);
dashboardDetail.setWidgets(widgetDetails);
// charts
if (!CollectionUtils.isEmpty(datachartIds)) {
dashboardDetail.setDatacharts(datachartMapper.listByIds(datachartIds));
} else {
dashboardDetail.setDatacharts(Collections.emptyList());
}
//views
List<String> chartViews = dashboardDetail.getDatacharts().stream().map(Datachart::getViewId).collect(Collectors.toList());
viewIds.addAll(chartViews);
if (!CollectionUtils.isEmpty(viewIds)) {
dashboardDetail.setViews(viewMapper.listByIds(viewIds));
} else {
dashboardDetail.setViews(Collections.emptyList());
}
//variables
LinkedList<Variable> variables = new LinkedList<>(variableService.listOrgQueryVariables(dashboard.getOrgId()));
if (!CollectionUtils.isEmpty(viewIds)) {
for (String viewId : viewIds) {
variables.addAll(variableService.listViewQueryVariables(viewId));
}
}
dashboardDetail.setQueryVariables(variables);
// download permission
dashboardDetail.setDownload(securityManager.hasPermission(PermissionHelper.vizPermission(dashboard.getOrgId(), "*", dashboardId, Const.DOWNLOAD)));
return dashboardDetail;
}
@Override
public Folder copyDashboard(DashboardCreateParam dashboard) throws IOException {
Folder folder = createWithFolder(dashboard);
DashboardDetail copy = getDashboardDetail(dashboard.getId());
BeanUtils.copyProperties(dashboard, copy);
// copy database records
if (CollectionUtils.isNotEmpty(copy.getWidgets())) {
没有合适的资源?快使用搜索试试~ 我知道了~
基于TypeScript和Java的新一代数据可视化开放平台设计源码
共1776个文件
tsx:600个
java:558个
ts:465个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 48 浏览量
2024-04-17
15:46:44
上传
评论
收藏 11.28MB ZIP 举报
温馨提示
本项目是基于TypeScript和Java开发的新一代数据可视化开放平台设计源码,主要使用TypeScript进行开发。项目共包含1776个文件,其中TypeScript源代码文件TypeScript 600个,Java源代码文件558个,JSON配置文件18个,XML配置文件12个,JavaScript源代码文件11个,Markdown文档文件9个,SQL文件9个,PEM文件7个。该平台支持报表、仪表板、大屏、分析和可视化数据应用的敏捷构建,由原davinci主创团队出品。项目结构清晰,代码注释详尽,适合用于学习和研究TypeScript和Java在数据可视化开放平台开发中的应用。
资源推荐
资源详情
资源评论
收起资源包目录
基于TypeScript和Java的新一代数据可视化开放平台设计源码 (1776个子文件)
datart-server.cmd 812B
datart.conf 654B
iconfont.css 4KB
datart.core.data.provider.DataProvider 37B
datart.core.data.provider.DataProvider 37B
datart.core.data.provider.DataProvider 37B
datart.demo.mv.db 64KB
Dockerfile 341B
.editorconfig 241B
spring.factories 99B
.gitattributes 5KB
.gitignore 469B
.gitignore 100B
.gitignore 2B
UserActiveMailTemplate.html 3KB
InviteMailTemplate.html 3KB
RestPasswordEmailTemplate.html 3KB
index.html 2KB
favicon.ico 134KB
DashboardServiceImpl.java 28KB
VizServiceImpl.java 24KB
RoleServiceImpl.java 24KB
SourceServiceImpl.java 22KB
ShareServiceImpl.java 22KB
UserServiceImpl.java 21KB
DataProviderServiceImpl.java 20KB
JdbcDataProviderAdapter.java 20KB
ViewServiceImpl.java 19KB
SqlBuilder.java 18KB
FolderServiceImpl.java 16KB
JdbcDataProvider.java 14KB
VariablePlaceholder.java 14KB
DatabaseMigration.java 13KB
VizController.java 13KB
VariableServiceImpl.java 13KB
ScheduleServiceImpl.java 13KB
ShiroSecurityManager.java 13KB
LocalDB.java 13KB
OrgServiceImpl.java 12KB
DatachartServiceImpl.java 12KB
PoiConvertUtils.java 12KB
POIUtils.java 11KB
HttpDataProvider.java 10KB
DefaultDataProvider.java 10KB
ProviderManager.java 10KB
StoryboardServiceImpl.java 9KB
MailServiceImpl.java 9KB
WeChartOauth2Client.java 8KB
ScheduleJob.java 8KB
CustomPropertiesValidate.java 8KB
FileDataProvider.java 8KB
BaseCRUDService.java 8KB
DingTalkOauth2Client.java 7KB
JwkUtils.java 7KB
SqlVariableVisitor.java 7KB
RoleController.java 7KB
UserController.java 7KB
WidgetServiceImpl.java 7KB
SqlSplitter.java 7KB
SqlStringUtils.java 7KB
SqlScriptRender.java 7KB
RegexVariableResolver.java 7KB
SqlNodeUtils.java 6KB
VariableSqlExamples.java 6KB
OrgController.java 6KB
JwtUtils.java 6KB
ScheduleController.java 6KB
FileServiceImpl.java 6KB
WebUtils.java 6KB
ExternalRegisterServiceImpl.java 6KB
ShareController.java 6KB
HttpDataFetcher.java 5KB
RelRoleResourceMapperExt.java 5KB
SqlScriptRenderTest.java 5KB
RelVariableSubjectMapperExt.java 5KB
DatartRealm.java 5KB
SchemaSyncJob.java 5KB
ParamFactory.java 5KB
SqlQueryScriptProcessor.java 5KB
DataProviderController.java 5KB
NormalSqlExamples.java 5KB
SourceController.java 5KB
DownloadServiceImpl.java 5KB
Application.java 5KB
VariableSqlProvider.java 5KB
ScheduleSqlProvider.java 5KB
VariableMapper.java 5KB
ScheduleMapper.java 5KB
ViewSqlProvider.java 5KB
SqlValidateUtils.java 5KB
DataProvider.java 5KB
ViewMapper.java 5KB
ShareMapper.java 4KB
FileUtils.java 4KB
ViewController.java 4KB
SwaggerConfiguration.java 4KB
RoleMapperExt.java 4KB
VariableController.java 4KB
ResponseJsonParser.java 4KB
AttachmentPdfServiceImpl.java 4KB
共 1776 条
- 1
- 2
- 3
- 4
- 5
- 6
- 18
资源评论
沐知全栈开发
- 粉丝: 5703
- 资源: 5215
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- JavaScript函数
- java-leetcode题解之Range Sum Query 2D - Mutable.java
- java-leetcode题解之Random Pick Index.java
- java-leetcode题解之Race Car.java
- java-leetcode题解之Profitable Schemes.java
- java-leetcode题解之Product of Array Exclude Itself.java
- java-leetcode题解之Prime Arrangements.java
- MCU51-51单片机
- java-leetcode题解之Power of Two.java
- java-leetcode题解之Power of Three.java
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功