|
@@ -150,6 +150,8 @@ async def get_waterlogged_all_video_info(
|
|
|
@router.get('/get_video_transportation_list')
|
|
|
async def get_video_forest_fire_list(
|
|
|
video_type:str = Query(None),
|
|
|
+ area:str = Query(None),
|
|
|
+ name:str = Query(None),
|
|
|
db: Session = Depends(get_db),
|
|
|
page: int = Query(1, gt=0, description='页码'),
|
|
|
pageSize: int = Query(10, gt=0, description='每页条目数量'),
|
|
@@ -165,6 +167,15 @@ async def get_video_forest_fire_list(
|
|
|
|
|
|
lis = [i.video_code for i in db.query(TpVideoTag.video_code).filter(TpVideoTag.dict_value==video_type , TpVideoTag.del_flag =='0').all()]
|
|
|
video_list = video_list.filter(TpVideoLog.video_code.in_(lis))
|
|
|
+ if area:
|
|
|
+ if area=='直辖市':
|
|
|
+ lis = [i.video_code for i in db.query(TpVideoLogTransportationAreaInfo.video_code).all()]
|
|
|
+ video_list = video_list.filter(TpVideoLog.video_code.in_(lis))
|
|
|
+ else:
|
|
|
+ lis = [i.video_code for i in db.query(TpVideoLogTransportationAreaInfo.video_code).filter(TpVideoLogTransportationAreaInfo.area == area).all()]
|
|
|
+ video_list = video_list.filter(TpVideoLog.video_code.in_(lis))
|
|
|
+ if name:
|
|
|
+ video_list = video_list.filter(TpVideoLog.name.like(f'%{name}%'))
|
|
|
# 计算总条目数
|
|
|
total_items = video_list.count()
|
|
|
# 排序
|
|
@@ -180,7 +191,7 @@ async def get_video_forest_fire_list(
|
|
|
video_type_label='其他'
|
|
|
longitude = 0
|
|
|
latitude = 0
|
|
|
-
|
|
|
+ area = '直辖市'
|
|
|
video_type_li = db.query(TpVideoTag).filter(TpVideoTag.video_code == video_code,
|
|
|
TpVideoTag.del_flag == '0',TpVideoTag.dict_value.in_(video_type_list)).first()
|
|
|
if video_type_li:
|
|
@@ -191,11 +202,12 @@ async def get_video_forest_fire_list(
|
|
|
if query:
|
|
|
video_type_label = query.dict_label
|
|
|
|
|
|
- video_base_info = db.query(TpVideoBase).filter(TpVideoBase.indexcode==video_code).first()
|
|
|
+ video_base_info = db.query(TpVideoLogTransportationAreaInfo).filter(TpVideoLogTransportationAreaInfo.video_code==video_code).first()
|
|
|
if video_base_info:
|
|
|
longitude = video_base_info.longitude
|
|
|
latitude = video_base_info.latitude
|
|
|
- result.append({"area":"直辖市","status":video_info.status,"name":video_info.name,"video_code":video_info.video_code,"video_type_label":video_type_label,"longitude":longitude,"latitude":latitude})
|
|
|
+ area = video_base_info.area
|
|
|
+ result.append({"area":area,"status":video_info.status,"name":video_info.name,"video_code":video_info.video_code,"video_type_label":video_type_label,"longitude":longitude,"latitude":latitude})
|
|
|
|
|
|
|
|
|
return {
|
|
@@ -211,7 +223,70 @@ async def get_video_forest_fire_list(
|
|
|
except Exception as e:
|
|
|
traceback.print_exc()
|
|
|
raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
|
|
+@router.get('/get_point_info_transportation_video')
|
|
|
+@router.post('/get_point_info_transportation_video')
|
|
|
+async def get_video_forest_fire_list(
|
|
|
+ db: Session = Depends(get_db),
|
|
|
+ page: int = Query(1, gt=0, description='页码'),
|
|
|
+ pageSize: int = Query(10, gt=0, description='每页条目数量'),
|
|
|
+ body=Depends(remove_xss_json),
|
|
|
+ user_id=Depends(valid_access_token)):
|
|
|
|
|
|
+ try:
|
|
|
+ video_type_list = ['sjyld','sgdfd','jtdd','dzzhyhd']
|
|
|
+ # video_code_list = [item[0] for item in db.query(TpVideoTag.id).filter(TpVideoTag.dict_value == '4').all()]
|
|
|
+ video_list = db.query(TpVideoLog).filter(TpVideoLog.area=='茂名市视频数据共享管理平台/茂名市交通运输局')
|
|
|
+
|
|
|
+ if 'query' in body:
|
|
|
+ if 'id' in body['query']:
|
|
|
+ video_list = video_list.filter(TpVideoLog.video_code==body['query']['id'])
|
|
|
+ # 计算总条目数
|
|
|
+ total_items = video_list.count()
|
|
|
+ # 排序
|
|
|
+
|
|
|
+ video_list = video_list.order_by(TpVideoLog.video_code)
|
|
|
+ # 执行分页查询
|
|
|
+ # print(video_list.offset((page - 1) * pageSize).limit(pageSize))
|
|
|
+ video_list = video_list.offset((page - 1) * pageSize).limit(pageSize).all()
|
|
|
+ result = []
|
|
|
+ # print(total_items,len(video_list),(page - 1) * pageSize,pageSize)
|
|
|
+ for video_info in video_list:
|
|
|
+ video_code = video_info.video_code
|
|
|
+ video_type_label='其他'
|
|
|
+ longitude = 0
|
|
|
+ latitude = 0
|
|
|
+ area = '直辖市'
|
|
|
+ video_type_li = db.query(TpVideoTag).filter(TpVideoTag.video_code == video_code,
|
|
|
+ TpVideoTag.del_flag == '0',TpVideoTag.dict_value.in_(video_type_list)).first()
|
|
|
+ if video_type_li:
|
|
|
+ query = db.query(SysDictData)
|
|
|
+ query = query.filter(SysDictData.del_flag != '2')
|
|
|
+ query = query.filter(SysDictData.dict_type == 'video_type')
|
|
|
+ query = query.filter(SysDictData.dict_value == video_type_li.dict_value).first()
|
|
|
+ if query:
|
|
|
+ video_type_label = query.dict_label
|
|
|
+
|
|
|
+ video_base_info = db.query(TpVideoLogTransportationAreaInfo).filter(TpVideoLogTransportationAreaInfo.video_code==video_code).first()
|
|
|
+ if video_base_info:
|
|
|
+ longitude = video_base_info.longitude
|
|
|
+ latitude = video_base_info.latitude
|
|
|
+ area = video_base_info.area
|
|
|
+ result.append({"area":area,"status":video_info.status,"name":video_info.name,"video_code":video_info.video_code,"video_type_label":video_type_label,"longitude":longitude,"latitude":latitude})
|
|
|
+
|
|
|
+
|
|
|
+ return {
|
|
|
+ "code": 0,
|
|
|
+ "msg": "success",
|
|
|
+ "rows": result,
|
|
|
+ 'total':total_items,
|
|
|
+ "currentPage": page,
|
|
|
+ "pageSize": pageSize,
|
|
|
+ "pages": (total_items + pageSize - 1) // pageSize
|
|
|
+ }
|
|
|
+
|
|
|
+ except Exception as e:
|
|
|
+ traceback.print_exc()
|
|
|
+ raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
|
|
|
|
|
@router.get('/transportation/type')
|
|
|
async def get_dict_data_by_type(
|