REQ-3540: 添加字段
This commit is contained in:
parent
3a6c66abbb
commit
82f3b20adf
@ -28,6 +28,7 @@ public class DocProps {
|
||||
private String ossAppCode = "ent-workspace-doc";
|
||||
private String ossBizScene = "ent-workspace-doc";
|
||||
private int asyncTimeoutSeconds = 10;
|
||||
private boolean lockSubtreeWhenMove = false;
|
||||
private String defaultIconDatabase = "https://axzo-obs-public.obs.cn-north-4.myhuaweicloud.com:443/doc/doc/image-30.png";
|
||||
private String defaultIconDir = "https://axzo-obs-public.obs.cn-north-4.myhuaweicloud.com:443/doc/doc/image-30.png";
|
||||
private String defaultIconExcel = "https://axzo-obs-public.obs.cn-north-4.myhuaweicloud.com:443/doc/doc/excel.png";
|
||||
|
||||
@ -181,13 +181,13 @@ public class IndexManager {
|
||||
public Future<IndexNode> asyncMove(String srcCode, @Nullable String destParentCode) {
|
||||
IndexNode srcNode = getOrThrow(srcCode);
|
||||
IndexNode destParentNode = determineDestParentNode(srcNode, destParentCode, "移动");
|
||||
return async(() -> {
|
||||
return async(() -> transaction.execute(unused -> {
|
||||
if (docProps.isLockSubtreeWhenMove())
|
||||
indexSupport.lockSubtree(srcNode);
|
||||
RootNode<IndexNode> moveRoot = TreeBuilder.build(collectValidSubtreeAsValueRoot(srcNode));
|
||||
return transaction.execute(unused -> {
|
||||
docLogDao.log("indexNode:asyncMove", srcCode, "srcCode", srcCode, "destParentCode", destParentCode);
|
||||
return connectNodes(moveRoot, destParentNode);
|
||||
});
|
||||
});
|
||||
docLogDao.log("indexNode:asyncMove", srcCode, "srcCode", srcCode, "destParentCode", destParentCode);
|
||||
return connectNodes(moveRoot, destParentNode);
|
||||
}));
|
||||
}
|
||||
|
||||
private IndexNode determineDestParentNode(IndexNode srcNode, String destParentCode, String op) {
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
package cn.axzo.nanopart.doc.file.index;
|
||||
|
||||
import static cn.axzo.nanopart.doc.api.util.IdBuilder.idbuilder;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
@ -140,6 +141,18 @@ class IndexSupport {
|
||||
.build());
|
||||
}
|
||||
|
||||
void lockSubtree(IndexNode subtreeRoot) {
|
||||
List<String> codes = indexNodeDao.collectValidSubtreeNodes(subtreeRoot).stream() //
|
||||
.map(IndexNode::getCode) //
|
||||
// don't remove this line
|
||||
.sorted() //
|
||||
.collect(toList());
|
||||
indexNodeDao.lambdaQuery() //
|
||||
.in(IndexNode::getCode, codes) //
|
||||
.last("FOR UPDATE") //
|
||||
.list();
|
||||
}
|
||||
|
||||
<T> Future<T> submit(Callable<T> callable) {
|
||||
return executor.submit(() -> {
|
||||
try {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user