3690e26d by 周伟奇

fix hil e-contract

1 parent 01d81417
......@@ -1101,6 +1101,31 @@ class Finder:
representative['position'] = bbox
return name, id_num, representative
def get_value_by_findall(self, prefix, suffix, page_num):
value = self.item.copy()
all_text = ''
pno = page_num
for block in self.pdf_info[pno]['blocks']:
if block['type'] != 0:
continue
for line in block['lines']:
for span in line['spans']:
bbox, text = span['bbox'], span['text']
all_text += text
words_list = re.findall(f"{prefix}(.*?){suffix}", all_text)
if len(words_list) > 0:
for block in self.pdf_info[pno]['blocks']:
if block['type'] != 0:
continue
for line in block['lines']:
for span in line['spans']:
bbox, text = span['bbox'], span['text']
if words_list[0] in text:
value['position'] = bbox
value['page'] = pno
value['words'] = words_list[0]
return value
def get_info(self):
"""
block['type'] == 0 : 表示该元素为图片
......@@ -1281,6 +1306,8 @@ class Finder:
self.init_result_1['承租人-证件号码'] = _id
# 销售经销商
seller = self.get_key_value(key='销售经销商:', page_num='0')
if seller['words'] == "":
seller = self.get_value_by_findall('销售经销商:', '地址:', page_num='0')
self.init_result_1['销售经销商'] = seller
# 合同编号(正文)
contract_no = self.get_contract_no_one()
......@@ -1296,6 +1323,9 @@ class Finder:
self.init_result_1['签字页-承租人签章'] = signature_role_1
# 签字页-销售经销商
seller = self.get_key_value(key='销售经销商:')
if seller['words'] == "":
# 销售经销商:深圳市宝创汽车贸易有限公司南山分公司(请授权代表签字并请盖章)
seller = self.get_value_by_findall('销售经销商:', '(请授权代表签字并请盖章)', page_num='3')
self.init_result_1['签字页-销售经销商'] = seller
# 经销商签章
pass
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!