import copy import datetime import json from Report.script import * class ReportModel: """ 信息技术业报告模板 """ def __init__(self, rep_json, temp_data): # 接口传入数据 self.doc = copy.deepcopy(temp_data) self.data = copy.deepcopy(rep_json) def report_vlaues(self): report_temlate = self.doc report_data = self.data report_data['企业名称'] = self.data['企业名称'] report_data['生成日期'] = datetime.datetime.now().strftime("%Y-%m-%d") # 报告内容 report_data = handle_report_content(report_temlate, report_data) return report_data if __name__ == '__main__': with open("../static/test_data/report_data.json", "r", encoding="utf-8") as f: rep_data = json.load(f) with open("../static/test_data/manufacturing_report.json", "r", encoding="utf-8") as f: tem_data = json.load(f) r = ReportModel(rep_data, tem_data).report_vlaues() print(r) """ 1.对外投资模块需要特殊处理 2.资质荣誉需要判断数据是否存在,如果无数据则显示段落3 3.环境治理中段落3,绿色业务占比 """