车间服务
This commit is contained in:
parent
97f4e12583
commit
7e07cd5117
@ -1 +1 @@
|
|||||||
Subproject commit 389b858c61d7202d3d3988a23a93a5a47df5273b
|
Subproject commit 59bd271ad62f7fd3ff0d95a761f40209bcc6d438
|
||||||
@ -50,7 +50,8 @@
|
|||||||
"AutomaticTelematicsModuleTime": "17:30:00",
|
"AutomaticTelematicsModuleTime": "17:30:00",
|
||||||
"AutomaticDayFreezeTime": "02:30:00",
|
"AutomaticDayFreezeTime": "02:30:00",
|
||||||
"AutomaticMonthFreezeTime": "03:30:00",
|
"AutomaticMonthFreezeTime": "03:30:00",
|
||||||
"DefaultProtocolPlugin": "T37612012ProtocolPlugin"
|
"DefaultProtocolPlugin": "T37612012ProtocolPlugin",
|
||||||
|
"VerifySignatureToken": "SIcPQnpMgaFDmNlIjNmzq5smshz7cKrh"
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Audience": "JiShe.IoT",
|
"Audience": "JiShe.IoT",
|
||||||
|
|||||||
@ -69,7 +69,8 @@
|
|||||||
"AutomaticTelematicsModuleTime": "17:30:00",
|
"AutomaticTelematicsModuleTime": "17:30:00",
|
||||||
"AutomaticDayFreezeTime": "02:30:00",
|
"AutomaticDayFreezeTime": "02:30:00",
|
||||||
"AutomaticMonthFreezeTime": "03:30:00",
|
"AutomaticMonthFreezeTime": "03:30:00",
|
||||||
"DefaultProtocolPlugin": "T37612012ProtocolPlugin"
|
"DefaultProtocolPlugin": "T37612012ProtocolPlugin",
|
||||||
|
"VerifySignatureToken": "SIcPQnpMgaFDmNlIjNmzq5smshz7cKrh"
|
||||||
},
|
},
|
||||||
"OneNETSecureReceiveOptions": {
|
"OneNETSecureReceiveOptions": {
|
||||||
"OneNETVerifySignatureToken": "SIcPQnpMgaFDmNlIjNmzq5smshz7cKrh",
|
"OneNETVerifySignatureToken": "SIcPQnpMgaFDmNlIjNmzq5smshz7cKrh",
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.IoT.CommonServices.Dto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 生产设备
|
|
||||||
/// </summary>
|
|
||||||
public class ProductionEquipmentInput
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 用于计算签名字符的随机串
|
|
||||||
/// </summary>
|
|
||||||
public string Nonce { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加密签名,用以校验推送客户端身份合法性,校验方法见实例验证
|
|
||||||
/// </summary>
|
|
||||||
public string Signature { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 签名有效期(毫秒)
|
|
||||||
/// </summary>
|
|
||||||
public long Timestamp { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 消息内容,JSON字符串,具体的设备相关信息
|
|
||||||
/// </summary>
|
|
||||||
[JsonPropertyName("msg")]
|
|
||||||
public string Message { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -26,12 +26,5 @@ namespace JiShe.IoT.CommonServices
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<SelectResult> GetSelectResultList(SelectResultListInput input);
|
List<SelectResult> GetSelectResultList(SelectResultListInput input);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 接收车间生产设备信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task ReceiveWorkshopProductionEquipment(ProductionEquipmentInput input);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
using JiShe.ServicePro;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace JiShe.IoT.Workshop.Dto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生产车间获取OneNET产品列表
|
||||||
|
/// </summary>
|
||||||
|
public class OneNetWorkshopProductListInput : OpenApiRequest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
using JiShe.ServicePro;
|
||||||
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace JiShe.IoT.Workshop.Dto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生产车间获取OneNET产品列表
|
||||||
|
/// </summary>
|
||||||
|
public class OneNetWorkshopProductListOutput: OpenApiRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// OneNET账户Id
|
||||||
|
/// </summary>
|
||||||
|
[SwaggerSchema("OneNET账户Id")]
|
||||||
|
public string OneNETAccountId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物联网平台对应的产品Id
|
||||||
|
/// </summary>
|
||||||
|
[SwaggerSchema("物联网平台对应的产品Id")]
|
||||||
|
public string IoTPlatformProductId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品名称
|
||||||
|
/// </summary>
|
||||||
|
[SwaggerSchema("产品名称")]
|
||||||
|
public string ProductName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品访问密钥
|
||||||
|
/// </summary>
|
||||||
|
[SwaggerSchema("产品访问密钥")]
|
||||||
|
public string ProductAccesskey { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通讯服务地址
|
||||||
|
/// </summary>
|
||||||
|
[SwaggerSchema("通讯服务地址")]
|
||||||
|
public string CommunicationAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// TLS通讯服务地址
|
||||||
|
/// </summary>
|
||||||
|
[SwaggerSchema("TLS通讯服务地址")]
|
||||||
|
public string CommunicationAddressTLS { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
using JiShe.ServicePro;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace JiShe.IoT.Workshop.Dto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生产设备
|
||||||
|
/// </summary>
|
||||||
|
public class ProductionEquipmentInput: OpenApiRequest
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
using JiShe.ServicePro;
|
||||||
|
using JiShe.ServicePro.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace JiShe.IoT.Workshop.Dto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生产设备详情
|
||||||
|
/// </summary>
|
||||||
|
public class ProductionEquipmentMessageBody
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 表计类型
|
||||||
|
/// 电表= 1,水表= 2,燃气表= 3,热能表= 4,水表流量计=5,燃气表流量计=6,特殊电表=7
|
||||||
|
/// </summary>
|
||||||
|
public MeterTypeEnum MeterType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 集中器地址
|
||||||
|
/// </summary>
|
||||||
|
public string FocusAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表通信地址
|
||||||
|
/// </summary>
|
||||||
|
public string MeterAddress { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
using JiShe.IoT.Workshop.Dto;
|
||||||
|
using JiShe.ServicePro;
|
||||||
|
using JiShe.ServicePro.OneNETManagement.OneNETProducts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace JiShe.IoT.Workshop
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生产车间服务
|
||||||
|
/// </summary>
|
||||||
|
public interface IProductionWorkshopService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 接收车间生产设备信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpDataResult> ReceiveWorkshopProductionEquipment(ProductionEquipmentInput input);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产车间获取OneNET产品列表
|
||||||
|
/// </summary>
|
||||||
|
Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> OneNetProductListForWorkshopAsync(OneNetWorkshopProductListInput input);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
using JiShe.IoT.CommonServices.Dto;
|
using JiShe.IoT.CommonServices.Dto;
|
||||||
using JiShe.ServicePro.Commons;
|
using JiShe.ServicePro.Commons;
|
||||||
using JiShe.ServicePro.Core;
|
using JiShe.ServicePro.Core;
|
||||||
|
using JiShe.ServicePro.DeviceManagement.Focuses;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -41,17 +42,5 @@ namespace JiShe.IoT.CommonServices
|
|||||||
|
|
||||||
return selectResults;
|
return selectResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 接收车间生产设备信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task ReceiveWorkshopProductionEquipment(ProductionEquipmentInput input)
|
|
||||||
{
|
|
||||||
await Task.CompletedTask;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,82 @@
|
|||||||
|
using JiShe.IoT.Workshop.Dto;
|
||||||
|
using JiShe.ServicePro;
|
||||||
|
using JiShe.ServicePro.DeviceManagement.Focuses;
|
||||||
|
using JiShe.ServicePro.DeviceManagement.Meters;
|
||||||
|
using JiShe.ServicePro.Encrypt;
|
||||||
|
using JiShe.ServicePro.Enums;
|
||||||
|
using JiShe.ServicePro.OneNETManagement.OneNETProducts;
|
||||||
|
using JiShe.ServicePro.ServerOptions;
|
||||||
|
using Mapster.Utils;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace JiShe.IoT.Workshop
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生产车间服务
|
||||||
|
/// </summary>
|
||||||
|
public class ProductionWorkshopService(IFocusAppService focusAppService, IMeterAppService meterAppService, IOptions<ServerApplicationOptions> options ) : IoTAppService,IProductionWorkshopService
|
||||||
|
{
|
||||||
|
ServerApplicationOptions srverOptions = options.Value;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收车间生产设备信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<HttpDataResult> ReceiveWorkshopProductionEquipment(ProductionEquipmentInput input)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool verifySignatureReult = EncryptUtil.OpenApiVerifySignature(input.Message, input.Nonce, input.Timestamp, input.Signature, srverOptions.VerifySignatureToken);
|
||||||
|
if (verifySignatureReult == false)//签名校验失败
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed("签名校验失败", -101, ResponeResultEnum.NotAllowed);
|
||||||
|
}
|
||||||
|
return HttpDataResultExtensions.Failed("签名校验失败", -101, ResponeResultEnum.NotAllowed);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产车间获取OneNET产品列表
|
||||||
|
/// </summary>
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> OneNetProductListForWorkshopAsync(OneNetWorkshopProductListInput input)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool verifySignatureReult = EncryptUtil.OpenApiVerifySignature(input.Message, input.Nonce, input.Timestamp, input.Signature, srverOptions.VerifySignatureToken);
|
||||||
|
if (verifySignatureReult == false)//签名校验失败
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed<List<OneNetWorkshopProductListOutput>>("签名校验失败", -101, ResponeResultEnum.NotAllowed);
|
||||||
|
}
|
||||||
|
|
||||||
|
var pageListQuery = FreeSqlDbContext.Instance.Select<OneNETProductInfos>()
|
||||||
|
.Where(e => e.IsEnabled == true)
|
||||||
|
.OrderByDescending(e => e.CreationTime);
|
||||||
|
|
||||||
|
var pageList = await pageListQuery.ToListAsync<OneNetWorkshopProductListOutput>();
|
||||||
|
|
||||||
|
return HttpDataResultExtensions.Success<List<OneNetWorkshopProductListOutput>>(pageList);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,8 @@
|
|||||||
using JiShe.IoT.CommonServices;
|
using JiShe.IoT.CommonServices;
|
||||||
using JiShe.IoT.CommonServices.Dto;
|
using JiShe.IoT.CommonServices.Dto;
|
||||||
|
using JiShe.ServicePro;
|
||||||
using JiShe.ServicePro.Commons;
|
using JiShe.ServicePro.Commons;
|
||||||
|
using JiShe.ServicePro.OneNETManagement.OneNETProducts;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -29,18 +31,5 @@ namespace JiShe.IoT.Controllers
|
|||||||
{
|
{
|
||||||
return _commonService.GetSelectResultList(input);
|
return _commonService.GetSelectResultList(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 接收车间生产设备信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("WorkshopProductionEquipment")]
|
|
||||||
[SwaggerOperation(summary: "车间生产设备信息", Tags = new[] { "Common" })]
|
|
||||||
public async Task ReceiveWorkshopProductionEquipment(ProductionEquipmentInput input)
|
|
||||||
{
|
|
||||||
|
|
||||||
await Task.CompletedTask;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
using JiShe.IoT.CommonServices;
|
||||||
|
using JiShe.IoT.CommonServices.Dto;
|
||||||
|
using JiShe.IoT.Workshop;
|
||||||
|
using JiShe.IoT.Workshop.Dto;
|
||||||
|
using JiShe.ServicePro;
|
||||||
|
using JiShe.ServicePro.Commons;
|
||||||
|
using JiShe.ServicePro.OneNETManagement.OneNETProducts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace JiShe.IoT.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 车间管理服务
|
||||||
|
/// </summary>
|
||||||
|
[Route("Workshop")]
|
||||||
|
public class ProductionWorkshopController : IoTController
|
||||||
|
{
|
||||||
|
private readonly IProductionWorkshopService _productionWorkshopService;
|
||||||
|
public ProductionWorkshopController(IProductionWorkshopService productionWorkshopService)
|
||||||
|
{
|
||||||
|
_productionWorkshopService = productionWorkshopService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收车间生产设备信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("WorkshopProductionEquipment")]
|
||||||
|
[SwaggerOperation(summary: "车间生产设备信息", Tags = new[] { "Workshop" })]
|
||||||
|
public async Task ReceiveWorkshopProductionEquipment(ProductionEquipmentInput input)
|
||||||
|
{
|
||||||
|
await _productionWorkshopService.ReceiveWorkshopProductionEquipment(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产车间获取OneNET产品列表
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost(nameof(OneNetProductListForWorkshopAsync))]
|
||||||
|
[SwaggerOperation(summary: "生产车间获取OneNET产品列表", Tags = new[] { "Workshop" })]
|
||||||
|
public async Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> OneNetProductListForWorkshopAsync(OneNetWorkshopProductListInput input)
|
||||||
|
{
|
||||||
|
return await _productionWorkshopService.OneNetProductListForWorkshopAsync(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user