hil contract part 1
Showing
4 changed files
with
128 additions
and
64 deletions
... | @@ -1180,6 +1180,9 @@ JYPZ_OCR_FIELD = 'jypz_ocr' | ... | @@ -1180,6 +1180,9 @@ JYPZ_OCR_FIELD = 'jypz_ocr' |
1180 | HT_FIELD = 'ht_ocr' | 1180 | HT_FIELD = 'ht_ocr' |
1181 | BD_FIELD = 'bd_ocr' | 1181 | BD_FIELD = 'bd_ocr' |
1182 | BS_FIELD = 'bss_ocr' | 1182 | BS_FIELD = 'bss_ocr' |
1183 | HIL_CONTRACT_1_FIELD = 'hil_contract_1_ocr' | ||
1184 | HIL_CONTRACT_2_FIELD = 'hil_contract_2_ocr' | ||
1185 | HIL_CONTRACT_3_FIELD = 'hil_contract_3_ocr' | ||
1183 | BS_CLASSIFY = 10087 | 1186 | BS_CLASSIFY = 10087 |
1184 | 1187 | ||
1185 | RESULT_MAPPING = { | 1188 | RESULT_MAPPING = { |
... | @@ -1200,6 +1203,9 @@ RESULT_MAPPING = { | ... | @@ -1200,6 +1203,9 @@ RESULT_MAPPING = { |
1200 | CONTRACT_CLASSIFY: HT_FIELD, | 1203 | CONTRACT_CLASSIFY: HT_FIELD, |
1201 | INSURANCE_CLASSIFY: BD_FIELD, | 1204 | INSURANCE_CLASSIFY: BD_FIELD, |
1202 | BS_CLASSIFY: BS_FIELD, | 1205 | BS_CLASSIFY: BS_FIELD, |
1206 | HIL_CONTRACT_1_CLASSIFY: HIL_CONTRACT_1_FIELD, | ||
1207 | HIL_CONTRACT_2_CLASSIFY: HIL_CONTRACT_2_FIELD, | ||
1208 | HIL_CONTRACT_3_CLASSIFY: HIL_CONTRACT_3_FIELD, | ||
1203 | } | 1209 | } |
1204 | 1210 | ||
1205 | CA_ADD_COMPARE_FIELDS = (IC_OCR_FIELD, BL_OCR_FIELD, BS_FIELD) | 1211 | CA_ADD_COMPARE_FIELDS = (IC_OCR_FIELD, BL_OCR_FIELD, BS_FIELD) |
... | @@ -1220,6 +1226,9 @@ COMPARE_FIELDS = (MVI_OCR_FIELD, | ... | @@ -1220,6 +1226,9 @@ COMPARE_FIELDS = (MVI_OCR_FIELD, |
1220 | HT_FIELD, | 1226 | HT_FIELD, |
1221 | BD_FIELD, | 1227 | BD_FIELD, |
1222 | BS_FIELD, | 1228 | BS_FIELD, |
1229 | HIL_CONTRACT_1_FIELD, | ||
1230 | HIL_CONTRACT_2_FIELD, | ||
1231 | HIL_CONTRACT_3_FIELD, | ||
1223 | ) | 1232 | ) |
1224 | 1233 | ||
1225 | # 身份证 | 1234 | # 身份证 |
... | @@ -1514,6 +1523,9 @@ JYPZ_EN = 'Used Car Document' | ... | @@ -1514,6 +1523,9 @@ JYPZ_EN = 'Used Car Document' |
1514 | AFC_CONTRACT_EN = 'AFC Contract' | 1523 | AFC_CONTRACT_EN = 'AFC Contract' |
1515 | BD_EN = 'Insurance' | 1524 | BD_EN = 'Insurance' |
1516 | BS_EN = 'Bank Statement' | 1525 | BS_EN = 'Bank Statement' |
1526 | HIL_CONTRACT_1_EN = '售后回租合同' | ||
1527 | HIL_CONTRACT_2_EN = '车辆租赁抵押合同' | ||
1528 | HIL_CONTRACT_3_EN = '车辆处置协议' | ||
1517 | 1529 | ||
1518 | SKIP_CARD = {SME_BL_EN} | 1530 | SKIP_CARD = {SME_BL_EN} |
1519 | 1531 | ||
... | @@ -1750,6 +1762,9 @@ SE_COMPARE_FIELD = { | ... | @@ -1750,6 +1762,9 @@ SE_COMPARE_FIELD = { |
1750 | AFC_CONTRACT_EN: (HT_FIELD, HT_COMPARE_LOGIC, False), | 1762 | AFC_CONTRACT_EN: (HT_FIELD, HT_COMPARE_LOGIC, False), |
1751 | BD_EN: (BD_FIELD, BD_COMPARE_LOGIC, False), | 1763 | BD_EN: (BD_FIELD, BD_COMPARE_LOGIC, False), |
1752 | BS_EN: (BS_FIELD, BS_COMPARE_LOGIC, False), | 1764 | BS_EN: (BS_FIELD, BS_COMPARE_LOGIC, False), |
1765 | HIL_CONTRACT_1_EN: (HIL_CONTRACT_1_FIELD, HIL_CONTRACT_1_COMPARE_LOGIC, False), | ||
1766 | HIL_CONTRACT_2_EN: (HIL_CONTRACT_1_FIELD, HIL_CONTRACT_2_COMPARE_LOGIC, False), | ||
1767 | HIL_CONTRACT_3_EN: (HIL_CONTRACT_1_FIELD, HIL_CONTRACT_3_COMPARE_LOGIC, False), | ||
1753 | } | 1768 | } |
1754 | 1769 | ||
1755 | 1770 | ||
... | @@ -2007,4 +2022,4 @@ HIL_CONTRACT_TYPE_MAP = { | ... | @@ -2007,4 +2022,4 @@ HIL_CONTRACT_TYPE_MAP = { |
2007 | str(HIL_CONTRACT_1_CLASSIFY): 0, | 2022 | str(HIL_CONTRACT_1_CLASSIFY): 0, |
2008 | str(HIL_CONTRACT_2_CLASSIFY): 2, | 2023 | str(HIL_CONTRACT_2_CLASSIFY): 2, |
2009 | str(HIL_CONTRACT_3_CLASSIFY): 1, | 2024 | str(HIL_CONTRACT_3_CLASSIFY): 1, |
2010 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
2025 | } | ... | ... |
... | @@ -316,6 +316,9 @@ class AFCOCRResult(models.Model): | ... | @@ -316,6 +316,9 @@ class AFCOCRResult(models.Model): |
316 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") | 316 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") |
317 | bd_ocr = models.TextField(null=True, verbose_name="保单") | 317 | bd_ocr = models.TextField(null=True, verbose_name="保单") |
318 | bss_ocr = models.TextField(null=True, verbose_name="银行流水") | 318 | bss_ocr = models.TextField(null=True, verbose_name="银行流水") |
319 | hil_contract_1_ocr = models.TextField(null=True, verbose_name="HIL合同1") | ||
320 | hil_contract_2_ocr = models.TextField(null=True, verbose_name="HIL合同2") | ||
321 | hil_contract_3_ocr = models.TextField(null=True, verbose_name="HIL合同3") | ||
319 | 322 | ||
320 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') | 323 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') |
321 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | 324 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') |
... | @@ -348,6 +351,9 @@ class HILOCRResult(models.Model): | ... | @@ -348,6 +351,9 @@ class HILOCRResult(models.Model): |
348 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") | 351 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") |
349 | bd_ocr = models.TextField(null=True, verbose_name="保单") | 352 | bd_ocr = models.TextField(null=True, verbose_name="保单") |
350 | bss_ocr = models.TextField(null=True, verbose_name="银行流水") | 353 | bss_ocr = models.TextField(null=True, verbose_name="银行流水") |
354 | hil_contract_1_ocr = models.TextField(null=True, verbose_name="HIL合同1") | ||
355 | hil_contract_2_ocr = models.TextField(null=True, verbose_name="HIL合同2") | ||
356 | hil_contract_3_ocr = models.TextField(null=True, verbose_name="HIL合同3") | ||
351 | 357 | ||
352 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') | 358 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') |
353 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | 359 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') |
... | @@ -379,6 +385,9 @@ class AFCSEOCRResult(models.Model): | ... | @@ -379,6 +385,9 @@ class AFCSEOCRResult(models.Model): |
379 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") | 385 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") |
380 | bd_ocr = models.TextField(null=True, verbose_name="保单") | 386 | bd_ocr = models.TextField(null=True, verbose_name="保单") |
381 | bss_ocr = models.TextField(null=True, verbose_name="银行流水") | 387 | bss_ocr = models.TextField(null=True, verbose_name="银行流水") |
388 | hil_contract_1_ocr = models.TextField(null=True, verbose_name="HIL合同1") | ||
389 | hil_contract_2_ocr = models.TextField(null=True, verbose_name="HIL合同2") | ||
390 | hil_contract_3_ocr = models.TextField(null=True, verbose_name="HIL合同3") | ||
382 | 391 | ||
383 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') | 392 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') |
384 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | 393 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') |
... | @@ -411,6 +420,9 @@ class HILSEOCRResult(models.Model): | ... | @@ -411,6 +420,9 @@ class HILSEOCRResult(models.Model): |
411 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") | 420 | ht_ocr = models.TextField(null=True, verbose_name="AFC合同") |
412 | bd_ocr = models.TextField(null=True, verbose_name="保单") | 421 | bd_ocr = models.TextField(null=True, verbose_name="保单") |
413 | bss_ocr = models.TextField(null=True, verbose_name="银行流水") | 422 | bss_ocr = models.TextField(null=True, verbose_name="银行流水") |
423 | hil_contract_1_ocr = models.TextField(null=True, verbose_name="HIL合同1") | ||
424 | hil_contract_2_ocr = models.TextField(null=True, verbose_name="HIL合同2") | ||
425 | hil_contract_3_ocr = models.TextField(null=True, verbose_name="HIL合同3") | ||
414 | 426 | ||
415 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') | 427 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') |
416 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | 428 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | ... | ... |
... | @@ -1191,73 +1191,75 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1191,73 +1191,75 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1191 | compare_info['other'] = other_info | 1191 | compare_info['other'] = other_info |
1192 | 1192 | ||
1193 | if application_entity in consts.HIL_SET: | 1193 | if application_entity in consts.HIL_SET: |
1194 | return compare_info, cms_info.get('applicationVersion', 1) | 1194 | # HIL合同----------------------------------------------------------------------------------------- |
1195 | |||
1196 | # AFC合同----------------------------------------------------------------------------------------------------------- | ||
1197 | contract_info = {} | ||
1198 | |||
1199 | schedule_list = [] | ||
1200 | for schedule_dict in cms_info.get('paymentSchedule', []): | ||
1201 | tmp_str = "{1}{0}{2}".format(consts.SPLIT_STR, str(schedule_dict.get('no', '')), | ||
1202 | str(schedule_dict.get('grossRentalAmount', ''))) | ||
1203 | schedule_list.append(tmp_str) | ||
1204 | schedule_list_str = consts.SCHEDULE_SPLIT_STR.join(schedule_list) | ||
1205 | |||
1206 | vehicle_principal_str = str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0')) | ||
1207 | afc_contract_input = [ | ||
1208 | (consts.SE_AFC_CON_FIELD[0], full_no), | ||
1209 | (consts.SE_AFC_CON_FIELD[1], amount), | ||
1210 | (consts.SE_AFC_CON_FIELD[2], vin_no), | ||
1211 | (consts.SE_AFC_CON_FIELD[3], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))), | ||
1212 | (consts.SE_AFC_CON_FIELD[4], str(cms_info.get('terms', '0'))), | ||
1213 | (consts.SE_AFC_CON_FIELD[5], vehicle_principal_str), | ||
1214 | (consts.SE_AFC_CON_FIELD[6], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))), | ||
1215 | (consts.SE_AFC_CON_FIELD[7], amount), | ||
1216 | (consts.SE_AFC_CON_FIELD[8], vin_no), | ||
1217 | (consts.SE_AFC_CON_FIELD[9], cms_info.get('dealerName', '')), | ||
1218 | (consts.SE_AFC_CON_FIELD[10], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))), | ||
1219 | (consts.SE_AFC_CON_FIELD[11], vehicle_principal_str), | ||
1220 | (consts.SE_AFC_CON_FIELD[12], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))), | ||
1221 | (consts.SE_AFC_CON_FIELD[13], str(cms_info.get('terms', '0'))), | ||
1222 | (consts.SE_AFC_CON_FIELD[14], account_no), | ||
1223 | (consts.SE_AFC_CON_FIELD[15], cms_info.get('bankAccountDetails', {}).get('accountHolderName', '')), | ||
1224 | (consts.SE_AFC_CON_FIELD[16], bank_name), | ||
1225 | (consts.SE_AFC_CON_FIELD[17], schedule_list_str), | ||
1226 | ] | ||
1227 | 1195 | ||
1228 | if is_asp: | 1196 | return compare_info, cms_info.get('applicationVersion', 1) |
1229 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[20], asp_list)) | ||
1230 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[22], asp_list)) | ||
1231 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[21], gzs_list)) | ||
1232 | else: | 1197 | else: |
1233 | afc_contract_input.pop(5) | 1198 | # AFC合同----------------------------------------------------------------------------------------------------------- |
1234 | afc_contract_input.pop(5) | 1199 | contract_info = {} |
1235 | afc_contract_input.pop(9) | 1200 | |
1236 | afc_contract_input.pop(9) | 1201 | schedule_list = [] |
1237 | 1202 | for schedule_dict in cms_info.get('paymentSchedule', []): | |
1238 | # '借款人签字及时间', 'Borrower', 0, 0, True | 1203 | tmp_str = "{1}{0}{2}".format(consts.SPLIT_STR, str(schedule_dict.get('no', '')), |
1239 | online_sign = cms_info.get('contractSource', 'Online Sign') == 'Online Sign' | 1204 | str(schedule_dict.get('grossRentalAmount', ''))) |
1240 | for key, app_type, id_idx, field_idx, is_force, e_write in consts.ROLE_LIST: | 1205 | schedule_list.append(tmp_str) |
1241 | if not e_write and not online_sign: | 1206 | schedule_list_str = consts.SCHEDULE_SPLIT_STR.join(schedule_list) |
1242 | continue | 1207 | |
1243 | is_find = False | 1208 | vehicle_principal_str = str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0')) |
1244 | if app_type in main_role_info: | 1209 | afc_contract_input = [ |
1245 | if len(main_role_info[app_type]) >= id_idx+1: | 1210 | (consts.SE_AFC_CON_FIELD[0], full_no), |
1246 | is_find = True | 1211 | (consts.SE_AFC_CON_FIELD[1], amount), |
1247 | if isinstance(field_idx, int): | 1212 | (consts.SE_AFC_CON_FIELD[2], vin_no), |
1248 | afc_contract_input.append((key, main_role_info[app_type][id_idx][field_idx])) | 1213 | (consts.SE_AFC_CON_FIELD[3], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))), |
1249 | else: | 1214 | (consts.SE_AFC_CON_FIELD[4], str(cms_info.get('terms', '0'))), |
1250 | afc_contract_input.append((key, field_idx)) | 1215 | (consts.SE_AFC_CON_FIELD[5], vehicle_principal_str), |
1251 | if not is_find and is_force: | 1216 | (consts.SE_AFC_CON_FIELD[6], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))), |
1252 | afc_contract_input.append((key, empty_str)) | 1217 | (consts.SE_AFC_CON_FIELD[7], amount), |
1218 | (consts.SE_AFC_CON_FIELD[8], vin_no), | ||
1219 | (consts.SE_AFC_CON_FIELD[9], cms_info.get('dealerName', '')), | ||
1220 | (consts.SE_AFC_CON_FIELD[10], str(cms_info.get('financialInformation', {}).get('originationPrincipal', '0.0'))), | ||
1221 | (consts.SE_AFC_CON_FIELD[11], vehicle_principal_str), | ||
1222 | (consts.SE_AFC_CON_FIELD[12], str(cms_info.get('financialInformation', {}).get('associatedServicePrincipal', '0.0'))), | ||
1223 | (consts.SE_AFC_CON_FIELD[13], str(cms_info.get('terms', '0'))), | ||
1224 | (consts.SE_AFC_CON_FIELD[14], account_no), | ||
1225 | (consts.SE_AFC_CON_FIELD[15], cms_info.get('bankAccountDetails', {}).get('accountHolderName', '')), | ||
1226 | (consts.SE_AFC_CON_FIELD[16], bank_name), | ||
1227 | (consts.SE_AFC_CON_FIELD[17], schedule_list_str), | ||
1228 | ] | ||
1229 | |||
1230 | if is_asp: | ||
1231 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[20], asp_list)) | ||
1232 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[22], asp_list)) | ||
1233 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[21], gzs_list)) | ||
1234 | else: | ||
1235 | afc_contract_input.pop(5) | ||
1236 | afc_contract_input.pop(5) | ||
1237 | afc_contract_input.pop(9) | ||
1238 | afc_contract_input.pop(9) | ||
1239 | |||
1240 | # '借款人签字及时间', 'Borrower', 0, 0, True | ||
1241 | online_sign = cms_info.get('contractSource', 'Online Sign') == 'Online Sign' | ||
1242 | for key, app_type, id_idx, field_idx, is_force, e_write in consts.ROLE_LIST: | ||
1243 | if not e_write and not online_sign: | ||
1244 | continue | ||
1245 | is_find = False | ||
1246 | if app_type in main_role_info: | ||
1247 | if len(main_role_info[app_type]) >= id_idx+1: | ||
1248 | is_find = True | ||
1249 | if isinstance(field_idx, int): | ||
1250 | afc_contract_input.append((key, main_role_info[app_type][id_idx][field_idx])) | ||
1251 | else: | ||
1252 | afc_contract_input.append((key, field_idx)) | ||
1253 | if not is_find and is_force: | ||
1254 | afc_contract_input.append((key, empty_str)) | ||
1253 | 1255 | ||
1254 | if online_sign: | 1256 | if online_sign: |
1255 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[18], consts.SE_STAMP_VALUE)) | 1257 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[18], consts.SE_STAMP_VALUE)) |
1256 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[19], empty_str)) | 1258 | afc_contract_input.append((consts.SE_AFC_CON_FIELD[19], empty_str)) |
1257 | 1259 | ||
1258 | contract_info[consts.AFC_CONTRACT_EN] = afc_contract_input | 1260 | contract_info[consts.AFC_CONTRACT_EN] = afc_contract_input |
1259 | compare_info['contract'] = contract_info | 1261 | compare_info['contract'] = contract_info |
1260 | return compare_info, cms_info.get('applicationVersion', 1) | 1262 | return compare_info, cms_info.get('applicationVersion', 1) |
1261 | 1263 | ||
1262 | 1264 | ||
1263 | def get_se_compare_info(last_obj, application_entity, detect_list): | 1265 | def get_se_compare_info(last_obj, application_entity, detect_list): | ... | ... |
src/common/tools/mssql_script12.py
0 → 100644
1 | import pyodbc | ||
2 | |||
3 | hil_sql = """ | ||
4 | ALTER TABLE hil_ocr_result ADD hil_contract_1_ocr nvarchar(max); | ||
5 | ALTER TABLE hil_ocr_result ADD hil_contract_2_ocr nvarchar(max); | ||
6 | ALTER TABLE hil_ocr_result ADD hil_contract_3_ocr nvarchar(max); | ||
7 | ALTER TABLE hil_se_ocr_result ADD hil_contract_1_ocr nvarchar(max); | ||
8 | ALTER TABLE hil_se_ocr_result ADD hil_contract_2_ocr nvarchar(max); | ||
9 | ALTER TABLE hil_se_ocr_result ADD hil_contract_3_ocr nvarchar(max); | ||
10 | """ | ||
11 | |||
12 | afc_sql = """ | ||
13 | ALTER TABLE afc_ocr_result ADD hil_contract_1_ocr nvarchar(max); | ||
14 | ALTER TABLE afc_ocr_result ADD hil_contract_2_ocr nvarchar(max); | ||
15 | ALTER TABLE afc_ocr_result ADD hil_contract_3_ocr nvarchar(max); | ||
16 | ALTER TABLE afc_se_ocr_result ADD hil_contract_1_ocr nvarchar(max); | ||
17 | ALTER TABLE afc_se_ocr_result ADD hil_contract_2_ocr nvarchar(max); | ||
18 | ALTER TABLE afc_se_ocr_result ADD hil_contract_3_ocr nvarchar(max); | ||
19 | """ | ||
20 | |||
21 | hil_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True) | ||
22 | |||
23 | hil_cursor = hil_cnxn.cursor() | ||
24 | hil_cursor.execute(hil_sql) | ||
25 | |||
26 | hil_cursor.close() | ||
27 | hil_cnxn.close() | ||
28 | |||
29 | afc_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True) | ||
30 | |||
31 | afc_cursor = afc_cnxn.cursor() | ||
32 | afc_cursor.execute(afc_sql) | ||
33 | |||
34 | afc_cursor.close() | ||
35 | afc_cnxn.close() |
-
Please register or sign in to post a comment