You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.6 KiB
C#
83 lines
2.6 KiB
C#
using System.Text;
|
|
using DS.Module.Core;
|
|
using DS.WMS.Common.Data;
|
|
using DS.WMS.Core.OpenApiModule.Dtos;
|
|
using DS.WMS.Core.OpenApiModule.Interface;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Newtonsoft.Json;
|
|
using NLog;
|
|
using LogLevel = NLog.LogLevel;
|
|
|
|
namespace DS.WMS.OpenApi.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("hkapi")]
|
|
public class HKApiController : ControllerBase
|
|
{
|
|
static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
|
private readonly IOpenService _invokeService;
|
|
/// <summary>
|
|
/// 构造函数
|
|
/// </summary>
|
|
/// <param name="invokeService"></param>
|
|
public HKApiController(IOpenService invokeService)
|
|
{
|
|
_invokeService = invokeService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 温度报警回调
|
|
/// </summary>
|
|
/// <param name="data"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("HighTemperatureCallBack")]
|
|
public async Task<string> HighTemperatureCallBack()
|
|
{
|
|
string body = string.Empty;
|
|
Request.EnableBuffering();
|
|
StreamReader sr = new StreamReader(Request.Body);
|
|
body = await sr.ReadToEndAsync();
|
|
Request.Body.Seek(0, SeekOrigin.Begin);
|
|
|
|
var data = JsonConvert.DeserializeObject<LinkEventNotify>(body);
|
|
await _invokeService.HKDealHighTemperature(data);
|
|
return await Task.FromResult<string>("success");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 越界侦测报警回调
|
|
/// </summary>
|
|
/// <param name="data"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("IntrudeCallBack")]
|
|
public async Task<string> IntrudeCallBack()
|
|
{
|
|
string body = string.Empty;
|
|
Request.EnableBuffering();
|
|
StreamReader sr = new StreamReader(Request.Body);
|
|
body = await sr.ReadToEndAsync();
|
|
Request.Body.Seek(0, SeekOrigin.Begin);
|
|
|
|
var data = JsonConvert.DeserializeObject<LinkEventNotify>(body);
|
|
Logger.Log(LogLevel.Info,
|
|
"越界侦测:"+DateTime.Now.ToString() + JsonConvert.SerializeObject(data));
|
|
await _invokeService.HKDealLineDetection(data);
|
|
return await Task.FromResult<string>("success");
|
|
}
|
|
|
|
// /// <summary>
|
|
// /// 获取内部车辆信息
|
|
// /// </summary>
|
|
// /// <param name="plateNumber"></param>
|
|
// /// <returns></returns>
|
|
// [HttpGet]
|
|
// [Authorize]
|
|
// [Route("GetInternalCarInfoAsync")]
|
|
// public async Task<DataResult<InternalCarInfoViewModel>> GetInternalCarInfoAsync([FromQuery] string plateNumber)
|
|
// {
|
|
// return await _invokeRecordService.GetInternalCarInfoAsync(plateNumber);
|
|
// }
|
|
} |