diff --git a/Config/daily_out_temps.docx b/Config/daily_out_temps.docx index c3adc2d..fd8da42 100644 Binary files a/Config/daily_out_temps.docx and b/Config/daily_out_temps.docx differ diff --git a/Config/word_data_template.json b/Config/word_data_template.json index f1891be..0ec0e5e 100644 --- a/Config/word_data_template.json +++ b/Config/word_data_template.json @@ -60,8 +60,7 @@ "分支机构": [ "浙江分公司", "湖南子公司", - "鼎信团队", - "四川远东" + "鼎信团队" ] }, "监管和同业动态": [ diff --git a/Crud/DailyCrud.py b/Crud/DailyCrud.py index 3787567..0d764d1 100644 --- a/Crud/DailyCrud.py +++ b/Crud/DailyCrud.py @@ -63,7 +63,7 @@ def replace_words(content): def daily_add(db: Session, data): daily = Daily(**data) if daily.content: - daily.content = replace_word(daily.content) + daily.content = replace_words(daily.content) db.add(daily) db.commit() db.refresh(daily) @@ -73,7 +73,7 @@ def daily_add(db: Session, data): def daily_change(db: Session, item_id, data): content = data.get('content') if content: - data['content'] = replace_word(content) + data['content'] = replace_words(content) db.query(Daily).filter_by(id=item_id).update(data) db.commit() item = db.query(Daily).filter_by(id=item_id).first() diff --git a/Mods/Notice/Utils.py b/Mods/Notice/Utils.py index 5930532..e35e083 100644 --- a/Mods/Notice/Utils.py +++ b/Mods/Notice/Utils.py @@ -63,7 +63,7 @@ def get_user_not_fill_daily(): filled_user_list = {item.fill_user for item in daily_list} notice_user_list = [item for item in db.query(User).filter(User.email.not_in(filled_user_list)) if - item.name not in ['邢军']] + item.name not in ['邢军'] and item.daily_fill_notice is True] email_list = [user.email for user in notice_user_list] name_list = [user.name for user in notice_user_list] # print(name_list) @@ -140,11 +140,12 @@ class DailyNotice: while True: time.sleep(15) now = datetime.now() - if is_workday() and now.hour == 15 and (35<= now.minute < 35 + 3) and not sended: + if is_workday() and now.hour == 15 and (35 <= now.minute < 35 + 3) and not sended: sended = True try: user_list = get_user_not_fill_daily() - args_list = [['日报填报提醒', user.email, daily_fill_send] for user in user_list if user.daily_fill_notice] + args_list = [['日报填报提醒', user.email, daily_fill_send] for user in user_list if + user.daily_fill_notice] # args_list = [['日报填报提醒', user.email, daily_fill_send] for user in user_list if user.name in ['王思川','伍春全','李凯','彭森','徐聿成','陈世杰']] self.email_send_thread(args_list) # send_email('日报填报提醒', "fecribd@fecr.com.cn", daily_fill_send) diff --git a/Router/UserRouter.py b/Router/UserRouter.py index 7c9e860..d911701 100644 --- a/Router/UserRouter.py +++ b/Router/UserRouter.py @@ -270,7 +270,7 @@ def set_user_openid(body: UserSchemas.SetUserOpenidReq, @router.post("/get_user_can_watch_department", tags=["获取用户可查看部门列表"], summary=['查询']) def get_user_can_watch_department(token_data: TokenData = Depends(token_data_depend), db: Session = Depends(get_db)): print(token_data) - department_list = [item.to_dict() for item in UserCrud.get_department_list(db) if item.id not in [1, 2, 3]] + department_list = [item.to_dict() for item in UserCrud.get_department_list(db) if item.id not in [1, 2, 3] and item.name not in ["四川远东"]] department_dict = {item['id']: item for item in department_list} # 所有部门动态查看 if check_auth(token_data.auth_data, [2]): diff --git a/Utils/SqlAlchemyUtils.py b/Utils/SqlAlchemyUtils.py index 9c4a984..ee0035f 100644 --- a/Utils/SqlAlchemyUtils.py +++ b/Utils/SqlAlchemyUtils.py @@ -5,6 +5,7 @@ from sqlalchemy import create_engine, Column, and_, asc, desc, func, cast, DATE, from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, Session, DeclarativeMeta, Query from typing import Literal, List, Any, Optional +from sqlalchemy_utils import database_exists, create_database Base = declarative_base() @@ -13,6 +14,7 @@ password = "123456" host = "127.0.0.1" db = 'daily' + # user = "root" # password = "jntm2.5" # host = "192.168.0.89:13306" @@ -58,6 +60,9 @@ def get_db_i() -> Session: # yield db # finally: # db.close() +def create_db(engine): + if not database_exists(engine.url): + create_database(engine.url) def init_database(): @@ -67,7 +72,7 @@ def init_database(): # 通用查询接口 -QueryType = Literal['=',"!=", '==', '>', '>=', '<', '<=', 'in', 'like', 'range', 'find_in_set', "date=="] +QueryType = Literal['=', "!=", '==', '>', '>=', '<', '<=', 'in', 'like', 'range', 'find_in_set', "date=="] class QueryParam(BaseModel): diff --git a/requirements.txt b/requirements.txt index 73d8d41..5d2a981 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,5 @@ redis==4.5.1 pandas==1.5.3 openpyxl==3.1.2 docxtpl -pyahocorasick \ No newline at end of file +pyahocorasick +sqlalchemy_utils==0.41.1 \ No newline at end of file