ADD
Showing
1 changed file
with
31 additions
and
5 deletions
... | @@ -360,6 +360,10 @@ compare_result_args = { | ... | @@ -360,6 +360,10 @@ compare_result_args = { |
360 | 360 | ||
361 | upload_pdf_args = { | 361 | upload_pdf_args = { |
362 | 'pdf_file': fields.Raw(required=True), | 362 | 'pdf_file': fields.Raw(required=True), |
363 | 'business_type': fields.Str(required=True), | ||
364 | 'document_scheme': fields.Str(required=True), | ||
365 | 'data_source': fields.Str(required=True), | ||
366 | 'document_name': fields.Str(required=True), | ||
363 | } | 367 | } |
364 | 368 | ||
365 | application_information = { | 369 | application_information = { |
... | @@ -1102,8 +1106,13 @@ class DocView(GenericView, DocHandler): | ... | @@ -1102,8 +1106,13 @@ class DocView(GenericView, DocHandler): |
1102 | if not pdf_file.name.endswith('pdf') and not pdf_file.name.endswith('PDF'): | 1106 | if not pdf_file.name.endswith('pdf') and not pdf_file.name.endswith('PDF'): |
1103 | self.invalid_params(msg='invalid params: not a PDF file') | 1107 | self.invalid_params(msg='invalid params: not a PDF file') |
1104 | 1108 | ||
1109 | business_type = args.get('business_type', '') | ||
1110 | document_scheme = args.get('document_scheme', '') | ||
1111 | data_source = args.get('data_source', '') | ||
1112 | document_name = args.get('document_name', '') | ||
1113 | |||
1105 | # business_type = random.choice(consts.BUSINESS_TYPE_LIST) | 1114 | # business_type = random.choice(consts.BUSINESS_TYPE_LIST) |
1106 | business_type = consts.BUSINESS_TYPE_LIST[0] | 1115 | # business_type = consts.BUSINESS_TYPE_LIST[0] |
1107 | tmp_save_path = os.path.join(conf.DATA_DIR, business_type, '{0}.pdf'.format(metadata_version_id)) | 1116 | tmp_save_path = os.path.join(conf.DATA_DIR, business_type, '{0}.pdf'.format(metadata_version_id)) |
1108 | file_write(pdf_file, tmp_save_path) | 1117 | file_write(pdf_file, tmp_save_path) |
1109 | 1118 | ||
... | @@ -1126,8 +1135,8 @@ class DocView(GenericView, DocHandler): | ... | @@ -1126,8 +1135,8 @@ class DocView(GenericView, DocHandler): |
1126 | application_id = '{0}{1}'.format(consts.FIXED_APPLICATION_ID_PREFIX, metadata_version_id) | 1135 | application_id = '{0}{1}'.format(consts.FIXED_APPLICATION_ID_PREFIX, metadata_version_id) |
1127 | upload_finish_time = timezone.now() | 1136 | upload_finish_time = timezone.now() |
1128 | # document_scheme = random.choice(consts.DOC_SCHEME_LIST) | 1137 | # document_scheme = random.choice(consts.DOC_SCHEME_LIST) |
1129 | document_scheme = consts.DOC_SCHEME_LIST[1] | 1138 | # document_scheme = consts.DOC_SCHEME_LIST[1] |
1130 | data_source = random.choice(consts.DATA_SOURCE_LIST) | 1139 | # data_source = random.choice(consts.DATA_SOURCE_LIST) |
1131 | # UploadDocRecords.objects.create( | 1140 | # UploadDocRecords.objects.create( |
1132 | # metadata_version_id=metadata_version_id, | 1141 | # metadata_version_id=metadata_version_id, |
1133 | # application_id=application_id, | 1142 | # application_id=application_id, |
... | @@ -1166,8 +1175,25 @@ class DocView(GenericView, DocHandler): | ... | @@ -1166,8 +1175,25 @@ class DocView(GenericView, DocHandler): |
1166 | 1175 | ||
1167 | # 4. 选择队列进入 | 1176 | # 4. 选择队列进入 |
1168 | is_priority = False | 1177 | is_priority = False |
1169 | tasks = ['{0}{1}{2}'.format(prefix, consts.SPLIT_STR, doc.id)] | 1178 | |
1170 | enqueue_res = rh.enqueue(tasks, is_priority) | 1179 | classify_1 = 0 |
1180 | # 电子合同 Econtract or OVP(FSM) | ||
1181 | if data_source == consts.DATA_SOURCE_LIST[2] or data_source == consts.DATA_SOURCE_LIST[3]: | ||
1182 | if document_scheme == consts.DOC_SCHEME_LIST[1]: | ||
1183 | for keyword, classify_1_tmp in consts.ECONTRACT_KEYWORDS_MAP.get(prefix): | ||
1184 | if keyword in document_name: | ||
1185 | classify_1 = classify_1_tmp | ||
1186 | break | ||
1187 | # FSM合同:WEP/MSI/SC | ||
1188 | elif data_source == consts.DATA_SOURCE_LIST[0] and document_scheme == consts.DOC_SCHEME_LIST[0]: | ||
1189 | for keyword, classify_1_tmp in consts.FSM_ECONTRACT_KEYWORDS_MAP.get(prefix): | ||
1190 | if keyword in document_name: | ||
1191 | classify_1 = classify_1_tmp | ||
1192 | break | ||
1193 | |||
1194 | # tasks = ['{0}{1}{2}'.format(prefix, consts.SPLIT_STR, doc.id)] | ||
1195 | task = consts.SPLIT_STR.join([prefix, str(doc.id), str(classify_1)]) | ||
1196 | enqueue_res = rh.enqueue([task], is_priority) | ||
1171 | 1197 | ||
1172 | self.running_log.info('[mock doc upload success] [args={0}] [business_type={1}] [doc_id={2}] ' | 1198 | self.running_log.info('[mock doc upload success] [args={0}] [business_type={1}] [doc_id={2}] ' |
1173 | '[is_priority={3}] [enqueue_res={4}]'.format(args, prefix, doc.id, | 1199 | '[is_priority={3}] [enqueue_res={4}]'.format(args, prefix, doc.id, | ... | ... |
-
Please register or sign in to post a comment