tfse-model-api-v0.2/Report/ReportObj.py

62 lines
2.1 KiB
Python
Raw Permalink Normal View History

from Utils.ObjUtil import SpecObject
from Utils.ValidateUtil import ValidateAttr, Validate
class ReportData(SpecObject):
"""报告数据"""
class ReportChapter(SpecObject):
"""章节"""
class ReportSubsection(SpecObject):
"""小节"""
class SubsectionContent(SpecObject):
"""小节内容"""
paragraph = ValidateAttr(field="paragraph", type=str)
tableName = ValidateAttr(field="tableName", type=str)
unit = ValidateAttr(field="unit", type=str)
table = ValidateAttr(field="table", type=list)
comment = ValidateAttr(field="comment", type=str)
fields_map = {
"paragraph": "段落",
"tableName": "表名",
"unit": "单位",
"table": "表格",
"comment": "注释",
}
subsection = ValidateAttr(field="subsection", type=str)
content = ValidateAttr(field="content", instance_list=SubsectionContent)
fields_map = {
"subsection": "小节",
"content": "小节内容"
}
chapter = ValidateAttr(field="chapter", type=str)
content = ValidateAttr(field="content", instance_list=ReportSubsection)
fields_map = {
"chapter": "章节",
"content": "章节内容"
}
cid = ValidateAttr(field='cid', type=str, length=8)
rid = ValidateAttr(field="rid", type=str, length=8)
name = ValidateAttr(field='name', type=str)
generate_date = ValidateAttr(field='generate_date', func=Validate.time_format)
industry = ValidateAttr(field='industry', type=list)
year = ValidateAttr(field='year', type=str)
content = ValidateAttr(field='content', instance_list=ReportChapter)
fields_map = {
"cid": "企业ID",
"rid": "评价ID",
"name": "企业名称",
"generate_date": "生成日期",
"industry": "行业选择",
"year": "评价年度",
"content": "报告内容"
}