@@ -53,7 +53,7 @@ class UserInfo(BaseModelMixin): |
||
| 53 | 53 |
def data(self): |
| 54 | 54 |
try: |
| 55 | 55 |
user = IsolationPointUserInfo.objects.get(user_id=self.user_id, status=True).userdata |
| 56 |
- except: |
|
| 56 |
+ except IsolationPointUserInfo.DoesNotExist: |
|
| 57 | 57 |
user = {}
|
| 58 | 58 |
|
| 59 | 59 |
return {
|
@@ -6,7 +6,7 @@ from django_logit import logit |
||
| 6 | 6 |
from django_response import response |
| 7 | 7 |
from TimeConvert import TimeConvert as tc |
| 8 | 8 |
|
| 9 |
-from equipment.models import IsolationPointUserInfo, AntigenMeasureLogInfo |
|
| 9 |
+from equipment.models import AntigenMeasureLogInfo, IsolationPointUserInfo |
|
| 10 | 10 |
|
| 11 | 11 |
|
| 12 | 12 |
def upload_antigen(request): |
@@ -9,7 +9,8 @@ from django_response import response |
||
| 9 | 9 |
from paginator import pagination |
| 10 | 10 |
from TimeConvert import TimeConvert as tc |
| 11 | 11 |
|
| 12 |
-from equipment.models import IsolationPointInfo, IsolationPointUserInfo, ThermometerEquipmentInfo, ThermometerMeasureLogInfo |
|
| 12 |
+from equipment.models import (IsolationPointInfo, IsolationPointUserInfo, ThermometerEquipmentInfo, |
|
| 13 |
+ ThermometerMeasureLogInfo) |
|
| 13 | 14 |
from utils.error.errno_utils import IsolationPointStatusCode |
| 14 | 15 |
|
| 15 | 16 |
|
@@ -130,7 +131,6 @@ def mp_upload_temperature(request): |
||
| 130 | 131 |
|
| 131 | 132 |
return response() |
| 132 | 133 |
|
| 133 |
- |
|
| 134 | 134 |
ThermometerMeasureLogInfo.objects.create(point_id=ipui.point_id, macid=macid, user_id=userid, temperature=temperature, temperature_src=ThermometerMeasureLogInfo.MP, chg_sta=False, ignore_temperature=False, ignore_fever_temperature=False, upload_temperature_info='') |
| 135 | 135 |
|
| 136 | 136 |
ipui.observed_ymds = list(set(ipui.observed_ymds + [tc.local_string(format='%Y-%m-%d')])) |
@@ -143,6 +143,7 @@ def mp_upload_temperature(request): |
||
| 143 | 143 |
|
| 144 | 144 |
return response() |
| 145 | 145 |
|
| 146 |
+ |
|
| 146 | 147 |
@logit |
| 147 | 148 |
def mp_temperature_list(request): |
| 148 | 149 |
user_id = request.POST.get('user_id', '')
|
@@ -156,13 +157,13 @@ def mp_temperature_list(request): |
||
| 156 | 157 |
|
| 157 | 158 |
logs = [log.userdata for log in logs] |
| 158 | 159 |
|
| 159 |
- |
|
| 160 | 160 |
return response(data={
|
| 161 | 161 |
'logs': logs, |
| 162 | 162 |
'left': left, |
| 163 | 163 |
'count': count, |
| 164 | 164 |
}) |
| 165 | 165 |
|
| 166 |
+ |
|
| 166 | 167 |
def admin_user_results(request): |
| 167 | 168 |
point_id = request.POST.get('point_id', '')
|
| 168 | 169 |
kw = request.POST.get('kw', '')
|
@@ -173,7 +174,7 @@ def admin_user_results(request): |
||
| 173 | 174 |
|
| 174 | 175 |
if kw: |
| 175 | 176 |
ipuis = ipuis.filter(fields__icontains=kw) |
| 176 |
- |
|
| 177 |
+ |
|
| 177 | 178 |
total_active_eqpt_num = ipuis.count() |
| 178 | 179 |
ipuis, left = pagination(ipuis, page, num) |
| 179 | 180 |
|
@@ -191,6 +192,7 @@ def admin_user_results(request): |
||
| 191 | 192 |
'fever_num': fever_num, |
| 192 | 193 |
}) |
| 193 | 194 |
|
| 195 |
+ |
|
| 194 | 196 |
@logit |
| 195 | 197 |
def admin_point_user_unbind(request): |
| 196 | 198 |
user_id = request.POST.get('user_id', '')
|
@@ -200,7 +202,7 @@ def admin_point_user_unbind(request): |
||
| 200 | 202 |
ipui = IsolationPointUserInfo.objects.get(user_id=user_id, status=True) |
| 201 | 203 |
except IsolationPointUserInfo.DoesNotExist: |
| 202 | 204 |
return response() |
| 203 |
- |
|
| 205 |
+ |
|
| 204 | 206 |
ipui.leave_at = tc.utc_datetime() |
| 205 | 207 |
ipui.status = False |
| 206 | 208 |
ipui.remark = '' |
@@ -208,12 +210,13 @@ def admin_point_user_unbind(request): |
||
| 208 | 210 |
|
| 209 | 211 |
try: |
| 210 | 212 |
eqpt = ThermometerEquipmentInfo.objects.get(ipui_pk=ipui.pk, status=True) |
| 211 |
- eqpt.active_status = active |
|
| 212 |
- eqpt.ipui_pk = 0 |
|
| 213 |
- eqpt.save() |
|
| 214 |
- except: |
|
| 213 |
+ except ThermometerEquipmentInfo.DoesNotExist: |
|
| 215 | 214 |
return response() |
| 216 | 215 |
|
| 216 |
+ eqpt.active_status = active |
|
| 217 |
+ eqpt.ipui_pk = 0 |
|
| 218 |
+ eqpt.save() |
|
| 219 |
+ |
|
| 217 | 220 |
return response() |
| 218 | 221 |
|
| 219 | 222 |
|
@@ -227,10 +230,10 @@ def admin_point_user_remark(request): |
||
| 227 | 230 |
ipui = IsolationPointUserInfo.objects.get(user_id=user_id, status=True) |
| 228 | 231 |
except IsolationPointUserInfo.DoesNotExist: |
| 229 | 232 |
return response() |
| 230 |
- if ipui: |
|
| 231 |
- ipui.remark = remark |
|
| 232 |
- ipui.remarks += [remark] |
|
| 233 |
- ipui.save() |
|
| 233 |
+ |
|
| 234 |
+ ipui.remark = remark |
|
| 235 |
+ ipui.remarks += [remark] |
|
| 236 |
+ ipui.save() |
|
| 234 | 237 |
|
| 235 | 238 |
return response() |
| 236 | 239 |
|
@@ -248,7 +251,6 @@ def admin_point_user_temperature_history(request): |
||
| 248 | 251 |
|
| 249 | 252 |
logs = [log.data for log in logs] |
| 250 | 253 |
|
| 251 |
- |
|
| 252 | 254 |
return response(data={
|
| 253 | 255 |
'logs': logs, |
| 254 | 256 |
'left': left, |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 |
|
| 3 | 3 |
from django.conf.urls import url |
| 4 | 4 |
|
| 5 |
-from api import (admin_views, aep_views, eqpt_views, field_views, mini_views, oauth_views, point_views, screen_views, |
|
| 6 |
- wx_views, antigen_views) |
|
| 5 |
+from api import (admin_views, aep_views, antigen_views, eqpt_views, field_views, mini_views, oauth_views, point_views, |
|
| 6 |
+ screen_views, wx_views) |
|
| 7 | 7 |
|
| 8 | 8 |
|
| 9 | 9 |
urlpatterns = [ |
@@ -3,8 +3,9 @@ |
||
| 3 | 3 |
from django.contrib import admin |
| 4 | 4 |
from django_admin import ReadOnlyModelAdmin |
| 5 | 5 |
|
| 6 |
-from equipment.models import (AepThermometerMeasureLogInfo, IsolationPointFieldPoolInfo, IsolationPointInfo, |
|
| 7 |
- IsolationPointUserInfo, ThermometerEquipmentInfo, ThermometerMeasureLogInfo, AntigenMeasureLogInfo) |
|
| 6 |
+from equipment.models import (AepThermometerMeasureLogInfo, AntigenMeasureLogInfo, IsolationPointFieldPoolInfo, |
|
| 7 |
+ IsolationPointInfo, IsolationPointUserInfo, ThermometerEquipmentInfo, |
|
| 8 |
+ ThermometerMeasureLogInfo) |
|
| 8 | 9 |
|
| 9 | 10 |
|
| 10 | 11 |
class IsolationPointFieldPoolInfoAdmin(admin.ModelAdmin): |
@@ -1,12 +1,13 @@ |
||
| 1 | 1 |
# -*- coding: utf-8 -*- |
| 2 | 2 |
|
| 3 |
+import datetime |
|
| 4 |
+ |
|
| 3 | 5 |
from django.db import models |
| 4 | 6 |
from django.utils.translation import ugettext_lazy as _ |
| 5 | 7 |
from django_models_ext import BaseModelMixin, SexModelMixin |
| 6 | 8 |
from jsonfield import JSONField |
| 7 | 9 |
from shortuuidfield import ShortUUIDField |
| 8 | 10 |
from TimeConvert import TimeConvert as tc |
| 9 |
-import datetime |
|
| 10 | 11 |
|
| 11 | 12 |
from utils.redis.rqrurl import get_qrcode_url |
| 12 | 13 |
|