|
@@ -414,7 +414,6 @@ async def ack_all(
|
|
|
user_id = Depends(valid_access_token)
|
|
|
):
|
|
|
call_id = body['call_id']
|
|
|
- ack_type = body['ack_type']
|
|
|
|
|
|
base_row = db.query(OnlineRollCallBase).filter(OnlineRollCallBase.id == call_id).first()
|
|
|
if base_row is None:
|
|
@@ -430,7 +429,7 @@ async def ack_all(
|
|
|
"msg": "点名记录不存在!"
|
|
|
}
|
|
|
|
|
|
- detail_row.ack_type = ack_type
|
|
|
+ detail_row.ack_status = 1 # 已应答
|
|
|
detail_row.ack_time = datetime.now()
|
|
|
db.commit()
|
|
|
|
|
@@ -459,12 +458,12 @@ async def query_mycall(
|
|
|
data = []
|
|
|
for row in rows:
|
|
|
call_id = row.pid
|
|
|
- base_row = db.query(OnlineRollCallBase).filter(and_(OnlineRollCallBase.id == call_id, OnlineRollCallBase.del_flag == '0')).first()
|
|
|
-
|
|
|
- data.append({
|
|
|
- "id": call_id,
|
|
|
- "time1": get_datetime_str(base_row.create_time)
|
|
|
- })
|
|
|
+ base_row = db.query(OnlineRollCallBase).filter(and_(OnlineRollCallBase.id == call_id, OnlineRollCallBase.call_status == 1, OnlineRollCallBase.del_flag == '0')).first()
|
|
|
+ if base_row is not None:
|
|
|
+ data.append({
|
|
|
+ "id": call_id,
|
|
|
+ "time1": get_datetime_str(base_row.create_time)
|
|
|
+ })
|
|
|
|
|
|
return {
|
|
|
"code": 200,
|
|
@@ -624,7 +623,7 @@ async def get_event_list(
|
|
|
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
|
|
|
|
|
-#应答列表
|
|
|
+#应答列表(我的)
|
|
|
@router.get('/ack_list')
|
|
|
async def get_event_list(
|
|
|
request: Request,
|
|
@@ -632,10 +631,12 @@ async def get_event_list(
|
|
|
end_date: str = Query('', description='结束时间'),
|
|
|
page: int = Query(1, gt=0, description='页码'),
|
|
|
page_size: int = Query(10, gt=0, description='pageSize'),
|
|
|
- db: Session = Depends(get_db)):
|
|
|
+ db: Session = Depends(get_db),
|
|
|
+ user_id = Depends(valid_access_token)
|
|
|
+):
|
|
|
|
|
|
try:
|
|
|
- where = and_(OnlineRollCallDetail.del_flag == '0')
|
|
|
+ where = and_(OnlineRollCallDetail.leader_id == user_id, OnlineRollCallDetail.del_flag == '0')
|
|
|
|
|
|
if begin_date is not None and begin_date != '':
|
|
|
begin_date = datetime.strptime(begin_date, "%Y-%m-%d")
|
|
@@ -663,8 +664,11 @@ async def get_event_list(
|
|
|
# 已应答
|
|
|
if row.ack_status == 1:
|
|
|
time_diff = row.ack_time - row.create_time
|
|
|
- # hours,minutes,seconds = str(time_diff).split(':')
|
|
|
- duration_time = str(time_diff)
|
|
|
+ if time_diff.days < 0:
|
|
|
+ duration_time = "超过{}天".format(abs(time_diff.days))
|
|
|
+ else:
|
|
|
+ hours,minutes,seconds = str(time_diff).split(':')
|
|
|
+ duration_time = str(time_diff)
|
|
|
|
|
|
data.append({
|
|
|
"id": row.id,
|
|
@@ -687,15 +691,16 @@ async def get_event_list(
|
|
|
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
|
|
|
|
|
-# 点名统计
|
|
|
+# 点名统计(我的)
|
|
|
@router.get("/summary")
|
|
|
async def get_call_summary(request: Request,
|
|
|
- db: Session = Depends(get_db)):
|
|
|
+ db: Session = Depends(get_db),
|
|
|
+ user_id = Depends(valid_access_token)):
|
|
|
|
|
|
try:
|
|
|
- call_count = db.query(OnlineRollCallBase).filter(OnlineRollCallBase.del_flag == '0').count()
|
|
|
- ack_count = db.query(OnlineRollCallDetail).filter(and_(OnlineRollCallDetail.del_flag == '0', OnlineRollCallDetail.ack_status == 1)).count()
|
|
|
- unack_count = db.query(OnlineRollCallDetail).filter(and_(OnlineRollCallDetail.del_flag == '0', OnlineRollCallDetail.ack_status == 0)).count()
|
|
|
+ call_count = db.query(OnlineRollCallDetail).filter(and_(OnlineRollCallDetail.leader_id == user_id, OnlineRollCallDetail.del_flag == '0')).count()
|
|
|
+ ack_count = db.query(OnlineRollCallDetail).filter(and_(OnlineRollCallDetail.leader_id == user_id, OnlineRollCallDetail.del_flag == '0', OnlineRollCallDetail.ack_status == 1)).count()
|
|
|
+ unack_count = db.query(OnlineRollCallDetail).filter(and_(OnlineRollCallDetail.leader_id == user_id, OnlineRollCallDetail.del_flag == '0', OnlineRollCallDetail.ack_status == 0)).count()
|
|
|
|
|
|
data = {
|
|
|
"call_count": call_count,
|