|
@@ -1,5 +1,6 @@
|
|
|
package com.gis.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.gis.common.constant.ErrorEnum;
|
|
|
import com.gis.common.exception.BaseRuntimeException;
|
|
@@ -80,7 +81,17 @@ public class DirServiceImpl extends IBaseServiceImpl<DirEntity, Long> implements
|
|
|
|
|
|
@Override
|
|
|
public Result move(DirMoveDto param) {
|
|
|
+ String[] split = param.getDirIds().split(",");
|
|
|
+ for (String s : split) {
|
|
|
+ DirEntity byId = this.findById(Long.valueOf(s));
|
|
|
+ log.info("文件夹名称查询{}",byId);
|
|
|
+ DirEntity byIdAndName = findByIdAndName(param.getParentId(), byId.getName());
|
|
|
+ if (ObjectUtil.isNotNull(byIdAndName)){
|
|
|
+ log.info("{}",byIdAndName);
|
|
|
+ throw new BaseRuntimeException(ErrorEnum.FAILURE_CODE_3104.code(), ErrorEnum.FAILURE_CODE_3104.message());
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
// 移动目录
|
|
|
this.updateParentId(param.getParentId(), param.getDirIds(), param.getAncestors());
|
|
|
// 移动素材
|
|
@@ -89,6 +100,14 @@ public class DirServiceImpl extends IBaseServiceImpl<DirEntity, Long> implements
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public DirEntity findByIdAndName(Long parentId, String name) {
|
|
|
+ DirEntity parm=new DirEntity();
|
|
|
+ parm.setName(name);
|
|
|
+ parm.setParentId(parentId);
|
|
|
+ return getBaseMapper().selectOne(parm);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 删除目录
|
|
|
* 若删除的文件夹包括图片、视频、音频,可直接删除
|
|
@@ -103,21 +122,21 @@ public class DirServiceImpl extends IBaseServiceImpl<DirEntity, Long> implements
|
|
|
// if ("pano".equals(type)){
|
|
|
// // 查询子节点
|
|
|
// String dirs = getChildIdById(id);
|
|
|
-// BaseRuntimeException.isTrue(checkPanoUse(dirs), ErrorEnum.FAILURE_CODE_3101.code(), ErrorEnum.FAILURE_CODE_3101.message());
|
|
|
-// this.deleteByIds(dirs);
|
|
|
+// BaseRuntimeException.isTrue(checkPanoUse(dirs,type), ErrorEnum.FAILURE_CODE_3101.code(), ErrorEnum.FAILURE_CODE_3101.message());
|
|
|
+// this.removeIds(dirs);
|
|
|
// fodderService.removeByDirIds(dirs);
|
|
|
// } else {
|
|
|
// // 子目录跟子素材没有进行递归删除
|
|
|
// //20230420 增加删除子目录
|
|
|
// String dirs = getChildIdById(id);
|
|
|
-// this.deleteByIds(dirs);
|
|
|
+// this.removeIds(dirs);
|
|
|
// fodderService.removeByDirIds(dirs);
|
|
|
// }
|
|
|
// 查询子节点
|
|
|
String dirs = getChildIdById(id);
|
|
|
log.info("删除类型{},dir-ids:{}",type,dirs);
|
|
|
BaseRuntimeException.isTrue(checkPanoUse(dirs,type), ErrorEnum.FAILURE_CODE_3101.code(), ErrorEnum.FAILURE_CODE_3101.message());
|
|
|
- this.deleteByIds(dirs);
|
|
|
+ this.removeIds(dirs);
|
|
|
fodderService.removeByDirIds(dirs);
|
|
|
return Result.success();
|
|
|
}
|
|
@@ -171,7 +190,13 @@ public class DirServiceImpl extends IBaseServiceImpl<DirEntity, Long> implements
|
|
|
return works;
|
|
|
|
|
|
}
|
|
|
+ private void removeIds(String dirIds){
|
|
|
+ if (StrUtil.isNotBlank(dirIds)){
|
|
|
+ log.info("删除状态标记: {} ", dirIds );
|
|
|
+ entityMapper.update(StrUtil.format("update tb_dir set is_delete=1 where is_delete=0 and id in ({}) ", dirIds));
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
private void updateParentId(Long parentId, String dirIds, String ancestors){
|
|
|
if (StrUtil.isNotBlank(dirIds)){
|
|
|
log.info("移动目录: {} 到 {}", dirIds, parentId);
|