-num lines-num-old"> 55
+    TEMPERATURE_MEASURE_TYPE_TUPLE = (
56
+        (CONTINUOUS, '连续型'),
57
+        (SINGLE, '单次')
58
+    )
59
+
52 60
     point_id = ShortUUIDField(_('point_id'), max_length=32, blank=True, null=True, help_text='隔离点唯一标识', db_index=True, unique=True)
53 61
     point_name = models.CharField(_('point_name'), max_length=255, blank=True, null=True, help_text='隔离点名称')
54 62
 
@@ -69,6 +77,7 @@ class IsolationPointInfo(BaseModelMixin):
69 77
     #     }
70 78
     # ]
71 79
     point_upload_period = JSONField(_('point_upload_period'), default=[], blank=True, null=True, help_text='隔离点上传时段')
80
+    temperature_measure_type = models.IntegerField(_('temperature_measure_type'), choices=TEMPERATURE_MEASURE_TYPE_TUPLE, default=SINGLE, help_text='测温类型')
72 81
 
73 82
     limit_scene_qrcode_url = models.CharField(_('limit_scene_qrcode_url'), max_length=255, blank=True, null=True, help_text='字段二维码')
74 83
 
@@ -81,15 +90,13 @@ class IsolationPointInfo(BaseModelMixin):
81 90
 
82 91
     @property
83 92
     def match_upload_period(self):
84
-        if not self.point_upload_period:
85
-            return True
86 93
         for period in self.point_upload_period:
87 94
             local_date_string = tc.local_date_string()
88 95
             start_dt = tc.string_to_datetime(f'{local_date_string} {period["start"]}', format='%Y-%m-%d %H:%M')
89 96
             end_dt = tc.string_to_datetime(f'{local_date_string} {period["end"]}', format='%Y-%m-%d %H:%M')
90
-            current_dt = tc.make_naive(tc.local_datetime())
91
-            if start_dt < current_dt < end_dt:
92
-                return True
97
+            current_at = tc.make_naive(tc.local_datetime())
98
+            if start_dt < current_at < end_dt:
99
+                return start_dt, end_dt
93 100
         return False
94 101
 
95 102
     @property
@@ -174,6 +181,7 @@ class IsolationPointUserInfo(BaseModelMixin):
174 181
             'temperature_has_upload': self.temperature_has_upload,
175 182
             'user_status': self.user_status,
176 183
             'temperature': self.temperature,
184
+            'last_submit_at': self.last_submit_at,
177 185
             'last_report_time': tc.local_string(utc_dt=self.last_submit_at, format='%m-%d %H:%M') if self.last_submit_at else '',
178 186
             'remark': self.remark or '',
179 187
         }

Pierakstīties - Gogs: Go Git Service

Pierakstīties

Aizmirsi paroli?