mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
cad同步菜单部件hash计算修复
This commit is contained in:
+10
-17
@@ -549,12 +549,14 @@ public class WebCadOrderImportFactory {
|
||||
|
||||
for (WebCadDataComponentGroupReqVO node : list) {
|
||||
|
||||
// 递归转换
|
||||
OrderComponentTreeCompareVO root =
|
||||
convertNode(node);
|
||||
OrderComponentTreeCompareVO root = convertNode(node);
|
||||
|
||||
// 递归生成 hash
|
||||
computeHashRecursively(root);
|
||||
// 仅给根节点计算 hash
|
||||
root.setStructureHash(
|
||||
DigestUtil.sha256Hex(
|
||||
buildStructureString(root)
|
||||
)
|
||||
);
|
||||
|
||||
roots.add(root);
|
||||
}
|
||||
@@ -614,7 +616,7 @@ public class WebCadOrderImportFactory {
|
||||
*
|
||||
* @return 当前节点结构字符串
|
||||
*/
|
||||
private String computeHashRecursively(
|
||||
private String buildStructureString(
|
||||
OrderComponentTreeCompareVO node) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -626,7 +628,6 @@ public class WebCadOrderImportFactory {
|
||||
|
||||
if (CollUtil.isNotEmpty(children)) {
|
||||
|
||||
// 排序保证 hash 稳定
|
||||
children.sort(
|
||||
Comparator.comparing(
|
||||
OrderComponentTreeCompareVO::getName
|
||||
@@ -641,9 +642,8 @@ public class WebCadOrderImportFactory {
|
||||
sb.append(",");
|
||||
}
|
||||
|
||||
// 递归子节点
|
||||
sb.append(
|
||||
computeHashRecursively(
|
||||
buildStructureString(
|
||||
children.get(i)
|
||||
)
|
||||
);
|
||||
@@ -652,14 +652,7 @@ public class WebCadOrderImportFactory {
|
||||
sb.append(")");
|
||||
}
|
||||
|
||||
String structureStr = sb.toString();
|
||||
|
||||
// 当前节点 hash
|
||||
node.setStructureHash(
|
||||
DigestUtil.sha256Hex(structureStr)
|
||||
);
|
||||
|
||||
return structureStr;
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user