refactor(webapp): 优化发票验证流程和界面
- 修改验证流程初始步骤为第3步- 更新验证结果展示方式,使用 Ant Design Result 组件 -优化上传页面样式,增加顶部间距 - 调整验证接口返回格式,统一错误处理
This commit is contained in:
@@ -44,15 +44,15 @@ def verify():
|
||||
file_path = request.args.get('filePath')
|
||||
invoice_id = request.args.get('invoiceId')
|
||||
if file_path is None:
|
||||
return "请选择文件"
|
||||
return {"msg":"请选择文件","status":'fail'}
|
||||
service = Service()
|
||||
data = dataservice.get_invoice(file_path=file_path,invice_id=invoice_id)
|
||||
if data is not None:
|
||||
if data.get('status') == 'yes':
|
||||
return "已报销发票!!"
|
||||
return {"msg":"请勿重复验证","status":'fail'}
|
||||
return service.verify(data=data,file_path=file_path)
|
||||
else:
|
||||
return "请选择文件"
|
||||
return {"msg":"请先识别发票","status":'fail'}
|
||||
# 发票复验
|
||||
@app.route('/reverify', methods=['GET'])
|
||||
def reverify():
|
||||
|
||||
@@ -105,13 +105,14 @@ class Service:
|
||||
resdata = {'cyjgxx': "未查询到发票信息", 'inspectionAmount': -1,'status': 'fail'}
|
||||
else:
|
||||
resdata.update({'status': 'success'})
|
||||
resdata['status'] = 'success'
|
||||
dataservice.insert_verify_log(resdata.get('inspectionAmount'), resdata.get('cyjgxx'), file_path)
|
||||
dataservice.update_invoice_status(data.get('id'), resdata.get('status'), resdata.get('inspectionAmount'))
|
||||
return resdata
|
||||
except Exception as error:
|
||||
# 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
# 错误 message
|
||||
print(error.message)
|
||||
print(error)
|
||||
# 诊断地址
|
||||
print(error.data.get("Recommend"))
|
||||
UtilClient.assert_as_string(error.message)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user