1.0.0.428.3

Former-commit-id: 42ecef67e603ec00f76f3918bf49c4830820098c
TangShanKaiPing
wanggang 5 years ago
parent 1ea43917ef
commit f562618e7b

@ -29,15 +29,6 @@ namespace Application.Domain.Entities
[Display(Name = "海拔")]
public decimal Altitude { get; set; }
//[Display(Name = "类型")]
//public string Type { get; set; }
//[Display(Name = "模板")]
//public string Template { get; set; }
//[Display(Name = "标记")]
//public string MobileTemplate { get; set; }
[Display(Name = "序号")]
public int DisplayOrder { get; set; }
@ -46,6 +37,5 @@ namespace Application.Domain.Entities
public List<Device> Devices { get; set; } = new List<Device>();
public List<Scene> Scenes { get; set; } = new List<Scene>();
public List<NodeCategoryNode> CategoryNodes { get; set; } = new List<NodeCategoryNode>();
}
}

@ -23,19 +23,21 @@ namespace IoT.Shared
modelBuilder.Entity<Permission>().HasIndex(o => o.Number).IsUnique();
modelBuilder.Entity<UserRole>().HasIndex(o => new { o.UserId, o.RoleId }).IsUnique();
modelBuilder.Entity<RolePermission>().HasIndex(o => new { o.RoleId, o.PermissionId }).IsUnique();
//////
modelBuilder.Entity<Node>().HasIndex(o => o.Number).IsUnique();
//
modelBuilder.Entity<Category>().HasIndex(o => o.Number).IsUnique();
modelBuilder.Entity<Product>().HasOne(o => o.Category).WithMany(o => o.Products).HasForeignKey(o => o.CategoryId);
modelBuilder.Entity<Product>().HasIndex(o => o.Number).IsUnique();
modelBuilder.Entity<Api>().HasOne(o => o.Product).WithMany(o => o.Apis).HasForeignKey(o => o.ProductId);
modelBuilder.Entity<Api>().HasIndex(o => new { o.ProductId, o.Name }).IsUnique();
modelBuilder.Entity<Node>().HasIndex(o => o.Number).IsUnique();
modelBuilder.Entity<Parameter>().HasOne(o => o.Api).WithMany(o => o.Parameters).HasForeignKey(o => o.ApiId);
//
modelBuilder.Entity<Device>().HasOne(o => o.Product).WithMany(o => o.Devices).HasForeignKey(o => o.ProductId);
modelBuilder.Entity<Device>().HasOne(o => o.Node).WithMany(o => o.Devices).HasForeignKey(o => o.NodeId);
modelBuilder.Entity<Device>().HasIndex(o => o.Number).IsUnique();
modelBuilder.Entity<Data>().HasOne(o => o.Device).WithMany(o => o.Data).HasForeignKey(o => o.DeviceId);
modelBuilder.Entity<Parameter>().HasOne(o => o.Api).WithMany(o => o.Parameters).HasForeignKey(o => o.ApiId);
modelBuilder.Entity<LiveRecord>().Property(o => o.DeviceNumber).IsRequired();
//
modelBuilder.Entity<Command>().HasOne(o => o.Api).WithMany(o => o.Commands).HasForeignKey(o => o.ApiId);
modelBuilder.Entity<Scene>().HasOne(o => o.Node).WithMany(o => o.Scenes).HasForeignKey(o => o.NodeId);
modelBuilder.Entity<SceneCommand>().HasOne(o => o.Scene).WithMany(o => o.SceneCommands).HasForeignKey(o => o.SceneId);
@ -43,10 +45,6 @@ namespace IoT.Shared
modelBuilder.Entity<SceneTimer>().HasOne(o => o.Scene).WithMany(o => o.SceneTimers).HasForeignKey(o => o.SceneId);
modelBuilder.Entity<SceneTigger>().HasOne(o => o.Scene).WithMany(o => o.SceneTiggers).HasForeignKey(o => o.SceneId);
modelBuilder.Entity<SceneTigger>().HasOne(o => o.Data).WithMany(o => o.Tiggers).HasForeignKey(o => o.DataId);
modelBuilder.Entity<NodeCategory>().HasIndex(o => o.Name).IsUnique();
modelBuilder.Entity<NodeCategoryNode>().HasOne(o => o.Node).WithMany(o => o.CategoryNodes).HasForeignKey(o => o.NodeId);
modelBuilder.Entity<NodeCategoryNode>().HasOne(o => o.Category).WithMany(o => o.CategoryNodes).HasForeignKey(o => o.CategoryId);
modelBuilder.Entity<NodeCategoryNode>().HasIndex(o => new { o.CategoryId, o.NodeId }).IsUnique();
}
public static void Seed(DbContext db)
@ -76,8 +74,6 @@ namespace IoT.Shared
db.Set<Category>().Add(new Category { Id = "productcatgoryid-40".ToGuid(), Number = "40", Name = "监测", Image = "/images/monitor.png" });
db.SaveChanges();
db.Set<NodeCategory>().Add(new NodeCategory { Name = "智慧教室", Template = "node" });
db.SaveChanges();
}
}
}

