c041e431 by 周伟奇

Merge branch 'feature/gb_excel' into feature/0611

2 parents 49a5299a 9be470c1
...@@ -749,8 +749,10 @@ MVC_FIELD_ORDER_1_2 = (('1.机动车所有人/身份证名称/号码', '机动 ...@@ -749,8 +749,10 @@ MVC_FIELD_ORDER_1_2 = (('1.机动车所有人/身份证名称/号码', '机动
749 ('2.登记机关', '登记机关'), 749 ('2.登记机关', '登记机关'),
750 ('编号', '机动车登记证书编号'),) 750 ('编号', '机动车登记证书编号'),)
751 MVC_FIELD_ORDER_3_4 = ( 751 MVC_FIELD_ORDER_3_4 = (
752 ('机动车登记证书编号', '机动车登记证书编号'),
752 ('姓名/名称', '姓名/名称'), 753 ('姓名/名称', '姓名/名称'),
753 ('身份证明名称/号码', '身份证明名称/号码'), 754 ('身份证明名称/号码', '身份证明名称/号码'),
755 ('转入地车辆管理所名称', '转入地车辆管理所名称'),
754 ('转移登记日期', '转移登记日期'), 756 ('转移登记日期', '转移登记日期'),
755 ('抵押权人姓名/名称', '抵押权人姓名/名称'), 757 ('抵押权人姓名/名称', '抵押权人姓名/名称'),
756 ('抵押身份证明名称/号码', '抵押身份证明名称/号码'), 758 ('抵押身份证明名称/号码', '抵押身份证明名称/号码'),
...@@ -793,8 +795,10 @@ MVC_SE_FIELD_ORDER_1_2 = (('9.车辆识别代号/车架号', '车辆识别代号 ...@@ -793,8 +795,10 @@ MVC_SE_FIELD_ORDER_1_2 = (('9.车辆识别代号/车架号', '车辆识别代号
793 ('4.机动车登记编号', '机动车登记编号'), 795 ('4.机动车登记编号', '机动车登记编号'),
794 ('编号', '机动车登记证书编号'),) 796 ('编号', '机动车登记证书编号'),)
795 MVC_SE_FIELD_ORDER_3_4 = ( 797 MVC_SE_FIELD_ORDER_3_4 = (
798 ('机动车登记证书编号', '机动车登记证书编号'),
796 ('姓名/名称', '姓名/名称'), 799 ('姓名/名称', '姓名/名称'),
797 ('身份证明名称/号码', '身份证明名称/号码'), 800 ('身份证明名称/号码', '身份证明名称/号码'),
801 ('转入地车辆管理所名称', '转入地车辆管理所名称'),
798 ('转移登记日期', '转移登记日期'), 802 ('转移登记日期', '转移登记日期'),
799 ('抵押权人姓名/名称', '抵押权人姓名/名称'), 803 ('抵押权人姓名/名称', '抵押权人姓名/名称'),
800 ('抵押身份证明名称/号码', '抵押身份证明名称/号码'), 804 ('抵押身份证明名称/号码', '抵押身份证明名称/号码'),
......
...@@ -78,12 +78,14 @@ class Command(BaseCommand, LoggerMixin): ...@@ -78,12 +78,14 @@ class Command(BaseCommand, LoggerMixin):
78 if mvc_page == 'VehicleRegArea': 78 if mvc_page == 'VehicleRegArea':
79 mvc_dict['姓名/名称'] = [] 79 mvc_dict['姓名/名称'] = []
80 mvc_dict['身份证明名称/号码'] = [] 80 mvc_dict['身份证明名称/号码'] = []
81 mvc_dict['转入地车辆管理所名称'] = []
81 mvc_dict['转移登记日期'] = [] 82 mvc_dict['转移登记日期'] = []
82 mvc_dict['抵押权人姓名/名称'] = [] 83 mvc_dict['抵押权人姓名/名称'] = []
83 mvc_dict['抵押身份证明名称/号码'] = [] 84 mvc_dict['抵押身份证明名称/号码'] = []
84 mvc_dict['抵押登记日期'] = [] 85 mvc_dict['抵押登记日期'] = []
85 mvc_dict['解除抵押日期'] = [] 86 mvc_dict['解除抵押日期'] = []
86 mvc_res = mvc_dict.pop('results', {}) 87 mvc_res = mvc_dict.pop('results', {})
88 mvc_dict['机动车登记证书编号'] = mvc_res.get('register_no', {}).get('words', '')
87 for register_info in mvc_res.get('register_info', []): 89 for register_info in mvc_res.get('register_info', []):
88 if register_info.get('register_type', 0) == 2: 90 if register_info.get('register_type', 0) == 2:
89 mvc_dict['姓名/名称'].append( 91 mvc_dict['姓名/名称'].append(
...@@ -92,6 +94,8 @@ class Command(BaseCommand, LoggerMixin): ...@@ -92,6 +94,8 @@ class Command(BaseCommand, LoggerMixin):
92 register_info.get('details', {}).get('idno', {}).get('words', '')) 94 register_info.get('details', {}).get('idno', {}).get('words', ''))
93 mvc_dict['转移登记日期'].append( 95 mvc_dict['转移登记日期'].append(
94 register_info.get('details', {}).get('date', {}).get('words', '')) 96 register_info.get('details', {}).get('date', {}).get('words', ''))
97 mvc_dict['转入地车辆管理所名称'].append(
98 register_info.get('details', {}).get('office_name', {}).get('words', ''))
95 elif register_info.get('register_type', 0) == 0: 99 elif register_info.get('register_type', 0) == 0:
96 mvc_dict['抵押权人姓名/名称'].append( 100 mvc_dict['抵押权人姓名/名称'].append(
97 register_info.get('details', {}).get('name', {}).get('words', '')) 101 register_info.get('details', {}).get('name', {}).get('words', ''))
......
...@@ -219,12 +219,14 @@ class Command(BaseCommand, LoggerMixin): ...@@ -219,12 +219,14 @@ class Command(BaseCommand, LoggerMixin):
219 if mvc_page == 'VehicleRegArea': 219 if mvc_page == 'VehicleRegArea':
220 mvc_dict['姓名/名称'] = [] 220 mvc_dict['姓名/名称'] = []
221 mvc_dict['身份证明名称/号码'] = [] 221 mvc_dict['身份证明名称/号码'] = []
222 mvc_dict['转入地车辆管理所名称'] = []
222 mvc_dict['转移登记日期'] = [] 223 mvc_dict['转移登记日期'] = []
223 mvc_dict['抵押权人姓名/名称'] = [] 224 mvc_dict['抵押权人姓名/名称'] = []
224 mvc_dict['抵押身份证明名称/号码'] = [] 225 mvc_dict['抵押身份证明名称/号码'] = []
225 mvc_dict['抵押登记日期'] = [] 226 mvc_dict['抵押登记日期'] = []
226 mvc_dict['解除抵押日期'] = [] 227 mvc_dict['解除抵押日期'] = []
227 mvc_res = mvc_dict.pop('results', {}) 228 mvc_res = mvc_dict.pop('results', {})
229 mvc_dict['机动车登记证书编号'] = mvc_res.get('register_no', {}).get('words', '')
228 for register_info in mvc_res.get('register_info', []): 230 for register_info in mvc_res.get('register_info', []):
229 if register_info.get('register_type', 0) == 2: 231 if register_info.get('register_type', 0) == 2:
230 mvc_dict['姓名/名称'].append( 232 mvc_dict['姓名/名称'].append(
...@@ -233,6 +235,8 @@ class Command(BaseCommand, LoggerMixin): ...@@ -233,6 +235,8 @@ class Command(BaseCommand, LoggerMixin):
233 register_info.get('details', {}).get('idno', {}).get('words', '')) 235 register_info.get('details', {}).get('idno', {}).get('words', ''))
234 mvc_dict['转移登记日期'].append( 236 mvc_dict['转移登记日期'].append(
235 register_info.get('details', {}).get('date', {}).get('words', '')) 237 register_info.get('details', {}).get('date', {}).get('words', ''))
238 mvc_dict['转入地车辆管理所名称'].append(
239 register_info.get('details', {}).get('office_name', {}).get('words', ''))
236 elif register_info.get('register_type', 0) == 0: 240 elif register_info.get('register_type', 0) == 0:
237 mvc_dict['抵押权人姓名/名称'].append( 241 mvc_dict['抵押权人姓名/名称'].append(
238 register_info.get('details', {}).get('name', {}).get('words', '')) 242 register_info.get('details', {}).get('name', {}).get('words', ''))
...@@ -331,7 +335,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -331,7 +335,7 @@ class Command(BaseCommand, LoggerMixin):
331 ic_merge = False 335 ic_merge = False
332 rp_merge = False 336 rp_merge = False
333 337
334 for classify in (consts.IC_CLASSIFY, consts.MVI_CLASSIFY): 338 for classify in (consts.IC_CLASSIFY, consts.MVI_CLASSIFY, consts.MVC_CLASSIFY):
335 339
336 license_list = license_summary.get(classify) 340 license_list = license_summary.get(classify)
337 341
...@@ -388,8 +392,20 @@ class Command(BaseCommand, LoggerMixin): ...@@ -388,8 +392,20 @@ class Command(BaseCommand, LoggerMixin):
388 price = round(price_total * 100 / (rate + 100), 2) 392 price = round(price_total * 100 / (rate + 100), 2)
389 license_dict['不含税价(逻辑计算)'] = price 393 license_dict['不含税价(逻辑计算)'] = price
390 394
391 return ic_merge, rp_merge 395 if classify == consts.MVC_CLASSIFY: # 机动车登记证先1/2页,后3/4页
396 key, _, _ = consts.FIELD_ORDER_MAP.get(classify)
397 page_1_2 = []
398 page_3_4 = []
399 for license_dict in license_list:
400 if key in license_dict:
401 page_3_4.append(license_dict)
402 else:
403 page_1_2.append(license_dict)
404 page_1_2.extend(page_3_4)
405 license_summary[classify] = page_1_2
406 page_1_2 = page_3_4 = None
392 407
408 return ic_merge, rp_merge
393 409
394 def parse_img_path(self, img_path): 410 def parse_img_path(self, img_path):
395 img_name, _ = os.path.splitext(os.path.basename(img_path)) 411 img_name, _ = os.path.splitext(os.path.basename(img_path))
......
1 import pyodbc
2
3 hil_sql = """
4
5 """
6
7 afc_sql = """
8
9 """
10
11 hil_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True)
12
13 hil_cursor = hil_cnxn.cursor()
14 hil_cursor.execute(hil_sql)
15
16 hil_cursor.close()
17 hil_cnxn.close()
18
19 afc_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True)
20
21 afc_cursor = afc_cnxn.cursor()
22 afc_cursor.execute(afc_sql)
23
24 afc_cursor.close()
25 afc_cnxn.close()
1 import pyodbc
2
3 hil_sql = """
4 create table hil_comparison_info
5 (
6 id bigint identity primary key,
7 uniq_seq nvarchar(128) not null,
8 application_id nvarchar(64) not null,
9 customer_type nvarchar(16) not null,
10 application_version tinyint default 0 not null,
11 vehicle_status nvarchar(16) not null,
12 individual_cus_info nvarchar(max) not null,
13 usedcar_info nvarchar(max),
14 corporate_cus_info nvarchar(max),
15 update_time datetime not null,
16 create_time datetime not null
17 );
18
19 create index hil_comparison_info_application_id_index
20 on hil_comparison_info (application_id);
21
22 create index hil_comparison_info_create_time_index
23 on hil_comparison_info (create_time);
24
25 create index hil_comparison_info_uniq_seq_index
26 on hil_comparison_info (uniq_seq);
27
28 create table hil_ocr_result
29 (
30 id int identity primary key,
31 application_id nvarchar(64) not null,
32 bs_ocr nvarchar(max),
33 mvi_ocr nvarchar(max),
34 ic_ocr nvarchar(max),
35 rp_ocr nvarchar(max),
36 bc_ocr nvarchar(max),
37 bl_ocr nvarchar(max),
38 uci_ocr nvarchar(max),
39 eep_ocr nvarchar(max),
40 dl_ocr nvarchar(max),
41 pp_ocr nvarchar(max),
42 mvc_ocr nvarchar(max),
43 vat_ocr nvarchar(max),
44 update_time datetime not null,
45 create_time datetime not null
46 );
47
48 create unique index hil_ocr_result_application_id_uindex
49 on hil_ocr_result (application_id);
50
51 """
52
53 afc_sql = """
54
55 create table afc_comparison_info
56 (
57 id bigint identity primary key,
58 uniq_seq nvarchar(128) not null,
59 application_id nvarchar(64) not null,
60 customer_type nvarchar(16) not null,
61 application_version tinyint default 0 not null,
62 vehicle_status nvarchar(16) not null,
63 individual_cus_info nvarchar(max) not null,
64 usedcar_info nvarchar(max),
65 corporate_cus_info nvarchar(max),
66 update_time datetime not null,
67 create_time datetime not null
68 );
69
70 create index afc_comparison_info_application_id_index
71 on afc_comparison_info (application_id);
72
73 create index afc_comparison_info_create_time_index
74 on afc_comparison_info (create_time);
75
76 create index afc_comparison_info_uniq_seq_index
77 on afc_comparison_info (uniq_seq);
78
79 create table afc_ocr_result
80 (
81 id int identity primary key,
82 application_id nvarchar(64) not null,
83 bs_ocr nvarchar(max),
84 mvi_ocr nvarchar(max),
85 ic_ocr nvarchar(max),
86 rp_ocr nvarchar(max),
87 bc_ocr nvarchar(max),
88 bl_ocr nvarchar(max),
89 uci_ocr nvarchar(max),
90 eep_ocr nvarchar(max),
91 dl_ocr nvarchar(max),
92 pp_ocr nvarchar(max),
93 mvc_ocr nvarchar(max),
94 vat_ocr nvarchar(max),
95 update_time datetime not null,
96 create_time datetime not null
97 );
98
99 create unique index afc_ocr_result_application_id_uindex
100 on afc_ocr_result (application_id);
101 """
102
103 hil_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True)
104
105 hil_cursor = hil_cnxn.cursor()
106 hil_cursor.execute(hil_sql)
107
108 hil_cursor.close()
109 hil_cnxn.close()
110
111 afc_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True)
112
113 afc_cursor = afc_cnxn.cursor()
114 afc_cursor.execute(afc_sql)
115
116 afc_cursor.close()
117 afc_cnxn.close()
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!