Commit 4291f70d authored by xianyang's avatar xianyang

优化异常修复报表

parent 9fd00077
...@@ -75,12 +75,12 @@ class Recovery_fix(PublicModel): ...@@ -75,12 +75,12 @@ class Recovery_fix(PublicModel):
class RecoveryTable(BaseModel): class RecoveryTable(BaseModel):
uuid: str uuid: Optional[str] = ''
type: int type: int
out_money: int out_money: Optional[int] = None
entry_money: int entry_money: Optional[int] = None
from_time: str from_time: Optional[str] = ''
cont: str cont: Optional[str] = ''
@validator('cont') @validator('cont')
def cont_must_contain_space(cls, c): def cont_must_contain_space(cls, c):
......
...@@ -455,7 +455,7 @@ def update_recovery_table(data): ...@@ -455,7 +455,7 @@ def update_recovery_table(data):
change_out_price = data.out_money - old_this_info[0]['out_money'] change_out_price = data.out_money - old_this_info[0]['out_money']
change_entry_money = data.entry_money - old_this_info[0]['entry_money'] change_entry_money = data.entry_money - old_this_info[0]['entry_money']
try: try:
update_sql = f"update finance_error_transverse_log set uuid='{data.uuid}',type={data.type},out_money={data.out_money},entry_money={data.entry_money},befor_out_money=befor_out_money+{change_out_price},befor_entry_money=befor_entry_money+{change_entry_money},from_time='{data.from_time}',cont='{data.cont}' where id={data.id}" update_sql = f"update finance_error_transverse_log set type={data.type},out_money={data.out_money},entry_money={data.entry_money},befor_out_money=befor_out_money+{change_out_price},befor_entry_money=befor_entry_money+{change_entry_money},cont='{data.cont}' where id={data.id}"
LinkMysql(env.DB_3YV2).perform_mysql(update_sql) LinkMysql(env.DB_3YV2).perform_mysql(update_sql)
except Exception as e: except Exception as e:
return e return e
......
...@@ -177,6 +177,8 @@ def recovery_fix(page: int, ...@@ -177,6 +177,8 @@ def recovery_fix(page: int,
@router.post("/submit/recovery") @router.post("/submit/recovery")
def finance_fix(data: acc_schemas.RecoveryTable, token=Depends(login_required), db: Session = Depends(get_db)): def finance_fix(data: acc_schemas.RecoveryTable, token=Depends(login_required), db: Session = Depends(get_db)):
"""新增异常数据修复""" """新增异常数据修复"""
if not all([data.uuid, data.out_money, data.entry_money, data.from_time, data.cont]):
return HttpResultResponse(code=500, msg='缺少必传参数')
res = guild.create_recovery_table(data) res = guild.create_recovery_table(data)
if res: if res:
return HttpResultResponse(code=500, msg=res) return HttpResultResponse(code=500, msg=res)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment