修改bug
This commit is contained in:
parent
a1c05d44d3
commit
f939eba40a
|
|
@ -91,6 +91,12 @@ public class DocumentScreenController extends BaseController {
|
|||
return service.addDocument(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/addLookNum")
|
||||
public AjaxResult addLookNum(@RequestBody TbFolderFileVo vo) {
|
||||
return service.addLookNum(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增文档
|
||||
* @param vo
|
||||
|
|
|
|||
|
|
@ -190,4 +190,11 @@ public interface DocumentScreenMapper {
|
|||
* @return
|
||||
*/
|
||||
int cancelShare(TbFolderFileVo vo);
|
||||
|
||||
/**
|
||||
* 查询是否是上级节点
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
Integer getPublicFolderNum(TbFolderFileVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,4 +91,11 @@ public interface DocumentScreenService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult cancelShare(TbFolderFileVo vo);
|
||||
|
||||
/**
|
||||
* 增加文件查看次数
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult addLookNum(TbFolderFileVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
private MinioUtil minioUtil;
|
||||
|
||||
|
||||
@Autowired
|
||||
public FileServiceUtils fileServiceUtils;
|
||||
|
||||
|
||||
protected String dataIds=",companyDocument,myShare,otherShare,share,";
|
||||
|
||||
protected String day= DateUtils.getCurrentDay();
|
||||
|
|
@ -126,6 +130,8 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
return AjaxResult.error("取消失败");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新建文件夹
|
||||
* @param vo
|
||||
|
|
@ -300,8 +306,14 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
List<String> ids=Arrays.asList(vo.getLabelIds().split(","));
|
||||
vo.setLabelIdList(ids);
|
||||
}
|
||||
|
||||
List<TbFolderFileVo> list=mapper.getFileFolderList(vo);
|
||||
for (TbFolderFileVo tbFolderFileVo : list) {
|
||||
if("1".equals(tbFolderFileVo.getFileType()) && StringUtils.isNotEmpty(tbFolderFileVo.getFilePath())){
|
||||
String path = fileServiceUtils.getFileUrl(tbFolderFileVo.getFilePath(),null);
|
||||
tbFolderFileVo.setFilePath(path);
|
||||
}
|
||||
|
||||
}
|
||||
//进行数据查看进行插入数据
|
||||
Integer num=mapper.getLookNum(vo);
|
||||
if (num==null){
|
||||
|
|
@ -316,7 +328,27 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@Override
|
||||
public AjaxResult addLookNum(TbFolderFileVo vo) {
|
||||
try{
|
||||
if(vo.getId().split("_").length==3){
|
||||
vo.setId(vo.getId().split("_")[2]);
|
||||
}
|
||||
vo.setParentId(vo.getId());
|
||||
vo.setType("2");
|
||||
Integer num=mapper.getLookNum(vo);
|
||||
if (num==null){
|
||||
num=0;
|
||||
}
|
||||
num++;
|
||||
vo.setReadNum(num+"");
|
||||
mapper.updateLookNum(vo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
/**
|
||||
* 移动文件/文件夹
|
||||
* @param vo
|
||||
|
|
@ -352,22 +384,25 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
if("companyDocument".equals(vo.getNewParentId()) || "myShare".equals(vo.getNewParentId()) || "otherShare".equals(vo.getNewParentId())){
|
||||
return AjaxResult.error("目标文件夹没有权限");
|
||||
}
|
||||
TbFolderFileVo data=mapper.getDocumentRealData(vo);
|
||||
if(data==null || !"1".equals(data.getDataType())){
|
||||
return AjaxResult.error("共享及分享的文件夹不允许移动");
|
||||
}
|
||||
|
||||
//验证目标文件夹名称
|
||||
String name=mapper.getNowName(vo);
|
||||
Integer publicFolderNum= mapper.getPublicFolderNum(vo);
|
||||
if(publicFolderNum==null){
|
||||
publicFolderNum=0;
|
||||
}
|
||||
//如果是初始化节点
|
||||
if ("0".equals(vo.getParentId())) {
|
||||
TbFolderFileVo data=mapper.getDocumentRealData(vo);
|
||||
TbDocumentFolder documentFolder = getTbDocumentFolder(vo, data);
|
||||
//目标不是文档中心
|
||||
if("userDocument".equals(vo.getNewParentId())) {
|
||||
mapper.deleteDocumentReal(data);
|
||||
|
||||
int num=mapper.getToName(name,vo.getPublicFolderId());
|
||||
if(num>0){
|
||||
return AjaxResult.error("目标文件夹名称已存在");
|
||||
}
|
||||
mapper.deleteDocumentReal(data);
|
||||
mapper.addDocumentRealUser(documentFolder);
|
||||
}else{
|
||||
|
||||
|
|
@ -378,11 +413,12 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
if(isChiild){
|
||||
return AjaxResult.error("目标文件夹不能是自己子文件夹");
|
||||
}
|
||||
mapper.deleteDocumentReal(data);
|
||||
|
||||
int num=mapper.getToName2(name,vo.getNewParentId());
|
||||
if(num>0){
|
||||
return AjaxResult.error("目标文件夹名称已存在");
|
||||
}
|
||||
mapper.deleteDocumentReal(data);
|
||||
if("3".equals(vo.getToType())){
|
||||
vo.setToType("3");
|
||||
}else{
|
||||
|
|
@ -392,15 +428,12 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
}
|
||||
}else{
|
||||
//非初始化节点 查询全部子数据
|
||||
|
||||
|
||||
|
||||
if("3".equals(vo.getToType())){
|
||||
vo.setToType("3");
|
||||
}else{
|
||||
vo.setToType(null);
|
||||
}
|
||||
if("userDocument".equals(vo.getNewParentId())) {
|
||||
if("userDocument".equals(vo.getNewParentId()) || publicFolderNum>0) {
|
||||
TbDocumentFolder documentFolder =new TbDocumentFolder();
|
||||
documentFolder.setPublicFolderId(vo.getNewParentId());
|
||||
documentFolder.setAuthType("1");
|
||||
|
|
@ -466,6 +499,9 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
public AjaxResult delete(TbFolderFileVo vo) {
|
||||
|
||||
try{
|
||||
if(dataIds.contains(vo.getParentId())){
|
||||
return AjaxResult.error("当前文件夹不允许删除");
|
||||
}
|
||||
//父节点更新
|
||||
String userId=SecurityUtils.getUserId().toString();
|
||||
vo.setUserId(userId);
|
||||
|
|
@ -484,9 +520,9 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
//如果是初始化节点
|
||||
if ("0".equals(vo.getParentId())) {
|
||||
TbFolderFileVo data=mapper.getDocumentRealData(vo);
|
||||
if(!"1".equals(data.getDataType())){
|
||||
return AjaxResult.success("共享及分享的文件夹不允许删除");
|
||||
}
|
||||
// if(!"1".equals(data.getDataType())){
|
||||
// return AjaxResult.success("共享及分享的文件夹不允许删除");
|
||||
// }
|
||||
int num= mapper.deleteDocumentReal(data);
|
||||
|
||||
}else{
|
||||
|
|
@ -569,6 +605,7 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
if(dataIds.contains(vo.getId())){
|
||||
return AjaxResult.error("当前文件夹不允许重命名");
|
||||
}
|
||||
|
||||
//父节点更新
|
||||
String userId=SecurityUtils.getUserId().toString();
|
||||
vo.setUserId(userId);
|
||||
|
|
@ -661,8 +698,8 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
}
|
||||
//全部数据集合--treeList 需要创建文件夹及文件
|
||||
long timestamp1 = System.currentTimeMillis();
|
||||
String dir="F:\\download\\"+timestamp1;
|
||||
String downloadPath="F:\\downZip\\"+timestamp1+"\\";
|
||||
String dir=getDownloadPath()+timestamp1;
|
||||
String downloadPath=getZipPath()+timestamp1+"\\";
|
||||
boolean success =createDirectories(downloadPath);
|
||||
//创建文件夹
|
||||
downloadFiles(treeList1,dir);
|
||||
|
|
@ -682,8 +719,8 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
}
|
||||
//全部数据集合--treeList 需要创建文件夹及文件
|
||||
long timestamp1 = System.currentTimeMillis();
|
||||
String dir="F:\\download\\"+timestamp1;
|
||||
String downloadPath="F:\\downZip\\"+timestamp1+"\\";
|
||||
String dir=getDownloadPath()+timestamp1;
|
||||
String downloadPath=getZipPath()+timestamp1+"\\";
|
||||
boolean success =createDirectories(downloadPath);
|
||||
//创建文件夹
|
||||
downloadFiles(treeList,dir);
|
||||
|
|
@ -698,6 +735,30 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
}
|
||||
}
|
||||
|
||||
public static String getDownloadPath(){
|
||||
String osName = System.getProperty("os.name").toLowerCase();
|
||||
if (osName.contains("win")) {
|
||||
return "F:\\download\\";
|
||||
} else if (osName.contains("nix") || osName.contains("nux") || osName.contains("aix")) {
|
||||
return "/data/local/tmp/";
|
||||
} else {
|
||||
return "/data/local/tmp/";
|
||||
}
|
||||
|
||||
}
|
||||
public static String getZipPath(){
|
||||
String osName = System.getProperty("os.name").toLowerCase();
|
||||
if (osName.contains("win")) {
|
||||
return "F:\\downZip\\";
|
||||
} else if (osName.contains("nix") || osName.contains("nux") || osName.contains("aix")) {
|
||||
return "/data/local/tmp/";
|
||||
} else {
|
||||
return "/data/local/tmp/";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public HttpServletResponse download(String path, HttpServletResponse response) {
|
||||
try {
|
||||
|
|
@ -792,20 +853,8 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
String path = "F:\\HAHAH\\DD\\PPP";
|
||||
Path dir = Paths.get(path);
|
||||
try {
|
||||
boolean success = Files.createDirectories(dir).isAbsolute();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
String sourceDirPath = "F:\\新建文件夹"; // 指定源目录路径
|
||||
String zipFilePath = "F:\\files\\test.zip"; // 指定输出ZIP文件的路径
|
||||
zipDirectory(sourceDirPath, zipFilePath);
|
||||
System.out.println("Directory zipped successfully.");
|
||||
}
|
||||
|
||||
public static void deleteDirectoryContents(String path) {
|
||||
try {
|
||||
Path directory = Paths.get(path);
|
||||
|
|
@ -1015,12 +1064,13 @@ public class DocumentScreenImpl implements DocumentScreenService {
|
|||
//
|
||||
String[] ids=files.getLabelIds().split(",");
|
||||
String[] name= files.getLabels().split(",");
|
||||
TbUserLabel vo=new TbUserLabel();
|
||||
|
||||
for (MultipartFile file: multipartFileList) {
|
||||
List<TbUserLabel> list=new ArrayList<>();
|
||||
String documentId=StringUtils.randomUUID();
|
||||
documentFolder.setId(documentId);
|
||||
for (int i = 0; i <ids.length ; i++) {
|
||||
TbUserLabel vo=new TbUserLabel();
|
||||
vo.setFileId(documentId);
|
||||
vo.setLabelId(ids[i]);
|
||||
vo.setLabelName(name[i]);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,6 @@
|
|||
<select id="getLabelNumById" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from tb_document_files_label
|
||||
where label_id = #{id}
|
||||
where lable_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -163,7 +163,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getFileFolderList" resultType="com.bonus.business.domain.TbFolderFileVo">
|
||||
<if test='type=="1" or type==1 '>
|
||||
select tpf.id,tpf.folder_name name ,tpf.parent_id parentId,tpf.parent_ids,1 type ,tpf.down_times downNum,0 fileType, '文件夹' fileSuffix,
|
||||
'' labName, tpf.id publicFolderId,#{auth} auth,
|
||||
'' labName, tpf.id publicFolderId,#{auth} auth,'' filePath,
|
||||
tpf.see_times readNum,tpf.create_user,tpf.create_time createTime,tpf.update_time updateTime,su.user_name createUser
|
||||
from tb_public_folder tpf
|
||||
<if test='isAdmin!="1" '>
|
||||
|
|
@ -178,9 +178,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and tpf.id='0000000';
|
||||
</if>
|
||||
union ALL
|
||||
SELECT
|
||||
SELECT distinct
|
||||
tudf.id, tudf.folder_name,tudf.parent_id,tudf.parent_ids,IFNULL(tudf.type,2) type ,tudf.down_times,tudf.file_type fileType,tudf.file_suffix fileSuffix,
|
||||
GROUP_CONCAT(tdfl.lable_name SEPARATOR ',') AS labName,tpru.public_folder_id publicFolderId,if(tpru.auth is null,#{auth},tpru.auth) auth,
|
||||
tudf.labels AS labName,tpru.public_folder_id publicFolderId,if(tpru.auth is null,#{auth},tpru.auth) auth,tudf.file_path filePath,
|
||||
tudf.see_times, tudf.create_user,tudf.create_time,tudf.update_time,su.user_name
|
||||
FROM tb_public_real_user tpru
|
||||
left join tb_user_document_folder tudf on tpru.user_folder_id=tudf.id
|
||||
|
|
@ -200,13 +200,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
)
|
||||
</if>
|
||||
GROUP BY tudf.id
|
||||
</if>
|
||||
<if test='type=="2" or type==2 or type=="4" or type==4'>
|
||||
SELECT tudf.id, tudf.folder_name name,tudf.parent_id parentId,tudf.parent_ids,IFNULL(tudf.type,2) type ,tudf.down_times downNum,
|
||||
SELECT distinct tudf.id, tudf.folder_name name,tudf.parent_id parentId,tudf.parent_ids,IFNULL(tudf.type,2) type ,tudf.down_times downNum,
|
||||
tudf.file_type fileType,tudf.file_suffix fileSuffix,tpru.public_folder_id publicFolderId,if(tpru.auth is null,#{auth},tpru.auth) auth,
|
||||
tudf.see_times readNum, tudf.create_user,tudf.create_time createTime,tudf.update_time updateTime,su.user_name createUser,
|
||||
GROUP_CONCAT(tdfl.lable_name SEPARATOR ',') AS labName
|
||||
tudf.file_path filePath,
|
||||
tudf.labels AS labName
|
||||
FROM tb_user_document_folder tudf
|
||||
left join tb_public_real_user tpru on tpru.user_folder_id=tudf.id
|
||||
left join sys_user su on su.user_id=tudf.create_user
|
||||
|
|
@ -222,13 +222,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
)
|
||||
</if>
|
||||
GROUP BY tudf.id
|
||||
</if>
|
||||
<if test='type=="3" or type==3 '>
|
||||
SELECT tudf.id, tudf.folder_name name,tudf.parent_id parentId,tudf.parent_ids,IFNULL(tudf.type,2) type ,tudf.down_times downNum,
|
||||
SELECT distinct tudf.id, tudf.folder_name name,tudf.parent_id parentId,tudf.parent_ids,IFNULL(tudf.type,2) type ,tudf.down_times downNum,
|
||||
tudf.file_type fileType,tudf.file_suffix fileSuffix,tpru.public_folder_id publicFolderId,if(tpru.auth is null,#{auth},tpru.auth) auth,
|
||||
tudf.see_times readNum, tudf.create_user,tudf.create_time createTime,tudf.update_time updateTime,su.user_name createUser,
|
||||
GROUP_CONCAT(tdfl.lable_name SEPARATOR ',') AS labName
|
||||
tudf.file_path filePath,
|
||||
tudf.labels AS labName
|
||||
FROM tb_user_document_folder tudf
|
||||
left join tb_public_real_user tpru on tpru.user_folder_id=tudf.id
|
||||
left join sys_user su on su.user_id=tudf.create_user
|
||||
|
|
@ -250,7 +250,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
)
|
||||
</if>
|
||||
GROUP BY tudf.id
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
|
@ -337,6 +336,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from tb_user_document_folder
|
||||
where file_type=0
|
||||
</select>
|
||||
<select id="getPublicFolderNum" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
FROM tb_public_folder
|
||||
WHERE id=#{newParentId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
GROUP BY
|
||||
d.dept_id
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
-- ${params.dataScope}
|
||||
order by d.parent_id, d.order_num
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue