修改获取识别记录表服务
This commit is contained in:
parent
9eae7c4b0e
commit
ed8b5d0faf
@ -50,7 +50,7 @@ class CustomHTTPRequestHandler(BaseHTTPRequestHandler):
|
|||||||
logger.info("POST 请求数据为空")
|
logger.info("POST 请求数据为空")
|
||||||
elif self.headers.get("Content-Type") == "application/json":
|
elif self.headers.get("Content-Type") == "application/json":
|
||||||
data = json.loads(post_data.decode("utf-8"))
|
data = json.loads(post_data.decode("utf-8"))
|
||||||
# logger.info(f"接收到JSON数据: {data}")
|
logger.info(f"接收到JSON数据: {data}")
|
||||||
else:
|
else:
|
||||||
# 解析表单数据
|
# 解析表单数据
|
||||||
data = urllib.parse.parse_qs(post_data.decode("utf-8"))
|
data = urllib.parse.parse_qs(post_data.decode("utf-8"))
|
||||||
|
|||||||
@ -10,6 +10,15 @@ class DoorDao:
|
|||||||
门禁设备模块数据库操作层
|
门禁设备模块数据库操作层
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
async def get_door_index_code_list(cls, db: AsyncSession, permission: str = None):
|
||||||
|
"""
|
||||||
|
获取门禁设备索引编码列表
|
||||||
|
"""
|
||||||
|
query = select(Door.indexCode).where(Door.permission == permission if permission else True)
|
||||||
|
result = await db.execute(query)
|
||||||
|
return [row[0] for row in result.all()]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def get_door_detail_by_id(cls, db: AsyncSession, id: int):
|
async def get_door_detail_by_id(cls, db: AsyncSession, id: int):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -3,7 +3,9 @@ from typing import List
|
|||||||
from config.constant import CommonConstant
|
from config.constant import CommonConstant
|
||||||
from exceptions.exception import ServiceException
|
from exceptions.exception import ServiceException
|
||||||
from module_admin.entity.vo.common_vo import CrudResponseModel
|
from module_admin.entity.vo.common_vo import CrudResponseModel
|
||||||
|
from module_admin.entity.do.identification_record_do import IdentificationRecord
|
||||||
from module_admin.dao.identification_record_dao import Identification_recordDao
|
from module_admin.dao.identification_record_dao import Identification_recordDao
|
||||||
|
from module_admin.dao.door_dao import DoorDao
|
||||||
from module_admin.entity.vo.identification_record_vo import DeleteIdentification_recordModel, Identification_recordModel, Identification_recordPageQueryModel
|
from module_admin.entity.vo.identification_record_vo import DeleteIdentification_recordModel, Identification_recordModel, Identification_recordPageQueryModel
|
||||||
from utils.common_util import CamelCaseUtil
|
from utils.common_util import CamelCaseUtil
|
||||||
from utils.excel_util import ExcelUtil
|
from utils.excel_util import ExcelUtil
|
||||||
@ -38,8 +40,9 @@ class Identification_recordService:
|
|||||||
start_time = cls.time_2_iso8601(query_object.begin_create_time) if query_object.begin_create_time else None
|
start_time = cls.time_2_iso8601(query_object.begin_create_time) if query_object.begin_create_time else None
|
||||||
end_time = cls.time_2_iso8601(query_object.end_create_time) if query_object.end_create_time else None
|
end_time = cls.time_2_iso8601(query_object.end_create_time) if query_object.end_create_time else None
|
||||||
|
|
||||||
# 获取门禁点列表
|
# 获取门禁点列表, 获取机器人添加的门禁设备列表,有权限的.
|
||||||
haikang_record_list = await HaikangUtil.query_door_events_v2([]
|
door_index_code_list = await DoorDao.get_door_index_code_list(query_db, permission='1')
|
||||||
|
haikang_record_list = await HaikangUtil.query_door_events_v2(door_index_code_list
|
||||||
,pageNo=query_object.page_num
|
,pageNo=query_object.page_num
|
||||||
, pageSize=max(t-query_object.page_size, t-len(identification_record_list_result.rows))
|
, pageSize=max(t-query_object.page_size, t-len(identification_record_list_result.rows))
|
||||||
,startTime=start_time, endTime=end_time
|
,startTime=start_time, endTime=end_time
|
||||||
@ -48,7 +51,7 @@ class Identification_recordService:
|
|||||||
# print(identification_record_list_result.rows)
|
# print(identification_record_list_result.rows)
|
||||||
# print("*"*100)
|
# print("*"*100)
|
||||||
# print(haikang_record_list[1])
|
# print(haikang_record_list[1])
|
||||||
return identification_record_list_result.rows + haikang_record_list[1]["list"]
|
return identification_record_list_result.rows + cls.parse_haikang_record_list(haikang_record_list[1]["list"])
|
||||||
# return None
|
# return None
|
||||||
|
|
||||||
|
|
||||||
@ -162,3 +165,12 @@ class Identification_recordService:
|
|||||||
iso_format = dt.isoformat()
|
iso_format = dt.isoformat()
|
||||||
|
|
||||||
return iso_format
|
return iso_format
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def parse_haikang_record_list(cls, record_list: list):
|
||||||
|
back = list()
|
||||||
|
for record in record_list:
|
||||||
|
back.append(IdentificationRecord(person_name=record['personName'], person_status="1", door_name=record['doorName'], pic_uri=record['picUri']
|
||||||
|
, status="1", source="haikang", conf=100, create_time=record['eventTime']))
|
||||||
|
|
||||||
|
return back
|
||||||
|
|||||||
@ -234,7 +234,7 @@ class HaikangUtil:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
# 查询门禁点事件v2
|
# 查询门禁点事件v2
|
||||||
async def query_door_events_v2(cls, door_index_code: str, **args):
|
async def query_door_events_v2(cls, door_index_code: list, **args):
|
||||||
"""查询门禁点事件v2
|
"""查询门禁点事件v2
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user