feat(电子公文): 规范标引命名空间管理
build.yaml / build (push) Successful in 50s

This commit is contained in:
xiaoqidun committed 2026-10-13 00:33:19 +08:00
1 parent e86fc6a4e0
commit e5685e5c7b
1 file changed
+18 -1
+18 -1
View File
@@ -23,6 +23,12 @@ import (
"strings" "strings"
) )
// 公文标引类型标识
const structureTypeOfficial = "od"
// 2013版电子公文标引命名空间
const structureNamespaceEGov2013 = "http://www.nits.org.cn/eGovDoc/2013"
// Structure 保存自定义标引入口及结构树,单个文件解析失败时通过Error报告,不影响其他标引 // Structure 保存自定义标引入口及结构树,单个文件解析失败时通过Error报告,不影响其他标引
type Structure struct { type Structure struct {
TypeID string `json:"typeId,omitempty"` TypeID string `json:"typeId,omitempty"`
@@ -188,7 +194,18 @@ func parseStructure(ctx context.Context, data []byte, tag CustomTag) (*Structure
// 入参: tag 标引入口, namespace 内容根节点命名空间 // 入参: tag 标引入口, namespace 内容根节点命名空间
// 返回: bool 是否使用公文引用规则 // 返回: bool 是否使用公文引用规则
func structureOfficial(tag CustomTag, namespace string) bool { func structureOfficial(tag CustomTag, namespace string) bool {
return tag.TypeID == "od" || namespace == "http://www.nits.org.cn/eGovDoc/2013" && tag.NameSpace == namespace if tag.TypeID == structureTypeOfficial {
return true
}
if tag.NameSpace != namespace {
return false
}
switch namespace {
case structureNamespaceEGov2013:
return true
default:
return false
}
} }
// structureObjectIDs 按公文标引规则拆分图元标识,保留顺序和重复项 // structureObjectIDs 按公文标引规则拆分图元标识,保留顺序和重复项