libushang hai 9 meses
pai
achega
05bec89e33
Modificáronse 1 ficheiros con 31 adicións e 2 borrados
  1. 31 2
      routers/api/infoPublish/back.py

+ 31 - 2
routers/api/infoPublish/back.py

@@ -104,12 +104,17 @@ async def create_emergency_plan(
             send_nick_name = u['nick_name']
             send_user_name = ''
             send_dept_name = ''
+            send_yzy_account = ''
 
             user_row = db.query(SysUser).filter(SysUser.user_id == send_user_id).first()
             if user_row is not None:
                 send_user_name = user_row.user_name
                 send_dept_row = db.query(SysDept).filter(SysDept.dept_id == user_row.dept_id).first()
                 send_dept_name = send_dept_row.dept_name
+                send_yzy_account = user_row.yzy_account
+
+                if send_yzy_account is None or send_yzy_account == "":
+                    send_yzy_account = user_row.phonenumber
             
             new_resp = InfoPublishResponses(
                 publish_id = new_publish_id,
@@ -118,6 +123,7 @@ async def create_emergency_plan(
                 nick_name = send_nick_name,
                 dept_name = send_dept_name,
                 sent_status = 0,
+                yzy_account = send_yzy_account,
                 response_type = body['response_type'],
                 publish_channel = body['publish_channel']
             )
@@ -308,6 +314,7 @@ async def get_edit_info(
 
     row = db.query(InfoPublishBase).filter(InfoPublishBase.id == info_id).first()
     data = get_model_dict(row)
+    data['examine_user'] = db_user.get_user_name_by_id(db, data['examine_by'])
     data['add_time'] = get_datetime_str(data['add_time'])
     data['publish_time'] = get_datetime_str(data['publish_time'])
 
@@ -448,9 +455,11 @@ async def get_sent_list(
                 "dept_name": row.dept_name,
                 "sent_status": row.sent_status,
                 "sent_time": get_datetime_str(row.sent_time),
-                "response_type": row.response_type,
+                "response_type": get_response_type_text(row.response_type),
                 "publish_channel": row.publish_channel,
-                "yzy_account": row.yzy_account
+                "yzy_account": row.yzy_account,
+                "yuezhengyiFeedbackStatus": get_sent_status_text(row.sent_status),
+                "haixinetFeedbackStatus": get_sent_status_text(0),
             }
             for row in rows
         ]
@@ -556,3 +565,23 @@ async def submit_examine(
         # 处理异常
         traceback.print_exc()
         raise HTTPException(status_code=500, detail=str(e))
+
+def get_sent_status_text(val: int) -> str:
+    if val == 0:
+        return "待发送"
+    elif val == 1:
+        return '成功'
+    elif val == 2:
+        return '失败'
+    else:
+        return "未知"
+    
+def get_response_type_text(val: int) -> str:
+    if val == 0:
+        return "仅需阅读"
+    elif val == 1:
+        return '点击确认'
+    elif val == 2:
+        return '签字确认'
+    else:
+        return '未知'