#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @File     : process
# @Author   : LiuYan
# @Time     : 2021/11/9 16:06

import chevron

from generate.gen_user_report_auto_generated import GeneralUserReportAutoGenerated


if __name__ == '__main__':
    # from docxtpl import DocxTemplate
    #
    # doc = DocxTemplate("template.docx")  # 模板文档
    # context = {'app_name': "模块测试", 'dataset_1_company_name': "2020-07-01", 'vac_time': "8:30", "reason": "上班未打卡"}  # 待替换对象
    # doc.render(context)  # 执行替换
    # doc.save("generated_doc.docx")  # 保存新的文档

    # from jinja2 import Template
    #
    # person = {'name': 'Person', 'age': 34}
    #
    # tm = Template("My name is {{ per.name }} and I am {{ per.age }}, {{ per.test }} ")
    # # tm = Template("My name is {{ per['name'] }} and I am {{ per['age'] }}")
    # msg = tm.render(per=person)
    #
    # print(msg)

    # s = chevron.render('Hello, {{ dataset_1_Company_Name }}!', {'dataset_1.Company_Name': 'World'})
    # s = chevron.render(
    #     'start_date={{start_time}}&end_date={{end_time}}&top_n={{top_n}}',
    #     {'start_time': 'st', 'end_time': 'et'}
    # )

    # project_name = '研究中心'
    # input_template_path = '../data/datasource/input/template.docx'
    # output_report_path = '../data/datasource/output/企业分析报告_20211223.docx'
    project_name = '评价中心'
    input_template_path = '../data/datasource/input/template_kaige.docx'
    output_report_path = '../data/datasource/output/template_kaige_2048.docx'
    gurag = GeneralUserReportAutoGenerated(
        project_name=project_name,
        input_template_path=input_template_path,
        output_report_path=output_report_path,
        start_time='2022-01-10', end_time='2022-01-17',
        parameter='reportId=2048'
    )
    gurag.process()