@ -1,5 +1,6 @@
using Application.Domain.Entities;
using Infrastructure.Data;
using IoTCenter.Application.Domain;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;

@ -1,7 +1,7 @@
using Infrastructure.Domain;
using System.ComponentModel.DataAnnotations;
namespace Application.Domain.Entities
namespace IoTCenter.Application.Domain
{
[Display(Name = "回放")]
public class LiveRecord : BaseEntity

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Application.Domain.Entities
namespace IoTCenter.Application.Domain
{
[Display(Name = "节点类型")]
public class NodeCategory : BaseEntity

@ -1,8 +1,9 @@
using Infrastructure.Domain;
using Application.Domain.Entities;
using Infrastructure.Domain;
using System;
using System.ComponentModel.DataAnnotations;
namespace Application.Domain.Entities
namespace IoTCenter.Application.Domain
{
[Display(Name = "节点分类")]
public class NodeCategoryNode : BaseEntity

@ -0,0 +1,12 @@
using Infrastructure.Domain;
using System.Collections.Generic;
namespace IoTCenter.Application.Domain
{
public class Organ : BaseEntity
{
public string Name { get; set; }
public string Number { get; set; }
public List<OrganNode> OrganNodes { get; set; } = new List<OrganNode>();
}
}

@ -0,0 +1,14 @@
using Application.Domain.Entities;
using Infrastructure.Domain;
using System;
namespace IoTCenter.Application.Domain
{
public class OrganNode : BaseEntity
{
public Guid OrganId { get; set; }
public Guid NodeId { get; set; }
public Organ Organ { get; set; }
public Node Node { get; set; }
}
}

@ -1,14 +1,14 @@
using System.Linq;
using Application.Domain.Entities;
using Application.Models;
using Infrastructure.Application;
using Application.Models;
using Infrastructure.Data;
using Infrastructure.Extensions;
using Infrastructure.Web.Mvc;
using IoT.Shared.Areas.Admin.Controlls;
using IoTCenter.Application.Domain;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
namespace IoT.Shared.Areas.Admin.Controlls
namespace IoTCenter.Areas.Admin.Controllers
{
[Authorize]
[Area(nameof(Admin))]

@ -1,4 +1,4 @@
using Application.Domain.Entities;
using IoTCenter.Application.Domain;
using Infrastructure.Application;
using Infrastructure.Data;
using Infrastructure.Extensions;

@ -2,6 +2,7 @@
using Application.Models;
using Infrastructure.Data;
using Infrastructure.Extensions;
using IoTCenter.Application.Domain;
using IoTCenter.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@ -136,23 +137,6 @@ namespace IoTCenter.Controllers
return Json(model);
}
public IActionResult GetTemplate(string number)
{
var node = _nodeRepo.ReadOnlyTable()
.Include(o => o.CategoryNodes)
.ThenInclude(o => o.Category)
.FirstOrDefault(o => o.Number == number);
var template = node.CategoryNodes.FirstOrDefault()?.Category.Template;
if (!string.IsNullOrEmpty(template))
{
return Content(System.IO.File.ReadAllText(Path.Combine(this._env.ContentRootPath, "wwwroot", template)));
}
else
{
return Content("");
}
}
public IActionResult ExecApi(string connectionId, string number, string method)
{
try

@ -1,10 +1,10 @@
using Application.Domain.Entities;
using Infrastructure.Data;
using Infrastructure.Extensions;
using IoTCenter.Application.Domain;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;

@ -4,6 +4,7 @@ using Infrastructure.Data;
using Infrastructure.Extensions;
using Infrastructure.Security;
using IoT.Shared;
using IoTCenter.Application.Domain;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
@ -25,6 +26,16 @@ namespace IoTCenter
public void OnModelCreating(ModelBuilder modelBuilder)
{
IoTSharedDbConfig.OnModelCreating(modelBuilder);
modelBuilder.Entity<LiveRecord>().Property(o => o.DeviceNumber).IsRequired();
modelBuilder.Entity<NodeCategory>().HasIndex(o => o.Name).IsUnique();
modelBuilder.Entity<NodeCategoryNode>().HasOne(o => o.Node).WithMany().HasForeignKey(o => o.NodeId);
modelBuilder.Entity<NodeCategoryNode>().HasOne(o => o.Category).WithMany(o => o.CategoryNodes).HasForeignKey(o => o.CategoryId);
modelBuilder.Entity<NodeCategoryNode>().HasIndex(o => new { o.CategoryId, o.NodeId }).IsUnique();
modelBuilder.Entity<Organ>().Property(o => o.Number).IsRequired();
modelBuilder.Entity<Organ>().HasIndex(o => o.Number).IsUnique();
modelBuilder.Entity<OrganNode>().HasOne(o => o.Organ).WithMany(o => o.OrganNodes).HasForeignKey(o => o.OrganId);
modelBuilder.Entity<OrganNode>().HasOne(o => o.Node).WithMany().HasForeignKey(o => o.NodeId);
modelBuilder.Entity<OrganNode>().HasIndex(o => new { o.OrganId, o.NodeId }).IsUnique();
}
public void Seed(DbContext db)
@ -74,6 +85,9 @@ namespace IoTCenter
set.Add(new Setting { Name = "id", Value = macAddress.Md5(), Type = SettingType.Text });
set.Add(new Setting { Name = "code", Value = "根据id生成的授权码", Type = SettingType.Text });
db.SaveChanges();
//
db.Set<NodeCategory>().Add(new NodeCategory { Name = "智慧教室", Template = "node" });
db.SaveChanges();
}
}
}

@ -37,6 +37,13 @@ CREATE TABLE "iot_NodeCategory" (
"DisplayOrder" INTEGER NOT NULL
);
CREATE TABLE "iot_Organ" (
"Id" TEXT NOT NULL CONSTRAINT "PK_iot_Organ" PRIMARY KEY,
"IsDeleted" TEXT NULL,
"Name" TEXT NULL,
"Number" TEXT NOT NULL
);
CREATE TABLE "iot_PermissionCategory" (
"Id" TEXT NOT NULL CONSTRAINT "PK_iot_PermissionCategory" PRIMARY KEY,
"IsDeleted" TEXT NULL,
@ -106,6 +113,15 @@ CREATE TABLE "iot_NodeCategoryNode" (
CONSTRAINT "FK_iot_NodeCategoryNode_iot_Node_NodeId" FOREIGN KEY ("NodeId") REFERENCES "iot_Node" ("Id") ON DELETE CASCADE
);
CREATE TABLE "iot_OrganNode" (
"Id" TEXT NOT NULL CONSTRAINT "PK_iot_OrganNode" PRIMARY KEY,
"IsDeleted" TEXT NULL,
"OrganId" TEXT NOT NULL,
"NodeId" TEXT NOT NULL,
CONSTRAINT "FK_iot_OrganNode_iot_Node_NodeId" FOREIGN KEY ("NodeId") REFERENCES "iot_Node" ("Id") ON DELETE CASCADE,
CONSTRAINT "FK_iot_OrganNode_iot_Organ_OrganId" FOREIGN KEY ("OrganId") REFERENCES "iot_Organ" ("Id") ON DELETE CASCADE
);
CREATE TABLE "iot_Permission" (
"Id" TEXT NOT NULL CONSTRAINT "PK_iot_Permission" PRIMARY KEY,
"IsDeleted" TEXT NULL,
@ -263,6 +279,12 @@ CREATE INDEX "IX_iot_NodeCategoryNode_NodeId" ON "iot_NodeCategoryNode" ("NodeId
CREATE UNIQUE INDEX "IX_iot_NodeCategoryNode_CategoryId_NodeId" ON "iot_NodeCategoryNode" ("CategoryId", "NodeId");
CREATE UNIQUE INDEX "IX_iot_Organ_Number" ON "iot_Organ" ("Number");
CREATE INDEX "IX_iot_OrganNode_NodeId" ON "iot_OrganNode" ("NodeId");
CREATE UNIQUE INDEX "IX_iot_OrganNode_OrganId_NodeId" ON "iot_OrganNode" ("OrganId", "NodeId");
CREATE INDEX "IX_iot_Parameter_ApiId" ON "iot_Parameter" ("ApiId");
CREATE INDEX "IX_iot_Permission_CategoryId" ON "iot_Permission" ("CategoryId");

@ -78,14 +78,12 @@ namespace IoTNode
set.Add(new Setting { Name = "debug", Value = "false" });
set.Add(new Setting { Name = "notify:enabled", Value = "true" });
set.Add(new Setting { Name = "notify:host", Value = $"http://{host}:8011" });
set.Add(new Setting { Name = "timer.seconds", Value = "300" });
set.Add(new Setting { Name = "timer.seconds", Value = "180" });
set.Add(new Setting { Name = "onvif.timer", Value = "1" });
set.Add(new Setting { Name = "onvif.speed", Value = "0.2" });
set.Add(new Setting { Name = "camera.usr", Value = "admin" });
set.Add(new Setting { Name = "camera.pwd", Value = "dsideal123" });
set.Add(new Setting { Name = "stream.rtmp", Value = stream });
//set.Add(new Setting { Name = "stream.flv", Value = $"{stream}" });
//set.Add(new Setting { Name = "stream.hls", Value = $"{stream}" });
set.Add(new Setting { Name = "ffmpeg.args", Value = " -y -threads {0} -rtsp_transport tcp -use_wallclock_as_timestamps 1 -stimeout 3000000 -i \"{1}\" -fflags +genpts -c copy -f flv \"{2}\"" });
set.Add(new Setting { Name = "fbee.writelist", Value = "" });
set.Add(new Setting { Name = "camera.writelist", Value = "" });

@ -6,15 +6,6 @@ CREATE TABLE "iot_Category" (
"Image" TEXT NULL
);
CREATE TABLE "iot_LiveRecord" (
"Id" TEXT NOT NULL CONSTRAINT "PK_iot_LiveRecord" PRIMARY KEY,
"IsDeleted" TEXT NULL,
"DeviceNumber" TEXT NOT NULL,
"DeviceName" TEXT NULL,
"Name" TEXT NULL,
"Value" TEXT NULL
);
CREATE TABLE "iot_Node" (
"Id" TEXT NOT NULL CONSTRAINT "PK_iot_Node" PRIMARY KEY,
"IsDeleted" TEXT NULL,
@ -29,14 +20,6 @@ CREATE TABLE "iot_Node" (
"Disabled" INTEGER NOT NULL
);
CREATE TABLE "iot_NodeCategory" (
"Id" TEXT NOT NULL CONSTRAINT "PK_iot_NodeCategory" PRIMARY KEY,
"IsDeleted" TEXT NULL,
"Name" TEXT NULL,
"Template" TEXT NULL,
"DisplayOrder" INTEGER NOT NULL
);
CREATE TABLE "iot_PermissionCategory" (
"Id" TEXT NOT NULL CONSTRAINT "PK_iot_PermissionCategory" PRIMARY KEY,
"IsDeleted" TEXT NULL,
@ -97,15 +80,6 @@ CREATE TABLE "iot_Scene" (
CONSTRAINT "FK_iot_Scene_iot_Node_NodeId" FOREIGN KEY ("NodeId") REFERENCES "iot_Node" ("Id") ON DELETE RESTRICT
);
CREATE TABLE "iot_NodeCategoryNode" (
"Id" TEXT NOT NULL CONSTRAINT "PK_iot_NodeCategoryNode" PRIMARY KEY,
"IsDeleted" TEXT NULL,
"CategoryId" TEXT NOT NULL,
"NodeId" TEXT NOT NULL,
CONSTRAINT "FK_iot_NodeCategoryNode_iot_NodeCategory_CategoryId" FOREIGN KEY ("CategoryId") REFERENCES "iot_NodeCategory" ("Id") ON DELETE CASCADE,
CONSTRAINT "FK_iot_NodeCategoryNode_iot_Node_NodeId" FOREIGN KEY ("NodeId") REFERENCES "iot_Node" ("Id") ON DELETE CASCADE
);
CREATE TABLE "iot_Permission" (
"Id" TEXT NOT NULL CONSTRAINT "PK_iot_Permission" PRIMARY KEY,
"IsDeleted" TEXT NULL,
@ -257,12 +231,6 @@ CREATE INDEX "IX_iot_Device_ProductId" ON "iot_Device" ("ProductId");
CREATE UNIQUE INDEX "IX_iot_Node_Number" ON "iot_Node" ("Number");
CREATE UNIQUE INDEX "IX_iot_NodeCategory_Name" ON "iot_NodeCategory" ("Name");
CREATE INDEX "IX_iot_NodeCategoryNode_NodeId" ON "iot_NodeCategoryNode" ("NodeId");
CREATE UNIQUE INDEX "IX_iot_NodeCategoryNode_CategoryId_NodeId" ON "iot_NodeCategoryNode" ("CategoryId", "NodeId");
CREATE INDEX "IX_iot_Parameter_ApiId" ON "iot_Parameter" ("ApiId");
CREATE INDEX "IX_iot_Permission_CategoryId" ON "iot_Permission" ("CategoryId");

@ -23,4 +23,4 @@
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</p>

@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using System.Diagnostics;
namespace JobServer.Pages
{
@ -28,4 +24,4 @@ namespace JobServer.Pages
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
}

@ -7,4 +7,4 @@
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>
</div>

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace JobServer.Pages
@ -19,7 +14,6 @@ namespace JobServer.Pages
public void OnGet()
{
}
}
}
}

@ -5,4 +5,4 @@
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>
<p>Use this page to detail your site's privacy policy.</p>

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace JobServer.Pages
@ -21,4 +16,4 @@ namespace JobServer.Pages
{
}
}
}
}

@ -1,2 +1,2 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

@ -1,3 +1,3 @@
@using JobServer
@namespace JobServer.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

@ -1,3 +1,3 @@
@{
Layout = "_Layout";
}
}

@ -6,4 +6,4 @@
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
}

@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("1.0.0.*")]
[assembly: AssemblyInformationalVersion("1.0.0.428.1")]
[assembly: AssemblyInformationalVersion("1.0.0.428.3")]
Loading…
Cancel
Save