first commit

main
whb
parent 2f106062bf
commit 3f6c283e9a

@ -1,42 +0,0 @@
## 📚简介
🔥DataRoom是一款基于SpringBoot、MyBatisPlus、ElementUI、G2Plot、Echarts等技术栈的大屏设计器具备大屏目录管理、大屏设计、大屏预览能力支持MySQL、Oracle、PostgreSQL、JSON、HTTP、Groovy等数据集接入使用简单完全免费代码开源。
<p align="center">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/gcpaas/DataRoom?style=social">
<img alt="GitHub forks" src="https://img.shields.io/github/forks/gcpaas/DataRoom?style=social">
<img alt="GitHub license" src="https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg">
<img alt="npm" src="https://img.shields.io/npm/v/@gcpaas/data-room-ui">
<img alt="Maven Central" src="https://img.shields.io/maven-central/v/com.gccloud/gc-starter-bigscreen-core">
<img alt="Company" src="https://img.shields.io/badge/Author-科大国创云网科技有限公司-blue.svg">
</p>
-------------------------------------------------------------------------------
## 效果图
#### 管理页
<img alt="logo" src="../doc/images/home.png">
#### 设计器
<img alt="logo" src="../doc/images/design01.png">
## 快速开始
<a href="https://www.yuque.com/chuinixiongkou/bigscreen/xd78cw7t12q7kfbl#norVs" target="_blank">快速开始 </a>
## 演示DEMO
<a href="http://gcpaas.gccloud.com/bigScreen" target="_blank"> http://gcpaas.gccloud.com/bigScreen </a>
## 联系我们
<img alt="Email" src="https://img.shields.io/badge/Email-tech@ustcinfo.com-blue.svg">
<img alt="QQ群" src="https://img.shields.io/badge/QQ群-322302395-blue.svg">
<p>
<img alt="logo" width="200" src="../doc/images/qq.png">
</p>
## License
Apache License 2.0

@ -18,6 +18,8 @@ public class FileConfig {
*
*/
private String urlPrefix;
private String img;
/**
*
*/

@ -0,0 +1,15 @@
package com.gccloud.dataroom.core.module.biz.component.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gccloud.dataroom.core.module.biz.component.entity.BizComponentEntity;
import com.gccloud.dataroom.core.module.biz.component.entity.BizComponentUser;
import org.apache.ibatis.annotations.Mapper;
/**
* @author hongyang
* @version 1.0
* @date 2023/6/5 11:39
*/
@Mapper
public interface DataRoomBizUserDao extends BaseMapper<BizComponentUser> {
}

@ -0,0 +1,45 @@
package com.gccloud.dataroom.core.module.biz.component.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gccloud.common.entity.SuperEntity;
import com.gccloud.dataroom.core.constant.PageDesignConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author 17803
* @date 2024-08-23 11:13
*/
@Data
@TableName(value = "big_screen_page_permission")
@ApiModel
public class BizComponentUser extends SuperEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "业务组件中文名称")
private String userId;
@ApiModelProperty(notes = "业务组件编码,页面唯一标识符")
@TableField(updateStrategy = FieldStrategy.NEVER)
private String code;
@ApiModelProperty(notes = "父节点编码/所属分组编码")
private String parentCode;
@ApiModelProperty(notes = "排序")
private Integer orderNum;
/**
* {@link PageDesignConstant.Type}
*/
@ApiModelProperty(notes = "页面类型")
private String type;
}

