0af5cb40 by 冯轩

ADD

1 parent 66e1870b
...@@ -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 = {
...@@ -1437,6 +1438,9 @@ class SECMSView(GenericView): ...@@ -1437,6 +1438,9 @@ class SECMSView(GenericView):
1437 1438
1438 # auto flag 1439 # auto flag
1439 is_auto = cms_info.get('AutoSettlement', False) 1440 is_auto = cms_info.get('AutoSettlement', False)
1441 # fsm flag
1442 fsm_contract = cms_info.get('FSMContract', False)
1443 is_fsm=1 if fsm_contract else 0,
1440 1444
1441 auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement 1445 auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement
1442 auto_obj = auto_class.objects.filter(application_id=application_id).first() 1446 auto_obj = auto_class.objects.filter(application_id=application_id).first()
...@@ -1448,6 +1452,7 @@ class SECMSView(GenericView): ...@@ -1448,6 +1452,7 @@ class SECMSView(GenericView):
1448 if auto_obj is None: 1452 if auto_obj is None:
1449 auto_class.objects.create( 1453 auto_class.objects.create(
1450 application_id=application_id, 1454 application_id=application_id,
1455 is_fsm=is_fsm,
1451 ) 1456 )
1452 elif auto_obj.on_off is False: 1457 elif auto_obj.on_off is False:
1453 auto_obj.on_off = True 1458 auto_obj.on_off = True
...@@ -1467,7 +1472,6 @@ class SECMSView(GenericView): ...@@ -1467,7 +1472,6 @@ class SECMSView(GenericView):
1467 ) 1472 )
1468 1473
1469 # 检查是否fsm流程(SE) 1474 # 检查是否fsm流程(SE)
1470 fsm_contract = cms_info.get('FSMContract', False)
1471 fsm_best_price = cms_info.get('FSMBestPrice', False) 1475 fsm_best_price = cms_info.get('FSMBestPrice', False)
1472 if fsm_contract: 1476 if fsm_contract:
1473 # 记录fsm 流程的cms 提交 1477 # 记录fsm 流程的cms 提交
...@@ -1575,6 +1579,8 @@ class AutoSettlementView(GenericView): ...@@ -1575,6 +1579,8 @@ class AutoSettlementView(GenericView):
1575 whole_result = args.get('whole_result', '') 1579 whole_result = args.get('whole_result', '')
1576 rpa_result = args.get('rpa_result', '') 1580 rpa_result = args.get('rpa_result', '')
1577 1581
1582 is_fsm = args.get('is_fsm')
1583
1578 if isinstance(auto_result, int): 1584 if isinstance(auto_result, int):
1579 auto_result = consts.RESULT_MAP.get(auto_result) 1585 auto_result = consts.RESULT_MAP.get(auto_result)
1580 if isinstance(whole_result, int): 1586 if isinstance(whole_result, int):
...@@ -1595,9 +1601,10 @@ class AutoSettlementView(GenericView): ...@@ -1595,9 +1601,10 @@ class AutoSettlementView(GenericView):
1595 time3_query = Q(ocr_latest_comparison_time__gte=comparison_time_start, 1601 time3_query = Q(ocr_latest_comparison_time__gte=comparison_time_start,
1596 ocr_latest_comparison_time__lt=comparison_time_end + datetime.timedelta(days=1)) \ 1602 ocr_latest_comparison_time__lt=comparison_time_end + datetime.timedelta(days=1)) \
1597 if comparison_time_start is not None and comparison_time_end is not None else Q() 1603 if comparison_time_start is not None and comparison_time_end is not None else Q()
1604 is_fsm_query = Q(is_fsm=is_fsm) if is_fsm is not None else Q()
1598 1605
1599 query = application_id_query & auto_result_query & whole_result_query & rpa_result_query \ 1606 query = application_id_query & auto_result_query & whole_result_query & rpa_result_query \
1600 & time1_query & time2_query & time3_query 1607 & time1_query & time2_query & time3_query & is_fsm_query
1601 1608
1602 auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement 1609 auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement
1603 1610
...@@ -1608,7 +1615,7 @@ class AutoSettlementView(GenericView): ...@@ -1608,7 +1615,7 @@ class AutoSettlementView(GenericView):
1608 raise self.invalid_params('页数不存在') 1615 raise self.invalid_params('页数不存在')
1609 1616
1610 val_tuple = ('application_id', 'ocr_latest_comparison_time', 'ocr_auto_result_pass', 'ocr_whole_result_pass', 1617 val_tuple = ('application_id', 'ocr_latest_comparison_time', 'ocr_auto_result_pass', 'ocr_whole_result_pass',
1611 'rpa_result', 'rpa_activated_time', 'rpa_get_case_from_ocr_time') 1618 'rpa_result', 'rpa_activated_time', 'rpa_get_case_from_ocr_time','is_fsm')
1612 auto_queryset = auto_class.objects.filter(query).values(*val_tuple).order_by( 1619 auto_queryset = auto_class.objects.filter(query).values(*val_tuple).order_by(
1613 '-ocr_latest_comparison_time')[start_index: end_index] 1620 '-ocr_latest_comparison_time')[start_index: end_index]
1614 1621
...@@ -1656,6 +1663,8 @@ class AutoSettlementExcelView(GenericView): ...@@ -1656,6 +1663,8 @@ class AutoSettlementExcelView(GenericView):
1656 whole_result = args.get('whole_result', '') 1663 whole_result = args.get('whole_result', '')
1657 rpa_result = args.get('rpa_result', '') 1664 rpa_result = args.get('rpa_result', '')
1658 1665
1666 is_fsm = args.get('is_fsm')
1667
1659 if isinstance(auto_result, int): 1668 if isinstance(auto_result, int):
1660 auto_result = consts.RESULT_MAP.get(auto_result) 1669 auto_result = consts.RESULT_MAP.get(auto_result)
1661 if isinstance(whole_result, int): 1670 if isinstance(whole_result, int):
...@@ -1676,9 +1685,10 @@ class AutoSettlementExcelView(GenericView): ...@@ -1676,9 +1685,10 @@ class AutoSettlementExcelView(GenericView):
1676 time3_query = Q(ocr_latest_comparison_time__gte=comparison_time_start, 1685 time3_query = Q(ocr_latest_comparison_time__gte=comparison_time_start,
1677 ocr_latest_comparison_time__lt=comparison_time_end + datetime.timedelta(days=1)) \ 1686 ocr_latest_comparison_time__lt=comparison_time_end + datetime.timedelta(days=1)) \
1678 if comparison_time_start is not None and comparison_time_end is not None else Q() 1687 if comparison_time_start is not None and comparison_time_end is not None else Q()
1688 is_fsm_query = Q(is_fsm=is_fsm) if is_fsm is not None else Q()
1679 1689
1680 query = application_id_query & auto_result_query & whole_result_query & rpa_result_query \ 1690 query = application_id_query & auto_result_query & whole_result_query & rpa_result_query \
1681 & time1_query & time2_query & time3_query 1691 & time1_query & time2_query & time3_query & is_fsm_query
1682 1692
1683 auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement 1693 auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement
1684 1694
......
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()
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!