#!/usr/bin/python # -*- coding=utf-8 -*- # @Create Time: 2024-12-23 15:22:39 # @Last Modified time: 2024-12-25 16:17:09 import uuid import time import json import requests from .get_tender_info import PdfExtractAttr_ from .document_ import DocumentPreReview from .busi_instance import busi_loc from .tech_instance import tech_loc from .parse_textmind_result import get_ocr_new def detail_task(zb_file: str, tb_file: str, tb_filename: str, projectId: str, project: str, supplier: str): host = '192.168.1.111:9999' detail_check_url = f'http://{host}/bm/alg/result_check_detail' agent = PdfExtractAttr_(file_path=zb_file) zb_table_path = f'./tmp/zb_table-{uuid.uuid4()}.json' agent.parse_table_pro(table_path=zb_table_path) dpr = DocumentPreReview(zb_table_path) scrutinize_dict = dpr.get_table() print(scrutinize_dict) with open(tb_file, 'r', encoding='utf-8') as fp: raw = json.load(fp) result = get_ocr_new(raw=raw, pretty=True) busi_score = busi_loc( scrutinize_dict=scrutinize_dict, outline_dict=result['outline'], title_list=result['title'], table_list=result['tables'], image_list=result['images'], supplier=supplier, project=project, file_name=tb_filename.split('.')[0] + 'pdf' ) busi_score['name'] = '商务部分评分标准' tech_score = tech_loc( scrutinize_dict=scrutinize_dict, outline_dict=result['outline'], content_list=result['contents'], supplier=supplier, project=project, file_name=tb_filename.split('.')[0] + 'pdf' ) tech_score['name'] = '技术部分评分标准' detail_data = { 'projectId': projectId, 'projectName': project, 'bidderUnit': supplier, 'list': [busi_score, tech_score] } print(detail_data) detail_check_response = requests.post(url=detail_check_url, json=detail_data) print("detail_check_response: ", detail_check_response.json()) return