feat:换为人工过滤meetingRoomName和meetingRoomTypeName
This commit is contained in:
@@ -155,7 +155,8 @@ def query_avali_room(data: dict, params: dict) -> str:
|
||||
Region = data.get('Region', None)
|
||||
start_time = data.get('start_time', None)
|
||||
end_time = data.get('end_time', None)
|
||||
params['meetingRoomName'] = Region
|
||||
# params['meetingRoomName'] = Region
|
||||
# params['meetingRoomTypeName'] = Region
|
||||
params['capacity'] = capacity if capacity else 0
|
||||
params['pageNum'] = 1
|
||||
params['pageSize'] = DEFAULT_QUERY_SIZE
|
||||
@@ -181,7 +182,25 @@ def query_avali_room(data: dict, params: dict) -> str:
|
||||
logger.info(" filter data: {0}".format(result))
|
||||
result = params_filter.filter_params(result, "query_meeting_room")
|
||||
logger.debug("query_avali_room result => {0}".format(result))
|
||||
return json.dumps(result, ensure_ascii=False)
|
||||
# return json.dumps(result, ensure_ascii=False)
|
||||
new_list = []
|
||||
# 字典中只要key存在,哪怕对应的value是'',也能取出来空字符串 data.get('capacity', 0)可能是空字符串
|
||||
capacity = data.get('capacity', 0)
|
||||
capacity_limit = int(capacity) if capacity not in [None, ''] else 0
|
||||
logger.info("capacity limit {0} {1}".format(capacity_limit, type(capacity_limit)))
|
||||
if data.get('Region') and data.get('Region') != 'None':
|
||||
region = data.get('Region')
|
||||
for b in result:
|
||||
logger.info("b.capacity {0} {1}".format(b.get('capacity', 0), type(b.get('capacity', 0))))
|
||||
if ((region in b.get('name', 'default') or region in b.get('typeName', 'default')) and b.get('capacity',
|
||||
0) >= capacity_limit):
|
||||
new_list.append(b)
|
||||
return json.dumps(new_list, ensure_ascii=False)
|
||||
else:
|
||||
for b in result:
|
||||
if b.get('capacity', 0) >= capacity_limit:
|
||||
new_list.append(b)
|
||||
return json.dumps(new_list, ensure_ascii=False)
|
||||
except Exception as ex:
|
||||
logger.exception("location: query_avali_room=> {0}".format(str(ex)))
|
||||
return error_respones.format("查询会议室信息")
|
||||
@@ -196,8 +215,9 @@ def query_booking_info(params: dict) -> str:
|
||||
raise Exception("tenantId 不能为空")
|
||||
access_token = getinfo.get_access_token(tenant_id)
|
||||
params['access_token'] = access_token
|
||||
params['startTimeStamp'] = get_time_info(0)
|
||||
params['endTimeStamp'] = get_time_info(10)
|
||||
if not params.get('startTimeStamp',None) and not params.get('endTimeStamp',None):
|
||||
params['startTimeStamp'] = get_time_info(0)
|
||||
params['endTimeStamp'] = get_time_info(10)
|
||||
# 查询所有已预定的会议
|
||||
meeting_room = getinfo.query_meetingbooking_info(params)
|
||||
# 过滤掉已经取消的会议
|
||||
@@ -226,8 +246,8 @@ def query_booking_info_by_user(params: dict, data=None):
|
||||
time_date = getinfo.standard_format(start_time) or getinfo.standard_format(end_time)
|
||||
current_date = time_date.split(' ')[0]
|
||||
logger.info("current date is {0}".format(current_date))
|
||||
mintime = datetime.min.time().strftime('%H:%M:%S')
|
||||
maxtime = datetime.max.time().strftime('%H:%M:%S')
|
||||
mintime = datetime.min.time().strftime('%H:%M:%S')
|
||||
start_time = parse_time(getinfo.standard_format(start_time) or " ".join((current_date, mintime)))
|
||||
end_time = parse_time(getinfo.standard_format(end_time) or " ".join((current_date, maxtime)))
|
||||
# datetime.
|
||||
|
||||
Reference in New Issue
Block a user