Phase0_Day2_volpro_side
This commit is contained in:
@@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
*接口编写处...
|
||||||
|
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||||||
|
*如: [ApiActionPermission("base_device",Enums.ActionPermissionOptions.Search)]
|
||||||
|
*/
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
|
||||||
|
namespace Warehouse.Controllers
|
||||||
|
{
|
||||||
|
public partial class base_deviceController
|
||||||
|
{
|
||||||
|
private readonly Ibase_deviceService _service;//访问业务代码
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public base_deviceController(
|
||||||
|
Ibase_deviceService service,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(service)
|
||||||
|
{
|
||||||
|
_service = service;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public base_deviceController(
|
||||||
|
Ibase_deviceService service,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(service)
|
||||||
|
{
|
||||||
|
_service = service;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Iwarehouse_regionsService GetRegionService() =>
|
||||||
|
_service.ServiceProvider.GetService<Iwarehouse_regionsService>();
|
||||||
|
private Iwarehouse_devicepointService GetPointService() =>
|
||||||
|
_service.ServiceProvider.GetService<Iwarehouse_devicepointService>();
|
||||||
|
|
||||||
|
/// <summary>区域树 (区域→点位→设备数量)</summary>
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/api/DeviceManager/GetRegionTree")]
|
||||||
|
public async Task<IActionResult> GetRegionTree()
|
||||||
|
{
|
||||||
|
var regions = await GetRegionService().FindAsIQueryable(x => true)
|
||||||
|
.Select(x => new { x.RegionsId, x.RegionsName, x.ParentId })
|
||||||
|
.ToListAsync();
|
||||||
|
var points = await GetPointService().FindAsIQueryable(x => true)
|
||||||
|
.Select(x => new { x.DevicePointId, x.DevicePointName, x.RegionId })
|
||||||
|
.ToListAsync();
|
||||||
|
var deviceCounts = await _service.FindAsIQueryable(x => true)
|
||||||
|
.GroupBy(x => x.PointId)
|
||||||
|
.Select(g => new { PointId = g.Key, Count = g.Count() })
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return Ok(BuildRegionTree(regions, points, deviceCounts));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<RegionTreeNode> BuildRegionTree(
|
||||||
|
List<dynamic> regions, List<dynamic> points, List<dynamic> deviceCounts)
|
||||||
|
{
|
||||||
|
var pointMap = points.GroupBy(p => (int?)p.RegionId)
|
||||||
|
.ToDictionary(g => g.Key ?? 0, g => g.ToList());
|
||||||
|
var countMap = deviceCounts.ToDictionary(c => c.PointId ?? 0, c => c.Count);
|
||||||
|
|
||||||
|
return regions.Where(r => r.ParentId == null || r.ParentId == 0).Select(r =>
|
||||||
|
BuildNode(r, regions, pointMap, countMap)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private RegionTreeNode BuildNode(dynamic region, List<dynamic> allRegions,
|
||||||
|
Dictionary<int, List<dynamic>> pointMap, Dictionary<int, int> countMap)
|
||||||
|
{
|
||||||
|
int rid = (int)region.RegionsId;
|
||||||
|
pointMap.TryGetValue(rid, out var pts);
|
||||||
|
var children = allRegions.Where(r => (int?)r.ParentId == rid).Select(r =>
|
||||||
|
BuildNode(r, allRegions, pointMap, countMap)).ToList();
|
||||||
|
|
||||||
|
var pointNodes = pts?.Select(p => new RegionTreeNode
|
||||||
|
{
|
||||||
|
Id = $"p_{(int)p.DevicePointId}",
|
||||||
|
Label = (string)p.DevicePointName,
|
||||||
|
Type = "point",
|
||||||
|
DeviceCount = countMap.GetValueOrDefault((int)p.DevicePointId, 0)
|
||||||
|
}).ToList() ?? new List<RegionTreeNode>();
|
||||||
|
|
||||||
|
children.AddRange(pointNodes);
|
||||||
|
|
||||||
|
return new RegionTreeNode
|
||||||
|
{
|
||||||
|
Id = $"r_{rid}",
|
||||||
|
Label = (string)region.RegionsName,
|
||||||
|
Type = "region",
|
||||||
|
DeviceCount = children.Sum(c => c.DeviceCount),
|
||||||
|
Children = children
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>点位下设备列表(含子设备)</summary>
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/api/DeviceManager/GetDevicesByPoint")]
|
||||||
|
public async Task<IActionResult> GetDevicesByPoint([FromQuery] int pointId, [FromQuery] int page = 1, [FromQuery] int size = 20)
|
||||||
|
{
|
||||||
|
var query = _service.FindAsIQueryable(x => x.PointId == pointId);
|
||||||
|
var total = await query.CountAsync();
|
||||||
|
var items = await query.Skip((page - 1) * size).Take(size).ToListAsync();
|
||||||
|
return Ok(new { items, total });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>获取网关所管的顶层设备 (供 Register 调用)</summary>
|
||||||
|
internal async Task<List<object>> GetDevicesForGateway(int nodeId)
|
||||||
|
{
|
||||||
|
var items = await _service.FindAsIQueryable(x => x.GatewayNodeId == nodeId && x.ParentDeviceId == null)
|
||||||
|
.Select(x => new {
|
||||||
|
x.DeviceId, x.DeviceName, x.AdapterCode, x.SourceId,
|
||||||
|
x.DeviceCategory, x.DeviceGroup, x.IsParent, x.IsOnline,
|
||||||
|
x.ExtraData
|
||||||
|
}).ToListAsync();
|
||||||
|
return items.Select(x => (object)x).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RegionTreeNode
|
||||||
|
{
|
||||||
|
public string Id { get; set; } = "";
|
||||||
|
public string Label { get; set; } = "";
|
||||||
|
public string Type { get; set; } = "";
|
||||||
|
public int DeviceCount { get; set; }
|
||||||
|
public List<RegionTreeNode> Children { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
/*
|
||||||
|
*接口编写处...
|
||||||
|
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||||||
|
*如: [ApiActionPermission("gateway_nodes",Enums.ActionPermissionOptions.Search)]
|
||||||
|
*/
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
|
||||||
|
namespace Warehouse.Controllers
|
||||||
|
{
|
||||||
|
public partial class gateway_nodesController
|
||||||
|
{
|
||||||
|
private readonly Igateway_nodesService _service;//访问业务代码
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public gateway_nodesController(
|
||||||
|
Igateway_nodesService service,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(service)
|
||||||
|
{
|
||||||
|
_service = service;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public gateway_nodesController(
|
||||||
|
Igateway_nodesService service,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(service)
|
||||||
|
{
|
||||||
|
_service = service;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>A1: 网关注册 (Upsert)</summary>
|
||||||
|
[HttpPost]
|
||||||
|
[Route("/api/gateway/register")]
|
||||||
|
public async Task<IActionResult> RegisterGateway([FromBody] GatewayRegisterRequest req)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(req.NodeCode) || string.IsNullOrEmpty(req.Token))
|
||||||
|
return BadRequest(new { message = "NodeCode and Token required" });
|
||||||
|
|
||||||
|
var existing = await _service.FindAsIQueryable(x => x.NodeCode == req.NodeCode)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
gateway_nodes entity;
|
||||||
|
|
||||||
|
if (existing != null)
|
||||||
|
{
|
||||||
|
// 验证 Token
|
||||||
|
if (existing.NodeToken != req.Token)
|
||||||
|
return StatusCode(401, new { message = "认证失败" });
|
||||||
|
|
||||||
|
entity = existing;
|
||||||
|
entity.AdapterTypes = req.AdapterTypes;
|
||||||
|
entity.BaseUrl = req.BaseUrl;
|
||||||
|
entity.IsOnline = "在线";
|
||||||
|
entity.LastHeartbeat = DateTime.Now;
|
||||||
|
await _service.UpdateAsync(entity);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entity = new gateway_nodes
|
||||||
|
{
|
||||||
|
NodeCode = req.NodeCode,
|
||||||
|
NodeName = req.NodeCode,
|
||||||
|
NodeToken = req.Token,
|
||||||
|
AdapterTypes = req.AdapterTypes,
|
||||||
|
BaseUrl = req.BaseUrl,
|
||||||
|
IsOnline = "在线",
|
||||||
|
LastHeartbeat = DateTime.Now,
|
||||||
|
Enable = "启用",
|
||||||
|
CreateDate = DateTime.Now
|
||||||
|
};
|
||||||
|
await _service.AddAsync(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
var devices = await _service.ServiceProvider.GetService<VolPro.WebApi.Controllers.Warehouse.base_deviceController>()
|
||||||
|
?.GetDevicesForGateway(entity.NodeId) ?? new List<object>();
|
||||||
|
|
||||||
|
return Ok(new { nodeId = entity.NodeId, devices });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>A2: 心跳</summary>
|
||||||
|
[HttpPost]
|
||||||
|
[Route("/api/gateway/heartbeat")]
|
||||||
|
public async Task<IActionResult> GatewayHeartbeat([FromBody] GatewayHeartbeatRequest req)
|
||||||
|
{
|
||||||
|
var entity = await _service.FindAsIQueryable(x => x.NodeCode == req.NodeCode && x.NodeToken == req.Token)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (entity == null)
|
||||||
|
return StatusCode(401, new { message = "认证失败" });
|
||||||
|
|
||||||
|
entity.IsOnline = "在线";
|
||||||
|
entity.LastHeartbeat = DateTime.Now;
|
||||||
|
await _service.UpdateAsync(entity);
|
||||||
|
|
||||||
|
return Ok(new { status = "ok", serverTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>A3: 设备数据同步</summary>
|
||||||
|
[HttpPost]
|
||||||
|
[Route("/api/gateway/sync/devices")]
|
||||||
|
public async Task<IActionResult> SyncDevices([FromBody] SyncDevicesRequest req)
|
||||||
|
{
|
||||||
|
var node = await _service.FindAsIQueryable(x => x.NodeCode == req.NodeCode && x.NodeToken == req.Token)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (node == null) return StatusCode(401, new { message = "认证失败" });
|
||||||
|
|
||||||
|
int added = 0, updated = 0;
|
||||||
|
foreach (var d in req.Devices)
|
||||||
|
{
|
||||||
|
// delegate to base_device service
|
||||||
|
}
|
||||||
|
return Ok(new { added, updated, removed = 0 });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>A4: 告警同步</summary>
|
||||||
|
[HttpPost]
|
||||||
|
[Route("/api/gateway/sync/alarms")]
|
||||||
|
public async Task<IActionResult> SyncAlarms([FromBody] SyncAlarmsRequest req)
|
||||||
|
{
|
||||||
|
var node = await _service.FindAsIQueryable(x => x.NodeCode == req.NodeCode && x.NodeToken == req.Token)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (node == null) return StatusCode(401, new { message = "认证失败" });
|
||||||
|
|
||||||
|
int added = 0;
|
||||||
|
foreach (var a in req.Alarms)
|
||||||
|
{
|
||||||
|
var alarm = new iot_alarm
|
||||||
|
{
|
||||||
|
SourceAlarmId = a.SourceAlarmId,
|
||||||
|
DeviceId = null, // resolved later
|
||||||
|
AdapterCode = a.AdapterCode,
|
||||||
|
AlarmLevel = a.Level,
|
||||||
|
AlarmDesc = a.Desc,
|
||||||
|
AlarmValue = a.Value,
|
||||||
|
StartTime = DateTime.Parse(a.StartTime),
|
||||||
|
State = "未确认",
|
||||||
|
CreateDate = DateTime.Now
|
||||||
|
};
|
||||||
|
await _service.ServiceProvider.GetService<IIoT_AlarmService>()?.AddAsync(alarm);
|
||||||
|
added++;
|
||||||
|
}
|
||||||
|
return Ok(new { added });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GatewayRegisterRequest
|
||||||
|
{
|
||||||
|
public string NodeCode { get; set; } = "";
|
||||||
|
public string Token { get; set; } = "";
|
||||||
|
public string AdapterTypes { get; set; } = "";
|
||||||
|
public string BaseUrl { get; set; } = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GatewayHeartbeatRequest
|
||||||
|
{
|
||||||
|
public string NodeCode { get; set; } = "";
|
||||||
|
public string Token { get; set; } = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SyncDevicesRequest
|
||||||
|
{
|
||||||
|
public string NodeCode { get; set; } = "";
|
||||||
|
public string Token { get; set; } = "";
|
||||||
|
public List<SyncDeviceItem> Devices { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SyncDeviceItem
|
||||||
|
{
|
||||||
|
public string AdapterCode { get; set; } = "";
|
||||||
|
public string SourceId { get; set; } = "";
|
||||||
|
public string Name { get; set; } = "";
|
||||||
|
public string Category { get; set; } = "";
|
||||||
|
public string Group { get; set; } = "";
|
||||||
|
public bool IsParent { get; set; }
|
||||||
|
public string? ParentSourceId { get; set; }
|
||||||
|
public bool IsOnline { get; set; }
|
||||||
|
public string? IpAddress { get; set; }
|
||||||
|
public int? Port { get; set; }
|
||||||
|
public Dictionary<string, object?>? ExtraData { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SyncAlarmsRequest
|
||||||
|
{
|
||||||
|
public string NodeCode { get; set; } = "";
|
||||||
|
public string Token { get; set; } = "";
|
||||||
|
public List<SyncAlarmItem> Alarms { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SyncAlarmItem
|
||||||
|
{
|
||||||
|
public string SourceAlarmId { get; set; } = "";
|
||||||
|
public string DeviceSourceId { get; set; } = "";
|
||||||
|
public string AdapterCode { get; set; } = "";
|
||||||
|
public string Level { get; set; } = "";
|
||||||
|
public string Desc { get; set; } = "";
|
||||||
|
public double? Value { get; set; }
|
||||||
|
public string StartTime { get; set; } = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
*接口编写处...
|
||||||
|
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||||||
|
*如: [ApiActionPermission("iot_alarm",Enums.ActionPermissionOptions.Search)]
|
||||||
|
*/
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
|
||||||
|
namespace Warehouse.Controllers
|
||||||
|
{
|
||||||
|
public partial class iot_alarmController
|
||||||
|
{
|
||||||
|
private readonly Iiot_alarmService _service;//访问业务代码
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public iot_alarmController(
|
||||||
|
Iiot_alarmService service,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(service)
|
||||||
|
{
|
||||||
|
_service = service;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
*接口编写处...
|
||||||
|
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||||||
|
*如: [ApiActionPermission("iot_devicedata",Enums.ActionPermissionOptions.Search)]
|
||||||
|
*/
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
|
||||||
|
namespace Warehouse.Controllers
|
||||||
|
{
|
||||||
|
public partial class iot_devicedataController
|
||||||
|
{
|
||||||
|
private readonly Iiot_devicedataService _service;//访问业务代码
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public iot_devicedataController(
|
||||||
|
Iiot_devicedataService service,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(service)
|
||||||
|
{
|
||||||
|
_service = service;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
*接口编写处...
|
||||||
|
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||||||
|
*如: [ApiActionPermission("video_channel",Enums.ActionPermissionOptions.Search)]
|
||||||
|
*/
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
|
||||||
|
namespace Warehouse.Controllers
|
||||||
|
{
|
||||||
|
public partial class video_channelController
|
||||||
|
{
|
||||||
|
private readonly Ivideo_channelService _service;//访问业务代码
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public video_channelController(
|
||||||
|
Ivideo_channelService service,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(service)
|
||||||
|
{
|
||||||
|
_service = service;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
*接口编写处...
|
||||||
|
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||||||
|
*如: [ApiActionPermission("video_record",Enums.ActionPermissionOptions.Search)]
|
||||||
|
*/
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
|
||||||
|
namespace Warehouse.Controllers
|
||||||
|
{
|
||||||
|
public partial class video_recordController
|
||||||
|
{
|
||||||
|
private readonly Ivideo_recordService _service;//访问业务代码
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public video_recordController(
|
||||||
|
Ivideo_recordService service,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(service)
|
||||||
|
{
|
||||||
|
_service = service;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
53
api_sqlsugar/Warehouse/Services/GatewayClient.cs
Normal file
53
api_sqlsugar/Warehouse/Services/GatewayClient.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace VolPro.Warehouse.Services;
|
||||||
|
|
||||||
|
public class GatewayClient
|
||||||
|
{
|
||||||
|
private readonly HttpClient _http;
|
||||||
|
private readonly IConfiguration _config;
|
||||||
|
|
||||||
|
public GatewayClient(IHttpClientFactory factory, IConfiguration config)
|
||||||
|
{
|
||||||
|
_http = factory.CreateClient("IntegrationGateway");
|
||||||
|
_config = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>检查网关健康状态</summary>
|
||||||
|
public async Task<Dictionary<string, bool>?> HealthCheckAsync(string gatewayBaseUrl)
|
||||||
|
{
|
||||||
|
var resp = await _http.GetAsync($"{gatewayBaseUrl}/api/gateway/health");
|
||||||
|
resp.EnsureSuccessStatusCode();
|
||||||
|
var json = await resp.Content.ReadAsStringAsync();
|
||||||
|
return JsonSerializer.Deserialize<GatewayHealth>(json)?.Adapters;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>获取实时数据</summary>
|
||||||
|
public async Task<string> GetRealtimeAsync(string gatewayBaseUrl, string adapter, string deviceId)
|
||||||
|
{
|
||||||
|
var resp = await _http.GetAsync($"{gatewayBaseUrl}/api/gateway/realtime/{adapter}/{deviceId}");
|
||||||
|
resp.EnsureSuccessStatusCode();
|
||||||
|
return await resp.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>设备控制</summary>
|
||||||
|
public async Task ControlDeviceAsync(string gatewayBaseUrl, string adapter, string deviceId, int pointIndex, double value)
|
||||||
|
{
|
||||||
|
var resp = await _http.PostAsJsonAsync($"{gatewayBaseUrl}/api/gateway/realtime/{adapter}/control", new
|
||||||
|
{
|
||||||
|
deviceSourceId = deviceId,
|
||||||
|
pointIndex,
|
||||||
|
value
|
||||||
|
});
|
||||||
|
resp.EnsureSuccessStatusCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class GatewayHealth
|
||||||
|
{
|
||||||
|
public string Gateway { get; set; } = "";
|
||||||
|
public Dictionary<string, bool> Adapters { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
26
api_sqlsugar/Warehouse/Services/HeartbeatMonitorJob.cs
Normal file
26
api_sqlsugar/Warehouse/Services/HeartbeatMonitorJob.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using Quartz;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace VolPro.Warehouse.Services;
|
||||||
|
|
||||||
|
public class HeartbeatMonitorJob : IJob
|
||||||
|
{
|
||||||
|
public async Task Execute(IJobExecutionContext context)
|
||||||
|
{
|
||||||
|
var sp = (IServiceProvider)context.JobDetail.JobDataMap["ServiceProvider"];
|
||||||
|
var gwSvc = sp.GetService<Igateway_nodesService>();
|
||||||
|
var devSvc = sp.GetService<Ibase_deviceService>();
|
||||||
|
|
||||||
|
var timeout = DateTime.Now.AddSeconds(-30);
|
||||||
|
var offlineNodes = await gwSvc.FindAsIQueryable(x => x.IsOnline == "在线" && x.LastHeartbeat < timeout)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
foreach (var node in offlineNodes)
|
||||||
|
{
|
||||||
|
node.IsOnline = "离线";
|
||||||
|
await gwSvc.UpdateAsync(node);
|
||||||
|
await devSvc.UpdateAsync(x => x.GatewayNodeId == node.NodeId,
|
||||||
|
x => new base_device { IsOnline = "离线" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
api_sqlsugar/Warehouse/Services/SyncDevicesJob.cs
Normal file
27
api_sqlsugar/Warehouse/Services/SyncDevicesJob.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using Quartz;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace VolPro.Warehouse.Services;
|
||||||
|
|
||||||
|
public class SyncDevicesJob : IJob
|
||||||
|
{
|
||||||
|
public async Task Execute(IJobExecutionContext context)
|
||||||
|
{
|
||||||
|
var sp = (IServiceProvider)context.JobDetail.JobDataMap["ServiceProvider"];
|
||||||
|
var gwSvc = sp.GetService<Igateway_nodesService>();
|
||||||
|
var httpFactory = sp.GetService<IHttpClientFactory>();
|
||||||
|
|
||||||
|
var onlineNodes = await gwSvc.FindAsIQueryable(x => x.IsOnline == "在线" && x.Enable == "启用" && x.BaseUrl != null)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
foreach (var node in onlineNodes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var http = httpFactory.CreateClient();
|
||||||
|
await http.PostAsync($"{node.BaseUrl}/api/gateway/devices/sync?adapter={node.AdapterTypes}", null);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
*所有关于base_device类的业务代码应在此处编写
|
||||||
|
*可使用repository.调用常用方法,获取EF/Dapper等信息
|
||||||
|
*如果需要事务请使用repository.DbContextBeginTransaction
|
||||||
|
*也可使用DBServerProvider.手动获取数据库相关信息
|
||||||
|
*用户信息、权限、角色等使用UserContext.Current操作
|
||||||
|
*base_deviceService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter
|
||||||
|
*/
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using System.Linq;
|
||||||
|
using VolPro.Core.Utilities;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using VolPro.Core.Extensions;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class base_deviceService
|
||||||
|
{
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly Ibase_deviceRepository _repository;//访问数据库
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public base_deviceService(
|
||||||
|
Ibase_deviceRepository dbRepository,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(dbRepository)
|
||||||
|
{
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_repository = dbRepository;
|
||||||
|
//多租户会用到这init代码,其他情况可以不用
|
||||||
|
//base.Init(dbRepository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
*所有关于gateway_nodes类的业务代码应在此处编写
|
||||||
|
*可使用repository.调用常用方法,获取EF/Dapper等信息
|
||||||
|
*如果需要事务请使用repository.DbContextBeginTransaction
|
||||||
|
*也可使用DBServerProvider.手动获取数据库相关信息
|
||||||
|
*用户信息、权限、角色等使用UserContext.Current操作
|
||||||
|
*gateway_nodesService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter
|
||||||
|
*/
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using System.Linq;
|
||||||
|
using VolPro.Core.Utilities;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using VolPro.Core.Extensions;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class gateway_nodesService
|
||||||
|
{
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly Igateway_nodesRepository _repository;//访问数据库
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public gateway_nodesService(
|
||||||
|
Igateway_nodesRepository dbRepository,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(dbRepository)
|
||||||
|
{
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_repository = dbRepository;
|
||||||
|
//多租户会用到这init代码,其他情况可以不用
|
||||||
|
//base.Init(dbRepository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
*所有关于iot_alarm类的业务代码应在此处编写
|
||||||
|
*可使用repository.调用常用方法,获取EF/Dapper等信息
|
||||||
|
*如果需要事务请使用repository.DbContextBeginTransaction
|
||||||
|
*也可使用DBServerProvider.手动获取数据库相关信息
|
||||||
|
*用户信息、权限、角色等使用UserContext.Current操作
|
||||||
|
*iot_alarmService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter
|
||||||
|
*/
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using System.Linq;
|
||||||
|
using VolPro.Core.Utilities;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using VolPro.Core.Extensions;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class iot_alarmService
|
||||||
|
{
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly Iiot_alarmRepository _repository;//访问数据库
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public iot_alarmService(
|
||||||
|
Iiot_alarmRepository dbRepository,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(dbRepository)
|
||||||
|
{
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_repository = dbRepository;
|
||||||
|
//多租户会用到这init代码,其他情况可以不用
|
||||||
|
//base.Init(dbRepository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
*所有关于iot_devicedata类的业务代码应在此处编写
|
||||||
|
*可使用repository.调用常用方法,获取EF/Dapper等信息
|
||||||
|
*如果需要事务请使用repository.DbContextBeginTransaction
|
||||||
|
*也可使用DBServerProvider.手动获取数据库相关信息
|
||||||
|
*用户信息、权限、角色等使用UserContext.Current操作
|
||||||
|
*iot_devicedataService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter
|
||||||
|
*/
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using System.Linq;
|
||||||
|
using VolPro.Core.Utilities;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using VolPro.Core.Extensions;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class iot_devicedataService
|
||||||
|
{
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly Iiot_devicedataRepository _repository;//访问数据库
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public iot_devicedataService(
|
||||||
|
Iiot_devicedataRepository dbRepository,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(dbRepository)
|
||||||
|
{
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_repository = dbRepository;
|
||||||
|
//多租户会用到这init代码,其他情况可以不用
|
||||||
|
//base.Init(dbRepository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
*所有关于video_channel类的业务代码应在此处编写
|
||||||
|
*可使用repository.调用常用方法,获取EF/Dapper等信息
|
||||||
|
*如果需要事务请使用repository.DbContextBeginTransaction
|
||||||
|
*也可使用DBServerProvider.手动获取数据库相关信息
|
||||||
|
*用户信息、权限、角色等使用UserContext.Current操作
|
||||||
|
*video_channelService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter
|
||||||
|
*/
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using System.Linq;
|
||||||
|
using VolPro.Core.Utilities;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using VolPro.Core.Extensions;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class video_channelService
|
||||||
|
{
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly Ivideo_channelRepository _repository;//访问数据库
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public video_channelService(
|
||||||
|
Ivideo_channelRepository dbRepository,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(dbRepository)
|
||||||
|
{
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_repository = dbRepository;
|
||||||
|
//多租户会用到这init代码,其他情况可以不用
|
||||||
|
//base.Init(dbRepository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
*所有关于video_record类的业务代码应在此处编写
|
||||||
|
*可使用repository.调用常用方法,获取EF/Dapper等信息
|
||||||
|
*如果需要事务请使用repository.DbContextBeginTransaction
|
||||||
|
*也可使用DBServerProvider.手动获取数据库相关信息
|
||||||
|
*用户信息、权限、角色等使用UserContext.Current操作
|
||||||
|
*video_recordService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter
|
||||||
|
*/
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
using System.Linq;
|
||||||
|
using VolPro.Core.Utilities;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using VolPro.Core.Extensions;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class video_recordService
|
||||||
|
{
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly Ivideo_recordRepository _repository;//访问数据库
|
||||||
|
|
||||||
|
[ActivatorUtilitiesConstructor]
|
||||||
|
public video_recordService(
|
||||||
|
Ivideo_recordRepository dbRepository,
|
||||||
|
IHttpContextAccessor httpContextAccessor
|
||||||
|
)
|
||||||
|
: base(dbRepository)
|
||||||
|
{
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_repository = dbRepository;
|
||||||
|
//多租户会用到这init代码,其他情况可以不用
|
||||||
|
//base.Init(dbRepository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
*Author:jxx
|
||||||
|
*Contact:283591387@qq.com
|
||||||
|
*代码由框架生成,此处任何更改都可能导致被代码生成器覆盖
|
||||||
|
*所有业务编写全部应在Partial文件夹下base_deviceService与Ibase_deviceService中编写
|
||||||
|
*/
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class base_deviceService : ServiceBase<base_device, Ibase_deviceRepository>
|
||||||
|
, Ibase_deviceService, IDependency
|
||||||
|
{
|
||||||
|
public static Ibase_deviceService Instance
|
||||||
|
{
|
||||||
|
get { return AutofacContainerModule.GetService<Ibase_deviceService>(); } }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
*Author:jxx
|
||||||
|
*Contact:283591387@qq.com
|
||||||
|
*代码由框架生成,此处任何更改都可能导致被代码生成器覆盖
|
||||||
|
*所有业务编写全部应在Partial文件夹下gateway_nodesService与Igateway_nodesService中编写
|
||||||
|
*/
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class gateway_nodesService : ServiceBase<gateway_nodes, Igateway_nodesRepository>
|
||||||
|
, Igateway_nodesService, IDependency
|
||||||
|
{
|
||||||
|
public static Igateway_nodesService Instance
|
||||||
|
{
|
||||||
|
get { return AutofacContainerModule.GetService<Igateway_nodesService>(); } }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
*Author:jxx
|
||||||
|
*Contact:283591387@qq.com
|
||||||
|
*代码由框架生成,此处任何更改都可能导致被代码生成器覆盖
|
||||||
|
*所有业务编写全部应在Partial文件夹下iot_alarmService与Iiot_alarmService中编写
|
||||||
|
*/
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class iot_alarmService : ServiceBase<iot_alarm, Iiot_alarmRepository>
|
||||||
|
, Iiot_alarmService, IDependency
|
||||||
|
{
|
||||||
|
public static Iiot_alarmService Instance
|
||||||
|
{
|
||||||
|
get { return AutofacContainerModule.GetService<Iiot_alarmService>(); } }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
*Author:jxx
|
||||||
|
*Contact:283591387@qq.com
|
||||||
|
*代码由框架生成,此处任何更改都可能导致被代码生成器覆盖
|
||||||
|
*所有业务编写全部应在Partial文件夹下iot_devicedataService与Iiot_devicedataService中编写
|
||||||
|
*/
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class iot_devicedataService : ServiceBase<iot_devicedata, Iiot_devicedataRepository>
|
||||||
|
, Iiot_devicedataService, IDependency
|
||||||
|
{
|
||||||
|
public static Iiot_devicedataService Instance
|
||||||
|
{
|
||||||
|
get { return AutofacContainerModule.GetService<Iiot_devicedataService>(); } }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
*Author:jxx
|
||||||
|
*Contact:283591387@qq.com
|
||||||
|
*代码由框架生成,此处任何更改都可能导致被代码生成器覆盖
|
||||||
|
*所有业务编写全部应在Partial文件夹下video_channelService与Ivideo_channelService中编写
|
||||||
|
*/
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class video_channelService : ServiceBase<video_channel, Ivideo_channelRepository>
|
||||||
|
, Ivideo_channelService, IDependency
|
||||||
|
{
|
||||||
|
public static Ivideo_channelService Instance
|
||||||
|
{
|
||||||
|
get { return AutofacContainerModule.GetService<Ivideo_channelService>(); } }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
*Author:jxx
|
||||||
|
*Contact:283591387@qq.com
|
||||||
|
*代码由框架生成,此处任何更改都可能导致被代码生成器覆盖
|
||||||
|
*所有业务编写全部应在Partial文件夹下video_recordService与Ivideo_recordService中编写
|
||||||
|
*/
|
||||||
|
using Warehouse.IRepositories;
|
||||||
|
using Warehouse.IServices;
|
||||||
|
using VolPro.Core.BaseProvider;
|
||||||
|
using VolPro.Core.Extensions.AutofacManager;
|
||||||
|
using VolPro.Entity.DomainModels;
|
||||||
|
|
||||||
|
namespace Warehouse.Services
|
||||||
|
{
|
||||||
|
public partial class video_recordService : ServiceBase<video_record, Ivideo_recordRepository>
|
||||||
|
, Ivideo_recordService, IDependency
|
||||||
|
{
|
||||||
|
public static Ivideo_recordService Instance
|
||||||
|
{
|
||||||
|
get { return AutofacContainerModule.GetService<Ivideo_recordService>(); } }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user