Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MyEMS
MyEMS能源管理系统
提交
b7df7939
M
MyEMS能源管理系统
项目概览
MyEMS
/
MyEMS能源管理系统
通知
46
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
MyEMS能源管理系统
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b7df7939
编写于
3月 20, 2024
作者:
L
llis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed equipment.py,gateway.py,point.py,rule.py,timezone.py,user.py file
上级
582bedd5
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
100 addition
and
72 deletion
+100
-72
myems-api/core/equipment.py
myems-api/core/equipment.py
+49
-38
myems-api/core/gateway.py
myems-api/core/gateway.py
+3
-1
myems-api/core/point.py
myems-api/core/point.py
+4
-8
myems-api/core/rule.py
myems-api/core/rule.py
+32
-12
myems-api/core/timezone.py
myems-api/core/timezone.py
+8
-2
myems-api/core/user.py
myems-api/core/user.py
+4
-11
未找到文件。
myems-api/core/equipment.py
浏览文件 @
b7df7939
...
@@ -51,13 +51,12 @@ class EquipmentCollection:
...
@@ -51,13 +51,12 @@ class EquipmentCollection:
result
=
list
()
result
=
list
()
if
rows_equipments
is
not
None
and
len
(
rows_equipments
)
>
0
:
if
rows_equipments
is
not
None
and
len
(
rows_equipments
)
>
0
:
for
row
in
rows_equipments
:
for
row
in
rows_equipments
:
cost_center
=
cost_center_dict
.
get
(
row
[
5
],
None
)
meta_result
=
{
"id"
:
row
[
0
],
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"uuid"
:
row
[
2
],
"is_input_counted"
:
bool
(
row
[
3
]),
"is_input_counted"
:
bool
(
row
[
3
]),
"is_output_counted"
:
bool
(
row
[
4
]),
"is_output_counted"
:
bool
(
row
[
4
]),
"cost_center"
:
cost_center
,
"cost_center"
:
cost_center
_dict
.
get
(
row
[
5
],
None
)
,
"svg"
:
row
[
6
],
"svg"
:
row
[
6
],
"camera_url"
:
row
[
7
],
"camera_url"
:
row
[
7
],
"description"
:
row
[
8
],
"description"
:
row
[
8
],
...
@@ -225,13 +224,12 @@ class EquipmentItem:
...
@@ -225,13 +224,12 @@ class EquipmentItem:
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
description
=
'API.EQUIPMENT_NOT_FOUND'
)
description
=
'API.EQUIPMENT_NOT_FOUND'
)
else
:
else
:
cost_center
=
cost_center_dict
.
get
(
row
[
5
],
None
)
meta_result
=
{
"id"
:
row
[
0
],
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"uuid"
:
row
[
2
],
"is_input_counted"
:
bool
(
row
[
3
]),
"is_input_counted"
:
bool
(
row
[
3
]),
"is_output_counted"
:
bool
(
row
[
4
]),
"is_output_counted"
:
bool
(
row
[
4
]),
"cost_center"
:
cost_center
,
"cost_center"
:
cost_center
_dict
.
get
(
row
[
5
],
None
)
,
"svg"
:
row
[
6
],
"svg"
:
row
[
6
],
"camera_url"
:
row
[
7
],
"camera_url"
:
row
[
7
],
"description"
:
row
[
8
],
"description"
:
row
[
8
],
...
@@ -1332,9 +1330,10 @@ class EquipmentMeterCollection:
...
@@ -1332,9 +1330,10 @@ class EquipmentMeterCollection:
result
=
list
()
result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
energy_category
=
energy_category_dict
.
get
(
row
[
3
],
None
)
meta_result
=
{
"id"
:
row
[
0
],
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"name"
:
row
[
1
],
"energy_category"
:
energy_category
,
"uuid"
:
row
[
2
],
"energy_category"
:
energy_category_dict
.
get
(
row
[
3
],
None
),
"is_output"
:
bool
(
row
[
4
])}
"is_output"
:
bool
(
row
[
4
])}
result
.
append
(
meta_result
)
result
.
append
(
meta_result
)
...
@@ -1530,9 +1529,10 @@ class EquipmentOfflineMeterCollection:
...
@@ -1530,9 +1529,10 @@ class EquipmentOfflineMeterCollection:
result
=
list
()
result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
energy_category
=
energy_category_dict
.
get
(
row
[
3
],
None
)
meta_result
=
{
"id"
:
row
[
0
],
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"name"
:
row
[
1
],
"energy_category"
:
energy_category
,
"uuid"
:
row
[
2
],
"energy_category"
:
energy_category_dict
.
get
(
row
[
3
],
None
),
"is_output"
:
bool
(
row
[
4
])}
"is_output"
:
bool
(
row
[
4
])}
result
.
append
(
meta_result
)
result
.
append
(
meta_result
)
...
@@ -1729,9 +1729,10 @@ class EquipmentVirtualMeterCollection:
...
@@ -1729,9 +1729,10 @@ class EquipmentVirtualMeterCollection:
result
=
list
()
result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
energy_category
=
energy_category_dict
.
get
(
row
[
3
],
None
)
meta_result
=
{
"id"
:
row
[
0
],
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"name"
:
row
[
1
],
"energy_category"
:
energy_category
,
"uuid"
:
row
[
2
],
"energy_category"
:
energy_category_dict
.
get
(
row
[
3
],
None
),
"is_output"
:
bool
(
row
[
4
])}
"is_output"
:
bool
(
row
[
4
])}
result
.
append
(
meta_result
)
result
.
append
(
meta_result
)
...
@@ -1916,7 +1917,9 @@ class EquipmentCommandCollection:
...
@@ -1916,7 +1917,9 @@ class EquipmentCommandCollection:
result
=
list
()
result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
]}
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
]}
result
.
append
(
meta_result
)
result
.
append
(
meta_result
)
resp
.
text
=
json
.
dumps
(
result
)
resp
.
text
=
json
.
dumps
(
result
)
...
@@ -2098,13 +2101,12 @@ class EquipmentExport:
...
@@ -2098,13 +2101,12 @@ class EquipmentExport:
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
description
=
'API.EQUIPMENT_NOT_FOUND'
)
description
=
'API.EQUIPMENT_NOT_FOUND'
)
else
:
else
:
cost_center
=
cost_center_dict
.
get
(
row
[
5
],
None
)
meta_result
=
{
"id"
:
row
[
0
],
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"uuid"
:
row
[
2
],
"is_input_counted"
:
bool
(
row
[
3
]),
"is_input_counted"
:
bool
(
row
[
3
]),
"is_output_counted"
:
bool
(
row
[
4
]),
"is_output_counted"
:
bool
(
row
[
4
]),
"cost_center"
:
cost_center
,
"cost_center"
:
cost_center
_dict
.
get
(
row
[
5
],
None
)
,
"svg"
:
row
[
6
],
"svg"
:
row
[
6
],
"camera_url"
:
row
[
7
],
"camera_url"
:
row
[
7
],
"description"
:
row
[
8
],
"description"
:
row
[
8
],
...
@@ -2124,7 +2126,9 @@ class EquipmentExport:
...
@@ -2124,7 +2126,9 @@ class EquipmentExport:
command_result
=
list
()
command_result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
]}
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
]}
command_result
.
append
(
result
)
command_result
.
append
(
result
)
meta_result
[
'commands'
]
=
command_result
meta_result
[
'commands'
]
=
command_result
...
@@ -2150,9 +2154,10 @@ class EquipmentExport:
...
@@ -2150,9 +2154,10 @@ class EquipmentExport:
meter_result
=
list
()
meter_result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
energy_category
=
energy_category_dict
.
get
(
row
[
3
],
None
)
result
=
{
"id"
:
row
[
0
],
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"name"
:
row
[
1
],
"energy_category"
:
energy_category
,
"uuid"
:
row
[
2
],
"energy_category"
:
energy_category_dict
.
get
(
row
[
3
],
None
),
"is_output"
:
bool
(
row
[
4
])}
"is_output"
:
bool
(
row
[
4
])}
meter_result
.
append
(
result
)
meter_result
.
append
(
result
)
meta_result
[
'meters'
]
=
meter_result
meta_result
[
'meters'
]
=
meter_result
...
@@ -2166,9 +2171,10 @@ class EquipmentExport:
...
@@ -2166,9 +2171,10 @@ class EquipmentExport:
offlinemeter_result
=
list
()
offlinemeter_result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
energy_category
=
energy_category_dict
.
get
(
row
[
3
],
None
)
result
=
{
"id"
:
row
[
0
],
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"name"
:
row
[
1
],
"energy_category"
:
energy_category
,
"uuid"
:
row
[
2
],
"energy_category"
:
energy_category_dict
.
get
(
row
[
3
],
None
),
"is_output"
:
bool
(
row
[
4
])}
"is_output"
:
bool
(
row
[
4
])}
offlinemeter_result
.
append
(
result
)
offlinemeter_result
.
append
(
result
)
meta_result
[
'offline_meters'
]
=
offlinemeter_result
meta_result
[
'offline_meters'
]
=
offlinemeter_result
...
@@ -2182,9 +2188,10 @@ class EquipmentExport:
...
@@ -2182,9 +2188,10 @@ class EquipmentExport:
virtualmeter_result
=
list
()
virtualmeter_result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
energy_category
=
energy_category_dict
.
get
(
row
[
3
],
None
)
result
=
{
"id"
:
row
[
0
],
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"name"
:
row
[
1
],
"energy_category"
:
energy_category
,
"uuid"
:
row
[
2
],
"energy_category"
:
energy_category_dict
.
get
(
row
[
3
],
None
),
"is_output"
:
bool
(
row
[
4
])}
"is_output"
:
bool
(
row
[
4
])}
virtualmeter_result
.
append
(
result
)
virtualmeter_result
.
append
(
result
)
meta_result
[
'virtual_meters'
]
=
virtualmeter_result
meta_result
[
'virtual_meters'
]
=
virtualmeter_result
...
@@ -2686,13 +2693,12 @@ class EquipmentClone:
...
@@ -2686,13 +2693,12 @@ class EquipmentClone:
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
description
=
'API.EQUIPMENT_NOT_FOUND'
)
description
=
'API.EQUIPMENT_NOT_FOUND'
)
else
:
else
:
cost_center
=
cost_center_dict
.
get
(
row
[
5
],
None
)
meta_result
=
{
"id"
:
row
[
0
],
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"uuid"
:
row
[
2
],
"is_input_counted"
:
bool
(
row
[
3
]),
"is_input_counted"
:
bool
(
row
[
3
]),
"is_output_counted"
:
bool
(
row
[
4
]),
"is_output_counted"
:
bool
(
row
[
4
]),
"cost_center"
:
cost_center
,
"cost_center"
:
cost_center
_dict
.
get
(
row
[
5
],
None
)
,
"svg"
:
row
[
6
],
"svg"
:
row
[
6
],
"camera_url"
:
row
[
7
],
"camera_url"
:
row
[
7
],
"description"
:
row
[
8
],
"description"
:
row
[
8
],
...
@@ -2712,7 +2718,9 @@ class EquipmentClone:
...
@@ -2712,7 +2718,9 @@ class EquipmentClone:
command_result
=
list
()
command_result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
]}
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
]}
command_result
.
append
(
result
)
command_result
.
append
(
result
)
meta_result
[
'commands'
]
=
command_result
meta_result
[
'commands'
]
=
command_result
...
@@ -2738,9 +2746,10 @@ class EquipmentClone:
...
@@ -2738,9 +2746,10 @@ class EquipmentClone:
meter_result
=
list
()
meter_result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
energy_category
=
energy_category_dict
.
get
(
row
[
3
],
None
)
result
=
{
"id"
:
row
[
0
],
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"name"
:
row
[
1
],
"energy_category"
:
energy_category
,
"uuid"
:
row
[
2
],
"energy_category"
:
energy_category_dict
.
get
(
row
[
3
],
None
),
"is_output"
:
bool
(
row
[
4
])}
"is_output"
:
bool
(
row
[
4
])}
meter_result
.
append
(
result
)
meter_result
.
append
(
result
)
meta_result
[
'meters'
]
=
meter_result
meta_result
[
'meters'
]
=
meter_result
...
@@ -2754,9 +2763,10 @@ class EquipmentClone:
...
@@ -2754,9 +2763,10 @@ class EquipmentClone:
offlinemeter_result
=
list
()
offlinemeter_result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
energy_category
=
energy_category_dict
.
get
(
row
[
3
],
None
)
result
=
{
"id"
:
row
[
0
],
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"name"
:
row
[
1
],
"energy_category"
:
energy_category
,
"uuid"
:
row
[
2
],
"energy_category"
:
energy_category_dict
.
get
(
row
[
3
],
None
),
"is_output"
:
bool
(
row
[
4
])}
"is_output"
:
bool
(
row
[
4
])}
offlinemeter_result
.
append
(
result
)
offlinemeter_result
.
append
(
result
)
meta_result
[
'offline_meters'
]
=
offlinemeter_result
meta_result
[
'offline_meters'
]
=
offlinemeter_result
...
@@ -2770,9 +2780,10 @@ class EquipmentClone:
...
@@ -2770,9 +2780,10 @@ class EquipmentClone:
virtualmeter_result
=
list
()
virtualmeter_result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
energy_category
=
energy_category_dict
.
get
(
row
[
3
],
None
)
result
=
{
"id"
:
row
[
0
],
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"name"
:
row
[
1
],
"energy_category"
:
energy_category
,
"uuid"
:
row
[
2
],
"energy_category"
:
energy_category_dict
.
get
(
row
[
3
],
None
),
"is_output"
:
bool
(
row
[
4
])}
"is_output"
:
bool
(
row
[
4
])}
virtualmeter_result
.
append
(
result
)
virtualmeter_result
.
append
(
result
)
meta_result
[
'virtual_meters'
]
=
virtualmeter_result
meta_result
[
'virtual_meters'
]
=
virtualmeter_result
...
...
myems-api/core/gateway.py
浏览文件 @
b7df7939
...
@@ -43,7 +43,9 @@ class GatewayCollection:
...
@@ -43,7 +43,9 @@ class GatewayCollection:
last_seen_datetime
=
last_seen_datetime_local
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
)
last_seen_datetime
=
last_seen_datetime_local
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
)
else
:
else
:
last_seen_datetime
=
None
last_seen_datetime
=
None
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
"token"
:
row
[
3
],
"token"
:
row
[
3
],
"last_seen_datetime"
:
last_seen_datetime
,
"last_seen_datetime"
:
last_seen_datetime
,
"description"
:
row
[
5
]
"description"
:
row
[
5
]
...
...
myems-api/core/point.py
浏览文件 @
b7df7939
...
@@ -47,10 +47,9 @@ class PointCollection:
...
@@ -47,10 +47,9 @@ class PointCollection:
result
=
list
()
result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
data_source
=
data_source_dict
.
get
(
row
[
2
],
None
)
meta_result
=
{
"id"
:
row
[
0
],
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"name"
:
row
[
1
],
"data_source"
:
data_source
,
"data_source"
:
data_source
_dict
.
get
(
row
[
2
],
None
)
,
"object_type"
:
row
[
3
],
"object_type"
:
row
[
3
],
"units"
:
row
[
4
],
"units"
:
row
[
4
],
"high_limit"
:
row
[
5
],
"high_limit"
:
row
[
5
],
...
@@ -273,10 +272,9 @@ class PointItem:
...
@@ -273,10 +272,9 @@ class PointItem:
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
description
=
'API.POINT_NOT_FOUND'
)
description
=
'API.POINT_NOT_FOUND'
)
data_source
=
data_source_dict
.
get
(
row
[
2
],
None
)
result
=
{
"id"
:
row
[
0
],
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"name"
:
row
[
1
],
"data_source"
:
data_source
,
"data_source"
:
data_source
_dict
.
get
(
row
[
2
],
None
)
,
"object_type"
:
row
[
3
],
"object_type"
:
row
[
3
],
"units"
:
row
[
4
],
"units"
:
row
[
4
],
"high_limit"
:
row
[
5
],
"high_limit"
:
row
[
5
],
...
@@ -909,10 +907,9 @@ class PointExport:
...
@@ -909,10 +907,9 @@ class PointExport:
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
description
=
'API.POINT_NOT_FOUND'
)
description
=
'API.POINT_NOT_FOUND'
)
data_source
=
data_source_dict
.
get
(
row
[
2
],
None
)
result
=
{
"id"
:
row
[
0
],
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"name"
:
row
[
1
],
"data_source"
:
data_source
,
"data_source"
:
data_source
_dict
.
get
(
row
[
2
],
None
)
,
"object_type"
:
row
[
3
],
"object_type"
:
row
[
3
],
"units"
:
row
[
4
],
"units"
:
row
[
4
],
"high_limit"
:
row
[
5
],
"high_limit"
:
row
[
5
],
...
@@ -1143,10 +1140,9 @@ class PointClone:
...
@@ -1143,10 +1140,9 @@ class PointClone:
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
description
=
'API.POINT_NOT_FOUND'
)
description
=
'API.POINT_NOT_FOUND'
)
data_source
=
data_source_dict
.
get
(
row
[
2
],
None
)
result
=
{
"id"
:
row
[
0
],
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"name"
:
row
[
1
],
"data_source"
:
data_source
,
"data_source"
:
data_source
_dict
.
get
(
row
[
2
],
None
)
,
"object_type"
:
row
[
3
],
"object_type"
:
row
[
3
],
"units"
:
row
[
4
],
"units"
:
row
[
4
],
"high_limit"
:
row
[
5
],
"high_limit"
:
row
[
5
],
...
...
myems-api/core/rule.py
浏览文件 @
b7df7939
...
@@ -56,9 +56,14 @@ class RuleCollection:
...
@@ -56,9 +56,14 @@ class RuleCollection:
else
:
else
:
next_run_datetime
=
None
next_run_datetime
=
None
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
meta_result
=
{
"id"
:
row
[
0
],
"category"
:
row
[
3
],
"fdd_code"
:
row
[
4
],
"priority"
:
row
[
5
],
"name"
:
row
[
1
],
"channel"
:
row
[
6
],
"expression"
:
row
[
7
],
"uuid"
:
row
[
2
],
"category"
:
row
[
3
],
"fdd_code"
:
row
[
4
],
"priority"
:
row
[
5
],
"channel"
:
row
[
6
],
"expression"
:
row
[
7
],
"message_template"
:
row
[
8
].
replace
(
"<br>"
,
""
),
"message_template"
:
row
[
8
].
replace
(
"<br>"
,
""
),
"is_enabled"
:
bool
(
row
[
9
]),
"is_enabled"
:
bool
(
row
[
9
]),
"last_run_datetime"
:
last_run_datetime
,
"last_run_datetime"
:
last_run_datetime
,
...
@@ -248,9 +253,14 @@ class RuleItem:
...
@@ -248,9 +253,14 @@ class RuleItem:
else
:
else
:
next_run_datetime
=
None
next_run_datetime
=
None
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
result
=
{
"id"
:
row
[
0
],
"category"
:
row
[
3
],
"fdd_code"
:
row
[
4
],
"priority"
:
row
[
5
],
"name"
:
row
[
1
],
"channel"
:
row
[
6
],
"expression"
:
row
[
7
],
"uuid"
:
row
[
2
],
"category"
:
row
[
3
],
"fdd_code"
:
row
[
4
],
"priority"
:
row
[
5
],
"channel"
:
row
[
6
],
"expression"
:
row
[
7
],
"message_template"
:
row
[
8
].
replace
(
"<br>"
,
""
),
"message_template"
:
row
[
8
].
replace
(
"<br>"
,
""
),
"is_enabled"
:
bool
(
row
[
9
]),
"is_enabled"
:
bool
(
row
[
9
]),
"last_run_datetime"
:
last_run_datetime
,
"last_run_datetime"
:
last_run_datetime
,
...
@@ -523,9 +533,14 @@ class RuleExport:
...
@@ -523,9 +533,14 @@ class RuleExport:
else
:
else
:
next_run_datetime
=
None
next_run_datetime
=
None
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
result
=
{
"id"
:
row
[
0
],
"category"
:
row
[
3
],
"fdd_code"
:
row
[
4
],
"priority"
:
row
[
5
],
"name"
:
row
[
1
],
"channel"
:
row
[
6
],
"expression"
:
row
[
7
],
"uuid"
:
row
[
2
],
"category"
:
row
[
3
],
"fdd_code"
:
row
[
4
],
"priority"
:
row
[
5
],
"channel"
:
row
[
6
],
"expression"
:
row
[
7
],
"message_template"
:
row
[
8
].
replace
(
"<br>"
,
""
),
"message_template"
:
row
[
8
].
replace
(
"<br>"
,
""
),
"is_enabled"
:
bool
(
row
[
9
]),
"is_enabled"
:
bool
(
row
[
9
]),
"last_run_datetime"
:
last_run_datetime
,
"last_run_datetime"
:
last_run_datetime
,
...
@@ -722,9 +737,14 @@ class RuleClone:
...
@@ -722,9 +737,14 @@ class RuleClone:
else
:
else
:
next_run_datetime
=
None
next_run_datetime
=
None
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"uuid"
:
row
[
2
],
result
=
{
"id"
:
row
[
0
],
"category"
:
row
[
3
],
"fdd_code"
:
row
[
4
],
"priority"
:
row
[
5
],
"name"
:
row
[
1
],
"channel"
:
row
[
6
],
"expression"
:
row
[
7
],
"uuid"
:
row
[
2
],
"category"
:
row
[
3
],
"fdd_code"
:
row
[
4
],
"priority"
:
row
[
5
],
"channel"
:
row
[
6
],
"expression"
:
row
[
7
],
"message_template"
:
row
[
8
].
replace
(
"<br>"
,
""
),
"message_template"
:
row
[
8
].
replace
(
"<br>"
,
""
),
"is_enabled"
:
bool
(
row
[
9
]),
"is_enabled"
:
bool
(
row
[
9
]),
"last_run_datetime"
:
last_run_datetime
,
"last_run_datetime"
:
last_run_datetime
,
...
...
myems-api/core/timezone.py
浏览文件 @
b7df7939
...
@@ -36,7 +36,10 @@ class TimezoneCollection:
...
@@ -36,7 +36,10 @@ class TimezoneCollection:
result
=
list
()
result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"description"
:
row
[
2
],
"utc_offset"
:
row
[
3
]}
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"description"
:
row
[
2
],
"utc_offset"
:
row
[
3
]}
result
.
append
(
meta_result
)
result
.
append
(
meta_result
)
resp
.
text
=
json
.
dumps
(
result
)
resp
.
text
=
json
.
dumps
(
result
)
...
@@ -78,7 +81,10 @@ class TimezoneItem:
...
@@ -78,7 +81,10 @@ class TimezoneItem:
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
raise
falcon
.
HTTPError
(
status
=
falcon
.
HTTP_404
,
title
=
'API.NOT_FOUND'
,
description
=
'API.TIMEZONE_NOT_FOUND'
)
description
=
'API.TIMEZONE_NOT_FOUND'
)
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"description"
:
row
[
2
],
"utc_offset"
:
row
[
3
]}
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"description"
:
row
[
2
],
"utc_offset"
:
row
[
3
]}
cursor
.
close
()
cursor
.
close
()
cnx
.
close
()
cnx
.
close
()
...
...
myems-api/core/user.py
浏览文件 @
b7df7939
...
@@ -44,10 +44,6 @@ class UserCollection:
...
@@ -44,10 +44,6 @@ class UserCollection:
result
=
list
()
result
=
list
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
for
row
in
rows
:
account_expiration_datetime_local
=
row
[
9
].
replace
(
tzinfo
=
timezone
.
utc
)
+
\
timedelta
(
minutes
=
timezone_offset
)
password_expiration_datetime_local
=
row
[
10
].
replace
(
tzinfo
=
timezone
.
utc
)
+
\
timedelta
(
minutes
=
timezone_offset
)
meta_result
=
{
"id"
:
row
[
0
],
meta_result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"name"
:
row
[
1
],
"display_name"
:
row
[
2
],
"display_name"
:
row
[
2
],
...
@@ -59,9 +55,9 @@ class UserCollection:
...
@@ -59,9 +55,9 @@ class UserCollection:
"id"
:
row
[
7
],
"id"
:
row
[
7
],
"name"
:
row
[
8
]}
if
row
[
7
]
is
not
None
else
None
,
"name"
:
row
[
8
]}
if
row
[
7
]
is
not
None
else
None
,
"account_expiration_datetime"
:
"account_expiration_datetime"
:
account_expiration_datetime_local
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
),
(
row
[
9
].
replace
(
tzinfo
=
timezone
.
utc
)
+
timedelta
(
minutes
=
timezone_offset
))
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
),
"password_expiration_datetime"
:
"password_expiration_datetime"
:
password_expiration_datetime_local
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
),
(
row
[
10
].
replace
(
tzinfo
=
timezone
.
utc
)
+
timedelta
(
minutes
=
timezone_offset
))
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
),
"is_locked"
:
True
if
row
[
11
]
>=
config
.
maximum_failed_login_count
else
False
}
"is_locked"
:
True
if
row
[
11
]
>=
config
.
maximum_failed_login_count
else
False
}
result
.
append
(
meta_result
)
result
.
append
(
meta_result
)
...
@@ -255,9 +251,6 @@ class UserItem:
...
@@ -255,9 +251,6 @@ class UserItem:
if
config
.
utc_offset
[
0
]
==
'-'
:
if
config
.
utc_offset
[
0
]
==
'-'
:
timezone_offset
=
-
timezone_offset
timezone_offset
=
-
timezone_offset
account_expiration_datetime_local
=
row
[
9
].
replace
(
tzinfo
=
timezone
.
utc
)
+
timedelta
(
minutes
=
timezone_offset
)
password_expiration_datetime_local
=
row
[
10
].
replace
(
tzinfo
=
timezone
.
utc
)
+
timedelta
(
minutes
=
timezone_offset
)
result
=
{
"id"
:
row
[
0
],
result
=
{
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"name"
:
row
[
1
],
"display_name"
:
row
[
2
],
"display_name"
:
row
[
2
],
...
@@ -269,9 +262,9 @@ class UserItem:
...
@@ -269,9 +262,9 @@ class UserItem:
"id"
:
row
[
7
],
"id"
:
row
[
7
],
"name"
:
row
[
8
]}
if
row
[
7
]
is
not
None
else
None
,
"name"
:
row
[
8
]}
if
row
[
7
]
is
not
None
else
None
,
"account_expiration_datetime"
:
"account_expiration_datetime"
:
account_expiration_datetime_local
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
),
(
row
[
9
].
replace
(
tzinfo
=
timezone
.
utc
)
+
timedelta
(
minutes
=
timezone_offset
))
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
),
"password_expiration_datetime"
:
"password_expiration_datetime"
:
password_expiration_datetime_local
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
),
(
row
[
10
].
replace
(
tzinfo
=
timezone
.
utc
)
+
timedelta
(
minutes
=
timezone_offset
))
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
),
"is_locked"
:
True
if
row
[
11
]
>=
config
.
maximum_failed_login_count
else
False
}
"is_locked"
:
True
if
row
[
11
]
>=
config
.
maximum_failed_login_count
else
False
}
resp
.
text
=
json
.
dumps
(
result
)
resp
.
text
=
json
.
dumps
(
result
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录