Browse Source

250416-2代码。

baoyubo 2 months ago
parent
commit
3aaebfe029
1 changed files with 10 additions and 2 deletions
  1. 10 2
      routers/api/riskManagement/task.py

+ 10 - 2
routers/api/riskManagement/task.py

@@ -133,6 +133,8 @@ async def get_inspection_task(
                 "task_number": task.task_number,
                 "business": task.inspection_business,
                 "task_time": '%s-%s'%(task.start_time.strftime('%Y/%m/%d'),task.end_time.strftime('%Y/%m/%d')),
+                "start_time":task.start_time.strftime('%Y-%m-%d'),
+                "end_time":task.end_time.strftime('%Y-%m-%d'),
                 "cycle": task.inspection_cycle,
                 "inspection_range": task.inspection_range,
                 "task_status": task_status,
@@ -178,10 +180,16 @@ async def create_inspection_task(
         else:
             corn=''
         # 创建新的预案记录
+        start_time = body['start_time']
+        if start_time =='':
+            start_time = datetime.now().strftime("%Y-%m-%d 00:00:00")
+        end_time = body['end_time']
+        if end_time =='':
+            end_time= '9999-12-31 00:00:00'
         new_task = RiskManagementInspectionTask(
             inspection_business=body['business'],
-            start_time = body['start_time'],
-            end_time = body['end_time'],
+            start_time = start_time,
+            end_time = end_time,
             inspection_cycle = cycle,
             corn_expression = corn,
             inspection_range = body['inspection_range'],