@ -48,7 +48,7 @@ public class BizComponentServiceImpl extends ServiceImpl<DataRoomBizComponentDao
queryWrapper.orderByDesc(BizComponentEntity::getCreateDate);
PageVO<BizComponentEntity> page = this.page(searchDTO, queryWrapper);
List<BizComponentEntity> list = page.getList();
String urlPrefix = bigScreenConfig.getFile().getUrlPrefix();
String urlPrefix = bigScreenConfig.getFile().getBasePath();
if (!urlPrefix.endsWith("/")) {
urlPrefix += "/";
}
@ -67,7 +67,7 @@ public class BizComponentServiceImpl extends ServiceImpl<DataRoomBizComponentDao
queryWrapper.like(StringUtils.isNotBlank(searchDTO.getName()), BizComponentEntity::getName, searchDTO.getName());
queryWrapper.eq(StringUtils.isNotBlank(searchDTO.getType()), BizComponentEntity::getType, searchDTO.getType());
List<BizComponentEntity> list = this.list(queryWrapper);
String urlPrefix = bigScreenConfig.getFile().getUrlPrefix();
String urlPrefix = bigScreenConfig.getFile().getBasePath();
if (!urlPrefix.endsWith("/")) {
urlPrefix += "/";
}
@ -92,7 +92,7 @@ public class BizComponentServiceImpl extends ServiceImpl<DataRoomBizComponentDao
throw new GlobalException("组件不存在");
}
BizComponentEntity bizComponentEntity = list.get(0);
String urlPrefix = bigScreenConfig.getFile().getUrlPrefix();
String urlPrefix = bigScreenConfig.getFile().getBasePath();
if (!urlPrefix.endsWith("/")) {
urlPrefix += "/";
}

@ -0,0 +1,96 @@
package com.gccloud.dataroom.core.module.biz.component.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gccloud.dataroom.core.module.basic.entity.PageEntity;
import com.gccloud.dataroom.core.module.biz.component.dao.DataRoomBizUserDao;
import com.gccloud.dataroom.core.module.biz.component.entity.BizComponentUser;
import com.gccloud.dataroom.core.module.manage.service.IDataRoomPageService;
import com.gccloud.dataroom.core.permission.IDataRoomPermissionService;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author gcpaas
* @version 1.0
* @date 2023/9/11 16:21
*/
@Service
public class PermissionServiceImpl implements IDataRoomPermissionService {
@Autowired
private DataRoomBizUserDao userDao;
@Resource
@Lazy
private IDataRoomPageService bigScreenPageService;
private List<String> getUserDataRoomCodeList() {
// 模拟获取当前用户有权限的大屏code列表需要根据实际情况自行实现
return Lists.newArrayList("bigScreen_auPP6DkIIn", "bigScreen_auPxxDkIIn", "bigScreen_auPP6Dkxxn");
}
@Override
public boolean verifyDataPermission(HttpServletRequest request, String pageCode) {
return false;
}
/**
*
*
*/
@Override
public List<String> filterByPermission(List<String> allCode, String userId,String type) {
// LambdaQueryWrapper<BizComponentUser> newQueryWrapper = new LambdaQueryWrapper<>();
// newQueryWrapper.eq()
//
LambdaQueryWrapper<BizComponentUser> queryWrapper = new LambdaQueryWrapper<>();
//用户ID
queryWrapper.eq(BizComponentUser::getUserId,userId);
//单独授权码
queryWrapper.select(BizComponentUser::getCode);
//页面类型
queryWrapper.in(BizComponentUser::getType, type);
//根据创建时间排序
queryWrapper.orderByDesc(BizComponentUser::getCreateDate);
List<BizComponentUser> bizComponentUserList = userDao.selectList(queryWrapper);
List<String> codeList = bizComponentUserList.stream().map(item -> item.getCode()).collect(Collectors.toList());
if (CollectionUtils.isEmpty(codeList))
{
//拷贝三个默认图形
List<String> arrayList = new ArrayList<>();
arrayList.add("bigScreen_mrayOVaVLN");
arrayList.add("bigScreen_1Z7KtlBQjM");
arrayList.add("bigScreen_31aDDWOXhH");
for (String code : arrayList) {
PageEntity bigScreenPage = bigScreenPageService.getByCode(code);
String newCode = bigScreenPageService.copy(bigScreenPage);
BizComponentUser bizComponentUser = new BizComponentUser();
bizComponentUser.setType("bigScreen");
bizComponentUser.setUserId(userId);
bizComponentUser.setCode(newCode);
userDao.insert(bizComponentUser);
codeList.add(newCode);
}
}
return codeList;
}
}

