fsm update
Showing
4 changed files
with
89 additions
and
3 deletions
... | @@ -1042,3 +1042,59 @@ class AFCCompareReportNew(models.Model): | ... | @@ -1042,3 +1042,59 @@ class AFCCompareReportNew(models.Model): |
1042 | managed = False | 1042 | managed = False |
1043 | db_table = 'afc_compare_report_new' | 1043 | db_table = 'afc_compare_report_new' |
1044 | situ_db_label = 'afc' | 1044 | situ_db_label = 'afc' |
1045 | |||
1046 | |||
1047 | invoice_code = content.get('invoiceCode', '') | ||
1048 | invoice_number = content.get('invoiceNumber', '') | ||
1049 | issue_date = content.get('issueDate', None) | ||
1050 | buyer_name = content.get('buyerName', '') | ||
1051 | buyer_id = content.get('buyerId', 0) | ||
1052 | vin = content.get('vin', '') | ||
1053 | dealer = content.get('dealer', '') | ||
1054 | price_with_vat = content.get('priceWithVat', 0.0) | ||
1055 | price_no_vat = content.get('priceNoVat', 0.0) | ||
1056 | price_in_capitals = content.get('priceInCapitals', '') | ||
1057 | vat = content.get('vat', 0.0) | ||
1058 | vat_rate = content.get('vatRate', 0.0) | ||
1059 | class AFCNscInvoice(models.Model): | ||
1060 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | ||
1061 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 | ||
1062 | content = models.TextField(null=True, verbose_name="nsc发票信息") | ||
1063 | create_time = models.DateTimeField(verbose_name='创建时间') # 索引 | ||
1064 | |||
1065 | |||
1066 | invoice_code = models.CharField(max_length=64, verbose_name="发票码") | ||
1067 | issue_date = models.CharField(max_length=64, verbose_name="开票日期") | ||
1068 | buyer_name = models.CharField(max_length=64, verbose_name="开票日期") | ||
1069 | buyer_id = models.CharField(max_length=64, verbose_name="开票日期") | ||
1070 | vin = models.CharField(max_length=64, verbose_name="开票日期") | ||
1071 | dealer = models.CharField(max_length=64, verbose_name="开票日期") | ||
1072 | price_with_vat = models.CharField(max_length=64, verbose_name="开票日期") | ||
1073 | price_no_vat = models.CharField(max_length=64, verbose_name="开票日期") | ||
1074 | price_in_capitals = models.CharField(max_length=64, verbose_name="开票日期") | ||
1075 | vat = models.CharField(max_length=64, verbose_name="开票日期") | ||
1076 | vat_rate = models.CharField(max_length=64, verbose_name="开票日期") | ||
1077 | |||
1078 | |||
1079 | |||
1080 | is_se = models.BooleanField(default=True, verbose_name="是否Settlement") | ||
1081 | is_auto = models.BooleanField(default=False, verbose_name="是否Settlement Auto") | ||
1082 | is_pass = models.BooleanField(default=False, verbose_name="是否全对") | ||
1083 | |||
1084 | full_result = models.TextField(null=True, verbose_name="完整比对结果") | ||
1085 | field_result = models.TextField(null=True, verbose_name="各证件字段统计") | ||
1086 | |||
1087 | start_time = models.DateTimeField(verbose_name='开始时间') # 索引 | ||
1088 | end_time = models.DateTimeField(verbose_name='结束时间') | ||
1089 | class Meta: | ||
1090 | managed = False | ||
1091 | db_table = 'afc_nsc_invoice' | ||
1092 | situ_db_label = 'afc' | ||
1093 | |||
1094 | |||
1095 | class HILNscInvoice(models.Model): | ||
1096 | |||
1097 | class Meta: | ||
1098 | managed = False | ||
1099 | db_table = 'hil_nsc_invoice' | ||
1100 | situ_db_label = 'hil' | ... | ... |
... | @@ -53,7 +53,7 @@ from .named_enum import ErrorType, AutoResult, WholeResult, RPAResult, SystemNam | ... | @@ -53,7 +53,7 @@ from .named_enum import ErrorType, AutoResult, WholeResult, RPAResult, SystemNam |
53 | from .mixins import DocHandler, MPOSHandler, PreSEHandler | 53 | from .mixins import DocHandler, MPOSHandler, PreSEHandler |
54 | from . import consts | 54 | from . import consts |
55 | from apps.account.authentication import OAuth2AuthenticationWithUser | 55 | from apps.account.authentication import OAuth2AuthenticationWithUser |
56 | from celery_compare.tasks import compare | 56 | from celery_compare.tasks import compare, fsm_compare |
57 | 57 | ||
58 | import time | 58 | import time |
59 | class CustomDate(fields.Date): | 59 | class CustomDate(fields.Date): |
... | @@ -563,6 +563,8 @@ class UploadDocView(GenericView, DocHandler): | ... | @@ -563,6 +563,8 @@ class UploadDocView(GenericView, DocHandler): |
563 | document = args.get('document') | 563 | document = args.get('document') |
564 | business_type = document.get('businessType') | 564 | business_type = document.get('businessType') |
565 | application_id = application_data.get('applicationId') | 565 | application_id = application_data.get('applicationId') |
566 | # 包含FSM 激活状态 | ||
567 | application_status = application_data.get('applicationStatus', '') | ||
566 | document_scheme = document.get('documentScheme') | 568 | document_scheme = document.get('documentScheme') |
567 | data_source = document.get('dataSource') | 569 | data_source = document.get('dataSource') |
568 | document_name = document.get('documentName', '') | 570 | document_name = document.get('documentName', '') |
... | @@ -1363,8 +1365,17 @@ class SECMSView(GenericView): | ... | @@ -1363,8 +1365,17 @@ class SECMSView(GenericView): |
1363 | content=content_str, | 1365 | content=content_str, |
1364 | ) | 1366 | ) |
1365 | 1367 | ||
1366 | # 触发比对 | 1368 | # 检查是否fsm流程(SE) |
1367 | compare.apply_async((application_id, business_type, None, None, False, True), | 1369 | fsm_contract = cms_info.get('fsmContract', False) |
1370 | fsm_best_price = cms_info.get('fsmBestPrice', False) | ||
1371 | if fsm_contract: | ||
1372 | fsm_compare.apply_async((application_id, business_type, None, None, False, True), | ||
1373 | queue='queue_compare') | ||
1374 | # compare.apply_async((application_id, business_type, None, None, False, True), | ||
1375 | # queue='queue_compare') | ||
1376 | else: | ||
1377 | # 触发比对 | ||
1378 | compare.apply_async((application_id, business_type, None, None, False, True), | ||
1368 | queue='queue_compare') | 1379 | queue='queue_compare') |
1369 | 1380 | ||
1370 | try: | 1381 | try: | ... | ... |
... | @@ -3266,6 +3266,23 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res | ... | @@ -3266,6 +3266,23 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res |
3266 | 3266 | ||
3267 | 3267 | ||
3268 | @app.task | 3268 | @app.task |
3269 | def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): | ||
3270 | # 调用java fsm 比对流程接口(http) | ||
3271 | if application_entity == consts.HIL_PREFIX: | ||
3272 | comparison_class = HILSECMSInfo if is_cms else HILSEComparisonInfo | ||
3273 | else: | ||
3274 | comparison_class = AFCSECMSInfo if is_cms else AFCSEComparisonInfo | ||
3275 | last_obj = comparison_class.objects.filter(application_id=application_id).last() | ||
3276 | if last_obj is None: | ||
3277 | compare_log.info('{0} [comparison info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' | ||
3278 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, uniq_seq, | ||
3279 | ocr_res_id, is_ca, is_cms)) | ||
3280 | return | ||
3281 | |||
3282 | # 调用Java fsm 比对流程接口, fsm 是se流程, ca可以暂时忽略 | ||
3283 | |||
3284 | |||
3285 | @app.task | ||
3269 | def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): | 3286 | def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): |
3270 | # POS: application_id, application_entity, uniq_seq, None | 3287 | # POS: application_id, application_entity, uniq_seq, None |
3271 | # OCR: application_id, business_type(application_entity), None, ocr_res_id | 3288 | # OCR: application_id, business_type(application_entity), None, ocr_res_id | ... | ... |
-
Please register or sign in to post a comment