Merge branch 'master' of http://121.41.2.71:3000/wyw/mh_jy_safe
This commit is contained in:
commit
950a42c770
@ -1,16 +1,23 @@
|
|||||||
using APT.Infrastructure.Core;
|
using APT.BaseData.Domain.ApiModel.EX;
|
||||||
using APT.BaseData.Domain.ApiModel.EX;
|
using APT.BaseData.Domain.Entities;
|
||||||
using APT.BaseData.Domain.Entities.FM;
|
using APT.BaseData.Domain.Entities.FM;
|
||||||
using APT.BaseData.Domain.Enums;
|
using APT.BaseData.Domain.Enums;
|
||||||
using System.Collections.Generic;
|
|
||||||
using APT.Infrastructure.Api;
|
using APT.Infrastructure.Api;
|
||||||
|
using APT.Infrastructure.Core;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using static APT.BaseData.Domain.ApiModel.SocketInfo;
|
using static APT.BaseData.Domain.ApiModel.SocketInfo;
|
||||||
|
|
||||||
namespace APT.BaseData.Domain.IServices.FM
|
namespace APT.BaseData.Domain.IServices.FM
|
||||||
{
|
{
|
||||||
public interface IFMNotificatoinService: ICommonService
|
public interface IFMNotificatoinService: ICommonService
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 发送变更的菜单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Menus"></param>
|
||||||
|
/// <param name="userIds"></param>
|
||||||
|
void MenusChangeNotice(List<Guid> userIds,WebSocketClientTypeEnum clientType);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送通知公告
|
/// 发送通知公告
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -28,7 +28,7 @@ namespace APT.BaseData.Services.Services.EX
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="clientInfo"></param>
|
/// <param name="clientInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static WebSocketResponseInfo OnOpenWebSocket(WebSocketClientInfo clientInfo)
|
public static WebSocketResponseInfo OnOpenWebSocket(WebSocketClientInfo clientInfo, List<WebSocketClientInfo> WebSocketClientInfos)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Socket连接:{clientInfo?.UserId}");
|
Console.WriteLine($"Socket连接:{clientInfo?.UserId}");
|
||||||
//clientInfo.WebSocketConnection.Close();
|
//clientInfo.WebSocketConnection.Close();
|
||||||
@ -90,9 +90,10 @@ namespace APT.BaseData.Services.Services.EX
|
|||||||
/// websocket 关闭
|
/// websocket 关闭
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId"></param>
|
/// <param name="userId"></param>
|
||||||
public static void OnCloseWebSocket(Guid userId, WebSocketClientInfo clientInfo)
|
public static void OnCloseWebSocket(Guid userId, WebSocketClientInfo clientInfo, List<WebSocketClientInfo> WebSocketClientInfos)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Socket连接断开:{userId}");
|
Console.WriteLine($"Socket连接断开:{userId}");
|
||||||
|
WebSocketClientInfos.Remove(clientInfo);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// websocket 信息
|
/// websocket 信息
|
||||||
@ -101,7 +102,7 @@ namespace APT.BaseData.Services.Services.EX
|
|||||||
/// <param name="requestInfo"></param>
|
/// <param name="requestInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static WebSocketResponseInfo OnMessageWebSocket(WebSocketClientInfo clientInfo,
|
public static WebSocketResponseInfo OnMessageWebSocket(WebSocketClientInfo clientInfo,
|
||||||
WebSocketRequestInfo requestInfo)
|
WebSocketRequestInfo requestInfo, List<WebSocketClientInfo> WebSocketClientInfos)
|
||||||
{
|
{
|
||||||
if (requestInfo != null)
|
if (requestInfo != null)
|
||||||
{
|
{
|
||||||
@ -123,14 +124,12 @@ namespace APT.BaseData.Services.Services.EX
|
|||||||
List<WebSocketClientInfo> ingoreClientInfos = new List<WebSocketClientInfo>();
|
List<WebSocketClientInfo> ingoreClientInfos = new List<WebSocketClientInfo>();
|
||||||
ingoreClientInfos.Add(clientInfo);
|
ingoreClientInfos.Add(clientInfo);
|
||||||
service.SendAlarmNotification(clientInfoByManu, ingoreClientInfos);
|
service.SendAlarmNotification(clientInfoByManu, ingoreClientInfos);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "P0001":
|
case "P0001":
|
||||||
{
|
{
|
||||||
BaseFilter baseFilter = new BaseFilter();
|
WebSocketClientInfos.Add(clientInfo);
|
||||||
baseFilter.IgnoreOrgRule = true;
|
|
||||||
baseFilter.IsMultipleDb = true;
|
|
||||||
var commonService = ServiceLocator.Instance.GetService<ICommonService>();
|
|
||||||
//var consumeService = APT.Infrastructure.Api.ServiceLocator.Instance.GetService<ISOConsumeChargingOrderService>();
|
//var consumeService = APT.Infrastructure.Api.ServiceLocator.Instance.GetService<ISOConsumeChargingOrderService>();
|
||||||
//var cueerntInfo = commonService.GetEntity<T_CP_CHARGING_PILE>(x => x.CURRENT_CLIENT_ID == clientInfo.UserId, baseFilter);//当前占用充电桩
|
//var cueerntInfo = commonService.GetEntity<T_CP_CHARGING_PILE>(x => x.CURRENT_CLIENT_ID == clientInfo.UserId, baseFilter);//当前占用充电桩
|
||||||
//if (cueerntInfo != null && cueerntInfo.CURRENT_CLIENT_ID != null)
|
//if (cueerntInfo != null && cueerntInfo.CURRENT_CLIENT_ID != null)
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
using APT.BaseData.Domain.ApiModel.EX;
|
using APT.BaseData.Domain.ApiModel.EX;
|
||||||
|
using APT.BaseData.Domain.Entities;
|
||||||
using APT.BaseData.Domain.Entities.FM;
|
using APT.BaseData.Domain.Entities.FM;
|
||||||
using APT.BaseData.Domain.Enums;
|
using APT.BaseData.Domain.Enums;
|
||||||
using APT.BaseData.Domain.IServices.FM;
|
using APT.BaseData.Domain.IServices.FM;
|
||||||
using APT.Infrastructure.Api;
|
using APT.Infrastructure.Api;
|
||||||
using APT.Infrastructure.Core;
|
using APT.Infrastructure.Core;
|
||||||
using APT.Migrations;
|
using APT.Migrations;
|
||||||
|
using StackExchange.Redis;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -103,7 +105,26 @@ namespace APT.BaseData.Services.Services.FM
|
|||||||
SendNotification(sendNotificationModel, clientInfos);
|
SendNotification(sendNotificationModel, clientInfos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 发送通知公告
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sendNotificationModel"></param>
|
||||||
|
/// <param name="ingoreClientInfos"></param>
|
||||||
|
public void MenusChangeNotice(List<Guid> userIds,WebSocketClientTypeEnum clientType)
|
||||||
|
{
|
||||||
|
var clientInfos = WebSocketServiceHelper.ClintInfos.Where(t => userIds.Contains(t.UserId.Value) && t.ClientType == clientType).ToList();
|
||||||
|
if (!clientInfos.Any())
|
||||||
|
return;
|
||||||
|
foreach (var u in userIds)
|
||||||
|
{
|
||||||
|
WebSocketServiceHelper.SendToUser(u, new WebSocketResponseInfo()
|
||||||
|
{
|
||||||
|
TypeCode = "MQ02",
|
||||||
|
Data = new SocketData(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -149,6 +149,7 @@
|
|||||||
<ProjectReference Include="..\..\APT.BaseData.Services\APT.BaseData.Services.csproj" />
|
<ProjectReference Include="..\..\APT.BaseData.Services\APT.BaseData.Services.csproj" />
|
||||||
<ProjectReference Include="..\..\APT.Data.Migrations\APT.Data.Migrations.csproj" />
|
<ProjectReference Include="..\..\APT.Data.Migrations\APT.Data.Migrations.csproj" />
|
||||||
<ProjectReference Include="..\..\APT.Utility\APT.Utility.csproj" />
|
<ProjectReference Include="..\..\APT.Utility\APT.Utility.csproj" />
|
||||||
|
<ProjectReference Include="..\APT.PF.WebApi\APT.PF.WebApi.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -16,6 +16,7 @@ using NPOI.SS.Formula.Functions;
|
|||||||
using APT.BaseData.Domain.ApiModel.Platform;
|
using APT.BaseData.Domain.ApiModel.Platform;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
using APT.BaseData.Domain.Entities.PF;
|
using APT.BaseData.Domain.Entities.PF;
|
||||||
|
using APT.Infrastructure.Api;
|
||||||
|
|
||||||
namespace APT.FM.WebApi.Controllers.Api.FM
|
namespace APT.FM.WebApi.Controllers.Api.FM
|
||||||
{
|
{
|
||||||
@ -468,6 +469,12 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
this.BantchAddEntityNoCommit<T_FM_ROLE_DEPARTMENT>(roleDepartments);
|
this.BantchAddEntityNoCommit<T_FM_ROLE_DEPARTMENT>(roleDepartments);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
//通知权限更新
|
||||||
|
var menuFilter = new BaseFilter();
|
||||||
|
menuFilter.SelectField =new string[] { "ID" };
|
||||||
|
var users = this.GetEntities<T_FM_USER>(x => x.Nav_BelongRoles.Any(x => x.BELONG_ROLE_ID == role.ID), menuFilter);
|
||||||
|
var notificationService = ServiceLocator.Instance.GetService<IFMNotificatoinService>();
|
||||||
|
notificationService.MenusChangeNotice(users.Select(x => x.ID).ToList(),WebSocketClientTypeEnum.WEB后台);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,40 +1,40 @@
|
|||||||
using APT.BaseData.Domain.Msg;
|
using APT.BaseData.Domain.ApiModel;
|
||||||
using APT.Infrastructure.Core;
|
using APT.BaseData.Domain.Entities;
|
||||||
using APT.MS.Domain.ApiModel;
|
|
||||||
using APT.BaseData.Domain.Entities.FM;
|
using APT.BaseData.Domain.Entities.FM;
|
||||||
|
using APT.BaseData.Domain.Entities.OP;
|
||||||
|
using APT.BaseData.Domain.Entities.PF;
|
||||||
|
using APT.BaseData.Domain.Enums;
|
||||||
|
using APT.BaseData.Domain.Enums.PF;
|
||||||
using APT.BaseData.Domain.IServices.FM;
|
using APT.BaseData.Domain.IServices.FM;
|
||||||
|
using APT.BaseData.Domain.IServices.OP;
|
||||||
|
using APT.BaseData.Domain.Msg;
|
||||||
|
using APT.BaseData.Services.Services.FM;
|
||||||
|
using APT.Infrastructure.Api;
|
||||||
|
using APT.Infrastructure.Core;
|
||||||
|
using APT.Migrations;
|
||||||
|
using APT.MS.Domain.ApiModel;
|
||||||
|
using APT.MS.Domain.Entities.HM;
|
||||||
|
using APT.MS.Domain.Entities.OG;
|
||||||
|
using APT.MS.Domain.Entities.PF;
|
||||||
|
using APT.MS.Domain.Entities.SC;
|
||||||
|
using APT.MS.Domain.Entities.SC.PT;
|
||||||
|
using APT.MS.Domain.Entities.SC.SC;
|
||||||
|
using APT.MS.Domain.Entities.SE;
|
||||||
|
using APT.MS.Domain.Entities.SK;
|
||||||
|
using APT.MS.Domain.Enums;
|
||||||
|
using APT.Utility;
|
||||||
|
using Castle.Core.Internal;
|
||||||
|
using InfluxData.Net.InfluxDb.Models.Responses;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.DependencyModel;
|
||||||
|
using MySqlX.XDevAPI.Common;
|
||||||
|
using NPOI.SS.Formula.Functions;
|
||||||
|
using StackExchange.Redis;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using APT.Utility;
|
|
||||||
using APT.BaseData.Domain.ApiModel;
|
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using APT.BaseData.Domain.Enums;
|
|
||||||
using APT.BaseData.Domain.Entities.PF;
|
|
||||||
using APT.MS.Domain.Entities.HM;
|
|
||||||
using APT.MS.Domain.Entities.PF;
|
|
||||||
using APT.BaseData.Domain.Entities;
|
|
||||||
using APT.BaseData.Services.Services.FM;
|
|
||||||
using MySqlX.XDevAPI.Common;
|
|
||||||
using Castle.Core.Internal;
|
|
||||||
using NPOI.SS.Formula.Functions;
|
|
||||||
using APT.MS.Domain.Entities.SE;
|
|
||||||
using APT.MS.Domain.Enums;
|
|
||||||
using APT.BaseData.Domain.Entities.OP;
|
|
||||||
using APT.Migrations;
|
|
||||||
using InfluxData.Net.InfluxDb.Models.Responses;
|
|
||||||
using APT.Infrastructure.Api;
|
|
||||||
using APT.BaseData.Domain.Enums.PF;
|
|
||||||
using APT.MS.Domain.Entities.OG;
|
|
||||||
using APT.MS.Domain.Entities.SC;
|
|
||||||
using APT.MS.Domain.Entities.SC.SC;
|
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using APT.MS.Domain.Entities.SC.PT;
|
|
||||||
using Microsoft.Extensions.DependencyModel;
|
|
||||||
using APT.MS.Domain.Entities.SK;
|
|
||||||
using APT.BaseData.Domain.IServices.OP;
|
|
||||||
|
|
||||||
namespace APT.FM.WebApi.Controllers.Api.FM
|
namespace APT.FM.WebApi.Controllers.Api.FM
|
||||||
{
|
{
|
||||||
@ -530,8 +530,9 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
{
|
{
|
||||||
return SafeExecute<bool>(() =>
|
return SafeExecute<bool>(() =>
|
||||||
{
|
{
|
||||||
var allUsers = this.GetEntities<T_FM_USER>(t => t.IS_DELETED == false, null, "Nav_ApproveRole");
|
//var allUsers = this.GetEntities<T_FM_USER>(t => t.IS_DELETED == false, null, "Nav_ApproveRole");
|
||||||
var isAdd = allUsers.Where(t => t.ID == entity.ID);
|
var isAdd = this.GetEntity<T_FM_USER>(entity.ID.ToString(), "Nav_ApproveRole", "Nav_BelongRoles");
|
||||||
|
var dbRuleStr = string.Join(',', isAdd.Nav_BelongRoles.OrderBy(x => x.BELONG_ROLE_ID).Select(x => x.BELONG_ROLE_ID).Distinct().ToList());
|
||||||
var userList = new List<T_FM_USER>();
|
var userList = new List<T_FM_USER>();
|
||||||
entity.CODE = entity.CODE.ToUpper();
|
entity.CODE = entity.CODE.ToUpper();
|
||||||
if (entity.ENTRYTIME == DateTime.Parse("0001/1/1 0:00:00"))
|
if (entity.ENTRYTIME == DateTime.Parse("0001/1/1 0:00:00"))
|
||||||
@ -558,7 +559,7 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
throw new Exception("岗位不允许为空!");
|
throw new Exception("岗位不允许为空!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAdd.Any())
|
if (isAdd == null)
|
||||||
{
|
{
|
||||||
userList = this.GetEntities<T_FM_USER>(t => (t.CODE == entity.CODE || t.APPROVE_ROLE_ID == entity.APPROVE_ROLE_ID) && t.ORG_ID == entity.ORG_ID, null, "Nav_Department").ToList();
|
userList = this.GetEntities<T_FM_USER>(t => (t.CODE == entity.CODE || t.APPROVE_ROLE_ID == entity.APPROVE_ROLE_ID) && t.ORG_ID == entity.ORG_ID, null, "Nav_Department").ToList();
|
||||||
var isRepeat = userList.FirstOrDefault(t => t.CODE == entity.CODE);
|
var isRepeat = userList.FirstOrDefault(t => t.CODE == entity.CODE);
|
||||||
@ -690,7 +691,7 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var departInfo = this.GetEntity<T_FM_DEPARTMENT>(entity.DEPARTMENT_ID.ToString());
|
var departInfo = this.GetEntity<T_FM_DEPARTMENT>(entity.DEPARTMENT_ID.ToString());
|
||||||
if (departInfo != null && departInfo.PRODUCTION_UNIT_ID != null && departInfo.MineType != null && !isAdd.Any())
|
if (departInfo != null && departInfo.PRODUCTION_UNIT_ID != null && departInfo.MineType != null && isAdd == null)
|
||||||
{
|
{
|
||||||
var enumList = this.GetEntity<T_FM_ENUMS>(t => t.CODE == "BSMineTypeEnum" && t.VALUE == departInfo.MineType);
|
var enumList = this.GetEntity<T_FM_ENUMS>(t => t.CODE == "BSMineTypeEnum" && t.VALUE == departInfo.MineType);
|
||||||
entity.MineType = departInfo.MineType.ToString();
|
entity.MineType = departInfo.MineType.ToString();
|
||||||
@ -1013,7 +1014,7 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
|
|
||||||
#region 总用户库添加
|
#region 总用户库添加
|
||||||
|
|
||||||
if (!isAdd.Any())
|
if (isAdd == null)
|
||||||
{
|
{
|
||||||
using (var context = new MigrationContext(ConfigurationManager.ConnectionStrings["default"]))
|
using (var context = new MigrationContext(ConfigurationManager.ConnectionStrings["default"]))
|
||||||
{
|
{
|
||||||
@ -1148,9 +1149,22 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
//通知权限更新
|
||||||
|
var menuFilter = new BaseFilter();
|
||||||
|
menuFilter.SelectField = new string[] { "ID" };
|
||||||
|
if (isAdd != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
var nowRules = string.Join(',', belongRoles.OrderBy(x => x.BELONG_ROLE_ID).Select(x => x.BELONG_ROLE_ID).Distinct().ToList());
|
||||||
|
if (dbRuleStr.CompareTo(nowRules) != 0)
|
||||||
|
{
|
||||||
|
var notificationService = ServiceLocator.Instance.GetService<IFMNotificatoinService>();
|
||||||
|
notificationService.MenusChangeNotice(new List<Guid>() { isAdd.ID },WebSocketClientTypeEnum.WEB后台);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ using APT.Infrastructure.EF.Extensions;
|
|||||||
using APT.Infrastructure.Api;
|
using APT.Infrastructure.Api;
|
||||||
using ConfigurationManager = APT.Infrastructure.Api.ConfigurationManager;
|
using ConfigurationManager = APT.Infrastructure.Api.ConfigurationManager;
|
||||||
using APT.WebApi.Models;
|
using APT.WebApi.Models;
|
||||||
|
using APT.PF.WebApi.Utils;
|
||||||
|
|
||||||
namespace APT.FM.WebApi
|
namespace APT.FM.WebApi
|
||||||
{
|
{
|
||||||
@ -139,8 +140,7 @@ namespace APT.FM.WebApi
|
|||||||
|
|
||||||
//fMOrganizationService.SetOrgCache();
|
//fMOrganizationService.SetOrgCache();
|
||||||
|
|
||||||
|
APT.PF.WebApi.Utils.WebSokectHelper.Init();
|
||||||
//APT.FM.WebApi.Utils.WebSokectHelper.Init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ConfigureContainer(ContainerBuilder builder)
|
public virtual void ConfigureContainer(ContainerBuilder builder)
|
||||||
|
|||||||
@ -1,191 +1,191 @@
|
|||||||
using APT.Infrastructure.Core;
|
//using APT.Infrastructure.Core;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
//using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Collections.Generic;
|
//using System.Collections.Generic;
|
||||||
using APT.Utility;
|
//using APT.Utility;
|
||||||
using APT.BaseData.Domain.Entities.LG;
|
//using APT.BaseData.Domain.Entities.LG;
|
||||||
using APT.BaseData.Domain.ApiModel.LG;
|
//using APT.BaseData.Domain.ApiModel.LG;
|
||||||
using System;
|
//using System;
|
||||||
using APT.BaseData.Domain.Enums;
|
//using APT.BaseData.Domain.Enums;
|
||||||
using System.Threading.Tasks;
|
//using System.Threading.Tasks;
|
||||||
using InfluxData.Net.InfluxDb.Models;
|
//using InfluxData.Net.InfluxDb.Models;
|
||||||
using APT.BaseData.Domain.Entities.FM;
|
//using APT.BaseData.Domain.Entities.FM;
|
||||||
using Microsoft.EntityFrameworkCore.Internal;
|
//using Microsoft.EntityFrameworkCore.Internal;
|
||||||
using System.Linq;
|
//using System.Linq;
|
||||||
using APT.BaseData.Domain.ApiModel.Platform;
|
//using APT.BaseData.Domain.ApiModel.Platform;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
//using Microsoft.Extensions.DependencyInjection;
|
||||||
using APT.Infrastructure.Api.Redis;
|
//using APT.Infrastructure.Api.Redis;
|
||||||
using APT.Infrastructure.Api;
|
//using APT.Infrastructure.Api;
|
||||||
namespace APT.LG.WebApi.Controllers.Api
|
//namespace APT.LG.WebApi.Controllers.Api
|
||||||
{
|
//{
|
||||||
|
|
||||||
#region Oprate-表单操作日志表
|
// #region Oprate-表单操作日志表
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// 表单操作日志表
|
// /// 表单操作日志表
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
[Route("api/LG/LGOperate")]
|
// [Route("api/LG/LGOperate")]
|
||||||
public partial class OprateController : AuthorizeApiController<T_LG_OPRATE>
|
// public partial class OprateController : AuthorizeApiController<T_LG_OPRATE>
|
||||||
{
|
// {
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// 新增日志
|
// /// 新增日志
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="filter">新增日志</param>
|
// /// <param name="filter">新增日志</param>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
[HttpPost, Route("Add")]
|
// [HttpPost, Route("Add")]
|
||||||
public async Task<JsonActionResult<bool>> Add([FromBody] LgOprateModel model)
|
// public async Task<JsonActionResult<bool>> Add([FromBody] LgOprateModel model)
|
||||||
{
|
// {
|
||||||
//var redisManager = APT.Infrastructure.Api.ServiceLocator.Instance.GetService<RedisManager>();
|
// //var redisManager = APT.Infrastructure.Api.ServiceLocator.Instance.GetService<RedisManager>();
|
||||||
//int num = 0;
|
// //int num = 0;
|
||||||
//if (CsRedisManager.KeyExists(RedisCacheKey.HardWarePVInfo))
|
// //if (CsRedisManager.KeyExists(RedisCacheKey.HardWarePVInfo))
|
||||||
//{
|
// //{
|
||||||
// num = CsRedisManager.StringGet<int>(RedisCacheKey.HardWarePVInfo);
|
// // num = CsRedisManager.StringGet<int>(RedisCacheKey.HardWarePVInfo);
|
||||||
//}
|
// //}
|
||||||
//num++;
|
// //num++;
|
||||||
//CsRedisManager.StringSet<int>(RedisCacheKey.HardWarePVInfo, num);
|
// //CsRedisManager.StringSet<int>(RedisCacheKey.HardWarePVInfo, num);
|
||||||
var isLog = LibUtils.ToBoolean(
|
// var isLog = LibUtils.ToBoolean(
|
||||||
ConfigurationManager.AppSettings["isSqlLog"]);
|
// ConfigurationManager.AppSettings["isSqlLog"]);
|
||||||
bool isSuccess = true;
|
// bool isSuccess = true;
|
||||||
if (isLog)
|
// if (isLog)
|
||||||
{
|
// {
|
||||||
var user = this.GetEntityByRedis<T_FM_USER>(model.UserId, new Guid(model.OrgId));
|
// var user = this.GetEntityByRedis<T_FM_USER>(model.UserId, new Guid(model.OrgId));
|
||||||
if (user == null)
|
// if (user == null)
|
||||||
throw new Exception("用户不存在");
|
// throw new Exception("用户不存在");
|
||||||
var dt = DateTime.Now;
|
// var dt = DateTime.Now;
|
||||||
var points = new Point
|
// var points = new Point
|
||||||
{
|
// {
|
||||||
Name = dt.Year + dt.Month.PadLeft(2, '0'),
|
// Name = dt.Year + dt.Month.PadLeft(2, '0'),
|
||||||
Timestamp = dt,
|
// Timestamp = dt,
|
||||||
Tags = new Dictionary<string, object>()
|
// Tags = new Dictionary<string, object>()
|
||||||
{
|
// {
|
||||||
{ "Id", Guid.NewGuid().ToString()}
|
// { "Id", Guid.NewGuid().ToString()}
|
||||||
},
|
// },
|
||||||
Fields = new Dictionary<string, object>()
|
// Fields = new Dictionary<string, object>()
|
||||||
{
|
// {
|
||||||
{ "FormCode", model.FormCode },
|
// { "FormCode", model.FormCode },
|
||||||
{ "FormName", model.FormName },
|
// { "FormName", model.FormName },
|
||||||
{ "BtnCode", model.BtnCode??"" },
|
// { "BtnCode", model.BtnCode??"" },
|
||||||
{ "BtnName", model.BtnName??"" },
|
// { "BtnName", model.BtnName??"" },
|
||||||
{ "OrgId", model.OrgId },
|
// { "OrgId", model.OrgId },
|
||||||
{ "UserId", model.UserId },
|
// { "UserId", model.UserId },
|
||||||
{ "UserCode",user.CODE },
|
// { "UserCode",user.CODE },
|
||||||
{ "OperateType",string.IsNullOrEmpty(model.BtnCode)?(int)LGOperateTypeEnum.表单加载:(int)LGOperateTypeEnum.按钮点击 }
|
// { "OperateType",string.IsNullOrEmpty(model.BtnCode)?(int)LGOperateTypeEnum.表单加载:(int)LGOperateTypeEnum.按钮点击 }
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
var response = await InfluxDbHelper.InfluxDbClient.Client.WriteAsync(points, InfluxDbHelper.InfluxLogDbName);
|
// // var response = await InfluxDbHelper.InfluxDbClient.Client.WriteAsync(points, InfluxDbHelper.InfluxLogDbName);
|
||||||
isSuccess = response.Success;
|
// //isSuccess = response.Success;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return SafeExecute<bool>(() =>
|
// return SafeExecute<bool>(() =>
|
||||||
{
|
// {
|
||||||
return isSuccess;
|
// return isSuccess;
|
||||||
|
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// 查询所有数据
|
// /// 查询所有数据
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="filter">过滤实体</param>
|
// /// <param name="filter">过滤实体</param>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
[HttpPost, Route("LGOrderPaged")]
|
// [HttpPost, Route("LGOrderPaged")]
|
||||||
public async Task<PagedActionResult<LgOprateModel>> LGOrderPaged([FromBody] KeywordPageFilter filters)
|
// public async Task<PagedActionResult<LgOprateModel>> LGOrderPaged([FromBody] KeywordPageFilter filters)
|
||||||
{
|
// {
|
||||||
var actionResult = new PagedActionResult<LgOprateModel>();
|
// var actionResult = new PagedActionResult<LgOprateModel>();
|
||||||
string timestr = filters.Parameter1;
|
// string timestr = filters.Parameter1;
|
||||||
if (string.IsNullOrEmpty(timestr))
|
// if (string.IsNullOrEmpty(timestr))
|
||||||
{
|
// {
|
||||||
this.ThrowError("120001");
|
// this.ThrowError("120001");
|
||||||
}
|
// }
|
||||||
//if (string.IsNullOrEmpty(filters.Parameter2))
|
// //if (string.IsNullOrEmpty(filters.Parameter2))
|
||||||
//{
|
// //{
|
||||||
// this.ThrowError("120002");
|
// // this.ThrowError("120002");
|
||||||
//}
|
// //}
|
||||||
var timeAry = timestr.Split(new char[] { ',' });
|
// var timeAry = timestr.Split(new char[] { ',' });
|
||||||
if (timeAry.Length != 2)
|
// if (timeAry.Length != 2)
|
||||||
this.ThrowError("120001");
|
// this.ThrowError("120001");
|
||||||
var dtStart = DateTime.Parse(timeAry[0]);
|
// var dtStart = DateTime.Parse(timeAry[0]);
|
||||||
var dtEnd = DateTime.Parse(timeAry[1]);
|
// var dtEnd = DateTime.Parse(timeAry[1]);
|
||||||
T_FM_USER user = null;
|
// T_FM_USER user = null;
|
||||||
if (!string.IsNullOrEmpty(filters.Keyword))
|
// if (!string.IsNullOrEmpty(filters.Keyword))
|
||||||
{
|
// {
|
||||||
user = this.GetEntity<T_FM_USER>(i => i.NAME == filters.Keyword || i.CODE == filters.Keyword, new BaseFilter(filters.OrgId));
|
// user = this.GetEntity<T_FM_USER>(i => i.NAME == filters.Keyword || i.CODE == filters.Keyword, new BaseFilter(filters.OrgId));
|
||||||
if (user == null)
|
// if (user == null)
|
||||||
return actionResult;
|
// return actionResult;
|
||||||
}
|
// }
|
||||||
List<string> querys = new List<string>();
|
// List<string> querys = new List<string>();
|
||||||
List<string> queryCounts = new List<string>();
|
// List<string> queryCounts = new List<string>();
|
||||||
for (var x = dtStart; x <= dtEnd; x = x.AddMonths(1))
|
// for (var x = dtStart; x <= dtEnd; x = x.AddMonths(1))
|
||||||
{
|
// {
|
||||||
var tableName = x.Year + x.Month.PadLeft(2, '0');
|
// var tableName = x.Year + x.Month.PadLeft(2, '0');
|
||||||
var query = $" FROM \"{tableName}\" WHERE time >= '{dtStart.ToString("yyyy-MM-dd HH:mm:ss")}' and time<='{dtEnd.ToString("yyyy-MM-dd HH:mm:ss")}'";
|
// var query = $" FROM \"{tableName}\" WHERE time >= '{dtStart.ToString("yyyy-MM-dd HH:mm:ss")}' and time<='{dtEnd.ToString("yyyy-MM-dd HH:mm:ss")}'";
|
||||||
if (user != null)
|
// if (user != null)
|
||||||
query += $" and UserId='{user.ID.ToString()}'";
|
// query += $" and UserId='{user.ID.ToString()}'";
|
||||||
//表单
|
// //表单
|
||||||
if (!string.IsNullOrEmpty(filters.Parameter3))
|
// if (!string.IsNullOrEmpty(filters.Parameter3))
|
||||||
{
|
// {
|
||||||
query += $" and FormCode='{filters.Parameter3}'";
|
// query += $" and FormCode='{filters.Parameter3}'";
|
||||||
}
|
// }
|
||||||
var offSet = (filters.PageIndex - 1) * filters.Limit;
|
// var offSet = (filters.PageIndex - 1) * filters.Limit;
|
||||||
var querySql = query + $" order by time desc limit {filters.Limit} OFFSET {offSet}";
|
// var querySql = query + $" order by time desc limit {filters.Limit} OFFSET {offSet}";
|
||||||
querySql = "SELECT * " + querySql;
|
// querySql = "SELECT * " + querySql;
|
||||||
querys.Add(querySql);
|
// querys.Add(querySql);
|
||||||
var queryCount = "SELECT COUNT(OrgId) " + query;
|
// var queryCount = "SELECT COUNT(OrgId) " + query;
|
||||||
queryCounts.Add(queryCount);
|
// queryCounts.Add(queryCount);
|
||||||
}
|
// }
|
||||||
|
|
||||||
var response = await InfluxDbHelper.InfluxDbClient.Client.MultiQueryAsync(querys, InfluxDbHelper.InfluxLogDbName);
|
// // var response = await InfluxDbHelper.InfluxDbClient.Client.MultiQueryAsync(querys, InfluxDbHelper.InfluxLogDbName);
|
||||||
if (!response.Any())
|
// if (!response.Any())
|
||||||
return actionResult;
|
// return actionResult;
|
||||||
//得到Serie集合对象(返回执行多个查询的结果)
|
// //得到Serie集合对象(返回执行多个查询的结果)
|
||||||
//取出第一条命令的查询结果,是一个集合
|
// //取出第一条命令的查询结果,是一个集合
|
||||||
List<LgOprateModel> opList = new List<LgOprateModel>();
|
// List<LgOprateModel> opList = new List<LgOprateModel>();
|
||||||
//从集合中取出第一条数据
|
// //从集合中取出第一条数据
|
||||||
foreach (var list in response)
|
// foreach (var list in response)
|
||||||
{
|
// {
|
||||||
foreach (var table in list)
|
// foreach (var table in list)
|
||||||
{
|
// {
|
||||||
foreach (var item in table.Values)
|
// foreach (var item in table.Values)
|
||||||
{
|
// {
|
||||||
var point = new LgOprateModel
|
// var point = new LgOprateModel
|
||||||
{
|
// {
|
||||||
BtnCode = item[1].ToString(),
|
// BtnCode = item[1].ToString(),
|
||||||
BtnName = item[2].ToString(),
|
// BtnName = item[2].ToString(),
|
||||||
FormCode = item[3].ToString(),
|
// FormCode = item[3].ToString(),
|
||||||
FormName = item[4].ToString(),
|
// FormName = item[4].ToString(),
|
||||||
ID = item[5].ToString(),
|
// ID = item[5].ToString(),
|
||||||
OrgId = item[7].ToString(),
|
// OrgId = item[7].ToString(),
|
||||||
UserCode = item[8].ToString(),
|
// UserCode = item[8].ToString(),
|
||||||
UserId = item[9].ToString(),
|
// UserId = item[9].ToString(),
|
||||||
Datetime = item[0].ToString(),
|
// Datetime = item[0].ToString(),
|
||||||
};
|
// };
|
||||||
opList.Add(point);
|
// opList.Add(point);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
opList = opList.OrderByDescending(t => t.Datetime).Take(filters.Limit).ToList();
|
// opList = opList.OrderByDescending(t => t.Datetime).Take(filters.Limit).ToList();
|
||||||
actionResult.Data = opList;
|
// actionResult.Data = opList;
|
||||||
|
|
||||||
var responseCount = await InfluxDbHelper.InfluxDbClient.Client.MultiQueryAsync(queryCounts, InfluxDbHelper.InfluxLogDbName);
|
// var responseCount = await InfluxDbHelper.InfluxDbClient.Client.MultiQueryAsync(queryCounts, InfluxDbHelper.InfluxLogDbName);
|
||||||
var totalCount = 0;
|
// var totalCount = 0;
|
||||||
foreach (var list in responseCount)
|
// foreach (var list in responseCount)
|
||||||
{
|
// {
|
||||||
foreach (var table in list)
|
// foreach (var table in list)
|
||||||
{
|
// {
|
||||||
foreach (var item in table.Values)
|
// foreach (var item in table.Values)
|
||||||
{
|
// {
|
||||||
totalCount += int.Parse(item[1].ToString());
|
// totalCount += int.Parse(item[1].ToString());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
actionResult.TotalCount = totalCount;
|
// actionResult.TotalCount = totalCount;
|
||||||
|
|
||||||
return actionResult;
|
// return actionResult;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
#endregion
|
// #endregion
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|||||||
@ -870,6 +870,7 @@ namespace APT.PF.WebApiControllers.Api.PF
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filter"></param>
|
/// <param name="filter"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
[DisableRequestSizeLimit] // 解除默认文件大小限制(可选)
|
||||||
[HttpPost, Route("UploadVideo")]
|
[HttpPost, Route("UploadVideo")]
|
||||||
public JsonActionResult<dynamic> UploadVideo()
|
public JsonActionResult<dynamic> UploadVideo()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -154,13 +154,13 @@ namespace APT.PF.WebApi
|
|||||||
////fMOrganizationService.SetOrgCache();
|
////fMOrganizationService.SetOrgCache();
|
||||||
//CheckLinse();
|
//CheckLinse();
|
||||||
//UpdateDatabase();
|
//UpdateDatabase();
|
||||||
APT.PF.WebApi.Utils.WebSokectHelper.Init();
|
//APT.PF.WebApi.Utils.WebSokectHelper.Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ConfigureContainer(ContainerBuilder builder)
|
public virtual void ConfigureContainer(ContainerBuilder builder)
|
||||||
{
|
{
|
||||||
builder.RegisterComponents();
|
builder.RegisterComponents();
|
||||||
Thread.Sleep(10000);
|
//Thread.Sleep(10000);
|
||||||
var dbs = GetAllDbConns();
|
var dbs = GetAllDbConns();
|
||||||
foreach (var db in dbs)
|
foreach (var db in dbs)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,11 +4,13 @@ using System;
|
|||||||
using APT.BaseData.Domain.IServices.Platform;
|
using APT.BaseData.Domain.IServices.Platform;
|
||||||
using APT.BaseData.Services.Services.EX;
|
using APT.BaseData.Services.Services.EX;
|
||||||
using APT.Infrastructure.Api;
|
using APT.Infrastructure.Api;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace APT.PF.WebApi.Utils
|
namespace APT.PF.WebApi.Utils
|
||||||
{
|
{
|
||||||
public static class WebSokectHelper
|
public static class WebSokectHelper
|
||||||
{
|
{
|
||||||
|
public static List<WebSocketClientInfo> WebSocketClientInfos = new List<WebSocketClientInfo>();
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -21,15 +23,15 @@ namespace APT.PF.WebApi.Utils
|
|||||||
WebSocketServiceHelper.InitService(webSocketPort,
|
WebSocketServiceHelper.InitService(webSocketPort,
|
||||||
(clientInfo) =>
|
(clientInfo) =>
|
||||||
{
|
{
|
||||||
return WebSocketService.OnOpenWebSocket(clientInfo);
|
return WebSocketService.OnOpenWebSocket(clientInfo, WebSocketClientInfos);
|
||||||
},
|
},
|
||||||
(clientInfo, requestInfo) =>
|
(clientInfo, requestInfo) =>
|
||||||
{
|
{
|
||||||
return WebSocketService.OnMessageWebSocket(clientInfo, requestInfo);
|
return WebSocketService.OnMessageWebSocket(clientInfo, requestInfo, WebSocketClientInfos);
|
||||||
},
|
},
|
||||||
(userId, clientInfo) =>
|
(userId, clientInfo) =>
|
||||||
{
|
{
|
||||||
WebSocketService.OnCloseWebSocket(userId, clientInfo);
|
WebSocketService.OnCloseWebSocket(userId, clientInfo, WebSocketClientInfos);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@ -49,6 +49,38 @@ namespace APT.SK.WebApi.Controllers.Api
|
|||||||
}
|
}
|
||||||
pageFilter.Include.Add("Nav_ListCheckQuestion");
|
pageFilter.Include.Add("Nav_ListCheckQuestion");
|
||||||
return WitOrderPaged(null, pageFilter);
|
return WitOrderPaged(null, pageFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得单条实体数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filter">过滤实体</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost, Route("SkGet")]
|
||||||
|
public JsonActionResult<T_SK_CHECK_CONTENTS> SkGet([FromBody] KeywordFilter filter)
|
||||||
|
{
|
||||||
|
return SafeExecute<T_SK_CHECK_CONTENTS>(() =>
|
||||||
|
{
|
||||||
|
if(filter.FilterGroup.Rules.Any(t=>t.Field=="ID"))
|
||||||
|
{
|
||||||
|
var ids = filter.FilterGroup.Rules.FirstOrDefault(t => t.Field == "ID").Value.ToString();
|
||||||
|
if(ids.Contains(","))
|
||||||
|
{
|
||||||
|
var idArr = ids.Split(",");
|
||||||
|
filter.FilterGroup.Rules.Remove(filter.FilterGroup.Rules.FirstOrDefault(t => t.Field == "ID"));
|
||||||
|
filter.FilterGroup.Rules.Add(new APT.Infrastructure.Core.FilterRule
|
||||||
|
{
|
||||||
|
Field = "ID",
|
||||||
|
Operate = FilterOperate.Equal,
|
||||||
|
Value = idArr.FirstOrDefault()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var entity = this.GetEntity<T_SK_CHECK_CONTENTS>(null,filter);
|
||||||
|
return entity;
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user