fix bug
Showing
3 changed files
with
63 additions
and
53 deletions
| ... | @@ -1394,49 +1394,50 @@ SE_HMH_FIELD = ['借款人/承租人姓名', '借款人/承租人证件号', ' | ... | @@ -1394,49 +1394,50 @@ SE_HMH_FIELD = ['借款人/承租人姓名', '借款人/承租人证件号', ' |
| 1394 | SE_BANK_FIELD = ['accountNo', 'bankName'] | 1394 | SE_BANK_FIELD = ['accountNo', 'bankName'] |
| 1395 | SE_DDA_FIELD = ['applicationId(1)', 'applicationId(2)', 'bankName', 'companyName', 'customerName', 'idNum', 'accountHolderName', 'accountNo'] | 1395 | SE_DDA_FIELD = ['applicationId(1)', 'applicationId(2)', 'bankName', 'companyName', 'customerName', 'idNum', 'accountHolderName', 'accountNo'] |
| 1396 | 1396 | ||
| 1397 | SE_AFC_CON_MAP = { | 1397 | ASP_KEY = 'is_asp' |
| 1398 | '合同编号-每页': (None, '合同编号', None), | ||
| 1399 | '所购车辆价格-小写-重要条款': (1, '所购车辆价格', None), | ||
| 1400 | '车架号-重要条款': (1, '车架号', None), | ||
| 1401 | '贷款本金金额-重要条款': (1, '贷款本金金额', '小写'), | ||
| 1402 | '贷款期限-重要条款': (1, '贷款期限', None), | ||
| 1403 | '车辆贷款本金金额-重要条款': (1, '车辆贷款本金金额', None), | ||
| 1404 | '附加产品融资贷款本金总额-重要条款': (1, '附加产品融资贷款本金总金额', None), | ||
| 1405 | '所购车辆价格': (2, '所购车辆价格', None), | ||
| 1406 | '车架号': (2, '车架号', None), | ||
| 1407 | '经销商': (2, '经销商', None), | ||
| 1408 | '贷款本金金额': (2, '贷款本金金额', '小写'), | ||
| 1409 | '车辆贷款本金金额': (2, '车辆贷款本金金额', None), | ||
| 1410 | '附加产品融资贷款本金总额': (2, '附加产品融资贷款本金总额', None), | ||
| 1411 | '贷款期限': (2, '贷款期限', None), | ||
| 1412 | '还款账号': (2, '还款账号', '账号'), | ||
| 1413 | '户名': (2, '还款账号', '户名'), | ||
| 1414 | '开户行': (2, '还款账号', '开户行'), | ||
| 1415 | |||
| 1416 | '借款人签字及时间': (1, '借款人签字及时间', None), | ||
| 1417 | |||
| 1418 | '借款人姓名': (2, '借款人及抵押人', 'name'), | ||
| 1419 | '借款人证件号': (2, '借款人及抵押人', 'id'), | ||
| 1420 | '共借人姓名': (2, '共同借款人及共同抵押人', 'name'), | ||
| 1421 | '共借人证件号': (2, '共同借款人及共同抵押人', 'id'), | ||
| 1422 | '保证人姓名1': (2, '保证人1', 'name'), | ||
| 1423 | '保证人证件号1': (2, '保证人1', 'id'), | ||
| 1424 | '保证人姓名2': (2, '保证人2', 'name'), | ||
| 1425 | '保证人证件号2': (2, '保证人2', 'id'), | ||
| 1426 | |||
| 1427 | '主借人签字': (8, '主借人签字', '签字'), | ||
| 1428 | '主借人日期': (8, '主借人签字', '日期'), | ||
| 1429 | '共借人签字': (8, '共借人签字', '签字'), | ||
| 1430 | '共借人日期': (8, '共借人签字', '日期'), | ||
| 1431 | '保证人签字1': (8, '保证人1签字', '签字'), | ||
| 1432 | '保证人日期1': (8, '保证人1签字', '日期'), | ||
| 1433 | '保证人签字2': (8, '保证人2签字', '签字'), | ||
| 1434 | '保证人日期2': (8, '保证人2签字', '日期'), | ||
| 1435 | '见证人签字': (8, '见证人签字', '签字'), | ||
| 1436 | '见证人日期': (8, '见证人签字', '日期'), | ||
| 1437 | |||
| 1438 | '还款计划表': (3, '还款计划表', None), | ||
| 1439 | 1398 | ||
| 1399 | SE_AFC_CON_MAP = { | ||
| 1400 | '合同编号-每页': (None, None, '合同编号', None), | ||
| 1401 | '所购车辆价格-小写-重要条款': (1, 1, '所购车辆价格', None), | ||
| 1402 | '车架号-重要条款': (1, 1, '车架号', None), | ||
| 1403 | '贷款本金金额-重要条款': (1, 1, '贷款本金金额', '小写'), | ||
| 1404 | '贷款期限-重要条款': (1, 1, '贷款期限', None), | ||
| 1405 | '车辆贷款本金金额-重要条款': (1, 1, '车辆贷款本金金额', None), | ||
| 1406 | '附加产品融资贷款本金总额-重要条款': (1, 1, '附加产品融资贷款本金总金额', None), | ||
| 1407 | '所购车辆价格': (2, 2, '所购车辆价格', None), | ||
| 1408 | '车架号': (2, 2, '车架号', None), | ||
| 1409 | '经销商': (2, 2, '经销商', None), | ||
| 1410 | '贷款本金金额': (2, 2, '贷款本金金额', '小写'), | ||
| 1411 | '车辆贷款本金金额': (2, 2, '车辆贷款本金金额', None), | ||
| 1412 | '附加产品融资贷款本金总额': (2, 2, '附加产品融资贷款本金总额', None), | ||
| 1413 | '贷款期限': (2, 2, '贷款期限', None), | ||
| 1414 | '还款账号': (2, 2, '还款账户', '账号'), | ||
| 1415 | '户名': (2, 2, '还款账户', '户名'), | ||
| 1416 | '开户行': (2, 2, '还款账户', '开户行'), | ||
| 1417 | |||
| 1418 | '借款人签字及时间': (1, 1, '借款人签字及时间', None), | ||
| 1419 | |||
| 1420 | '借款人姓名': (2, 2, '借款人及抵押人', 'name'), | ||
| 1421 | '借款人证件号': (2, 2, '借款人及抵押人', 'id'), | ||
| 1422 | '共借人姓名': (2, 2, '共同借款人及共同抵押人', 'name'), | ||
| 1423 | '共借人证件号': (2, 2, '共同借款人及共同抵押人', 'id'), | ||
| 1424 | '保证人姓名1': (2, 2, '保证人1', 'name'), | ||
| 1425 | '保证人证件号1': (2, 2, '保证人1', 'id'), | ||
| 1426 | '保证人姓名2': (2, 2, '保证人2', 'name'), | ||
| 1427 | '保证人证件号2': (2, 2, '保证人2', 'id'), | ||
| 1428 | |||
| 1429 | '主借人签字': (7, 8, '主借人签字', '签字'), | ||
| 1430 | '主借人日期': (7, 8, '主借人签字', '日期'), | ||
| 1431 | '共借人签字': (7, 8, '共借人签字', '签字'), | ||
| 1432 | '共借人日期': (7, 8, '共借人签字', '日期'), | ||
| 1433 | '保证人签字1': (7, 8, '保证人1签字', '签字'), | ||
| 1434 | '保证人日期1': (7, 8, '保证人1签字', '日期'), | ||
| 1435 | '保证人签字2': (7, 8, '保证人2签字', '签字'), | ||
| 1436 | '保证人日期2': (7, 8, '保证人2签字', '日期'), | ||
| 1437 | '见证人签字': (7, 8, '见证人签字', '签字'), | ||
| 1438 | '见证人日期': (7, 8, '见证人签字', '日期'), | ||
| 1439 | |||
| 1440 | '还款计划表': (3, 3, '还款计划表', None), | ||
| 1440 | } | 1441 | } |
| 1441 | 1442 | ||
| 1442 | SE_AFC_CON_FIELD = ['合同编号-每页', '所购车辆价格-小写-重要条款', '车架号-重要条款', '贷款本金金额-重要条款', '贷款期限-重要条款', | 1443 | SE_AFC_CON_FIELD = ['合同编号-每页', '所购车辆价格-小写-重要条款', '车架号-重要条款', '贷款本金金额-重要条款', '贷款期限-重要条款', | ... | ... |
| ... | @@ -282,6 +282,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -282,6 +282,7 @@ class Command(BaseCommand, LoggerMixin): |
| 282 | elif isinstance(sub_value[text_key], str): | 282 | elif isinstance(sub_value[text_key], str): |
| 283 | page_compare_dict[key][sub_key] = sub_value[text_key] | 283 | page_compare_dict[key][sub_key] = sub_value[text_key] |
| 284 | 284 | ||
| 285 | contract_result_compare.setdefault(classify, dict())[consts.ASP_KEY] = contract_dict.get(consts.ASP_KEY, False) | ||
| 285 | contract_result_compare.setdefault(classify, dict())[page_num_only] = page_compare_dict | 286 | contract_result_compare.setdefault(classify, dict())[page_num_only] = page_compare_dict |
| 286 | 287 | ||
| 287 | 288 | ||
| ... | @@ -858,9 +859,12 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -858,9 +859,12 @@ class Command(BaseCommand, LoggerMixin): |
| 858 | for classify, page_info_dict in contract_result_compare.items(): | 859 | for classify, page_info_dict in contract_result_compare.items(): |
| 859 | res = {} | 860 | res = {} |
| 860 | if classify == consts.CONTRACT_CLASSIFY: | 861 | if classify == consts.CONTRACT_CLASSIFY: |
| 861 | for key, (pno, key1, key2) in consts.SE_AFC_CON_MAP.items(): | 862 | is_asp = page_info_dict.get(consts.ASP_KEY, False) |
| 863 | for key, (pno_not_asp, pno_asp, key1, key2) in consts.SE_AFC_CON_MAP.items(): | ||
| 864 | pno = pno_asp if is_asp else pno_not_asp | ||
| 862 | if pno is None: | 865 | if pno is None: |
| 863 | for i in range(1, 9): | 866 | end_idx = 9 if is_asp else 8 |
| 867 | for i in range(1, end_idx): | ||
| 864 | res.setdefault(key, list()).append(page_info_dict.get(str(i), {}).get(key1, '')) | 868 | res.setdefault(key, list()).append(page_info_dict.get(str(i), {}).get(key1, '')) |
| 865 | elif key2 is None: | 869 | elif key2 is None: |
| 866 | res[key] = page_info_dict.get(str(pno), {}).get(key1, '') | 870 | res[key] = page_info_dict.get(str(pno), {}).get(key1, '') |
| ... | @@ -1144,6 +1148,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -1144,6 +1148,7 @@ class Command(BaseCommand, LoggerMixin): |
| 1144 | if isinstance(page_num, str) and page_num.startswith('page_'): | 1148 | if isinstance(page_num, str) and page_num.startswith('page_'): |
| 1145 | page_res[page_num] = { | 1149 | page_res[page_num] = { |
| 1146 | 'classify': int(classify_1_str), | 1150 | 'classify': int(classify_1_str), |
| 1151 | "is_asp": ocr_result.get('is_asp', False), | ||
| 1147 | 'page_num': page_num, | 1152 | 'page_num': page_num, |
| 1148 | 'page_info': page_info | 1153 | 'page_info': page_info |
| 1149 | } | 1154 | } | ... | ... |
| ... | @@ -1121,15 +1121,19 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1121,15 +1121,19 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
| 1121 | (consts.SE_AFC_CON_FIELD[17], schedule_list_str), | 1121 | (consts.SE_AFC_CON_FIELD[17], schedule_list_str), |
| 1122 | ] | 1122 | ] |
| 1123 | 1123 | ||
| 1124 | # asp_list = [] | 1124 | asp_list = [] |
| 1125 | # for asp_info in cms_info.get('associatedServices', []): | 1125 | for asp_info in cms_info.get('associatedServices', []): |
| 1126 | # asp_list.append( | 1126 | asp_list.append( |
| 1127 | # ( | 1127 | ( |
| 1128 | # asp_info.get('associatedServices', ''), | 1128 | asp_info.get('associatedServices', ''), |
| 1129 | # asp_info.get('price', 0.0), | 1129 | asp_info.get('price', 0.0), |
| 1130 | # asp_info.get('financed', 0.0) | 1130 | asp_info.get('financed', 0.0) |
| 1131 | # ) | 1131 | ) |
| 1132 | # ) | 1132 | ) |
| 1133 | |||
| 1134 | if len(asp_list) == 0: | ||
| 1135 | afc_contract_input.pop(5) | ||
| 1136 | afc_contract_input.pop(6) | ||
| 1133 | 1137 | ||
| 1134 | # if len(asp_list) > 0: | 1138 | # if len(asp_list) > 0: |
| 1135 | # fin_total = 0 | 1139 | # fin_total = 0 | ... | ... |
-
Please register or sign in to post a comment