add comparsion offline result upload interface & swagger document
Showing
9 changed files
with
647 additions
and
8 deletions
docs/compare_offline.yaml
0 → 100644
| 1 | swagger: '2.0' | ||
| 2 | info: | ||
| 3 | title: 接口文档 | ||
| 4 | description: 宝马ocr/biz_logic接口文档 | ||
| 5 | version: 1.0.0 | ||
| 6 | host: li19dkocruat01vm.bmwgroup.net | ||
| 7 | basePath: / | ||
| 8 | tags: | ||
| 9 | - name: info | ||
| 10 | description: 比对结果 | ||
| 11 | schemes: | ||
| 12 | - https | ||
| 13 | security: | ||
| 14 | - OAuth2: [] | ||
| 15 | paths: | ||
| 16 | /api/compare/offline/v1: | ||
| 17 | post: | ||
| 18 | tags: | ||
| 19 | - info | ||
| 20 | summary: 线下文件夹比对结果上传 | ||
| 21 | consumes: | ||
| 22 | - application/json | ||
| 23 | produces: | ||
| 24 | - application/json | ||
| 25 | parameters: | ||
| 26 | - in: body | ||
| 27 | name: body | ||
| 28 | required: true | ||
| 29 | schema: | ||
| 30 | $ref: '#/definitions/ComparisonOffline' | ||
| 31 | responses: | ||
| 32 | 200: | ||
| 33 | description: ok | ||
| 34 | schema: | ||
| 35 | $ref: '#/definitions/ApiResponse' | ||
| 36 | securityDefinitions: | ||
| 37 | OAuth2: | ||
| 38 | type: oauth2 | ||
| 39 | flow: application | ||
| 40 | description: 'This API uses OAuth 2 with the application(clientCredentials) grant | ||
| 41 | flow. | ||
| 42 | |||
| 43 | client_id=sMlciTkppsMzARwHpCVarm5q7DP2Vucj3ny8JFhw | ||
| 44 | |||
| 45 | client_secret=WNoOilDx140ZLcenDKfsnikv7S2LIFs60DciYoqnrZaYLqYsKpcmt7mJIL69o9AEf84uQvRnS3K2UioxfjNyImjR4UOyXbDcF6qYgTLC4KDVByKFdVhKfrn2Lc4q4BNW | ||
| 46 | |||
| 47 | scopes=write | ||
| 48 | |||
| 49 | ' | ||
| 50 | tokenUrl: https://li19dkocruat01vm.bmwgroup.net/api/oauth/token/ | ||
| 51 | scopes: | ||
| 52 | write: Grants write access | ||
| 53 | responses: | ||
| 54 | ErrorResponse: | ||
| 55 | description: 调用异常, 具体情况请参考`HTTP`状态码和`code`字段 | ||
| 56 | schema: | ||
| 57 | $ref: '#/definitions/ApiResponse' | ||
| 58 | NoContent: | ||
| 59 | description: 后台接收请求,但是没有响应内容 | ||
| 60 | schema: | ||
| 61 | $ref: '#/definitions/ApiResponse' | ||
| 62 | definitions: | ||
| 63 | ComparisonOffline: | ||
| 64 | type: object | ||
| 65 | required: | ||
| 66 | - is_hil | ||
| 67 | - case_number | ||
| 68 | - request_team | ||
| 69 | - request_trigger | ||
| 70 | - input_file | ||
| 71 | - transaction_start | ||
| 72 | - transaction_end | ||
| 73 | - successful_at_this_level | ||
| 74 | - process_name | ||
| 75 | - total_fields | ||
| 76 | - workflow_name | ||
| 77 | properties: | ||
| 78 | is_hil: | ||
| 79 | description: is_hil | ||
| 80 | type: boolean | ||
| 81 | example: false | ||
| 82 | case_number: | ||
| 83 | description: case_number | ||
| 84 | type: string | ||
| 85 | example: VAT Invoice Number | ||
| 86 | request_team: | ||
| 87 | description: request_team | ||
| 88 | type: string | ||
| 89 | example: Accounting | ||
| 90 | request_trigger: | ||
| 91 | description: request_trigger | ||
| 92 | type: string | ||
| 93 | example: Attended RPA (Q-Account + Machine Number) | ||
| 94 | input_file: | ||
| 95 | description: input_file | ||
| 96 | type: string | ||
| 97 | example: CH-B1000000身份证.jpeg | ||
| 98 | transaction_start: | ||
| 99 | description: transaction_start | ||
| 100 | type: string | ||
| 101 | format: date-time | ||
| 102 | example: '2027-04-30 19:22:29' | ||
| 103 | transaction_end: | ||
| 104 | description: transaction_end | ||
| 105 | type: string | ||
| 106 | format: date-time | ||
| 107 | example: '2027-04-30 19:22:29' | ||
| 108 | successful_at_this_level: | ||
| 109 | description: successful_at_this_level | ||
| 110 | type: boolean | ||
| 111 | example: false | ||
| 112 | failure_reason: | ||
| 113 | description: failure_reason | ||
| 114 | type: string | ||
| 115 | example: Fileds Name which doesn’t pass verification | ||
| 116 | process_name: | ||
| 117 | description: process_name | ||
| 118 | type: string | ||
| 119 | example: F1_VATInvoiceMapping | ||
| 120 | total_fields: | ||
| 121 | description: total_fields | ||
| 122 | type: integer | ||
| 123 | example: 0 | ||
| 124 | workflow_name: | ||
| 125 | description: workflow_name | ||
| 126 | type: string | ||
| 127 | example: Normal invoice or Special invoice | ||
| 128 | ApiResponse: | ||
| 129 | description: 响应对象,code字段用于表示响应的状态; data字段用于存放响应内容 | ||
| 130 | type: object | ||
| 131 | required: | ||
| 132 | - code | ||
| 133 | - msg | ||
| 134 | properties: | ||
| 135 | code: | ||
| 136 | type: integer | ||
| 137 | format: uint8 | ||
| 138 | description: '0: success 1: need login 2: invalid params 3: internal error | ||
| 139 | 4: object not exist 5: async wait 6: no permission 7: illegal operation' | ||
| 140 | example: 0 | ||
| 141 | enum: | ||
| 142 | - 0 | ||
| 143 | - 1 | ||
| 144 | - 2 | ||
| 145 | - 3 | ||
| 146 | - 4 | ||
| 147 | - 5 | ||
| 148 | - 6 | ||
| 149 | - 7 | ||
| 150 | msg: | ||
| 151 | type: string | ||
| 152 | example: success | ||
| 153 | data: | ||
| 154 | type: object |
| ... | @@ -5,4 +5,5 @@ from . import views | ... | @@ -5,4 +5,5 @@ from . import views |
| 5 | urlpatterns = [ | 5 | urlpatterns = [ |
| 6 | path(r'v1', views.CompareView.as_view()), | 6 | path(r'v1', views.CompareView.as_view()), |
| 7 | path(r'settlement/v1', views.SECompareView.as_view()), | 7 | path(r'settlement/v1', views.SECompareView.as_view()), |
| 8 | path(r'offline/v1', views.CompareOfflineView.as_view()), | ||
| 8 | ] | 9 | ] | ... | ... |
| ... | @@ -275,8 +275,8 @@ class HILOCRReport(models.Model): | ... | @@ -275,8 +275,8 @@ class HILOCRReport(models.Model): |
| 275 | request_team = models.SmallIntegerField(default=RequestTeam.ACCEPTANCE.value, verbose_name="来源") | 275 | request_team = models.SmallIntegerField(default=RequestTeam.ACCEPTANCE.value, verbose_name="来源") |
| 276 | request_trigger = models.SmallIntegerField(default=RequestTrigger.POS.value, verbose_name="触发者") | 276 | request_trigger = models.SmallIntegerField(default=RequestTrigger.POS.value, verbose_name="触发者") |
| 277 | input_file = models.CharField(max_length=255, verbose_name="文件名") | 277 | input_file = models.CharField(max_length=255, verbose_name="文件名") |
| 278 | transaction_start = models.DateTimeField(null=True, verbose_name='开始时间') # 索引 | 278 | transaction_start = models.DateTimeField(verbose_name='开始时间') # 索引 |
| 279 | transaction_end = models.DateTimeField(null=True, verbose_name='结束时间') | 279 | transaction_end = models.DateTimeField(verbose_name='结束时间') |
| 280 | successful_at_this_level = models.BooleanField(default=True, verbose_name="是否成功") | 280 | successful_at_this_level = models.BooleanField(default=True, verbose_name="是否成功") |
| 281 | failure_reason = models.SmallIntegerField(null=True, verbose_name="失败原因") | 281 | failure_reason = models.SmallIntegerField(null=True, verbose_name="失败原因") |
| 282 | process_name = models.SmallIntegerField(default=ProcessName.ALL.value, verbose_name="流程名称") | 282 | process_name = models.SmallIntegerField(default=ProcessName.ALL.value, verbose_name="流程名称") |
| ... | @@ -294,8 +294,8 @@ class AFCOCRReport(models.Model): | ... | @@ -294,8 +294,8 @@ class AFCOCRReport(models.Model): |
| 294 | request_team = models.SmallIntegerField(default=RequestTeam.ACCEPTANCE.value, verbose_name="来源") | 294 | request_team = models.SmallIntegerField(default=RequestTeam.ACCEPTANCE.value, verbose_name="来源") |
| 295 | request_trigger = models.SmallIntegerField(default=RequestTrigger.POS.value, verbose_name="触发者") | 295 | request_trigger = models.SmallIntegerField(default=RequestTrigger.POS.value, verbose_name="触发者") |
| 296 | input_file = models.CharField(max_length=255, verbose_name="文件名") | 296 | input_file = models.CharField(max_length=255, verbose_name="文件名") |
| 297 | transaction_start = models.DateTimeField(null=True, verbose_name='开始时间') # 索引 | 297 | transaction_start = models.DateTimeField(verbose_name='开始时间') # 索引 |
| 298 | transaction_end = models.DateTimeField(null=True, verbose_name='结束时间') | 298 | transaction_end = models.DateTimeField(verbose_name='结束时间') |
| 299 | successful_at_this_level = models.BooleanField(default=True, verbose_name="是否成功") | 299 | successful_at_this_level = models.BooleanField(default=True, verbose_name="是否成功") |
| 300 | failure_reason = models.SmallIntegerField(null=True, verbose_name="失败原因") | 300 | failure_reason = models.SmallIntegerField(null=True, verbose_name="失败原因") |
| 301 | process_name = models.SmallIntegerField(default=ProcessName.ALL.value, verbose_name="流程名称") | 301 | process_name = models.SmallIntegerField(default=ProcessName.ALL.value, verbose_name="流程名称") |
| ... | @@ -308,4 +308,81 @@ class AFCOCRReport(models.Model): | ... | @@ -308,4 +308,81 @@ class AFCOCRReport(models.Model): |
| 308 | situ_db_label = 'afc' | 308 | situ_db_label = 'afc' |
| 309 | 309 | ||
| 310 | 310 | ||
| 311 | class HILCompareReport(models.Model): | ||
| 312 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | ||
| 313 | case_number = models.CharField(max_length=64, verbose_name="申请id") | ||
| 314 | request_team = models.SmallIntegerField(default=RequestTeam.ACCEPTANCE.value, verbose_name="来源") | ||
| 315 | request_trigger = models.SmallIntegerField(default=RequestTrigger.POS.value, verbose_name="触发者") | ||
| 316 | input_file = models.CharField(max_length=255, verbose_name="文件名", null=True) | ||
| 317 | transaction_start = models.DateTimeField(verbose_name='开始时间') # 索引 | ||
| 318 | transaction_end = models.DateTimeField(verbose_name='结束时间') | ||
| 319 | successful_at_this_level = models.BooleanField(default=True, verbose_name="是否成功") | ||
| 320 | failure_reason = models.TextField(null=True, verbose_name="失败原因") | ||
| 321 | process_name = models.SmallIntegerField(default=ProcessName.ALL.value, verbose_name="流程名称") | ||
| 322 | total_fields = models.IntegerField(null=True, verbose_name='比对字段数目') | ||
| 323 | workflow_name = models.SmallIntegerField(null=True, verbose_name="工作流程") | ||
| 324 | |||
| 325 | class Meta: | ||
| 326 | managed = False | ||
| 327 | db_table = 'hil_compare_report' | ||
| 328 | |||
| 329 | |||
| 330 | class AFCCompareReport(models.Model): | ||
| 331 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | ||
| 332 | case_number = models.CharField(max_length=64, verbose_name="申请id") | ||
| 333 | request_team = models.SmallIntegerField(default=RequestTeam.ACCEPTANCE.value, verbose_name="来源") | ||
| 334 | request_trigger = models.SmallIntegerField(default=RequestTrigger.POS.value, verbose_name="触发者") | ||
| 335 | input_file = models.CharField(max_length=255, verbose_name="文件名", null=True) | ||
| 336 | transaction_start = models.DateTimeField(verbose_name='开始时间') # 索引 | ||
| 337 | transaction_end = models.DateTimeField(verbose_name='结束时间') | ||
| 338 | successful_at_this_level = models.BooleanField(default=True, verbose_name="是否成功") | ||
| 339 | failure_reason = models.TextField(null=True, verbose_name="失败原因") | ||
| 340 | process_name = models.SmallIntegerField(default=ProcessName.ALL.value, verbose_name="流程名称") | ||
| 341 | total_fields = models.IntegerField(null=True, verbose_name='比对字段数目') | ||
| 342 | workflow_name = models.SmallIntegerField(null=True, verbose_name="工作流程") | ||
| 343 | |||
| 344 | class Meta: | ||
| 345 | managed = False | ||
| 346 | db_table = 'afc_compare_report' | ||
| 347 | situ_db_label = 'afc' | ||
| 348 | |||
| 349 | |||
| 350 | class HILCompareOfflineReport(models.Model): | ||
| 351 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | ||
| 352 | case_number = models.CharField(max_length=255, verbose_name="申请id") | ||
| 353 | request_team = models.CharField(max_length=255, verbose_name="来源") | ||
| 354 | request_trigger = models.CharField(max_length=1024, verbose_name="触发者") | ||
| 355 | input_file = models.CharField(max_length=2048, verbose_name="文件名", null=True) | ||
| 356 | transaction_start = models.DateTimeField(verbose_name='开始时间') # 索引 | ||
| 357 | transaction_end = models.DateTimeField(verbose_name='结束时间') | ||
| 358 | successful_at_this_level = models.BooleanField(default=True, verbose_name="是否成功") | ||
| 359 | failure_reason = models.TextField(null=True, verbose_name="失败原因") | ||
| 360 | process_name = models.CharField(max_length=1024, verbose_name="流程名称") | ||
| 361 | total_fields = models.IntegerField(verbose_name='比对字段数目') | ||
| 362 | workflow_name = models.CharField(max_length=1024, verbose_name="工作流程") | ||
| 363 | |||
| 364 | class Meta: | ||
| 365 | managed = False | ||
| 366 | db_table = 'hil_compare_offline_report' | ||
| 367 | |||
| 368 | |||
| 369 | class AFCCompareOfflineReport(models.Model): | ||
| 370 | id = models.AutoField(primary_key=True, verbose_name="id") # 主键 | ||
| 371 | case_number = models.CharField(max_length=255, verbose_name="申请id") | ||
| 372 | request_team = models.CharField(max_length=255, verbose_name="来源") | ||
| 373 | request_trigger = models.CharField(max_length=1024, verbose_name="触发者") | ||
| 374 | input_file = models.CharField(max_length=2048, verbose_name="文件名", null=True) | ||
| 375 | transaction_start = models.DateTimeField(verbose_name='开始时间') # 索引 | ||
| 376 | transaction_end = models.DateTimeField(verbose_name='结束时间') | ||
| 377 | successful_at_this_level = models.BooleanField(default=True, verbose_name="是否成功") | ||
| 378 | failure_reason = models.TextField(null=True, verbose_name="失败原因") | ||
| 379 | process_name = models.CharField(max_length=1024, verbose_name="流程名称") | ||
| 380 | total_fields = models.IntegerField(verbose_name='比对字段数目') | ||
| 381 | workflow_name = models.CharField(max_length=1024, verbose_name="工作流程") | ||
| 382 | |||
| 383 | class Meta: | ||
| 384 | managed = False | ||
| 385 | db_table = 'afc_compare_offline_report' | ||
| 386 | situ_db_label = 'afc' | ||
| 387 | |||
| 311 | 388 | ... | ... |
| ... | @@ -16,7 +16,7 @@ from common import response | ... | @@ -16,7 +16,7 @@ from common import response |
| 16 | from common.mixins import GenericView | 16 | 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 DocStatus, PriorityApplication, GCAPRecords, AFCComparisonInfo, HILComparisonInfo | 19 | from .models import DocStatus, PriorityApplication, GCAPRecords, AFCComparisonInfo, HILComparisonInfo, AFCCompareOfflineReport, HILCompareOfflineReport |
| 20 | from .mixins import DocHandler | 20 | from .mixins import DocHandler |
| 21 | from . import consts | 21 | from . import consts |
| 22 | from apps.account.authentication import OAuth2AuthenticationWithUser | 22 | from apps.account.authentication import OAuth2AuthenticationWithUser |
| ... | @@ -276,6 +276,21 @@ priority_doc_args = { | ... | @@ -276,6 +276,21 @@ priority_doc_args = { |
| 276 | 276 | ||
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | compare_offline_args = { | ||
| 280 | 'is_hil': fields.Boolean(required=True), | ||
| 281 | 'case_number': fields.Str(required=True, validate=validate.Length(max=255)), | ||
| 282 | 'request_team': fields.Str(required=True, validate=validate.Length(max=255)), | ||
| 283 | 'request_trigger': fields.Str(required=True, validate=validate.Length(max=1024)), | ||
| 284 | 'input_file': fields.Str(required=True, validate=validate.Length(max=2048)), | ||
| 285 | 'transaction_start': fields.DateTime(required=True), | ||
| 286 | 'transaction_end': fields.DateTime(required=True), | ||
| 287 | 'successful_at_this_level': fields.Boolean(required=True), | ||
| 288 | 'failure_reason': fields.Str(required=False), | ||
| 289 | 'process_name': fields.Str(required=True, validate=validate.Length(max=1024)), | ||
| 290 | 'total_fields': fields.Int(required=True), | ||
| 291 | 'workflow_name': fields.Str(required=True, validate=validate.Length(max=1024)), | ||
| 292 | } | ||
| 293 | |||
| 279 | 294 | ||
| 280 | class UploadDocView(GenericView, DocHandler): | 295 | class UploadDocView(GenericView, DocHandler): |
| 281 | # permission_classes = [] | 296 | # permission_classes = [] |
| ... | @@ -435,7 +450,7 @@ class CompareView(GenericView): | ... | @@ -435,7 +450,7 @@ class CompareView(GenericView): |
| 435 | permission_classes = [IsAuthenticated] | 450 | permission_classes = [IsAuthenticated] |
| 436 | authentication_classes = [OAuth2AuthenticationWithUser] | 451 | authentication_classes = [OAuth2AuthenticationWithUser] |
| 437 | 452 | ||
| 438 | # pos上传比对信息接口 | 453 | # pos上传比对信息接口 CA |
| 439 | @use_args(compare_args, location='data') | 454 | @use_args(compare_args, location='data') |
| 440 | def post(self, request, args): | 455 | def post(self, request, args): |
| 441 | # 存库 | 456 | # 存库 |
| ... | @@ -486,7 +501,7 @@ class SECompareView(GenericView): | ... | @@ -486,7 +501,7 @@ class SECompareView(GenericView): |
| 486 | permission_classes = [IsAuthenticated] | 501 | permission_classes = [IsAuthenticated] |
| 487 | authentication_classes = [OAuth2AuthenticationWithUser] | 502 | authentication_classes = [OAuth2AuthenticationWithUser] |
| 488 | 503 | ||
| 489 | # pos上传比对信息接口 | 504 | # pos上传比对信息接口 SE |
| 490 | @use_args(se_compare_args, location='data') | 505 | @use_args(se_compare_args, location='data') |
| 491 | def post(self, request, args): | 506 | def post(self, request, args): |
| 492 | self.running_log.info('se compare in') | 507 | self.running_log.info('se compare in') |
| ... | @@ -512,6 +527,50 @@ class SECompareView(GenericView): | ... | @@ -512,6 +527,50 @@ class SECompareView(GenericView): |
| 512 | ''' | 527 | ''' |
| 513 | 528 | ||
| 514 | 529 | ||
| 530 | class CompareOfflineView(GenericView): | ||
| 531 | permission_classes = [IsAuthenticated] | ||
| 532 | authentication_classes = [OAuth2AuthenticationWithUser] | ||
| 533 | |||
| 534 | # 线下文件夹比对结果上传接口 | ||
| 535 | @use_args(compare_offline_args, location='data') | ||
| 536 | def post(self, request, args): | ||
| 537 | is_hil = args.get('is_hil', False) | ||
| 538 | table = HILCompareOfflineReport if is_hil else AFCCompareOfflineReport | ||
| 539 | table.objects.create( | ||
| 540 | case_number=args.get('case_number'), | ||
| 541 | request_team=args.get('request_team'), | ||
| 542 | request_trigger=args.get('request_trigger'), | ||
| 543 | input_file=args.get('input_file'), | ||
| 544 | transaction_start=args.get('transaction_start'), | ||
| 545 | transaction_end=args.get('transaction_end'), | ||
| 546 | successful_at_this_level=args.get('successful_at_this_level'), | ||
| 547 | failure_reason=args.get('failure_reason', ''), | ||
| 548 | process_name=args.get('process_name'), | ||
| 549 | total_fields=args.get('total_fields', 0), | ||
| 550 | workflow_name=args.get('workflow_name'), | ||
| 551 | ) | ||
| 552 | return response.ok() | ||
| 553 | |||
| 554 | post.openapi_doc = ''' | ||
| 555 | tags: [info] | ||
| 556 | summary: 线下文件夹比对结果上传 | ||
| 557 | consumes: [application/json] | ||
| 558 | produces: [application/json] | ||
| 559 | parameters: | ||
| 560 | - in: body | ||
| 561 | name: body | ||
| 562 | required: true | ||
| 563 | schema: | ||
| 564 | $ref: "#/definitions/ComparisonOffline" | ||
| 565 | |||
| 566 | responses: | ||
| 567 | 200: | ||
| 568 | description: ok | ||
| 569 | schema: | ||
| 570 | $ref: '#/definitions/ApiResponse' | ||
| 571 | ''' | ||
| 572 | |||
| 573 | |||
| 515 | class DocView(GenericView, DocHandler): | 574 | class DocView(GenericView, DocHandler): |
| 516 | 575 | ||
| 517 | # 文件列表页 | 576 | # 文件列表页 | ... | ... |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/common/api_doc_bak2.py
0 → 100644
| 1 | base_part = ''' | ||
| 2 | swagger: "2.0" | ||
| 3 | info: | ||
| 4 | title: 接口文档 | ||
| 5 | description: 宝马ocr/biz_logic接口文档 | ||
| 6 | version: 1.0.0 | ||
| 7 | host: "staging-bmw-ocr.situdata.com" | ||
| 8 | basePath: "/" | ||
| 9 | tags: | ||
| 10 | - name: doc | ||
| 11 | description: 文件 | ||
| 12 | schemes: | ||
| 13 | - "https" | ||
| 14 | security: | ||
| 15 | - OAuth2: [] | ||
| 16 | ''' | ||
| 17 | |||
| 18 | # scheme: oauth | ||
| 19 | security_definitions = ''' | ||
| 20 | OAuth2: | ||
| 21 | type: oauth2 | ||
| 22 | flow: application | ||
| 23 | description: > | ||
| 24 | This API uses OAuth 2 with the application(clientCredentials) grant flow. | ||
| 25 | |||
| 26 | client_id=sMlciTkppsMzARwHpCVarm5q7DP2Vucj3ny8JFhw | ||
| 27 | |||
| 28 | client_secret=WNoOilDx140ZLcenDKfsnikv7S2LIFs60DciYoqnrZaYLqYsKpcmt7mJIL69o9AEf84uQvRnS3K2UioxfjNyImjR4UOyXbDcF6qYgTLC4KDVByKFdVhKfrn2Lc4q4BNW | ||
| 29 | |||
| 30 | scopes=write | ||
| 31 | tokenUrl: https://staging-bmw-ocr.situdata.com/api/oauth/token/ | ||
| 32 | scopes: | ||
| 33 | write: Grants write access | ||
| 34 | ''' | ||
| 35 | |||
| 36 | responses = ''' | ||
| 37 | ErrorResponse: | ||
| 38 | description: 调用异常, 具体情况请参考`HTTP`状态码和`code`字段 | ||
| 39 | schema: | ||
| 40 | $ref: '#/definitions/ApiResponse' | ||
| 41 | NoContent: | ||
| 42 | description: 后台接收请求,但是没有响应内容 | ||
| 43 | schema: | ||
| 44 | $ref: '#/definitions/ApiResponse' | ||
| 45 | ''' | ||
| 46 | |||
| 47 | parameters = '' | ||
| 48 | |||
| 49 | definitions = ''' | ||
| 50 | Doc: | ||
| 51 | type: object | ||
| 52 | required: [applicationData, applicantData, document] | ||
| 53 | properties: | ||
| 54 | applicationData: | ||
| 55 | description: 申请信息 | ||
| 56 | type: object | ||
| 57 | required: [applicationId] | ||
| 58 | properties: | ||
| 59 | applicationId: | ||
| 60 | description: 申请id | ||
| 61 | type: string | ||
| 62 | example: CH-B0011010101 | ||
| 63 | applicantData: | ||
| 64 | description: 申请人信息 | ||
| 65 | type: object | ||
| 66 | required: [mainApplicantName, coApplicantName, guarantor1Name, guarantor2Name] | ||
| 67 | properties: | ||
| 68 | mainApplicantName: | ||
| 69 | description: 主申请人 | ||
| 70 | type: string | ||
| 71 | example: 王明阳 | ||
| 72 | coApplicantName: | ||
| 73 | description: 共同申请人 | ||
| 74 | type: string | ||
| 75 | example: 王明月 | ||
| 76 | guarantor1Name: | ||
| 77 | description: 担保人1 | ||
| 78 | type: string | ||
| 79 | example: 王明日 | ||
| 80 | guarantor2Name: | ||
| 81 | description: 担保人2 | ||
| 82 | type: string | ||
| 83 | example: 王明雨 | ||
| 84 | document: | ||
| 85 | description: 文件信息 | ||
| 86 | type: object | ||
| 87 | required: [documentName, documentScheme, businessType, uploadFinishTime, dataSource, metadataVersionId] | ||
| 88 | properties: | ||
| 89 | documentName: | ||
| 90 | description: 文件名 | ||
| 91 | type: string | ||
| 92 | example: CH-B0011010101王明阳申请表 | ||
| 93 | documentScheme: | ||
| 94 | description: 文件方案 | ||
| 95 | type: string | ||
| 96 | example: Acceptance | ||
| 97 | enum: [Acceptance, Settlement, Contract Management] | ||
| 98 | businessType: | ||
| 99 | description: 业务类型 | ||
| 100 | type: string | ||
| 101 | example: CO00001 | ||
| 102 | enum: [CO00001, CO00002] | ||
| 103 | uploadFinishTime: | ||
| 104 | description: 上传完成时间 | ||
| 105 | type: string | ||
| 106 | example: '2020-09-01 12:21:11' | ||
| 107 | dataSource: | ||
| 108 | description: 数据源 | ||
| 109 | type: string | ||
| 110 | example: POS | ||
| 111 | enum: [POS, EAPP, Econtract] | ||
| 112 | metadataVersionId: | ||
| 113 | description: 元数据版本ID | ||
| 114 | type: string | ||
| 115 | example: '8410480' | ||
| 116 | |||
| 117 | Application: | ||
| 118 | type: object | ||
| 119 | required: [APPLICATION_INFORMATION] | ||
| 120 | properties: | ||
| 121 | APPLICATION_INFORMATION: | ||
| 122 | description: 申请单信息 | ||
| 123 | type: object | ||
| 124 | required: [SUBMIT_DATETIME, STATUS, ENTITY, RATING, APPLICATION_ID, APPLICATION_VERSION, INTERMEDIATE_DECISION] | ||
| 125 | properties: | ||
| 126 | SUBMIT_DATETIME: | ||
| 127 | description: 提交时间 | ||
| 128 | type: string | ||
| 129 | example: 2020-07-08T18:33:31.000+08:00 | ||
| 130 | STATUS: | ||
| 131 | description: 状态 | ||
| 132 | type: integer | ||
| 133 | example: 42 | ||
| 134 | ENTITY: | ||
| 135 | description: 业务类型 | ||
| 136 | type: string | ||
| 137 | example: CO00001 | ||
| 138 | enum: [CO00001, CO00002] | ||
| 139 | RATING: | ||
| 140 | description: 排名 | ||
| 141 | type: integer | ||
| 142 | example: 4 | ||
| 143 | APPLICATION_ID: | ||
| 144 | description: 申请id | ||
| 145 | type: string | ||
| 146 | example: CH-B0011010101 | ||
| 147 | APPLICATION_VERSION: | ||
| 148 | description: 申请版本 | ||
| 149 | type: integer | ||
| 150 | example: 1 | ||
| 151 | INTERMEDIATE_DECISION: | ||
| 152 | description: '' | ||
| 153 | type: string | ||
| 154 | example: MUW | ||
| 155 | |||
| 156 | individualCusInfo: | ||
| 157 | type: object | ||
| 158 | required: [applicantType, idType, customerChineseName, idNum, idExpiryDate, dateOfBirth, selfEmployedSubType] | ||
| 159 | properties: | ||
| 160 | applicantType: | ||
| 161 | description: applicantType | ||
| 162 | type: string | ||
| 163 | example: COAPP | ||
| 164 | enum: [COAPP, CUSTR, GAUTR1, GAUTR2] | ||
| 165 | idType: | ||
| 166 | description: idType | ||
| 167 | type: string | ||
| 168 | example: ITARI | ||
| 169 | enum: [ITARI, ITHKM, ITPRC, ITPSP, ITRES, ITTID, ITUSC, ITCCU] | ||
| 170 | secondIdType: | ||
| 171 | description: secondIdType | ||
| 172 | type: string | ||
| 173 | example: ITARI | ||
| 174 | enum: [ITARI, ITHKM, ITPRC, ITPSP, ITRES, ITTID] | ||
| 175 | customerChineseName: | ||
| 176 | description: customerChineseName | ||
| 177 | type: string | ||
| 178 | example: 李四 | ||
| 179 | idNum: | ||
| 180 | description: idNum | ||
| 181 | type: string | ||
| 182 | example: 111111199404251111 | ||
| 183 | secondIdNum: | ||
| 184 | description: secondIdNum | ||
| 185 | type: string | ||
| 186 | example: 111111199404251111 | ||
| 187 | idExpiryDate: | ||
| 188 | description: idExpiryDate | ||
| 189 | type: string | ||
| 190 | example: 2027-04-30 | ||
| 191 | dateOfBirth: | ||
| 192 | description: dateOfBirth | ||
| 193 | type: string | ||
| 194 | example: 2027-04-30 | ||
| 195 | selfEmployedSubType: | ||
| 196 | description: selfEmployedSubType | ||
| 197 | type: string | ||
| 198 | example: CSIBM | ||
| 199 | enum: [CSIBM, CSOTH, CSSME] | ||
| 200 | |||
| 201 | Comparison: | ||
| 202 | type: object | ||
| 203 | required: [content] | ||
| 204 | properties: | ||
| 205 | content: | ||
| 206 | description: 比对内容信息 | ||
| 207 | type: object | ||
| 208 | required: [uniqSeq, applicationId, applicationEntity, customerType, applicationVersion, vehicleStatus, comments, individualCusInfo] | ||
| 209 | properties: | ||
| 210 | uniqSeq: | ||
| 211 | description: uniqSeq | ||
| 212 | type: string | ||
| 213 | example: 201809301905121000 | ||
| 214 | applicationId: | ||
| 215 | description: applicationId | ||
| 216 | type: string | ||
| 217 | example: CH-B100000123 | ||
| 218 | applicationEntity: | ||
| 219 | description: applicationEntity | ||
| 220 | type: string | ||
| 221 | example: HIL | ||
| 222 | enum: [AFC, HIL] | ||
| 223 | customerType: | ||
| 224 | description: customerType | ||
| 225 | type: string | ||
| 226 | example: TCCOR | ||
| 227 | enum: [TCCOR, TCDAS, TCFRE, TCIAS, TCIND, TCSEP, TCURE] | ||
| 228 | applicationVersion: | ||
| 229 | description: applicationVersion | ||
| 230 | type: integer | ||
| 231 | example: 0 | ||
| 232 | vehicleStatus: | ||
| 233 | description: vehicleStatus | ||
| 234 | type: string | ||
| 235 | example: PCUSD | ||
| 236 | enum: [PCUSD, PCNEW] | ||
| 237 | comments: | ||
| 238 | description: comments | ||
| 239 | type: array | ||
| 240 | items: | ||
| 241 | type: string | ||
| 242 | individualCusInfo: | ||
| 243 | description: individualCusInfo | ||
| 244 | type: array | ||
| 245 | items: | ||
| 246 | $ref: "#/definitions/individualCusInfo" | ||
| 247 | |||
| 248 | usedCarInfo: | ||
| 249 | description: usedCarInfo | ||
| 250 | type: object | ||
| 251 | required: [vinNo, manufactureDate, firstRegistrationDate] | ||
| 252 | properties: | ||
| 253 | vinNo: | ||
| 254 | description: vinNo | ||
| 255 | type: string | ||
| 256 | example: LBVSFJSDLFJLSDJF | ||
| 257 | manufactureDate: | ||
| 258 | description: manufactureDate | ||
| 259 | type: string | ||
| 260 | example: 2027-04-30 | ||
| 261 | firstRegistrationDate: | ||
| 262 | description: firstRegistrationDate | ||
| 263 | type: string | ||
| 264 | example: 2027-04-30 | ||
| 265 | |||
| 266 | corporateCusInfo: | ||
| 267 | description: corporateCusInfo | ||
| 268 | type: object | ||
| 269 | required: [customerChineseName, legalRepName, idNum, businessLicenseNo, taxRegistrationCode, incorporationDate, businessLicenseDueDate] | ||
| 270 | properties: | ||
| 271 | customerChineseName: | ||
| 272 | description: customerChineseName | ||
| 273 | type: string | ||
| 274 | example: 北京思图场景数据科技服务有限公司 | ||
| 275 | legalRepName: | ||
| 276 | description: legalRepName | ||
| 277 | type: string | ||
| 278 | example: 李六 | ||
| 279 | idNum: | ||
| 280 | description: idNum | ||
| 281 | type: string | ||
| 282 | example: MA007438143XJ1P | ||
| 283 | businessLicenseNo: | ||
| 284 | description: businessLicenseNo | ||
| 285 | type: string | ||
| 286 | example: MA007438143XJ1P | ||
| 287 | taxRegistrationCode: | ||
| 288 | description: taxRegistrationCode | ||
| 289 | type: string | ||
| 290 | example: MA007438143XJ1P | ||
| 291 | incorporationDate: | ||
| 292 | description: incorporationDate | ||
| 293 | type: string | ||
| 294 | example: 2027-04-30 | ||
| 295 | businessLicenseDueDate: | ||
| 296 | description: businessLicenseDueDate | ||
| 297 | type: string | ||
| 298 | example: 2027-04-30 | ||
| 299 | |||
| 300 | ApiResponse: | ||
| 301 | description: 响应对象,code字段用于表示响应的状态; data字段用于存放响应内容 | ||
| 302 | type: object | ||
| 303 | required: [code, msg] | ||
| 304 | properties: | ||
| 305 | code: | ||
| 306 | type: integer | ||
| 307 | format: uint8 | ||
| 308 | description: '0: success | ||
| 309 | 1: need login | ||
| 310 | 2: invalid params | ||
| 311 | 3: internal error | ||
| 312 | 4: object not exist | ||
| 313 | 5: async wait | ||
| 314 | 6: no permission | ||
| 315 | 7: illegal operation' | ||
| 316 | example: 0 | ||
| 317 | enum: [0, 1, 2, 3, 4, 5, 6, 7] | ||
| 318 | msg: | ||
| 319 | type: string | ||
| 320 | example: success | ||
| 321 | data: | ||
| 322 | type: object | ||
| 323 | ''' | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -48,7 +48,7 @@ class Command(BaseCommand): | ... | @@ -48,7 +48,7 @@ class Command(BaseCommand): |
| 48 | view_class = view.view_class | 48 | view_class = view.view_class |
| 49 | url_path, path_parameters = pattern[0][0] | 49 | url_path, path_parameters = pattern[0][0] |
| 50 | url_path = unify_url_path_format(url_path) | 50 | url_path = unify_url_path_format(url_path) |
| 51 | if url_path not in ['/api/compare/settlement/v1', '/api/compare/v1']: | 51 | if url_path not in ['/api/compare/offline/v1']: |
| 52 | continue | 52 | continue |
| 53 | url_path_paramters = getattr(view, 'parameters_doc', None) | 53 | url_path_paramters = getattr(view, 'parameters_doc', None) |
| 54 | if url_path_paramters: | 54 | if url_path_paramters: | ... | ... |
src/common/tools/mssql_script3.py
0 → 100644
| 1 | import pyodbc | ||
| 2 | |||
| 3 | hil_sql = """ | ||
| 4 | |||
| 5 | """ | ||
| 6 | |||
| 7 | afc_sql = """ | ||
| 8 | |||
| 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