根据登录用户获取打卡点

DataMaintenance
zhangbin 2025-11-06 09:20:24 +08:00
parent 0d9db50c3a
commit ff91662227
3 changed files with 75 additions and 2 deletions

View File

@ -409,6 +409,51 @@ namespace OpenAuth.App.ServiceApp.FireManagement
}
}
//app根据登录用户获取打卡点
public async Task<Response<PageInfo<List<dynamic>>>> GetCheckPointByUserId(string userid)
{
using (SugarDbContext db = base.UnitWork.CreateContext())
{
var list = await db.FmCheckPointUser.AsQueryable()
.LeftJoin<FmCheckInPoint>((a, b) => a.PointId == b.Id)
.Where((a, b) => b.IsDelete == false || b.IsDelete == null)
.Select<dynamic>((a, b) => new
{
id = b.Id,
pointname = b.PointName,
lat = b.Lat,
lng = b.Lng,
ischecked = false
}).ToListAsync();
var clockon = await db.FmCheckClockOn.AsQueryable()
.Where(r => r.UserId.ToString() == userid)
.GroupBy(r => r.PointId)
.Select(r => new
{
pointid = r.PointId,
time = SqlFunc.AggregateMax(r.ClockonTime)
}).ToListAsync();
if (clockon.Count > 0)
{
foreach (var item in list)
{
var data = clockon.Where(r => r.pointid == item.id).ToList();
if (data.Count > 0 && (DateTime.Now - data[0].time).Days < 1)
{
item.ischecked = true;
}
}
}
return new Response<PageInfo<List<dynamic>>>
{
Result = new PageInfo<List<dynamic>> { Items = list, Total = list.Count }
};
}
}
//导出统计
//public async MemoryStream ExportStatistics(long areaid, DateTime begintime, DateTime endtime)
//{

View File

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using OpenAuth.App.Response;
using OpenAuth.App.ServiceApp.FireManagement;
using OpenAuth.App.ServiceApp.FireManagement.Request;
using OpenAuth.App.ServiceApp.FireManagement.Response;
@ -50,12 +51,12 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
/// <param name="limit"></param>
/// <returns></returns>
[HttpGet]
public async Task<Response<PageInfo<List<dynamic>>>> GetCheckPointList(long areaid,string pointName, int page, int limit)
public async Task<Response<PageInfo<List<dynamic>>>> GetCheckPointList(long areaid, string pointName, int page, int limit)
{
Response<PageInfo<List<dynamic>>> response = new Response<PageInfo<List<dynamic>>>();
try
{
return await _app.GetCheckPointList(areaid,pointName, page, limit);
return await _app.GetCheckPointList(areaid, pointName, page, limit);
}
catch (Exception ex)
{
@ -213,6 +214,17 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
return response;
}
/// <summary>
/// app根据登录用户获取打卡点
/// </summary>
/// <param name="userid">用户id</param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<Response<PageInfo<List<dynamic>>>> GetCheckPointByUserId(string userid)
{
return await _app.GetCheckPointByUserId(userid);
}
/// <summary>
/// 数据总览
/// </summary>
/// <param name="areaid"></param>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<key id="f7f79039-af47-471a-998d-a8819b680267" version="1">
<creationDate>2025-11-03T01:16:49.1065756Z</creationDate>
<activationDate>2025-11-03T01:16:49.075783Z</activationDate>
<expirationDate>2026-02-01T01:16:49.075783Z</expirationDate>
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<descriptor>
<encryption algorithm="AES_256_CBC" />
<validation algorithm="HMACSHA256" />
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
<!-- Warning: the key below is in an unencrypted form. -->
<value>J9+AC6LMlIPct5snU2v9+p0ZACCG7YKEHc9CwlDurPcMVNT76hangAJp1c7a8QPO2tu6MntfZbVpdYgLiH/ATA==</value>
</masterKey>
</descriptor>
</descriptor>
</key>