|
@@ -95,6 +95,7 @@ END """
|
|
|
"pageSize": pageSize,
|
|
|
"totalPages": (total_items + pageSize - 1) // pageSize
|
|
|
}
|
|
|
+
|
|
|
@router.get('/get_waterlogged_all_video_info')
|
|
|
async def get_waterlogged_all_video_info(
|
|
|
radius:int = Query(None),
|
|
@@ -146,6 +147,118 @@ async def get_waterlogged_all_video_info(
|
|
|
traceback.print_exc()
|
|
|
raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
|
|
|
|
|
+@router.get('/get_video_transportation_list')
|
|
|
+async def get_video_forest_fire_list(
|
|
|
+ video_type:str = Query(None),
|
|
|
+ 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 video_type:
|
|
|
+ if video_type in video_type_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))
|
|
|
+ # 计算总条目数
|
|
|
+ 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
|
|
|
+
|
|
|
+ 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(TpVideoBase).filter(TpVideoBase.indexcode==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})
|
|
|
+
|
|
|
+
|
|
|
+ return {
|
|
|
+ "code": 200,
|
|
|
+ "msg": "成功",
|
|
|
+ "data": result,
|
|
|
+ 'total':total_items,
|
|
|
+ "page": page,
|
|
|
+ "pageSize": pageSize,
|
|
|
+ "totalPages": (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(
|
|
|
+ db: Session = Depends(get_db),
|
|
|
+ body = Depends(remove_xss_json),
|
|
|
+ user_id = Depends(valid_access_token)
|
|
|
+):
|
|
|
+ try:
|
|
|
+ # 根据 dict_type 查询字典数据
|
|
|
+ video_type_list = ['sjyld','sgdfd','jtdd','dzzhyhd']
|
|
|
+ query = db.query(SysDictData)
|
|
|
+ query = query.filter(SysDictData.dict_type=='video_type')
|
|
|
+ query = query.filter(SysDictData.dict_value.in_(video_type_list))
|
|
|
+ query = query.filter(SysDictData.del_flag != '2')
|
|
|
+ query = query.order_by(SysDictData.dict_sort)
|
|
|
+ # dict_data = db.query(SysDictData).filter_by(dict_type==dict_type and del_flag != '2').all()
|
|
|
+ dict_data = query.all()
|
|
|
+ # 将模型转换为字典
|
|
|
+ dict_data_list = [
|
|
|
+ {
|
|
|
+ "dictCode": d.dict_code,
|
|
|
+ "dictSort": d.dict_sort,
|
|
|
+ "dictLabel": d.dict_label,
|
|
|
+ "dictValue": d.dict_value,
|
|
|
+ "dictType": d.dict_type,
|
|
|
+ "cssClass": d.css_class,
|
|
|
+ "listClass": d.list_class,
|
|
|
+ "isDefault": d.is_default,
|
|
|
+ "remark": d.remark,
|
|
|
+ "createTime": d.create_time.strftime('%Y-%m-%d %H:%M:%S') if d.create_time else ''
|
|
|
+ }
|
|
|
+ for d in dict_data
|
|
|
+ ]
|
|
|
+
|
|
|
+ # 构建返回结果
|
|
|
+ result = {
|
|
|
+ "code": 200,
|
|
|
+ "msg": "操作成功",
|
|
|
+ "data": dict_data_list
|
|
|
+ }
|
|
|
+ return result
|
|
|
+ except Exception as e:
|
|
|
+ # 处理异常
|
|
|
+
|
|
|
+ traceback.print_exc()
|
|
|
+ raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
|
|
+
|
|
|
@router.get('/get_video_forest_fire_list')
|
|
|
async def get_video_forest_fire_list(
|
|
|
radius:int = Query(None),
|
|
@@ -215,14 +328,15 @@ async def get_video_tag_info(
|
|
|
tag_lable = []
|
|
|
for info in get_video_tag_list(db,video_code):
|
|
|
tag_info = get_dict_data_info(db,info.dict_type,info.dict_value)
|
|
|
- if tag_info.dict_label not in tag_lable:
|
|
|
- tag.append({"id":info.id,
|
|
|
- "video_code":video_code,
|
|
|
- "dict_type":info.dict_type,
|
|
|
- "dict_value":info.dict_value,
|
|
|
- "dict_label":tag_info.dict_label,
|
|
|
- "dict_code":tag_info.dict_code})
|
|
|
- tag_lable.append(tag_info.dict_label)
|
|
|
+ if tag_info:
|
|
|
+ if tag_info.dict_label not in tag_lable:
|
|
|
+ tag.append({"id":info.id,
|
|
|
+ "video_code":video_code,
|
|
|
+ "dict_type":info.dict_type,
|
|
|
+ "dict_value":info.dict_value,
|
|
|
+ "dict_label":tag_info.dict_label,
|
|
|
+ "dict_code":tag_info.dict_code})
|
|
|
+ tag_lable.append(tag_info.dict_label)
|
|
|
return {
|
|
|
"code": 200,
|
|
|
"msg": "成功",
|