Browse Source

用户管理查询列表接口调整

master
liujiaqiang 2 years ago
parent
commit
e2a7f5ed8f
  1. 2
      24Hour/Controllers/Common/ReservationController.cs
  2. 59
      24Hour/Controllers/Common/WebSocketController.cs
  3. 33
      24Hour/Controllers/system/SystemControllerController.cs
  4. 12
      24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230614/16.log
  5. 72
      24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230614/17.log
  6. 2
      Elight.Entity/AppMode/App_ReceptionModel.cs
  7. 2
      Elight.Entity/AppMode/StagingModel.cs
  8. 2
      Elight.Entity/AppMode/StagingNumModel.cs
  9. 2
      Elight.Entity/SystemModel/App_Sys_DepartModel.cs
  10. 10
      Elight.Entity/SystemModel/App_Sys_MenuModel.cs
  11. 2
      Elight.Entity/SystemModel/App_Sys_RoleMenuModel.cs
  12. 2
      Elight.Entity/SystemModel/App_Sys_RoleModel.cs
  13. 2
      Elight.Entity/SystemModel/App_Sys_RoleUserModel.cs
  14. 2
      Elight.Entity/SystemModel/App_Sys_UnitModel.cs
  15. 10
      Elight.Entity/SystemModel/App_Sys_UserModel.cs
  16. 2
      Elight.Entity/SystemModel/Func_Dossier_LogRecordModel.cs

2
24Hour/Controllers/Common/ReservationController.cs

@ -56,7 +56,7 @@ namespace _24Hour.Controllers.Common
.Where(q => q.IsDelete == 0).ToPageListAsync(Reception.PageIndex, Reception.PageSize);
list.ForEach(q =>
{
var data = app_staging.Where(a => a.Id == q.receptionId).First();
var data = app_staging.Where(a => a.Id == q.receptionId).FirstOrDefault();
if (data != null)
{
q.receptionId = data.title;

59
24Hour/Controllers/Common/WebSocketController.cs

@ -1,6 +1,8 @@
using Elight.Entity;
using Elight.Logic;
using Elight.Utility;
using Elight.Utility.Code;
using javax.xml.crypto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
@ -16,6 +18,7 @@ namespace _24Hour.Controllers.Common
private readonly SqlSugarClient _db;//数据库
App_Sys_UserModel _userdata = new App_Sys_UserModel();//当前用户
private readonly ILogger<LoginController> _logger;//日志
Result result = new Result();
private static Dictionary<string, WebSocket> CONNECT_POOL = new Dictionary<string, WebSocket>();//用户连接池
//private static Dictionary<string, List<MessageInfo>> MESSAGE_POOL = new Dictionary<string, List<MessageInfo>>();//离线消息池
public WebSocketController(ILogger<LoginController> logger, SqlSugarClient db, User user)
@ -158,53 +161,55 @@ namespace _24Hour.Controllers.Common
/// <returns></returns>
[HttpPost]
[Route("text")]
public async Task text(WebSocketSending Sendingdata)
public async Task<Result> text()
{
try
{
//获取发送人连接
var socket = CONNECT_POOL.Where(q => q.Key == _userdata.Id).Select(q => q.Value).First();
while (true)
if (socket.State == WebSocketState.Open)
{
if (socket.State == WebSocketState.Open)
{
ArraySegment<byte> buffer = new ArraySegment<byte>(new byte[2048]);
WebSocketReceiveResult result = await socket.ReceiveAsync(buffer, CancellationToken.None);
ArraySegment<byte> buffer = new ArraySegment<byte>(new byte[2048]);
//WebSocketReceiveResult result = await socket.ReceiveAsync(buffer, CancellationToken.None);
#region 消息处理(消息转发)
try
#region 消息处理(消息转发)
try
{
#region 关闭Socket处理,删除连接池
if (socket.State != WebSocketState.Open)//连接关闭
{
#region 关闭Socket处理,删除连接池
if (socket.State != WebSocketState.Open)//连接关闭
{
if (CONNECT_POOL.ContainsKey(_userdata.Id)) CONNECT_POOL.Remove(_userdata.Id);//删除连接池
break;
}
#endregion
if (CONNECT_POOL.ContainsKey(_userdata.Id)) CONNECT_POOL.Remove(_userdata.Id);//删除连接池
result.IsSucceed = true;
result.result = "";
return result;
}
#endregion
#region 消息发送
var content = JsonConvert.SerializeObject(Sendingdata);
buffer = new ArraySegment<byte>(Encoding.UTF8.GetBytes(content));
await socket.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken.None);
#endregion
}
catch (Exception exs)
{
//消息转发异常处理,本次消息忽略 继续监听接下来的消息
}
#region 消息发送
var content = "测试test";
buffer = new ArraySegment<byte>(Encoding.UTF8.GetBytes(content));
await socket.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken.None);
#endregion
}
else
catch (Exception exs)
{
//消息转发异常处理,本次消息忽略 继续监听接下来的消息
}
}//while end
#endregion
}
else
{
}
}
catch (Exception)
{
//整体异常处理
if (CONNECT_POOL.ContainsKey(_userdata.Id)) CONNECT_POOL.Remove(_userdata.Id);
}
result.IsSucceed = true;
result.result = "";
return result;
}
}

