Former-commit-id: f155dd08f280654b112be48f6db9788e01120580
TangShanKaiPing
wanggang 6 years ago
parent 4876dc3984
commit 4a02b5d0aa

@ -21,11 +21,11 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" /> <PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.0.0-rc1.final" /> <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.0.0-rc1.final" />
<PackageReference Include="Serilog.AspNetCore" Version="3.0.0" /> <PackageReference Include="Serilog.AspNetCore" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" /> <PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="DotNetCore.NPOI" Version="1.2.2" /> <PackageReference Include="DotNetCore.NPOI" Version="1.2.2" />
<PackageReference Include="HtmlAgilityPack.NetCore" Version="1.5.0.1" /> <PackageReference Include="HtmlAgilityPack.NetCore" Version="1.5.0.1" />
<PackageReference Include="MailKit" Version="2.3.1.6" /> <PackageReference Include="MailKit" Version="2.3.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" /> <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" /> <PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />

@ -5,6 +5,7 @@ using Infrastructure.Extensions;
using Infrastructure.Web.SignalR; using Infrastructure.Web.SignalR;
using IoT.Shared.Services; using IoT.Shared.Services;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -143,7 +144,8 @@ namespace IoTCenter.Services
{ {
var model = message.FromJson<EditNodeModel>(); var model = message.FromJson<EditNodeModel>();
this._dataService.Edit<Node, EditNodeModel>(model); this._dataService.Edit<Node, EditNodeModel>(model);
this.Clients.Group("page").SendAsync(method, message); //
this.Clients.Group("page").SendAsync("UpdateNode", model.ToJson());
} }
else if (method == Methods.EditDeviceResponse) else if (method == Methods.EditDeviceResponse)
{ {
@ -155,10 +157,13 @@ namespace IoTCenter.Services
var model = message.FromJson<EditDeviceModel>(); var model = message.FromJson<EditDeviceModel>();
this._dataService.Delete<Device, EditDeviceModel>(model); this._dataService.Delete<Device, EditDeviceModel>(model);
} }
else if (method == Methods.EditDataResponse) else if (method == Methods.EditDataResponse)//后台编辑或设备上报
{ {
var model = message.FromJson<EditDataModel>(); var model = message.FromJson<EditDataModel>();
this._dataService.Edit<Data, EditDataModel>(model); this._dataService.Edit<Data, EditDataModel>(model);
//
var device = _deviceRepo.ReadOnlyTable().Include(o => o.Data).Where(o => o.Id == model.DeviceId).FirstOrDefault();
this.Clients.Group("page").SendAsync("UpdateDevice", device.ToJson());
} }
else if (method == Methods.DeleteDataResponse) else if (method == Methods.DeleteDataResponse)
{ {
@ -213,27 +218,6 @@ namespace IoTCenter.Services
} }
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:不捕获常规异常类型", Justification = "<挂起>")]
private void DeleteData(string message)
{
try
{
Console.WriteLine("iot center> receive delete data message");
var model = message.FromJson<EditDataModel>();
var data = _dataRepo.Table().FirstOrDefault(o => o.Device.Id == model.DeviceId && o.Id == model.Id);
if (data != null)
{
_dataRepo.Delete(data);
_dataRepo.SaveChanges();
this.Clients.Group("page").SendAsync("DeleteData", message);
}
}
catch (Exception ex)
{
ex.PrintStack();
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:不捕获常规异常类型", Justification = "<挂起>")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:不捕获常规异常类型", Justification = "<挂起>")]
private void UpdateScene(string message) private void UpdateScene(string message)
{ {

@ -8,7 +8,7 @@ namespace IoTCenter.Services
{ {
public static void ServerToClient(this IHubContext<IoTCenterHub> hub, string group, string method, object arg, string fromConnectionId = null) public static void ServerToClient(this IHubContext<IoTCenterHub> hub, string group, string method, object arg, string fromConnectionId = null)
{ {
hub.Clients.Group(group).SendAsync(Methods.ServerToClient, method, arg.ToJson(), fromConnectionId); hub?.Clients.Group(group).SendAsync(Methods.ServerToClient, method, arg.ToJson(), fromConnectionId);
} }
} }
} }

@ -7,7 +7,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.3" /> <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1,6 +1,6 @@
using Application.Models; using Application.Models;
using Infrastructure.Extensions; using Infrastructure.Extensions;
using IoTNode.Services.DeviceServices.FBee; using IoTNode.DeviceServices.FBee;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System;

@ -1,5 +1,5 @@
using Application.Models; using Application.Models;
using IoTNode.Services.DeviceServices.FBee; using IoTNode.DeviceServices.FBee;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System;

@ -1,5 +1,5 @@
using Application.Models; using Application.Models;
using IoTNode.Services.DeviceServices.FBee; using IoTNode.DeviceServices.FBee;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System;

@ -1,5 +1,5 @@
using Application.Models; using Application.Models;
using IoTNode.Services.DeviceServices.FBee; using IoTNode.DeviceServices.FBee;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System;

@ -1,4 +1,4 @@
using IoTNode.Services.DeviceServices.FBee; using IoTNode.DeviceServices.FBee;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System;

@ -1,5 +1,5 @@
using Application.Models; using Application.Models;
using IoTNode.Services.DeviceServices.FBee; using IoTNode.DeviceServices.FBee;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System;

@ -1,5 +1,5 @@
using Application.Models; using Application.Models;
using IoTNode.Services.DeviceServices.FBee; using IoTNode.DeviceServices.FBee;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System;