@ -29,6 +29,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.File;
import java.util.List;
/**
@ -71,6 +72,7 @@ public class DataRoomPageController {
@GetMapping("/page")
@ApiOperation(value = "大屏/组件分页列表", position = 10, produces = MediaType.APPLICATION_JSON_VALUE)
public MixinsResp<PageVO<PageEntity>> page(DataRoomSearchDTO searchDTO) {
PageVO<PageEntity> page = bigScreenPageService.getByCategory(searchDTO);
MixinsResp<PageVO<PageEntity>> resp = new MixinsResp<PageVO<PageEntity>>().setData(page);
resp.setCode(DataRoomConst.Response.Code.SUCCESS);
@ -149,7 +151,9 @@ public class DataRoomPageController {
public R<List<StaticFileVO>> getBgList() {
List<String> staticFileList = Webjars.BIG_SCREEN_BG;
List<StaticFileVO> bgList = Lists.newArrayList();
String urlPrefix = bigScreenConfig.getFile().getUrlPrefix() + "bigScreenBg/";
String urlPrefix = bigScreenConfig.getFile().getImg() + File.separator+ "bigScreenBg/";
for (String fileName : staticFileList) {
StaticFileVO fileVO = new StaticFileVO();
fileVO.setUrl(urlPrefix + fileName);

@ -27,6 +27,9 @@ public class DataRoomPageDTO extends BasePageDTO {
@ApiModelProperty(notes = "主键id")
private String id;
@ApiModelProperty(notes = "用户id")
private String userId;
@NotBlank(message = "名称不能为空", groups = {Update.class, Insert.class})
@ApiModelProperty(notes = "大屏名称")
private String name;

@ -19,4 +19,6 @@ public class DataRoomSearchDTO extends SearchDTO {
*
*/
private String type;
private String userId;
}

