libushang 7 bulan lalu
induk
melakukan
7d2b8be884

+ 14 - 0
models/taskRegistration_base.py

@@ -92,3 +92,17 @@ class TaskFile(Base):
 
     class Config:
         orm_mode = True
+
+class TaskLeaderInstructions(Base):
+    __tablename__ = 'task_leader_instructions'
+
+    id = Column(Integer, primary_key=True, autoincrement=True, index=True,comment='id')
+    event_code = Column(String(255), comment='事件编码')
+    recorded_by = Column(Integer, nullable=False, comment='记录用户ID')
+    dept_id = Column(Integer, default=0, comment='部门ID')
+    dept_name = Column(String, default="", comment='部门名称')
+    content = Column(Text, comment='批示内容')
+    create_time = Column(DateTime, default=datetime.now, comment='登记时间')
+
+    class Config:
+        orm_mode = True

+ 22 - 3
routers/api/eventManagement/event.py

@@ -734,11 +734,13 @@ async def send_emergency_plan_task_by_yzy(
     request: Request,  
     background_tasks: BackgroundTasks, 
     body = Depends(remove_xss_json), 
-    db: Session = Depends(get_db)
+    db: Session = Depends(get_db),
+    user_id = Depends(valid_access_token)
 ):
     time.sleep(1.0)
     
     eventId = body['eventId']
+    tasks = body['tasks']
     
     event_row = db.query(EventBase).filter(EventBase.event_code == eventId).first()
     if event_row is None:
@@ -785,14 +787,31 @@ async def send_emergency_plan_task_by_yzy(
     for row in rows:
         dept_id = row.dept_id
         dept_name = row.dept_name
+        
+        leader_content = ""
+        if str(dept_id) in tasks:
+            leader_content = tasks[str(dept_id)]
 
         # 已下发的过滤掉,避免重发
         row_exists = db.query(EventEmergencyNotify).filter(and_(EventEmergencyNotify.plan_id == plan_id, EventEmergencyNotify.event_id == eventId, EventEmergencyNotify.dept_id == dept_id)).first()
         if row_exists is not None:
             continue
+
+        if leader_content != "":
+            # 领导批示
+            new_instruction = TaskLeaderInstructions(
+                event_code = eventId,
+                dept_id = dept_id,
+                dept_name = dept_name,
+                content = leader_content,
+                create_time = datetime.now(),
+                recorded_by = user_id
+            )
+            db.add(new_instruction)
+            db.commit()
         
         # 通过预案人员管理匹配负责人
-        user_id = 0
+        _user_id = 0
         user_name = ''
         contact_row = db.query(EmergencyContactInfo).filter(and_(EmergencyContactInfo.del_flag == "0", EmergencyContactInfo.unit_id == dept_id)).first()
         yzy_account = contact_row.yue_gov_ease_phone
@@ -819,7 +838,7 @@ async def send_emergency_plan_task_by_yzy(
             plan_id = plan_id,
             dept_id = dept_id,
             dept_name = dept_name,
-            user_id = user_id,
+            user_id = _user_id,
             user_name = user_name,
             nick_name = nick_name,
             yzy_user_id = yzy_user_id,

+ 1 - 1
routers/prod_api/system/menu/__init__.py

@@ -232,7 +232,7 @@ async def getRouters(request: Request, db: Session = Depends(get_db),
                     children_menus = query.all()
                     menu_data['redirect'] = 'noRedirect'
                     menu_data['alwaysShow'] = True
-                    print( menu.menu_id)
+                    # print( menu.menu_id)
                     # children_menus = parent_id_get_menu_info(db, menu.menu_id)
                     if len(children_menus) > 0:
                         menu_data['children'] = build_menu_tree(children_menus, menu)