@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System;
using IoTNode.Services.DeviceServices.FBee; using IoTNode.DeviceServices.FBee;
namespace IoTNode.Controllers namespace IoTNode.Controllers
{ {

@ -1,5 +1,5 @@
using Application.Models; using Application.Models;
using IoTNode.Services.DeviceServices.Onvif; using IoTNode.DeviceServices.Onvif;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System;

@ -1,5 +1,5 @@
using Application.Models; using Application.Models;
using IoTNode.Services.DeviceServices.SerialPort; using IoTNode.DeviceServices.SerialPort;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System;

@ -11,7 +11,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace IoTNode.Services.DeviceServices namespace IoTNode.DeviceServices
{ {
public abstract class BaseDeviceService : IHostedService public abstract class BaseDeviceService : IHostedService
{ {

@ -1,4 +1,4 @@
namespace IoTNode.Services.DeviceServices.FBee namespace IoTNode.DeviceServices.FBee
{ {
public enum ClusterId public enum ClusterId
{ {

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace IoTNode.Services.DeviceServices.FBee namespace IoTNode.DeviceServices.FBee
{ {
public class DeviceId public class DeviceId
{ {

@ -1,4 +1,4 @@
namespace IoTNode.Services.DeviceServices.FBee namespace IoTNode.DeviceServices.FBee
{ {
public enum FBeeDataType public enum FBeeDataType
{ {

@ -20,7 +20,7 @@ using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace IoTNode.Services.DeviceServices.FBee namespace IoTNode.DeviceServices.FBee
{ {
public class FBeeService : BaseDeviceService public class FBeeService : BaseDeviceService
{ {

@ -1,4 +1,4 @@
namespace IoTNode.Services.DeviceServices.FBee namespace IoTNode.DeviceServices.FBee
{ {
public static class Keys public static class Keys
{ {

@ -1,4 +1,4 @@
namespace IoTNode.Services.DeviceServices.FBee namespace IoTNode.DeviceServices.FBee
{ {
public static class RequestType public static class RequestType
{ {

@ -1,4 +1,4 @@
namespace IoTNode.Services.DeviceServices.FBee namespace IoTNode.DeviceServices.FBee
{ {
public static class ResponseType public static class ResponseType
{ {

@ -1,6 +1,6 @@
using System.Net.Sockets; using System.Net.Sockets;
namespace IoTNode.Services.DeviceServices.FBee namespace IoTNode.DeviceServices.FBee
{ {
public class TcpClientWrapper public class TcpClientWrapper
{ {

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace IoTNode.Services.DeviceServices.Onvif namespace IoTNode.DeviceServices.Onvif
{ {
public interface IOnvifDeviceManagement public interface IOnvifDeviceManagement
{ {

@ -5,7 +5,7 @@ using System.Net;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Xml.Linq; using System.Xml.Linq;
namespace IoTNode.Services.DeviceServices.Onvif namespace IoTNode.DeviceServices.Onvif
{ {
public class IPCamera public class IPCamera
{ {

@ -1,4 +1,4 @@
namespace IoTNode.Services.DeviceServices.Onvif namespace IoTNode.DeviceServices.Onvif
{ {
public static class MessageTemplate public static class MessageTemplate
{ {

@ -13,7 +13,7 @@ using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace IoTNode.Services.DeviceServices.Onvif namespace IoTNode.DeviceServices.Onvif
{ {
public class OnvifDeviceManagement : IOnvifDeviceManagement public class OnvifDeviceManagement : IOnvifDeviceManagement
{ {

@ -21,7 +21,7 @@ using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace IoTNode.Services.DeviceServices.Onvif namespace IoTNode.DeviceServices.Onvif
{ {
public class OnvifService : BaseDeviceService public class OnvifService : BaseDeviceService
{ {

@ -1,4 +1,4 @@
namespace IoTNode.Services.DeviceServices.Onvif namespace IoTNode.DeviceServices.Onvif
{ {
public class Profile public class Profile
{ {

@ -15,7 +15,7 @@ using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace IoTNode.Services.DeviceServices.SerialPort namespace IoTNode.DeviceServices.SerialPort
{ {
public class SerialPortService : BaseDeviceService public class SerialPortService : BaseDeviceService
{ {

@ -4,8 +4,8 @@ using Infrastructure.Extensions;
using IoT.Shared.Services; using IoT.Shared.Services;
using IoT.UI.Shard; using IoT.UI.Shard;
using IoTNode.Services; using IoTNode.Services;
using IoTNode.Services.DeviceServices.FBee; using IoTNode.DeviceServices.FBee;
using IoTNode.Services.DeviceServices.Onvif; using IoTNode.DeviceServices.Onvif;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;

@ -9,12 +9,12 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="AspNet.Security.OAuth.GitHub" Version="2.1.0" /> <PackageReference Include="AspNet.Security.OAuth.GitHub" Version="3.0.0" />
<PackageReference Include="AspNet.Security.OAuth.QQ" Version="2.1.0" /> <PackageReference Include="AspNet.Security.OAuth.QQ" Version="3.0.0" />
<PackageReference Include="FaceRecognitionDotNet" Version="1.2.3.13" /> <PackageReference Include="FaceRecognitionDotNet" Version="1.2.3.13" />
<PackageReference Include="IdentityServer4" Version="3.0.1" /> <PackageReference Include="IdentityServer4" Version="3.0.1" />
<PackageReference Include="IdentityServer4.EntityFramework" Version="3.0.1" /> <PackageReference Include="IdentityServer4.EntityFramework" Version="3.0.1" />
<PackageReference Include="RavenDB.Embedded" Version="4.2.3" /> <PackageReference Include="RavenDB.Embedded" Version="4.2.4" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" /> <ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />

Loading…
Cancel
Save