1、删除节点时,递归删除子节点并删除相应文件夹

This commit is contained in:
2025-12-03 18:02:36 +08:00
parent 7ba947675d
commit 27fa62eaef

View File

@@ -14,6 +14,7 @@ import com.sdm.common.entity.constants.TagConstant;
import com.sdm.common.entity.enums.DirTypeEnum;
import com.sdm.common.entity.enums.NodeTypeEnum;
import com.sdm.common.entity.req.data.CreateDirReq;
import com.sdm.common.entity.req.data.DelDirReq;
import com.sdm.common.entity.req.data.RenameDirReq;
import com.sdm.common.entity.req.data.UploadFilesReq;
import com.sdm.common.entity.req.project.*;
@@ -199,10 +200,26 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return SdmResponse.failed("操作节点失败,原因:删除节点时失败!");
}
deleteDirNew(deleteNodeIdList);
}
return SdmResponse.success();
}
// 删除文件夹
public boolean deleteDirNew(List<String> uuidList) {
for (String uuid : uuidList) {
DelDirReq req = new DelDirReq();
req.setDelUuid(uuid);
log.info("调用删除文件夹的参数为:{}", req);
SdmResponse response = dataClientFeignClient.delDir(req);
log.info("调用删除文件夹的返回值为:{}", response);
if (response.getCode() != ResultCode.SUCCESS.getCode()) {
return false;
}
}
return true;
}
private boolean deleteNode(List<String> deleteNodeIdList) {
List<ProjectNodePo> projectNodePoList = nodeMapper.allList(deleteNodeIdList);
@@ -235,7 +252,11 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
List<Long> performanceIdList = performanceNodePoList.stream().map(PerformanceNodePo::getId).toList();
nodeMapper.deletePerformanceBatch(performanceIdList);
nodeMapper.deletePerformanceExtraBatch(performanceIdList);
return true;
List<SpdmNodeVo> childrenNodeList = nodeMapper.getNodeListByNodeIdList(deleteNodeIdList);
if (CollectionUtils.isEmpty(childrenNodeList)) {
return true;
}
return deleteNode(childrenNodeList.stream().map(SpdmNodeVo::getUuid).toList());
}
@Override