Merge branch 'feature/CHINARPA-3523'
Showing
4 changed files
with
47 additions
and
6 deletions
... | @@ -2455,10 +2455,12 @@ RE_RPA_RESULT_MAP = {v: k for k, v in RPA_RESULT_MAP.items()} | ... | @@ -2455,10 +2455,12 @@ RE_RPA_RESULT_MAP = {v: k for k, v in RPA_RESULT_MAP.items()} |
2455 | AUTO_WB_FIELD = ( | 2455 | AUTO_WB_FIELD = ( |
2456 | ('application_id', 'aa_type', 'ocr_latest_comparison_time', 'ocr_auto_result_pass', 'ocr_whole_result_pass', | 2456 | ('application_id', 'aa_type', 'ocr_latest_comparison_time', 'ocr_auto_result_pass', 'ocr_whole_result_pass', |
2457 | 'rpa_result', 'rpa_1st_eye_tat', 'rpa_2nd_eye_tat', 'rpa_3rd_eye_tat', 'rpa_total_tat', 'rpa_activated_time', | 2457 | 'rpa_result', 'rpa_1st_eye_tat', 'rpa_2nd_eye_tat', 'rpa_3rd_eye_tat', 'rpa_total_tat', 'rpa_activated_time', |
2458 | 'rpa_get_case_from_ocr_time', 'rpa_get_case_from_oc_time', 'rpa_payment_authorize_time', 'rpa_second_eye_time'), | 2458 | 'rpa_get_case_from_ocr_time', 'rpa_get_case_from_oc_time', 'rpa_payment_authorize_time', 'rpa_second_eye_time', |
2459 | 'is_fsm'), | ||
2459 | ('application_id', 'aa_type', 'latest_comparison_time', 'auto_result', 'whole_result', 'rpa_result', | 2460 | ('application_id', 'aa_type', 'latest_comparison_time', 'auto_result', 'whole_result', 'rpa_result', |
2460 | 'rpa_1st_eye_tat', 'rpa_2nd_eye_tat', 'rpa_3rd_eye_tat', 'rpa_total_tat', 'rpa_activated_time', | 2461 | 'rpa_1st_eye_tat', 'rpa_2nd_eye_tat', 'rpa_3rd_eye_tat', 'rpa_total_tat', 'rpa_activated_time', |
2461 | 'rpa_get_case_from_ocr_time', 'rpa_get_case_from_oc_time', 'rpa_payment_authorize_time', 'rpa_second_eye_time') | 2462 | 'rpa_get_case_from_ocr_time', 'rpa_get_case_from_oc_time', 'rpa_payment_authorize_time', 'rpa_second_eye_time', |
2463 | 'is_fsm') | ||
2462 | ) | 2464 | ) |
2463 | 2465 | ||
2464 | MPOS_MAP = { | 2466 | MPOS_MAP = { | ... | ... |
... | @@ -880,6 +880,8 @@ class HILAutoSettlement(models.Model): | ... | @@ -880,6 +880,8 @@ class HILAutoSettlement(models.Model): |
880 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') | 880 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') |
881 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | 881 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') |
882 | 882 | ||
883 | is_fsm = models.SmallIntegerField(null=False, default=0, verbose_name="是否fsm流程 1:是") | ||
884 | |||
883 | class Meta: | 885 | class Meta: |
884 | managed = False | 886 | managed = False |
885 | db_table = 'hil_auto_settlement' | 887 | db_table = 'hil_auto_settlement' |
... | @@ -910,6 +912,8 @@ class AFCAutoSettlement(models.Model): | ... | @@ -910,6 +912,8 @@ class AFCAutoSettlement(models.Model): |
910 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') | 912 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') |
911 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | 913 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') |
912 | 914 | ||
915 | is_fsm = models.SmallIntegerField(null=False, default=0, verbose_name="是否fsm流程 1:是") | ||
916 | |||
913 | class Meta: | 917 | class Meta: |
914 | managed = False | 918 | managed = False |
915 | db_table = 'afc_auto_settlement' | 919 | db_table = 'afc_auto_settlement' | ... | ... |
... | @@ -348,6 +348,7 @@ auto_list_args = { | ... | @@ -348,6 +348,7 @@ auto_list_args = { |
348 | 'activated_time_end': fields.Date(required=False), | 348 | 'activated_time_end': fields.Date(required=False), |
349 | 'comparison_time_start': fields.Date(required=False), | 349 | 'comparison_time_start': fields.Date(required=False), |
350 | 'comparison_time_end': fields.Date(required=False), | 350 | 'comparison_time_end': fields.Date(required=False), |
351 | 'is_fsm': fields.Int(required=False), | ||
351 | } | 352 | } |
352 | 353 | ||
353 | compare_result_args = { | 354 | compare_result_args = { |
... | @@ -1465,6 +1466,9 @@ class SECMSView(GenericView): | ... | @@ -1465,6 +1466,9 @@ class SECMSView(GenericView): |
1465 | 1466 | ||
1466 | # auto flag | 1467 | # auto flag |
1467 | is_auto = cms_info.get('AutoSettlement', False) | 1468 | is_auto = cms_info.get('AutoSettlement', False) |
1469 | # fsm flag | ||
1470 | fsm_contract = cms_info.get('FSMContract', False) | ||
1471 | is_fsm=1 if fsm_contract else 0 | ||
1468 | 1472 | ||
1469 | auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement | 1473 | auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement |
1470 | auto_obj = auto_class.objects.filter(application_id=application_id).first() | 1474 | auto_obj = auto_class.objects.filter(application_id=application_id).first() |
... | @@ -1476,6 +1480,7 @@ class SECMSView(GenericView): | ... | @@ -1476,6 +1480,7 @@ class SECMSView(GenericView): |
1476 | if auto_obj is None: | 1480 | if auto_obj is None: |
1477 | auto_class.objects.create( | 1481 | auto_class.objects.create( |
1478 | application_id=application_id, | 1482 | application_id=application_id, |
1483 | is_fsm=is_fsm, | ||
1479 | ) | 1484 | ) |
1480 | elif auto_obj.on_off is False: | 1485 | elif auto_obj.on_off is False: |
1481 | auto_obj.on_off = True | 1486 | auto_obj.on_off = True |
... | @@ -1495,7 +1500,6 @@ class SECMSView(GenericView): | ... | @@ -1495,7 +1500,6 @@ class SECMSView(GenericView): |
1495 | ) | 1500 | ) |
1496 | 1501 | ||
1497 | # 检查是否fsm流程(SE) | 1502 | # 检查是否fsm流程(SE) |
1498 | fsm_contract = cms_info.get('FSMContract', False) | ||
1499 | fsm_best_price = cms_info.get('FSMBestPrice', False) | 1503 | fsm_best_price = cms_info.get('FSMBestPrice', False) |
1500 | if fsm_contract: | 1504 | if fsm_contract: |
1501 | # 记录fsm 流程的cms 提交 | 1505 | # 记录fsm 流程的cms 提交 |
... | @@ -1603,6 +1607,8 @@ class AutoSettlementView(GenericView): | ... | @@ -1603,6 +1607,8 @@ class AutoSettlementView(GenericView): |
1603 | whole_result = args.get('whole_result', '') | 1607 | whole_result = args.get('whole_result', '') |
1604 | rpa_result = args.get('rpa_result', '') | 1608 | rpa_result = args.get('rpa_result', '') |
1605 | 1609 | ||
1610 | is_fsm = args.get('is_fsm') | ||
1611 | |||
1606 | if isinstance(auto_result, int): | 1612 | if isinstance(auto_result, int): |
1607 | auto_result = consts.RESULT_MAP.get(auto_result) | 1613 | auto_result = consts.RESULT_MAP.get(auto_result) |
1608 | if isinstance(whole_result, int): | 1614 | if isinstance(whole_result, int): |
... | @@ -1623,9 +1629,10 @@ class AutoSettlementView(GenericView): | ... | @@ -1623,9 +1629,10 @@ class AutoSettlementView(GenericView): |
1623 | time3_query = Q(ocr_latest_comparison_time__gte=comparison_time_start, | 1629 | time3_query = Q(ocr_latest_comparison_time__gte=comparison_time_start, |
1624 | ocr_latest_comparison_time__lt=comparison_time_end + datetime.timedelta(days=1)) \ | 1630 | ocr_latest_comparison_time__lt=comparison_time_end + datetime.timedelta(days=1)) \ |
1625 | if comparison_time_start is not None and comparison_time_end is not None else Q() | 1631 | if comparison_time_start is not None and comparison_time_end is not None else Q() |
1632 | is_fsm_query = Q(is_fsm=is_fsm) if is_fsm is not None else Q() | ||
1626 | 1633 | ||
1627 | query = application_id_query & auto_result_query & whole_result_query & rpa_result_query \ | 1634 | query = application_id_query & auto_result_query & whole_result_query & rpa_result_query \ |
1628 | & time1_query & time2_query & time3_query | 1635 | & time1_query & time2_query & time3_query & is_fsm_query |
1629 | 1636 | ||
1630 | auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement | 1637 | auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement |
1631 | 1638 | ||
... | @@ -1636,7 +1643,7 @@ class AutoSettlementView(GenericView): | ... | @@ -1636,7 +1643,7 @@ class AutoSettlementView(GenericView): |
1636 | raise self.invalid_params('页数不存在') | 1643 | raise self.invalid_params('页数不存在') |
1637 | 1644 | ||
1638 | val_tuple = ('application_id', 'ocr_latest_comparison_time', 'ocr_auto_result_pass', 'ocr_whole_result_pass', | 1645 | val_tuple = ('application_id', 'ocr_latest_comparison_time', 'ocr_auto_result_pass', 'ocr_whole_result_pass', |
1639 | 'rpa_result', 'rpa_activated_time', 'rpa_get_case_from_ocr_time') | 1646 | 'rpa_result', 'rpa_activated_time', 'rpa_get_case_from_ocr_time','is_fsm') |
1640 | auto_queryset = auto_class.objects.filter(query).values(*val_tuple).order_by( | 1647 | auto_queryset = auto_class.objects.filter(query).values(*val_tuple).order_by( |
1641 | '-ocr_latest_comparison_time')[start_index: end_index] | 1648 | '-ocr_latest_comparison_time')[start_index: end_index] |
1642 | 1649 | ||
... | @@ -1684,6 +1691,8 @@ class AutoSettlementExcelView(GenericView): | ... | @@ -1684,6 +1691,8 @@ class AutoSettlementExcelView(GenericView): |
1684 | whole_result = args.get('whole_result', '') | 1691 | whole_result = args.get('whole_result', '') |
1685 | rpa_result = args.get('rpa_result', '') | 1692 | rpa_result = args.get('rpa_result', '') |
1686 | 1693 | ||
1694 | is_fsm = args.get('is_fsm') | ||
1695 | |||
1687 | if isinstance(auto_result, int): | 1696 | if isinstance(auto_result, int): |
1688 | auto_result = consts.RESULT_MAP.get(auto_result) | 1697 | auto_result = consts.RESULT_MAP.get(auto_result) |
1689 | if isinstance(whole_result, int): | 1698 | if isinstance(whole_result, int): |
... | @@ -1704,9 +1713,10 @@ class AutoSettlementExcelView(GenericView): | ... | @@ -1704,9 +1713,10 @@ class AutoSettlementExcelView(GenericView): |
1704 | time3_query = Q(ocr_latest_comparison_time__gte=comparison_time_start, | 1713 | time3_query = Q(ocr_latest_comparison_time__gte=comparison_time_start, |
1705 | ocr_latest_comparison_time__lt=comparison_time_end + datetime.timedelta(days=1)) \ | 1714 | ocr_latest_comparison_time__lt=comparison_time_end + datetime.timedelta(days=1)) \ |
1706 | if comparison_time_start is not None and comparison_time_end is not None else Q() | 1715 | if comparison_time_start is not None and comparison_time_end is not None else Q() |
1716 | is_fsm_query = Q(is_fsm=is_fsm) if is_fsm is not None else Q() | ||
1707 | 1717 | ||
1708 | query = application_id_query & auto_result_query & whole_result_query & rpa_result_query \ | 1718 | query = application_id_query & auto_result_query & whole_result_query & rpa_result_query \ |
1709 | & time1_query & time2_query & time3_query | 1719 | & time1_query & time2_query & time3_query & is_fsm_query |
1710 | 1720 | ||
1711 | auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement | 1721 | auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement |
1712 | 1722 | ... | ... |
src/common/tools/mssql_script25.py
0 → 100644
1 | import pyodbc | ||
2 | |||
3 | hil_sql = """ | ||
4 | ALTER TABLE hil_auto_settlement ADD is_fsm tinyint not null default 0; | ||
5 | """ | ||
6 | |||
7 | afc_sql = """ | ||
8 | ALTER TABLE afc_auto_settlement ADD is_fsm tinyint not null default 0; | ||
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() |
-
Please register or sign in to post a comment