|
@@ -31,7 +31,7 @@ def name_get_user_id(db,keywords):
|
|
|
def user_id_get_duty_id(db,user_id_list):
|
|
|
query = db.query(DutyPersonnelArrangement)
|
|
|
query = query.filter(DutyPersonnelArrangement.del_flag != '2')
|
|
|
- query = query.filter(DutyPersonnelArrangement.personnel_id._in(user_id_list))
|
|
|
+ query = query.filter(DutyPersonnelArrangement.personnel_id.in_(user_id_list))
|
|
|
data = query.all()
|
|
|
return [info.duty_id for info in data]
|
|
|
|
|
@@ -52,9 +52,9 @@ def user_id_get_info(db,user_id):
|
|
|
def get_duty_unit_id_list(db):
|
|
|
query = db.query(SysDictData)
|
|
|
query = query.filter(SysDictData.del_flag != '2')
|
|
|
- query = query.filter(SysDictData.dict_value=='duty_unit')
|
|
|
+ query = query.filter(SysDictData.dict_type=='duty_unit')
|
|
|
data = query.all()
|
|
|
- return [int(i) for i in data]
|
|
|
+ return [int(i.dict_value) for i in data]
|
|
|
|
|
|
def dept_id_get_duty_unit_id(db,dept_id,duty_unit_id_list):
|
|
|
if dept_id == 0:
|
|
@@ -106,7 +106,7 @@ async def get_dict_data_by_type(
|
|
|
if keywords:
|
|
|
user_list= name_get_user_id(db,keywords)
|
|
|
duty_list = user_id_get_duty_id(db,user_list)
|
|
|
- query = query.filter(DutySchedule.id._in(duty_list))
|
|
|
+ query = query.filter(DutySchedule.id.in_(duty_list))
|
|
|
|
|
|
if duty_type:
|
|
|
query = query.filter(DutySchedule.duty_type==duty_type)
|
|
@@ -197,7 +197,7 @@ async def get_dict_data_by_type(
|
|
|
if keywords:
|
|
|
user_list= name_get_user_id(db,keywords)
|
|
|
duty_list = user_id_get_duty_id(db,user_list)
|
|
|
- query = query.filter(DutySchedule.id._in(duty_list))
|
|
|
+ query = query.filter(DutySchedule.id.in_(duty_list))
|
|
|
if start_time:
|
|
|
start_time = datetime.strptime(start_time, "%Y-%m-%d").date()
|
|
|
query = query.filter(DutySchedule.duty_date>=start_time)
|
|
@@ -208,8 +208,9 @@ async def get_dict_data_by_type(
|
|
|
query = query.filter(DutySchedule.duty_unit==duty_unit)
|
|
|
else:
|
|
|
now_user_info=user_id_get_user_info(db,user_id)
|
|
|
+ print(user_id,now_user_info.phonenumber,get_duty_unit_id_list(db))
|
|
|
if now_user_info:
|
|
|
- query = query.filter(DutySchedule.duty_unit==mobile_phone_get_dept_id(db,now_user_info.phonenumber,get_duty_unit_id_list(db)))
|
|
|
+ query = query.filter(DutySchedule.duty_unit==mobile_phone_get_dept_id(db,mpfun.dec_data(now_user_info.phonenumber),get_duty_unit_id_list(db)))
|
|
|
else:
|
|
|
return {
|
|
|
"total": 0,
|
|
@@ -224,7 +225,7 @@ async def get_dict_data_by_type(
|
|
|
DutySchedule.duty_date,
|
|
|
DutySchedule.shift_type,
|
|
|
func.max(DutySchedule.update_time).label("latest_create_time")
|
|
|
- ).group_by(
|
|
|
+ ).filter(DutySchedule.del_flag != '2').group_by(
|
|
|
DutySchedule.duty_date,
|
|
|
DutySchedule.shift_type
|
|
|
).subquery()
|
|
@@ -243,6 +244,7 @@ async def get_dict_data_by_type(
|
|
|
# 计算分页
|
|
|
offset = (page - 1) * pageSize
|
|
|
query = query.order_by(DutySchedule.update_time.desc())
|
|
|
+ print(query)
|
|
|
duty_data = query.offset(offset).limit(pageSize).all()
|
|
|
|
|
|
# 转换为字典
|
|
@@ -323,7 +325,7 @@ async def get_dict_data_by_type(
|
|
|
"mobile_phone": contact_info.mobile_phone,
|
|
|
"office_phone": contact_info.office_phone,
|
|
|
"department_id": contact_info.department_id,
|
|
|
- "yzy_userid": contact_info.yzy_userid})
|
|
|
+ "yzy_userid": contact_info.userid})
|
|
|
data_list={
|
|
|
"id": d.id,
|
|
|
"start_time": d.start_time,
|
|
@@ -527,7 +529,7 @@ async def delete_dict_data(
|
|
|
# 从数据库中获取要删除的 OneShareApiEntity 实例
|
|
|
id_list = [int(i) for i in id_list.split(',')]
|
|
|
query = db.query(DutySchedule)
|
|
|
- query = query.filter(DutySchedule.id._in(id_list))
|
|
|
+ query = query.filter(DutySchedule.id.in_(id_list))
|
|
|
query = query.filter(DutySchedule.del_flag != '2')
|
|
|
position_data = query.all()
|
|
|
# dict_data = db.query(SysDictData).filter(SysDictData.dict_code == dictCode and SysDictData.del_flag != '2').first()
|