diff --git a/Generate_Report.py b/Generate_Report.py index e2625ae..6bb666f 100644 --- a/Generate_Report.py +++ b/Generate_Report.py @@ -505,18 +505,14 @@ async def generate_report(base_info, baogao_info): print(await search_and_replace(output_dir, 'baogao_date', baogao_date.split(' ')[0])) print(await search_and_replace(output_dir, jiegou_xuhao, num_to_chinese[head_num])) - - - - def main(): json_data1 = { "turbine_id" : "183463dbf40d9278549a76b82b175dd9", } json_data2 = { - 'shengcheng_dir': r"D:\work\Report_Generate_Server\output", - 'muban_dir': r"D:\work\Report_Generate_Server\muban", + 'shengcheng_dir': r".\output", + 'muban_dir': r".\muban", } asyncio.run(generate_report(json_data1,json_data2)) print('文档生成完毕') diff --git a/core/__pycache__/styles.cpython-312.pyc b/core/__pycache__/styles.cpython-312.pyc new file mode 100644 index 0000000..552ca3c Binary files /dev/null and b/core/__pycache__/styles.cpython-312.pyc differ diff --git a/core/__pycache__/tables.cpython-312.pyc b/core/__pycache__/tables.cpython-312.pyc new file mode 100644 index 0000000..cdc6230 Binary files /dev/null and b/core/__pycache__/tables.cpython-312.pyc differ diff --git a/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版.docx b/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版.docx deleted file mode 100644 index 44548a6..0000000 Binary files a/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版.docx and /dev/null differ diff --git a/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版1.docx b/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版1.docx deleted file mode 100644 index 44548a6..0000000 Binary files a/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版1.docx and /dev/null differ diff --git a/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版2.docx b/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版2.docx deleted file mode 100644 index 44548a6..0000000 Binary files a/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版2.docx and /dev/null differ diff --git a/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月03日版1.docx b/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月03日版1.docx deleted file mode 100644 index 44548a6..0000000 Binary files a/output/~$能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月03日版1.docx and /dev/null differ diff --git a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版.docx b/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版.docx deleted file mode 100644 index ac77005..0000000 Binary files a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版.docx and /dev/null differ diff --git a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版1.docx b/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版1.docx deleted file mode 100644 index 4edbf8d..0000000 Binary files a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版1.docx and /dev/null differ diff --git a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版2.docx b/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版2.docx deleted file mode 100644 index 57de554..0000000 Binary files a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版2.docx and /dev/null differ diff --git a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版3.docx b/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版3.docx deleted file mode 100644 index 6752839..0000000 Binary files a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版3.docx and /dev/null differ diff --git a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版4.docx b/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版4.docx deleted file mode 100644 index 94f6d54..0000000 Binary files a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版4.docx and /dev/null differ diff --git a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版5.docx b/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版5.docx deleted file mode 100644 index 961ad89..0000000 Binary files a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版5.docx and /dev/null differ diff --git a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版6.docx b/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版6.docx deleted file mode 100644 index f97fc83..0000000 Binary files a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2021年12月10日版6.docx and /dev/null differ diff --git a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月03日版.docx b/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月03日版.docx deleted file mode 100644 index 09a9062..0000000 Binary files a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月03日版.docx and /dev/null differ diff --git a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月03日版1.docx b/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月04日版.docx similarity index 97% rename from output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月03日版1.docx rename to output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月04日版.docx index f7b95a1..947aa1d 100644 Binary files a/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月03日版1.docx and b/output/三峡能源阿城万兴风电场项目风力发电机组叶片检查报告H3-08#2025年07月04日版.docx differ diff --git a/tools/Get_Json.py b/tools/Get_Json.py index acb10be..cdbcdd5 100644 --- a/tools/Get_Json.py +++ b/tools/Get_Json.py @@ -1,79 +1,42 @@ import requests import json from tools.API import * -def get_project_info(projectId): - projecturl = DTURL + GETPROJECTINFO.format(projectId=projectId) + +def get_data(url, data_type="data", params=None): headers = { - "content_type" : "application/x-www-form-urlencoded" + "content_type": "application/x-www-form-urlencoded" } try: - response = requests.get(projecturl, headers=headers) + response = requests.get(url, headers=headers, params=params) if response.status_code == 200: data = json.loads(response.text) - print(f"获取到项目的数据:{data}") - return data["data"] + print(f"获取到数据:{data}") + return data.get(data_type) else: - print(f"获取项目{projectId}数据失败,状态码:{response.status_code}") + print(f"请求数据失败,状态码:{response.status_code}") return None except Exception as e: - print(f"获取项目{projectId}数据失败,异常:{e}") + print(f"请求数据失败,异常:{e}") return None + +def get_project_info(projectId): + projecturl = DTURL + GETPROJECTINFO.format(projectId=projectId) + return get_data(projecturl, "data") def get_jizu_info(turbineId): jizuurl = DTURL + GETJIZUINFO.format(turbineId=turbineId) - headers = { - "content_type" : "application/x-www-form-urlencoded" - } - try: - response = requests.get(jizuurl, headers=headers) - if response.status_code == 200: - data = json.loads(response.text) - print(f"获取到机组的数据:{data}") - return data["data"] - else: - print(f"获取项目{turbineId}数据失败,状态码:{response.status_code}") - return None - except Exception as e: - print(f"获取项目{turbineId}数据失败,异常:{e}") - return None + return get_data(jizuurl, "data") def get_jizu_shigong_info(turbineId): jizuurl = DTURL + GETSHIGONGINFO - headers = { - "content_type" : "application/x-www-form-urlencoded" - } params = { - "rows" : { - "turbineId" : turbineId + "rows": { + "turbineId": turbineId } } - try: - response = requests.get(jizuurl, headers=headers, params=params) - if response.status_code == 200: - data = json.loads(response.text) - print(f"获取到机组施工的数据:{data}") - return data["rows"][0] - else: - print(f"获取项目{turbineId}施工数据失败,状态码:{response.status_code}") - return None - except Exception as e: - print(f"获取项目{turbineId}施工数据失败,异常:{e}") - return None + result = get_data(jizuurl, "rows", params) + return result[0] if result else None def get_weather(weatherid): weatherurl = DTURL + GETWEATHERINFO.format(weatherCode=weatherid) - headers = { - "content_type" : "application/x-www-form-urlencoded" - } - try: - response = requests.get(weatherurl, headers=headers) - if response.status_code == 200: - data = json.loads(response.text) - print(f"获取到天气数据:{data}") - return data["data"] - else: - print(f"获取天气{weatherid}数据失败,状态码:{response.status_code}") - return None - except Exception as e: - print(f"获取天气{weatherid}数据失败,异常:{e}") - return None \ No newline at end of file + return get_data(weatherurl, "data") \ No newline at end of file diff --git a/tools/__pycache__/API.cpython-312.pyc b/tools/__pycache__/API.cpython-312.pyc new file mode 100644 index 0000000..8014ac7 Binary files /dev/null and b/tools/__pycache__/API.cpython-312.pyc differ diff --git a/tools/__pycache__/Get_Json.cpython-312.pyc b/tools/__pycache__/Get_Json.cpython-312.pyc new file mode 100644 index 0000000..bf78474 Binary files /dev/null and b/tools/__pycache__/Get_Json.cpython-312.pyc differ diff --git a/tools/__pycache__/content_tools.cpython-312.pyc b/tools/__pycache__/content_tools.cpython-312.pyc new file mode 100644 index 0000000..2a69f5a Binary files /dev/null and b/tools/__pycache__/content_tools.cpython-312.pyc differ diff --git a/tools/__pycache__/defines.cpython-312.pyc b/tools/__pycache__/defines.cpython-312.pyc new file mode 100644 index 0000000..8fdad3b Binary files /dev/null and b/tools/__pycache__/defines.cpython-312.pyc differ diff --git a/tools/__pycache__/document_tools.cpython-312.pyc b/tools/__pycache__/document_tools.cpython-312.pyc new file mode 100644 index 0000000..1cdc62a Binary files /dev/null and b/tools/__pycache__/document_tools.cpython-312.pyc differ diff --git a/tools/__pycache__/get_pictures.cpython-312.pyc b/tools/__pycache__/get_pictures.cpython-312.pyc new file mode 100644 index 0000000..0e0b904 Binary files /dev/null and b/tools/__pycache__/get_pictures.cpython-312.pyc differ diff --git a/utils/__pycache__/__init__.cpython-312.pyc b/utils/__pycache__/__init__.cpython-312.pyc index 002b2f0..1d3d8b9 100644 Binary files a/utils/__pycache__/__init__.cpython-312.pyc and b/utils/__pycache__/__init__.cpython-312.pyc differ diff --git a/utils/__pycache__/document_utils.cpython-312.pyc b/utils/__pycache__/document_utils.cpython-312.pyc index 010bc3b..634f6c1 100644 Binary files a/utils/__pycache__/document_utils.cpython-312.pyc and b/utils/__pycache__/document_utils.cpython-312.pyc differ diff --git a/utils/__pycache__/file_utils.cpython-312.pyc b/utils/__pycache__/file_utils.cpython-312.pyc index 43b01d6..a3f5acf 100644 Binary files a/utils/__pycache__/file_utils.cpython-312.pyc and b/utils/__pycache__/file_utils.cpython-312.pyc differ