diff --git a/alibabacloud_sample/fileservice.py b/alibabacloud_sample/fileservice.py index ab2386a..f3987fc 100644 --- a/alibabacloud_sample/fileservice.py +++ b/alibabacloud_sample/fileservice.py @@ -2,7 +2,6 @@ from typing import Any from flask import Request -from werkzeug.datastructures import FileStorage from werkzeug.utils import secure_filename import os , time, hashlib from alibabacloud_sample.dataservice import DataService @@ -18,10 +17,10 @@ class FileService: if request.method == 'POST': # 检查是否有文件在请求中 if 'file' not in request.files: - return 'No file part' + return '没有文件被上传' file = request.files['file'] if file.filename == '': - return 'No selected file' + return '请重新选择文件' if file: date = time.strftime("%Y%m%d", time.localtime()) filetype = secure_filename(file.filename) @@ -30,7 +29,7 @@ class FileService: os.makedirs(os.path.dirname(filepath), exist_ok=True) file.save(filepath) file_size = os.path.getsize(filepath) - file_hash = self.getHash(filepath) + file_hash = self.get_hash(filepath) v_file = dataservice.get_file(file_hash,file_size) if v_file: os.remove(filepath) @@ -39,8 +38,11 @@ class FileService: v_file = dataservice.insert_file_data(file.filename, filepath, file_size, filetype, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),file_hash) print("insert v_file:", v_file) return v_file + return None + # 获取文件md5 - def getHash(self, file_path: str) -> str: + @staticmethod + def get_hash(file_path: str) -> str: with open(file_path, 'rb') as f: md5 = hashlib.md5() while True: diff --git a/alibabacloud_sample/main.py b/alibabacloud_sample/main.py index ade75b2..a4926cf 100644 --- a/alibabacloud_sample/main.py +++ b/alibabacloud_sample/main.py @@ -1,11 +1,9 @@ - - from flask import Flask, request, render_template, send_from_directory from flask_cors import CORS from alibabacloud_sample.dataservice import DataService from alibabacloud_sample.fileservice import FileService from alibabacloud_sample.service import Service -from dateutil import parser + app = Flask(__name__) CORS(app) app.config['UPLOAD_FOLDER'] = 'uploads' # 指定上传文件夹 @@ -66,22 +64,22 @@ def reverify(): return service.verify(data=data,file_path=file_path,reverify=True) # 发票列表 @app.route('/listInvoice',methods=['POST']) -def listInvoice(): +def list_invoice(): value = request.form.get('value') verify_status = request.form.get('verifyStatus') return dataservice.get_invoice_list(value=value,verify_status=verify_status) @app.route('/listInvoiceTimeOut',methods=['POST']) -def listInvoiceTimeOut(): +def list_invoice_time_out(): time_out = request.form.get('timeOut') return dataservice.get_invoice_list(value='',verify_status='',time_out=time_out) # 发票日志列表 @app.route('/listLogs',methods=['GET']) -def listLogs(): +def list_logs(): file_path = request.args.get('filePath') return dataservice.get_verify_log_list(file_path=file_path) # 更新发票标注 @app.route('/updateInvoice',methods=['POST']) -def updateInvoice(): +def update_invoice(): invoice_id = request.form.get('invoiceId') status = request.form.get('status') desc = request.form.get('desc') diff --git a/webapp/vite-project/src/components/check/Check.vue b/webapp/vite-project/src/components/check/Check.vue index f8c1c4a..039e3e4 100644 --- a/webapp/vite-project/src/components/check/Check.vue +++ b/webapp/vite-project/src/components/check/Check.vue @@ -24,9 +24,7 @@ @finish="onFinish" @finishFailed="onFinishFailed" > - - - + @@ -57,6 +55,9 @@ + + + diff --git a/webapp/vite-project/src/pages/manage.vue b/webapp/vite-project/src/pages/manage.vue index 823646e..eb7d0b8 100644 --- a/webapp/vite-project/src/pages/manage.vue +++ b/webapp/vite-project/src/pages/manage.vue @@ -15,6 +15,16 @@ const columns = [ dataIndex: 'invoiceNumber', key: 'invoiceNumber', }, + { + title: '销方名称', + dataIndex: 'sellerName', + key: 'sellerName', + }, + { + title: '销方税号', + dataIndex: 'sellerTaxNumber', + key: 'sellerTaxNumber', + }, { title: '不含税金额', dataIndex: 'invoiceAmountPreTax', @@ -35,16 +45,7 @@ const columns = [ dataIndex: 'invoiceDate', key: 'invoiceDate', }, - { - title: '销方名称', - dataIndex: 'sellerName', - key: 'sellerName', - }, - { - title: '销方税号', - dataIndex: 'sellerTaxNumber', - key: 'sellerTaxNumber', - }, + { title: '查验结果', dataIndex: 'cyjgxx',