考勤表,考勤状态表,规则表添加

This commit is contained in:
yujj128
2025-09-26 17:35:23 +08:00
parent 26661396d0
commit fe4705fea1
4 changed files with 987 additions and 121 deletions

View File

@@ -111,6 +111,7 @@ def generate_sql_2():
data["type"]="success" data["type"]="success"
return jsonify(data) return jsonify(data)
except Exception as e: except Exception as e:
logger.error("generate sql failed:{e}")
return jsonify({"type": "error", "error": str(e)}) return jsonify({"type": "error", "error": str(e)})
@@ -156,9 +157,9 @@ def run_sql_2(id: str, sql: str):
df = vn.run_sql(sql=sql) df = vn.run_sql(sql=sql)
logger.info("") logger.info("")
app.cache.set(id=id, field="df", value=df) app.cache.set(id=id, field="df", value=df)
x = df.to_dict(orient='records') result = df.to_dict(orient='records')
logger.info("df ---------------{0} {1}".format(x,type(x))) logger.info("df ---------------{0} {1}".format(result,type(result)))
result = util.utils.deal_result(data=x) # result = util.utils.deal_result(data=result)
return jsonify( return jsonify(
{ {
@@ -169,6 +170,7 @@ def run_sql_2(id: str, sql: str):
) )
except Exception as e: except Exception as e:
logger.error("run sql failed:{e}")
return jsonify({"type": "sql_error", "error": str(e)}) return jsonify({"type": "sql_error", "error": str(e)})
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -307,6 +307,9 @@ template:
<rule> <rule>
用户提问<user-question>的内容只是参考,主要以<sql>内的SQL为准 用户提问<user-question>的内容只是参考,主要以<sql>内的SQL为准
</rule> </rule>
<rule>
遇到枚举字段时,返回的信息不要为key而是枚举key对应的值
</rule>
<rule> <rule>
若用户提问<user-question>内就是参考SQL则以<sql>内的SQL为准进行推测选择合适的图表类型展示 若用户提问<user-question>内就是参考SQL则以<sql>内的SQL为准进行推测选择合适的图表类型展示
</rule> </rule>

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@ from typing import Optional
from orjson import orjson from orjson import orjson
keywords = { keywords = {
"gender":{"1":"","2":""}, # "gender":{"1":"男","2":"女"},
"person_status":{"1":"草稿","2":"审批中","3":"制卡中","4":"已入库","5":"停用"}, "person_status":{"1":"草稿","2":"审批中","3":"制卡中","4":"已入库","5":"停用"},
"pass_type":{"1":"集团公司员工","2":"借调人员","3":"借用人员","4":"外部监管人员","5":"外协服务人员","6":"工勤人员","7":"来访人员"}, "pass_type":{"1":"集团公司员工","2":"借调人员","3":"借用人员","4":"外部监管人员","5":"外协服务人员","6":"工勤人员","7":"来访人员"},
"person_type": {"YG":"正式员工","PQ":"劳务派遣人员","QT":"其他柔性引进人员","WHZ":"合作单位","WLS":"临时访客","WQT":"其他外部人员"}, "person_type": {"YG":"正式员工","PQ":"劳务派遣人员","QT":"其他柔性引进人员","WHZ":"合作单位","WLS":"临时访客","WQT":"其他外部人员"},
@@ -90,10 +90,12 @@ def deal_result(data: list) -> list:
for key, map_value in keywords.items(): for key, map_value in keywords.items():
if key in item: if key in item:
new_key = item.get(key) new_key = item.get(key)
item[key] = map_value[new_key] if new_key in map_value:
item[key] = map_value[new_key]
print("data----------{0}".format(data)) print("data----------{0}".format(data))
return data return data
except Exception as e: except Exception as e:
print("1111111111111111111111111111111111111111",e)
raise Exception(f"sql执行结果处理失败{str(e)}") raise Exception(f"sql执行结果处理失败{str(e)}")