Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development
This commit is contained in:
@@ -84,4 +84,19 @@ public class DevicePageResponse
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool Enable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否在线
|
||||
/// </summary>
|
||||
public bool IsOnline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费总额
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费人次
|
||||
/// </summary>
|
||||
public int UserCount { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.Scope;
|
||||
@@ -11,7 +13,6 @@ using Kurisu.SqlSugar.Attributes;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -40,9 +41,51 @@ public class DeviceService : IDeviceService
|
||||
}, true)
|
||||
.ToPageListAsync(request);
|
||||
|
||||
var now = DateTime.Now;
|
||||
var deviceUniqueNos = page.Data.Select(x => x.UniqueNo).ToList();
|
||||
|
||||
var balanceRecords = await _dbContext.Queryable<BalanceRecordEntity>().Where(x => x.Type == BalanceRecordTypeEnumType.Out)
|
||||
.Where(x => deviceUniqueNos.Contains(x.DeviceInfo))
|
||||
.ToListAsync();
|
||||
|
||||
var deviceRegistries = await _dbContext.Queryable<DeviceRegistryEntity>()
|
||||
.LeftJoin<DeviceEntity>((x, d) => x.DeviceUniqueNo == d.UniqueNo)
|
||||
.Where(x => deviceUniqueNos.Contains(x.DeviceUniqueNo))
|
||||
.Select((x, d) => new
|
||||
{
|
||||
d.HeartbeatInterval,
|
||||
x.LastHeartbeatTime,
|
||||
x.DeviceUniqueNo,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
page.Data.ForEach(device =>
|
||||
{
|
||||
device.Amount = balanceRecords.Sum(x => x.Amount);
|
||||
device.UserCount = balanceRecords.DistinctBy(x => x.UserCode).Count();
|
||||
|
||||
var r = deviceRegistries.FirstOrDefault(x => x.DeviceUniqueNo == device.UniqueNo);
|
||||
if (r == null)
|
||||
{
|
||||
device.IsOnline = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (r.HeartbeatInterval <= 0)
|
||||
{
|
||||
device.IsOnline = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
device.IsOnline = r.LastHeartbeatTime.AddSeconds(r.HeartbeatInterval * 3) >= now;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
[Transactional]
|
||||
public async Task SaveAsync(DeviceSaveRequest request)
|
||||
{
|
||||
@@ -288,7 +331,7 @@ public class DeviceService : IDeviceService
|
||||
dbContext.Client.CurrentConnectionConfig.ConnectionString = logConnectionString;
|
||||
var logs = await dbContext.Queryable<ApiLogEntity>()
|
||||
.WhereIF(!request.message.IsEmpty(), x => x.Message.Contains(request.message))
|
||||
.WhereIF(!level.IsEmpty(),x => x.Level == level)
|
||||
.WhereIF(!level.IsEmpty(), x => x.Level == level)
|
||||
.Select<ApiLogResponse>()
|
||||
.ToPageListAsync(request);
|
||||
return logs;
|
||||
|
||||
@@ -141,7 +141,7 @@ public class GainfosController : ControllerBase
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
public async Task<Pagination<GainfoListResponse>> GetGainfoListTaskAsync([FromQuery]GainfoListRequest request)
|
||||
public async Task<Pagination<GainfoListResponse>> GetGainfoListTaskAsync([FromQuery] GainfoListRequest request)
|
||||
{
|
||||
return await _gainfoService.GetGainfoListTaskAsync(request);
|
||||
}
|
||||
@@ -155,57 +155,5 @@ public class GainfosController : ControllerBase
|
||||
{
|
||||
return await _gainfoService.GetGainfoDetailTaskAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取近七天入职人数及列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("weeknumber")]
|
||||
public async Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetWeekNumberAsync([FromQuery] WeekNumberRequest request)
|
||||
{
|
||||
// 从请求头中获取 Token
|
||||
string token = HttpContext.Request.Headers["Authorization"].ToString().Replace("Bearer ", "");
|
||||
|
||||
return await _gainfoService.GetWeekNumberAsync(request,token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取近七天离职人数及列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("weeknumberdimission")]
|
||||
public async Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetDimissionWeekNumberAsync([FromQuery] WeekNumberRequest request)
|
||||
{
|
||||
// 从请求头中获取 Token
|
||||
string token = HttpContext.Request.Headers["Authorization"].ToString().Replace("Bearer ", "");
|
||||
|
||||
return await _gainfoService.GetDimissionWeekNumberAsync(request,token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取基地在职、离职、考勤数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("gainfonumbers")]
|
||||
public async Task<GainfoGainfoNumbersResponse> GetGainfoNumbersAsync()
|
||||
{
|
||||
// 从请求头中获取 Token
|
||||
string token = HttpContext.Request.Headers["Authorization"].ToString().Replace("Bearer ", "");
|
||||
|
||||
return await _gainfoService.GetGainfoNumbersAsync(token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取本基地管理员列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("administrator")]
|
||||
public async Task<Pagination<GainfoDetailResponse>> GetAdministratorAsync([FromQuery] WeekNumberRequest request)
|
||||
{
|
||||
// 从请求头中获取 Token
|
||||
string token = HttpContext.Request.Headers["Authorization"].ToString().Replace("Bearer ", "");
|
||||
return await _gainfoService.GetAdministratorAsync(request,token);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,11 +110,6 @@ public class GainfoSaveRequest : IValidatableObject
|
||||
/// </summary>
|
||||
public string Werks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在职状态
|
||||
/// </summary>
|
||||
public string Employed { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (GainfoStatus.HasValue && GainfoStatus == GainfoStatusEnumType.Leave)
|
||||
|
||||
@@ -105,10 +105,5 @@ namespace Dlhis.Basic.Organization.Response
|
||||
/// 民族代码
|
||||
/// </summary>
|
||||
public string NationName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否在职
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,60 +1,51 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using SqlSugar;
|
||||
using SqlSugar.DbConvert;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Response
|
||||
namespace Dlhis.Basic.Organization.Response;
|
||||
|
||||
public class GainfoListResponse
|
||||
{
|
||||
public class GainfoListResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 档案号
|
||||
/// </summary>
|
||||
public string No { get; set; }
|
||||
/// <summary>
|
||||
/// 档案号
|
||||
/// </summary>
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
public string IdNo { get; set; }
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public GenderEnumType Gender { get; set; }
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public GenderEnumType Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门编码
|
||||
/// </summary>
|
||||
public string DepartmentNo { get; set; }
|
||||
/// <summary>
|
||||
/// 部门编码
|
||||
/// </summary>
|
||||
public string DepartmentNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
public string DepartmentName { get; set; }
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
public string DepartmentName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证地址
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在职状态
|
||||
/// </summary>
|
||||
public string Employed { get; set; }
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 身份证地址
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
}
|
||||
|
||||
@@ -112,9 +112,4 @@ public class GainfoPageResponse
|
||||
/// 人事范围
|
||||
/// </summary>
|
||||
public string Werks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在职状态
|
||||
/// </summary>
|
||||
public string Employed { get; set; }
|
||||
}
|
||||
|
||||
@@ -31,12 +31,4 @@ public interface IGainfoService : IScopeDependency
|
||||
Task<Pagination<GainfoListResponse>> GetGainfoListTaskAsync(GainfoListRequest request);
|
||||
|
||||
Task<GainfoDetailResponse> GetGainfoDetailTaskAsync(GainfoDetailRequest request);
|
||||
|
||||
Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetWeekNumberAsync(WeekNumberRequest request, string token);
|
||||
|
||||
Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetDimissionWeekNumberAsync([FromQuery] WeekNumberRequest request, string token);
|
||||
|
||||
Task<GainfoGainfoNumbersResponse> GetGainfoNumbersAsync(string token);
|
||||
|
||||
Task<Pagination<GainfoDetailResponse>> GetAdministratorAsync(WeekNumberRequest request,string token);
|
||||
}
|
||||
|
||||
@@ -333,10 +333,10 @@ public class GainfoService : IGainfoService
|
||||
DepartmentNo = de.No,
|
||||
DepartmentName = de.Name,
|
||||
Address = ga.Address,
|
||||
Employed = ga.Employed
|
||||
}).ToPageListAsync(request);
|
||||
return page;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案详情
|
||||
/// </summary>
|
||||
@@ -373,8 +373,8 @@ public class GainfoService : IGainfoService
|
||||
Marital = ga.Marital,
|
||||
CountryName = type2.Display,
|
||||
NationName = type3.Display,
|
||||
IsActive = ga.Employed == "Active" ? true : false,
|
||||
}).FirstAsync();
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -425,11 +425,8 @@ public class GainfoService : IGainfoService
|
||||
Marital = ga.Marital,
|
||||
CountryName = type2.Display,
|
||||
NationName = type3.Display,
|
||||
IsActive = ga.Employed == "Active" ? true : false,
|
||||
}).ToPageListAsync(request);
|
||||
//var infos = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||
// .Where(ga => ga.CreateTime.ToString("yyyy-MM-dd") == time)
|
||||
// .ToPageListAsync(request);
|
||||
|
||||
dic[time] = infos;
|
||||
}
|
||||
return dic;
|
||||
@@ -481,7 +478,6 @@ public class GainfoService : IGainfoService
|
||||
Marital = ga.Marital,
|
||||
CountryName = type2.Display,
|
||||
NationName = type3.Display,
|
||||
IsActive = ga.Employed == "Active" ? true : false,
|
||||
}).ToPageListAsync(request);
|
||||
dic[time] = infos;
|
||||
}
|
||||
@@ -514,44 +510,6 @@ public class GainfoService : IGainfoService
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<Pagination<GainfoDetailResponse>> GetAdministratorAsync( WeekNumberRequest request, string token)
|
||||
{
|
||||
var werks = GetClaimValueFromToken(token, "tenant");
|
||||
var info = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||
.LeftJoin<DepartmentEntity>((ga, de) => ga.DepartmentNo == de.No)
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type) => ga.Native == type.Code && type.Type == "native")
|
||||
.LeftJoin<PositionEntity>((ga, de, type, posi) => ga.Position == posi.Name)
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi, type2) => ga.CountryNo == type2.Code && type2.Type == "country")
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi, type2, type3) => ga.Nation == type3.Code && type3.Type == "nation")
|
||||
.Where(ga => ga.Werks == werks && ga.IdentityUserId != 0)
|
||||
.Select((ga, de, type, posi, type2, type3) => new GainfoDetailResponse
|
||||
{
|
||||
No = ga.No,
|
||||
SapNo = ga.SapNo,
|
||||
Name = ga.Name,
|
||||
Code = ga.Code,
|
||||
DepartmentName = de.Name,
|
||||
IdClass = ga.IdClass,
|
||||
IdNo = ga.IdNo,
|
||||
Gender = ga.Gender,
|
||||
NativeName = type.Display,
|
||||
Address = ga.Address,
|
||||
Birthday = ga.Birthday,
|
||||
Phone = ga.Phone,
|
||||
Position = ga.Position,
|
||||
Grade = posi.Grade,
|
||||
Degree = ga.Degree,
|
||||
Werks = ga.Werks,
|
||||
CostId = ga.CostId,
|
||||
Marital = ga.Marital,
|
||||
CountryName = type2.Display,
|
||||
NationName = type3.Display,
|
||||
IsActive = ga.Employed == "Active" ? true : false,
|
||||
}).ToPageListAsync(request);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
//-------------------------------------------help methods ------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore;
|
||||
using Kurisu.AspNetCore;
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -148,12 +148,6 @@ public class GainfoEntity : SugarBaseEntity
|
||||
/// </summary>
|
||||
public string CostId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在职状态
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "在职状态")]
|
||||
public string Employed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份认证用户Id
|
||||
/// </summary>
|
||||
|
||||
@@ -85,8 +85,8 @@ public class RolesController : ControllerBase
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("my")]
|
||||
public async Task<RoleRespone> GetMyRoleAsync()
|
||||
public async Task<RoleRespone> GetMyRoleAsync(int? userId)
|
||||
{
|
||||
return await _roleService.GetMyRoleAsync();
|
||||
return await _roleService.GetMyRoleAsync(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,4 +58,10 @@ public class UserResponse
|
||||
/// 登陆失败次数
|
||||
/// </summary>
|
||||
public int AccessFailedCount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色
|
||||
/// </summary>
|
||||
public string Role { get; set; }
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public interface IRoleService : IScopeDependency
|
||||
|
||||
Task SaveRoleAsync(RoleSaveRequest request);
|
||||
|
||||
Task<RoleRespone> GetMyRoleAsync();
|
||||
Task<RoleRespone> GetMyRoleAsync(int? userId);
|
||||
|
||||
Task RemoveRoleAsync(RoleRemoveRequest request);
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Sys.Identity.Services.Implements;
|
||||
|
||||
@@ -40,9 +39,9 @@ public class RoleService : IRoleService
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<RoleRespone> GetMyRoleAsync()
|
||||
public async Task<RoleRespone> GetMyRoleAsync(int? userId)
|
||||
{
|
||||
var userId = _currentUser.GetIntSubjectId();
|
||||
userId ??= _currentUser.GetIntSubjectId();
|
||||
|
||||
return await Scoped.Request.Value.CreateAsync(async sp =>
|
||||
{
|
||||
@@ -50,7 +49,6 @@ public class RoleService : IRoleService
|
||||
var identityConnection = _configuration.GetSection("SqlSugarOptions:IdentityConnectionString").Value;
|
||||
dbContext.Client.CurrentConnectionConfig.ConnectionString = identityConnection;
|
||||
|
||||
|
||||
return await dbContext.Queryable<UserRoleEntity>()
|
||||
.LeftJoin<RoleEntity>((x, r) => x.RoleId == r.Id)
|
||||
.Where(x => x.UserId == userId)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Configuration;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.Sys.Identity.Request;
|
||||
using Dlhis.Sys.Identity.Response;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
@@ -23,13 +22,18 @@ public class UserService : IUserService
|
||||
public async Task<Pagination<UserResponse>> GetPageAsync(UserPageRequest request)
|
||||
{
|
||||
return await _dbContext.Queryable<UserEntity>()
|
||||
.LeftJoin<UserRoleEntity>((x, ur) => x.Id == ur.UserId)
|
||||
.LeftJoin<RoleEntity>((x, ur, r) => ur.RoleId == r.Id)
|
||||
.WhereIF(request.Search.IsPresent(), x => x.UserName.Contains(request.Search)
|
||||
|| x.NormalizedUserName.Contains(request.Search)
|
||||
|| x.Email.Contains(request.Search)
|
||||
|| x.NormalizedEmail.Contains(request.Search)
|
||||
|| x.PhoneNumber.Contains(request.Search)
|
||||
)
|
||||
.Select<UserResponse>()
|
||||
.Select((x, ur, r) => new UserResponse
|
||||
{
|
||||
Id = x.Id
|
||||
}, true)
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user