tfse-admin-api-v0.2/Test/TestObj.py

75 lines
3.6 KiB
Python
Raw Normal View History

2022-04-25 17:04:40 +08:00
from Utils.ObjUtil import SpecObject
from Utils.ValidateUtil import ValidateAttr, Validate
class CompanyUser(SpecObject):
"""企业用户"""
class VerifyInfo(SpecObject):
"""认证信息"""
name = ValidateAttr(field='name', default=None, type=str, error_info='企业名称异常', error_code=200)
code = ValidateAttr(field='code', default=None, type=str, error_info='统一社会信用代码异常', error_code=200)
legal_person = ValidateAttr(field='legal_person', default=None, type=str, error_info='法人姓名异常', error_code=200)
fields_map = {
"name": "企业名称",
"code": "统一社会信用代码",
"legal_person": "法人姓名"
}
cid = ValidateAttr(field='cid', type=str, length=8, error_info='企业ID异常', error_code=200)
name = ValidateAttr(field='name', type=str, default=None, error_info='企业名称异常', error_code=200)
email = ValidateAttr(field='email', func=Validate.email, error_info='邮箱格式异常', error_code=200)
pwd = ValidateAttr(field='pwd', func=Validate.password, error_info='密码强度异常', error_code=200)
avatar_id = ValidateAttr(field='avatar_id', type=str, length=24, error_info='头像ID异常', error_code=200)
verify_status = ValidateAttr(field='verify_status', type=str, in_list=["", ""], error_info='认证状态异常',
error_code=200)
verify_info = ValidateAttr(field='verify_info', type=VerifyInfo, error_info='认证信息异常', error_code=200)
register_time = ValidateAttr(field='register_time', default=None, type=str, error_info='注册时间异常', error_code=200)
fields_map = {
"cid": "企业ID",
"name": "企业名称",
"email": "邮箱",
"avatar_id": "头像fid",
"pwd": "密码",
"register_time": "注册时间",
"verify_status": "已认证",
"verify_info": "认证信息"
}
class RatingRecord(SpecObject):
"""评价记录 """
rid = ValidateAttr(field='rid', type=str, length=8)
cid = ValidateAttr(field='cid', type=str, length=8)
company = ValidateAttr(field='company', type=str)
project = ValidateAttr(field='project', type=str, in_list=["综合信用评价", "ESG评价"])
methods = ValidateAttr(field='methods', type=str, in_list=["企业申报"])
status = ValidateAttr(field='status', type=str, in_list=["进行", "完成"])
result = ValidateAttr(field='result', type=str,
in_list=["AAA", "AA+", "AA", "AA-", "A+", "A", "A-", "BBB+", "BBB", "BBB-", "BB+", "BB",
"BB-", "B+", "B", "B-", "CCC", "CC"], default=None)
report_fid = ValidateAttr(field='report_fid', type=str, default=None)
certificate_fid = ValidateAttr(field='certificate_fid', type=str, default=None)
begin_time = ValidateAttr(field='begin_time', type=str)
submit_time = ValidateAttr(field='submit_time', type=str, default=None)
finish_time = ValidateAttr(field='finish_time', type=str, default=None)
finish_date = ValidateAttr(field='finish_date', type=str, default=None)
fields_map = {
"rid": "评价ID",
"cid": "企业ID",
"company": "企业名称",
"project": "评价项目",
"methods": "评价方式",
"status": "进行状态",
"result": "评价结果",
"report_fid": "报告fid",
"certificate_fid": "证书fid",
"begin_time": "开始填报时间",
"submit_time": "提交填报时间",
"finish_time": "评价完成时间",
"finish_date": "评价完成日期"
}