@ -7,6 +7,8 @@ import com.gccloud.dataroom.core.constant.PageDesignConstant;
import com.gccloud.dataroom.core.module.basic.dao.DataRoomPageDao;
import com.gccloud.dataroom.core.module.basic.entity.PageEntity;
import com.gccloud.dataroom.core.module.basic.entity.PagePreviewEntity;
import com.gccloud.dataroom.core.module.biz.component.dao.DataRoomBizUserDao;
import com.gccloud.dataroom.core.module.biz.component.entity.BizComponentUser;
import com.gccloud.dataroom.core.module.chart.bean.Chart;
import com.gccloud.dataroom.core.module.chart.bean.Linkage;
import com.gccloud.dataroom.core.module.chart.components.datasource.DataSetDataSource;
@ -35,16 +37,15 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.tomcat.util.http.fileupload.FileItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.annotation.Resource;
import java.io.*;
import java.util.Base64;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -75,6 +76,9 @@ public class DataRoomPageServiceImpl extends ServiceImpl<DataRoomPageDao, PageEn
@Resource
private IDataRoomOssService ossService;
@Autowired
private DataRoomBizUserDao userDao;
@Override
public PageEntity getByCode(String code) {
if (code.startsWith(IDataRoomPagePreviewService.PREVIEW_KEY)) {
@ -85,9 +89,17 @@ public class DataRoomPageServiceImpl extends ServiceImpl<DataRoomPageDao, PageEn
}
@Override
@Transactional(rollbackFor = Exception.class)
public String add(DataRoomPageDTO bigScreenPageDTO) {
if (!org.springframework.util.StringUtils.hasText(bigScreenPageDTO.getUserId()))
{
throw new RuntimeException("userId不能为空");
}
String code = null;
if (StringUtils.isBlank(bigScreenPageDTO.getCode())) {
String code = CodeGenerateUtils.generate(bigScreenPageDTO.getType());
code = CodeGenerateUtils.generate(bigScreenPageDTO.getType());
bigScreenPageDTO.setCode(code);
}
List<Chart> chartList = bigScreenPageDTO.getChartList();
@ -111,6 +123,15 @@ public class DataRoomPageServiceImpl extends ServiceImpl<DataRoomPageDao, PageEn
AssertUtils.isTrue(!checkCodeRepeat(bigScreenEntity), "编码重复");
this.save(bigScreenEntity);
dataRoomExtendClient.afterAdd(bigScreenEntity.getCode());
BizComponentUser bizComponentUser = new BizComponentUser();
bizComponentUser.setUserId(bigScreenPageDTO.getUserId());
bizComponentUser.setCode(code);
bizComponentUser.setType(bigScreenPageDTO.getType());
userDao.insert(bizComponentUser);
return bigScreenEntity.getCode();
}
@ -208,17 +229,79 @@ public class DataRoomPageServiceImpl extends ServiceImpl<DataRoomPageDao, PageEn
return config;
}
// @Override
// public PageVO<PageEntity> getByCategory(DataRoomSearchDTO searchDTO) {
// if (StringUtils.isBlank(searchDTO.getType())) {
// throw new GlobalException("类型不能为空");
// }
// LambdaQueryWrapper<PageEntity> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.like(StringUtils.isNotBlank(searchDTO.getSearchKey()), PageEntity::getName, searchDTO.getSearchKey());
// if (StringUtils.isNotBlank(searchDTO.getParentCode())) {
// queryWrapper.eq(PageEntity::getParentCode, searchDTO.getParentCode());
// }
// queryWrapper.eq(PageEntity::getType, searchDTO.getType());
// queryWrapper.select(PageEntity::getCode);
// List<PageEntity> idEntityList = this.list(queryWrapper);
// if (idEntityList == null || idEntityList.isEmpty()) {
// PageVO<PageEntity> pageVO = new PageVO<>();
// pageVO.setList(Lists.newArrayList());
// return pageVO;
// }
// List<String> codeList = idEntityList.stream().map(PageEntity::getCode).collect(Collectors.toList());
// List<String> filterByPermission = permissionClient.filterByPermission(codeList);
// if (filterByPermission == null || filterByPermission.isEmpty()) {
// PageVO<PageEntity> pageVO = new PageVO<>();
// pageVO.setList(Lists.newArrayList());
// return pageVO;
// }
// LambdaQueryWrapper<PageEntity> reQueryWrapper = new LambdaQueryWrapper<>();
// if (idEntityList.size() == filterByPermission.size()) {
// // 说明没有过滤掉任何一个, 按照原来的条件查询
// reQueryWrapper = queryWrapper;
// } else {
// // 说明过滤掉了一些, 按照过滤后的编码查询
// reQueryWrapper.in(PageEntity::getCode, filterByPermission);
// }
// reQueryWrapper.select(PageEntity::getId, PageEntity::getAppCode, PageEntity::getCode, PageEntity::getName, PageEntity::getParentCode, PageEntity::getOrderNum, PageEntity::getCoverPicture, PageEntity::getUpdateDate);
// // 优先序号升序,其次创建时间降序
// reQueryWrapper.orderByAsc(PageEntity::getOrderNum);
// reQueryWrapper.orderByDesc(PageEntity::getCreateDate);
// PageVO<PageEntity> page = this.page(searchDTO, reQueryWrapper);
// List<PageEntity> list = page.getList();
// if (list == null || list.isEmpty()) {
// return page;
// }
// String urlPrefix = bigScreenConfig.getFile().getBasePath();
// if (!urlPrefix.endsWith("/")) {
// urlPrefix += "/";
// }
// for (PageEntity pageEntity : list) {
// String coverPicture = pageEntity.getCoverPicture();
// if (StringUtils.isBlank(coverPicture)) {
// continue;
// }
// if (coverPicture.startsWith("/")) {
// coverPicture = coverPicture.substring(1);
// }
// pageEntity.setCoverPicture(urlPrefix + PathUtils.normalizePath(coverPicture));
// }
// return page;
// }
@Override
public PageVO<PageEntity> getByCategory(DataRoomSearchDTO searchDTO) {
if (StringUtils.isBlank(searchDTO.getType())) {
throw new GlobalException("类型不能为空");
}
// 使用分割type
List<String> types = Lists.newArrayList(searchDTO.getType().split(","));
LambdaQueryWrapper<PageEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtils.isNotBlank(searchDTO.getSearchKey()), PageEntity::getName, searchDTO.getSearchKey());
if (StringUtils.isNotBlank(searchDTO.getParentCode())) {
queryWrapper.eq(PageEntity::getParentCode, searchDTO.getParentCode());
}
queryWrapper.eq(PageEntity::getType, searchDTO.getType());
queryWrapper.in(PageEntity::getType, types);
//查询code code和userId关联
queryWrapper.select(PageEntity::getCode);
List<PageEntity> idEntityList = this.list(queryWrapper);
if (idEntityList == null || idEntityList.isEmpty()) {
@ -227,12 +310,15 @@ public class DataRoomPageServiceImpl extends ServiceImpl<DataRoomPageDao, PageEn
return pageVO;
}
List<String> codeList = idEntityList.stream().map(PageEntity::getCode).collect(Collectors.toList());
List<String> filterByPermission = permissionClient.filterByPermission(codeList);
List<String> filterByPermission = permissionClient.filterByPermission(codeList,searchDTO.getUserId(),searchDTO.getType());
if (filterByPermission == null || filterByPermission.isEmpty()) {
PageVO<PageEntity> pageVO = new PageVO<>();
pageVO.setList(Lists.newArrayList());
return pageVO;
}
LambdaQueryWrapper<PageEntity> reQueryWrapper = new LambdaQueryWrapper<>();
if (idEntityList.size() == filterByPermission.size()) {
// 说明没有过滤掉任何一个, 按照原来的条件查询
@ -241,29 +327,13 @@ public class DataRoomPageServiceImpl extends ServiceImpl<DataRoomPageDao, PageEn
// 说明过滤掉了一些, 按照过滤后的编码查询
reQueryWrapper.in(PageEntity::getCode, filterByPermission);
}
reQueryWrapper.select(PageEntity::getId, PageEntity::getAppCode, PageEntity::getCode, PageEntity::getName, PageEntity::getParentCode, PageEntity::getOrderNum, PageEntity::getCoverPicture, PageEntity::getUpdateDate);
reQueryWrapper.select(PageEntity::getId, PageEntity::getCode, PageEntity::getName,
PageEntity::getParentCode, PageEntity::getOrderNum, PageEntity::getCoverPicture, PageEntity::getUpdateDate, PageEntity::getType);
// 优先序号升序,其次创建时间降序
reQueryWrapper.orderByAsc(PageEntity::getOrderNum);
reQueryWrapper.orderByDesc(PageEntity::getCreateDate);
PageVO<PageEntity> page = this.page(searchDTO, reQueryWrapper);
List<PageEntity> list = page.getList();
if (list == null || list.isEmpty()) {
return page;
}
String urlPrefix = bigScreenConfig.getFile().getUrlPrefix();
if (!urlPrefix.endsWith("/")) {
urlPrefix += "/";
}
for (PageEntity pageEntity : list) {
String coverPicture = pageEntity.getCoverPicture();
if (StringUtils.isBlank(coverPicture)) {
continue;
}
if (coverPicture.startsWith("/")) {
coverPicture = coverPicture.substring(1);
}
pageEntity.setCoverPicture(urlPrefix + PathUtils.normalizePath(coverPicture));
}
return page;
}

