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) {
|
for (WebCadDataComponentGroupReqVO node : list) {
|
||||||
|
|
||||||
// 递归转换
|
OrderComponentTreeCompareVO root = convertNode(node);
|
||||||
OrderComponentTreeCompareVO root =
|
|
||||||
convertNode(node);
|
|
||||||
|
|
||||||
// 递归生成 hash
|
// 仅给根节点计算 hash
|
||||||
computeHashRecursively(root);
|
root.setStructureHash(
|
||||||
|
DigestUtil.sha256Hex(
|
||||||
|
buildStructureString(root)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
roots.add(root);
|
roots.add(root);
|
||||||
}
|
}
|
||||||
@@ -614,7 +616,7 @@ public class WebCadOrderImportFactory {
|
|||||||
*
|
*
|
||||||
* @return 当前节点结构字符串
|
* @return 当前节点结构字符串
|
||||||
*/
|
*/
|
||||||
private String computeHashRecursively(
|
private String buildStructureString(
|
||||||
OrderComponentTreeCompareVO node) {
|
OrderComponentTreeCompareVO node) {
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -626,7 +628,6 @@ public class WebCadOrderImportFactory {
|
|||||||
|
|
||||||
if (CollUtil.isNotEmpty(children)) {
|
if (CollUtil.isNotEmpty(children)) {
|
||||||
|
|
||||||
// 排序保证 hash 稳定
|
|
||||||
children.sort(
|
children.sort(
|
||||||
Comparator.comparing(
|
Comparator.comparing(
|
||||||
OrderComponentTreeCompareVO::getName
|
OrderComponentTreeCompareVO::getName
|
||||||
@@ -641,9 +642,8 @@ public class WebCadOrderImportFactory {
|
|||||||
sb.append(",");
|
sb.append(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 递归子节点
|
|
||||||
sb.append(
|
sb.append(
|
||||||
computeHashRecursively(
|
buildStructureString(
|
||||||
children.get(i)
|
children.get(i)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -652,14 +652,7 @@ public class WebCadOrderImportFactory {
|
|||||||
sb.append(")");
|
sb.append(")");
|
||||||
}
|
}
|
||||||
|
|
||||||
String structureStr = sb.toString();
|
return sb.toString();
|
||||||
|
|
||||||
// 当前节点 hash
|
|
||||||
node.setStructureHash(
|
|
||||||
DigestUtil.sha256Hex(structureStr)
|
|
||||||
);
|
|
||||||
|
|
||||||
return structureStr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user