|
@@ -38,6 +38,11 @@ async def code3001(**sources):
|
|
ipv4 = int(f"{item.get('host_address').replace('.', '')}")
|
|
ipv4 = int(f"{item.get('host_address').replace('.', '')}")
|
|
d2[ipv4] = item.get('pid')
|
|
d2[ipv4] = item.get('pid')
|
|
|
|
|
|
|
|
+ cockpit_name_dict = {
|
|
|
|
+ '': '1号舱',
|
|
|
|
+ '': '2号舱',
|
|
|
|
+ }
|
|
|
|
+
|
|
# --- fill d1 ---
|
|
# --- fill d1 ---
|
|
"""
|
|
"""
|
|
UserWorkRecordList: 用户操作记录
|
|
UserWorkRecordList: 用户操作记录
|
|
@@ -61,18 +66,20 @@ async def code3001(**sources):
|
|
item['uuid'] = uuid
|
|
item['uuid'] = uuid
|
|
item['start_time_at'] = item.get('start_at')
|
|
item['start_time_at'] = item.get('start_at')
|
|
item['end_time_at'] = item.get('end_at')
|
|
item['end_time_at'] = item.get('end_at')
|
|
- item['cockpit_name'] = item.get('cockpit_id')
|
|
|
|
|
|
|
|
- # --- check ---
|
|
|
|
|
|
+ # --- update driver_name ---
|
|
item['driver_name'] = item.get('user_uuid')
|
|
item['driver_name'] = item.get('user_uuid')
|
|
if len('67174cf9cd36d7a6def99cae') == len(item.get('user_uuid')):
|
|
if len('67174cf9cd36d7a6def99cae') == len(item.get('user_uuid')):
|
|
item['driver_name'] = Global.mdb.get_one_by_id('UserInfo', item.get('user_uuid')).get('name')
|
|
item['driver_name'] = Global.mdb.get_one_by_id('UserInfo', item.get('user_uuid')).get('name')
|
|
|
|
|
|
- # --- check ---
|
|
|
|
|
|
+ # --- update pid ---
|
|
item['pid'] = item.get('vehicle_id')
|
|
item['pid'] = item.get('vehicle_id')
|
|
if int(item.get('vehicle_id')) in d2:
|
|
if int(item.get('vehicle_id')) in d2:
|
|
item['pid'] = d2.get(int(item.get('vehicle_id')))
|
|
item['pid'] = d2.get(int(item.get('vehicle_id')))
|
|
|
|
|
|
|
|
+ # --- update cockpit_name ---
|
|
|
|
+ item['cockpit_name'] = item.get('cockpit_id')
|
|
|
|
+
|
|
# --- update --
|
|
# --- update --
|
|
del item['_id']
|
|
del item['_id']
|
|
del item['user_uuid']
|
|
del item['user_uuid']
|
|
@@ -81,82 +88,7 @@ async def code3001(**sources):
|
|
del item['cockpit_id']
|
|
del item['cockpit_id']
|
|
del item['vehicle_id']
|
|
del item['vehicle_id']
|
|
d1.append(item)
|
|
d1.append(item)
|
|
- # d1.append(item)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- # d1 = [
|
|
|
|
- # {
|
|
|
|
- # 'uuid': '65dbe96949fbe311a3a01d30',
|
|
|
|
- # 'pid': 'AA112233', # 车牌号
|
|
|
|
- # 'start_time_at': methods.now_ts(),
|
|
|
|
- # 'end_time_at': methods.now_ts() + (3600 * 8),
|
|
|
|
- # 'driver_name': '张三',
|
|
|
|
- # 'cockpit_name': '1号舱',
|
|
|
|
- # }, {
|
|
|
|
- # 'uuid': '65dbe96949fbe311a3a01d30',
|
|
|
|
- # 'pid': 'AA112233',
|
|
|
|
- # 'start_time_at': methods.now_ts(),
|
|
|
|
- # 'end_time_at': methods.now_ts() + (3600 * 8),
|
|
|
|
- # 'driver_name': '李四',
|
|
|
|
- # 'cockpit_name': '1号舱',
|
|
|
|
- # }, {
|
|
|
|
- # 'uuid': '65dbe96949fbe311a3a01d30',
|
|
|
|
- # 'pid': 'AA112233',
|
|
|
|
- # 'start_time_at': methods.now_ts(),
|
|
|
|
- # 'end_time_at': methods.now_ts() + (3600 * 8),
|
|
|
|
- # 'driver_name': '李四',
|
|
|
|
- # 'cockpit_name': '1号舱',
|
|
|
|
- # }, {
|
|
|
|
- # 'uuid': '65dbe96949fbe311a3a01d30',
|
|
|
|
- # 'pid': 'AA112233',
|
|
|
|
- # 'start_time_at': methods.now_ts(),
|
|
|
|
- # 'end_time_at': methods.now_ts() + (3600 * 8),
|
|
|
|
- # 'driver_name': '李四',
|
|
|
|
- # 'cockpit_name': '1号舱',
|
|
|
|
- # }, {
|
|
|
|
- # 'uuid': '65dbe96949fbe311a3a01d30',
|
|
|
|
- # 'pid': 'AA112233',
|
|
|
|
- # 'start_time_at': methods.now_ts(),
|
|
|
|
- # 'end_time_at': methods.now_ts() + (3600 * 8),
|
|
|
|
- # 'driver_name': '李四',
|
|
|
|
- # 'cockpit_name': '1号舱',
|
|
|
|
- # }, {
|
|
|
|
- # 'uuid': '65dbe96949fbe311a3a01d30',
|
|
|
|
- # 'pid': 'AA112233',
|
|
|
|
- # 'start_time_at': methods.now_ts(),
|
|
|
|
- # 'end_time_at': methods.now_ts() + (3600 * 8),
|
|
|
|
- # 'driver_name': '李四',
|
|
|
|
- # 'cockpit_name': '1号舱',
|
|
|
|
- # }, {
|
|
|
|
- # 'uuid': '65dbe96949fbe311a3a01d30',
|
|
|
|
- # 'pid': 'AA112233',
|
|
|
|
- # 'start_time_at': methods.now_ts(),
|
|
|
|
- # 'end_time_at': methods.now_ts() + (3600 * 8),
|
|
|
|
- # 'driver_name': '李四',
|
|
|
|
- # 'cockpit_name': '1号舱',
|
|
|
|
- # }, {
|
|
|
|
- # 'uuid': '65dbe96949fbe311a3a01d30',
|
|
|
|
- # 'pid': 'AA112233',
|
|
|
|
- # 'start_time_at': methods.now_ts(),
|
|
|
|
- # 'end_time_at': methods.now_ts() + (3600 * 8),
|
|
|
|
- # 'driver_name': '李四',
|
|
|
|
- # 'cockpit_name': '1号舱',
|
|
|
|
- # }, {
|
|
|
|
- # 'uuid': '65dbe96949fbe311a3a01d30',
|
|
|
|
- # 'pid': 'AA112233',
|
|
|
|
- # 'start_time_at': methods.now_ts(),
|
|
|
|
- # 'end_time_at': methods.now_ts() + (3600 * 8),
|
|
|
|
- # 'driver_name': '李四',
|
|
|
|
- # 'cockpit_name': '1号舱',
|
|
|
|
- # }, {
|
|
|
|
- # 'uuid': '65dbe96949fbe311a3a01d30',
|
|
|
|
- # 'pid': 'AA112233',
|
|
|
|
- # 'start_time_at': methods.now_ts(),
|
|
|
|
- # 'end_time_at': methods.now_ts() + (3600 * 8),
|
|
|
|
- # 'driver_name': '李四',
|
|
|
|
- # 'cockpit_name': '1号舱',
|
|
|
|
- # }
|
|
|
|
- # ]
|
|
|
|
|
|
+
|
|
return dict(code=0, data=d1[(page - 1) * size: page * size], total=len(d1), page=page, size=size)
|
|
return dict(code=0, data=d1[(page - 1) * size: page * size], total=len(d1), page=page, size=size)
|
|
|
|
|
|
|
|
|