Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
IoTSharp
提交
0d0b07d5
I
IoTSharp
项目概览
jobily
/
IoTSharp
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
IoTSharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0d0b07d5
编写于
10月 11, 2022
作者:
W
wq1234wq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
证书管理,设备在线,产品接口
上级
75e58319
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
466 addition
and
174 deletion
+466
-174
IoTSharp/ClientApp/src/app/routes/devices/devicelist/devicelist.component.html
...c/app/routes/devices/devicelist/devicelist.component.html
+140
-156
IoTSharp/ClientApp/src/app/routes/devices/devicelist/devicelist.component.ts
...src/app/routes/devices/devicelist/devicelist.component.ts
+2
-0
IoTSharp/ClientApp/src/app/routes/settings/certmgr/certmgr.component.html
...pp/src/app/routes/settings/certmgr/certmgr.component.html
+22
-12
IoTSharp/ClientApp/src/app/routes/settings/certmgr/certmgr.component.ts
...tApp/src/app/routes/settings/certmgr/certmgr.component.ts
+3
-0
IoTSharp/Controllers/DevicesController.cs
IoTSharp/Controllers/DevicesController.cs
+1
-1
IoTSharp/Controllers/ProducesController.cs
IoTSharp/Controllers/ProducesController.cs
+144
-5
IoTSharp/Dtos/ProduceAddDto.cs
IoTSharp/Dtos/ProduceAddDto.cs
+61
-0
IoTSharp/IoTSharp.xml
IoTSharp/IoTSharp.xml
+93
-0
未找到文件。
IoTSharp/ClientApp/src/app/routes/devices/devicelist/devicelist.component.html
浏览文件 @
0d0b07d5
<page-header
[title]=
"'设备列表'"
>
<page-header
[title]=
"'设备列表'"
>
<nz-card
[nzBordered]=
"false"
class
>
<nz-card
[nzBordered]=
"false"
class
>
<form
nz-form
class=
"search__form"
action=
"search"
>
<form
nz-form
class=
"search__form"
action=
"search"
>
<div
nz-row
[nzGutter]=
"{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }"
>
<div
nz-row
[nzGutter]=
"{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }"
>
<div
nz-col
nzMd=
"8"
nzSm=
"24"
>
<div
nz-col
nzMd=
"8"
nzSm=
"24"
>
<nz-form-item>
<nz-form-item>
<nz-form-label
nzFor=
"name"
>
设备名称
</nz-form-label>
<nz-form-label
nzFor=
"name"
>
设备名称
</nz-form-label>
<nz-form-control>
<nz-form-control>
<input
nz-input
[(ngModel)]=
"q.name"
placeholder=
"请输入设备名称或者Id"
[ngModelOptions]=
"{ standalone: true }"
/>
<input
nz-input
[(ngModel)]=
"q.name"
placeholder=
"请输入设备名称或者Id"
[ngModelOptions]=
"{ standalone: true }"
/>
</nz-form-control>
</nz-form-control>
</nz-form-item>
</nz-form-item>
</div>
</div>
<div
nz-col
[nzSpan]=
"24"
>
<div
nz-col
nzMd=
"8"
nzSm=
"24"
>
<nz-form-item>
<nz-form-label
nzFor=
"name"
>
仅显示在线
</nz-form-label>
<nz-form-control>
<div
style=
"text-align: right"
>
<nz-switch
[(ngModel)]=
"q.onlyActive"
[ngModelOptions]=
"{ standalone: true }"
placeholder=
"仅显示在线设备"
></nz-switch>
</nz-form-control>
</nz-form-item>
</div>
<div
nz-col
[nzSpan]=
"24"
>
<div
style=
"text-align: right"
>
<button
nz-button
type=
"submit"
[nzType]=
"'primary'"
(click)=
"getData()"
>
搜索
</button>
<button
nz-button
type=
"submit"
[nzType]=
"'primary'"
(click)=
"getData()"
>
搜索
</button>
<!--<button nz-button type="submit" (click)="getData()" [nzType]="'primary'" [nzLoading]="loading">查询</button>-->
<!--<button nz-button type="submit" (click)="getData()" [nzType]="'primary'" [nzLoading]="loading">查询</button>-->
<button
nz-button
type=
"reset"
(click)=
"reset()"
class=
"mx-sm"
>
重置
</button>
<button
nz-button
type=
"reset"
(click)=
"reset()"
class=
"mx-sm"
>
重置
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!--<button nz-button [nzType]="'primary'" [routerLink]="['/manage/authority/roleform']" [queryParams]="{Id:-1}">
<!--<button nz-button [nzType]="'primary'" [routerLink]="['/manage/authority/roleform']" [queryParams]="{Id:-1}">
<i nz-icon nzType="plus"></i>
<i nz-icon nzType="plus"></i>
<span>{{ 'button.new' | translate }}</span>
<span>{{ 'button.new' | translate }}</span>
</button>-->
</button>-->
</form>
</form>
<div
nz-col
>
<div
nz-col
>
<button
nz-button
[nzType]=
"'primary'"
(click)=
"edit('00000000-0000-0000-0000-000000000000')"
acl
[acl-ability]=
"137"
>
<button
nz-button
[nzType]=
"'primary'"
(click)=
"edit('00000000-0000-0000-0000-000000000000')"
acl
<i
nz-icon
nzType=
"plus"
></i>
[acl-ability]=
"137"
>
<span>
{{ 'button.new' | i18n }}
</span>
<i
nz-icon
nzType=
"plus"
></i>
</button>
<span>
{{ 'button.new' | i18n }}
</span>
<button
nz-button
[nzType]=
"'primary'"
(click)=
"downlink([])"
acl
[acl-ability]=
"137"
>
</button>
<i
nz-icon
nzType=
"plus"
></i>
<button
nz-button
[nzType]=
"'primary'"
(click)=
"downlink([])"
acl
[acl-ability]=
"137"
>
<span>
设置规则
</span>
<i
nz-icon
nzType=
"plus"
></i>
</button>
<span>
设置规则
</span>
</button>
<div
style=
"float: right; margin-top: 1rem;"
>
显示的列:
<div
style=
"float: right; margin-top: 1rem;"
>
<nz-checkbox-group
显示的列:
[(ngModel)]=
"customColumns"
<nz-checkbox-group
[(ngModel)]=
"customColumns"
name=
"customColumns"
name=
"customColumns"
(ngModelChange)=
"st.resetColumns({ emitReload: true })"
></nz-checkbox-group>
(ngModelChange)=
"st.resetColumns({ emitReload: true })"
></nz-checkbox-group>
</div>
</div>
</div>
</nz-card>
<st
multiSort
[expandAccordion]=
"true"
#st
</div>
[columns]=
"columns"
</nz-card>
[data]=
"url"
ps=
"20"
<st
multiSort
[expandAccordion]=
"true"
#st
[columns]=
"columns"
[data]=
"url"
ps=
"20"
[page]=
"page"
[req]=
"req"
[page]=
"page"
[expand]=
"expand"
[res]=
"res"
expandAccordion
(change)=
"onchange($event)"
>
[req]=
"req"
<ng-template
#expand
let-item
let-index=
"index"
let-column=
"column"
>
[expand]=
"expand"
<nz-card
nzTitle=
"设备属性"
>
[res]=
"res"
<nz-table
[nzNoResult]=
"null"
>
expandAccordion
<thead>
(change)=
"onchange($event)"
<tr>
>
<td>
属性名称
</td>
<ng-template
#expand
let-item
let-index=
"index"
let-column=
"column"
>
<td>
属性值
</td>
<nz-card
nzTitle=
"设备属性"
>
<td>
数据侧
</td>
<nz-table
[nzNoResult]=
"null"
>
<td>
时间
</td>
<thead>
<td>
操作
</td>
<tr>
</tr>
<td>
属性名称
</td>
</thead>
<td>
属性值
</td>
<tbody>
<td>
数据侧
</td>
<tr
*ngFor=
"let _item of cead; let i = index; let odd = odd"
[ngClass]=
"_item.class"
>
<td>
时间
</td>
<td>
操作
</td>
<td>
{{ _item.keyName }}
</td>
</tr></thead
<td>
{{ _item.value }}
</td>
>
<td>
{{ _item.dataSide }}
</td>
<tbody>
<td>
{{ _item.dateTime | date: 'yyyy-MM-dd HH:mm:ss' }}
</td>
<tr
*ngFor=
"let _item of cead; let i = index; let odd = odd"
[ngClass]=
"_item.class"
>
<td>
<td>
{{ _item.keyName }}
</td>
<button
nz-button
nzType=
"text"
nzDanger
nz-popconfirm
nzPopconfirmTitle=
"确认删除属性?"
<td>
{{ _item.value }}
</td>
(nzOnConfirm)=
"removeprop(item,_item)"
nzPopconfirmPlacement=
"topLeft"
>
<td>
{{ _item.dataSide }}
</td>
删除
<td>
{{ _item.dateTime | date: 'yyyy-MM-dd HH:mm:ss' }}
</td>
</button>
<td>
</td>
<button
nz-button
</tr>
nzType=
"text"
</tbody>
nzDanger
</nz-table>
nz-popconfirm
</nz-card>
nzPopconfirmTitle=
"确认删除属性?"
(nzOnConfirm)=
"removeprop(item,_item)"
<nz-card
nzTitle=
"遥测数据"
>
nzPopconfirmPlacement=
"topLeft"
<!-- <nz-tabset> -->
>
<!-- <nz-tab [nzTitle]="titleTemplate">
删除
</button>
</td>
</tr>
</tbody>
</nz-table>
</nz-card>
<nz-card
nzTitle=
"遥测数据"
>
<!-- <nz-tabset> -->
<!-- <nz-tab [nzTitle]="titleTemplate">
<ng-template #titleTemplate>
<ng-template #titleTemplate>
<i nz-icon nzType="area-chart" nzTheme="outline"></i>
<i nz-icon nzType="area-chart" nzTheme="outline"></i>
图表
图表
...
@@ -118,64 +110,57 @@
...
@@ -118,64 +110,57 @@
</div>
</div>
</div>
</div>
</nz-tab> -->
</nz-tab> -->
<!-- <nz-tab [nzTitle]="titleTemplate">
<!-- <nz-tab [nzTitle]="titleTemplate">
<ng-template #titleTemplate>
<ng-template #titleTemplate>
<i nz-icon ></i>
<i nz-icon ></i>
数据
数据
</ng-template> -->
</ng-template> -->
<nz-table
[nzNoResult]=
"null"
>
<nz-table
[nzNoResult]=
"null"
>
<thead>
<thead>
<tr>
<tr>
<td>
遥测名称
</td>
<td>
遥测名称
</td>
<td>
遥测值
</td>
<td>
遥测值
</td>
<td>
时间
</td>
<td>
时间
</td>
</tr></thead
</tr>
>
</thead
>
<tbody>
<tbody>
<tr
*ngFor=
"let _item of cetd; let i = index; let odd = odd"
[ngClass]=
"_item.class"
>
<tr
*ngFor=
"let _item of cetd; let i = index; let odd = odd"
[ngClass]=
"_item.class"
>
<td>
{{ _item.keyName }}
</td>
<td>
{{ _item.keyName }}
</td>
<td>
{{ _item.value }}
</td>
<td>
{{ _item.value }}
</td>
<td>
{{ _item.dateTime | date: 'yyyy-MM-dd HH:mm:ss'
}}
</td>
<td>
{{ _item.dateTime | date: 'yyyy-MM-dd HH:mm:ss'
}}
</td>
</tr>
</tr>
</tbody>
</tbody>
</nz-table>
</nz-table>
<!-- </nz-tab>
<!-- </nz-tab>
</nz-tabset> -->
</nz-tabset> -->
</nz-card>
</nz-card>
<nz-card
nzTitle=
"规则"
>
<nz-card
nzTitle=
"规则"
>
<nz-table
[nzNoResult]=
"null"
>
<nz-table
[nzNoResult]=
"null"
>
<thead>
<thead>
<tr>
<tr>
<td>
规则名称
</td>
<td>
规则名称
</td>
<td>
备注
</td>
<td>
备注
</td>
<td>
操作
</td>
<td>
操作
</td>
</tr></thead
</tr>
>
</thead>
<tbody>
<tbody>
<tr
*ngFor=
"let _item of cerd; let i = index; let odd = odd"
>
<tr
*ngFor=
"let _item of cerd; let i = index; let odd = odd"
>
<td>
{{ _item.name }}
</td>
<td>
{{ _item.name }}
</td>
<td>
{{ _item.ruleDesc }}
</td>
<td>
{{ _item.ruleDesc }}
</td>
<td>
<td>
<button
<button
nz-button
nzType=
"text"
nzDanger
nz-popconfirm
nzPopconfirmTitle=
"确认删除规则?"
nz-button
(nzOnConfirm)=
"removerule(item, _item)"
nzPopconfirmPlacement=
"topLeft"
>
nzType=
"text"
删除
nzDanger
</button>
nz-popconfirm
</td>
nzPopconfirmTitle=
"确认删除规则?"
</tr>
(nzOnConfirm)=
"removerule(item, _item)"
</tbody>
nzPopconfirmPlacement=
"topLeft"
</nz-table>
>
</nz-card>
删除
</button>
<!-- <nz-card nzTitle="操作">
</td>
</tr></tbody
>
</nz-table>
</nz-card>
<!-- <nz-card nzTitle="操作">
<div nz-row >
<div nz-row >
...
@@ -195,7 +180,6 @@
...
@@ -195,7 +180,6 @@
</nz-card> -->
</nz-card> -->
</ng-template>
</ng-template>
</st>
</st>
</page-header>
</page-header>
\ No newline at end of file
\ No newline at end of file
IoTSharp/ClientApp/src/app/routes/devices/devicelist/devicelist.component.ts
浏览文件 @
0d0b07d5
...
@@ -73,6 +73,7 @@ export class DevicelistComponent implements OnInit, OnDestroy {
...
@@ -73,6 +73,7 @@ export class DevicelistComponent implements OnInit, OnDestroy {
pi
:
number
;
pi
:
number
;
ps
:
number
;
ps
:
number
;
sorter
:
string
;
sorter
:
string
;
onlyActive
:
boolean
;
customerId
:
string
;
customerId
:
string
;
name
:
string
;
name
:
string
;
// anothor query field:The type you expect
// anothor query field:The type you expect
...
@@ -80,6 +81,7 @@ export class DevicelistComponent implements OnInit, OnDestroy {
...
@@ -80,6 +81,7 @@ export class DevicelistComponent implements OnInit, OnDestroy {
pi
:
0
,
pi
:
0
,
ps
:
20
,
ps
:
20
,
sorter
:
''
,
sorter
:
''
,
onlyActive
:
false
,
customerId
:
''
,
customerId
:
''
,
name
:
''
name
:
''
};
};
...
...
IoTSharp/ClientApp/src/app/routes/settings/certmgr/certmgr.component.html
浏览文件 @
0d0b07d5
<page-header
[title]=
"'根证书管理'"
>
<page-header
[title]=
"'根证书管理'"
>
<form
nz-form
(ngSubmit)=
"createcert($event)"
[formGroup]=
"form"
se-container=
"1"
labelWidth=
"120"
>
<div
nz-row
>
<se
label=
"域名"
>
<div
nz-col
class=
"gutter-row"
[nzSpan]=
"24"
>
<input
nz-input
nz-input
formControlName=
"domain"
placeholder=
"域名"
/>
<form
nz-form
(ngSubmit)=
"createcert($event)"
[formGroup]=
"form"
se-container=
"1"
labelWidth=
"120"
>
</se>
<se
label=
"域名"
>
<se
label=
"Ca指纹"
>
<input
nz-input
nz-input
formControlName=
"domain"
placeholder=
"域名"
/>
<input
nz-input
nz-input
formControlName=
"caThumbprint"
placeholder=
"域名"
/>
</se>
</se>
<se
label=
"Ca指纹"
>
<se
label=
"Broker指纹"
>
<input
nz-input
nz-input
formControlName=
"caThumbprint"
placeholder=
"域名"
/>
<input
nz-input
nz-input
formControlName=
"brokerThumbprint"
placeholder=
"域名"
/>
</se>
</se>
<se
label=
"Broker指纹"
>
<button
nz-button
nzType=
"primary"
type=
"submit"
*ngIf=
"!installed"
>
生成根证书
</button>
<input
nz-input
nz-input
formControlName=
"brokerThumbprint"
placeholder=
"域名"
/>
</form>
</se>
<button
nz-button
nzType=
"primary"
type=
"submit"
*ngIf=
"!installed&&caCertificate"
>
生成根证书
</button>
</form>
</div>
</div>
<nz-divider
nzOrientation=
"left"
*ngIf=
"!caCertificate"
></nz-divider>
<div
nz-row
*ngIf=
"!caCertificate"
>
<div
nz-col
class=
"gutter-row"
[nzSpan]=
"24"
>
<nz-alert
nzType=
"success"
nzDescription=
"证书尚未配置."
nzShowIcon
></nz-alert>
</div>
</div>
</page-header>
</page-header>
\ No newline at end of file
IoTSharp/ClientApp/src/app/routes/settings/certmgr/certmgr.component.ts
浏览文件 @
0d0b07d5
...
@@ -12,6 +12,7 @@ import { appmessage } from 'src/app/models/appmessage';
...
@@ -12,6 +12,7 @@ import { appmessage } from 'src/app/models/appmessage';
export
class
CertmgrComponent
implements
OnInit
{
export
class
CertmgrComponent
implements
OnInit
{
form
!
:
FormGroup
;
form
!
:
FormGroup
;
installed
=
true
;
installed
=
true
;
caCertificate
=
false
;
constructor
(
private
http
:
_HttpClient
,
private
msg
:
NzMessageService
,
private
fb
:
FormBuilder
,)
{
}
constructor
(
private
http
:
_HttpClient
,
private
msg
:
NzMessageService
,
private
fb
:
FormBuilder
,)
{
}
ngOnInit
():
void
{
ngOnInit
():
void
{
...
@@ -31,9 +32,11 @@ export class CertmgrComponent implements OnInit {
...
@@ -31,9 +32,11 @@ export class CertmgrComponent implements OnInit {
next
:
next
=>
{
next
:
next
=>
{
if
(
next
.
data
.
installed
)
{
if
(
next
.
data
.
installed
)
{
this
.
installed
=
true
;
this
.
installed
=
true
;
this
.
caCertificate
=
next
.
data
.
caCertificate
;
this
.
form
.
patchValue
(
next
.
data
);
this
.
form
.
patchValue
(
next
.
data
);
}
else
{
}
else
{
this
.
installed
=
false
;
this
.
installed
=
false
;
this
.
caCertificate
=
next
.
data
.
caCertificate
;
this
.
form
.
patchValue
(
next
.
data
);
this
.
form
.
patchValue
(
next
.
data
);
}
}
},
},
...
...
IoTSharp/Controllers/DevicesController.cs
浏览文件 @
0d0b07d5
...
@@ -131,7 +131,7 @@ namespace IoTSharp.Controllers
...
@@ -131,7 +131,7 @@ namespace IoTSharp.Controllers
var
query
=
from
c
in
_context
.
Device
.
Include
(
c
=>
c
.
DeviceIdentity
)
where
c
.
Customer
.
Id
==
m
.
customerId
&&
!
c
.
Deleted
&&
c
.
Tenant
.
Id
==
profile
.
Tenant
select
c
;
var
query
=
from
c
in
_context
.
Device
.
Include
(
c
=>
c
.
DeviceIdentity
)
where
c
.
Customer
.
Id
==
m
.
customerId
&&
!
c
.
Deleted
&&
c
.
Tenant
.
Id
==
profile
.
Tenant
select
c
;
if
(
m
.
OnlyActive
)
if
(
m
.
OnlyActive
)
{
{
var
al
=
from
a
in
_context
.
AttributeLatest
where
a
.
KeyName
==
Constants
.
_Active
select
a
.
DeviceId
;
var
al
=
from
a
in
_context
.
AttributeLatest
where
a
.
KeyName
==
Constants
.
_Active
&&
a
.
Value_Boolean
==
true
select
a
.
DeviceId
;
query
=
from
x
in
query
where
al
.
Contains
(
x
.
Id
)
select
x
;
query
=
from
x
in
query
where
al
.
Contains
(
x
.
Id
)
select
x
;
}
}
if
(!
string
.
IsNullOrEmpty
(
m
.
Name
))
if
(!
string
.
IsNullOrEmpty
(
m
.
Name
))
...
...
IoTSharp/Controllers/ProducesController.cs
浏览文件 @
0d0b07d5
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Linq.Expressions
;
using
System.Security.Cryptography
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
IoTSharp.Contracts
;
using
IoTSharp.Contracts
;
using
IoTSharp.Controllers.Models
;
using
IoTSharp.Controllers.Models
;
...
@@ -30,7 +31,11 @@ namespace IoTSharp.Controllers
...
@@ -30,7 +31,11 @@ namespace IoTSharp.Controllers
_context
=
context
;
_context
=
context
;
_logger
=
logger
;
_logger
=
logger
;
}
}
/// <summary>
/// 产品列表
/// </summary>
/// <param name="m"></param>
/// <returns></returns>
[
HttpGet
]
[
HttpGet
]
public
async
Task
<
ApiResult
<
PagedData
<
ProduceDto
>>>
List
([
FromQuery
]
ProduceParam
m
)
public
async
Task
<
ApiResult
<
PagedData
<
ProduceDto
>>>
List
([
FromQuery
]
ProduceParam
m
)
{
{
...
@@ -49,19 +54,153 @@ namespace IoTSharp.Controllers
...
@@ -49,19 +54,153 @@ namespace IoTSharp.Controllers
total
=
await
_context
.
Produces
.
CountAsync
(
condition
),
total
=
await
_context
.
Produces
.
CountAsync
(
condition
),
rows
=
_context
.
Produces
.
Where
(
condition
).
Where
(
condition
).
Skip
((
m
.
offset
)
*
m
.
limit
).
Take
(
m
.
limit
)
rows
=
_context
.
Produces
.
Where
(
condition
).
Where
(
condition
).
Skip
((
m
.
offset
)
*
m
.
limit
).
Take
(
m
.
limit
)
.
ToList
().
Select
(
c
=>
new
ProduceDto
.
ToList
().
Select
(
c
=>
new
ProduceDto
{
Id
=
c
.
Id
,
DefaultIdentityType
=
c
.
DefaultIdentityType
,
DefaultTimeout
=
c
.
DefaultTimeout
,
Description
=
c
.
Description
,
Name
=
c
.
Name
}).
ToList
()
{
Id
=
c
.
Id
,
DefaultIdentityType
=
c
.
DefaultIdentityType
,
DefaultTimeout
=
c
.
DefaultTimeout
,
Description
=
c
.
Description
,
Name
=
c
.
Name
}).
ToList
()
});
});
}
}
/// <summary>
///
/// </summary>
/// <param name="produceid"></param>
/// <returns></returns>
[
HttpGet
]
[
HttpGet
]
public
async
Task
<
ApiResult
<
List
<
ProduceData
>>>
ProduceDatas
(
Guid
produceid
)
public
async
Task
<
ApiResult
<
List
<
ProduceData
>>>
ProduceDatas
(
Guid
produceid
)
{
{
var
result
=
await
_context
.
ProduceDatas
.
Include
(
c
=>
c
.
Owner
).
Where
(
p
=>
p
.
Owner
.
Id
==
produceid
).
AsSplitQuery
().
ToListAsync
();
var
result
=
await
_context
.
ProduceDatas
.
Include
(
c
=>
c
.
Owner
).
Where
(
p
=>
p
.
Owner
.
Id
==
produceid
).
AsSplitQuery
().
ToListAsync
();
return
new
ApiResult
<
List
<
ProduceData
>>(
ApiCode
.
Success
,
"OK"
,
result
);
return
new
ApiResult
<
List
<
ProduceData
>>(
ApiCode
.
Success
,
"OK"
,
result
);
}
}
/// <summary>
/// 获取产品
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[
HttpGet
]
public
async
Task
<
ApiResult
<
ProduceAddDto
>>
Get
(
Guid
id
)
{
var
result
=
await
_context
.
Produces
.
SingleOrDefaultAsync
(
c
=>
c
.
Id
==
id
);
if
(
result
!=
null
)
{
return
new
ApiResult
<
ProduceAddDto
>(
ApiCode
.
Success
,
"OK"
,
new
ProduceAddDto
{
Id
=
result
.
Id
,
Customer
=
result
.
Customer
.
Id
,
Tenant
=
result
.
Tenant
.
Id
,
Icon
=
result
.
Icon
,
DefaultDeviceType
=
result
.
DefaultDeviceType
,
DefaultIdentityType
=
result
.
DefaultIdentityType
,
DefaultTimeout
=
result
.
DefaultTimeout
,
Description
=
result
.
Description
,
GatewayConfiguration
=
result
.
GatewayConfiguration
,
GatewayType
=
result
.
GatewayType
,
Name
=
result
.
Name
});
}
else
{
return
new
ApiResult
<
ProduceAddDto
>(
ApiCode
.
CantFindObject
,
"Produce is not found"
,
null
);
}
}
/// <summary>
/// 删除产品
/// </summary>
/// <param name="produceid"></param>
/// <returns></returns>
[
HttpGet
]
public
async
Task
<
ApiResult
<
bool
>>
Delete
(
Guid
produceid
)
{
try
{
var
produce
=
await
_context
.
Produces
.
SingleOrDefaultAsync
(
c
=>
c
.
Id
==
produceid
);
if
(
produce
!=
null
)
{
_context
.
ProduceDatas
.
RemoveRange
(
_context
.
ProduceDatas
.
Where
(
c
=>
c
.
Owner
==
produce
));
await
_context
.
SaveChangesAsync
();
_context
.
Produces
.
Remove
(
produce
);
await
_context
.
SaveChangesAsync
();
return
new
ApiResult
<
bool
>(
ApiCode
.
Success
,
"OK"
,
true
);
}
return
new
ApiResult
<
bool
>(
ApiCode
.
CantFindObject
,
"Produce is not found"
,
false
);
}
catch
(
Exception
e
)
{
return
new
ApiResult
<
bool
>(
ApiCode
.
Exception
,
e
.
Message
,
false
);
}
}
/// <summary>
/// 新增产品
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[
HttpGet
]
public
async
Task
<
ApiResult
<
bool
>>
Save
(
ProduceAddDto
dto
)
{
try
{
var
profile
=
this
.
GetUserProfile
();
var
produce
=
new
Produce
();
produce
.
Customer
=
_context
.
Customer
.
Find
(
profile
.
Customer
);
produce
.
Tenant
=
_context
.
Tenant
.
Find
(
profile
.
Tenant
);
produce
.
DefaultDeviceType
=
dto
.
DefaultDeviceType
;
produce
.
DefaultIdentityType
=
dto
.
DefaultIdentityType
;
produce
.
DefaultTimeout
=
dto
.
DefaultTimeout
;
produce
.
Description
=
dto
.
Description
;
produce
.
Name
=
dto
.
Name
;
produce
.
GatewayConfiguration
=
dto
.
GatewayConfiguration
;
produce
.
Icon
=
dto
.
Icon
;
produce
.
GatewayType
=
dto
.
GatewayType
;
_context
.
Produces
.
Add
(
produce
);
await
_context
.
SaveChangesAsync
();
return
new
ApiResult
<
bool
>(
ApiCode
.
Success
,
"OK"
,
true
);
}
catch
(
Exception
e
)
{
return
new
ApiResult
<
bool
>(
ApiCode
.
Exception
,
e
.
Message
,
false
);
}
}
/// <summary>
/// 修改产品
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[
HttpGet
]
public
async
Task
<
ApiResult
<
bool
>>
Update
(
ProduceAddDto
dto
)
{
try
{
var
produce
=
await
_context
.
Produces
.
SingleOrDefaultAsync
(
c
=>
c
.
Id
==
dto
.
Id
);
if
(
produce
!=
null
)
{
produce
.
DefaultIdentityType
=
dto
.
DefaultIdentityType
;
produce
.
DefaultIdentityType
=
dto
.
DefaultIdentityType
;
produce
.
DefaultTimeout
=
dto
.
DefaultTimeout
;
produce
.
Description
=
dto
.
Description
;
produce
.
GatewayConfiguration
=
dto
.
GatewayConfiguration
;
produce
.
Name
=
dto
.
Name
;
produce
.
Icon
=
dto
.
Icon
;
_context
.
Produces
.
Update
(
produce
);
await
_context
.
SaveChangesAsync
();
}
return
new
ApiResult
<
bool
>(
ApiCode
.
CantFindObject
,
"Produce is not found"
,
false
);
}
catch
(
Exception
e
)
{
return
new
ApiResult
<
bool
>(
ApiCode
.
Exception
,
e
.
Message
,
false
);
}
}
}
}
}
}
IoTSharp/Dtos/ProduceAddDto.cs
0 → 100644
浏览文件 @
0d0b07d5
using
IoTSharp.Contracts
;
using
IoTSharp.Data
;
using
System.Collections.Generic
;
using
System.ComponentModel.DataAnnotations
;
using
System
;
namespace
IoTSharp.Dtos
{
public
class
ProduceAddDto
{
public
Guid
Id
{
get
;
set
;
}
/// <summary>
/// 设备名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// ICON file full path
/// </summary>
public
string
Icon
{
get
;
set
;
}
/// <summary>
/// 网关类型 根据不通网关来处理相关配置
/// </summary>
public
GatewayType
GatewayType
{
get
;
set
;
}
=
GatewayType
.
Unknow
;
/// <summary>
/// 网关配置信息, 如果是Unknow 则不使用, 如果是自定义 ,则这里是json字符串。
/// 如果是其他对应的网关, 则这里是 对应的配置文件名。
/// </summary>
public
string
GatewayConfiguration
{
get
;
set
;
}
=
string
.
Empty
;
/// <summary>
/// 超时时间 秒数
/// </summary>
public
int
DefaultTimeout
{
get
;
set
;
}
=
300
;
/// <summary>
/// 租户
/// </summary>
public
Guid
Tenant
{
get
;
set
;
}
/// <summary>
/// 客户
/// </summary>
public
Guid
Customer
{
get
;
set
;
}
/// <summary>
/// 默认认证类型
/// </summary>
[
EnumDataType
(
typeof
(
IdentityType
))]
public
IdentityType
DefaultIdentityType
{
get
;
set
;
}
=
IdentityType
.
AccessToken
;
/// <summary>
/// 描述
/// </summary>
public
string
Description
{
get
;
set
;
}
/// <summary>
/// 默认设备类型
/// </summary>
public
DeviceType
DefaultDeviceType
{
get
;
set
;
}
}
}
IoTSharp/IoTSharp.xml
浏览文件 @
0d0b07d5
...
@@ -514,6 +514,48 @@
...
@@ -514,6 +514,48 @@
</summary>
</summary>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:IoTSharp.Controllers.ProducesController.List(IoTSharp.Controllers.Models.ProduceParam)"
>
<summary>
产品列表
</summary>
<param
name=
"m"
></param>
<returns></returns>
</member>
<member
name=
"M:IoTSharp.Controllers.ProducesController.ProduceDatas(System.Guid)"
>
<summary>
</summary>
<param
name=
"produceid"
></param>
<returns></returns>
</member>
<member
name=
"M:IoTSharp.Controllers.ProducesController.Get(System.Guid)"
>
<summary>
获取产品
</summary>
<param
name=
"id"
></param>
<returns></returns>
</member>
<member
name=
"M:IoTSharp.Controllers.ProducesController.Delete(System.Guid)"
>
<summary>
删除产品
</summary>
<param
name=
"produceid"
></param>
<returns></returns>
</member>
<member
name=
"M:IoTSharp.Controllers.ProducesController.Save(IoTSharp.Dtos.ProduceAddDto)"
>
<summary>
新增产品
</summary>
<param
name=
"dto"
></param>
<returns></returns>
</member>
<member
name=
"M:IoTSharp.Controllers.ProducesController.Update(IoTSharp.Dtos.ProduceAddDto)"
>
<summary>
修改产品
</summary>
<param
name=
"dto"
></param>
<returns></returns>
</member>
<member
name=
"M:IoTSharp.Controllers.RulesController.UpdateFlowExpression(IoTSharp.Dtos.UpdateFlowExpression)"
>
<member
name=
"M:IoTSharp.Controllers.RulesController.UpdateFlowExpression(IoTSharp.Dtos.UpdateFlowExpression)"
>
<summary>
<summary>
更新节点的条件表达式
更新节点的条件表达式
...
@@ -745,6 +787,57 @@
...
@@ -745,6 +787,57 @@
http://localhost/
http://localhost/
</summary>
</summary>
</member>
</member>
<member
name=
"P:IoTSharp.Dtos.ProduceAddDto.Name"
>
<summary>
设备名称
</summary>
</member>
<member
name=
"P:IoTSharp.Dtos.ProduceAddDto.Icon"
>
<summary>
ICON file full path
</summary>
</member>
<member
name=
"P:IoTSharp.Dtos.ProduceAddDto.GatewayType"
>
<summary>
网关类型 根据不通网关来处理相关配置
</summary>
</member>
<member
name=
"P:IoTSharp.Dtos.ProduceAddDto.GatewayConfiguration"
>
<summary>
网关配置信息, 如果是Unknow 则不使用, 如果是自定义 ,则这里是json字符串。
如果是其他对应的网关, 则这里是 对应的配置文件名。
</summary>
</member>
<member
name=
"P:IoTSharp.Dtos.ProduceAddDto.DefaultTimeout"
>
<summary>
超时时间 秒数
</summary>
</member>
<member
name=
"P:IoTSharp.Dtos.ProduceAddDto.Tenant"
>
<summary>
租户
</summary>
</member>
<member
name=
"P:IoTSharp.Dtos.ProduceAddDto.Customer"
>
<summary>
客户
</summary>
</member>
<member
name=
"P:IoTSharp.Dtos.ProduceAddDto.DefaultIdentityType"
>
<summary>
默认认证类型
</summary>
</member>
<member
name=
"P:IoTSharp.Dtos.ProduceAddDto.Description"
>
<summary>
描述
</summary>
</member>
<member
name=
"P:IoTSharp.Dtos.ProduceAddDto.DefaultDeviceType"
>
<summary>
默认设备类型
</summary>
</member>
<member
name=
"T:IoTSharp.Dtos.TelemetryDataQueryDto"
>
<member
name=
"T:IoTSharp.Dtos.TelemetryDataQueryDto"
>
<summary>
<summary>
查询历史遥测数据请求结构体
查询历史遥测数据请求结构体
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录