diff --git a/ClientApp/Angular/src/app/core/startup/startup.service.ts b/ClientApp/Angular/src/app/core/startup/startup.service.ts index e8cf4e712ac7f311490fc4e5ce0257f739f15bdf..2bd3d87f5b5c6632885f02d72076764a335da005 100644 --- a/ClientApp/Angular/src/app/core/startup/startup.service.ts +++ b/ClientApp/Angular/src/app/core/startup/startup.service.ts @@ -48,25 +48,28 @@ export class StartupService { this.translate.setDefaultLang(this.i18n.defaultLang); }), ), - this.httpClient.get('api/Account/MyInfo').pipe( + this.httpClient.get('api/Menu/GetProfile').pipe( map((appData) => { const res = appData as NzSafeAny; this.settingService.setApp({ name: 'IotSharp', description: 'IotSharp' }); this.settingService.setData('drawerconfig', { width: 720, nzMaskClosable: false }); - this.settingService.setUser(res.data.customer); + this.settingService.setUser({ + name: res.result.username, + avatar: '', + email: res.result.email, + }); var ACL = []; - if (!res.data.funcs) { + if (!res.result.funcs) { for (var i = 0; i < 500; i++) { ACL = [...ACL, i]; } } else { - this.aclService.setAbility(res.data.funcs); + this.aclService.setAbility(res.result.funcs); } - this.aclService.setAbility(ACL); this.aclService.setFull(false); //开启ACL - console.log(this.aclService.data); + var menu = [ { text: '主导航1', @@ -131,11 +134,7 @@ export class StartupService { link: '/iot/device/devicescene', // i18n: 'menu.device.devicelist', }, - { - text: '流程', - link: '/iot/flow/designer', - // i18n: 'menu.device.devicelist', - }, + { text: '规则', link: '/iot/flow/flowlist', @@ -175,12 +174,12 @@ export class StartupService { ], }, ]; - if (!res.data.menu) { + if (!res.result.menu) { res.data.menu = menu; } - this.menuService.add(res.data.menu); + this.menuService.add(res.result.menu); this.titleService.default = ''; - this.titleService.suffix = res.data.tenant.name; + this.titleService.suffix = res.result.appName; }), ), ).toPromise(); diff --git a/ClientApp/Angular/src/app/routes/device/propform/propform.component.ts b/ClientApp/Angular/src/app/routes/device/propform/propform.component.ts index 6fa12aeb6daa2cc2a8532b7c3e167482b3f84712..96b9f780f6043c3dd14e526f623b29f1371e6150 100644 --- a/ClientApp/Angular/src/app/routes/device/propform/propform.component.ts +++ b/ClientApp/Angular/src/app/routes/device/propform/propform.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectorRef } from '@angular/core'; import { Input, ViewChild } from '@angular/core'; import { Component, OnInit } from '@angular/core'; -import { SFComponent, SFSchema } from '@delon/form'; +import { SFComponent, SFNumberWidgetSchema, SFSchema, SFTextareaWidgetSchema } from '@delon/form'; import { _HttpClient } from '@delon/theme'; import { switchMap } from 'rxjs/operators'; @@ -33,22 +33,122 @@ export class PropformComponent implements OnInit { (next) => { var properties: any = {}; for (var item of next) { - // switch (item.uielement) { - // case 'uielement': - properties[item.keyName] = { - type: 'string', - title: item.keyName, - // maxLength: item.maxLength, - // pattern: item.pattern, - // ui: { - // addOnAfter: item.ui.addOnAfter, - // placeholder: item.ui.placeholder, - // }, - default: item.value, - }; - // }; - // break; - // } + switch (item.keyType) { + case 'XML': + properties[item.keyName] = { + type: 'string', + title: item.keyName, + // maxLength: item.maxLength, + // pattern: item.pattern, + ui: { + widget: 'codefield', + loadingTip: 'loading...', + config: { theme: 'vs-dark', language: 'xml' }, + value: item.value, + }, + default: item.value, + }; + + break; + + case 'Boolean': + properties[item.keyName] = { + type: 'boolean', + title: item.keyName, + // maxLength: item.maxLength, + // pattern: item.pattern, + ui: { + checkedChildren: 'True', + unCheckedChildren: 'False', + }, + default: item.value, + }; + + break; + + case 'String': + properties[item.keyName] = { + type: 'string', + title: item.keyName, + // maxLength: item.maxLength, + // pattern: item.pattern, + + default: item.value, + }; + + break; + + case 'Long': + properties[item.keyName] = { + type: 'number', + title: item.keyName, + // maxLength: item.maxLength, + // pattern: item.pattern, + ui: { + hideStep: true, + } as SFNumberWidgetSchema, + default: item.value, + }; + + break; + + case 'Double': + properties[item.keyName] = { + type: 'number', + title: item.keyName, + // maxLength: item.maxLength, + // pattern: item.pattern, + ui: { + hideStep: true, + } as SFNumberWidgetSchema, + default: item.value, + }; + + break; + + case 'Json': + properties[item.keyName] = { + type: 'string', + title: item.keyName, + // maxLength: item.maxLength, + // pattern: item.pattern, + ui: { + widget: 'codefield', + loadingTip: 'loading...', + config: { theme: 'vs-dark', language: 'json' }, + value: item.value, + }, + default: item.value, + }; + + break; + + case 'Binary': + properties[item.keyName] = { + type: 'string', + title: item.keyName, + // maxLength: item.maxLength, + // pattern: item.pattern, + ui: { + widget: 'textarea', + autosize: { minRows: 2, maxRows: 10 }, + } as SFTextareaWidgetSchema, + default: item.value, + }; + + break; + case 'DateTime': + properties[item.keyName] = { + type: 'string', + title: item.keyName, + format: 'date-time', + displayFormat: 'yyyy-MM-dd HH:mm:ss', + ui: {}, + default: item.value, + }; + + break; + } } this.schema.properties = properties; @@ -87,4 +187,5 @@ export interface deviceattributeitem { dataSide: any; dateTime: string; value: string; + keyType: string; } diff --git a/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.html b/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.html index 0b846038d0d6a2fa65acf264098846c20435feb6..2cd0c33a14ee9ebdb481f70a8b3e94faebc9c550 100644 --- a/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.html +++ b/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.html @@ -1,13 +1,6 @@ -
-
- -
- +
+
+
@@ -62,13 +55,42 @@ (ngModelChange)="ngModelChange($event)" /> + + + + + + + + + + + + + + +
- + + More +
- - More - + + +
diff --git a/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.less b/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.less index d3b41afe481d625d51e502eecc801152a8f54f19..6cc6d9ce8fb8eb689d7c1f50bc90ad9139f969e1 100644 --- a/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.less +++ b/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.less @@ -1,6 +1,5 @@ .diagram-container { - width: 100%; - height: 100%; + background-color: rgb(181, 245, 185); } .highlight:not(.djs-connection) .djs-visual > :nth-child(1) { fill: green !important; /* color elements as green */ diff --git a/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.ts b/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.ts index 928eddc9976e1ae7673381c26c4159d46ab3f0c1..e10ee26956a937491089e07981ae6936f31a6e4e 100644 --- a/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.ts +++ b/ClientApp/Angular/src/app/routes/flow/diagram/diagram.component.ts @@ -20,6 +20,8 @@ import { Observable, throwError, from, fromEvent } from 'rxjs'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { CombineLatestSubscriber } from 'rxjs/internal/observable/combineLatest'; import { appmessage, AppMessage } from '../../common/AppMessage'; +import { NzConfigService } from 'ng-zorro-antd/core/config'; +import { NzCodeEditorComponent } from 'ng-zorro-antd/code-editor'; @Component({ selector: 'app-diagram', @@ -36,6 +38,7 @@ import { appmessage, AppMessage } from '../../common/AppMessage'; // 'element.mouseup' // 来自 https://github.com/bpmn-io/bpmn-js-examples/tree/master/interaction export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy { + @ViewChild(NzCodeEditorComponent, { static: false }) editorComponent?: NzCodeEditorComponent; isCollapsed = false; EMPTY_BPMN_DIAGRAM = ` @@ -72,12 +75,39 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy nodeProcessClassVisable: false, conditionexpression: '', conditionexpressionVisable: false, + flowscript: '', + flowscriptVisable: false, + flowscripttype: '', + flowscripttypeVisable: false, }; activity: Activity; selectedValue: any; + + flowscripttypeChange($event) { + console.log(this.form.flowscripttype); + // this.nzConfigService.set('codeEditor', { + // defaultEditorOption: { + // language: this.form.flowscripttype, + // theme: 'vs-dark', + // }, + // }); + // this.editorComponent?.layout(); + } + ngModelChange($event) { var x = this.activity.sequenceFlows.find((x) => x.id == this.form.flowid); - x.bizObject = this.form; + if (x != null) { + x.bizObject = this.form; + return; + } + + var y = this.activity.tasks.find((x) => x.id == this.form.flowid); + if (y) { + console.log(this.form); + y.bizObject = this.form; + return; + } + var elementRegistry = this.bpmnJS.get('elementRegistry'); var modeling = this.bpmnJS.get('modeling'); @@ -88,7 +118,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy } public savediagram() { this.activity.ruleId = this.ruleId; - console.log(this.activity); + from(this.bpmnJS.saveXML({ format: true })) .pipe( mergeMap((x: any) => { @@ -104,8 +134,8 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy private http: _HttpClient, private fb: FormBuilder, private cd: ChangeDetectorRef, - private cdr: ChangeDetectorRef, private render: Renderer2, + private nzConfigService: NzConfigService, ) { this.activity = new Activity(); this.activity.tasks = []; @@ -133,8 +163,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy this.bpmnJS.on('element.click', (event) => { // this.form.patchValue({ Flowid: event.element.id, flowname: event.element.businessObject.name }); - console.log(event); - console.log(this.activity); + switch (event.element.type) { case 'bpmn:Task': var task = this.activity.tasks.find((x) => x.id == event.element.id); @@ -145,17 +174,22 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', - + flowscript: '', nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, conditionexpressionVisable: false, + flowscriptVisable: true, + flowscripttypeVisable: true, + flowscripttype: '', }; } + task.bizObject.flowscriptVisable = true; + task.bizObject.flowscripttypeVisable = true; task.bizObject.nodeProcessClassVisable = false; - this.form = task.bizObject; console.log(task); + this.form = task.bizObject; } break; @@ -168,10 +202,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } @@ -189,10 +227,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } @@ -210,10 +252,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } @@ -231,10 +277,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } @@ -252,10 +302,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } @@ -273,10 +327,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } @@ -294,10 +352,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } @@ -315,12 +377,19 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: true, + flowscripttypeVisable: true, + flowscripttype: '', }; } + + businessruletask.bizObject.flowscriptVisable = true; + businessruletask.bizObject.flowscripttypeVisable = true; businessruletask.bizObject.nodeProcessClassVisable = false; this.form = businessruletask.bizObject; } @@ -335,10 +404,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } @@ -356,13 +429,19 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: true, + flowscripttypeVisable: true, + flowscripttype: '', }; } + receivetask.bizObject.flowscriptVisable = true; + receivetask.bizObject.flowscripttypeVisable = true; receivetask.bizObject.nodeProcessClassVisable = false; this.form = receivetask.bizObject; } @@ -377,12 +456,20 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: true, + flowscripttypeVisable: true, + flowscripttype: '', }; } + this.form.flowscript = ''; + this.form.flowscripttype = ''; + usertask.bizObject.flowscriptVisable = true; + usertask.bizObject.flowscripttypeVisable = true; usertask.bizObject.nodeProcessClassVisable = false; this.form = usertask.bizObject; } @@ -397,10 +484,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } @@ -418,12 +509,19 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: true, + flowscripttypeVisable: true, + flowscripttype: '', }; } + + servicetask.bizObject.flowscriptVisable = true; + servicetask.bizObject.flowscripttypeVisable = true; servicetask.bizObject.nodeProcessClassVisable = false; this.form = servicetask.bizObject; } @@ -438,13 +536,19 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: true, + flowscripttypeVisable: true, + flowscripttype: '', }; } + manualtask.bizObject.flowscriptVisable = true; + manualtask.bizObject.flowscripttypeVisable = true; manualtask.bizObject.nodeProcessClassVisable = false; this.form = manualtask.bizObject; } @@ -459,13 +563,19 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: true, + flowscripttypeVisable: true, + flowscripttype: '', }; } + sendtask.bizObject.flowscriptVisable = true; + sendtask.bizObject.flowscripttypeVisable = true; sendtask.bizObject.nodeProcessClassVisable = false; this.form = sendtask.bizObject; } @@ -480,12 +590,18 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: true, + flowscripttypeVisable: true, + flowscripttype: '', }; } + callactivity.bizObject.flowscriptVisable = true; + callactivity.bizObject.flowscripttypeVisable = true; callactivity.bizObject.nodeProcessClassVisable = false; this.form = callactivity.bizObject; } @@ -500,12 +616,17 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } + sequenceflow.bizObject.conditionexpressionVisable = true; sequenceflow.bizObject.nodeProcessClassVisable = false; this.form = sequenceflow.bizObject; @@ -521,10 +642,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } participant.bizObject.nodeProcessClassVisable = false; @@ -541,10 +666,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } @@ -562,20 +691,21 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } - collaboration.bizObject.nodeProcessClassVisable = false; this.form = collaboration.bizObject; } - break; } - this.cdr.detectChanges(); this.cd.detectChanges(); }); this.bpmnJS.on('element.changed', (event) => { @@ -679,10 +809,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; baseBpmnObject.outgoing = []; baseBpmnObject.incoming = []; @@ -720,10 +854,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; baseBpmnObject.outgoing = []; baseBpmnObject.incoming = []; @@ -767,10 +905,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; dataStoreReference.outgoing = []; dataStoreReference.incoming = []; @@ -812,10 +954,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; container.outgoing = []; container.incoming = []; @@ -859,10 +1005,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; subProcess.outgoing = []; subProcess.incoming = []; @@ -908,10 +1058,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; sequenceflow.outgoing = []; sequenceflow.incoming = []; @@ -962,6 +1116,10 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscript: '', + flowscriptVisable: true, + flowscripttypeVisable: true, + flowscripttype: '', }; task.id = e.element.businessObject.id; task.bizObject.flowname = e.element.businessObject.name; @@ -1005,10 +1163,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; gateway.id = e.element.businessObject.id; gateway.outgoing = []; @@ -1050,10 +1212,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', nodeProcessClassVisable: true, conditionexpression: '', + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; startevent.id = e.element.businessObject.id; startevent.outgoing = []; @@ -1094,10 +1260,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; endevent.id = e.element.businessObject.id; endevent.outgoing = []; @@ -1223,10 +1393,15 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, + nodeProcessClass: element.bizObject.NodeProcessClass, conditionexpression: '', nodeProcessClassVisable: true, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; gateWay.incoming = element.incoming ?? []; gateWay.outgoing == element.incoming ?? []; @@ -1246,8 +1421,12 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowtype: '', conditionexpressionVisable: false, nodeProcessClass: '', + flowscript: '', conditionexpression: element.bizObject.conditionexpression, nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; sequenceflows.sourceId = element.sourceId; sequenceflows.targetId = element.targetId; @@ -1267,11 +1446,16 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: element.bizObject.flowscript ?? '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: element.bizObject.flowscripttype ?? '', }; + task.incoming = element.incoming ?? []; task.outgoing = element.incoming ?? []; task.id = element.id; @@ -1288,10 +1472,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; laneset.incoming = element.incoming ?? []; laneset.outgoing = element.incoming ?? []; @@ -1308,10 +1496,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; endevent.incoming = element.incoming ?? []; endevent.outgoing = element.incoming ?? []; @@ -1329,10 +1521,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; startevent.incoming = []; startevent.outgoing = []; @@ -1350,10 +1546,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; container.incoming = element.incoming ?? []; container.outgoing = element.incoming ?? []; @@ -1371,10 +1571,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; baseBpmnObject.incoming = element.incoming ?? []; baseBpmnObject.outgoing = element.incoming ?? []; @@ -1392,10 +1596,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; datastorereference.incoming = element.incoming ?? []; datastorereference.outgoing = element.incoming ?? []; @@ -1412,10 +1620,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; subprocess.incoming = element.incoming ?? []; subprocess.outgoing = element.incoming ?? []; @@ -1433,10 +1645,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; dataOutputAssociation.incoming = element.incoming ?? []; dataOutputAssociation.outgoing = element.incoming ?? []; @@ -1454,10 +1670,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; dataInputAssociations.incoming = element.incoming ?? []; dataInputAssociations.outgoing = element.incoming ?? []; @@ -1475,10 +1695,14 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy flowname: element.bizObject.flowname, flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', conditionexpression: '', nodeProcessClassVisable: false, + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; lane.incoming = element.incoming ?? []; lane.outgoing = element.incoming ?? []; @@ -1509,10 +1733,14 @@ export class BpmnBaseObject { flowname: '', flowdesc: '', flowtype: '', + flowscript: '', conditionexpressionVisable: false, nodeProcessClass: '', nodeProcessClassVisable: true, conditionexpression: '', + flowscriptVisable: false, + flowscripttypeVisable: false, + flowscripttype: '', }; } @@ -1611,4 +1839,8 @@ export interface FormBpmnObject { nodeProcessClassVisable: boolean; conditionexpression: string; conditionexpressionVisable: boolean; + flowscript: string; + flowscriptVisable: boolean; + flowscripttype: string; + flowscripttypeVisable: boolean; } diff --git a/ClientApp/Angular/src/app/routes/flow/flowlist/flowlist.component.ts b/ClientApp/Angular/src/app/routes/flow/flowlist/flowlist.component.ts index d5bd0e2321e93c70a0f3c07f0f36a29e1ad5b455..b7d9304c1c8169770ec55963b040732619daeac6 100644 --- a/ClientApp/Angular/src/app/routes/flow/flowlist/flowlist.component.ts +++ b/ClientApp/Angular/src/app/routes/flow/flowlist/flowlist.component.ts @@ -107,7 +107,7 @@ export class FlowlistComponent implements OnInit { }, { text: '设计', - acl: 104, + // acl: 104, click: (item: ruleflow) => { this._router.navigate(['/iot/flow/designer'], { queryParams: { @@ -119,7 +119,7 @@ export class FlowlistComponent implements OnInit { }, { text: '测试', - acl: 104, + // acl: 104, click: (item: ruleflow) => { this.testthisflow(item); @@ -202,7 +202,18 @@ export class FlowlistComponent implements OnInit { this.st.req = this.req; this.st.load(this.st.pi); } - + reset() { + this.q == + { + pi: 0, + ps: 10, + Name: '', + Creator: '', + CreatTime: [], + sorter: '', + status: null, + }; + } setstatus(number: number, status: number) {} } diff --git a/ClientApp/Angular/src/app/routes/passport/login/login.component.html b/ClientApp/Angular/src/app/routes/passport/login/login.component.html index 997ac5d67ac3b25cb277b5309dc7ca2ef42062ad..6361772930f4bb881d49b8f38e0cb016fe30fd2f 100644 --- a/ClientApp/Angular/src/app/routes/passport/login/login.component.html +++ b/ClientApp/Angular/src/app/routes/passport/login/login.component.html @@ -42,8 +42,15 @@ - @@ -57,7 +64,7 @@ - {{ 'app.login.forgot-password' | translate }} + {{ 'app.login.forgot-password' | translate }} @@ -68,10 +75,8 @@
{{ 'app.login.sign-in-with' | translate }} - - + + {{ 'app.login.signup' | translate }} -
\ No newline at end of file +
diff --git a/ClientApp/Angular/src/app/routes/routes.module.ts b/ClientApp/Angular/src/app/routes/routes.module.ts index cf1f453c50ed4eaa39e50dcaccd00135204a128b..bccc850a363776d27a4a75db92cfebd1d3da1073 100644 --- a/ClientApp/Angular/src/app/routes/routes.module.ts +++ b/ClientApp/Angular/src/app/routes/routes.module.ts @@ -38,11 +38,14 @@ import { DynamicformresultviewComponent } from './util/dynamicform/dynamicformre import { DynamicformviewComponent } from './util/dynamicform/dynamicformview/dynamicformview.component'; import { WidgetsModule } from './widgets/widgets.module'; import { CodeviewComponent } from './util/code/codeview/codeview.component'; +import { DelonFormModule, WidgetRegistry } from '@delon/form'; + +import { CodefieldComponent } from './util/codefield/codefield.component'; const COMPONENTS: Type[] = []; const Directive: Type[] = [fielddirective]; @NgModule({ - imports: [SharedModule, RouteRoutingModule, WidgetsModule], + imports: [SharedModule, RouteRoutingModule, WidgetsModule, DelonFormModule.forRoot()], declarations: [ ...COMPONENTS, ...Directive, @@ -77,6 +80,11 @@ const Directive: Type[] = [fielddirective]; DynamicformresultviewComponent, DynamicformviewComponent, CodeviewComponent, + CodefieldComponent, ], }) -export class RoutesModule {} +export class RoutesModule { + constructor(widgetRegistry: WidgetRegistry) { + widgetRegistry.register(CodefieldComponent.KEY, CodefieldComponent); + } +} diff --git a/ClientApp/Angular/src/app/routes/tenant/tenantlist/tenantlist.component.ts b/ClientApp/Angular/src/app/routes/tenant/tenantlist/tenantlist.component.ts index 43bba573c7ebf4d0eb0f55656cc18f2cb6bb4778..4db48dbcb2dd35703e8deb89b17b1bdcad098893 100644 --- a/ClientApp/Angular/src/app/routes/tenant/tenantlist/tenantlist.component.ts +++ b/ClientApp/Angular/src/app/routes/tenant/tenantlist/tenantlist.component.ts @@ -74,7 +74,7 @@ export class TenantlistComponent implements OnInit { { // acl: 10, - text: '租户管理', + text: '客户管理', click: (item: any) => { this._router.navigateByUrl('iot/customer/customerlist?id=' + item.id); }, diff --git a/ClientApp/Angular/src/app/routes/util/code/codeview/codeview.component.less b/ClientApp/Angular/src/app/routes/util/code/codeview/codeview.component.less index ea0ff4b7ad0164bb7292d0bdde1224a9123c7434..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/ClientApp/Angular/src/app/routes/util/code/codeview/codeview.component.less +++ b/ClientApp/Angular/src/app/routes/util/code/codeview/codeview.component.less @@ -1 +0,0 @@ -@import 'node_modules/ng-zorro-antd/code-editor/style/entry.less'; diff --git a/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.html b/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.html new file mode 100644 index 0000000000000000000000000000000000000000..0092218fdc4bd8e0d258651184f60a0b7d7d7e6a --- /dev/null +++ b/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.html @@ -0,0 +1,16 @@ + + + + diff --git a/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.less b/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.less new file mode 100644 index 0000000000000000000000000000000000000000..52a015fb0e240d7e0022f69b7d29d24c10c8a699 --- /dev/null +++ b/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.less @@ -0,0 +1,3 @@ +.editor { + height: 200px; +} diff --git a/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.spec.ts b/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..7d172f85a145250f5436cf4e2b0b2076cdcbfd85 --- /dev/null +++ b/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CodefieldComponent } from './codefield.component'; + +describe('CodefieldComponent', () => { + let component: CodefieldComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ CodefieldComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(CodefieldComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.ts b/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..919e9ccc19c88b59ee3ecf728abfed9220b97a3a --- /dev/null +++ b/ClientApp/Angular/src/app/routes/util/codefield/codefield.component.ts @@ -0,0 +1,29 @@ +import { Component, OnInit } from '@angular/core'; +import { ControlWidget } from '@delon/form'; + +@Component({ + selector: 'app-codefield', + templateUrl: './codefield.component.html', + styleUrls: ['./codefield.component.less'], +}) +export class CodefieldComponent extends ControlWidget implements OnInit { + static readonly KEY = 'codefield'; + config: { theme: 'vs-dark'; language: 'csharp' }; + loadingTip: string; + ngOnInit(): void { + this.loadingTip = this.ui.loadingTip || '加载中……'; + this.config = this.ui.config || { theme: 'vs-dark', language: 'csharp' }; + console.log(this.value); + this.setValue(this.ui.value); + console.log(this.value); + this.detectChanges(); + //this.config = { theme: 'vs-dark', language: 'csharp' }; + } + reset(value: string) { + // this.setValue(''); + } + change(value: string) { + this.setValue(value); + if (this.ui.change) this.ui.change(value); + } +} diff --git a/ClientApp/Angular/src/app/routes/util/dynamicform/dynamicformfieldeditor/dynamicformfieldeditor.component.ts b/ClientApp/Angular/src/app/routes/util/dynamicform/dynamicformfieldeditor/dynamicformfieldeditor.component.ts index d0e1645de281a6b3fdee48eabe8fc9cd258a43c5..4b93f23f940c5970a9105affd324ce28a9380c84 100644 --- a/ClientApp/Angular/src/app/routes/util/dynamicform/dynamicformfieldeditor/dynamicformfieldeditor.component.ts +++ b/ClientApp/Angular/src/app/routes/util/dynamicform/dynamicformfieldeditor/dynamicformfieldeditor.component.ts @@ -47,8 +47,6 @@ export class DynamicformfieldeditorComponent implements OnInit { this.AllSuportType = x.result.rows.map((x) => { return { label: x.dictionaryName, value: x.dictionaryValue }; }); - - console.log(this.AllSuportType); }), ), this.http.post('api/dictionary/index', { DictionaryGroupId: 2, pi: 0, ps: 20, limit: 20, offset: 0 }).pipe( @@ -56,7 +54,6 @@ export class DynamicformfieldeditorComponent implements OnInit { this.AllControlType = x.result.rows.map((x) => { return { label: x.dictionaryName, value: x.dictionaryValue }; }); - console.log(this.AllControlType); }), ), this.http.get('api/dynamicforminfo/getParams?id=' + this.id).pipe( diff --git a/ClientApp/Angular/src/app/routes/util/dynamicform/dynamicformview/dynamicformview.component.ts b/ClientApp/Angular/src/app/routes/util/dynamicform/dynamicformview/dynamicformview.component.ts index f5d6996753e56da6a0765fffe26faf9b9facb8cf..a351826de943d01f47d8c8f6bf62c4d2a52027d8 100644 --- a/ClientApp/Angular/src/app/routes/util/dynamicform/dynamicformview/dynamicformview.component.ts +++ b/ClientApp/Angular/src/app/routes/util/dynamicform/dynamicformview/dynamicformview.component.ts @@ -24,13 +24,21 @@ import { map } from 'rxjs/operators'; }) export class DynamicformviewComponent implements OnInit { @ViewChild('sf', { static: false }) sf: SFComponent; - @Input() id: Number = -1; + @Input() _id: Number = -1; @Output() onsubmit = new EventEmitter(); options: {}; AllControlType: any = []; AllSuportType: any = []; SuportType: any = []; + get id() { + return this._id; + } + set id(val) { + this._id = val; + this.CreatForm(val); + } + constructor( private _router: ActivatedRoute, private router: Router, @@ -42,7 +50,7 @@ export class DynamicformviewComponent implements OnInit { private cd: ChangeDetectorRef, ) {} - ngOnInit(): void { + private CreatForm(id) { this._httpClient.get('api/DynamicFormInfo/GetFormFieldValue?FormId=' + this.id + '&BizId=0').subscribe( (x) => { var properties = {}; @@ -546,6 +554,8 @@ export class DynamicformviewComponent implements OnInit { () => {}, ); } + + ngOnInit(): void {} schema: SFSchema = { properties: {}, }; diff --git a/ClientApp/Angular/src/app/routes/util/flow/flowsimulator/flowsimulator.component.html b/ClientApp/Angular/src/app/routes/util/flow/flowsimulator/flowsimulator.component.html index 1c9dd436e127c38c2a7ab487834501a4073d8ab9..2b101e12ac1e48a32cef3792a44a0bea764f418b 100644 --- a/ClientApp/Angular/src/app/routes/util/flow/flowsimulator/flowsimulator.component.html +++ b/ClientApp/Angular/src/app/routes/util/flow/flowsimulator/flowsimulator.component.html @@ -1,4 +1,4 @@ -
+
@@ -7,13 +7,25 @@
+
+ + + + + +
- - + +
diff --git a/ClientApp/Angular/src/app/routes/util/flow/flowsimulator/flowsimulator.component.ts b/ClientApp/Angular/src/app/routes/util/flow/flowsimulator/flowsimulator.component.ts index 73ce1284fe1d086a2c17fc6b04cc25004e4ee18c..a851c02c3ea7122d28e55a284df95480050a5e9d 100644 --- a/ClientApp/Angular/src/app/routes/util/flow/flowsimulator/flowsimulator.component.ts +++ b/ClientApp/Angular/src/app/routes/util/flow/flowsimulator/flowsimulator.component.ts @@ -1,8 +1,9 @@ -import { Component, OnInit, ViewChild, Input, ChangeDetectorRef, TemplateRef } from '@angular/core'; +import { Component, OnInit, ViewChild, Input, ChangeDetectorRef, TemplateRef, OnDestroy } from '@angular/core'; import { _HttpClient } from '@delon/theme'; import { NzTimelineComponent, NzTimelineItemComponent, TimelineService } from 'ng-zorro-antd/timeline'; -import { Observable } from 'rxjs'; +import { concat, interval, Observable, Subject, Subscription } from 'rxjs'; +import { map } from 'rxjs/operators'; import { appmessage } from 'src/app/routes/common/AppMessage'; import { ruleflow } from 'src/app/routes/flow/flowlist/flowlist.component'; import { FlowviewerComponent } from 'src/app/routes/widgets/flowviewer/flowviewer.component'; @@ -13,9 +14,11 @@ import { DynamicformviewComponent } from '../../dynamicform/dynamicformview/dyna templateUrl: './flowsimulator.component.html', styleUrls: ['./flowsimulator.component.less'], }) -export class FlowsimulatorComponent implements OnInit { +export class FlowsimulatorComponent implements OnInit, OnDestroy { @Input() id: Number; + listOfOption = []; + obs: Subscription; // @ViewChild('flowtimeline', { static: true }) // flowtimeline: NzTimelineComponent; @ViewChild('flowview', { static: true }) @@ -23,26 +26,50 @@ export class FlowsimulatorComponent implements OnInit { @ViewChild('dynamicformview', { static: true }) dynamicformview: DynamicformviewComponent; constructor( - private httpClient: _HttpClient, + private http: _HttpClient, private cdr: ChangeDetectorRef, // private timelineservice: TimelineService ) {} + ngOnDestroy(): void { + if (this.obs) { + this.obs.unsubscribe(); + } + } // @ViewChild('TimeLineItemTemplate', { read: TemplateRef }) TimeLineItemTemplate: TemplateRef; - thisisyourtestdataformid: number = 1; - steps: []; + thisisyourtestdataformid: Number = 1; + steps: any = []; + nodes = []; current: 0; ngOnInit(): void { - this.httpClient.get>('api/rules/get?id=' + this.id).subscribe( - (next) => { - this.flowview.diagramdata = next.result; + concat( + this.http.post('api/dynamicforminfo/index', { DictionaryGroupId: 1, pi: 0, ps: 20, limit: 20, offset: 0 }).pipe( + map((x) => { + this.listOfOption = x.result.rows.map((x) => { + return { label: x.formName, value: x.formId }; + }); - this.flowview.loadXml(); - }, - (error) => {}, - () => {}, - ); - this.dynamicformview.id = this.thisisyourtestdataformid; + this.dynamicformview.id = this.listOfOption[0]?.value; + console.log(this.dynamicformview.id); + }), + ), + this.http.get>('api/rules/get?id=' + this.id).pipe( + map((x) => { + this.flowview.diagramdata = x.result; + this.flowview.loadXml(); + }), + ), + ).subscribe(); + + // this.http.get>('api/rules/get?id=' + this.id).subscribe( + // (next) => { + // this.flowview.diagramdata = next.result; - //it's deadend + // this.flowview.loadXml(); + // }, + // (error) => {}, + // () => {}, + // ); + + //it's deadend,nothing you can get // let item = new NzTimelineItemComponent(this.cdr, this.timelineservice); // item.borderColor = '#eeeeff'; // item.template = this.TimeLineItemTemplate; @@ -56,9 +83,11 @@ export class FlowsimulatorComponent implements OnInit { // console.log(this.flowtimeline.timelineItems); } - + formIdChange(iamnottheformidyouwantit): void { + this.dynamicformview.id = this.thisisyourtestdataformid; + } onsubmit(formdata) { - this.httpClient + this.http .post('api/rules/active', { form: formdata, extradata: { @@ -67,9 +96,37 @@ export class FlowsimulatorComponent implements OnInit { }, }) .subscribe( - (next) => {}, + (next) => { + this.nodes = next.result; // + this.play(); + }, (error) => {}, () => {}, ); } + + play() { + if (this.obs) { + this.obs.unsubscribe(); + } + this.obs = interval(1000).subscribe(async (x) => { + var index = x % this.nodes.length; + if (index == 0) { + await this.flowview.redraw(); + this.steps = []; + } + for (var element of this.steps) { + element.nzStatus = 'finish'; + } + + for (const node of this.nodes[index].nodes) { + this.flowview.sethighlight(node.bpmnid); + this.steps = [...this.steps, { addDate: node.addDate, operationDesc: node.operationDesc, nzStatus: 'process' }]; + } + + // if (this.nodes.length + 3 == x) { + // this.obs.unsubscribe(); + // } + }); + } } diff --git a/ClientApp/Angular/src/app/routes/widgets/flowviewer/flowviewer.component.html b/ClientApp/Angular/src/app/routes/widgets/flowviewer/flowviewer.component.html index 9897e7667b2244b416e0f16d303f4d26654b3b55..f4b59baabd173fede78f0b4e11269598cf72beff 100644 --- a/ClientApp/Angular/src/app/routes/widgets/flowviewer/flowviewer.component.html +++ b/ClientApp/Angular/src/app/routes/widgets/flowviewer/flowviewer.component.html @@ -1 +1 @@ -
+
diff --git a/ClientApp/Angular/src/app/routes/widgets/flowviewer/flowviewer.component.ts b/ClientApp/Angular/src/app/routes/widgets/flowviewer/flowviewer.component.ts index c9d85693828b4ca11b4084763c19ad4273f51f69..352a7146396d9e88b4b567b167cce13bcc2f7bf2 100644 --- a/ClientApp/Angular/src/app/routes/widgets/flowviewer/flowviewer.component.ts +++ b/ClientApp/Angular/src/app/routes/widgets/flowviewer/flowviewer.component.ts @@ -18,7 +18,6 @@ import { interval } from 'rxjs'; styleUrls: ['./flowviewer.component.less'], }) export class FlowviewerComponent implements AfterContentInit, OnChanges, OnDestroy { - nodes = ['Event_1ugcz6g', 'Flow_1d2x8ry', 'Activity_1fl2v8i', 'Flow_09ib71g', 'Activity_1pl6xim', 'Flow_1nmme3b', 'Event_1e0aci8']; @ViewChild('viewer', { static: true }) private viewer: ElementRef; @Input() @@ -43,9 +42,8 @@ export class FlowviewerComponent implements AfterContentInit, OnChanges, OnDestr this.bpmnViewer.attachTo(this.viewer.nativeElement); } async loadXml() { - console.log(this.diagramdata); await this.bpmnViewer.importXML(this.diagramdata.definitionsXml); - + this.bpmnViewer.get('canvas').zoom('fit-viewport'); var elementRegistry = this.bpmnViewer.get('elementRegistry'); var shape = elementRegistry.get('Activity_1pl6xim'); var overlays = this.bpmnViewer.get('overlays'); @@ -64,19 +62,17 @@ export class FlowviewerComponent implements AfterContentInit, OnChanges, OnDestr // }); // console.log(overlays); // overlays.remove(id); - var canvas = this.bpmnViewer.get('canvas'); - //只是修改了属性 - const souce = interval(1000).subscribe(async (x) => { - var index = x % this.nodes.length; + //只是修改了属性 + } - if (index == 0) { - await this.bpmnViewer.importXML(this.diagramdata.definitionsXml); - } - if (index < this.nodes.length) { - canvas.addMarker(this.nodes[index], 'flowviewhighlight'); - } - }); + async redraw() { + await this.bpmnViewer.importXML(this.diagramdata.definitionsXml); + } + sethighlight(bpmnid) { + var canvas = this.bpmnViewer.get('canvas'); + //只能添加一次,再次添加只能重绘后添加了 + canvas.addMarker(bpmnid, 'flowviewhighlight'); } ngOnChanges(changes: SimpleChanges): void {} diff --git a/ClientApp/Angular/src/app/routes/widgets/widgets.module.ts b/ClientApp/Angular/src/app/routes/widgets/widgets.module.ts index 0bfc07cfa8c47605693a3506a82490cfffb54420..47017e79114630475c0215675d4195ecf82ce287 100644 --- a/ClientApp/Angular/src/app/routes/widgets/widgets.module.ts +++ b/ClientApp/Angular/src/app/routes/widgets/widgets.module.ts @@ -1,8 +1,10 @@ import { NgModule, Type } from '@angular/core'; import { G2MiniAreaModule } from '@delon/chart/mini-area'; import { G2MiniBarModule } from '@delon/chart/mini-bar'; +import { DelonFormModule, WidgetRegistry } from '@delon/form'; import { SharedModule } from '@shared'; import { NzCarouselModule } from 'ng-zorro-antd/carousel'; + import { FlowviewerComponent } from './flowviewer/flowviewer.component'; import { WidgetsRoutingModule } from './widgets-routing.module'; @@ -12,7 +14,7 @@ import { WidgetsComponent } from './widgets/widgets.component'; const COMPONENTS: Type[] = [WidgetsComponent, FlowviewerComponent]; @NgModule({ - imports: [SharedModule, WidgetsRoutingModule, NzCarouselModule, G2MiniBarModule, G2MiniAreaModule], + imports: [SharedModule, WidgetsRoutingModule, NzCarouselModule, G2MiniBarModule, G2MiniAreaModule, DelonFormModule], declarations: COMPONENTS, exports: COMPONENTS, }) diff --git a/ClientApp/Angular/src/app/shared/shared.module.ts b/ClientApp/Angular/src/app/shared/shared.module.ts index 35b07743d07e9e9f8e82794fe7c7a5c501d4f340..44e5c6c008d560da8196ae4b9b08031e25e75579 100644 --- a/ClientApp/Angular/src/app/shared/shared.module.ts +++ b/ClientApp/Angular/src/app/shared/shared.module.ts @@ -16,8 +16,9 @@ import { NgxJsonViewModule } from 'ngw-json-view'; // #region third libs // import { NgxTinymceModule } from 'ngx-tinymce'; import { UEditorModule } from 'ngx-ueditor'; +import { NzCodeEditorModule } from 'ng-zorro-antd/code-editor'; -const THIRDMODULES: Type[] = [DragDropModule, DragAndDropModule, NgxJsonViewModule]; +const THIRDMODULES: Type[] = [DragDropModule, DragAndDropModule, NgxJsonViewModule, NzCodeEditorModule]; // #endregion // #region your componets & directives diff --git a/ClientApp/Angular/src/styles/index.less b/ClientApp/Angular/src/styles/index.less index 2266d6abfd8c83487df45d74591ded2980dc6d47..2c7ec22ee3213fe7c9d53c2159baba3a8e392204 100644 --- a/ClientApp/Angular/src/styles/index.less +++ b/ClientApp/Angular/src/styles/index.less @@ -1,10 +1,11 @@ /* You can add global styles to this file, and also import other style files */ +@import 'node_modules/ng-zorro-antd/code-editor/style/entry.less'; /* 测试,测完该放哪里放哪里 */ .flowviewhighlight .djs-visual > :nth-child(1) { - border-color: green !important; - opacity: 0.4; - fill: green !important; /* color elements as green */ + border-color: rgb(223, 126, 16) !important; + opacity: 0.8; + stroke: rgb(223, 126, 16) !important; } .flowview:not(.djs-connection) .djs-visual > :nth-child(1) { border-color: #e6f7ff !important; diff --git a/IoTSharp.Data.PostgreSQL/Migrations/20210809095243_addflowoperationfield1.Designer.cs b/IoTSharp.Data.PostgreSQL/Migrations/20210809095243_addflowoperationfield1.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..fe77027297adcf6076550535ef70f60cae531f8f --- /dev/null +++ b/IoTSharp.Data.PostgreSQL/Migrations/20210809095243_addflowoperationfield1.Designer.cs @@ -0,0 +1,1312 @@ +// +using System; +using IoTSharp.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace IoTSharp.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20210809095243_addflowoperationfield1")] + partial class addflowoperationfield1 + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.7") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ActionData") + .HasColumnType("jsonb"); + + b.Property("ActionName") + .HasColumnType("text"); + + b.Property("ActionResult") + .HasColumnType("jsonb"); + + b.Property("ActiveDateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("ObjectID") + .HasColumnType("uuid"); + + b.Property("ObjectName") + .HasColumnType("text"); + + b.Property("ObjectType") + .HasColumnType("integer"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("text"); + + b.Property("UserName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuditLog"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthToken") + .HasColumnType("text"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuthorizedKeys"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseDictionary", b => + { + b.Property("DictionaryId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Dictionary18NKeyName") + .HasColumnType("text"); + + b.Property("DictionaryColor") + .HasColumnType("text"); + + b.Property("DictionaryDesc") + .HasColumnType("text"); + + b.Property("DictionaryGroupId") + .HasColumnType("bigint"); + + b.Property("DictionaryIcon") + .HasColumnType("text"); + + b.Property("DictionaryName") + .HasColumnType("text"); + + b.Property("DictionaryPattern") + .HasColumnType("text"); + + b.Property("DictionaryStatus") + .HasColumnType("integer"); + + b.Property("DictionaryTag") + .HasColumnType("text"); + + b.Property("DictionaryValue") + .HasColumnType("text"); + + b.Property("DictionaryValueType") + .HasColumnType("integer"); + + b.Property("DictionaryValueTypeName") + .HasColumnType("text"); + + b.HasKey("DictionaryId"); + + b.ToTable("BaseDictionaries"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseDictionaryGroup", b => + { + b.Property("DictionaryGroupId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DictionaryGroup18NKeyName") + .HasColumnType("text"); + + b.Property("DictionaryGroupDesc") + .HasColumnType("text"); + + b.Property("DictionaryGroupKey") + .HasColumnType("text"); + + b.Property("DictionaryGroupName") + .HasColumnType("text"); + + b.Property("DictionaryGroupStatus") + .HasColumnType("integer"); + + b.Property("DictionaryGroupValueType") + .HasColumnType("integer"); + + b.Property("DictionaryGroupValueTypeName") + .HasColumnType("text"); + + b.HasKey("DictionaryGroupId"); + + b.ToTable("BaseDictionaryGroups"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseEvent", b => + { + b.Property("EventId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CreaterDateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("EventDesc") + .HasColumnType("text"); + + b.Property("EventName") + .HasColumnType("text"); + + b.Property("EventStaus") + .HasColumnType("integer"); + + b.Property("MataData") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("EventId"); + + b.ToTable("BaseEvents"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseI18N", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AddDate") + .HasColumnType("timestamp without time zone"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("ResouceDesc") + .HasColumnType("text"); + + b.Property("ResouceGroupId") + .HasColumnType("integer"); + + b.Property("ResourceId") + .HasColumnType("bigint"); + + b.Property("ResourceKey") + .HasColumnType("text"); + + b.Property("ResourceTag") + .HasColumnType("text"); + + b.Property("ResourceType") + .HasColumnType("integer"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("ValueBG") + .HasColumnType("text"); + + b.Property("ValueCS") + .HasColumnType("text"); + + b.Property("ValueDA") + .HasColumnType("text"); + + b.Property("ValueDEDE") + .HasColumnType("text"); + + b.Property("ValueELGR") + .HasColumnType("text"); + + b.Property("ValueENGR") + .HasColumnType("text"); + + b.Property("ValueENUS") + .HasColumnType("text"); + + b.Property("ValueESES") + .HasColumnType("text"); + + b.Property("ValueFI") + .HasColumnType("text"); + + b.Property("ValueFRFR") + .HasColumnType("text"); + + b.Property("ValueHE") + .HasColumnType("text"); + + b.Property("ValueHRHR") + .HasColumnType("text"); + + b.Property("ValueHU") + .HasColumnType("text"); + + b.Property("ValueITIT") + .HasColumnType("text"); + + b.Property("ValueJAJP") + .HasColumnType("text"); + + b.Property("ValueKOKR") + .HasColumnType("text"); + + b.Property("ValueNL") + .HasColumnType("text"); + + b.Property("ValuePLPL") + .HasColumnType("text"); + + b.Property("ValuePT") + .HasColumnType("text"); + + b.Property("ValueSLSL") + .HasColumnType("text"); + + b.Property("ValueSR") + .HasColumnType("text"); + + b.Property("ValueSV") + .HasColumnType("text"); + + b.Property("ValueTRTR") + .HasColumnType("text"); + + b.Property("ValueUK") + .HasColumnType("text"); + + b.Property("ValueVI") + .HasColumnType("text"); + + b.Property("ValueZHCN") + .HasColumnType("text"); + + b.Property("ValueZHTW") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("BaseI18Ns"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("text"); + + b.Property("Country") + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("text"); + + b.Property("Province") + .HasColumnType("text"); + + b.Property("Street") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("ZipCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Customer"); + }); + + modelBuilder.Entity("IoTSharp.Data.DataStorage", b => + { + b.Property("Catalog") + .HasColumnType("integer"); + + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("DataSide") + .HasColumnType("integer"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("Value_Binary") + .HasColumnType("bytea"); + + b.Property("Value_Boolean") + .HasColumnType("boolean"); + + b.Property("Value_DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Value_Double") + .HasColumnType("double precision"); + + b.Property("Value_Json") + .HasColumnType("jsonb"); + + b.Property("Value_Long") + .HasColumnType("bigint"); + + b.Property("Value_String") + .HasColumnType("text"); + + b.Property("Value_XML") + .HasColumnType("xml"); + + b.HasKey("Catalog", "DeviceId", "KeyName"); + + b.HasIndex("Catalog"); + + b.HasIndex("Catalog", "DeviceId"); + + b.ToTable("DataStorage"); + + b.HasDiscriminator("Catalog").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthorizedKeyId") + .HasColumnType("uuid"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("DeviceType") + .HasColumnType("integer"); + + b.Property("LastActive") + .HasColumnType("timestamp without time zone"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Online") + .HasColumnType("boolean"); + + b.Property("OwnerId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("Timeout") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizedKeyId"); + + b.HasIndex("CustomerId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("TenantId"); + + b.ToTable("Device"); + + b.HasDiscriminator("DeviceType").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IdentityType") + .HasColumnType("integer"); + + b.Property("IdentityValue") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("DeviceId"); + + b.ToTable("DeviceIdentities"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldInfo", b => + { + b.Property("FieldId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FieldCode") + .HasColumnType("text"); + + b.Property("FieldCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldEditDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldI18nKey") + .HasColumnType("text"); + + b.Property("FieldMaxLength") + .HasColumnType("integer"); + + b.Property("FieldName") + .HasColumnType("text"); + + b.Property("FieldPattern") + .HasColumnType("text"); + + b.Property("FieldPocoTypeName") + .HasColumnType("text"); + + b.Property("FieldStatus") + .HasColumnType("integer"); + + b.Property("FieldUIElement") + .HasColumnType("bigint"); + + b.Property("FieldUIElementSchema") + .HasColumnType("text"); + + b.Property("FieldUnit") + .HasColumnType("text"); + + b.Property("FieldValue") + .HasColumnType("text"); + + b.Property("FieldValueDataSource") + .HasColumnType("text"); + + b.Property("FieldValueLocalDataSource") + .HasColumnType("text"); + + b.Property("FieldValueType") + .HasColumnType("integer"); + + b.Property("FieldValueTypeName") + .HasColumnType("text"); + + b.Property("FormId") + .HasColumnType("bigint"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("IsRequired") + .HasColumnType("boolean"); + + b.HasKey("FieldId"); + + b.ToTable("DynamicFormFieldInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldValueInfo", b => + { + b.Property("FieldValueId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BizId") + .HasColumnType("bigint"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FieldCode") + .HasColumnType("text"); + + b.Property("FieldCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldId") + .HasColumnType("bigint"); + + b.Property("FieldName") + .HasColumnType("text"); + + b.Property("FieldUnit") + .HasColumnType("text"); + + b.Property("FieldValue") + .HasColumnType("text"); + + b.Property("FieldValueType") + .HasColumnType("bigint"); + + b.Property("FromId") + .HasColumnType("bigint"); + + b.HasKey("FieldValueId"); + + b.ToTable("DynamicFormFieldValueInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormInfo", b => + { + b.Property("FormId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BizId") + .HasColumnType("bigint"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FormCreator") + .HasColumnType("bigint"); + + b.Property("FormDesc") + .HasColumnType("text"); + + b.Property("FormName") + .HasColumnType("text"); + + b.Property("FormSchame") + .HasColumnType("text"); + + b.Property("FormStatus") + .HasColumnType("integer"); + + b.Property("FromCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ModelClass") + .HasColumnType("text"); + + b.Property("Url") + .HasColumnType("text"); + + b.HasKey("FormId"); + + b.ToTable("DynamicFormInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.Flow", b => + { + b.Property("FlowId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Conditionexpression") + .HasColumnType("text"); + + b.Property("FlowType") + .HasColumnType("text"); + + b.Property("Flowdesc") + .HasColumnType("text"); + + b.Property("Flowname") + .HasColumnType("text"); + + b.Property("Incoming") + .HasColumnType("text"); + + b.Property("NodeProcessClass") + .HasColumnType("text"); + + b.Property("NodeProcessMethod") + .HasColumnType("text"); + + b.Property("NodeProcessParams") + .HasColumnType("text"); + + b.Property("NodeProcessScript") + .HasColumnType("text"); + + b.Property("NodeProcessType") + .HasColumnType("text"); + + b.Property("ObjectId") + .HasColumnType("text"); + + b.Property("Outgoing") + .HasColumnType("text"); + + b.Property("RuleId") + .HasColumnType("bigint"); + + b.Property("SourceId") + .HasColumnType("text"); + + b.Property("TargetId") + .HasColumnType("text"); + + b.Property("bpmnid") + .HasColumnType("text"); + + b.HasKey("FlowId"); + + b.ToTable("Flows"); + }); + + modelBuilder.Entity("IoTSharp.Data.FlowOperation", b => + { + b.Property("OperationId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AddDate") + .HasColumnType("timestamp without time zone"); + + b.Property("BizId") + .HasColumnType("text"); + + b.Property("Data") + .HasColumnType("text"); + + b.Property("FlowId") + .HasColumnType("bigint"); + + b.Property("NodeStatus") + .HasColumnType("integer"); + + b.Property("OperationDesc") + .HasColumnType("text"); + + b.Property("RuleId") + .HasColumnType("bigint"); + + b.Property("Step") + .HasColumnType("integer"); + + b.Property("Tag") + .HasColumnType("text"); + + b.Property("bpmnid") + .HasColumnType("text"); + + b.HasKey("OperationId"); + + b.ToTable("FlowOperations"); + }); + + modelBuilder.Entity("IoTSharp.Data.FlowRule", b => + { + b.Property("RuleId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CreatTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Creator") + .HasColumnType("text"); + + b.Property("DefinitionsXml") + .HasColumnType("text"); + + b.Property("Describes") + .HasColumnType("text"); + + b.Property("ExecutableCode") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RuleDesc") + .HasColumnType("text"); + + b.Property("RuleStatus") + .HasColumnType("integer"); + + b.Property("RuleType") + .HasColumnType("integer"); + + b.Property("Runner") + .HasColumnType("text"); + + b.HasKey("RuleId"); + + b.ToTable("FlowRules"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("IdentityUserId") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("IdentityUserId"); + + b.HasIndex("TenantId"); + + b.ToTable("Relationship"); + }); + + modelBuilder.Entity("IoTSharp.Data.TelemetryData", b => + { + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("DataSide") + .HasColumnType("integer"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("Value_Binary") + .HasColumnType("bytea"); + + b.Property("Value_Boolean") + .HasColumnType("boolean"); + + b.Property("Value_DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Value_Double") + .HasColumnType("double precision"); + + b.Property("Value_Json") + .HasColumnType("jsonb"); + + b.Property("Value_Long") + .HasColumnType("bigint"); + + b.Property("Value_String") + .HasColumnType("text"); + + b.Property("Value_XML") + .HasColumnType("xml"); + + b.HasKey("DeviceId", "KeyName", "DateTime"); + + b.HasIndex("DeviceId"); + + b.HasIndex("KeyName"); + + b.HasIndex("DeviceId", "KeyName"); + + b.ToTable("TelemetryData"); + }); + + modelBuilder.Entity("IoTSharp.Data.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("text"); + + b.Property("Country") + .HasColumnType("text"); + + b.Property("EMail") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("text"); + + b.Property("Province") + .HasColumnType("text"); + + b.Property("Street") + .HasColumnType("text"); + + b.Property("ZipCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("text"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("IoTSharp.Data.AttributeLatest", b => + { + b.HasBaseType("IoTSharp.Data.DataStorage"); + + b.HasDiscriminator().HasValue(2); + }); + + modelBuilder.Entity("IoTSharp.Data.TelemetryLatest", b => + { + b.HasBaseType("IoTSharp.Data.DataStorage"); + + b.HasDiscriminator().HasValue(4); + }); + + modelBuilder.Entity("IoTSharp.Data.Gateway", b => + { + b.HasBaseType("IoTSharp.Data.Device"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany("Customers") + .HasForeignKey("TenantId"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.HasOne("IoTSharp.Data.AuthorizedKey", null) + .WithMany("Devices") + .HasForeignKey("AuthorizedKeyId"); + + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany("Devices") + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Gateway", "Owner") + .WithMany("Children") + .HasForeignKey("OwnerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany("Devices") + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Owner"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.HasOne("IoTSharp.Data.Device", "Device") + .WithMany() + .HasForeignKey("DeviceId"); + + b.Navigation("Device"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "IdentityUser") + .WithMany() + .HasForeignKey("IdentityUserId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("IdentityUser"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Tenant", b => + { + b.Navigation("Customers"); + + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Gateway", b => + { + b.Navigation("Children"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IoTSharp.Data.PostgreSQL/Migrations/20210809095243_addflowoperationfield1.cs b/IoTSharp.Data.PostgreSQL/Migrations/20210809095243_addflowoperationfield1.cs new file mode 100644 index 0000000000000000000000000000000000000000..2749904560df4e6a01518f4a72f435aa712dc344 --- /dev/null +++ b/IoTSharp.Data.PostgreSQL/Migrations/20210809095243_addflowoperationfield1.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace IoTSharp.Migrations +{ + public partial class addflowoperationfield1 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "bpmnid", + table: "FlowOperations", + type: "text", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "bpmnid", + table: "FlowOperations"); + } + } +} diff --git a/IoTSharp.Data.PostgreSQL/Migrations/20210811030553_addfolwscriptfield.Designer.cs b/IoTSharp.Data.PostgreSQL/Migrations/20210811030553_addfolwscriptfield.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..d6df3886c0be48a10aa288a3702fc6d30af09534 --- /dev/null +++ b/IoTSharp.Data.PostgreSQL/Migrations/20210811030553_addfolwscriptfield.Designer.cs @@ -0,0 +1,1315 @@ +// +using System; +using IoTSharp.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace IoTSharp.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20210811030553_addfolwscriptfield")] + partial class addfolwscriptfield + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.7") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ActionData") + .HasColumnType("jsonb"); + + b.Property("ActionName") + .HasColumnType("text"); + + b.Property("ActionResult") + .HasColumnType("jsonb"); + + b.Property("ActiveDateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("ObjectID") + .HasColumnType("uuid"); + + b.Property("ObjectName") + .HasColumnType("text"); + + b.Property("ObjectType") + .HasColumnType("integer"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("text"); + + b.Property("UserName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuditLog"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthToken") + .HasColumnType("text"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuthorizedKeys"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseDictionary", b => + { + b.Property("DictionaryId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Dictionary18NKeyName") + .HasColumnType("text"); + + b.Property("DictionaryColor") + .HasColumnType("text"); + + b.Property("DictionaryDesc") + .HasColumnType("text"); + + b.Property("DictionaryGroupId") + .HasColumnType("bigint"); + + b.Property("DictionaryIcon") + .HasColumnType("text"); + + b.Property("DictionaryName") + .HasColumnType("text"); + + b.Property("DictionaryPattern") + .HasColumnType("text"); + + b.Property("DictionaryStatus") + .HasColumnType("integer"); + + b.Property("DictionaryTag") + .HasColumnType("text"); + + b.Property("DictionaryValue") + .HasColumnType("text"); + + b.Property("DictionaryValueType") + .HasColumnType("integer"); + + b.Property("DictionaryValueTypeName") + .HasColumnType("text"); + + b.HasKey("DictionaryId"); + + b.ToTable("BaseDictionaries"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseDictionaryGroup", b => + { + b.Property("DictionaryGroupId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DictionaryGroup18NKeyName") + .HasColumnType("text"); + + b.Property("DictionaryGroupDesc") + .HasColumnType("text"); + + b.Property("DictionaryGroupKey") + .HasColumnType("text"); + + b.Property("DictionaryGroupName") + .HasColumnType("text"); + + b.Property("DictionaryGroupStatus") + .HasColumnType("integer"); + + b.Property("DictionaryGroupValueType") + .HasColumnType("integer"); + + b.Property("DictionaryGroupValueTypeName") + .HasColumnType("text"); + + b.HasKey("DictionaryGroupId"); + + b.ToTable("BaseDictionaryGroups"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseEvent", b => + { + b.Property("EventId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CreaterDateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("EventDesc") + .HasColumnType("text"); + + b.Property("EventName") + .HasColumnType("text"); + + b.Property("EventStaus") + .HasColumnType("integer"); + + b.Property("MataData") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("EventId"); + + b.ToTable("BaseEvents"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseI18N", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AddDate") + .HasColumnType("timestamp without time zone"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("ResouceDesc") + .HasColumnType("text"); + + b.Property("ResouceGroupId") + .HasColumnType("integer"); + + b.Property("ResourceId") + .HasColumnType("bigint"); + + b.Property("ResourceKey") + .HasColumnType("text"); + + b.Property("ResourceTag") + .HasColumnType("text"); + + b.Property("ResourceType") + .HasColumnType("integer"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("ValueBG") + .HasColumnType("text"); + + b.Property("ValueCS") + .HasColumnType("text"); + + b.Property("ValueDA") + .HasColumnType("text"); + + b.Property("ValueDEDE") + .HasColumnType("text"); + + b.Property("ValueELGR") + .HasColumnType("text"); + + b.Property("ValueENGR") + .HasColumnType("text"); + + b.Property("ValueENUS") + .HasColumnType("text"); + + b.Property("ValueESES") + .HasColumnType("text"); + + b.Property("ValueFI") + .HasColumnType("text"); + + b.Property("ValueFRFR") + .HasColumnType("text"); + + b.Property("ValueHE") + .HasColumnType("text"); + + b.Property("ValueHRHR") + .HasColumnType("text"); + + b.Property("ValueHU") + .HasColumnType("text"); + + b.Property("ValueITIT") + .HasColumnType("text"); + + b.Property("ValueJAJP") + .HasColumnType("text"); + + b.Property("ValueKOKR") + .HasColumnType("text"); + + b.Property("ValueNL") + .HasColumnType("text"); + + b.Property("ValuePLPL") + .HasColumnType("text"); + + b.Property("ValuePT") + .HasColumnType("text"); + + b.Property("ValueSLSL") + .HasColumnType("text"); + + b.Property("ValueSR") + .HasColumnType("text"); + + b.Property("ValueSV") + .HasColumnType("text"); + + b.Property("ValueTRTR") + .HasColumnType("text"); + + b.Property("ValueUK") + .HasColumnType("text"); + + b.Property("ValueVI") + .HasColumnType("text"); + + b.Property("ValueZHCN") + .HasColumnType("text"); + + b.Property("ValueZHTW") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("BaseI18Ns"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("text"); + + b.Property("Country") + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("text"); + + b.Property("Province") + .HasColumnType("text"); + + b.Property("Street") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("ZipCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Customer"); + }); + + modelBuilder.Entity("IoTSharp.Data.DataStorage", b => + { + b.Property("Catalog") + .HasColumnType("integer"); + + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("DataSide") + .HasColumnType("integer"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("Value_Binary") + .HasColumnType("bytea"); + + b.Property("Value_Boolean") + .HasColumnType("boolean"); + + b.Property("Value_DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Value_Double") + .HasColumnType("double precision"); + + b.Property("Value_Json") + .HasColumnType("jsonb"); + + b.Property("Value_Long") + .HasColumnType("bigint"); + + b.Property("Value_String") + .HasColumnType("text"); + + b.Property("Value_XML") + .HasColumnType("xml"); + + b.HasKey("Catalog", "DeviceId", "KeyName"); + + b.HasIndex("Catalog"); + + b.HasIndex("Catalog", "DeviceId"); + + b.ToTable("DataStorage"); + + b.HasDiscriminator("Catalog").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthorizedKeyId") + .HasColumnType("uuid"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("DeviceType") + .HasColumnType("integer"); + + b.Property("LastActive") + .HasColumnType("timestamp without time zone"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Online") + .HasColumnType("boolean"); + + b.Property("OwnerId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("Timeout") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizedKeyId"); + + b.HasIndex("CustomerId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("TenantId"); + + b.ToTable("Device"); + + b.HasDiscriminator("DeviceType").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IdentityType") + .HasColumnType("integer"); + + b.Property("IdentityValue") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("DeviceId"); + + b.ToTable("DeviceIdentities"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldInfo", b => + { + b.Property("FieldId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FieldCode") + .HasColumnType("text"); + + b.Property("FieldCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldEditDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldI18nKey") + .HasColumnType("text"); + + b.Property("FieldMaxLength") + .HasColumnType("integer"); + + b.Property("FieldName") + .HasColumnType("text"); + + b.Property("FieldPattern") + .HasColumnType("text"); + + b.Property("FieldPocoTypeName") + .HasColumnType("text"); + + b.Property("FieldStatus") + .HasColumnType("integer"); + + b.Property("FieldUIElement") + .HasColumnType("bigint"); + + b.Property("FieldUIElementSchema") + .HasColumnType("text"); + + b.Property("FieldUnit") + .HasColumnType("text"); + + b.Property("FieldValue") + .HasColumnType("text"); + + b.Property("FieldValueDataSource") + .HasColumnType("text"); + + b.Property("FieldValueLocalDataSource") + .HasColumnType("text"); + + b.Property("FieldValueType") + .HasColumnType("integer"); + + b.Property("FieldValueTypeName") + .HasColumnType("text"); + + b.Property("FormId") + .HasColumnType("bigint"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("IsRequired") + .HasColumnType("boolean"); + + b.HasKey("FieldId"); + + b.ToTable("DynamicFormFieldInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldValueInfo", b => + { + b.Property("FieldValueId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BizId") + .HasColumnType("bigint"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FieldCode") + .HasColumnType("text"); + + b.Property("FieldCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldId") + .HasColumnType("bigint"); + + b.Property("FieldName") + .HasColumnType("text"); + + b.Property("FieldUnit") + .HasColumnType("text"); + + b.Property("FieldValue") + .HasColumnType("text"); + + b.Property("FieldValueType") + .HasColumnType("bigint"); + + b.Property("FromId") + .HasColumnType("bigint"); + + b.HasKey("FieldValueId"); + + b.ToTable("DynamicFormFieldValueInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormInfo", b => + { + b.Property("FormId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BizId") + .HasColumnType("bigint"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FormCreator") + .HasColumnType("bigint"); + + b.Property("FormDesc") + .HasColumnType("text"); + + b.Property("FormName") + .HasColumnType("text"); + + b.Property("FormSchame") + .HasColumnType("text"); + + b.Property("FormStatus") + .HasColumnType("integer"); + + b.Property("FromCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ModelClass") + .HasColumnType("text"); + + b.Property("Url") + .HasColumnType("text"); + + b.HasKey("FormId"); + + b.ToTable("DynamicFormInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.Flow", b => + { + b.Property("FlowId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Conditionexpression") + .HasColumnType("text"); + + b.Property("FlowType") + .HasColumnType("text"); + + b.Property("Flowdesc") + .HasColumnType("text"); + + b.Property("Flowname") + .HasColumnType("text"); + + b.Property("Incoming") + .HasColumnType("text"); + + b.Property("NodeProcessClass") + .HasColumnType("text"); + + b.Property("NodeProcessMethod") + .HasColumnType("text"); + + b.Property("NodeProcessParams") + .HasColumnType("text"); + + b.Property("NodeProcessScript") + .HasColumnType("text"); + + b.Property("NodeProcessScriptType") + .HasColumnType("text"); + + b.Property("NodeProcessType") + .HasColumnType("text"); + + b.Property("ObjectId") + .HasColumnType("text"); + + b.Property("Outgoing") + .HasColumnType("text"); + + b.Property("RuleId") + .HasColumnType("bigint"); + + b.Property("SourceId") + .HasColumnType("text"); + + b.Property("TargetId") + .HasColumnType("text"); + + b.Property("bpmnid") + .HasColumnType("text"); + + b.HasKey("FlowId"); + + b.ToTable("Flows"); + }); + + modelBuilder.Entity("IoTSharp.Data.FlowOperation", b => + { + b.Property("OperationId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AddDate") + .HasColumnType("timestamp without time zone"); + + b.Property("BizId") + .HasColumnType("text"); + + b.Property("Data") + .HasColumnType("text"); + + b.Property("FlowId") + .HasColumnType("bigint"); + + b.Property("NodeStatus") + .HasColumnType("integer"); + + b.Property("OperationDesc") + .HasColumnType("text"); + + b.Property("RuleId") + .HasColumnType("bigint"); + + b.Property("Step") + .HasColumnType("integer"); + + b.Property("Tag") + .HasColumnType("text"); + + b.Property("bpmnid") + .HasColumnType("text"); + + b.HasKey("OperationId"); + + b.ToTable("FlowOperations"); + }); + + modelBuilder.Entity("IoTSharp.Data.FlowRule", b => + { + b.Property("RuleId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CreatTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Creator") + .HasColumnType("text"); + + b.Property("DefinitionsXml") + .HasColumnType("text"); + + b.Property("Describes") + .HasColumnType("text"); + + b.Property("ExecutableCode") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RuleDesc") + .HasColumnType("text"); + + b.Property("RuleStatus") + .HasColumnType("integer"); + + b.Property("RuleType") + .HasColumnType("integer"); + + b.Property("Runner") + .HasColumnType("text"); + + b.HasKey("RuleId"); + + b.ToTable("FlowRules"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("IdentityUserId") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("IdentityUserId"); + + b.HasIndex("TenantId"); + + b.ToTable("Relationship"); + }); + + modelBuilder.Entity("IoTSharp.Data.TelemetryData", b => + { + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("DataSide") + .HasColumnType("integer"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("Value_Binary") + .HasColumnType("bytea"); + + b.Property("Value_Boolean") + .HasColumnType("boolean"); + + b.Property("Value_DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Value_Double") + .HasColumnType("double precision"); + + b.Property("Value_Json") + .HasColumnType("jsonb"); + + b.Property("Value_Long") + .HasColumnType("bigint"); + + b.Property("Value_String") + .HasColumnType("text"); + + b.Property("Value_XML") + .HasColumnType("xml"); + + b.HasKey("DeviceId", "KeyName", "DateTime"); + + b.HasIndex("DeviceId"); + + b.HasIndex("KeyName"); + + b.HasIndex("DeviceId", "KeyName"); + + b.ToTable("TelemetryData"); + }); + + modelBuilder.Entity("IoTSharp.Data.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("text"); + + b.Property("Country") + .HasColumnType("text"); + + b.Property("EMail") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("text"); + + b.Property("Province") + .HasColumnType("text"); + + b.Property("Street") + .HasColumnType("text"); + + b.Property("ZipCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("text"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("IoTSharp.Data.AttributeLatest", b => + { + b.HasBaseType("IoTSharp.Data.DataStorage"); + + b.HasDiscriminator().HasValue(2); + }); + + modelBuilder.Entity("IoTSharp.Data.TelemetryLatest", b => + { + b.HasBaseType("IoTSharp.Data.DataStorage"); + + b.HasDiscriminator().HasValue(4); + }); + + modelBuilder.Entity("IoTSharp.Data.Gateway", b => + { + b.HasBaseType("IoTSharp.Data.Device"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany("Customers") + .HasForeignKey("TenantId"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.HasOne("IoTSharp.Data.AuthorizedKey", null) + .WithMany("Devices") + .HasForeignKey("AuthorizedKeyId"); + + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany("Devices") + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Gateway", "Owner") + .WithMany("Children") + .HasForeignKey("OwnerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany("Devices") + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Owner"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.HasOne("IoTSharp.Data.Device", "Device") + .WithMany() + .HasForeignKey("DeviceId"); + + b.Navigation("Device"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "IdentityUser") + .WithMany() + .HasForeignKey("IdentityUserId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("IdentityUser"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Tenant", b => + { + b.Navigation("Customers"); + + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Gateway", b => + { + b.Navigation("Children"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IoTSharp.Data.PostgreSQL/Migrations/20210811030553_addfolwscriptfield.cs b/IoTSharp.Data.PostgreSQL/Migrations/20210811030553_addfolwscriptfield.cs new file mode 100644 index 0000000000000000000000000000000000000000..0eb56c2b15be65061443d30cded52d8ce30e5537 --- /dev/null +++ b/IoTSharp.Data.PostgreSQL/Migrations/20210811030553_addfolwscriptfield.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace IoTSharp.Migrations +{ + public partial class addfolwscriptfield : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "NodeProcessScriptType", + table: "Flows", + type: "text", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "NodeProcessScriptType", + table: "Flows"); + } + } +} diff --git a/IoTSharp.Data.PostgreSQL/Migrations/20210813043858_addformfield.Designer.cs b/IoTSharp.Data.PostgreSQL/Migrations/20210813043858_addformfield.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..44275ba2aaf250196b5a1b341395f89a9eadf18e --- /dev/null +++ b/IoTSharp.Data.PostgreSQL/Migrations/20210813043858_addformfield.Designer.cs @@ -0,0 +1,1324 @@ +// +using System; +using IoTSharp.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace IoTSharp.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20210813043858_addformfield")] + partial class addformfield + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.7") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ActionData") + .HasColumnType("jsonb"); + + b.Property("ActionName") + .HasColumnType("text"); + + b.Property("ActionResult") + .HasColumnType("jsonb"); + + b.Property("ActiveDateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("ObjectID") + .HasColumnType("uuid"); + + b.Property("ObjectName") + .HasColumnType("text"); + + b.Property("ObjectType") + .HasColumnType("integer"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("text"); + + b.Property("UserName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuditLog"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthToken") + .HasColumnType("text"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuthorizedKeys"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseDictionary", b => + { + b.Property("DictionaryId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Dictionary18NKeyName") + .HasColumnType("text"); + + b.Property("DictionaryColor") + .HasColumnType("text"); + + b.Property("DictionaryDesc") + .HasColumnType("text"); + + b.Property("DictionaryGroupId") + .HasColumnType("bigint"); + + b.Property("DictionaryIcon") + .HasColumnType("text"); + + b.Property("DictionaryName") + .HasColumnType("text"); + + b.Property("DictionaryPattern") + .HasColumnType("text"); + + b.Property("DictionaryStatus") + .HasColumnType("integer"); + + b.Property("DictionaryTag") + .HasColumnType("text"); + + b.Property("DictionaryValue") + .HasColumnType("text"); + + b.Property("DictionaryValueType") + .HasColumnType("integer"); + + b.Property("DictionaryValueTypeName") + .HasColumnType("text"); + + b.HasKey("DictionaryId"); + + b.ToTable("BaseDictionaries"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseDictionaryGroup", b => + { + b.Property("DictionaryGroupId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DictionaryGroup18NKeyName") + .HasColumnType("text"); + + b.Property("DictionaryGroupDesc") + .HasColumnType("text"); + + b.Property("DictionaryGroupKey") + .HasColumnType("text"); + + b.Property("DictionaryGroupName") + .HasColumnType("text"); + + b.Property("DictionaryGroupStatus") + .HasColumnType("integer"); + + b.Property("DictionaryGroupValueType") + .HasColumnType("integer"); + + b.Property("DictionaryGroupValueTypeName") + .HasColumnType("text"); + + b.HasKey("DictionaryGroupId"); + + b.ToTable("BaseDictionaryGroups"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseEvent", b => + { + b.Property("EventId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CreaterDateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("EventDesc") + .HasColumnType("text"); + + b.Property("EventName") + .HasColumnType("text"); + + b.Property("EventStaus") + .HasColumnType("integer"); + + b.Property("MataData") + .HasColumnType("text"); + + b.Property("RuleId") + .HasColumnType("bigint"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("EventId"); + + b.ToTable("BaseEvents"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseI18N", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AddDate") + .HasColumnType("timestamp without time zone"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("ResouceDesc") + .HasColumnType("text"); + + b.Property("ResouceGroupId") + .HasColumnType("integer"); + + b.Property("ResourceId") + .HasColumnType("bigint"); + + b.Property("ResourceKey") + .HasColumnType("text"); + + b.Property("ResourceTag") + .HasColumnType("text"); + + b.Property("ResourceType") + .HasColumnType("integer"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("ValueBG") + .HasColumnType("text"); + + b.Property("ValueCS") + .HasColumnType("text"); + + b.Property("ValueDA") + .HasColumnType("text"); + + b.Property("ValueDEDE") + .HasColumnType("text"); + + b.Property("ValueELGR") + .HasColumnType("text"); + + b.Property("ValueENGR") + .HasColumnType("text"); + + b.Property("ValueENUS") + .HasColumnType("text"); + + b.Property("ValueESES") + .HasColumnType("text"); + + b.Property("ValueFI") + .HasColumnType("text"); + + b.Property("ValueFRFR") + .HasColumnType("text"); + + b.Property("ValueHE") + .HasColumnType("text"); + + b.Property("ValueHRHR") + .HasColumnType("text"); + + b.Property("ValueHU") + .HasColumnType("text"); + + b.Property("ValueITIT") + .HasColumnType("text"); + + b.Property("ValueJAJP") + .HasColumnType("text"); + + b.Property("ValueKOKR") + .HasColumnType("text"); + + b.Property("ValueNL") + .HasColumnType("text"); + + b.Property("ValuePLPL") + .HasColumnType("text"); + + b.Property("ValuePT") + .HasColumnType("text"); + + b.Property("ValueSLSL") + .HasColumnType("text"); + + b.Property("ValueSR") + .HasColumnType("text"); + + b.Property("ValueSV") + .HasColumnType("text"); + + b.Property("ValueTRTR") + .HasColumnType("text"); + + b.Property("ValueUK") + .HasColumnType("text"); + + b.Property("ValueVI") + .HasColumnType("text"); + + b.Property("ValueZHCN") + .HasColumnType("text"); + + b.Property("ValueZHTW") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("BaseI18Ns"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("text"); + + b.Property("Country") + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("text"); + + b.Property("Province") + .HasColumnType("text"); + + b.Property("Street") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("ZipCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Customer"); + }); + + modelBuilder.Entity("IoTSharp.Data.DataStorage", b => + { + b.Property("Catalog") + .HasColumnType("integer"); + + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("DataSide") + .HasColumnType("integer"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("Value_Binary") + .HasColumnType("bytea"); + + b.Property("Value_Boolean") + .HasColumnType("boolean"); + + b.Property("Value_DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Value_Double") + .HasColumnType("double precision"); + + b.Property("Value_Json") + .HasColumnType("jsonb"); + + b.Property("Value_Long") + .HasColumnType("bigint"); + + b.Property("Value_String") + .HasColumnType("text"); + + b.Property("Value_XML") + .HasColumnType("xml"); + + b.HasKey("Catalog", "DeviceId", "KeyName"); + + b.HasIndex("Catalog"); + + b.HasIndex("Catalog", "DeviceId"); + + b.ToTable("DataStorage"); + + b.HasDiscriminator("Catalog").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthorizedKeyId") + .HasColumnType("uuid"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("DeviceType") + .HasColumnType("integer"); + + b.Property("LastActive") + .HasColumnType("timestamp without time zone"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Online") + .HasColumnType("boolean"); + + b.Property("OwnerId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("Timeout") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizedKeyId"); + + b.HasIndex("CustomerId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("TenantId"); + + b.ToTable("Device"); + + b.HasDiscriminator("DeviceType").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IdentityType") + .HasColumnType("integer"); + + b.Property("IdentityValue") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("DeviceId"); + + b.ToTable("DeviceIdentities"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldInfo", b => + { + b.Property("FieldId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FieldCode") + .HasColumnType("text"); + + b.Property("FieldCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldEditDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldI18nKey") + .HasColumnType("text"); + + b.Property("FieldMaxLength") + .HasColumnType("integer"); + + b.Property("FieldName") + .HasColumnType("text"); + + b.Property("FieldPattern") + .HasColumnType("text"); + + b.Property("FieldPocoTypeName") + .HasColumnType("text"); + + b.Property("FieldStatus") + .HasColumnType("integer"); + + b.Property("FieldUIElement") + .HasColumnType("bigint"); + + b.Property("FieldUIElementSchema") + .HasColumnType("text"); + + b.Property("FieldUnit") + .HasColumnType("text"); + + b.Property("FieldValue") + .HasColumnType("text"); + + b.Property("FieldValueDataSource") + .HasColumnType("text"); + + b.Property("FieldValueLocalDataSource") + .HasColumnType("text"); + + b.Property("FieldValueType") + .HasColumnType("integer"); + + b.Property("FieldValueTypeName") + .HasColumnType("text"); + + b.Property("FormId") + .HasColumnType("bigint"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("IsRequired") + .HasColumnType("boolean"); + + b.HasKey("FieldId"); + + b.ToTable("DynamicFormFieldInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldValueInfo", b => + { + b.Property("FieldValueId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BizId") + .HasColumnType("bigint"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FieldCode") + .HasColumnType("text"); + + b.Property("FieldCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldId") + .HasColumnType("bigint"); + + b.Property("FieldName") + .HasColumnType("text"); + + b.Property("FieldUnit") + .HasColumnType("text"); + + b.Property("FieldValue") + .HasColumnType("text"); + + b.Property("FieldValueType") + .HasColumnType("bigint"); + + b.Property("FromId") + .HasColumnType("bigint"); + + b.HasKey("FieldValueId"); + + b.ToTable("DynamicFormFieldValueInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormInfo", b => + { + b.Property("FormId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BizId") + .HasColumnType("bigint"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FormCreator") + .HasColumnType("bigint"); + + b.Property("FormDesc") + .HasColumnType("text"); + + b.Property("FormLayout") + .HasColumnType("text"); + + b.Property("FormName") + .HasColumnType("text"); + + b.Property("FormSchame") + .HasColumnType("text"); + + b.Property("FormStatus") + .HasColumnType("integer"); + + b.Property("FromCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsCompact") + .HasColumnType("boolean"); + + b.Property("ModelClass") + .HasColumnType("text"); + + b.Property("Url") + .HasColumnType("text"); + + b.HasKey("FormId"); + + b.ToTable("DynamicFormInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.Flow", b => + { + b.Property("FlowId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Conditionexpression") + .HasColumnType("text"); + + b.Property("FlowType") + .HasColumnType("text"); + + b.Property("Flowdesc") + .HasColumnType("text"); + + b.Property("Flowname") + .HasColumnType("text"); + + b.Property("Incoming") + .HasColumnType("text"); + + b.Property("NodeProcessClass") + .HasColumnType("text"); + + b.Property("NodeProcessMethod") + .HasColumnType("text"); + + b.Property("NodeProcessParams") + .HasColumnType("text"); + + b.Property("NodeProcessScript") + .HasColumnType("text"); + + b.Property("NodeProcessScriptType") + .HasColumnType("text"); + + b.Property("NodeProcessType") + .HasColumnType("text"); + + b.Property("ObjectId") + .HasColumnType("text"); + + b.Property("Outgoing") + .HasColumnType("text"); + + b.Property("RuleId") + .HasColumnType("bigint"); + + b.Property("SourceId") + .HasColumnType("text"); + + b.Property("TargetId") + .HasColumnType("text"); + + b.Property("bpmnid") + .HasColumnType("text"); + + b.HasKey("FlowId"); + + b.ToTable("Flows"); + }); + + modelBuilder.Entity("IoTSharp.Data.FlowOperation", b => + { + b.Property("OperationId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AddDate") + .HasColumnType("timestamp without time zone"); + + b.Property("BizId") + .HasColumnType("text"); + + b.Property("Data") + .HasColumnType("text"); + + b.Property("FlowId") + .HasColumnType("bigint"); + + b.Property("NodeStatus") + .HasColumnType("integer"); + + b.Property("OperationDesc") + .HasColumnType("text"); + + b.Property("RuleId") + .HasColumnType("bigint"); + + b.Property("Step") + .HasColumnType("integer"); + + b.Property("Tag") + .HasColumnType("text"); + + b.Property("bpmnid") + .HasColumnType("text"); + + b.HasKey("OperationId"); + + b.ToTable("FlowOperations"); + }); + + modelBuilder.Entity("IoTSharp.Data.FlowRule", b => + { + b.Property("RuleId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CreatTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Creator") + .HasColumnType("text"); + + b.Property("DefinitionsXml") + .HasColumnType("text"); + + b.Property("Describes") + .HasColumnType("text"); + + b.Property("ExecutableCode") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RuleDesc") + .HasColumnType("text"); + + b.Property("RuleStatus") + .HasColumnType("integer"); + + b.Property("RuleType") + .HasColumnType("integer"); + + b.Property("Runner") + .HasColumnType("text"); + + b.HasKey("RuleId"); + + b.ToTable("FlowRules"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("IdentityUserId") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("IdentityUserId"); + + b.HasIndex("TenantId"); + + b.ToTable("Relationship"); + }); + + modelBuilder.Entity("IoTSharp.Data.TelemetryData", b => + { + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("DataSide") + .HasColumnType("integer"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("Value_Binary") + .HasColumnType("bytea"); + + b.Property("Value_Boolean") + .HasColumnType("boolean"); + + b.Property("Value_DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Value_Double") + .HasColumnType("double precision"); + + b.Property("Value_Json") + .HasColumnType("jsonb"); + + b.Property("Value_Long") + .HasColumnType("bigint"); + + b.Property("Value_String") + .HasColumnType("text"); + + b.Property("Value_XML") + .HasColumnType("xml"); + + b.HasKey("DeviceId", "KeyName", "DateTime"); + + b.HasIndex("DeviceId"); + + b.HasIndex("KeyName"); + + b.HasIndex("DeviceId", "KeyName"); + + b.ToTable("TelemetryData"); + }); + + modelBuilder.Entity("IoTSharp.Data.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("text"); + + b.Property("Country") + .HasColumnType("text"); + + b.Property("EMail") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("text"); + + b.Property("Province") + .HasColumnType("text"); + + b.Property("Street") + .HasColumnType("text"); + + b.Property("ZipCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("text"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("IoTSharp.Data.AttributeLatest", b => + { + b.HasBaseType("IoTSharp.Data.DataStorage"); + + b.HasDiscriminator().HasValue(2); + }); + + modelBuilder.Entity("IoTSharp.Data.TelemetryLatest", b => + { + b.HasBaseType("IoTSharp.Data.DataStorage"); + + b.HasDiscriminator().HasValue(4); + }); + + modelBuilder.Entity("IoTSharp.Data.Gateway", b => + { + b.HasBaseType("IoTSharp.Data.Device"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany("Customers") + .HasForeignKey("TenantId"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.HasOne("IoTSharp.Data.AuthorizedKey", null) + .WithMany("Devices") + .HasForeignKey("AuthorizedKeyId"); + + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany("Devices") + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Gateway", "Owner") + .WithMany("Children") + .HasForeignKey("OwnerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany("Devices") + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Owner"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.HasOne("IoTSharp.Data.Device", "Device") + .WithMany() + .HasForeignKey("DeviceId"); + + b.Navigation("Device"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "IdentityUser") + .WithMany() + .HasForeignKey("IdentityUserId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("IdentityUser"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Tenant", b => + { + b.Navigation("Customers"); + + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Gateway", b => + { + b.Navigation("Children"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IoTSharp.Data.PostgreSQL/Migrations/20210813043858_addformfield.cs b/IoTSharp.Data.PostgreSQL/Migrations/20210813043858_addformfield.cs new file mode 100644 index 0000000000000000000000000000000000000000..fe4ae15319144ba2e9971770e654f55522bfd673 --- /dev/null +++ b/IoTSharp.Data.PostgreSQL/Migrations/20210813043858_addformfield.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace IoTSharp.Migrations +{ + public partial class addformfield : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "FormLayout", + table: "DynamicFormInfos", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsCompact", + table: "DynamicFormInfos", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "RuleId", + table: "BaseEvents", + type: "bigint", + nullable: false, + defaultValue: 0L); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "FormLayout", + table: "DynamicFormInfos"); + + migrationBuilder.DropColumn( + name: "IsCompact", + table: "DynamicFormInfos"); + + migrationBuilder.DropColumn( + name: "RuleId", + table: "BaseEvents"); + } + } +} diff --git a/IoTSharp.Data.PostgreSQL/Migrations/20210816075805_addeventfield.Designer.cs b/IoTSharp.Data.PostgreSQL/Migrations/20210816075805_addeventfield.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..d0ed31f6244beb618a04b0fa253128e301eedf8f --- /dev/null +++ b/IoTSharp.Data.PostgreSQL/Migrations/20210816075805_addeventfield.Designer.cs @@ -0,0 +1,1330 @@ +// +using System; +using IoTSharp.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace IoTSharp.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20210816075805_addeventfield")] + partial class addeventfield + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.7") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ActionData") + .HasColumnType("jsonb"); + + b.Property("ActionName") + .HasColumnType("text"); + + b.Property("ActionResult") + .HasColumnType("jsonb"); + + b.Property("ActiveDateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("ObjectID") + .HasColumnType("uuid"); + + b.Property("ObjectName") + .HasColumnType("text"); + + b.Property("ObjectType") + .HasColumnType("integer"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("text"); + + b.Property("UserName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuditLog"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthToken") + .HasColumnType("text"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuthorizedKeys"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseDictionary", b => + { + b.Property("DictionaryId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Dictionary18NKeyName") + .HasColumnType("text"); + + b.Property("DictionaryColor") + .HasColumnType("text"); + + b.Property("DictionaryDesc") + .HasColumnType("text"); + + b.Property("DictionaryGroupId") + .HasColumnType("bigint"); + + b.Property("DictionaryIcon") + .HasColumnType("text"); + + b.Property("DictionaryName") + .HasColumnType("text"); + + b.Property("DictionaryPattern") + .HasColumnType("text"); + + b.Property("DictionaryStatus") + .HasColumnType("integer"); + + b.Property("DictionaryTag") + .HasColumnType("text"); + + b.Property("DictionaryValue") + .HasColumnType("text"); + + b.Property("DictionaryValueType") + .HasColumnType("integer"); + + b.Property("DictionaryValueTypeName") + .HasColumnType("text"); + + b.HasKey("DictionaryId"); + + b.ToTable("BaseDictionaries"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseDictionaryGroup", b => + { + b.Property("DictionaryGroupId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DictionaryGroup18NKeyName") + .HasColumnType("text"); + + b.Property("DictionaryGroupDesc") + .HasColumnType("text"); + + b.Property("DictionaryGroupKey") + .HasColumnType("text"); + + b.Property("DictionaryGroupName") + .HasColumnType("text"); + + b.Property("DictionaryGroupStatus") + .HasColumnType("integer"); + + b.Property("DictionaryGroupValueType") + .HasColumnType("integer"); + + b.Property("DictionaryGroupValueTypeName") + .HasColumnType("text"); + + b.HasKey("DictionaryGroupId"); + + b.ToTable("BaseDictionaryGroups"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseEvent", b => + { + b.Property("EventId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Bizid") + .HasColumnType("text"); + + b.Property("CreaterDateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("EventDesc") + .HasColumnType("text"); + + b.Property("EventName") + .HasColumnType("text"); + + b.Property("EventStaus") + .HasColumnType("integer"); + + b.Property("MataData") + .HasColumnType("text"); + + b.Property("RuleId") + .HasColumnType("bigint"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("EventId"); + + b.ToTable("BaseEvents"); + }); + + modelBuilder.Entity("IoTSharp.Data.BaseI18N", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AddDate") + .HasColumnType("timestamp without time zone"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("ResouceDesc") + .HasColumnType("text"); + + b.Property("ResouceGroupId") + .HasColumnType("integer"); + + b.Property("ResourceId") + .HasColumnType("bigint"); + + b.Property("ResourceKey") + .HasColumnType("text"); + + b.Property("ResourceTag") + .HasColumnType("text"); + + b.Property("ResourceType") + .HasColumnType("integer"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("ValueBG") + .HasColumnType("text"); + + b.Property("ValueCS") + .HasColumnType("text"); + + b.Property("ValueDA") + .HasColumnType("text"); + + b.Property("ValueDEDE") + .HasColumnType("text"); + + b.Property("ValueELGR") + .HasColumnType("text"); + + b.Property("ValueENGR") + .HasColumnType("text"); + + b.Property("ValueENUS") + .HasColumnType("text"); + + b.Property("ValueESES") + .HasColumnType("text"); + + b.Property("ValueFI") + .HasColumnType("text"); + + b.Property("ValueFRFR") + .HasColumnType("text"); + + b.Property("ValueHE") + .HasColumnType("text"); + + b.Property("ValueHRHR") + .HasColumnType("text"); + + b.Property("ValueHU") + .HasColumnType("text"); + + b.Property("ValueITIT") + .HasColumnType("text"); + + b.Property("ValueJAJP") + .HasColumnType("text"); + + b.Property("ValueKOKR") + .HasColumnType("text"); + + b.Property("ValueNL") + .HasColumnType("text"); + + b.Property("ValuePLPL") + .HasColumnType("text"); + + b.Property("ValuePT") + .HasColumnType("text"); + + b.Property("ValueSLSL") + .HasColumnType("text"); + + b.Property("ValueSR") + .HasColumnType("text"); + + b.Property("ValueSV") + .HasColumnType("text"); + + b.Property("ValueTRTR") + .HasColumnType("text"); + + b.Property("ValueUK") + .HasColumnType("text"); + + b.Property("ValueVI") + .HasColumnType("text"); + + b.Property("ValueZHCN") + .HasColumnType("text"); + + b.Property("ValueZHTW") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("BaseI18Ns"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("text"); + + b.Property("Country") + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("text"); + + b.Property("Province") + .HasColumnType("text"); + + b.Property("Street") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("ZipCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Customer"); + }); + + modelBuilder.Entity("IoTSharp.Data.DataStorage", b => + { + b.Property("Catalog") + .HasColumnType("integer"); + + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("DataSide") + .HasColumnType("integer"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("Value_Binary") + .HasColumnType("bytea"); + + b.Property("Value_Boolean") + .HasColumnType("boolean"); + + b.Property("Value_DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Value_Double") + .HasColumnType("double precision"); + + b.Property("Value_Json") + .HasColumnType("jsonb"); + + b.Property("Value_Long") + .HasColumnType("bigint"); + + b.Property("Value_String") + .HasColumnType("text"); + + b.Property("Value_XML") + .HasColumnType("xml"); + + b.HasKey("Catalog", "DeviceId", "KeyName"); + + b.HasIndex("Catalog"); + + b.HasIndex("Catalog", "DeviceId"); + + b.ToTable("DataStorage"); + + b.HasDiscriminator("Catalog").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthorizedKeyId") + .HasColumnType("uuid"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("DeviceType") + .HasColumnType("integer"); + + b.Property("LastActive") + .HasColumnType("timestamp without time zone"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Online") + .HasColumnType("boolean"); + + b.Property("OwnerId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("Timeout") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizedKeyId"); + + b.HasIndex("CustomerId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("TenantId"); + + b.ToTable("Device"); + + b.HasDiscriminator("DeviceType").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IdentityType") + .HasColumnType("integer"); + + b.Property("IdentityValue") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("DeviceId"); + + b.ToTable("DeviceIdentities"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldInfo", b => + { + b.Property("FieldId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FieldCode") + .HasColumnType("text"); + + b.Property("FieldCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldEditDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldI18nKey") + .HasColumnType("text"); + + b.Property("FieldMaxLength") + .HasColumnType("integer"); + + b.Property("FieldName") + .HasColumnType("text"); + + b.Property("FieldPattern") + .HasColumnType("text"); + + b.Property("FieldPocoTypeName") + .HasColumnType("text"); + + b.Property("FieldStatus") + .HasColumnType("integer"); + + b.Property("FieldUIElement") + .HasColumnType("bigint"); + + b.Property("FieldUIElementSchema") + .HasColumnType("text"); + + b.Property("FieldUnit") + .HasColumnType("text"); + + b.Property("FieldValue") + .HasColumnType("text"); + + b.Property("FieldValueDataSource") + .HasColumnType("text"); + + b.Property("FieldValueLocalDataSource") + .HasColumnType("text"); + + b.Property("FieldValueType") + .HasColumnType("integer"); + + b.Property("FieldValueTypeName") + .HasColumnType("text"); + + b.Property("FormId") + .HasColumnType("bigint"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("IsRequired") + .HasColumnType("boolean"); + + b.HasKey("FieldId"); + + b.ToTable("DynamicFormFieldInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldValueInfo", b => + { + b.Property("FieldValueId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BizId") + .HasColumnType("bigint"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FieldCode") + .HasColumnType("text"); + + b.Property("FieldCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FieldId") + .HasColumnType("bigint"); + + b.Property("FieldName") + .HasColumnType("text"); + + b.Property("FieldUnit") + .HasColumnType("text"); + + b.Property("FieldValue") + .HasColumnType("text"); + + b.Property("FieldValueType") + .HasColumnType("bigint"); + + b.Property("FromId") + .HasColumnType("bigint"); + + b.HasKey("FieldValueId"); + + b.ToTable("DynamicFormFieldValueInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.DynamicFormInfo", b => + { + b.Property("FormId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BizId") + .HasColumnType("bigint"); + + b.Property("Creator") + .HasColumnType("uuid"); + + b.Property("FormCreator") + .HasColumnType("bigint"); + + b.Property("FormDesc") + .HasColumnType("text"); + + b.Property("FormLayout") + .HasColumnType("text"); + + b.Property("FormName") + .HasColumnType("text"); + + b.Property("FormSchame") + .HasColumnType("text"); + + b.Property("FormStatus") + .HasColumnType("integer"); + + b.Property("FromCreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsCompact") + .HasColumnType("boolean"); + + b.Property("ModelClass") + .HasColumnType("text"); + + b.Property("Url") + .HasColumnType("text"); + + b.HasKey("FormId"); + + b.ToTable("DynamicFormInfos"); + }); + + modelBuilder.Entity("IoTSharp.Data.Flow", b => + { + b.Property("FlowId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Conditionexpression") + .HasColumnType("text"); + + b.Property("FlowType") + .HasColumnType("text"); + + b.Property("Flowdesc") + .HasColumnType("text"); + + b.Property("Flowname") + .HasColumnType("text"); + + b.Property("Incoming") + .HasColumnType("text"); + + b.Property("NodeProcessClass") + .HasColumnType("text"); + + b.Property("NodeProcessMethod") + .HasColumnType("text"); + + b.Property("NodeProcessParams") + .HasColumnType("text"); + + b.Property("NodeProcessScript") + .HasColumnType("text"); + + b.Property("NodeProcessScriptType") + .HasColumnType("text"); + + b.Property("NodeProcessType") + .HasColumnType("text"); + + b.Property("ObjectId") + .HasColumnType("text"); + + b.Property("Outgoing") + .HasColumnType("text"); + + b.Property("RuleId") + .HasColumnType("bigint"); + + b.Property("SourceId") + .HasColumnType("text"); + + b.Property("TargetId") + .HasColumnType("text"); + + b.Property("bpmnid") + .HasColumnType("text"); + + b.HasKey("FlowId"); + + b.ToTable("Flows"); + }); + + modelBuilder.Entity("IoTSharp.Data.FlowOperation", b => + { + b.Property("OperationId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AddDate") + .HasColumnType("timestamp without time zone"); + + b.Property("BizId") + .HasColumnType("text"); + + b.Property("Data") + .HasColumnType("text"); + + b.Property("EventId") + .HasColumnType("bigint"); + + b.Property("FlowId") + .HasColumnType("bigint"); + + b.Property("NodeStatus") + .HasColumnType("integer"); + + b.Property("OperationDesc") + .HasColumnType("text"); + + b.Property("RuleId") + .HasColumnType("bigint"); + + b.Property("Step") + .HasColumnType("integer"); + + b.Property("Tag") + .HasColumnType("text"); + + b.Property("bpmnid") + .HasColumnType("text"); + + b.HasKey("OperationId"); + + b.ToTable("FlowOperations"); + }); + + modelBuilder.Entity("IoTSharp.Data.FlowRule", b => + { + b.Property("RuleId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CreatTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Creator") + .HasColumnType("text"); + + b.Property("DefinitionsXml") + .HasColumnType("text"); + + b.Property("Describes") + .HasColumnType("text"); + + b.Property("ExecutableCode") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RuleDesc") + .HasColumnType("text"); + + b.Property("RuleStatus") + .HasColumnType("integer"); + + b.Property("RuleType") + .HasColumnType("integer"); + + b.Property("Runner") + .HasColumnType("text"); + + b.HasKey("RuleId"); + + b.ToTable("FlowRules"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("IdentityUserId") + .HasColumnType("text"); + + b.Property("TenantId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("IdentityUserId"); + + b.HasIndex("TenantId"); + + b.ToTable("Relationship"); + }); + + modelBuilder.Entity("IoTSharp.Data.TelemetryData", b => + { + b.Property("DeviceId") + .HasColumnType("uuid"); + + b.Property("KeyName") + .HasColumnType("text"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("DataSide") + .HasColumnType("integer"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("Value_Binary") + .HasColumnType("bytea"); + + b.Property("Value_Boolean") + .HasColumnType("boolean"); + + b.Property("Value_DateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Value_Double") + .HasColumnType("double precision"); + + b.Property("Value_Json") + .HasColumnType("jsonb"); + + b.Property("Value_Long") + .HasColumnType("bigint"); + + b.Property("Value_String") + .HasColumnType("text"); + + b.Property("Value_XML") + .HasColumnType("xml"); + + b.HasKey("DeviceId", "KeyName", "DateTime"); + + b.HasIndex("DeviceId"); + + b.HasIndex("KeyName"); + + b.HasIndex("DeviceId", "KeyName"); + + b.ToTable("TelemetryData"); + }); + + modelBuilder.Entity("IoTSharp.Data.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("text"); + + b.Property("Country") + .HasColumnType("text"); + + b.Property("EMail") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("text"); + + b.Property("Province") + .HasColumnType("text"); + + b.Property("Street") + .HasColumnType("text"); + + b.Property("ZipCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("text"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("IoTSharp.Data.AttributeLatest", b => + { + b.HasBaseType("IoTSharp.Data.DataStorage"); + + b.HasDiscriminator().HasValue(2); + }); + + modelBuilder.Entity("IoTSharp.Data.TelemetryLatest", b => + { + b.HasBaseType("IoTSharp.Data.DataStorage"); + + b.HasDiscriminator().HasValue(4); + }); + + modelBuilder.Entity("IoTSharp.Data.Gateway", b => + { + b.HasBaseType("IoTSharp.Data.Device"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany("Customers") + .HasForeignKey("TenantId"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.HasOne("IoTSharp.Data.AuthorizedKey", null) + .WithMany("Devices") + .HasForeignKey("AuthorizedKeyId"); + + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany("Devices") + .HasForeignKey("CustomerId"); + + b.HasOne("IoTSharp.Data.Gateway", "Owner") + .WithMany("Children") + .HasForeignKey("OwnerId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany("Devices") + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("Owner"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.HasOne("IoTSharp.Data.Device", "Device") + .WithMany() + .HasForeignKey("DeviceId"); + + b.Navigation("Device"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.HasOne("IoTSharp.Data.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "IdentityUser") + .WithMany() + .HasForeignKey("IdentityUserId"); + + b.HasOne("IoTSharp.Data.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Customer"); + + b.Navigation("IdentityUser"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Tenant", b => + { + b.Navigation("Customers"); + + b.Navigation("Devices"); + }); + + modelBuilder.Entity("IoTSharp.Data.Gateway", b => + { + b.Navigation("Children"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IoTSharp.Data.PostgreSQL/Migrations/20210816075805_addeventfield.cs b/IoTSharp.Data.PostgreSQL/Migrations/20210816075805_addeventfield.cs new file mode 100644 index 0000000000000000000000000000000000000000..fbffebc6ff7a7148fec3a35123fedab593b19caa --- /dev/null +++ b/IoTSharp.Data.PostgreSQL/Migrations/20210816075805_addeventfield.cs @@ -0,0 +1,34 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace IoTSharp.Migrations +{ + public partial class addeventfield : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "EventId", + table: "FlowOperations", + type: "bigint", + nullable: false, + defaultValue: 0L); + + migrationBuilder.AddColumn( + name: "Bizid", + table: "BaseEvents", + type: "text", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "EventId", + table: "FlowOperations"); + + migrationBuilder.DropColumn( + name: "Bizid", + table: "BaseEvents"); + } + } +} diff --git a/IoTSharp.Data.PostgreSQL/Migrations/ApplicationDbContextModelSnapshot.cs b/IoTSharp.Data.PostgreSQL/Migrations/ApplicationDbContextModelSnapshot.cs index c07221e3d96d2d65a81fb070ec9623501a124fe4..f5c5c45f309dd081ebd6b9f468b3501ccc9006f2 100644 --- a/IoTSharp.Data.PostgreSQL/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/IoTSharp.Data.PostgreSQL/Migrations/ApplicationDbContextModelSnapshot.cs @@ -182,6 +182,9 @@ namespace IoTSharp.Migrations .HasColumnType("bigint") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + b.Property("Bizid") + .HasColumnType("text"); + b.Property("CreaterDateTime") .HasColumnType("timestamp without time zone"); @@ -200,6 +203,9 @@ namespace IoTSharp.Migrations b.Property("MataData") .HasColumnType("text"); + b.Property("RuleId") + .HasColumnType("bigint"); + b.Property("Type") .HasColumnType("integer"); @@ -639,6 +645,9 @@ namespace IoTSharp.Migrations b.Property("FormDesc") .HasColumnType("text"); + b.Property("FormLayout") + .HasColumnType("text"); + b.Property("FormName") .HasColumnType("text"); @@ -651,6 +660,9 @@ namespace IoTSharp.Migrations b.Property("FromCreateDate") .HasColumnType("timestamp without time zone"); + b.Property("IsCompact") + .HasColumnType("boolean"); + b.Property("ModelClass") .HasColumnType("text"); @@ -696,6 +708,9 @@ namespace IoTSharp.Migrations b.Property("NodeProcessScript") .HasColumnType("text"); + b.Property("NodeProcessScriptType") + .HasColumnType("text"); + b.Property("NodeProcessType") .HasColumnType("text"); @@ -738,6 +753,9 @@ namespace IoTSharp.Migrations b.Property("Data") .HasColumnType("text"); + b.Property("EventId") + .HasColumnType("bigint"); + b.Property("FlowId") .HasColumnType("bigint"); @@ -756,6 +774,9 @@ namespace IoTSharp.Migrations b.Property("Tag") .HasColumnType("text"); + b.Property("bpmnid") + .HasColumnType("text"); + b.HasKey("OperationId"); b.ToTable("FlowOperations"); diff --git a/IoTSharp.Data/BaseEvent.cs b/IoTSharp.Data/BaseEvent.cs index 33b118f2469a700d4a7d918d37688f4b8ebe85f9..61b7f15b8f6f7f023d74cb846cdf14f1a94a782d 100644 --- a/IoTSharp.Data/BaseEvent.cs +++ b/IoTSharp.Data/BaseEvent.cs @@ -18,9 +18,12 @@ namespace IoTSharp.Data public string EventName { get; set; } public string EventDesc { get; set; } public int EventStaus { get; set; } - public int Type { get; set; } + public EventType Type { get; set; } public string MataData { get; set; } + public long RuleId { get; set; } public Guid Creator { get; set; } + + public string Bizid { get; set; } public DateTime CreaterDateTime { get; set; } } } diff --git a/IoTSharp.Data/BaseFunction.cs b/IoTSharp.Data/BaseFunction.cs new file mode 100644 index 0000000000000000000000000000000000000000..ee12533e31e887dd349f2d6bb79b28802e42a393 --- /dev/null +++ b/IoTSharp.Data/BaseFunction.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IoTSharp.Data +{ + public class BaseFunction + {[Key] + public long FunctionId { get; set; } + public string FunctionName { get; set; } + public string FunctionController { get; set; } + public string FunctionAction { get; set; } + public string FunctionDesc { get; set; } + public string FunctionRoute { get; set; } + public int FunctionType{ get; set; } + public long FunctionParent { get; set; } + public int FunctionStatus { get; set; } + } +} diff --git a/IoTSharp.Data/DynamicFormInfo.cs b/IoTSharp.Data/DynamicFormInfo.cs index bc21c8a63a363ec0c02685790eb7976f622a80f2..9559a4199ebbccdfe97886d96d8521a87bfd3a19 100644 --- a/IoTSharp.Data/DynamicFormInfo.cs +++ b/IoTSharp.Data/DynamicFormInfo.cs @@ -24,5 +24,8 @@ namespace IoTSharp.Data public string Url { get; set; } public Guid Creator { get; set; } public DateTime? FromCreateDate { get; set; } + public string FormLayout { get; set; } //horizontal vertical inline + + public bool IsCompact { get; set; } } } diff --git a/IoTSharp.Data/Enums.cs b/IoTSharp.Data/Enums.cs index c15932c3579e83ecc23b80391c48a4c754db4359..3123f609a7fe3732612dd49708dd704c81361cac 100644 --- a/IoTSharp.Data/Enums.cs +++ b/IoTSharp.Data/Enums.cs @@ -125,4 +125,15 @@ namespace IoTSharp.Data RuleNode, RuleSwitcher } + + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + [JsonConverter(typeof(StringEnumConverter))] + public enum EventType + { + Normal=1, + TestPurpose=2 + } + + + } \ No newline at end of file diff --git a/IoTSharp.Data/Flow.cs b/IoTSharp.Data/Flow.cs index 64818850199f74be1f3bc287c3b0b948bee8986b..fa377d0b87a5415ea6fe1d3ec0cd99eeaf0e7c3a 100644 --- a/IoTSharp.Data/Flow.cs +++ b/IoTSharp.Data/Flow.cs @@ -26,6 +26,7 @@ namespace IoTSharp.Data public string NodeProcessMethod { get; set; } public string NodeProcessParams { get; set; } public string NodeProcessType{ get; set; } + public string NodeProcessScriptType { get; set; } public string NodeProcessScript { get; set; } public string Incoming { get; set; } public string Outgoing { get; set; } diff --git a/IoTSharp.Data/FlowOperation.cs b/IoTSharp.Data/FlowOperation.cs index 244e478cf07ffcc8ee2c507c0789376d74d25e22..e3a6408007b355c830622bb52fcc8768a29b612f 100644 --- a/IoTSharp.Data/FlowOperation.cs +++ b/IoTSharp.Data/FlowOperation.cs @@ -18,8 +18,10 @@ namespace IoTSharp.Data public string OperationDesc { get; set; } public string Data { get; set; } public string BizId { get; set; } + public string bpmnid { get; set; } public long FlowId { get; set; } public long RuleId { get; set; } + public long EventId { get; set; } public int Step { get; set; } public string Tag { get; set; } } diff --git a/IoTSharp.Data/RoleAsset.cs b/IoTSharp.Data/RoleAsset.cs new file mode 100644 index 0000000000000000000000000000000000000000..b85aaf0c52178037b021234689947022dfc81cc5 --- /dev/null +++ b/IoTSharp.Data/RoleAsset.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IoTSharp.Data +{ + class RoleAsset + { + } +} diff --git a/IoTSharp.Data/RoleFunction.cs b/IoTSharp.Data/RoleFunction.cs new file mode 100644 index 0000000000000000000000000000000000000000..1d1c69cbc6fc25a1db1c8d558466f1e1d8537209 --- /dev/null +++ b/IoTSharp.Data/RoleFunction.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IoTSharp.Data +{ + class RoleFunction + { + } +} diff --git a/IoTSharp/App_Code/Util/Extensions/JwtControllerExtension.cs b/IoTSharp/App_Code/Util/Extensions/JwtControllerExtension.cs new file mode 100644 index 0000000000000000000000000000000000000000..94023dde33e3863263c9949b377e1e60cfc78a77 --- /dev/null +++ b/IoTSharp/App_Code/Util/Extensions/JwtControllerExtension.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.IdentityModel.Tokens.Jwt; +using System.Linq; +using System.Security.Claims; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; +using IoTSharp.Data; +using IoTSharp.Models; +using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Mvc; +using Microsoft.IdentityModel.Tokens; +using Newtonsoft.Json; + + +namespace IoTSharp.App_Code.Util.Extensions +{ + public static class JwtControllerExtension + { + + public static string JWTKEY=""; + public static async Task GetUserProfile(this ControllerBase c) + { + string token = await c.HttpContext.GetTokenAsync(JwtBearerDefaults.AuthenticationScheme, "access_token"); + if (!string.IsNullOrEmpty(token)) + { + + var _token = token.Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries); + if (_token.Length == 3) + { + //var header = _token[0]; + var payload = _token[1]; + // var sign = _token[2]; + //// var YOURJWTKEY = "iotsharpiotsharpiotsharpiotsharpiotsharp"; + // var hs256 = new HMACSHA256(Encoding.UTF8.GetBytes(JWTKEY)); + // var target = Base64UrlEncoder.Encode( + // hs256.ComputeHash(Encoding.UTF8.GetBytes(string.Concat(header, ".", payload)))); + // //验签 + // if (string.Equals(sign, target)) + // { + var claims = JwtHeader.Base64UrlDeserialize(payload); + return new UserProfile() + { + Id = Guid.Parse(claims[ClaimTypes.NameIdentifier].ToString() ?? string.Empty), + Name = claims[ClaimTypes.Name].ToString() ?? string.Empty, + Roles = JsonConvert.DeserializeObject(claims[ClaimTypes.Role]?.ToString() ?? string.Empty), + Email = JsonConvert.DeserializeObject(claims[ClaimTypes.Email]?.ToString() ?? string.Empty), + Tenant = Guid.Parse(claims[IoTSharpClaimTypes.Tenant]?.ToString() ?? string.Empty), + Comstomer = Guid.Parse(claims[IoTSharpClaimTypes.Customer]?.ToString() ?? string.Empty), + }; + + //} + + + } + } + + return default; + } + } +} diff --git a/IoTSharp/Controllers/AccountController.cs b/IoTSharp/Controllers/AccountController.cs index 82cc91ebd635be63ff4fb8541e4252ad11633348..889f85b0491525480419f4fa5e0dbfaf8a53af9b 100644 --- a/IoTSharp/Controllers/AccountController.cs +++ b/IoTSharp/Controllers/AccountController.cs @@ -90,6 +90,12 @@ namespace IoTSharp.Controllers { try { + var sss = ""; + for (int i = 0; i < 100; i++) + { + sss += Guid.NewGuid().ToString(); + } + var result = await _signInManager.PasswordSignInAsync(model.UserName, model.Password, false, false); if (result.Succeeded) { @@ -101,6 +107,7 @@ namespace IoTSharp.Controllers new Claim(ClaimTypes.Email, appUser.Email), new Claim(ClaimTypes.NameIdentifier, appUser.Id), new Claim(ClaimTypes.Name, appUser.UserName), + new Claim(ClaimTypes.UserData, sss), }; var lstclaims = await _userManager.GetClaimsAsync(appUser); claims.AddRange(lstclaims); diff --git a/IoTSharp/Controllers/MenuController.cs b/IoTSharp/Controllers/MenuController.cs index 3ab37c95a3103120298fab0a5596766fb150ba7f..2235e00fdb46c61943daebbe08dfd1eeed7c5bc3 100644 --- a/IoTSharp/Controllers/MenuController.cs +++ b/IoTSharp/Controllers/MenuController.cs @@ -4,7 +4,13 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using IoTSharp.App_Code.Util.Extensions; +using IoTSharp.Data; +using IoTSharp.Models; +using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Identity; namespace IoTSharp.Controllers { @@ -17,11 +23,358 @@ namespace IoTSharp.Controllers [ApiController] public class MenuController : ControllerBase { + private readonly UserManager _userManager; + private readonly ApplicationDbContext _context; + public MenuController(UserManager userManager, ApplicationDbContext context) + { + this._userManager = userManager; + this._context = context; + } + + + + public async Task GetUserAsset(int type) + { + var profile = await this.GetUserProfile(); + switch (type) + { + case 1: + if (profile.Roles.Contains("SystemAdmin")) + { + return new AppMessage() + { + ErrType = ErrType.正常返回, Result = new[] {""} + }; + } + if (profile.Roles.Contains("SystemAdmin")) + { + return new AppMessage() + { + ErrType = ErrType.正常返回, + Result = new[] { "" } + }; + } + if (profile.Roles.Contains("SystemAdmin")) + { + return new AppMessage() + { + ErrType = ErrType.正常返回, + Result = new[] { "" } + }; + } + if (profile.Roles.Contains("SystemAdmin")) + { + return new AppMessage() + { + ErrType = ErrType.正常返回, + Result = new[] { "" } + }; + } + if (profile.Roles.Contains("SystemAdmin")) + { + return new AppMessage() + { + ErrType = ErrType.正常返回, + Result = new[] { "" } + }; + } + + + + + break; + + } + + + + return new AppMessage(); + } + + + + [Authorize] + [HttpGet("[action]")] + public async Task GetProfile() + { + + var profile = await this.GetUserProfile(); + if (profile.Roles.Contains("SystemAdmin")) + { + return new AppMessage() + { + Result = new + { + menu = new[] + { + new + { + text = "主导航",i18n="menu.main",group=true ,hideInBreadcrumb=true, + children=new[] + { + new + { + text = "仪表盘", + i18n="menu.dashboard", + icon="anticon-dashboard", + children=new[] + { + + new { text = "仪表盘", i18n = "",link="/dashboard/v1" } + } + }, + + new + { + text = "租户管理", + i18n="", + icon="anticon-rocket", + children=new[] + { + + new { text = "租户列表", i18n = "",link="/iot/tenant/tenantlist" } + } + }, + + new + { + text = "客户管理", + i18n="", + icon="anticon-rocket", + children=new[] + { + + new { text = "租户列表", i18n = "",link="/iot/customer/customerlist" } + } + }, + new + { + text = "用户管理", + i18n="", + icon="anticon-rocket", + children=new[] + { + + new { text = "用户列表", i18n = "",link="/iot/user/userlist" } + } + }, + new + { + text = "设备管理", + i18n="", + icon="anticon-rocket", + children=new[] + { + + new { text = "设备列表", i18n = "",link="/iot/device/devicelist" }, + new { text = "设计", i18n = "",link="/iot/device/devicegraph" }, + new { text = "规则链", i18n = "",link="/iot/flow/flowlist" }, + } + }, + new + { + text = "资源", + i18n="", + icon="anticon-rocket", + children=new[] + { + + new { text = "字典分组", i18n = "",link="/iot/dictionary/dictionarygrouplist" }, + new { text = "字典", i18n = "",link="/iot/dictionary/dictionarylist" }, + new { text = "国际化", i18n = "",link="/iot/resouce/i18nlist" }, + new { text = "表单", i18n = "",link="/iot/util/dynamicformlist" }, + } + }, + + } + } + }, + funcs = Enumerable.Range(0, 500), + username= profile.Name, + AppName="IOTSHARP", + Email= profile.Email.FirstOrDefault(), + Logo="" + } + }; + } + + if (profile.Roles.Contains("TenantAdmin")) + { + return new AppMessage() + { + Result = new + { + menu = new[] + { + new + { + text = "主导航",i18n="menu.main",group=true ,hideInBreadcrumb=true, + children=new[] + { + new + { + text = "仪表盘",i18n="menu.dashboard",icon="anticon-dashboard", + children=new[] + { + + new { text = "仪表盘", i18n = "menu.dashboard.v1",link="/dashboard/v1" } + } + }, + + new + { + text = "客户管理",i18n="",icon="anticon-rocket", + children=new[] + { + + new { text = "客户列表", i18n = "",link="/iot/customer/customerlist" } + } + }, + new + { + text = "用户管理",i18n="",icon="anticon-rocket", + children=new[] + { + + new { text = "用户列表", i18n = "menu.customer.userlist",link="/iot/user/userlist" } + } + }, + + } + } + }, + funcs = Enumerable.Range(0, 500), + username = profile.Name, + AppName = "IOTSHARP", + Email = profile.Email.FirstOrDefault(), + Logo = "" + } + }; + } + if (profile.Roles.Contains("CustomerAdmin")) + { + return new AppMessage() + { + Result = new + { + menu = new[] + { + new + { + text = "主导航",i18n="menu.main",group=true ,hideInBreadcrumb=true, + children=new[] + { + new + { + text = "仪表盘",i18n="menu.dashboard",icon="anticon-dashboard", + children=new[] + { + + new { text = "仪表盘", i18n = "menu.dashboard.v1",link="/dashboard/v1" } + } + }, + + new + { + text = "设备管理",i18n="menu.tenant.devicemanage",icon="anticon-rocket", + children=new[] + { + + new { text = "设备列表", i18n = "",link="/iot/device/devicelist" }, + new { text = "规则链", i18n = "",link="/iot/device/devicelist" }, + new { text = "设计", i18n = "",link="/iot/device/devicelist" }, + new { text = "场景", i18n = "",link="/iot/device/devicelist" }, + } + }, + new + { + text = "用户管理",i18n="",icon="anticon-rocket", + children=new[] + { + + new { text = "用户列表", i18n = "menu.user.customerlist",link="/iot/user/userlist" } + } + }, + + } + } + }, + funcs = Enumerable.Range(0, 500), + username = profile.Name, + AppName = "IOTSHARP", + Email = profile.Email.FirstOrDefault(), + Logo = "" + } + }; + } + + if (profile.Roles.Contains("NormalUser")) + { + return new AppMessage() + { + Result = new + { + menu = new[] + { + new + { + text = "主导航",i18n="menu.main",group=true ,hideInBreadcrumb=true, + children=new[] + { + new + { + text = "仪表盘",i18n="menu.dashboard",icon="anticon-dashboard", + children=new[] + { + + new { text = "仪表盘", i18n = "menu.dashboard.v1",link="/dashboard/v1" } + } + }, + + new + { + text = "设备管理",i18n="menu.tenant.devicemanage",icon="anticon-rocket", + children=new[] + { + + new { text = "设备列表", i18n = "",link="/iot/device/devicelist" }, + new { text = "规则链", i18n = "",link="/iot/device/devicelist" }, + new { text = "设计", i18n = "",link="/iot/device/devicelist" }, + new { text = "场景", i18n = "",link="/iot/device/devicelist" }, + } + }, + + } + } + }, + funcs = Enumerable.Range(0, 500), + username = profile.Name, + AppName = "IOTSHARP", + Email = profile.Email.FirstOrDefault(), + Logo = "" + } + }; + } + + return new AppMessage(); + } + + + + [AllowAnonymous] [HttpGet("[action]")] public JsonResult getMenuList() { + + + + + + + + return new JsonResult(new[] { @@ -39,7 +392,7 @@ namespace IoTSharp.Controllers alias="", redirect="", caseSensitive="false", - + }, @@ -56,7 +409,7 @@ namespace IoTSharp.Controllers return new JsonResult(new[] { "this","is","test" - + }); } } diff --git a/IoTSharp/Controllers/RulesController.cs b/IoTSharp/Controllers/RulesController.cs index 34813753d4c22e5377a0e18352d5b4bc118c59ad..256098726d62cc6715e789db23443248053a519a 100644 --- a/IoTSharp/Controllers/RulesController.cs +++ b/IoTSharp/Controllers/RulesController.cs @@ -22,11 +22,12 @@ using System.Diagnostics; using System.Dynamic; using System.IO; using System.Reflection; +using IoTSharp.App_Code.Util.Extensions; using IoTSharp.Extensions; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Emit; - +using Microsoft.EntityFrameworkCore; namespace IoTSharp.Controllers @@ -47,8 +48,12 @@ namespace IoTSharp.Controllers } [HttpPost("[action]")] - public AppMessage Index([FromBody] RulePageParam m) + public async Task Index([FromBody] RulePageParam m) { + + + var profile = await this.GetUserProfile(); + Expression> expression = x => x.RuleStatus > -1; if (!string.IsNullOrEmpty(m.Name)) { @@ -72,9 +77,9 @@ namespace IoTSharp.Controllers ErrType = ErrType.正常返回, Result = new { - rows = _context.FlowRules.OrderByDescending(c => c.RuleId).Where(expression).Skip(m.offset * m.limit).Take(m.limit) - .ToList(), - totel = _context.FlowRules.Count(expression) + rows = await _context.FlowRules.OrderByDescending(c => c.RuleId).Where(expression).Skip(m.offset * m.limit).Take(m.limit) + .ToListAsync(), + totel = await _context.FlowRules.CountAsync(expression) } }; @@ -163,13 +168,16 @@ namespace IoTSharp.Controllers [HttpPost("[action]")] - public AppMessage SaveDiagram(ModelWorkFlow m) + public async Task SaveDiagram(ModelWorkFlow m) { - var user = _userManager.GetUserId(User); + // var user = _userManager.GetUserId(User); + var profile = await this.GetUserProfile(); var activity = JsonConvert.DeserializeObject(m.Biz); var rule = _context.FlowRules.FirstOrDefault(c => c.RuleId == activity.RuleId); + rule.DefinitionsXml = m.Xml; + rule.Creator = profile.Id.ToString(); _context.FlowRules.Update(rule); _context.SaveChanges(); _context.Flows.RemoveRange(_context.Flows.Where(c => c.RuleId == activity.RuleId).ToList()); @@ -185,6 +193,8 @@ namespace IoTSharp.Controllers Flowname = c.BizObject.Flowname, bpmnid = c.id, FlowType = c.bpmntype, + NodeProcessScript = c.BizObject.flowscript, + NodeProcessScriptType = c.BizObject.flowscripttype }).ToList()); _context.SaveChanges(); @@ -249,7 +259,9 @@ namespace IoTSharp.Controllers bpmnid = c.id, FlowType = c.bpmntype, NodeProcessParams = c.BizObject.NodeProcessParams, - NodeProcessClass = c.BizObject.NodeProcessClass + NodeProcessClass = c.BizObject.NodeProcessClass, + NodeProcessScript = c.BizObject.flowscript, + NodeProcessScriptType = c.BizObject.flowscripttype }).ToList()); _context.SaveChanges(); } @@ -576,6 +588,8 @@ namespace IoTSharp.Controllers Flowdesc = item.Flowdesc, Flowtype = item.FlowType.ToString(), Flowname = item.Flowname, + flowscript = item.NodeProcessScript, + flowscripttype = item.NodeProcessScriptType } }); break; @@ -593,6 +607,8 @@ namespace IoTSharp.Controllers Flowdesc = item.Flowdesc, Flowtype = item.FlowType.ToString(), Flowname = item.Flowname, + flowscript = item.NodeProcessScript, + flowscripttype = item.NodeProcessScriptType } }); break; @@ -630,6 +646,8 @@ namespace IoTSharp.Controllers Flowdesc = item.Flowdesc, Flowtype = item.FlowType.ToString(), Flowname = item.Flowname, + flowscript = item.NodeProcessScript, + flowscripttype = item.NodeProcessScriptType } }); break; @@ -649,6 +667,8 @@ namespace IoTSharp.Controllers Flowdesc = item.Flowdesc, Flowtype = item.FlowType.ToString(), Flowname = item.Flowname, + flowscript = item.NodeProcessScript, + flowscripttype = item.NodeProcessScriptType } }); break; @@ -667,6 +687,8 @@ namespace IoTSharp.Controllers Flowdesc = item.Flowdesc, Flowtype = item.FlowType.ToString(), Flowname = item.Flowname, + flowscript = item.NodeProcessScript, + flowscripttype = item.NodeProcessScriptType } }); break; @@ -685,6 +707,8 @@ namespace IoTSharp.Controllers Flowdesc = item.Flowdesc, Flowtype = item.FlowType.ToString(), Flowname = item.Flowname, + flowscript = item.NodeProcessScript, + flowscripttype = item.NodeProcessScriptType } }); break; @@ -855,21 +879,31 @@ namespace IoTSharp.Controllers }; } - private async System.Threading.Tasks.Task Process(Flow flow, List allflow, object data,int nextstep) + private async System.Threading.Tasks.Task Process(Flow flow, List allflow, object data, int nextstep, long _eventid) { switch (flow.FlowType) { case "bpmn:SequenceFlow": - var t = allflow.FirstOrDefault(c => c.TargetId == flow.bpmnid); - _context.FlowOperations.Add(new FlowOperation() { AddDate = DateTime.Now, RuleId = flow.RuleId, FlowId = t.FlowId, Data = JsonConvert.SerializeObject(data), NodeStatus = 1, OperationDesc = "执行条件" + flow.Conditionexpression , Step = nextstep}); + var t = allflow.FirstOrDefault(c => c.bpmnid == flow.TargetId); + _context.FlowOperations.Add(new FlowOperation() + { + AddDate = DateTime.Now, + RuleId = flow.RuleId, + FlowId = flow.FlowId, + Data = JsonConvert.SerializeObject(data), + NodeStatus = 1, + OperationDesc = "执行条件" + flow.Conditionexpression, + Step = nextstep, + bpmnid = flow.bpmnid, + EventId = _eventid + }); await _context.SaveChangesAsync(); - await Process(t, allflow, data, nextstep++); + await Process(t, allflow, data, ++nextstep, _eventid); break; case "bpmn:Task": { var flows = allflow.Where(c => c.SourceId == flow.bpmnid).ToList(); - var tasks = new BaseRuleTask() { Name = flow.Flowname, @@ -878,13 +912,22 @@ namespace IoTSharp.Controllers outgoing = new EditableList() }; - - _context.FlowOperations.Add(new FlowOperation() { AddDate = DateTime.Now, RuleId = flow.RuleId, FlowId = flow.FlowId, Data = JsonConvert.SerializeObject(data), NodeStatus = 1, OperationDesc = "执行任务" + flow.Flowname, Step = nextstep }); + _context.FlowOperations.Add(new FlowOperation() + { + bpmnid = flow.bpmnid, + AddDate = DateTime.Now, + RuleId = flow.RuleId, + FlowId = flow.FlowId, + Data = JsonConvert.SerializeObject(data), + NodeStatus = 1, + OperationDesc = "执行任务" + flow.Flowname, + Step = nextstep, + EventId = _eventid + }); await _context.SaveChangesAsync(); nextstep++; foreach (var item in flows) { - var rule = new BaseRuleFlow(); rule.Expression = item.Conditionexpression; rule.id = item.bpmnid; @@ -892,7 +935,7 @@ namespace IoTSharp.Controllers rule.Eventid = item.bpmnid; tasks.outgoing.Add(rule); } - AbstractTaskExcutor taskExcutor = new AbstractTaskExcutor(); + SimpleTaskExcutor taskExcutor = new SimpleTaskExcutor(); var result = await taskExcutor.Excute(new ExcuteEntity() { Action = null, @@ -901,23 +944,29 @@ namespace IoTSharp.Controllers WaitTime = 0 }); - - var next = result.Where(c => c.IsSuccess).ToList().Select(c => c.Rule.Properties["Flow"]); - - - - + var next = result.Where(c => c.IsSuccess).ToList(); foreach (var item in next) { - var _flow = item as BaseRuleFlow; - var nextflow = allflow.FirstOrDefault(a => a.bpmnid == _flow.id); - await Process(nextflow, allflow, data,nextstep); + + var nextflow = allflow.FirstOrDefault(a => a.bpmnid == item.Rule.SuccessEvent); + await Process(nextflow, allflow, data, nextstep, _eventid); } } break; case "bpmn:EndEvent": - _context.FlowOperations.Add(new FlowOperation() { AddDate = DateTime.Now, RuleId = flow.RuleId, FlowId = flow.FlowId, Data = JsonConvert.SerializeObject(data), NodeStatus = 1, OperationDesc = "处理完成", Step = nextstep}); + _context.FlowOperations.Add(new FlowOperation() + { + bpmnid = flow.bpmnid, + AddDate = DateTime.Now, + RuleId = flow.RuleId, + FlowId = flow.FlowId, + Data = JsonConvert.SerializeObject(data), + NodeStatus = 1, + OperationDesc = "处理完成", + Step = nextstep, + EventId = _eventid + }); await _context.SaveChangesAsync(); break; @@ -925,30 +974,40 @@ namespace IoTSharp.Controllers { var flows = allflow.Where(c => c.SourceId == flow.bpmnid).ToList(); - var tasks = new BaseRuleTask() { - Name =flow.Flowname, + Name = flow.Flowname, Eventid = flow.bpmnid, id = flow.bpmnid, outgoing = new EditableList() }; - _context.FlowOperations.Add(new FlowOperation() { AddDate = DateTime.Now, RuleId = flow.RuleId, FlowId = flow.FlowId, Data = JsonConvert.SerializeObject(data), NodeStatus = 1, OperationDesc = "开始处理", Step = nextstep}); + _context.FlowOperations.Add(new FlowOperation() + { + bpmnid = flow.bpmnid, + AddDate = DateTime.Now, + RuleId = flow.RuleId, + FlowId = flow.FlowId, + Data = JsonConvert.SerializeObject(data), + NodeStatus = 1, + OperationDesc = "开始处理", + Step = nextstep, + EventId = _eventid + }); await _context.SaveChangesAsync(); foreach (var item in flows) { var rule = new BaseRuleFlow(); - + rule.id = item.bpmnid; rule.Name = item.bpmnid; rule.Eventid = item.bpmnid; rule.Expression = item.Conditionexpression; tasks.outgoing.Add(rule); } - AbstractTaskExcutor taskExcutor = new AbstractTaskExcutor(); + SimpleTaskExcutor taskExcutor = new SimpleTaskExcutor(); var result = await taskExcutor.Excute(new ExcuteEntity() { Action = null, @@ -959,110 +1018,149 @@ namespace IoTSharp.Controllers }); var next = result.Where(c => c.IsSuccess).ToList(); - - + + nextstep++; foreach (var item in next) { - var _flow = item.Rule.Properties["flow"] as BaseRuleFlow; - var nextflow = allflow.FirstOrDefault(a => a.bpmnid == _flow.id); - await Process(nextflow, allflow, data, nextstep); + + var nextflow = allflow.FirstOrDefault(a => a.bpmnid == item.Rule.SuccessEvent); + await Process(nextflow, allflow, data, nextstep, _eventid); } } break; + case "label": - } + break; + case "bpmn:Lane": - } + break; + case "bpmn:Participant": + break; - [HttpPost("[action]")] - public async Task Active([FromBody] JObject form) - { + case "bpmn:DataStoreReference": + break; + case "bpmn:SubProcess": - var formdata = form.First.First; + break; + default: + { + var flows = allflow.Where(c => c.SourceId == flow.bpmnid).ToList(); + var tasks = new BaseRuleTask() + { + Name = flow.Flowname, + Eventid = flow.bpmnid, + id = flow.bpmnid, + + outgoing = new EditableList() + }; + _context.FlowOperations.Add(new FlowOperation() + { + bpmnid = flow.bpmnid, + AddDate = DateTime.Now, + RuleId = flow.RuleId, + FlowId = flow.FlowId, + Data = JsonConvert.SerializeObject(data), + NodeStatus = 1, + OperationDesc = "执行任务" + flow.Flowname, + Step = nextstep, + EventId = _eventid + }); + await _context.SaveChangesAsync(); + nextstep++; + foreach (var item in flows) + { + var rule = new BaseRuleFlow(); + rule.Expression = item.Conditionexpression; + rule.id = item.bpmnid; + rule.Name = item.Flowname; + rule.Eventid = item.bpmnid; + tasks.outgoing.Add(rule); + } + SimpleTaskExcutor taskExcutor = new SimpleTaskExcutor(); + var result = await taskExcutor.Excute(new ExcuteEntity() + { + Action = null, + Params = data, + Task = tasks, + WaitTime = 0 + }); + var next = result.Where(c => c.IsSuccess).ToList(); + foreach (var item in next) + { + var nextflow = allflow.FirstOrDefault(a => a.bpmnid == item.Rule.SuccessEvent); + await Process(nextflow, allflow, data, nextstep, _eventid); + } + break; + } + + + + } + + } + + + [HttpPost("[action]")] + public async Task Active([FromBody] JObject form) + { + + var profile = await this.GetUserProfile(); + var formdata = form.First.First; var extradata = form.First.Next; var obj = extradata.First.First.First.Value(); var obj1 = extradata.First.First.Next.First.Value(); var formid = obj.Value(); var ruleid = obj1.Value(); - var _form = _context.DynamicFormInfos.FirstOrDefault(c => c.FormId == formid); - object data = formdata.ToObject(BuildPocoObject(_form.ModelClass, "FormData"+ _form.FormId)); + //wrong way + // var _form = _context.DynamicFormInfos.FirstOrDefault(c => c.FormId == formid); + // object data = formdata.ToObject(BuildPocoObject(_form.ModelClass, "FormData"+ _form.FormId)); + // var _params = _context.DynamicFormFieldInfos.Where(c => c.FormId == formid).ToList(); var d = formdata.ToObject(typeof(ExpandoObject)); - var _params = _context.DynamicFormFieldInfos.Where(c => c.FormId == formid).ToList(); - var flows = _context.Flows.Where(c => c.RuleId == ruleid).ToList(); - - var start = flows.FirstOrDefault(c => c.FlowType == "bpmn:StartEvent"); - var end = flows.FirstOrDefault(c => c.FlowType == "bpmn:EndEvent"); - - - await Process(start, flows, d, 1); - //AbstractTaskExcutor taskExcutor = new AbstractTaskExcutor(); - - //var tasks = new BaseRuleTask() - //{ - // Name = "aa", - // Eventid = "aa", - // id = "aa", - - // outgoing = new EditableList() - //}; - - //var rule1 = new BaseRuleFlow(); - //rule1.Expression = "Temperature>2"; - //rule1.id = "1"; - //rule1.Name = "Name1"; - //rule1.Eventid = "Eventid1"; - //var rule2 = new BaseRuleFlow(); - //rule2.id = "2"; - //rule2.Name = "Name2"; - //rule2.Eventid = "Eventid2"; - //rule2.Expression = "Temperature>100"; - //var rule3 = new BaseRuleFlow(); - //rule3.id = "3"; - //rule3.Name = "Name3"; - //rule3.Eventid = "Eventid3"; - //rule3.Expression = "Temperature>1000"; - //tasks.outgoing.Add(rule1); - //tasks.outgoing.Add(rule2); - //tasks.outgoing.Add(rule3); - //var result = await taskExcutor.Excute(new ExcuteEntity() - //{ - // Action = null, - // Params = data, - // Task = tasks, - // WaitTime = 0 - - //}); - - - foreach (var item in _params) + var _event = new BaseEvent() { - foreach (JProperty _item in formdata) - { - if (_item.Path == "form." + item.FieldCode) - { - - var v = _item.First.Value(); - var vl = DynamicProp.GetValue(item.FieldValueType ?? 4, v).ToString(); + CreaterDateTime = DateTime.Now, + Creator = profile.Id, + EventDesc = "测试", + EventName = "测试", + MataData = JsonConvert.SerializeObject(d), + RuleId = ruleid, + Bizid = formid.ToString(), + Type = EventType.TestPurpose, + EventStaus = 1 + }; + _context.BaseEvents.Add(_event); + _context.SaveChanges(); - var code = item.FieldCode; - } - } - } + var flows = _context.Flows.Where(c => c.RuleId == ruleid && c.FlowType != "label").ToList(); + var start = flows.FirstOrDefault(c => c.FlowType == "bpmn:StartEvent"); + // var end = flows.FirstOrDefault(c => c.FlowType == "bpmn:EndEvent"); + await Process(start, flows, d, 1, _event.EventId); + //应该由事件总线去通知 - return new AppMessage(); + return new AppMessage + { + ErrType = ErrType.正常返回, + Result = _context.FlowOperations.OrderBy(c => c.Step). + Where(c => c.EventId == _event.EventId).ToList() + .GroupBy(c => c.Step).Select(c => new + { + Step = c.Key, + Nodes = c + }).ToList() + }; } @@ -1073,19 +1171,14 @@ namespace IoTSharp.Controllers } - private Type BuildPocoObject(string classtext,string typename) + private Type BuildPocoObject(string classtext, string typename) { MetadataReference[] references = { - MetadataReference.CreateFromFile(typeof(object).Assembly.Location), - MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location), - MetadataReference.CreateFromFile(typeof(System.Double).Assembly.Location), - MetadataReference.CreateFromFile(typeof(System.Int32).Assembly.Location), - MetadataReference.CreateFromFile(typeof(System.Int64).Assembly.Location), - MetadataReference.CreateFromFile(typeof(System.String).Assembly.Location), - MetadataReference.CreateFromFile(typeof(System.Single).Assembly.Location), + + }; - + var tree = SyntaxFactory.ParseSyntaxTree(classtext); CSharpCompilation compilation = CSharpCompilation.Create(typename, new[] { tree }, references, new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); using var ms = new MemoryStream(); diff --git a/IoTSharp/Extensions/ApplicationDBInitializer.cs b/IoTSharp/Extensions/ApplicationDBInitializer.cs index 4ee0bf57287cb0d5c2afa1fdb7d122f3a9c8dfb3..249e50c2cc31716b82c77bbaf7211c7f46629533 100644 --- a/IoTSharp/Extensions/ApplicationDBInitializer.cs +++ b/IoTSharp/Extensions/ApplicationDBInitializer.cs @@ -134,10 +134,10 @@ namespace IoTSharp.Data await _signInManager.UserManager.AddClaimAsync(user, new Claim(ClaimTypes.Email, model.Email)); await _signInManager.UserManager.AddClaimAsync(user, new Claim(IoTSharpClaimTypes.Customer, customer.Id.ToString())); await _signInManager.UserManager.AddClaimAsync(user, new Claim(IoTSharpClaimTypes.Tenant, tenant.Id.ToString())); - await _signInManager.UserManager.AddToRoleAsync(user, nameof(UserRole.Anonymous)); - await _signInManager.UserManager.AddToRoleAsync(user, nameof(UserRole.NormalUser)); - await _signInManager.UserManager.AddToRoleAsync(user, nameof(UserRole.CustomerAdmin)); - await _signInManager.UserManager.AddToRoleAsync(user, nameof(UserRole.TenantAdmin)); + //await _signInManager.UserManager.AddToRoleAsync(user, nameof(UserRole.Anonymous)); + //await _signInManager.UserManager.AddToRoleAsync(user, nameof(UserRole.NormalUser)); + //await _signInManager.UserManager.AddToRoleAsync(user, nameof(UserRole.CustomerAdmin)); + //await _signInManager.UserManager.AddToRoleAsync(user, nameof(UserRole.TenantAdmin)); await _signInManager.UserManager.AddToRoleAsync(user, nameof(UserRole.SystemAdmin)); } diff --git a/IoTSharp/FlowRuleEngine/Models/Flow.cs b/IoTSharp/FlowRuleEngine/Models/Flow.cs index 313ca9c3611312fa420e1103dedf44efb2b2f193..970194250181a574c7d32983f0ba2ace07c1b5d3 100644 --- a/IoTSharp/FlowRuleEngine/Models/Flow.cs +++ b/IoTSharp/FlowRuleEngine/Models/Flow.cs @@ -35,7 +35,7 @@ namespace IoTSharp.FlowRuleEngine.Models { RuleName = this.id, RuleExpressionType = RuleExpressionType.LambdaExpression, - Expression = this.Expression, SuccessEvent = this.id, Properties = new Dictionary() + Expression = this.Expression, SuccessEvent = this.id, }; } } diff --git a/IoTSharp/FlowRuleEngine/Models/Task/ITaskExcutor.cs b/IoTSharp/FlowRuleEngine/Models/Task/ITaskExcutor.cs index ae5dab3c3fded3dfa5cc08477e2b9358f43ce968..f2d64d4386a63f05a31a917a080014ff5faea7ec 100644 --- a/IoTSharp/FlowRuleEngine/Models/Task/ITaskExcutor.cs +++ b/IoTSharp/FlowRuleEngine/Models/Task/ITaskExcutor.cs @@ -21,7 +21,7 @@ namespace IoTSharp.FlowRuleEngine.Models.Task public int WaitTime { get; set; } } - public class AbstractTaskExcutor : ITaskExcutor + public class SimpleTaskExcutor : ITaskExcutor { @@ -43,7 +43,7 @@ namespace IoTSharp.FlowRuleEngine.Models.Task foreach (var item in Input.Task.outgoing) { - item.Rule.Properties = new Dictionary {{"Flow", item}}; + item.Rule.Operator=item.id; } mainRules.Rules = Input.Task.outgoing.Select(c => c.Rule).ToList(); var bre = new RulesEngine.RulesEngine(new[] { mainRules }, null); diff --git a/IoTSharp/Models/Rule/ModelFlow.cs b/IoTSharp/Models/Rule/ModelFlow.cs index 370b978de280c190098e928f3602235465176d4f..7918f8b1aba0a04ff3c972bcda536e62363220b0 100644 --- a/IoTSharp/Models/Rule/ModelFlow.cs +++ b/IoTSharp/Models/Rule/ModelFlow.cs @@ -67,8 +67,8 @@ namespace IoTSharp.Models.Rule public string NodeProcessClass { get; set; } public string conditionexpression { get; set; } public string NodeProcessParams { get; set; } - - + public string flowscript { get; set; } + public string flowscripttype { get; set; } } } diff --git a/IoTSharp/Models/UserProfile.cs b/IoTSharp/Models/UserProfile.cs new file mode 100644 index 0000000000000000000000000000000000000000..ef3a2708c13d96d7a099cfd9dcd479fa222b5e1e --- /dev/null +++ b/IoTSharp/Models/UserProfile.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace IoTSharp.Models +{ + public class UserProfile + { + public string[] Roles { get; set; } + public Guid Id { get; set; } + public string[] Email{ get; set; } + public Guid Comstomer { get; set; } + public Guid Tenant { get; set; } + public string Name { get; set; } + } +} diff --git a/IoTSharp/Startup.cs b/IoTSharp/Startup.cs index 3c85076baa12812cdc27170bb45c9acf93cfbbc6..f6046b659801d44e132de95a6098b76c35bce6aa 100644 --- a/IoTSharp/Startup.cs +++ b/IoTSharp/Startup.cs @@ -51,6 +51,7 @@ using Microsoft.AspNetCore.Hosting.Server.Features; using System.Text.RegularExpressions; using HealthChecks.UI.Configuration; using IoTSharp.App_Code.Util; +using IoTSharp.App_Code.Util.Extensions; using Newtonsoft.Json.Serialization; using NSwag.Generation.AspNetCore; using RabbitMQ.Client; @@ -69,7 +70,7 @@ namespace IoTSharp // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - + JwtControllerExtension.JWTKEY = Configuration["JwtKey"]; var settings = Configuration.Get(); services.Configure((Action)(setting => { diff --git a/IoTSharp/appsettings.DefaultSettings.json b/IoTSharp/appsettings.DefaultSettings.json index 81d83d9526b92d97dab31c5fd1a011fa6ed2e83b..8c4ac37ec7e2158444c7656eb2ba70da443616e4 100644 --- a/IoTSharp/appsettings.DefaultSettings.json +++ b/IoTSharp/appsettings.DefaultSettings.json @@ -10,7 +10,7 @@ "IoTSharp": "Server=pgsql;Database=IoTSharp;Username=postgres;Password=future;" }, - "JwtKey": "kissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissme", + "JwtKey": "iotsharpiotsharpiotsharpiotsharpiotsharp", "JwtIssuer": "IoTSharp.Net", "JwtAudience": "IoTSharp.Net", "JwtExpireHours": 3, diff --git a/IoTSharp/appsettings.Development.json b/IoTSharp/appsettings.Development.json index 49e910be8ddc7dc84f99650e7bc05a0865dffba0..80290630f916816844c76945bbc98d7f071ac548 100644 --- a/IoTSharp/appsettings.Development.json +++ b/IoTSharp/appsettings.Development.json @@ -10,8 +10,8 @@ "ConnectionStrings": { "IoTSharp": "Server=localhost;Database=IoTSharp;Username=postgres;Password=future;" }, - "JwtKey": "kissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissme", - "JwtExpireHours":3, + "JwtKey": "iotsharpiotsharpiotsharpiotsharpiotsharp", + "JwtExpireHours": 3, "JwtIssuer": "IoTSharp.Net", "JwtAudience": "IoTSharp.Net", "EventBusStore": "InMemory", diff --git a/IoTSharp/appsettings.PostgreSql.json b/IoTSharp/appsettings.PostgreSql.json index 44a1095beef1b3fe7c492c566596435d2d5f89ef..58fbb46fcd7a7d18fee650d8b1d18a827d447fda 100644 --- a/IoTSharp/appsettings.PostgreSql.json +++ b/IoTSharp/appsettings.PostgreSql.json @@ -13,7 +13,7 @@ "TelemetryStorage": "DataSource=taos;DataBase=IoTSharp;Username=root;Password=taosdata;Port=6030", "EventBusMQ": "amqp://root:kissme@rabbitmq:5672" }, - "JwtKey": "kissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissme", + "JwtKey": "iotsharpiotsharpiotsharpiotsharpiotsharp", "JwtExpireHours": 3, "JwtIssuer": "IoTSharp.Net", "JwtAudience": "IoTSharp.Net",