33
24Hour/Controllers/system/SystemControllerController.cs

@ -42,6 +42,10 @@ namespace _24Hour.Controllers.system
[Route("QueryUser0")]
public async Task<Result> QueryUser0(App_Sys_UserInput UserModel)
{
var userlist = new List<dynamic>();
var Unitlist = await _db.Queryable<App_Sys_UnitModel>().Where(q => q.IsDelete == 0).ToListAsync();
var Departlist = await _db.Queryable<App_Sys_DepartModel>().Where(q => q.IsDelete == 0).ToListAsync();
var list = await _db.Queryable<App_Sys_UserModel>()
.WhereIF(!UserModel.name.IsNull(), q => q.name.Contains(UserModel.name))
.WhereIF(!UserModel.phone.IsNull(), q => q.phone.Contains(UserModel.phone))
@ -49,7 +53,30 @@ namespace _24Hour.Controllers.system
.WhereIF(!UserModel.cardId.IsNull(), q => q.cardId.Contains(UserModel.cardId))
.Where(q => q.IsDeleted == 0 && q.usertype == 0)
.ToPageListAsync(UserModel.PageIndex, UserModel.PageSize);
var data = new QueryResult<App_Sys_UserModel>(UserModel, list);
list.ForEach(q => {
var Unitdata = Unitlist.Where(x => x.Id == q.unitCode)?.FirstOrDefault();
var Departdata = Departlist.Where(x => x.Id == q.department)?.FirstOrDefault();
userlist.Add(new
{
q.Id,
q.unitCode,
q.department,
q.name,
q.sex,
q.duties,
q.phone,
q.cardId,
q.wechatId,
q.isdeactivate,
q.becurrent,
q.photo,
q.identity,
q.createtime,
unitname = Unitdata?.unitname,
departname= Departdata?.departname
});
});
var data = new { Paging = UserModel,Data = userlist};
result.IsSucceed = true;
result.result = data;
return result;
@ -237,9 +264,9 @@ namespace _24Hour.Controllers.system
[Route("QueryRole")]
public async Task<Result> QueryRole(App_Sys_RoleInput roledata)
{
var totalCount = 0;
var list = await _db.Queryable<App_Sys_RoleModel>()
.WhereIF(roledata.name.NotNull(), q => q.name.Contains(roledata.name))
.WhereIF(roledata.unitCode.NotNull(), q => q.unitCode.Contains(roledata.unitCode))
.Where(q => q.IsDeleted == 0).ToPageListAsync(roledata.PageIndex, roledata.PageSize);
var data = new QueryResult<App_Sys_RoleModel>(roledata, list);
result.IsSucceed = true;
@ -1016,7 +1043,7 @@ namespace _24Hour.Controllers.system
datalist.ForEach(item =>
{
var data = pidlist.Where(q => q.Id == item.pid).First();
var data = pidlist.Where(q => q.Id == item.pid).FirstOrDefault();
if (data != null)
{
var childrenlist = new List<dynamic>();

12
24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230614/16.log

@ -0,0 +1,12 @@
日志时间:2023-06-14 16:50:49
************************Exception Start********************************
Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常
Exception Date:2023/6/14 16:50:49
Exception Type:MySqlConnector.MySqlException
Exception Message:Unknown column 'SerialNumber' in 'field list'
Exception Source:SqlSugar
Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters)
at SqlSugar.InsertableProvider`1.ExecuteCommand()
at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 51
************************Exception End************************************

72
24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230614/17.log

@ -0,0 +1,72 @@
日志时间:2023-06-14 17:05:00
************************Exception Start********************************
Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常
Exception Date:2023/6/14 17:05:00
Exception Type:MySqlConnector.MySqlException
Exception Message:Unknown column 'SerialNumber' in 'field list'
Exception Source:SqlSugar
Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters)
at SqlSugar.InsertableProvider`1.ExecuteCommand()
at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 51
************************Exception End************************************
日志时间:2023-06-14 17:10:15
************************Exception Start********************************
Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常
Exception Date:2023/6/14 17:10:15
Exception Type:MySqlConnector.MySqlException
Exception Message:Unknown column 'SerialNumber' in 'field list'
Exception Source:SqlSugar
Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters)
at SqlSugar.InsertableProvider`1.ExecuteCommand()
at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 51
************************Exception End************************************
日志时间:2023-06-14 17:11:43
************************Exception Start********************************
Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常
Exception Date:2023/6/14 17:11:43
Exception Type:MySqlConnector.MySqlException
Exception Message:Unknown column 'SerialNumber' in 'field list'
Exception Source:SqlSugar
Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters)
at SqlSugar.InsertableProvider`1.ExecuteCommand()
at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 51
************************Exception End************************************
日志时间:2023-06-14 17:31:14
************************Exception Start********************************
Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常
Exception Date:2023/6/14 17:31:14
Exception Type:MySqlConnector.MySqlException
Exception Message:Unknown column 'SerialNumber' in 'field list'
Exception Source:SqlSugar
Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters)
at SqlSugar.InsertableProvider`1.ExecuteCommand()
at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 51
************************Exception End************************************
日志时间:2023-06-14 17:36:33
************************Exception Start********************************
Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常
Exception Date:2023/6/14 17:36:33
Exception Type:MySqlConnector.MySqlException
Exception Message:Unknown column 'SerialNumber' in 'field list'
Exception Source:SqlSugar
Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters)
at SqlSugar.InsertableProvider`1.ExecuteCommand()
at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 51
************************Exception End************************************
日志时间:2023-06-14 17:52:35
************************Exception Start********************************
Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常
Exception Date:2023/6/14 17:52:35
Exception Type:MySqlConnector.MySqlException
Exception Message:Unknown column 'SerialNumber' in 'field list'
Exception Source:SqlSugar
Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters)
at SqlSugar.InsertableProvider`1.ExecuteCommand()
at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 51
************************Exception End************************************

2
Elight.Entity/AppMode/App_ReceptionModel.cs

@ -73,6 +73,6 @@ namespace Elight.Entity
/// 是否删除:0:未删除、1:删除
/// </summary>
[DataMember]
public int IsDelete { get; set; } = 0;
public int? IsDelete { get; set; } = 0;
}
}

2
Elight.Entity/AppMode/StagingModel.cs

@ -67,6 +67,6 @@ namespace Elight.Entity
/// 是否删除:0:未删除、1:删除
/// </summary>
[DataMember]
public int IsDelete { get; set; } = 0;
public int? IsDelete { get; set; } = 0;
}
}

2
Elight.Entity/AppMode/StagingNumModel.cs

@ -49,6 +49,6 @@ namespace Elight.Entity
/// 是否删除:0:未删除、1:删除
/// </summary>
[DataMember]
public int IsDelete { get; set; } = 0;
public int? IsDelete { get; set; } = 0;
}
}

2
Elight.Entity/SystemModel/App_Sys_DepartModel.cs

@ -45,7 +45,7 @@ namespace Elight.Entity
/// 是否删除 0否,1是
/// </summary>
[DataMember]
public int IsDelete { get; set; }
public int? IsDelete { get; set; } = 0;
/// <summary>
/// 创建人Id

10
Elight.Entity/SystemModel/App_Sys_MenuModel.cs

@ -69,28 +69,28 @@ namespace Elight.Entity
/// 当前菜单在列表中显示时 激活的菜单
/// </summary>
[DataMember]
public bool currentActiveMenu { get; set; }
public bool? currentActiveMenu { get; set; }
/// <summary>
/// 是否隐藏面包眉
/// </summary>
[DataMember]
public bool hideBreadcrumb { get; set; }
public bool? hideBreadcrumb { get; set; }
/// <summary>
/// 是否隐藏当前菜单
/// </summary>
[DataMember]
public bool hideMenu { get; set; }
public bool? hideMenu { get; set; }
/// <summary>
/// 排序
/// </summary>
[DataMember]
public int sortnum { get; set; }
public int? sortnum { get; set; }
/// <summary>
/// 是否删除 0否,1是
/// </summary>
[DataMember]
public int IsDelete { get; set; }
public int? IsDelete { get; set; } = 0;
/// <summary>
/// 创建人Id

2
Elight.Entity/SystemModel/App_Sys_RoleMenuModel.cs

@ -54,7 +54,7 @@ namespace Elight.Entity
/// 是否删除
/// </summary>
[DataMember]
public int IsDeleted { get; set; } = 0;
public int? IsDeleted { get; set; } = 0;
}
}

2
Elight.Entity/SystemModel/App_Sys_RoleModel.cs

@ -54,7 +54,7 @@ namespace Elight.Entity
/// 是否删除
/// </summary>
[DataMember]
public int IsDeleted { get; set; } = 0;
public int? IsDeleted { get; set; } = 0;
}
}

2
Elight.Entity/SystemModel/App_Sys_RoleUserModel.cs

@ -54,7 +54,7 @@ namespace Elight.Entity
/// 是否删除
/// </summary>
[DataMember]
public int IsDeleted { get; set; } = 0;
public int? IsDeleted { get; set; } = 0;
}
}

2
Elight.Entity/SystemModel/App_Sys_UnitModel.cs

@ -46,7 +46,7 @@ namespace Elight.Entity
/// 是否删除 0否,1是
/// </summary>
[DataMember]
public int IsDelete { get; set; }
public int? IsDelete { get; set; }=0;
/// <summary>
/// 创建人Id

10
Elight.Entity/SystemModel/App_Sys_UserModel.cs

@ -77,19 +77,19 @@ namespace Elight.Entity
/// 账号类型0:系统,1:APP
/// </summary>
[DataMember]
public int usertype { get; set; }
public int? usertype { get; set; }
/// <summary>
/// 是否停用 0:启用,1禁用
/// </summary>
[DataMember]
public int isdeactivate { get; set; }
public int? isdeactivate { get; set; }
/// <summary>
/// 是否App通用:0:通用,1:不通用
/// </summary>
[DataMember]
public int becurrent { get; set; }
public int? becurrent { get; set; }
/// <summary>
/// 头像地址
@ -101,13 +101,13 @@ namespace Elight.Entity
/// 性别 0:女 1:男
/// </summary>
[DataMember]
public int sex { get; set; }
public int? sex { get; set; }
/// <summary>
/// 是否删除
/// </summary>
[DataMember]
public int IsDeleted { get; set; } = 0;
public int? IsDeleted { get; set; } = 0;
/// <summary>
/// 审核状态
/// </summary>

2
Elight.Entity/SystemModel/Func_Dossier_LogRecordModel.cs

@ -99,7 +99,7 @@ namespace Elight.Entity.SystemModel
/// 是否删除
/// </summary>
[DataMember]
public int IsDeleted { get; set; }
public int? IsDeleted { get; set; }
/*CodeAutoBuilderArea*/

Loading…
Cancel
Save