@ -53,7 +53,7 @@ public class PageTemplateController extends SuperController {
PageVO<PageTemplateVO> pageVO = BeanConvertUtils.convertPage(page, PageTemplateVO.class, (source, target) -> {
// 如果缩略图的不是http开头的那么就拼接上当前服务后端地址
if (target.getThumbnail() != null && !target.getThumbnail().startsWith("http")) {
target.setThumbnail(bigScreenConfig.getFile().getUrlPrefix() + target.getThumbnail());
target.setThumbnail(bigScreenConfig.getFile().getBasePath() + target.getThumbnail());
}
});
return success(pageVO);
@ -72,7 +72,7 @@ public class PageTemplateController extends SuperController {
List<PageTemplateVO> voList = BeanConvertUtils.convert(list, PageTemplateVO.class, (source, target) -> {
// 如果缩略图的不是http开头的那么就拼接上当前服务后端地址
if (target.getThumbnail() != null && !target.getThumbnail().startsWith("http")) {
target.setThumbnail(bigScreenConfig.getFile().getUrlPrefix() + target.getThumbnail());
target.setThumbnail(bigScreenConfig.getFile().getBasePath() + target.getThumbnail());
}
});
return success(voList);

@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -34,10 +35,15 @@ public class TypeController {
private ITypeService typeService;
@GetMapping("/list/{type}")
@GetMapping("/list")
@ApiOperation(value = "分类列表", position = 10, produces = MediaType.APPLICATION_JSON_VALUE)
public R<List<TypeVO>> list(@PathVariable("type") String type) {
List<TypeEntity> entityList = typeService.listByType(type);
public R<List<TypeVO>> list(String type,String userId) {
if (!StringUtils.hasText(userId))
{
throw new RuntimeException("userId不能空");
}
List<TypeEntity> entityList = typeService.listByType(type,userId);
List<TypeVO> typeVOList = BeanConvertUtils.convert(entityList, TypeVO.class);
return R.success(typeVOList);
}

@ -38,5 +38,7 @@ public class TypeDTO {
@ApiModelProperty(notes = "排序")
private Integer orderNum;
@ApiModelProperty(notes = "用户ID")
private String userId;
}

@ -38,7 +38,7 @@ public interface ITypeService extends ISuperService<TypeEntity> {
* @param type
* @return
*/
List<TypeEntity> listByType(String type);
List<TypeEntity> listByType(String type,String userId);
/**
* code

@ -2,6 +2,8 @@ package com.gccloud.dataroom.core.module.type.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gccloud.dataroom.core.module.biz.component.dao.DataRoomBizUserDao;
import com.gccloud.dataroom.core.module.biz.component.entity.BizComponentUser;
import com.gccloud.dataroom.core.module.type.dao.DataRoomTypeDao;
import com.gccloud.dataroom.core.module.type.dto.TypeDTO;
import com.gccloud.dataroom.core.module.type.entity.TypeEntity;
@ -12,9 +14,11 @@ import com.gccloud.common.utils.BeanConvertUtils;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author hongyang
@ -25,11 +29,15 @@ import java.util.List;
@Service("dataRoomTypeService")
public class TypeServiceImpl extends ServiceImpl<DataRoomTypeDao, TypeEntity> implements ITypeService {
@Autowired
private DataRoomBizUserDao userDao;
@Override
public String add(TypeDTO typeDTO) {
TypeEntity entity = BeanConvertUtils.convert(typeDTO, TypeEntity.class);
String code = null;
if (StringUtils.isBlank(entity.getCode())) {
String code = CodeGenerateUtils.generate(typeDTO.getType());
code = CodeGenerateUtils.generate(typeDTO.getType());
while (this.checkCodeRepeat(null, typeDTO.getType(), code)) {
code = CodeGenerateUtils.generate(typeDTO.getType());
}
@ -43,6 +51,14 @@ public class TypeServiceImpl extends ServiceImpl<DataRoomTypeDao, TypeEntity> im
throw new GlobalException("分组名称已存在");
}
this.save(entity);
BizComponentUser bizComponentUser = new BizComponentUser();
bizComponentUser.setUserId(typeDTO.getUserId());
bizComponentUser.setCode(code);
bizComponentUser.setType(typeDTO.getType());
userDao.insert(bizComponentUser);
return entity.getId();
}
@ -60,16 +76,41 @@ public class TypeServiceImpl extends ServiceImpl<DataRoomTypeDao, TypeEntity> im
if (StringUtils.isBlank(id)) {
return;
}
TypeEntity byId = this.getById(id);
this.removeById(id);
//根据ID查询code 和type,然后删除
String type = byId.getType();
String code = byId.getCode();
LambdaQueryWrapper<BizComponentUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(BizComponentUser::getType,type);
lambdaQueryWrapper.eq(BizComponentUser::getCode,code);
userDao.delete(lambdaQueryWrapper);
}
@Override
public List<TypeEntity> listByType(String type) {
public List<TypeEntity> listByType(String type,String userId) {
if (StringUtils.isBlank(type)) {
return Lists.newArrayList();
}
//获取所有code
LambdaQueryWrapper<BizComponentUser> userLambdaQueryWrapper = new LambdaQueryWrapper<>();
userLambdaQueryWrapper.eq(BizComponentUser::getUserId,userId);
userLambdaQueryWrapper.eq(BizComponentUser::getType,type);
List<BizComponentUser> bizComponentUserList = userDao.selectList(userLambdaQueryWrapper);
List<String> codeList = bizComponentUserList.stream().map(code -> code.getCode()).collect(Collectors.toList());
LambdaQueryWrapper<TypeEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TypeEntity::getType, type);
queryWrapper.in(TypeEntity::getCode,codeList);
queryWrapper.orderByAsc(TypeEntity::getOrderNum);
queryWrapper.orderByDesc(TypeEntity::getCreateDate);
return this.list(queryWrapper);

@ -1,9 +1,16 @@
package com.gccloud.dataroom.core.permission;
import com.gccloud.dataroom.core.module.basic.entity.PageEntity;
import com.gccloud.dataroom.core.module.biz.component.dao.DataRoomBizUserDao;
import com.gccloud.dataroom.core.module.biz.component.entity.BizComponentUser;
import com.gccloud.dataroom.core.module.manage.service.IDataRoomPageService;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
@ -36,16 +43,21 @@ public class DataRoomPermissionClient {
/**
*
* @param allCode code
* @return code
* @return code
*/
public List<String> filterByPermission(List<String> allCode) {
public List<String> filterByPermission(List<String> allCode,String userId,String type) {
if (permissionService != null) {
return permissionService.filterByPermission(allCode);
return permissionService.filterByPermission(allCode,userId,type);
}
return allCode;
}
private List<String> getUserDataRoomCodeList() {
// 模拟获取当前用户有权限的大屏code列表需要根据实际情况自行实现
return Lists.newArrayList("bigScreen_auPP6DkIIn", "bigScreen_auPxxDkIIn", "bigScreen_auPP6Dkxxn");
}
}

@ -24,8 +24,6 @@ public interface IDataRoomPermissionService {
* @param allCode code
* @return code
*/
default List<String> filterByPermission(List<String> allCode) {
return allCode;
}
List<String> filterByPermission(List<String> allCode,String userId,String type) ;
}

@ -8,6 +8,10 @@ server:
spring:
profiles:
active: dev
servlet:
multipart:
max-file-size: 500MB
max-request-size: 500MB
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
@ -29,7 +33,12 @@ spring:
web:
resources:
static-locations: classpath:/static/,classpath:/META-INF/resources/,classpath:/META-INF/resources/webjars/,file:${gc.starter.file.basePath}
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.p6spy.engine.spy.P6SpyDriver
url: jdbc:p6spy:mysql://118.31.7.2:3306/dashboard?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true
username: root
password: sztzjy2017
mybatis-plus:
# mybatis plus xml配置文件扫描多个通过分号隔开
@ -40,3 +49,10 @@ mybatis-plus:
db-config:
#主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"唯一ID";
id-type: AUTO
gc:
starter:
file:
basePath: /usr/local/tianzeProject/largeScreen/uploadFile/img
img: http://118.31.7.2:96/file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Loading…
Cancel
Save