swagger yaml file
Showing
4 changed files
with
159 additions
and
7 deletions
docs/main.yaml
0 → 100644
| 1 | swagger: '2.0' | ||
| 2 | info: | ||
| 3 | title: 接口文档 | ||
| 4 | description: 宝马ocr/biz_logic接口文档 | ||
| 5 | version: 1.0.0 | ||
| 6 | host: staging-bmw-ocr.situdata.com | ||
| 7 | basePath: / | ||
| 8 | tags: | ||
| 9 | - name: doc | ||
| 10 | description: 文件 | ||
| 11 | schemes: | ||
| 12 | - https | ||
| 13 | - http | ||
| 14 | paths: | ||
| 15 | /api/create/v1/: | ||
| 16 | post: | ||
| 17 | tags: | ||
| 18 | - doc | ||
| 19 | summary: POS系统上传文件信息 | ||
| 20 | consumes: | ||
| 21 | - application/json | ||
| 22 | produces: | ||
| 23 | - application/json | ||
| 24 | parameters: | ||
| 25 | - in: body | ||
| 26 | name: body | ||
| 27 | required: true | ||
| 28 | schema: | ||
| 29 | $ref: '#/definitions/Doc' | ||
| 30 | responses: | ||
| 31 | 200: | ||
| 32 | description: ok | ||
| 33 | schema: | ||
| 34 | $ref: '#/definitions/ApiResponse' | ||
| 35 | responses: | ||
| 36 | ErrorResponse: | ||
| 37 | description: 调用异常, 具体情况请参考`HTTP`状态码和`code`字段 | ||
| 38 | schema: | ||
| 39 | $ref: '#/definitions/ApiResponse' | ||
| 40 | NoContent: | ||
| 41 | description: 后台接收请求,但是没有响应内容 | ||
| 42 | schema: | ||
| 43 | $ref: '#/definitions/ApiResponse' | ||
| 44 | definitions: | ||
| 45 | Doc: | ||
| 46 | type: object | ||
| 47 | required: | ||
| 48 | - applicationData | ||
| 49 | - applicantData | ||
| 50 | - document | ||
| 51 | properties: | ||
| 52 | applicationData: | ||
| 53 | description: 申请信息 | ||
| 54 | type: object | ||
| 55 | required: | ||
| 56 | - applicationId | ||
| 57 | properties: | ||
| 58 | applicationId: | ||
| 59 | description: 申请id | ||
| 60 | type: string | ||
| 61 | example: CH-B0011010101 | ||
| 62 | applicantData: | ||
| 63 | description: 申请人信息 | ||
| 64 | type: object | ||
| 65 | required: | ||
| 66 | - mainApplicantName | ||
| 67 | - coApplicantName | ||
| 68 | - guarantor1Name | ||
| 69 | - guarantor2Name | ||
| 70 | properties: | ||
| 71 | mainApplicantName: | ||
| 72 | description: 主申请人 | ||
| 73 | type: string | ||
| 74 | example: 王明阳 | ||
| 75 | coApplicantName: | ||
| 76 | description: 共同申请人 | ||
| 77 | type: string | ||
| 78 | example: 王明月 | ||
| 79 | guarantor1Name: | ||
| 80 | description: 担保人1 | ||
| 81 | type: string | ||
| 82 | example: 王明日 | ||
| 83 | guarantor2Name: | ||
| 84 | description: 担保人2 | ||
| 85 | type: string | ||
| 86 | example: 王明雨 | ||
| 87 | document: | ||
| 88 | description: 文件信息 | ||
| 89 | type: object | ||
| 90 | required: | ||
| 91 | - documentName | ||
| 92 | - documentScheme | ||
| 93 | - businessType | ||
| 94 | - uploadFinishTime | ||
| 95 | - dataSource | ||
| 96 | - metadataVersionId | ||
| 97 | properties: | ||
| 98 | documentName: | ||
| 99 | description: 文件名 | ||
| 100 | type: string | ||
| 101 | example: CH-B0011010101王明阳申请表 | ||
| 102 | documentScheme: | ||
| 103 | description: 文件格式? | ||
| 104 | type: string | ||
| 105 | example: CO00001 | ||
| 106 | businessType: | ||
| 107 | description: 业务类型 | ||
| 108 | type: string | ||
| 109 | example: HIL | ||
| 110 | uploadFinishTime: | ||
| 111 | description: 上传完成时间 | ||
| 112 | type: string | ||
| 113 | example: '2020-09-01 12:21:11' | ||
| 114 | dataSource: | ||
| 115 | description: 数据源 | ||
| 116 | type: string | ||
| 117 | example: POS | ||
| 118 | metadataVersionId: | ||
| 119 | description: 元数据版本ID | ||
| 120 | type: string | ||
| 121 | example: '8410480' | ||
| 122 | ApiResponse: | ||
| 123 | description: 响应对象,code字段用于表示响应的状态; data字段用于存放响应内容 | ||
| 124 | type: object | ||
| 125 | required: | ||
| 126 | - code | ||
| 127 | - msg | ||
| 128 | properties: | ||
| 129 | code: | ||
| 130 | type: integer | ||
| 131 | format: uint8 | ||
| 132 | description: '0: success 1: need login 2: invalid params 3: internal error | ||
| 133 | 4: object not exist 5: async wait 6: no permission 7: illegal operation' | ||
| 134 | example: 0 | ||
| 135 | enum: | ||
| 136 | - 0 | ||
| 137 | - 1 | ||
| 138 | - 2 | ||
| 139 | - 3 | ||
| 140 | - 4 | ||
| 141 | - 5 | ||
| 142 | - 6 | ||
| 143 | - 7 | ||
| 144 | msg: | ||
| 145 | type: string | ||
| 146 | example: success | ||
| 147 | data: | ||
| 148 | type: object |
| ... | @@ -8,16 +8,20 @@ class Command(BaseCommand): | ... | @@ -8,16 +8,20 @@ class Command(BaseCommand): |
| 8 | 8 | ||
| 9 | def __init__(self): | 9 | def __init__(self): |
| 10 | super().__init__() | 10 | super().__init__() |
| 11 | # 处理文件开关 | ||
| 11 | self.switch = True | 12 | self.switch = True |
| 13 | # 优雅退出信号:15 | ||
| 12 | signal.signal(signal.SIGTERM, self.signal_handler) | 14 | signal.signal(signal.SIGTERM, self.signal_handler) |
| 13 | 15 | ||
| 14 | def signal_handler(self, sig, frame): | 16 | def signal_handler(self, sig, frame): |
| 15 | self.switch = False | 17 | self.switch = False # 停止处理文件 |
| 16 | print('get sig: {0}'.format(sig)) | ||
| 17 | 18 | ||
| 18 | def handle(self, *args, **kwargs): | 19 | def handle(self, *args, **kwargs): |
| 19 | while self.switch: | 20 | while self.switch: |
| 20 | print('process start') | 21 | # 从队列获取文件信息 |
| 21 | time.sleep(5) | 22 | # 从EDMS获取PDF文件 |
| 22 | print('process success') | 23 | # PDF文件分页转化为图片 |
| 23 | print('process stop') | 24 | # 图片调用算法判断是否为银行流水 |
| 25 | # 图片调用算法OCR为excel文件 | ||
| 26 | # excel文件上传至EDMS | ||
| 27 | pass | ... | ... |
-
Please register or sign in to post a comment