浏览代码

no message

libushang 9 月之前
父节点
当前提交
f0cf9de77f
共有 2 个文件被更改,包括 37 次插入8 次删除
  1. 5 0
      models/online_roll_call.py
  2. 32 8
      routers/api/onlineRollCall/call.py

+ 5 - 0
models/online_roll_call.py

@@ -45,6 +45,11 @@ class OnlineRollCallDetail(Base):
     create_time = Column(DateTime, default=datetime.now, comment='数据创建时间')
     del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
     ack_type = Column(Integer, default=0, server_default='0', comment='应答方式 1 视频  2 电话')
+    # 从duty_shift复制过来
+    leader_id = Column(Integer, default=0, server_default='0', comment="领导ID")
+    primary_staff_id = Column(Integer, default=0, server_default='0', comment="主班人员ID")
+    secondary_staff_id = Column(Integer, default=0, server_default='0', comment="副班人员ID")
+    standby_staff_id = Column(Integer, default=0, server_default='0', comment="备班人员ID")
 
     class Config:
         orm_mode = True

+ 32 - 8
routers/api/onlineRollCall/call.py

@@ -128,6 +128,10 @@ async def create_by_city_to_area(
             shift_id = row.shift_id
             shift_dept_id = row.dept_id
             shift_dept_name = db_dept.get_dept_name_by_id(db, row.dept_id)
+            leader_id = row.leader_id
+            primary_staff_id = row.primary_staff_id
+            secondary_staff_id = row.secondary_staff_id
+            standby_staff_id = row.standby_staff_id
 
             onduty_user = db_user.get_nick_name_by_id(db, row.primary_staff_id)
             onduty_leader = db_user.get_nick_name_by_id(db, row.leader_id)
@@ -152,7 +156,11 @@ async def create_by_city_to_area(
                 ack_time = None,
                 create_time = datetime.now(),
                 del_flag = '0',
-                ack_type = 0
+                ack_type = 0,
+                leader_id = leader_id,
+                primary_staff_id = primary_staff_id,
+                secondary_staff_id = secondary_staff_id,
+                standby_staff_id = standby_staff_id
             )
             db.add(new_detail)
             db.commit()
@@ -217,6 +225,10 @@ async def create_by_city_to_district(
             shift_id = row.shift_id
             shift_dept_id = row.dept_id
             shift_dept_name = db_dept.get_dept_name_by_id(db, row.dept_id)
+            leader_id = row.leader_id
+            primary_staff_id = row.primary_staff_id
+            secondary_staff_id = row.secondary_staff_id
+            standby_staff_id = row.standby_staff_id
 
             onduty_user = db_user.get_nick_name_by_id(db, row.primary_staff_id)
             onduty_leader = db_user.get_nick_name_by_id(db, row.leader_id)
@@ -241,7 +253,11 @@ async def create_by_city_to_district(
                 ack_time = None,
                 create_time = datetime.now(),
                 del_flag = '0',
-                ack_type = 0
+                ack_type = 0,
+                leader_id = leader_id,
+                primary_staff_id = primary_staff_id,
+                secondary_staff_id = secondary_staff_id,
+                standby_staff_id = standby_staff_id
             )
             db.add(new_detail)
             db.commit()
@@ -308,6 +324,10 @@ async def create_by_dept_ids(
                 shift_id = row.shift_id
                 shift_dept_id = row.dept_id
                 shift_dept_name = db_dept.get_dept_name_by_id(db, row.dept_id)
+                leader_id = row.leader_id
+                primary_staff_id = row.primary_staff_id
+                secondary_staff_id = row.secondary_staff_id
+                standby_staff_id = row.standby_staff_id
 
                 onduty_user = db_user.get_nick_name_by_id(db, row.primary_staff_id)
                 onduty_leader = db_user.get_nick_name_by_id(db, row.leader_id)
@@ -327,7 +347,11 @@ async def create_by_dept_ids(
                     ack_time = None,
                     create_time = datetime.now(),
                     del_flag = '0',
-                    ack_type = 0
+                    ack_type = 0,
+                    leader_id = leader_id,
+                    primary_staff_id = primary_staff_id,
+                    secondary_staff_id = secondary_staff_id,
+                    standby_staff_id = standby_staff_id
                 )
                 db.add(new_detail)
                 db.commit()
@@ -361,7 +385,7 @@ async def create_by_dept_ids(
         raise HTTPException(status_code=500, detail=str(e))
     
 
-# 结束应答
+# 结束点名
 @router.post("/end")
 async def end_call(
     db: Session = Depends(get_db),
@@ -412,7 +436,7 @@ async def ack_all(
             "msg": "点名记录不存在"
         }
     
-    detail_row = db.query(OnlineRollCallDetail).filter(and_(OnlineRollCallDetail.pid == call_id, OnlineRollCallDetail.user_id == user_id)).first()
+    detail_row = db.query(OnlineRollCallDetail).filter(and_(OnlineRollCallDetail.pid == call_id, OnlineRollCallDetail.leader_id == user_id)).first()
     if detail_row is None:
         return {
             "code": 500,
@@ -444,15 +468,15 @@ async def query_mycall(
     db: Session = Depends(get_db),
     user_id = Depends(valid_access_token)
 ):
-    rows = db.query(OnlineRollCallDetail).filter(and_(OnlineRollCallDetail.user_id == user_id, OnlineRollCallDetail.ack_status == 0)).all()
+    rows = db.query(OnlineRollCallDetail).filter(and_(OnlineRollCallDetail.leader_id == user_id, OnlineRollCallDetail.ack_status == 0)).all()
     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({
-            "call_id": call_id,
-            "create_time": get_datetime_str(base_row.create_time)
+            "id": call_id,
+            "time1": get_datetime_str(base_row.create_time)
         })
     
     return {