This commit is contained in:
parent
7054784661
commit
e99f62f985
|
|
@ -65,7 +65,6 @@ public class SysLoginController
|
|||
String token;
|
||||
String permissions; //权限字符
|
||||
String username= Sm4Utils.decrypt(loginBody.getUsername()); // 解密
|
||||
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
if("2".equals(loginBody.getLoginType())){
|
||||
token = loginService.login(loginBody.getUsername(), loginBody.getCode());
|
||||
|
|
@ -102,6 +101,7 @@ public class SysLoginController
|
|||
tokenService.refreshToken(loginUser);
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
user.setPassword("");
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ pagehelper:
|
|||
# Swagger配置
|
||||
swagger:
|
||||
# 是否开启swagger
|
||||
enabled: true
|
||||
enabled: false
|
||||
# 请求前缀
|
||||
pathMapping: /dev-api
|
||||
|
||||
|
|
@ -140,3 +140,12 @@ minio:
|
|||
accessKey: minio
|
||||
secretKey: bonus@admin123
|
||||
bucketName: product
|
||||
management:
|
||||
server:
|
||||
port: -1 # 禁用独立管理端口(与业务端口共用)
|
||||
endpoints:
|
||||
enabled-by-default: false # 全局禁用所有端点(默认值为 true)
|
||||
endpoint:
|
||||
# 即使全局禁用后,若需单独启用某个端点,可在此配置(当前需求为关闭全部,故无需配置)
|
||||
# 例如:health:
|
||||
# enabled: true # 单独启用健康检查端点(此处不需要)
|
||||
|
|
@ -53,7 +53,7 @@ public class DocumentController extends BaseController {
|
|||
|
||||
|
||||
/**
|
||||
* 新增文件夹
|
||||
* 修改文件夹
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package com.bonus.business.controller;
|
||||
|
||||
import com.bonus.business.domain.DocumentTreeVo;
|
||||
import com.bonus.business.domain.TbDocumentFolder;
|
||||
import com.bonus.business.domain.TbUserFiles;
|
||||
import com.bonus.business.service.DocumentScreenService;
|
||||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 文档中心管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/screen/document/")
|
||||
public class DocumentScreenController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DocumentScreenService service;
|
||||
|
||||
|
||||
/**
|
||||
* 查询文档树
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getDocumentTree")
|
||||
public AjaxResult getDocumentTree(DocumentTreeVo vo) {
|
||||
return service.getDocumentTree(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增文档
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addDocument")
|
||||
public AjaxResult addDocument(TbDocumentFolder vo) {
|
||||
return service.addDocument(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文档
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/importFile")
|
||||
public AjaxResult importFile(@RequestParam(value = "files",required = false) MultipartFile[] file, TbUserFiles vo) {
|
||||
return service.importFile(file,vo);
|
||||
}
|
||||
}
|
||||
|
|
@ -35,6 +35,8 @@ public class DownloadController {
|
|||
|
||||
@Resource
|
||||
private MinioClient minioClient;
|
||||
|
||||
|
||||
/**
|
||||
* 下载文件 根据文件名
|
||||
* @param filePath
|
||||
|
|
|
|||
|
|
@ -1,61 +0,0 @@
|
|||
//package com.bonus.business.controller;
|
||||
//
|
||||
//import org.bytedeco.javacv.FFmpegFrameGrabber;
|
||||
//import org.bytedeco.javacv.FFmpegFrameRecorder;
|
||||
//import org.bytedeco.javacv.Frame;
|
||||
//
|
||||
//public class VideoToMp4Converter {
|
||||
//
|
||||
// /**
|
||||
// * 将视频文件转换为MP4格式
|
||||
// * @param inputPath 输入视频文件路径
|
||||
// * @param outputPath 输出MP4文件路径
|
||||
// * @throws Exception 转换过程中的异常
|
||||
// */
|
||||
// public static void convertToMp4(String inputPath, String outputPath) throws Exception {
|
||||
// // 创建FFmpegFrameGrabber对象,读取输入视频
|
||||
// FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(inputPath);
|
||||
// grabber.start();
|
||||
//
|
||||
// // 创建FFmpegFrameRecorder对象,设置输出视频参数
|
||||
// FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(outputPath,
|
||||
// grabber.getImageWidth(),
|
||||
// grabber.getImageHeight());
|
||||
//
|
||||
// // 设置视频编码为H.264
|
||||
// recorder.setVideoCodec(org.bytedeco.ffmpeg.global.avcodec.AV_CODEC_ID_H264);
|
||||
// // 设置输出格式为MP4
|
||||
// recorder.setFormat("mp4");
|
||||
// // 设置帧率与原视频保持一致
|
||||
// recorder.setFrameRate(grabber.getFrameRate());
|
||||
// // 设置音频通道数
|
||||
// recorder.setAudioChannels(grabber.getAudioChannels());
|
||||
// // 设置音频编码
|
||||
// recorder.setAudioCodec(org.bytedeco.ffmpeg.global.avcodec.AV_CODEC_ID_AAC);
|
||||
//
|
||||
// recorder.start();
|
||||
//
|
||||
// // 循环读取视频帧并进行录制
|
||||
// Frame frame;
|
||||
// while ((frame = grabber.grabFrame()) != null) {
|
||||
// recorder.record(frame);
|
||||
// }
|
||||
//
|
||||
// // 关闭抓取器和录制器
|
||||
// recorder.stop();
|
||||
// grabber.stop();
|
||||
//
|
||||
// System.out.println("视频转换完成!输出文件:" + outputPath);
|
||||
// }
|
||||
//
|
||||
// // 测试方法
|
||||
// public static void main(String[] args) {
|
||||
// try {
|
||||
// String inputVideo = "input_video.flv"; // 输入视频文件,可以是任何格式
|
||||
// String outputMp4 = "output_video.mp4"; // 输出MP4文件
|
||||
// convertToMp4(inputVideo, outputMp4);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.bonus.business.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DocumentTreeVo {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 上级节点id
|
||||
*/
|
||||
private String parentId;
|
||||
/**
|
||||
* 上级节点ids
|
||||
*/
|
||||
private String parentIds;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 是否是管理员
|
||||
*/
|
||||
private String isAdmin;
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private String auth;
|
||||
/**
|
||||
*子集合
|
||||
*/
|
||||
private List<DocumentTreeVo> childTree;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -64,6 +64,10 @@ public class TbDocumentFolder extends BaseEntity
|
|||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private String type;
|
||||
|
||||
private String userId;
|
||||
/**
|
||||
* 权限集合
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.util.Date;
|
|||
|
||||
import com.bonus.common.core.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bonus.common.annotation.Excel;
|
||||
|
|
@ -14,16 +15,17 @@ import com.bonus.common.annotation.Excel;
|
|||
* @author 黑子
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
@Data
|
||||
public class TbUserFiles extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
/** 文件夹id */
|
||||
@Excel(name = "文件夹id")
|
||||
private Long folderId;
|
||||
private String folderId;
|
||||
|
||||
/** 源文件名称 */
|
||||
@Excel(name = "源文件名称")
|
||||
|
|
@ -55,181 +57,49 @@ public class TbUserFiles extends BaseEntity
|
|||
/** 上传时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date uploadTime;
|
||||
private String uploadTime;
|
||||
|
||||
/** 上传人 */
|
||||
@Excel(name = "上传人")
|
||||
private Long uploadUser;
|
||||
private String uploadUser;
|
||||
|
||||
/** 下载次数 */
|
||||
@Excel(name = "下载次数")
|
||||
private Long downTimes;
|
||||
private int downTimes;
|
||||
|
||||
/** 预览次数 */
|
||||
@Excel(name = "预览次数")
|
||||
private Long seeTimes;
|
||||
private int seeTimes;
|
||||
|
||||
/** 文档标签 */
|
||||
@Excel(name = "文档标签")
|
||||
private String labels;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* 桶名称
|
||||
*/
|
||||
private String bucketName;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createUser;
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 文件夹副节点集合
|
||||
*/
|
||||
private String parentIds;
|
||||
/**
|
||||
* 标签数据id
|
||||
*/
|
||||
private String labelIds;
|
||||
/**
|
||||
* 重复的是否跳过 1跳过 2 覆盖
|
||||
*/
|
||||
private String repeatType;
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setFolderId(Long folderId)
|
||||
{
|
||||
this.folderId = folderId;
|
||||
}
|
||||
|
||||
public Long getFolderId()
|
||||
{
|
||||
return folderId;
|
||||
}
|
||||
|
||||
public void setOriginalName(String originalName)
|
||||
{
|
||||
this.originalName = originalName;
|
||||
}
|
||||
|
||||
public String getOriginalName()
|
||||
{
|
||||
return originalName;
|
||||
}
|
||||
|
||||
public void setFileSuffix(String fileSuffix)
|
||||
{
|
||||
this.fileSuffix = fileSuffix;
|
||||
}
|
||||
|
||||
public String getFileSuffix()
|
||||
{
|
||||
return fileSuffix;
|
||||
}
|
||||
|
||||
public void setFileSize(String fileSize)
|
||||
{
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
|
||||
public String getFileSize()
|
||||
{
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath)
|
||||
{
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
public String getFilePath()
|
||||
{
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName)
|
||||
{
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFileName()
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileUrl(String fileUrl)
|
||||
{
|
||||
this.fileUrl = fileUrl;
|
||||
}
|
||||
|
||||
public String getFileUrl()
|
||||
{
|
||||
return fileUrl;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setUploadTime(Date uploadTime)
|
||||
{
|
||||
this.uploadTime = uploadTime;
|
||||
}
|
||||
|
||||
public Date getUploadTime()
|
||||
{
|
||||
return uploadTime;
|
||||
}
|
||||
|
||||
public void setUploadUser(Long uploadUser)
|
||||
{
|
||||
this.uploadUser = uploadUser;
|
||||
}
|
||||
|
||||
public Long getUploadUser()
|
||||
{
|
||||
return uploadUser;
|
||||
}
|
||||
|
||||
public void setDownTimes(Long downTimes)
|
||||
{
|
||||
this.downTimes = downTimes;
|
||||
}
|
||||
|
||||
public Long getDownTimes()
|
||||
{
|
||||
return downTimes;
|
||||
}
|
||||
|
||||
public void setSeeTimes(Long seeTimes)
|
||||
{
|
||||
this.seeTimes = seeTimes;
|
||||
}
|
||||
|
||||
public Long getSeeTimes()
|
||||
{
|
||||
return seeTimes;
|
||||
}
|
||||
|
||||
public void setLabels(String labels)
|
||||
{
|
||||
this.labels = labels;
|
||||
}
|
||||
|
||||
public String getLabels()
|
||||
{
|
||||
return labels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("folderId", getFolderId())
|
||||
.append("originalName", getOriginalName())
|
||||
.append("fileSuffix", getFileSuffix())
|
||||
.append("fileSize", getFileSize())
|
||||
.append("filePath", getFilePath())
|
||||
.append("fileName", getFileName())
|
||||
.append("fileUrl", getFileUrl())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("uploadTime", getUploadTime())
|
||||
.append("uploadUser", getUploadUser())
|
||||
.append("downTimes", getDownTimes())
|
||||
.append("seeTimes", getSeeTimes())
|
||||
.append("labels", getLabels())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package com.bonus.business.domain;
|
||||
|
||||
import com.bonus.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import com.bonus.common.annotation.Excel;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 个人文档标签记录对象 tb_user_lable
|
||||
*
|
||||
* @author 黑子
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class TbUserLabel extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 文件id */
|
||||
private String fileId;
|
||||
|
||||
/** 标签id */
|
||||
private String labelId;
|
||||
|
||||
/** 标签名称 */
|
||||
@Excel(name = "标签名称")
|
||||
private String labelName;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
package com.bonus.business.domain;
|
||||
|
||||
import com.bonus.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bonus.common.annotation.Excel;
|
||||
|
||||
/**
|
||||
* 个人文档标签记录对象 tb_user_lable
|
||||
*
|
||||
* @author 黑子
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
public class TbUserLable extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 文件id */
|
||||
private Long fileId;
|
||||
|
||||
/** 标签id */
|
||||
private Long lableId;
|
||||
|
||||
/** 标签名称 */
|
||||
@Excel(name = "标签名称")
|
||||
private String lableName;
|
||||
|
||||
public void setFileId(Long fileId)
|
||||
{
|
||||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
public Long getFileId()
|
||||
{
|
||||
return fileId;
|
||||
}
|
||||
|
||||
public void setLableId(Long lableId)
|
||||
{
|
||||
this.lableId = lableId;
|
||||
}
|
||||
|
||||
public Long getLableId()
|
||||
{
|
||||
return lableId;
|
||||
}
|
||||
|
||||
public void setLableName(String lableName)
|
||||
{
|
||||
this.lableName = lableName;
|
||||
}
|
||||
|
||||
public String getLableName()
|
||||
{
|
||||
return lableName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("fileId", getFileId())
|
||||
.append("lableId", getLableId())
|
||||
.append("lableName", getLableName())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.bonus.business.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* BuildTree 构建树形结构
|
||||
*/
|
||||
public class TreeBuild {
|
||||
|
||||
// 保存参与构建树形的所有数据(通常数据库查询结果)
|
||||
public List<DocumentTreeVo> nodeList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
* @param nodeList 将数据集合赋值给nodeList,即所有数据作为所有节点。
|
||||
*/
|
||||
public TreeBuild(List<DocumentTreeVo> nodeList){
|
||||
this.nodeList = nodeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取需构建的所有根节点(顶级节点) "0"
|
||||
* @return 所有根节点List集合
|
||||
*/
|
||||
public List<DocumentTreeVo> getRootNode(String parentId){
|
||||
// 保存所有根节点(所有根节点的数据)
|
||||
List<DocumentTreeVo> rootNodeList = new ArrayList<>();
|
||||
// treeNode:查询出的每一条数据(节点)
|
||||
for (DocumentTreeVo treeNode : nodeList){
|
||||
// 判断当前节点是否为根节点,此处注意:若parentId类型是String,则要采用equals()方法判断。
|
||||
if (parentId.equals(treeNode.getParentId()) ) {
|
||||
// 是,添加
|
||||
rootNodeList.add(treeNode);
|
||||
}
|
||||
}
|
||||
return rootNodeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据每一个顶级节点(根节点)进行构建树形结构
|
||||
* @return 构建整棵树
|
||||
*/
|
||||
public List<DocumentTreeVo> buildTree(String parentId){
|
||||
// treeNodes:保存一个顶级节点所构建出来的完整树形
|
||||
List<DocumentTreeVo> treeNodes = new ArrayList<DocumentTreeVo>();
|
||||
// getRootNode():获取所有的根节点
|
||||
for (DocumentTreeVo treeRootNode : getRootNode(parentId)) {
|
||||
// 将顶级节点进行构建子树
|
||||
treeRootNode = buildChildTree(treeRootNode);
|
||||
// 完成一个顶级节点所构建的树形,增加进来
|
||||
treeNodes.add(treeRootNode);
|
||||
}
|
||||
return treeNodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归-----构建子树形结构
|
||||
* @param pNode 根节点(顶级节点)
|
||||
* @return 整棵树
|
||||
*/
|
||||
public DocumentTreeVo buildChildTree(DocumentTreeVo pNode){
|
||||
List<DocumentTreeVo> childTree = new ArrayList<DocumentTreeVo>();
|
||||
// nodeList:所有节点集合(所有数据)
|
||||
for (DocumentTreeVo treeNode : nodeList) {
|
||||
// 判断当前节点的父节点ID是否等于根节点的ID,即当前节点为其下的子节点
|
||||
if (treeNode.getParentId().equals(pNode.getId())) {
|
||||
// 再递归进行判断当前节点的情况,调用自身方法
|
||||
childTree.add(buildChildTree(treeNode));
|
||||
}
|
||||
}
|
||||
// for循环结束,即节点下没有任何节点,树形构建结束,设置树结果
|
||||
pNode.setChildTree(childTree);
|
||||
return pNode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.bonus.business.mapper;
|
||||
|
||||
import com.bonus.business.domain.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
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);
|
||||
|
||||
void deleteCompanyFile(@Param("list") List<TbUserFiles> delete);
|
||||
|
||||
void deleteUserFile(@Param("list")List<TbUserFiles> delete);
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.bonus.business.service;
|
||||
|
||||
import com.bonus.business.domain.DocumentTreeVo;
|
||||
import com.bonus.business.domain.TbDocumentFolder;
|
||||
import com.bonus.business.domain.TbUserFiles;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface DocumentScreenService {
|
||||
/**
|
||||
* 查询 文档中心 树
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getDocumentTree(DocumentTreeVo vo);
|
||||
|
||||
/**
|
||||
* 新增文档
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult addDocument(TbDocumentFolder vo);
|
||||
|
||||
/**
|
||||
* 文件导入
|
||||
* @param file
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult importFile(MultipartFile[] file, TbUserFiles vo);
|
||||
}
|
||||
|
|
@ -0,0 +1,387 @@
|
|||
package com.bonus.business.service.impl;
|
||||
|
||||
import cn.hutool.db.handler.StringHandler;
|
||||
import com.bonus.business.domain.*;
|
||||
import com.bonus.business.mapper.DocumentScreenMapper;
|
||||
import com.bonus.business.service.DocumentScreenService;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.utils.DateUtils;
|
||||
import com.bonus.common.utils.SecurityUtils;
|
||||
import com.bonus.common.utils.StringUtils;
|
||||
import com.bonus.file.service.FileUploadService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DocumentScreenImpl implements DocumentScreenService {
|
||||
|
||||
@Autowired
|
||||
private DocumentScreenMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private FileUploadService service;
|
||||
|
||||
public String day= DateUtils.getCurrentDay();
|
||||
|
||||
public String month=DateUtils.getCurrentMonth();
|
||||
|
||||
public String year=DateUtils.getCurrentYear();
|
||||
/**
|
||||
* 查询文档中心树
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getDocumentTree(DocumentTreeVo vo) {
|
||||
List<DocumentTreeVo> list=new ArrayList<>();
|
||||
try{
|
||||
String userId= SecurityUtils.getUserId().toString();
|
||||
vo.setUserId(userId);
|
||||
// 是否是管理员
|
||||
boolean administrator=SecurityUtils.hasRole("administrator");
|
||||
boolean admin=SecurityUtils.hasRole("admin");
|
||||
//管理员
|
||||
if(administrator || admin){
|
||||
vo.setIsAdmin("1");
|
||||
}else{
|
||||
//查询共享文档
|
||||
//个人需要查询
|
||||
DocumentTreeVo shareDocument=getShareDocument(vo);
|
||||
list.add(shareDocument);
|
||||
}
|
||||
|
||||
//查询我的文档
|
||||
DocumentTreeVo myDocument=getMyChildList(vo);
|
||||
list.add(myDocument);
|
||||
//查询公共文档数据集合
|
||||
DocumentTreeVo companyList=getCompanyChildList(vo);
|
||||
list.add(companyList);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建文件夹
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult addDocument(TbDocumentFolder vo) {
|
||||
try{
|
||||
String userId=SecurityUtils.getUserId().toString();
|
||||
vo.setCreateUser(userId);
|
||||
vo.setUpdateUser(userId);
|
||||
vo.setId(StringUtils.randomUUID());
|
||||
//类型
|
||||
String type=vo.getType();
|
||||
//文档库
|
||||
vo.setParentIds(vo.getParentIds()+","+vo.getParentId()+",");
|
||||
if("1".equals(type)){
|
||||
Integer num= mapper.addDocumentCompany(vo);
|
||||
if(num!=null && num>0){
|
||||
TbDocumentFolderAuth auth=new TbDocumentFolderAuth();
|
||||
auth.setFolderId(vo.getId());
|
||||
auth.setUserId(userId);
|
||||
auth.setFolderType("1");
|
||||
auth.setFolderSource("0");
|
||||
auth.setFolderAuth("4");
|
||||
auth.setIsShare("0");
|
||||
//新增数据
|
||||
mapper.addDocumentAuth(auth);
|
||||
}else{
|
||||
return AjaxResult.error("添加失败");
|
||||
}
|
||||
}else{
|
||||
mapper.addDocumentUser(vo);
|
||||
}
|
||||
return AjaxResult.success("添加成功");
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.error("添加失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入文件
|
||||
* @param file
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult importFile(MultipartFile[] file, TbUserFiles vo) {
|
||||
try{
|
||||
if(file==null ||file.length==0){
|
||||
return AjaxResult.error("请上传附件");
|
||||
}
|
||||
if(StringUtils.isEmpty(vo.getFolderId())){
|
||||
return AjaxResult.error("选择文件夹");
|
||||
}
|
||||
if(StringUtils.isEmpty(vo.getType())){
|
||||
return AjaxResult.error("文件夹类型不能为空");
|
||||
}
|
||||
|
||||
vo.setUploadUser(SecurityUtils.getUserId().toString());
|
||||
vo.setCreateUser(SecurityUtils.getUserId().toString());
|
||||
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<>();
|
||||
|
||||
//覆盖 覆盖会删除之前的数据
|
||||
if("1".equals(repeatType)){
|
||||
//跳过
|
||||
for (MultipartFile multipartFile : file) {
|
||||
String originFileName = multipartFile.getOriginalFilename();
|
||||
boolean iscz = true;
|
||||
for (TbUserFiles tbUserFiles : list) {
|
||||
assert originFileName != null;
|
||||
if (originFileName.equals(tbUserFiles.getOriginalName())) {
|
||||
iscz = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (iscz) {
|
||||
fileList.add(multipartFile);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//覆盖
|
||||
for (MultipartFile multipartFile : file) {
|
||||
String originFileName = multipartFile.getOriginalFilename();
|
||||
for (TbUserFiles tbUserFiles : list) {
|
||||
fileList.add(multipartFile);
|
||||
assert originFileName != null;
|
||||
if (originFileName.equals(tbUserFiles.getOriginalName())) {
|
||||
delete.add(tbUserFiles);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (TbUserFiles tbUserFiles : delete) {
|
||||
//删除文件
|
||||
service.delFile(tbUserFiles.getFilePath());
|
||||
}
|
||||
//个人及公司
|
||||
if("1".equals(vo.getType())){
|
||||
mapper.deleteCompanyFile(delete);
|
||||
}else{
|
||||
mapper.deleteUserFile(delete);
|
||||
}
|
||||
}
|
||||
|
||||
// 文件上传
|
||||
AjaxResult result=uploadFile(fileList,vo);
|
||||
if(result.isError()){
|
||||
return result;
|
||||
}
|
||||
return AjaxResult.success("上传成功");
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.error("文件上传失败");
|
||||
}
|
||||
/**
|
||||
* 上传附件
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult uploadFile(List<MultipartFile> multipartFileList,TbUserFiles files){
|
||||
String type=files.getType();
|
||||
String filePath ;
|
||||
if("1".equals(type)){
|
||||
filePath = "document/company/"+files.getUploadUser() + "/" +
|
||||
year + "/" + month + "/" + day + "/" ;
|
||||
}else{
|
||||
filePath = "document/user/" + files.getUploadUser()+"/" +
|
||||
year + "/" + month + "/" + day + "/" ;
|
||||
}
|
||||
String[] ids=files.getLabelIds().split(",");
|
||||
String[] name= files.getLabels().split(",");
|
||||
List<TbUserLabel> list=new ArrayList<TbUserLabel>();
|
||||
TbUserLabel vo=new TbUserLabel();
|
||||
for (int i = 0; i <ids.length ; i++) {
|
||||
vo.setFileId(files.getFolderId());
|
||||
vo.setLabelId(ids[i]);
|
||||
vo.setLabelName(name[i]);
|
||||
list.add(vo);
|
||||
}
|
||||
for (MultipartFile file: multipartFileList) {
|
||||
String uuid = StringUtils.randomUUID();
|
||||
String originFileName = file.getOriginalFilename();
|
||||
String suffix=StringUtils.substringAfterLast(originFileName, ".");
|
||||
//产品 封面
|
||||
filePath =filePath+uuid + "." + suffix;
|
||||
String path=service.uploadFile(file, filePath);
|
||||
if(path==null){
|
||||
return AjaxResult.error("文件上传失败");
|
||||
}
|
||||
files.setDelFlag("0");
|
||||
files.setDownTimes(0);
|
||||
files.setSeeTimes(0);
|
||||
files.setFileName(uuid+"." + suffix);
|
||||
files.setFilePath(filePath);
|
||||
files.setBucketName(path);
|
||||
files.setOriginalName(originFileName);
|
||||
files.setFileSuffix(suffix);
|
||||
// 获取文件大小(字节)
|
||||
long sizeInBytes = file.getSize();
|
||||
// 转换为可读格式(如KB/MB)
|
||||
String humanReadableSize = convertToHumanReadable(sizeInBytes);
|
||||
files.setFileSize(humanReadableSize);
|
||||
if("1".equals(type)){
|
||||
//公司级别
|
||||
mapper.insertCompanyFile(files);
|
||||
mapper.addFileLabel(list,files.getId());
|
||||
}else{
|
||||
// 个人级别
|
||||
mapper.insertUserFile(files);
|
||||
mapper.addUserFileLabel(list,files.getId());
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
// 辅助方法:字节转可读格式
|
||||
private String convertToHumanReadable(long bytes) {
|
||||
if (bytes < 1024) return bytes + " B";
|
||||
else if (bytes < 1024 * 1024) return String.format("%.2f KB", bytes / 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.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.setName("我共享的");
|
||||
vo1.setType("31");
|
||||
//我共享出去的文档查询
|
||||
List<DocumentTreeVo> childerList=getMyShareList(vo,allShareList);
|
||||
vo1.setChildTree(childerList);
|
||||
DocumentTreeVo vo2=new DocumentTreeVo();
|
||||
vo2.setId("otherShare");
|
||||
vo2.setParentId("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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -62,10 +62,11 @@ public class DocumentServiceImpl implements DocumentService {
|
|||
}
|
||||
//默认层级
|
||||
vo.setLevel(1);
|
||||
vo.setParentId("0");
|
||||
vo.setParentIds("0,");
|
||||
vo.setParentId("companyDocument");
|
||||
vo.setParentIds("companyDocument,");
|
||||
vo.setCreateUser(SecurityUtils.getUserId().toString());
|
||||
vo.setUpdateUser(SecurityUtils.getUserId().toString());
|
||||
vo.setId(StringUtils.randomUUID());
|
||||
int num =mapper.addDocument(vo);
|
||||
if(num<1){
|
||||
return AjaxResult.error("文件夹创建失败");
|
||||
|
|
@ -130,7 +131,6 @@ public class DocumentServiceImpl implements DocumentService {
|
|||
|
||||
public AjaxResult getAjaxResult(TbDocumentFolder vo, String userId) {
|
||||
List<String> ids= Arrays.asList(userId.split(","));
|
||||
|
||||
int addIds= mapper.addDocumentAuth(ids,vo.getId());
|
||||
if(addIds!=ids.size()){
|
||||
return AjaxResult.error("文件夹授权失败");
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class ProductServiceImpl implements ProductService {
|
|||
public FileServiceUtils fileServiceUtils;
|
||||
|
||||
|
||||
public String day= DateUtils.getCurrentYear();
|
||||
public String day= DateUtils.getCurrentDay();
|
||||
|
||||
public String month=DateUtils.getCurrentMonth();
|
||||
|
||||
|
|
|
|||
|
|
@ -5,23 +5,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<mapper namespace="com.bonus.business.mapper.DocumentMapper">
|
||||
<!--新增文档内容-->
|
||||
<insert id="addDocument" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_document_folder(
|
||||
insert into tb_document_folder(id,
|
||||
level,folder_name,parent_id, create_time, create_user, update_time,update_user, file_type, del_flag,parent_ids
|
||||
)values (#{level},#{folderName},#{parentId},now(),#{createUser},now(),#{updateUser},#{fileType},0,#{parentIds})
|
||||
)values (#{id},#{level},#{folderName},#{parentId},now(),#{createUser},now(),#{updateUser},#{fileType},0,#{parentIds})
|
||||
</insert>
|
||||
<!--新增菜单权限-->
|
||||
<insert id="addDocumentAuth">
|
||||
insert into tb_document_folder(folder_id, user_id,folder_type, folder_source, folder_auth, is_share) value
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{id},#{item},0,1,0,1,
|
||||
#{id},#{item},0,4,2,0
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateDocument">
|
||||
update tb_document_folder set
|
||||
folder_name=#{folderName},update_time=#{updateTime} ,update_user=#{updateUser}
|
||||
where id=#{id}
|
||||
where
|
||||
|
||||
</update>
|
||||
<delete id="deleteAuth">
|
||||
delete from tb_document_folder_auth WHERE folder_id=#{id}
|
||||
|
|
@ -43,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
su.user_name createUser
|
||||
from tb_document_folder tdf
|
||||
left join sys_user su on su.user_id=tdf.create_user
|
||||
where tdf.parent_id=0 and tdf.del_flag=0
|
||||
where tdf.parent_id='companyDocument' and tdf.del_flag=0
|
||||
<if test="folderName!=null and folderName!=''">
|
||||
and tdf.folder_name like concat('%',#{folderName},'%')
|
||||
</if>
|
||||
|
|
@ -69,7 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
</select>
|
||||
<select id="getChildNum" resultType="java.lang.Integer">
|
||||
select
|
||||
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
<?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="com.bonus.business.mapper.DocumentScreenMapper">
|
||||
<insert id="addDocumentCompany">
|
||||
insert into tb_document_folder(id,
|
||||
level,folder_name,parent_id, create_time, create_user, update_time,update_user, file_type, del_flag,parent_ids
|
||||
)values (#{id},#{level},#{folderName},#{parentId},now(),#{createUser},now(),#{updateUser},#{fileType},0,#{parentIds})
|
||||
|
||||
</insert>
|
||||
<insert id="addDocumentAuth">
|
||||
insert into tb_document_folder_auth(
|
||||
folder_id, user_id,folder_type,folder_source,folder_auth,is_share
|
||||
)values (#{folderId},#{userId},#{folderType},#{folderSource},#{folderAuth},#{isShare} )
|
||||
|
||||
</insert>
|
||||
<insert id="addDocumentUser" keyProperty="id" useGeneratedKeys="true" >
|
||||
insert into tb_user_folder(
|
||||
id,parent_id, level, folder_name,
|
||||
create_user, create_time, is_share, del_flag,update_time,
|
||||
update_user, parent_ids,
|
||||
)values (#{id},#{parentId},#{level},#{folderName},#{userId},now(),0,0,now(),#{userId},#{parentIds})
|
||||
</insert>
|
||||
<insert id="insertUserFile" keyProperty="id" useGeneratedKeys="true" >
|
||||
INSERT INTO tb_user_files(
|
||||
folder_id,original_name,file_suffix,file_size,
|
||||
file_path,file_name,del_flag,upload_time,upload_user,
|
||||
down_times,see_times,labels,parent_ids
|
||||
)values (#{folderId},#{originalName},#{fileSuffix},#{fileSize},#{filePath},#{fileName},
|
||||
#{delFlag},now(),#{uploadUser},#{downTimes},#{seeTimes},#{labels},#{parentIds})
|
||||
|
||||
</insert>
|
||||
<insert id="insertCompanyFile">
|
||||
insert into tb_document_files(
|
||||
folder_id, folder_ids, original_name,
|
||||
file_suffix, file_size, file_path, file_name, upload_time,
|
||||
upload_user, down_times, see_times, labels, del_flag
|
||||
)values (#{folderId},#{parentIds},#{originalName},#{fileSuffix},
|
||||
#{fileSize},#{filePath},#{fileName},now(),#{uploadUser},#{downTimes},#{seeTimes},#{labels},#{delFlag})
|
||||
</insert>
|
||||
<!--添加文件-->
|
||||
<insert id="addFileLabel">
|
||||
insert into tb_document_files_label( file_id, label_id, label_name)values (
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
#{id},#{item.labelId},#{item.labelName}
|
||||
</foreach>
|
||||
)
|
||||
</insert>
|
||||
<insert id="addUserFileLabel">
|
||||
insert into tb_user_label(file_id, label_id, label_name )values (
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
#{id},#{item.labelId},#{item.labelName}
|
||||
</foreach>
|
||||
)
|
||||
</insert>
|
||||
<update id="deleteCompanyFile">
|
||||
update tb_document_files set del_flag=1 where id IN
|
||||
(
|
||||
<foreach collection="list" separator="," item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
<update id="deleteUserFile">
|
||||
update tb_user_files set del_flag=1 where id IN
|
||||
(
|
||||
<foreach collection="list" separator="," item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
<select id="getCompanyChildList" resultType="com.bonus.business.domain.DocumentTreeVo">
|
||||
select fdf.id id, fdf.parent_id parentId, fdf.parent_ids parentIds, fdf.folder_name name,1 type
|
||||
from tb_document_folder fdf
|
||||
<if test='isAdmin!=1 or isAdmin!="1"'>
|
||||
left join tb_document_folder_auth fdfa on fdfa.folder_id=fdf.id
|
||||
</if>
|
||||
<where >
|
||||
tdfa.folder_source !='1' --去除他人分享的
|
||||
<if test='isAdmin!=1 or isAdmin!="1"'>
|
||||
and fdfa.user_id=#{userId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<!--查询自己的文档数据-->
|
||||
<select id="getMyChildList" resultType="com.bonus.business.domain.DocumentTreeVo">
|
||||
select fuf.id,fuf.parent_id parentId,fuf.folder_name name,2 type
|
||||
from tb_user_folder fuf
|
||||
where create_user=#{userId}
|
||||
</select>
|
||||
<select id="getOtherShare" resultType="com.bonus.business.domain.DocumentTreeVo">
|
||||
select tdf.id ,tdf.folder_name name,'otherShare' parentId,tdfa.is_share,1 type,tdfa.folder_auth auth
|
||||
from tb_document_folder tdf
|
||||
left join tb_document_folder_auth tdfa on tdf.id=tdfa.folder_id
|
||||
where tdfa.user_id=#{userId}
|
||||
and tdfa.folder_source=1 -- 数据源是他人分享而来的
|
||||
union ALL
|
||||
select tuf.id,tuf.folder_name,'otherShare' parentId,tuf.is_share,2 type,tfs.share_type auth
|
||||
from tb_user_folder tuf
|
||||
left join tb_files_share tfs on tfs.folder_id=tuf.id
|
||||
where tfs.user_id=#{userId} -- 数据源是他人分享而来的
|
||||
</select>
|
||||
|
||||
<select id="getMyShareList" resultType="com.bonus.business.domain.DocumentTreeVo">
|
||||
select tdf.id ,tdf.folder_name name,'myShare' parentId,tdfa.is_share,1 type,
|
||||
from tb_document_folder tdf
|
||||
left join tb_document_folder_auth tdfa on tdf.id=tdfa.folder_id
|
||||
where tdfa.is_share=1 -- 查询分项出去的
|
||||
and tdfa.user_id=#{userId}
|
||||
union ALL
|
||||
select tuf.id,tuf.folder_name,'myShare' parentId,tuf.is_share,2 type
|
||||
from tb_user_folder tuf
|
||||
where tuf.is_share=1
|
||||
and tuf.create_user=#{userId} -- 查询分项出去的
|
||||
</select>
|
||||
<select id="getDocumentList" resultType="com.bonus.business.domain.DocumentTreeVo">
|
||||
select tdf.id ,tdf.folder_name name,parent_id parentId,1 type
|
||||
from tb_document_folder tdf
|
||||
union ALL
|
||||
select tuf.id,tuf.folder_name,parent_id parentId,2 type
|
||||
from tb_user_folder tuf
|
||||
</select>
|
||||
<!--查询存在为文件-->
|
||||
<select id="getCompanyFileList" resultType="com.bonus.business.domain.TbUserFiles">
|
||||
SELECT id,original_name originalName,file_path filePath
|
||||
FROM tb_document_files
|
||||
where folder_id=#{folderId} and del_flag=0
|
||||
</select>
|
||||
<select id="getUserFileList" resultType="com.bonus.business.domain.TbUserFiles">
|
||||
SELECT id,original_name originalName,file_path filePath
|
||||
FROM tb_user_files
|
||||
where folder_id=#{folderId} and del_flag=0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -49,12 +49,6 @@
|
|||
<version>8.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- pagehelper 分页插件 -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 自定义验证注解 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
@ -72,7 +66,12 @@
|
|||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- pagehelper 分页插件 -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>${pagehelper.boot.version}</version>
|
||||
</dependency>
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
|
|
|
|||
|
|
@ -41,8 +41,10 @@ public class TableSupport
|
|||
public static PageDomain getPageDomain()
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
|
||||
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
|
||||
int pageNum=Integer.parseInt(ServletUtils.getParameter(PAGE_NUM));
|
||||
int pageSize=Integer.parseInt(ServletUtils.getParameter(PAGE_SIZE));
|
||||
pageDomain.setPageNum(Convert.toInt(pageNum, 1));
|
||||
pageDomain.setPageSize(Convert.toInt(pageSize, 10));
|
||||
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
|
||||
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
|
||||
pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class Sm4Utils {
|
|||
|
||||
// 测试方法,演示加密和解密过程
|
||||
public static void main(String[] args) {
|
||||
String plainText = "18226653236";
|
||||
String plainText = "15755022653";
|
||||
System.out.println("原文: " + plainText);
|
||||
|
||||
// 加密明文
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.bonus.common.utils;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
@ -79,7 +78,6 @@ public class PhoneUtils {
|
|||
; map.put("code","200");
|
||||
map.put("msg","发送成功");
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ public class MinioUtil {
|
|||
} else {
|
||||
uploadLargeFile(folderPath, file);
|
||||
}
|
||||
|
||||
return SysFile.builder()
|
||||
.name(file.getOriginalFilename())
|
||||
.url(folderPath).build();
|
||||
|
|
@ -130,9 +129,7 @@ public class MinioUtil {
|
|||
List<String> partNames = new ArrayList<>();
|
||||
// 创建线程池
|
||||
ExecutorService executor = Executors.newFixedThreadPool(5);
|
||||
|
||||
List<CompletableFuture<Void>> futures = new ArrayList<>();
|
||||
|
||||
// 上传每个分片
|
||||
for (int i = 0; i < partCount; i++) {
|
||||
long offset = i * PART_SIZE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue