69 lines
1.9 KiB
Python
69 lines
1.9 KiB
Python
from Utils.ObjUtil import SpecObject
|
|
from Utils.ValidateUtil import ValidateAttr, Validate
|
|
|
|
|
|
class Content(SpecObject):
|
|
"""小节内容"""
|
|
|
|
paragraph = ValidateAttr(field="paragraph", type=str)
|
|
table_name = ValidateAttr(field="table_name", type=str)
|
|
table_unit = ValidateAttr(field="table_unit", type=str)
|
|
table_data = ValidateAttr(field="table_data", type=list)
|
|
comment = ValidateAttr(field="comment", type=str)
|
|
|
|
fields_map = {
|
|
"paragraph": "段落",
|
|
"table_name": "表名",
|
|
"table_unit": "单位",
|
|
"table_data": "表格",
|
|
"comment": "注释",
|
|
}
|
|
|
|
|
|
class Section(SpecObject):
|
|
"""小节"""
|
|
|
|
title = ValidateAttr(field="title", type=str)
|
|
content = ValidateAttr(field="content", instance_list=Content)
|
|
|
|
fields_map = {
|
|
"title": "小节",
|
|
"content": "小节内容"
|
|
}
|
|
|
|
|
|
class Chapter(SpecObject):
|
|
"""章节"""
|
|
|
|
title = ValidateAttr(field="title", type=str)
|
|
content = ValidateAttr(field="content", instance_list=Section)
|
|
|
|
fields_map = {
|
|
"title": "章节",
|
|
"content": "章节内容"
|
|
}
|
|
|
|
|
|
class ReportDataObj(SpecObject):
|
|
"""报告数据"""
|
|
|
|
cid = ValidateAttr(field='cid', type=str, length=8)
|
|
rid = ValidateAttr(field="rid", type=str, length=8)
|
|
name = ValidateAttr(field='name', type=str)
|
|
year = ValidateAttr(field='year', func=Validate.year_format)
|
|
industry = ValidateAttr(field='industry', type=str)
|
|
title = ValidateAttr(field='title', type=str)
|
|
content = ValidateAttr(field='content', instance_list=Chapter)
|
|
generate_date = ValidateAttr(field='generate_date', func=Validate.date_format)
|
|
|
|
fields_map = {
|
|
"cid": "企业ID",
|
|
"rid": "评级ID",
|
|
"name": "企业名称",
|
|
"year": "评价年度",
|
|
"industry": "行业选择",
|
|
"title": "报告标题",
|
|
"content": "报告内容",
|
|
"generate_date": "生成日期"
|
|
}
|