add auto settlement
Showing
5 changed files
with
234 additions
and
56 deletions
| ... | @@ -1477,6 +1477,9 @@ SE_HIL_CON_1_MAP = { | ... | @@ -1477,6 +1477,9 @@ SE_HIL_CON_1_MAP = { |
| 1477 | '融资成本总额': (5, 4, 7, '融资成本总额', None), | 1477 | '融资成本总额': (5, 4, 7, '融资成本总额', None), |
| 1478 | '租期': (5, 4, 7, '租期', None), | 1478 | '租期': (5, 4, 7, '租期', None), |
| 1479 | '还款计划表': (5, 5, 7, '付款计划表', None), | 1479 | '还款计划表': (5, 5, 7, '付款计划表', None), |
| 1480 | '还款账号': (5, 5, 7, '银行账户-银行账号', None), | ||
| 1481 | '户名': (5, 5, 7, '银行账户-户名', None), | ||
| 1482 | '开户行': (5, 5, 7, '银行账户-开户行', None), | ||
| 1480 | 'ASP项目详情': (5, 4, 7, '车辆附加产品明细表', None), | 1483 | 'ASP项目详情': (5, 4, 7, '车辆附加产品明细表', None), |
| 1481 | '承租人法定代表人或授权代表': (1, 1, 7, '承租人-法定代表人或授权代表', None), | 1484 | '承租人法定代表人或授权代表': (1, 1, 7, '承租人-法定代表人或授权代表', None), |
| 1482 | 1485 | ||
| ... | @@ -1532,11 +1535,11 @@ SE_AFC_CON_FIELD = ['-瘥△', '韐剛膠颲遠-撠- | ... | @@ -1532,11 +1535,11 @@ SE_AFC_CON_FIELD = ['-瘥△', '韐剛膠颲遠-撠- |
| 1532 | '车辆贷款本金金额-重要条款', '附加产品融资贷款本金总额-重要条款', '所购车辆价格', '车架号', '经销商', | 1535 | '车辆贷款本金金额-重要条款', '附加产品融资贷款本金总额-重要条款', '所购车辆价格', '车架号', '经销商', |
| 1533 | '贷款本金金额', '车辆贷款本金金额', '附加产品融资贷款本金总额', '贷款期限', '还款账号', '户名', '开户行', | 1536 | '贷款本金金额', '车辆贷款本金金额', '附加产品融资贷款本金总额', '贷款期限', '还款账号', '户名', '开户行', |
| 1534 | '还款计划表', '见证人签字', '见证人日期', 'ASP项目详情-重要条款', '购置税校验', 'ASP项目详情'] | 1537 | '还款计划表', '见证人签字', '见证人日期', 'ASP项目详情-重要条款', '购置税校验', 'ASP项目详情'] |
| 1535 | AFC_CON_BANK_FIELD = ['还款账号', '户名', '开户行'] | 1538 | CON_BANK_FIELD = ['还款账号', '户名', '开户行'] |
| 1536 | 1539 | ||
| 1537 | # '承租人姓名', '承租人证件号码', '承租人法定代表人或授权代表' | 1540 | # '承租人姓名', '承租人证件号码', '承租人法定代表人或授权代表' |
| 1538 | SE_HIL_CON_1_FIELD = ['合同编号-每页', '合同编号-正文', '车辆识别代码', '车辆卖方', '车辆原始销售价格', '融资成本总额', '租期', | 1541 | SE_HIL_CON_1_FIELD = ['合同编号-每页', '合同编号-正文', '车辆识别代码', '车辆卖方', '车辆原始销售价格', '融资成本总额', '租期', |
| 1539 | '还款计划表', 'ASP项目详情', '购置税校验', '承租人法定代表人或授权代表'] | 1542 | '还款计划表', 'ASP项目详情', '购置税校验', '承租人法定代表人或授权代表', '还款账号', '户名', '开户行'] |
| 1540 | SE_HIL_CON_2_FIELD = ['合同编号', '合同编号-正文', '车辆识别代码', '租金总额', '融资租赁期限'] | 1543 | SE_HIL_CON_2_FIELD = ['合同编号', '合同编号-正文', '车辆识别代码', '租金总额', '融资租赁期限'] |
| 1541 | SE_HIL_CON_3_FIELD = ['合同编号-每页', '承租人姓名', '承租人证件号码', '销售经销商', '合同编号-正文', '姓名/名称', | 1544 | SE_HIL_CON_3_FIELD = ['合同编号-每页', '承租人姓名', '承租人证件号码', '销售经销商', '合同编号-正文', '姓名/名称', |
| 1542 | '自然人身份证件号码/法人执照号码', '承租人签字'] | 1545 | '自然人身份证件号码/法人执照号码', '承租人签字'] |
| ... | @@ -1820,6 +1823,9 @@ HIL_CONTRACT_1_COMPARE_LOGIC = { | ... | @@ -1820,6 +1823,9 @@ HIL_CONTRACT_1_COMPARE_LOGIC = { |
| 1820 | '还款计划表': ('还款计划表', 'se_schedule_compare', {"value_idx": 1}, '售后回租合同还款计划表与系统不一致'), | 1823 | '还款计划表': ('还款计划表', 'se_schedule_compare', {"value_idx": 1}, '售后回租合同还款计划表与系统不一致'), |
| 1821 | 'ASP项目详情': ('ASP项目详情', 'se_asp_compare', {}, '售后回租合同ASP名称或者金额与系统不一致'), | 1824 | 'ASP项目详情': ('ASP项目详情', 'se_asp_compare', {}, '售后回租合同ASP名称或者金额与系统不一致'), |
| 1822 | '承租人法定代表人或授权代表': ('承租人法定代表人或授权代表', 'se_name_compare', {}, '售后回租合同承租人法定代表人或授权代表与系统不一致'), | 1825 | '承租人法定代表人或授权代表': ('承租人法定代表人或授权代表', 'se_name_compare', {}, '售后回租合同承租人法定代表人或授权代表与系统不一致'), |
| 1826 | '还款账号': ('还款账号', 'se_common_compare', {'remove_space': True}, '售后回租合同还款账号与系统不一致'), | ||
| 1827 | '户名': ('户名', 'se_common_compare', {}, '售后回租合同户名与系统不一致'), | ||
| 1828 | '开户行': ('开户行', 'se_both_contain_compare', {}, '售后回租合同开户行与系统不一致'), | ||
| 1823 | 1829 | ||
| 1824 | '承租人姓名': ('承租人姓名', 'se_name_compare', {}, '售后回租合同承租人姓名与系统不一致'), | 1830 | '承租人姓名': ('承租人姓名', 'se_name_compare', {}, '售后回租合同承租人姓名与系统不一致'), |
| 1825 | '承租人证件号': ('承租人证件号', 'se_common_compare', {}, '售后回租合同承租人证件号与系统不一致'), | 1831 | '承租人证件号': ('承租人证件号', 'se_common_compare', {}, '售后回租合同承租人证件号与系统不一致'), | ... | ... |
| ... | @@ -806,31 +806,69 @@ class HILCACompareResultRecord(models.Model): | ... | @@ -806,31 +806,69 @@ class HILCACompareResultRecord(models.Model): |
| 806 | reason10_count = models.SmallIntegerField(default=0, verbose_name="原因10数目") | 806 | reason10_count = models.SmallIntegerField(default=0, verbose_name="原因10数目") |
| 807 | result = models.TextField(null=True, verbose_name="比对结果") | 807 | result = models.TextField(null=True, verbose_name="比对结果") |
| 808 | comments = models.TextField(null=True, verbose_name="备注") | 808 | comments = models.TextField(null=True, verbose_name="备注") |
| 809 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') # 索引 | 809 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') # 索引 |
| 810 | 810 | ||
| 811 | class Meta: | 811 | class Meta: |
| 812 | managed = False | 812 | managed = False |
| 813 | db_table = 'hil_ca_compare_result_record' | 813 | db_table = 'hil_ca_compare_result_record' |
| 814 | 814 | ||
| 815 | 815 | ||
| 816 | # class HILContract(models.Model): | 816 | class HILAutoSettlement(models.Model): |
| 817 | # id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | 817 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 |
| 818 | # application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 | 818 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 |
| 819 | # create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | 819 | aa_type = models.CharField(null=True, max_length=64, verbose_name="aa_type") |
| 820 | |||
| 821 | rpa_result = models.SmallIntegerField(null=True, verbose_name="原因10数目") | ||
| 822 | rpa_1st_eye_tat = models.DecimalField(null=True, verbose_name='rpa_1st_eye_tat') | ||
| 823 | rpa_2nd_eye_tat = models.DecimalField(null=True, verbose_name='rpa_2nd_eye_tat') | ||
| 824 | rpa_3rd_eye_tat = models.DecimalField(null=True, verbose_name='rpa_3rd_eye_tat') | ||
| 825 | rpa_total_tat = models.DecimalField(null=True, verbose_name='rpa_total_tat') | ||
| 826 | rpa_activated_time = models.DateTimeField(null=True, verbose_name='rpa_activated_time') | ||
| 827 | rpa_get_case_from_ocr_time = models.DateTimeField(null=True, verbose_name='rpa_get_case_from_ocr_time') | ||
| 828 | rpa_get_case_from_oc_time = models.DateTimeField(null=True, verbose_name='rpa_get_case_from_oc_time') | ||
| 829 | rpa_payment_authorize_time = models.DateTimeField(null=True, verbose_name='rpa_payment_authorize_time') | ||
| 830 | rpa_second_eye_time = models.DateTimeField(null=True, verbose_name='rpa_second_eye_time') | ||
| 831 | |||
| 832 | on_off = models.BooleanField(default=True, verbose_name="是否有效") | ||
| 833 | ocr_auto_result_pass = models.BooleanField(default=False, verbose_name="整体结果") | ||
| 834 | ocr_auto_result = models.TextField(null=True, verbose_name="auto比对结果") | ||
| 835 | ocr_latest_comparison_time = models.DateTimeField(auto_now=True, null=True, verbose_name='最新比对时间') | ||
| 820 | 836 | ||
| 821 | # class Meta: | 837 | update_time = models.DateTimeField(auto_now=False, verbose_name='修改时间') |
| 822 | # managed = False | 838 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') |
| 823 | # db_table = 'hil_contract' | ||
| 824 | 839 | ||
| 840 | class Meta: | ||
| 841 | managed = False | ||
| 842 | db_table = 'hil_auto_settlement' | ||
| 825 | 843 | ||
| 826 | # class AFCContract(models.Model): | ||
| 827 | # id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | ||
| 828 | # application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 | ||
| 829 | # create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | ||
| 830 | 844 | ||
| 831 | # class Meta: | 845 | class AFCAutoSettlement(models.Model): |
| 832 | # managed = False | 846 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 |
| 833 | # db_table = 'afc_contract' | 847 | application_id = models.CharField(max_length=64, verbose_name="申请id") # 索引 |
| 834 | # situ_db_label = 'afc' | 848 | aa_type = models.CharField(null=True, max_length=64, verbose_name="aa_type") |
| 849 | |||
| 850 | rpa_result = models.SmallIntegerField(null=True, verbose_name="原因10数目") | ||
| 851 | rpa_1st_eye_tat = models.DecimalField(null=True, verbose_name='rpa_1st_eye_tat') | ||
| 852 | rpa_2nd_eye_tat = models.DecimalField(null=True, verbose_name='rpa_2nd_eye_tat') | ||
| 853 | rpa_3rd_eye_tat = models.DecimalField(null=True, verbose_name='rpa_3rd_eye_tat') | ||
| 854 | rpa_total_tat = models.DecimalField(null=True, verbose_name='rpa_total_tat') | ||
| 855 | rpa_activated_time = models.DateTimeField(null=True, verbose_name='rpa_activated_time') | ||
| 856 | rpa_get_case_from_ocr_time = models.DateTimeField(null=True, verbose_name='rpa_get_case_from_ocr_time') | ||
| 857 | rpa_get_case_from_oc_time = models.DateTimeField(null=True, verbose_name='rpa_get_case_from_oc_time') | ||
| 858 | rpa_payment_authorize_time = models.DateTimeField(null=True, verbose_name='rpa_payment_authorize_time') | ||
| 859 | rpa_second_eye_time = models.DateTimeField(null=True, verbose_name='rpa_second_eye_time') | ||
| 860 | |||
| 861 | on_off = models.BooleanField(default=True, verbose_name="是否有效") | ||
| 862 | ocr_auto_result_pass = models.BooleanField(default=False, verbose_name="整体结果") | ||
| 863 | ocr_auto_result = models.TextField(verbose_name="auto比对结果") | ||
| 864 | ocr_latest_comparison_time = models.DateTimeField(auto_now=True, null=True, verbose_name='最新比对时间') | ||
| 865 | |||
| 866 | update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间') | ||
| 867 | create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') | ||
| 868 | |||
| 869 | class Meta: | ||
| 870 | managed = False | ||
| 871 | db_table = 'afc_auto_settlement' | ||
| 872 | situ_db_label = 'afc' | ||
| 835 | 873 | ||
| 836 | 874 | ... | ... |
| ... | @@ -6,7 +6,7 @@ import datetime | ... | @@ -6,7 +6,7 @@ import datetime |
| 6 | import fitz | 6 | import fitz |
| 7 | import shutil | 7 | import shutil |
| 8 | from django.utils import timezone | 8 | from django.utils import timezone |
| 9 | from django.http import HttpResponse | 9 | # from django.http import HttpResponse |
| 10 | from django.db.models import Q | 10 | from django.db.models import Q |
| 11 | from rest_framework.permissions import IsAuthenticated | 11 | from rest_framework.permissions import IsAuthenticated |
| 12 | from webargs import fields, validate | 12 | from webargs import fields, validate |
| ... | @@ -17,14 +17,15 @@ from common.mixins import GenericView | ... | @@ -17,14 +17,15 @@ from common.mixins import GenericView |
| 17 | from common.tools.file_tools import file_write | 17 | from common.tools.file_tools import file_write |
| 18 | from common.redis_cache import redis_handler as rh | 18 | from common.redis_cache import redis_handler as rh |
| 19 | from .models import ( | 19 | from .models import ( |
| 20 | # UploadDocRecords, | ||
| 20 | DocStatus, | 21 | DocStatus, |
| 21 | PriorityApplication, | 22 | PriorityApplication, |
| 22 | GCAPRecords, | 23 | GCAPRecords, |
| 23 | AFCComparisonInfo, | 24 | AFCComparisonInfo, |
| 24 | AFCSEComparisonInfo, | 25 | # AFCSEComparisonInfo, |
| 25 | AFCSECMSInfo, | 26 | AFCSECMSInfo, |
| 26 | HILComparisonInfo, | 27 | HILComparisonInfo, |
| 27 | HILSEComparisonInfo, | 28 | # HILSEComparisonInfo, |
| 28 | HILSECMSInfo, | 29 | HILSECMSInfo, |
| 29 | AFCCompareOfflineReport, | 30 | AFCCompareOfflineReport, |
| 30 | HILCompareOfflineReport, | 31 | HILCompareOfflineReport, |
| ... | @@ -36,6 +37,8 @@ from .models import ( | ... | @@ -36,6 +37,8 @@ from .models import ( |
| 36 | AFCSECompareResultRecord, | 37 | AFCSECompareResultRecord, |
| 37 | HILCACompareResultRecord, | 38 | HILCACompareResultRecord, |
| 38 | HILSECompareResultRecord, | 39 | HILSECompareResultRecord, |
| 40 | HILAutoSettlement, | ||
| 41 | AFCAutoSettlement, | ||
| 39 | ) | 42 | ) |
| 40 | from .named_enum import ErrorType | 43 | from .named_enum import ErrorType |
| 41 | from .mixins import DocHandler | 44 | from .mixins import DocHandler |
| ... | @@ -213,6 +216,7 @@ se_compare_content = { | ... | @@ -213,6 +216,7 @@ se_compare_content = { |
| 213 | 'customerType': fields.Str(required=True, validate=validate.OneOf(consts.CUSTOMER_TYPE)), | 216 | 'customerType': fields.Str(required=True, validate=validate.OneOf(consts.CUSTOMER_TYPE)), |
| 214 | "firstSubmmisonDate": CustomDate(required=True), | 217 | "firstSubmmisonDate": CustomDate(required=True), |
| 215 | 'propertyDocumentPolicy': fields.Str(required=False, validate=validate.Length(max=16)), | 218 | 'propertyDocumentPolicy': fields.Str(required=False, validate=validate.Length(max=16)), |
| 219 | 'isAutoSettlement': fields.Boolean(required=False), | ||
| 216 | 220 | ||
| 217 | 'individualCusInfo': fields.List(fields.Nested(se_individual_args), | 221 | 'individualCusInfo': fields.List(fields.Nested(se_individual_args), |
| 218 | required=True, validate=validate.Length(min=1, max=4)), | 222 | required=True, validate=validate.Length(min=1, max=4)), |
| ... | @@ -283,6 +287,7 @@ compare_result_args = { | ... | @@ -283,6 +287,7 @@ compare_result_args = { |
| 283 | 'scheme': fields.Str(required=True, validate=validate.OneOf(consts.COMPARE_DOC_SCHEME_LIST)), | 287 | 'scheme': fields.Str(required=True, validate=validate.OneOf(consts.COMPARE_DOC_SCHEME_LIST)), |
| 284 | 'id': fields.Int(required=False, validate=lambda val: val >= 1), | 288 | 'id': fields.Int(required=False, validate=lambda val: val >= 1), |
| 285 | 'case_id': fields.Str(required=True, validate=validate.Length(max=64)), | 289 | 'case_id': fields.Str(required=True, validate=validate.Length(max=64)), |
| 290 | 'auto': fields.Int(required=False), | ||
| 286 | } | 291 | } |
| 287 | 292 | ||
| 288 | upload_pdf_args = { | 293 | upload_pdf_args = { |
| ... | @@ -500,27 +505,29 @@ class UploadDocView(GenericView, DocHandler): | ... | @@ -500,27 +505,29 @@ class UploadDocView(GenericView, DocHandler): |
| 500 | # co_name = self.get_name(applicant_data, 'coApplicantName', 16) | 505 | # co_name = self.get_name(applicant_data, 'coApplicantName', 16) |
| 501 | # g1_name = self.get_name(applicant_data, 'guarantor1Name', 16) | 506 | # g1_name = self.get_name(applicant_data, 'guarantor1Name', 16) |
| 502 | # g2_name = self.get_name(applicant_data, 'guarantor2Name', 16) | 507 | # g2_name = self.get_name(applicant_data, 'guarantor2Name', 16) |
| 508 | |||
| 503 | # try: | 509 | # try: |
| 504 | # # 1. 上传信息记录 | 510 | # # 1. 上传信息记录 |
| 505 | # UploadDocRecords.objects.create( | 511 | # UploadDocRecords.objects.create( |
| 506 | # metadata_version_id=document.get('metadataVersionId'), | 512 | # metadata_version_id=document.get('metadataVersionId'), |
| 507 | # application_id=application_id, | 513 | # application_id=application_id, |
| 508 | # main_applicant=main_name, | 514 | # main_applicant='main_name', |
| 509 | # co_applicant=co_name, | 515 | # co_applicant='co_name', |
| 510 | # guarantor_1=g1_name, | 516 | # guarantor_1='g1_name', |
| 511 | # guarantor_2=g2_name, | 517 | # guarantor_2='g2_name', |
| 512 | # document_name=document_name, | 518 | # document_name=document_name, |
| 513 | # document_scheme=document_scheme, | 519 | # document_scheme=document_scheme, |
| 514 | # business_type=business_type, | 520 | # business_type=business_type, |
| 515 | # data_source=data_source, | 521 | # data_source=data_source, |
| 516 | # upload_finish_time=document.get('uploadFinishTime'), | 522 | # upload_finish_time=document.get('uploadFinishTime'), |
| 517 | # ) | 523 | # ) |
| 518 | # except IntegrityError as e: | 524 | # except Exception as e: |
| 519 | # self.running_log.info('[doc upload fail] [args={0}] [err={1}]'.format(args, e)) | 525 | # self.running_log.info('[doc upload success] [same file skip] [args={0}]'.format(args)) |
| 520 | # self.invalid_params(msg='metadataVersionId repeat') | 526 | # # self.invalid_params(msg='metadataVersionId repeat') |
| 521 | # else: | 527 | # return response.ok() |
| 528 | |||
| 522 | data_source = self.fix_data_source(data_source) | 529 | data_source = self.fix_data_source(data_source) |
| 523 | document_scheme=self.fix_scheme(document_scheme) | 530 | document_scheme = self.fix_scheme(document_scheme) |
| 524 | 531 | ||
| 525 | if document_name.endswith('.zip'): | 532 | if document_name.endswith('.zip'): |
| 526 | self.running_log.info('[doc upload success] [zip file skip] [args={0}]'.format(args)) | 533 | self.running_log.info('[doc upload success] [zip file skip] [args={0}]'.format(args)) |
| ... | @@ -531,6 +538,7 @@ class UploadDocView(GenericView, DocHandler): | ... | @@ -531,6 +538,7 @@ class UploadDocView(GenericView, DocHandler): |
| 531 | if document_name.endswith('-证书.pdf') or document_name.endswith('-证书'): | 538 | if document_name.endswith('-证书.pdf') or document_name.endswith('-证书'): |
| 532 | self.running_log.info('[doc upload success] [eapp license skip] [args={0}]'.format(args)) | 539 | self.running_log.info('[doc upload success] [eapp license skip] [args={0}]'.format(args)) |
| 533 | return response.ok() | 540 | return response.ok() |
| 541 | |||
| 534 | # 2. 根据业务类型分库存储 | 542 | # 2. 根据业务类型分库存储 |
| 535 | doc_class, prefix = self.get_doc_class(business_type) | 543 | doc_class, prefix = self.get_doc_class(business_type) |
| 536 | doc = doc_class.objects.create( | 544 | doc = doc_class.objects.create( |
| ... | @@ -707,37 +715,52 @@ class SECompareView(GenericView): | ... | @@ -707,37 +715,52 @@ class SECompareView(GenericView): |
| 707 | def post(self, request, args): | 715 | def post(self, request, args): |
| 708 | # 存库 | 716 | # 存库 |
| 709 | content = args.get('content', {}) | 717 | content = args.get('content', {}) |
| 710 | uniq_seq = content.get('uniqSeq') | ||
| 711 | business_type = content.get('applicationEntity') | 718 | business_type = content.get('applicationEntity') |
| 712 | application_id = content.get('applicationId') | 719 | application_id = content.get('applicationId') |
| 720 | is_auto = content.get('isAutoSettlement', False) | ||
| 721 | if is_auto: | ||
| 722 | # 加入优先级队列 | ||
| 723 | PriorityApplication.objects.update_or_create( | ||
| 724 | application_id=application_id, defaults={'on_off': True}) | ||
| 725 | # 加入auto表 | ||
| 726 | auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement | ||
| 727 | is_auto = auto_class.objects.filter(application_id=application_id, on_off=True).exists() | ||
| 728 | if not is_auto: | ||
| 729 | auto_class.objects.create( | ||
| 730 | application_id=application_id, | ||
| 731 | ) | ||
| 732 | return response.ok() | ||
| 713 | 733 | ||
| 714 | individual_cus_info = json.dumps(content.get('individualCusInfo')) | 734 | # uniq_seq = content.get('uniqSeq') |
| 715 | vehicle_info = json.dumps(content.get('vehicleInfo')) | 735 | # business_type = content.get('applicationEntity') |
| 716 | insurance_info = json.dumps(content.get('insuranceInfo')) | 736 | # application_id = content.get('applicationId') |
| 717 | bank_info = json.dumps(content.get('bankInfo')) | 737 | # |
| 718 | quotationt_info = json.dumps(content.get('quotationtInfo')) | 738 | # individual_cus_info = json.dumps(content.get('individualCusInfo')) |
| 719 | corporate_cus_info = json.dumps(content.get('corporateCusInfo')) if isinstance( | 739 | # vehicle_info = json.dumps(content.get('vehicleInfo')) |
| 720 | content.get('corporateCusInfo'), dict) else None | 740 | # insurance_info = json.dumps(content.get('insuranceInfo')) |
| 721 | 741 | # bank_info = json.dumps(content.get('bankInfo')) | |
| 722 | comparison_class = HILSEComparisonInfo if business_type in consts.HIL_SET else AFCSEComparisonInfo | 742 | # quotationt_info = json.dumps(content.get('quotationtInfo')) |
| 723 | comparison_class.objects.create( | 743 | # corporate_cus_info = json.dumps(content.get('corporateCusInfo')) if isinstance( |
| 724 | uniq_seq=uniq_seq, | 744 | # content.get('corporateCusInfo'), dict) else None |
| 725 | application_id=application_id, | 745 | |
| 726 | application_version=content.get('applicationVersion'), | 746 | # comparison_class = HILSEComparisonInfo if business_type in consts.HIL_SET else AFCSEComparisonInfo |
| 727 | customer_type=content.get('customerType'), | 747 | # comparison_class.objects.create( |
| 728 | first_submmison_date=content.get('firstSubmmisonDate'), | 748 | # uniq_seq=uniq_seq, |
| 729 | property_doc_policy=content.get('propertyDocumentPolicy', None), | 749 | # application_id=application_id, |
| 730 | individual_cus_info=individual_cus_info, | 750 | # application_version=content.get('applicationVersion'), |
| 731 | corporate_cus_info=corporate_cus_info, | 751 | # customer_type=content.get('customerType'), |
| 732 | vehicle_info=vehicle_info, | 752 | # first_submmison_date=content.get('firstSubmmisonDate'), |
| 733 | insurance_info=insurance_info, | 753 | # property_doc_policy=content.get('propertyDocumentPolicy', None), |
| 734 | bank_info=bank_info, | 754 | # individual_cus_info=individual_cus_info, |
| 735 | quotationt_info=quotationt_info | 755 | # corporate_cus_info=corporate_cus_info, |
| 736 | ) | 756 | # vehicle_info=vehicle_info, |
| 757 | # insurance_info=insurance_info, | ||
| 758 | # bank_info=bank_info, | ||
| 759 | # quotationt_info=quotationt_info | ||
| 760 | # ) | ||
| 737 | # 触发比对 | 761 | # 触发比对 |
| 738 | # compare.apply_async((application_id, business_type, uniq_seq, None, False, False), | 762 | # compare.apply_async((application_id, business_type, uniq_seq, None, False, False), |
| 739 | # queue='queue_compare') | 763 | # queue='queue_compare') |
| 740 | return response.ok() | ||
| 741 | 764 | ||
| 742 | post.openapi_doc = ''' | 765 | post.openapi_doc = ''' |
| 743 | tags: [info] | 766 | tags: [info] |
| ... | @@ -944,6 +967,38 @@ class CompareResultView(GenericView): | ... | @@ -944,6 +967,38 @@ class CompareResultView(GenericView): |
| 944 | entity = args.get('entity') | 967 | entity = args.get('entity') |
| 945 | scheme = args.get('scheme') | 968 | scheme = args.get('scheme') |
| 946 | case_id = args.get('case_id') | 969 | case_id = args.get('case_id') |
| 970 | is_auto = args.get('auto') | ||
| 971 | if is_auto == 1: | ||
| 972 | result_table = HILAutoSettlement if entity == consts.HIL_PREFIX else AFCAutoSettlement | ||
| 973 | |||
| 974 | if result_id is not None: | ||
| 975 | result_obj = result_table.objects.filter(id=result_id).first() | ||
| 976 | else: | ||
| 977 | result_obj = result_table.objects.filter(application_id=case_id).first() | ||
| 978 | |||
| 979 | if result_obj is None: | ||
| 980 | whole_result = '' | ||
| 981 | else: | ||
| 982 | whole_result = consts.RESULT_Y if result_obj.ocr_auto_result_pass else consts.RESULT_N | ||
| 983 | |||
| 984 | source = consts.INFO_SOURCE[1] | ||
| 985 | version = comments = '' | ||
| 986 | |||
| 987 | compare_result = { | ||
| 988 | 'id': 0 if result_obj is None else result_obj.id, | ||
| 989 | 'application_id': case_id, | ||
| 990 | 'entity': entity, | ||
| 991 | 'scheme': consts.DOC_SCHEME_LIST[0] if scheme == consts.COMPARE_DOC_SCHEME_LIST[0] else | ||
| 992 | consts.DOC_SCHEME_LIST[1], | ||
| 993 | 'whole_result': whole_result, | ||
| 994 | 'latest_compared_time': '' if result_obj is None else result_obj.ocr_latest_comparison_time.strftime('%Y-%m-%d %H:%M'), | ||
| 995 | 'source': source, | ||
| 996 | 'version': version, | ||
| 997 | 'comments': comments, | ||
| 998 | 'result': [] if result_obj is None else json.loads(result_obj.ocr_auto_result) | ||
| 999 | } | ||
| 1000 | |||
| 1001 | return response.ok(data=compare_result) | ||
| 947 | 1002 | ||
| 948 | if entity == consts.HIL_PREFIX: | 1003 | if entity == consts.HIL_PREFIX: |
| 949 | result_table = HILCACompareResult if scheme == consts.COMPARE_DOC_SCHEME_LIST[0] else HILSECompareResult | 1004 | result_table = HILCACompareResult if scheme == consts.COMPARE_DOC_SCHEME_LIST[0] else HILSECompareResult |
| ... | @@ -1132,7 +1187,7 @@ class SECMSView(GenericView): | ... | @@ -1132,7 +1187,7 @@ class SECMSView(GenericView): |
| 1132 | permission_classes = [IsAuthenticated] | 1187 | permission_classes = [IsAuthenticated] |
| 1133 | authentication_classes = [OAuth2AuthenticationWithUser] | 1188 | authentication_classes = [OAuth2AuthenticationWithUser] |
| 1134 | 1189 | ||
| 1135 | # pos上传比对信息接口 SE | 1190 | # CMS上传比对信息接口 SE |
| 1136 | # @use_args(se_cms_args, location='data') | 1191 | # @use_args(se_cms_args, location='data') |
| 1137 | def post(self, request): | 1192 | def post(self, request): |
| 1138 | args = request.data | 1193 | args = request.data | ... | ... |
This diff is collapsed.
Click to expand it.
src/common/tools/mssql_script13.py
0 → 100644
| 1 | import pyodbc | ||
| 2 | |||
| 3 | hil_sql = """ | ||
| 4 | create table hil_auto_settlement | ||
| 5 | ( | ||
| 6 | id bigint identity primary key, | ||
| 7 | application_id nvarchar(64) not null, | ||
| 8 | aa_type nvarchar(64), | ||
| 9 | |||
| 10 | rpa_result smallint, | ||
| 11 | rpa_1st_eye_tat decimal(18,0), | ||
| 12 | rpa_2nd_eye_tat decimal(18,0), | ||
| 13 | rpa_3rd_eye_tat decimal(18,0), | ||
| 14 | rpa_total_tat decimal(18,0), | ||
| 15 | rpa_activated_time datetime, | ||
| 16 | rpa_get_case_from_ocr_time datetime, | ||
| 17 | rpa_get_case_from_oc_time datetime, | ||
| 18 | rpa_payment_authorize_time datetime, | ||
| 19 | rpa_second_eye_time datetime, | ||
| 20 | |||
| 21 | on_off bit default 1 not null, | ||
| 22 | ocr_auto_result_pass bit default 0 not null, | ||
| 23 | ocr_auto_result nvarchar(max), | ||
| 24 | ocr_latest_comparison_time datetime, | ||
| 25 | |||
| 26 | update_time datetime not null, | ||
| 27 | create_time datetime not null | ||
| 28 | ); | ||
| 29 | |||
| 30 | create index hil_auto_settlement_application_id_index | ||
| 31 | on hil_auto_settlement (application_id); | ||
| 32 | """ | ||
| 33 | |||
| 34 | afc_sql = """ | ||
| 35 | create table afc_auto_settlement | ||
| 36 | ( | ||
| 37 | id bigint identity primary key, | ||
| 38 | application_id nvarchar(64) not null, | ||
| 39 | aa_type nvarchar(64), | ||
| 40 | |||
| 41 | rpa_result smallint, | ||
| 42 | rpa_1st_eye_tat decimal(18,0), | ||
| 43 | rpa_2nd_eye_tat decimal(18,0), | ||
| 44 | rpa_3rd_eye_tat decimal(18,0), | ||
| 45 | rpa_total_tat decimal(18,0), | ||
| 46 | rpa_activated_time datetime, | ||
| 47 | rpa_get_case_from_ocr_time datetime, | ||
| 48 | rpa_get_case_from_oc_time datetime, | ||
| 49 | rpa_payment_authorize_time datetime, | ||
| 50 | rpa_second_eye_time datetime, | ||
| 51 | |||
| 52 | on_off bit default 1 not null, | ||
| 53 | ocr_auto_result_pass bit default 0 not null, | ||
| 54 | ocr_auto_result nvarchar(max), | ||
| 55 | ocr_latest_comparison_time datetime, | ||
| 56 | |||
| 57 | update_time datetime not null, | ||
| 58 | create_time datetime not null | ||
| 59 | ); | ||
| 60 | |||
| 61 | create index afc_auto_settlement_application_id_index | ||
| 62 | on afc_auto_settlement (application_id); | ||
| 63 | """ | ||
| 64 | |||
| 65 | hil_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True) | ||
| 66 | |||
| 67 | hil_cursor = hil_cnxn.cursor() | ||
| 68 | hil_cursor.execute(hil_sql) | ||
| 69 | |||
| 70 | hil_cursor.close() | ||
| 71 | hil_cnxn.close() | ||
| 72 | |||
| 73 | afc_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True) | ||
| 74 | |||
| 75 | afc_cursor = afc_cnxn.cursor() | ||
| 76 | afc_cursor.execute(afc_sql) | ||
| 77 | |||
| 78 | afc_cursor.close() | ||
| 79 | afc_cnxn.close() |
-
Please register or sign in to post a comment