|
@@ -18,6 +18,7 @@ using System.Collections.Generic;
|
|
|
using System;
|
|
|
using Newtonsoft.Json;
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
+using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
namespace Ropin.Inspection.Api.Controllers.Base
|
|
|
{
|
|
@@ -27,11 +28,14 @@ namespace Ropin.Inspection.Api.Controllers.Base
|
|
|
private readonly AIProjectHelper aIHelper;
|
|
|
private readonly ITsysMessageService _TsysMessageService;
|
|
|
private readonly IPushMsgService _pushMsgService;
|
|
|
- public AIController(IHttpClientFactory httpClientFactory, ITsysMessageService tsysMessageService, IPushMsgService pushMsgService)
|
|
|
+ private string IsUpdateAI = "false";
|
|
|
+ public AIController(IHttpClientFactory httpClientFactory, ITsysMessageService tsysMessageService, IPushMsgService pushMsgService, IConfiguration configuration)
|
|
|
{
|
|
|
aIHelper = new AIProjectHelper(httpClientFactory);
|
|
|
_TsysMessageService = tsysMessageService;
|
|
|
_pushMsgService = pushMsgService;
|
|
|
+ string IsUpdate = configuration.GetSection("AIIsUpdate")?.Value;
|
|
|
+ IsUpdateAI = !string.IsNullOrEmpty(IsUpdate) ? IsUpdate : "false";
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// AI登录
|
|
@@ -76,8 +80,8 @@ namespace Ropin.Inspection.Api.Controllers.Base
|
|
|
public async Task<ApiResult> AiAlmSaveMessage()
|
|
|
{
|
|
|
//40124884581189;33379713109829
|
|
|
- var data = await aIHelper.GetAlmDispose("", 1, 100, 40124884581189);
|
|
|
- //var data = await aIHelper.GetHistoricAlmrecord("", 7, 10, 33379713109829);
|
|
|
+ var data = await aIHelper.GetAlmDispose("", 1, 100, 40124884581189);
|
|
|
+ //var data = await aIHelper.GetHistoricAlmrecord("", 1, 10, 40124884581189);
|
|
|
if (data!=null)
|
|
|
{
|
|
|
foreach (var item in data.Items)
|
|
@@ -96,13 +100,18 @@ namespace Ropin.Inspection.Api.Controllers.Base
|
|
|
MessageFile messageFile = new MessageFile();
|
|
|
messageFile.Text = datas;
|
|
|
messageFile.Type = "FILE_TYP_006";
|
|
|
+ string msg = item.Event_Name;
|
|
|
+ if (string.IsNullOrEmpty(msg))
|
|
|
+ {
|
|
|
+ msg = item.Event_Code;
|
|
|
+ }
|
|
|
TpushMsgModel model = new TpushMsgModel
|
|
|
{
|
|
|
C_DevStoreCode = "d705ceb5-7473-4b19-91dd-d3eff223f05b",
|
|
|
C_MsgTypeCode = "MSG_TYPE_024",
|
|
|
Subject = item.Device_TypeName + "报警",
|
|
|
- Msg = item.Event_Name??item.Event_Code,
|
|
|
- UserName = "AI",
|
|
|
+ Msg = msg,
|
|
|
+ UserName = "AI盒子",
|
|
|
UserMobile = "",
|
|
|
CreateOn = item.StartTime?.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
GenerationType = 1,
|
|
@@ -110,7 +119,7 @@ namespace Ropin.Inspection.Api.Controllers.Base
|
|
|
FileList=new List<MessageFile> { messageFile }
|
|
|
};
|
|
|
bool bol = await _pushMsgService.PushAlarmMsgAsync(model, model.Subject);
|
|
|
- if (bol)
|
|
|
+ if (bol&& IsUpdateAI=="true")
|
|
|
{
|
|
|
DateTime updTime = DateTime.Now;
|
|
|
var updData = new
|