b0ca4ade by 冯轩

init4562

1 parent 3a4fd0b0
......@@ -4,5 +4,6 @@ from . import views
urlpatterns = [
path(r'', views.DocView.as_view()),
path(r'query/employee', views.EmployeeView.as_view()),
path(r'contract/v1', views.SEContractView.as_view()),
]
......
......@@ -90,6 +90,10 @@ class CustomDecimal(fields.Decimal):
def load_data(request, schema):
return request.data
employee_args = {
'applicationId': fields.Str(required=True, validate=validate.Length(max=64)),
'business_type': fields.Str(required=True, validate=validate.Length(max=64)),
}
go_args = {
'image': fields.Raw(required=True),
......@@ -1845,3 +1849,25 @@ class GoView(GenericView):
return response.ok(data=result)
else:
return response.error_msg(msg='识别错误')
class EmployeeView(GenericView):
permission_classes = [IsAuthenticated]
authentication_classes = [OAuth2AuthenticationWithUser]
@use_args(employee_args, location='data')
def post(self, request, args):
application_id = args.get('application_id')
business_type = args.get('business_type')
ocr_result_class = HILOCRResult if business_type in consts.HIL_SET else AFCOCRResult
ocr_result_info = ocr_result_class.objects.filter(application_id=application_id).first()
if not ocr_result_info:
return response.ok(data=False)
bss_ocr_str = ocr_result_info.bss_ocr
bss_ocr = json.loads(bss_ocr_str)
for one_bss in bss_ocr:
income_keywords = one_bss['income_keywords']
if income_keywords is not None and len(income_keywords) > 0:
return response.ok(data=True)
return response.ok(data=False)
\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!