This commit is contained in:
parent
8de1f747f8
commit
a1cf2d1033
|
|
@ -6,9 +6,12 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://192.168.0.14:4417/bonus_cloud_service?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://192.168.0.14:4417/bonus_cloud_service?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
# username: root
|
||||||
password: Bonus@admin123!
|
# password: Bonus@admin123!
|
||||||
|
url: jdbc:mysql://127.0.0.1:3306/bonus_cloud_service?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
username: mroot
|
||||||
|
password: bonus@admin123
|
||||||
# url: jdbc:mysql://192.168.0.7:13308/bonus_cloud_service?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://192.168.0.7:13308/bonus_cloud_service?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
# username: root
|
# username: root
|
||||||
# password: Bonus@admin123!
|
# password: Bonus@admin123!
|
||||||
|
|
|
||||||
|
|
@ -69,9 +69,12 @@ spring:
|
||||||
enabled: true
|
enabled: true
|
||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
host: 192.168.0.14
|
host: 127.0.0.1
|
||||||
port: 2003
|
port: 6379
|
||||||
password: Fyzbns@Redis123!
|
# password: Fyzbns@Redis123!
|
||||||
|
# host: 192.168.0.14
|
||||||
|
# port: 2003
|
||||||
|
# password: Fyzbns@Redis123!
|
||||||
# 地址
|
# 地址
|
||||||
# host: 192.168.0.7
|
# host: 192.168.0.7
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
|
|
@ -133,13 +136,18 @@ xss:
|
||||||
# 匹配链接
|
# 匹配链接
|
||||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||||
|
|
||||||
|
|
||||||
minio:
|
minio:
|
||||||
url: http://192.168.0.14:9090
|
url: http://47.92.234.255:9090
|
||||||
endpoint: http://192.168.0.14:9090
|
endpoint: http://47.92.234.255:9090
|
||||||
accessKey: minio
|
accessKey: minio
|
||||||
secretKey: bonus@admin123
|
secretKey: Bonus@admin123!
|
||||||
bucketName: product
|
bucketName: product
|
||||||
|
#minio:
|
||||||
|
# url: http://192.168.0.14:9090
|
||||||
|
# endpoint: http://192.168.0.14:9090
|
||||||
|
# accessKey: minio
|
||||||
|
# secretKey: bonus@admin123
|
||||||
|
# bucketName: product
|
||||||
management:
|
management:
|
||||||
server:
|
server:
|
||||||
port: -1 # 禁用独立管理端口(与业务端口共用)
|
port: -1 # 禁用独立管理端口(与业务端口共用)
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,28 @@ public class DocumentTreeVo {
|
||||||
*子集合
|
*子集合
|
||||||
*/
|
*/
|
||||||
private List<DocumentTreeVo> childTree;
|
private List<DocumentTreeVo> childTree;
|
||||||
|
/**
|
||||||
|
* 管理id
|
||||||
|
*/
|
||||||
|
private String realId;
|
||||||
|
/**
|
||||||
|
* 公共的级别id
|
||||||
|
*/
|
||||||
|
private String pubFolderId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级节点id
|
||||||
|
*/
|
||||||
|
private String parent;
|
||||||
|
/**
|
||||||
|
* 实际id
|
||||||
|
*/
|
||||||
|
private String exeId;
|
||||||
|
/**
|
||||||
|
* 数据类型
|
||||||
|
*/
|
||||||
|
private String datType;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,30 @@ public class TbDocumentFolder extends BaseEntity
|
||||||
* 分享人id
|
* 分享人id
|
||||||
*/
|
*/
|
||||||
private String shareUserId;
|
private String shareUserId;
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
private String filePath;
|
||||||
|
/**
|
||||||
|
* 文件id
|
||||||
|
*/
|
||||||
|
private String fileId;
|
||||||
|
/**
|
||||||
|
* 文件后缀
|
||||||
|
*/
|
||||||
|
private String fileSuffix;
|
||||||
|
|
||||||
|
private String labels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公共文件夹id
|
||||||
|
*/
|
||||||
|
private String publicFolderId;
|
||||||
|
/**
|
||||||
|
* 数据类型
|
||||||
|
*/
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限集合
|
* 权限集合
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,11 @@ public class TbUserFiles extends BaseEntity
|
||||||
@Excel(name = "文档标签")
|
@Excel(name = "文档标签")
|
||||||
private String labels;
|
private String labels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级节点
|
||||||
|
*/
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 桶名称
|
* 桶名称
|
||||||
*/
|
*/
|
||||||
|
|
@ -101,5 +106,8 @@ public class TbUserFiles extends BaseEntity
|
||||||
private String repeatType;
|
private String repeatType;
|
||||||
|
|
||||||
|
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,30 @@ public class TreeBuild {
|
||||||
return rootNodeList;
|
return rootNodeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取需构建的所有根节点(顶级节点) "0"
|
||||||
|
* @return 所有根节点List集合
|
||||||
|
*/
|
||||||
|
public List<DocumentTreeVo> getRootNode1(String parentId,String isAdmin){
|
||||||
|
// 保存所有根节点(所有根节点的数据)
|
||||||
|
List<DocumentTreeVo> rootNodeList = new ArrayList<>();
|
||||||
|
// treeNode:查询出的每一条数据(节点)
|
||||||
|
for (DocumentTreeVo treeNode : nodeList){
|
||||||
|
// 判断当前节点是否为根节点,此处注意:若parentId类型是String,则要采用equals()方法判断。
|
||||||
|
if (parentId.equals(treeNode.getParent()) ) {
|
||||||
|
if("1".equals(isAdmin) && "1".equals(treeNode.getDatType())){
|
||||||
|
// 是,添加
|
||||||
|
rootNodeList.add(treeNode);
|
||||||
|
}else{
|
||||||
|
rootNodeList.add(treeNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rootNodeList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据每一个顶级节点(根节点)进行构建树形结构
|
* 根据每一个顶级节点(根节点)进行构建树形结构
|
||||||
* @return 构建整棵树
|
* @return 构建整棵树
|
||||||
|
|
@ -54,6 +78,20 @@ public class TreeBuild {
|
||||||
return treeNodes;
|
return treeNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DocumentTreeVo> buildTree1(String parentId,String isAdmin){
|
||||||
|
// treeNodes:保存一个顶级节点所构建出来的完整树形
|
||||||
|
List<DocumentTreeVo> treeNodes = new ArrayList<DocumentTreeVo>();
|
||||||
|
// getRootNode():获取所有的根节点
|
||||||
|
for (DocumentTreeVo treeRootNode : getRootNode1(parentId,isAdmin)) {
|
||||||
|
// 将顶级节点进行构建子树
|
||||||
|
treeRootNode = buildChildTree1(treeRootNode);
|
||||||
|
// 完成一个顶级节点所构建的树形,增加进来
|
||||||
|
treeNodes.add(treeRootNode);
|
||||||
|
}
|
||||||
|
return treeNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归-----构建子树形结构
|
* 递归-----构建子树形结构
|
||||||
* @param pNode 根节点(顶级节点)
|
* @param pNode 根节点(顶级节点)
|
||||||
|
|
@ -69,6 +107,28 @@ public class TreeBuild {
|
||||||
childTree.add(buildChildTree(treeNode));
|
childTree.add(buildChildTree(treeNode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(pNode.getChildTree()==null || pNode.getChildTree().isEmpty()){
|
||||||
|
// for循环结束,即节点下没有任何节点,树形构建结束,设置树结果
|
||||||
|
pNode.setChildTree(childTree);
|
||||||
|
}
|
||||||
|
return pNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递归-----构建子树形结构
|
||||||
|
* @param pNode 根节点(顶级节点)
|
||||||
|
* @return 整棵树
|
||||||
|
*/
|
||||||
|
public DocumentTreeVo buildChildTree1(DocumentTreeVo pNode){
|
||||||
|
List<DocumentTreeVo> childTree = new ArrayList<DocumentTreeVo>();
|
||||||
|
// nodeList:所有节点集合(所有数据)
|
||||||
|
for (DocumentTreeVo treeNode : nodeList) {
|
||||||
|
// 判断当前节点的父节点ID是否等于根节点的ID,即当前节点为其下的子节点
|
||||||
|
if (treeNode.getParent().equals(pNode.getExeId())) {
|
||||||
|
// 再递归进行判断当前节点的情况,调用自身方法
|
||||||
|
childTree.add(buildChildTree1(treeNode));
|
||||||
|
}
|
||||||
|
}
|
||||||
// for循环结束,即节点下没有任何节点,树形构建结束,设置树结果
|
// for循环结束,即节点下没有任何节点,树形构建结束,设置树结果
|
||||||
pNode.setChildTree(childTree);
|
pNode.setChildTree(childTree);
|
||||||
return pNode;
|
return pNode;
|
||||||
|
|
|
||||||
|
|
@ -3,131 +3,12 @@ package com.bonus.business.mapper;
|
||||||
import com.bonus.business.domain.*;
|
import com.bonus.business.domain.*;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.security.core.parameters.P;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface DocumentScreenMapper {
|
public interface DocumentScreenMapper {
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询文档库数据
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DocumentTreeVo> getCompanyChildList(DocumentTreeVo vo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询每个人自己的文档数据
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DocumentTreeVo> getMyChildList(DocumentTreeVo vo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询其他人共享给我的
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DocumentTreeVo> getOtherShare(DocumentTreeVo vo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询我分享出去的文档
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DocumentTreeVo> getMyShareList(DocumentTreeVo vo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询全部数据
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DocumentTreeVo> getDocumentList(DocumentTreeVo vo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增公司文档
|
|
||||||
* @param vo
|
|
||||||
*/
|
|
||||||
Integer addDocumentCompany(TbDocumentFolder vo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增文件夹权限数据
|
|
||||||
* @param auth
|
|
||||||
*/
|
|
||||||
void addDocumentAuth(TbDocumentFolderAuth auth);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增个人文档文件夹
|
|
||||||
* @param vo
|
|
||||||
*/
|
|
||||||
void addDocumentUser(TbDocumentFolder vo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 插入图片-个人
|
|
||||||
* @param productCaseImage
|
|
||||||
*/
|
|
||||||
void insertUserFile(TbUserFiles productCaseImage);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 插入文档-公司
|
|
||||||
* @param productCaseImage
|
|
||||||
*/
|
|
||||||
void insertCompanyFile(TbUserFiles productCaseImage);
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param list
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
void addFileLabel(@Param("list") List<TbUserLabel> list, @Param("id") String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件标签
|
|
||||||
* @param list
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
void addUserFileLabel(List<TbUserLabel> list, String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询文件夹下存在的文件
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<TbUserFiles> getCompanyFileList(TbUserFiles vo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询个人文件数据集合
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<TbUserFiles> getUserFileList(TbUserFiles vo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除公司下文件
|
|
||||||
* @param delete
|
|
||||||
*/
|
|
||||||
void deleteCompanyFile(@Param("list") List<TbUserFiles> delete);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除用户文件
|
|
||||||
* @param delete
|
|
||||||
*/
|
|
||||||
void deleteUserFile(@Param("list")List<TbUserFiles> delete);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 公司文件夹下文件及
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<TbFolderFileVo> getCompanyUserFileList(TbFolderFileVo vo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 个人 文件夹下 的文件夹及我呢见
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<TbFolderFileVo> getMyUserFileList(TbFolderFileVo vo);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -144,4 +25,45 @@ public interface DocumentScreenMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DocumentTreeVo> getUserFolderList(DocumentTreeVo vo);
|
List<DocumentTreeVo> getUserFolderList(DocumentTreeVo vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件夹名称是否重复
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer getDocumentByNum(TbDocumentFolder vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建文件夹名称
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer addDocumentCompany(TbDocumentFolder vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增文件夹关联信息
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer addDocumentRealUser(TbDocumentFolder vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TbUserFiles> getDocumentFileList(TbUserFiles vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据
|
||||||
|
* @param delete
|
||||||
|
*/
|
||||||
|
void deleteCompanyFile(@Param("list") List<TbUserFiles> delete);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据详情
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TbFolderFileVo> getFileFolderList(TbFolderFileVo vo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getDocumentTree(DocumentTreeVo vo) {
|
public AjaxResult getDocumentTree(DocumentTreeVo vo) {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
String userId= SecurityUtils.getUserId().toString();
|
String userId= SecurityUtils.getUserId().toString();
|
||||||
vo.setUserId(userId);
|
vo.setUserId(userId);
|
||||||
|
|
@ -54,8 +53,13 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
||||||
vo.setIsAdmin("1");
|
vo.setIsAdmin("1");
|
||||||
}
|
}
|
||||||
List<DocumentTreeVo> allList=mapper.getPublicFolderList(vo);
|
List<DocumentTreeVo> allList=mapper.getPublicFolderList(vo);
|
||||||
|
|
||||||
List<DocumentTreeVo> childeList=mapper.getUserFolderList(vo);
|
List<DocumentTreeVo> childeList=mapper.getUserFolderList(vo);
|
||||||
//查询 子节点集合
|
//查询 子节点集合
|
||||||
|
TreeBuild treeBuild1 = new TreeBuild(childeList);
|
||||||
|
List<DocumentTreeVo> childeList2=treeBuild1.buildTree1("0",vo.getIsAdmin());
|
||||||
|
allList.addAll(childeList2);
|
||||||
|
//查询 子节点集合
|
||||||
TreeBuild treeBuild = new TreeBuild(allList);
|
TreeBuild treeBuild = new TreeBuild(allList);
|
||||||
List<DocumentTreeVo> list=treeBuild.buildTree("0");
|
List<DocumentTreeVo> list=treeBuild.buildTree("0");
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
|
|
@ -79,26 +83,38 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
||||||
vo.setId(StringUtils.randomUUID());
|
vo.setId(StringUtils.randomUUID());
|
||||||
//类型
|
//类型
|
||||||
String type=vo.getType();
|
String type=vo.getType();
|
||||||
//文档库
|
vo.setFileType("0");
|
||||||
vo.setParentIds(vo.getParentIds()+","+vo.getParentId()+",");
|
// 如果上级节点是public 数据 parentId设置为新的起点 0
|
||||||
if("1".equals(type)){
|
if("1".equals(type)){
|
||||||
Integer num= mapper.addDocumentCompany(vo);
|
vo.setPublicFolderId(vo.getParentId());
|
||||||
|
vo.setParentId("0");
|
||||||
|
}
|
||||||
|
vo.setParentIds(vo.getParentIds()+vo.getParentId()+",");
|
||||||
|
/**
|
||||||
|
* 查询文件夹名称是否重复
|
||||||
|
*/
|
||||||
|
Integer num= mapper.getDocumentByNum(vo);
|
||||||
if(num!=null && num>0){
|
if(num!=null && num>0){
|
||||||
TbDocumentFolderAuth auth=new TbDocumentFolderAuth();
|
return AjaxResult.error("文件夹名称已存在");
|
||||||
auth.setFolderId(vo.getId());
|
}
|
||||||
auth.setUserId(userId);
|
Integer num2= mapper.addDocumentCompany(vo);
|
||||||
auth.setFolderType("1");
|
|
||||||
auth.setFolderSource("0");
|
if("1".equals(type)){
|
||||||
auth.setFolderAuth("4");
|
vo.setAuthType("4");
|
||||||
auth.setIsShare("0");
|
//创建的都是4
|
||||||
//新增数据
|
vo.setDataType("1");
|
||||||
mapper.addDocumentAuth(auth);
|
Integer num3= mapper.addDocumentRealUser(vo);
|
||||||
|
if(num3!=null && num3>0){
|
||||||
|
return AjaxResult.success("添加成功");
|
||||||
}else{
|
}else{
|
||||||
return AjaxResult.error("添加失败");
|
return AjaxResult.error("添加失败");
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
mapper.addDocumentUser(vo);
|
|
||||||
}
|
}
|
||||||
|
if(num2!=null && num2>0){
|
||||||
|
return AjaxResult.success("添加成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return AjaxResult.success("添加成功");
|
return AjaxResult.success("添加成功");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
|
|
@ -115,6 +131,7 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult importFile(MultipartFile[] file, TbUserFiles vo) {
|
public AjaxResult importFile(MultipartFile[] file, TbUserFiles vo) {
|
||||||
try{
|
try{
|
||||||
|
String type=vo.getType();
|
||||||
if(file==null ||file.length==0){
|
if(file==null ||file.length==0){
|
||||||
return AjaxResult.error("请上传附件");
|
return AjaxResult.error("请上传附件");
|
||||||
}
|
}
|
||||||
|
|
@ -128,17 +145,12 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
||||||
vo.setUploadUser(SecurityUtils.getUserId().toString());
|
vo.setUploadUser(SecurityUtils.getUserId().toString());
|
||||||
vo.setCreateUser(SecurityUtils.getUserId().toString());
|
vo.setCreateUser(SecurityUtils.getUserId().toString());
|
||||||
String repeatType=vo.getRepeatType();
|
String repeatType=vo.getRepeatType();
|
||||||
//
|
//创建文件
|
||||||
List<TbUserFiles> list;
|
|
||||||
if("1".equals(vo.getType())){
|
|
||||||
list=mapper.getCompanyFileList(vo);
|
|
||||||
}else{
|
|
||||||
list=mapper.getUserFileList(vo);
|
|
||||||
}
|
|
||||||
List<MultipartFile> fileList=new ArrayList<>(list.size());
|
|
||||||
List<TbUserFiles> delete=new ArrayList<>();
|
|
||||||
|
|
||||||
//覆盖 覆盖会删除之前的数据
|
List<TbUserFiles> list=mapper.getDocumentFileList(vo);
|
||||||
|
List<MultipartFile> fileList=new ArrayList<>(file.length);
|
||||||
|
List<TbUserFiles> delete=new ArrayList<>();
|
||||||
|
//是否覆盖之前的数据
|
||||||
if("1".equals(repeatType)){
|
if("1".equals(repeatType)){
|
||||||
//跳过
|
//跳过
|
||||||
for (MultipartFile multipartFile : file) {
|
for (MultipartFile multipartFile : file) {
|
||||||
|
|
@ -168,20 +180,16 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//删除文件
|
||||||
for (TbUserFiles tbUserFiles : delete) {
|
for (TbUserFiles tbUserFiles : delete) {
|
||||||
//删除文件
|
//删除文件
|
||||||
service.delFile(tbUserFiles.getFilePath());
|
service.delFile(tbUserFiles.getFilePath());
|
||||||
}
|
}
|
||||||
//个人及公司
|
//删除文件
|
||||||
if("1".equals(vo.getType())){
|
|
||||||
mapper.deleteCompanyFile(delete);
|
mapper.deleteCompanyFile(delete);
|
||||||
}else{
|
|
||||||
mapper.deleteUserFile(delete);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 文件上传
|
|
||||||
AjaxResult result=uploadFile(fileList,vo);
|
AjaxResult result=uploadFile(fileList,vo);
|
||||||
|
// 文件上传
|
||||||
if(result.isError()){
|
if(result.isError()){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -200,14 +208,21 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
||||||
@Override
|
@Override
|
||||||
public List<TbFolderFileVo> getFileFolderList(TbFolderFileVo vo) {
|
public List<TbFolderFileVo> getFileFolderList(TbFolderFileVo vo) {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
|
List<TbFolderFileVo> list=mapper.getFileFolderList(vo);
|
||||||
// 文件夹类型
|
// 文件夹类型
|
||||||
String type=vo.getType();
|
String type=vo.getType();
|
||||||
if("1".equals(type)){
|
if("1".equals(type)){
|
||||||
//公司文档
|
//公司文档 公共的查询全部
|
||||||
return mapper.getCompanyUserFileList(vo);
|
|
||||||
}else if("2".equals(type)){
|
|
||||||
|
|
||||||
|
}else {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//自己的文档
|
//自己的文档
|
||||||
return mapper.getMyUserFileList(vo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
|
@ -223,14 +238,21 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
||||||
*/
|
*/
|
||||||
public AjaxResult uploadFile(List<MultipartFile> multipartFileList,TbUserFiles files){
|
public AjaxResult uploadFile(List<MultipartFile> multipartFileList,TbUserFiles files){
|
||||||
String type=files.getType();
|
String type=files.getType();
|
||||||
String filePath="" ;
|
String filePath = "document/file/"+files.getUploadUser() +file_path +
|
||||||
|
year + file_path + month + file_path + day +file_path ;
|
||||||
|
TbDocumentFolder documentFolder=new TbDocumentFolder();
|
||||||
|
//文件类型
|
||||||
|
documentFolder.setFileType("1");
|
||||||
|
documentFolder.setId(StringUtils.randomUUID());
|
||||||
|
documentFolder.setPublicFolderId(documentFolder.getParentId());
|
||||||
if("1".equals(type)){
|
if("1".equals(type)){
|
||||||
filePath = "document/company/"+files.getUploadUser() +file_path +
|
documentFolder.setParentId("0");
|
||||||
year + file_path + month + file_path + day +file_path ;
|
|
||||||
}else{
|
}else{
|
||||||
filePath = "document/user/" + files.getUploadUser()+file_path +
|
documentFolder.setParentId(files.getParentId());
|
||||||
year + file_path + month + file_path + day +file_path ;
|
|
||||||
}
|
}
|
||||||
|
documentFolder.setParentIds(documentFolder.getParentIds()+documentFolder.getParentId()+",");
|
||||||
|
|
||||||
|
//
|
||||||
String[] ids=files.getLabelIds().split(",");
|
String[] ids=files.getLabelIds().split(",");
|
||||||
String[] name= files.getLabels().split(",");
|
String[] name= files.getLabels().split(",");
|
||||||
List<TbUserLabel> list=new ArrayList<TbUserLabel>();
|
List<TbUserLabel> list=new ArrayList<TbUserLabel>();
|
||||||
|
|
@ -264,14 +286,30 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
||||||
// 转换为可读格式(如KB/MB)
|
// 转换为可读格式(如KB/MB)
|
||||||
String humanReadableSize = convertToHumanReadable(sizeInBytes);
|
String humanReadableSize = convertToHumanReadable(sizeInBytes);
|
||||||
files.setFileSize(humanReadableSize);
|
files.setFileSize(humanReadableSize);
|
||||||
|
//数据
|
||||||
|
documentFolder.setFolderName(originFileName);
|
||||||
|
documentFolder.setFileSuffix(suffix);
|
||||||
|
documentFolder.setFilePath(filePath);
|
||||||
|
String userId=SecurityUtils.getUserId().toString();
|
||||||
|
documentFolder.setCreateUser(userId);
|
||||||
|
documentFolder.setUpdateUser(userId);
|
||||||
|
//新增文档
|
||||||
|
Integer num=mapper.addDocumentCompany(documentFolder);
|
||||||
if("1".equals(type)){
|
if("1".equals(type)){
|
||||||
//公司级别
|
documentFolder.setAuthType("4");
|
||||||
mapper.insertCompanyFile(files);
|
//创建的都是4
|
||||||
mapper.addFileLabel(list,files.getId());
|
documentFolder.setDataType("1");
|
||||||
|
Integer num3= mapper.addDocumentRealUser(documentFolder);
|
||||||
|
if(num3!=null && num3>0){
|
||||||
|
return AjaxResult.success();
|
||||||
}else{
|
}else{
|
||||||
// 个人级别
|
return AjaxResult.error("添加失败");
|
||||||
mapper.insertUserFile(files);
|
}
|
||||||
mapper.addUserFileLabel(list,files.getId());
|
}
|
||||||
|
if(num!=null && num>0){
|
||||||
|
return AjaxResult.success();
|
||||||
|
}else{
|
||||||
|
return AjaxResult.error("添加失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|
@ -284,124 +322,15 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
||||||
else return String.format("%.2f MB", bytes / (1024 * 1024.0));
|
else return String.format("%.2f MB", bytes / (1024 * 1024.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询 我的共享文档和他人贡献给我的文档
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private DocumentTreeVo getShareDocument(DocumentTreeVo vo) {
|
|
||||||
DocumentTreeVo vo1=new DocumentTreeVo();
|
|
||||||
vo1.setId("share");
|
|
||||||
vo1.setParentId("0");
|
|
||||||
vo1.setParentIds("0,");
|
|
||||||
vo1.setName("共享文档");
|
|
||||||
vo1.setType("3");
|
|
||||||
List<DocumentTreeVo> list=getShareList(vo);
|
|
||||||
vo1.setChildTree(list);
|
|
||||||
return vo1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询共享文档数据集合
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private List<DocumentTreeVo> getShareList(DocumentTreeVo vo) {
|
|
||||||
List<DocumentTreeVo> allShareList=mapper.getDocumentList(vo);
|
|
||||||
List<DocumentTreeVo> list=new ArrayList<>();
|
|
||||||
DocumentTreeVo vo1=new DocumentTreeVo();
|
|
||||||
vo1.setId("myShare");
|
|
||||||
vo1.setParentId("share");
|
|
||||||
vo1.setParentIds("share");
|
|
||||||
vo1.setName("我共享的");
|
|
||||||
vo1.setType("31");
|
|
||||||
//我共享出去的文档查询
|
|
||||||
List<DocumentTreeVo> childerList=getMyShareList(vo,allShareList);
|
|
||||||
vo1.setChildTree(childerList);
|
|
||||||
DocumentTreeVo vo2=new DocumentTreeVo();
|
|
||||||
vo2.setId("otherShare");
|
|
||||||
vo2.setParentId("share");
|
|
||||||
vo2.setParentIds("share");
|
|
||||||
vo2.setName("与我共享");
|
|
||||||
vo2.setType("32");
|
|
||||||
List<DocumentTreeVo> childList2=getOtherShare(vo,allShareList);
|
|
||||||
vo2.setChildTree(childList2);
|
|
||||||
list.add(vo1);
|
|
||||||
list.add(vo2);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 其他人共享给我的
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private List<DocumentTreeVo> getOtherShare(DocumentTreeVo vo, List<DocumentTreeVo> allShareList) {
|
|
||||||
//查询他人分享的 -数据源是 文档库
|
|
||||||
TreeBuild treeBuild = new TreeBuild(allShareList);
|
|
||||||
List<DocumentTreeVo> shareList=mapper.getOtherShare(vo);
|
|
||||||
for(DocumentTreeVo share:allShareList){
|
|
||||||
List<DocumentTreeVo> list=treeBuild.buildTree(share.getId());
|
|
||||||
share.setChildTree(list);
|
|
||||||
}
|
|
||||||
return shareList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询分享给我的文件夹
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private List<DocumentTreeVo> getMyShareList(DocumentTreeVo vo, List<DocumentTreeVo> allShareList) {
|
|
||||||
//查询我共享出去的文件夹及文件
|
|
||||||
TreeBuild treeBuild = new TreeBuild(allShareList);
|
|
||||||
List<DocumentTreeVo> shareList=mapper.getMyShareList(vo);
|
|
||||||
for(DocumentTreeVo share:allShareList){
|
|
||||||
List<DocumentTreeVo> list=treeBuild.buildTree(share.getId());
|
|
||||||
share.setChildTree(list);
|
|
||||||
}
|
|
||||||
return shareList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询我的文档数据集合1
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private DocumentTreeVo getMyChildList(DocumentTreeVo vo) {
|
|
||||||
DocumentTreeVo vo1=new DocumentTreeVo();
|
|
||||||
vo1.setId("myDocument");
|
|
||||||
vo1.setParentId("0");
|
|
||||||
vo1.setName("我的文档");
|
|
||||||
vo1.setType("2");
|
|
||||||
List<DocumentTreeVo> childeList=mapper.getMyChildList(vo);
|
|
||||||
TreeBuild treeBuild = new TreeBuild(childeList);
|
|
||||||
List<DocumentTreeVo> list=treeBuild.buildTree("myDocument");
|
|
||||||
vo1.setChildTree(list);
|
|
||||||
return vo1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 公共服务文档数据集合
|
|
||||||
* @param vo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public DocumentTreeVo getCompanyChildList(DocumentTreeVo vo){
|
|
||||||
//查询 文档库集合
|
|
||||||
DocumentTreeVo vo1=new DocumentTreeVo();
|
|
||||||
vo1.setId("companyDocument");
|
|
||||||
vo1.setParentId("0");
|
|
||||||
vo1.setName("文档库");
|
|
||||||
vo1.setType("1");
|
|
||||||
List<DocumentTreeVo> childeList=mapper.getCompanyChildList(vo);
|
|
||||||
TreeBuild treeBuild = new TreeBuild(childeList);
|
|
||||||
List<DocumentTreeVo> list=treeBuild.buildTree("companyDocument");
|
|
||||||
vo1.setChildTree(list);
|
|
||||||
return vo1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,30 @@
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.bonus.business.mapper.DocumentScreenMapper">
|
<mapper namespace="com.bonus.business.mapper.DocumentScreenMapper">
|
||||||
|
<insert id="addDocumentCompany">
|
||||||
|
insert into tb_user_document_folder(
|
||||||
|
id, level, folder_name, parent_id, file_type,
|
||||||
|
remark, parent_ids,file_path, file_id,
|
||||||
|
down_times, see_times, file_suffix, labels,
|
||||||
|
create_user, create_time, update_user, update_time, del_flag
|
||||||
|
)values (#{id},#{level},#{folderName},#{parentId},#{fileType},#{remark},#{parentIds},#{filePath},#{fileId},0,0,#{fileSuffix},
|
||||||
|
#{labels},#{createUser},now(),#{updateUser},now(),0
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
<insert id="addDocumentRealUser">
|
||||||
|
replace into tb_public_real_user(
|
||||||
|
public_folder_id, user_id, user_folder_id,auth, share_user_id, data_type
|
||||||
|
)values (#{publicFolderId},#{userId},#{id},#{auth},#{shareUserId},#{dataType})
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
<update id="deleteCompanyFile">
|
||||||
|
update tb_user_document_folder set from del_flag=1
|
||||||
|
where id in (
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
#{item.id}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</update>
|
||||||
<select id="getPublicFolderList" resultType="com.bonus.business.domain.DocumentTreeVo">
|
<select id="getPublicFolderList" resultType="com.bonus.business.domain.DocumentTreeVo">
|
||||||
select tpf.id,level,tpf.folder_name name,tpf.parent_id parentId,tpf.parent_ids parentIds,1 type
|
select tpf.id,level,tpf.folder_name name,tpf.parent_id parentId,tpf.parent_ids parentIds,1 type
|
||||||
from tb_public_folder tpf
|
from tb_public_folder tpf
|
||||||
|
|
@ -21,6 +45,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
<!--查询用户文件夹结合-->
|
<!--查询用户文件夹结合-->
|
||||||
<select id="getUserFolderList" resultType="com.bonus.business.domain.DocumentTreeVo">
|
<select id="getUserFolderList" resultType="com.bonus.business.domain.DocumentTreeVo">
|
||||||
|
SELECT folder.id exeId ,folder.level,folder.folder_name name,folder.parent_id parent,2 type,folder.parent_ids parentIds,
|
||||||
|
folder.file_suffix,pru.user_id,pru.public_folder_id parentId,pru.auth ,pru.share_user_id,
|
||||||
|
concat(pru.public_folder_id,"_",pru.user_id,"_",folder.id) id
|
||||||
|
from tb_user_document_folder folder
|
||||||
|
left join tb_public_real_user pru on folder.id=pru.user_folder_id
|
||||||
|
where folder.file_type=0
|
||||||
|
</select>
|
||||||
|
<!--文件夹名称是否存在-->
|
||||||
|
<select id="getDocumentByNum" resultType="java.lang.Integer">
|
||||||
|
select count(1)
|
||||||
|
from tb_user_document_folder
|
||||||
|
where del_flag=0 and file_type=0 and folder_name=#{folderName}
|
||||||
|
</select>
|
||||||
|
<!--查询文件夹数据集合-->
|
||||||
|
<select id="getDocumentFileList" resultType="com.bonus.business.domain.TbUserFiles">
|
||||||
|
SELECT folder.id id ,folder.level,folder.folder_name originalName,folder.parent_id parentId,2 type,folder.parent_ids parentIds,
|
||||||
|
folder.file_suffix,pru.user_id,pru.public_folder_id ,pru.auth ,pru.share_user_id,folder.file_path filePath
|
||||||
|
from tb_user_document_folder folder
|
||||||
|
left join tb_public_real_user pru on folder.id=pru.user_folder_id
|
||||||
|
where folder.file_type=1
|
||||||
|
<!--类型是public-->
|
||||||
|
<if test='type=="1" or type==1 '>
|
||||||
|
and pru.public_folder_id=#{parentId}
|
||||||
|
</if>
|
||||||
|
<if test='type=="2" or type==2 '>
|
||||||
|
and folder.parent_id=#{parentId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<!--查询文件数据集合-->
|
||||||
|
<select id="getFileFolderList" resultType="com.bonus.business.domain.TbFolderFileVo">
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue