guarantee-admin-api-v0.2/Modules/Reports/ReportDataObj.py

69 lines
1.9 KiB
Python
Raw Permalink Normal View History

2022-06-13 17:17:30 +08:00
from Utils.ObjUtil import SpecObject
from Utils.ValidateUtil import ValidateAttr, Validate
2022-06-15 03:51:24 +08:00
class Content(SpecObject):
2022-06-13 17:17:30 +08:00
"""小节内容"""
paragraph = ValidateAttr(field="paragraph", type=str)
2022-06-15 03:51:24 +08:00
table_name = ValidateAttr(field="table_name", type=str)
table_unit = ValidateAttr(field="table_unit", type=str)
table_data = ValidateAttr(field="table_data", type=list)
2022-06-13 17:17:30 +08:00
comment = ValidateAttr(field="comment", type=str)
fields_map = {
"paragraph": "段落",
2022-06-15 03:51:24 +08:00
"table_name": "表名",
"table_unit": "单位",
"table_data": "表格",
2022-06-13 17:17:30 +08:00
"comment": "注释",
}
class Section(SpecObject):
"""小节"""
2022-06-15 03:51:24 +08:00
title = ValidateAttr(field="title", type=str)
content = ValidateAttr(field="content", instance_list=Content)
2022-06-13 17:17:30 +08:00
fields_map = {
2022-06-15 03:51:24 +08:00
"title": "小节",
"content": "小节内容"
2022-06-13 17:17:30 +08:00
}
class Chapter(SpecObject):
"""章节"""
2022-06-15 03:51:24 +08:00
title = ValidateAttr(field="title", type=str)
content = ValidateAttr(field="content", instance_list=Section)
2022-06-13 17:17:30 +08:00
fields_map = {
2022-06-15 03:51:24 +08:00
"title": "章节",
"content": "章节内容"
2022-06-13 17:17:30 +08:00
}
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)
2022-06-15 03:51:24 +08:00
industry = ValidateAttr(field='industry', type=str)
2022-06-13 17:17:30 +08:00
title = ValidateAttr(field='title', type=str)
content = ValidateAttr(field='content', instance_list=Chapter)
2022-06-15 03:51:24 +08:00
generate_date = ValidateAttr(field='generate_date', func=Validate.date_format)
2022-06-13 17:17:30 +08:00
fields_map = {
"cid": "企业ID",
2022-06-16 15:46:40 +08:00
"rid": "评级ID",
2022-06-13 17:17:30 +08:00
"name": "企业名称",
"year": "评价年度",
"industry": "行业选择",
"title": "报告标题",
"content": "报告内容",
"generate_date": "生成日期"
}