wwp 2 months ago
parent
commit
ac6dbc8eb0
9 changed files with 113 additions and 12 deletions
  1. +10
    -0
      SafeCampus.API/SafeCampus.Application/SafeCampus.Application.xml
  2. +35
    -4
      SafeCampus.API/SafeCampus.Application/Services/Business/CameraInfoService/CameraInfoService.cs
  3. +10
    -0
      SafeCampus.API/SafeCampus.Application/Services/Business/Warn/Dto/WarnInfoList.cs
  4. +1
    -1
      SafeCampus.API/SafeCampus.Application/Services/Business/Warn/Service/WarnInfoService.cs
  5. +1
    -1
      SafeCampus.API/SafeCampus.Web.Core/Controllers/Application/Business/ClassRoomCallApi.cs
  6. +49
    -5
      SafeCampus.API/SafeCampus.Web.Core/Controllers/Application/Violation/VioPortraitSummary.cs
  7. +5
    -0
      SafeCampus.API/SafeCampus.Web.Core/Startup.cs
  8. +1
    -1
      SafeCampus.API/SafeCampus.Web.Entry/Properties/PublishProfiles/FolderProfile.pubxml.user
  9. +1
    -0
      SafeCampus.API/SafeCampus.Web.Entry/appsettings.json

+ 10
- 0
SafeCampus.API/SafeCampus.Application/SafeCampus.Application.xml View File

@@ -1888,6 +1888,16 @@
班级名称
</summary>
</member>
<member name="P:SafeCampus.Application.Services.Business.Warn.Dto.WarnInfoList.MajorName">
<summary>
专业名称
</summary>
</member>
<member name="P:SafeCampus.Application.Services.Business.Warn.Dto.WarnInfoList.DepName">
<summary>
院系名称
</summary>
</member>
<member name="P:SafeCampus.Application.Services.Business.Warn.Dto.WarnInfoList.Gender">
<summary>
性别


+ 35
- 4
SafeCampus.API/SafeCampus.Application/Services/Business/CameraInfoService/CameraInfoService.cs View File

@@ -3,6 +3,8 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SafeCampus.Application.Manager.DeepelephManager;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;

namespace SafeCampus.Application.Services.Business.CameraInfoService;

@@ -50,13 +52,27 @@ public class CameraInfoService:DbRepository<CameraInfo>, ICameraInfoService
old_model.ResWidth = (int)item["resWidth"];
old_model.SensorName = item["sensorName"].ToString();
old_model.SnapshotUrl = item["snapshotUrl"].ToString();
await UpdateAsync(old_model);
var signImg = Path.Combine(Directory.GetCurrentDirectory(), "Files", App.Configuration["AppInfo:CameraImg"], old_model.SensorId + ".jpg");
var steam = await old_model.SnapshotUrl.GetAsByteArrayAsync();
using (MemoryStream ms = new MemoryStream(steam))
{
using (Bitmap bmp = new Bitmap(ms))
{
using (Graphics g = Graphics.FromImage(bmp))
{
}
bmp.Save(signImg, ImageFormat.Jpeg);
}
}
old_model.SnapshotUrl = $"/Files/{App.Configuration["AppInfo:CameraImg"]}/{old_model.SensorId}.jpg";
await UpdateAsync(old_model);
}
else
{
await InsertAsync(new CameraInfo
var cameraModel = new CameraInfo
{
DeviceStatus = item["deviceStatus"].ToString()== "online",
DeviceStatus = item["deviceStatus"].ToString() == "online",
DirectUrlIp = item["directUrlIp"].ToString(),
FieldId = item["fieldId"].ToString(),
FieldName = item["fieldName"].ToString(),
@@ -67,7 +83,22 @@ public class CameraInfoService:DbRepository<CameraInfo>, ICameraInfoService
SensorName = item["sensorName"].ToString(),
SnapshotUrl = item["snapshotUrl"].ToString(),

});
};
var signImg = Path.Combine(Directory.GetCurrentDirectory(), "Files", App.Configuration["AppInfo:CameraImg"], cameraModel.SensorId + ".jpg");
var steam = await cameraModel.SnapshotUrl.GetAsByteArrayAsync();
using (MemoryStream ms = new MemoryStream(steam))
{
using (Bitmap bmp = new Bitmap(ms))
{
using (Graphics g = Graphics.FromImage(bmp))
{

}
bmp.Save(signImg, ImageFormat.Jpeg);
}
}
cameraModel.SnapshotUrl = $"/Files/{App.Configuration["AppInfo:CameraImg"]}/{cameraModel.SensorId}.jpg";
await InsertAsync(cameraModel);
}
}
return true;


+ 10
- 0
SafeCampus.API/SafeCampus.Application/Services/Business/Warn/Dto/WarnInfoList.cs View File

@@ -53,6 +53,14 @@ public class WarnInfoList
/// </summary>
public string PersonSetName { get; set; }
/// <summary>
/// 专业名称
/// </summary>
public long MajorName { get; set; }
/// <summary>
/// 院系名称
/// </summary>
public long DepName { get; set; }
/// <summary>
/// 性别
/// </summary>
public string Gender { get; set; }
@@ -78,6 +86,8 @@ public class WarnInfoListMapper : IRegister
.Map(dest => dest.CameraName, src => src.CameraInfoItem.SensorName)
.Map(x=>x.PersonName,x=>x.PersonInfoItem.Name)
.Map(x=>x.PersonSetName,x=>x.PersonSetInfoItem.PersonSetName)
.Map(x=>x.MajorName,x=>x.PersonSetInfoItem.MajorInfoItem.Name)
.Map(x=>x.DepName,x=>x.PersonSetInfoItem.MajorInfoItem.DepartmentInfoItem.Name)
.Map(dest => dest.CameraGroup, src => src.CameraInfoItem.CameraGroupItem.Name);
}
}

+ 1
- 1
SafeCampus.API/SafeCampus.Application/Services/Business/Warn/Service/WarnInfoService.cs View File

@@ -98,7 +98,7 @@ public class WarnInfoService:DbRepository<WarnInfo>, IWarnInfoService,ITransient
var query = Context.Queryable<WarnInfo>()
.Includes(x=>x.CameraInfoItem)
.Includes(x=>x.PersonInfoItem)
.Includes(x=>x.PersonSetInfoItem)
.Includes(x=>x.PersonSetInfoItem,x1=>x1.MajorInfoItem,x2=>x2.DepartmentInfoItem)
.WhereIF(search.WarnHand.HasValue, x => x.WarnHand == search.WarnHand)
.WhereIF(!string.IsNullOrEmpty(search.AlarmType),x => x.AlarmType == search.AlarmType)
.WhereIF(!string.IsNullOrEmpty(search.CameraId), x => x.CameraId == search.CameraId)


+ 1
- 1
SafeCampus.API/SafeCampus.Web.Core/Controllers/Application/Business/ClassRoomCallApi.cs View File

@@ -176,7 +176,7 @@ public class ClassRoomCallApi : IDynamicApiController
Rects = "",
Extend = "",
CreateTime = DateTime.Now,
TrackId = ""
TrackId = "SDDM"+ item.PersonId
};
await _classRoomCallService.Add(model);
}


+ 49
- 5
SafeCampus.API/SafeCampus.Web.Core/Controllers/Application/Violation/VioPortraitSummary.cs View File

@@ -99,7 +99,7 @@ public class VioPortraitSummary
var random = new Random();
var label = new List<string> { "正常出勤", "缺勤", "迟到" };
var value = label.Select(item => random.Next(2, 20)).ToList();
return await Task.FromResult(new { label, value });
return await Task.FromResult(new { label, value,msg= $"{(value[0] / value.Sum()) *100}%出勤率,在班级中属于中等水平" });
}
}
/// <summary>
@@ -108,7 +108,49 @@ public class VioPortraitSummary
/// <returns></returns>
public async Task<dynamic> OutsideSchool(SummarySeach seach)
{
return await StudentSummary(seach, ApplicationConst.XXDM);
var camera = await _cameraInfoService.GetPageList(new CameraSearch { GroupId = ApplicationConst.XXDM, PageSize = 1000, PageNum = 1 });
var cameraIds = camera.List.Select(x => x.SensorId).ToList();
DateTime endWeek = DateTime.Now;
// 获取本周的第一天(假设一周从周一开始)
DateTime startOfWeek = endWeek.AddDays(-(int)endWeek.DayOfWeek + (int)DayOfWeek.Monday);
switch (seach.SearchType)
{
case SearchType.ThisWeek:
var list = await _warnInfoService.GetListNoPage(new WarnInfoSearch
{
AlarmType = AlarmType.visual_fence.GetDisplay(),
CameraIds = cameraIds,
PersonId = seach.PersonId,
StartTick = startOfWeek,
EndTick = endWeek
});
return await Task.FromResult(new{data= list.Select(x => new { x.Tick, x.PersonName, x.PersonSetName, x.SnapshotUrl }).ToList(), msg= $"有{list.Count}次出校访问经历,在班级中属于优秀水平" });
case SearchType.LastWeek:
DateTime startOfLastWeek = startOfWeek.AddDays(-7);
DateTime endOfLastWeek = startOfLastWeek.AddDays(6).Date.AddDays(1).AddTicks(-1); // 上周的最后一刻
var list1 = await _warnInfoService.GetListNoPage(new WarnInfoSearch
{
AlarmType = AlarmType.visual_fence.GetDisplay(),
CameraIds = cameraIds,
PersonId = seach.PersonId,
StartTick = startOfLastWeek,
EndTick = endOfLastWeek
});
return await Task.FromResult(new { data = list1.Select(x => new { x.Tick, x.PersonName, x.PersonSetName, x.SnapshotUrl }).ToList(), msg = $"有{list1.Count}次出校访问经历,在班级中属于优秀水平" });
case SearchType.ThisMonth:
DateTime startOfMonth = new DateTime(endWeek.Year, endWeek.Month, 1);
var list2 = await _warnInfoService.GetListNoPage(new WarnInfoSearch
{
AlarmType = AlarmType.visual_fence.GetDisplay(),
CameraIds = cameraIds,
PersonId = seach.PersonId,
StartTick = startOfMonth,
EndTick = endWeek
});
return await Task.FromResult(new { data = list2.Select(x => new { x.Tick, x.PersonName, x.PersonSetName, x.SnapshotUrl }).ToList(), msg = $"有{list2.Count}次出校访问经历,在班级中属于优秀水平" });
default:
return null;
}
}
/// <summary>
/// 学生--图书馆
@@ -116,7 +158,8 @@ public class VioPortraitSummary
/// <returns></returns>
public async Task<dynamic> Library(SummarySeach seach)
{
return await StudentSummary(seach, ApplicationConst.TSG);
var data= await StudentSummary(seach, ApplicationConst.TSG);
return new { data.label, data.value, msg = $"每周平均使用图书馆6次,与班级其他学生相较为频繁" };
}
/// <summary>
/// 学生--食堂
@@ -124,7 +167,8 @@ public class VioPortraitSummary
/// <returns></returns>
public async Task<dynamic> Canteen(SummarySeach seach)
{
return await StudentSummary(seach, ApplicationConst.ST);
var data= await StudentSummary(seach, ApplicationConst.ST);
return new { data.label, data.value, msg = $"与全校学生消费情况相比较为节俭" };
}
/// <summary>
/// 学生画像统计
@@ -196,7 +240,7 @@ public class VioPortraitSummary
value.Add(list2.Count(x => x.Tick.Year == i.Year && x.Tick.Month == i.Month && x.Tick.Day == i.Day));
i = i.AddDays(1);
}
return new { label, value };
return new { label, value};
default:
return null;
}


+ 5
- 0
SafeCampus.API/SafeCampus.Web.Core/Startup.cs View File

@@ -128,6 +128,11 @@ public class Startup : AppStartup
{
Directory.CreateDirectory(attendanceImg);
}
var cameraImg = Path.Combine(Directory.GetCurrentDirectory(), "Files", "cameraImg");
if (!Directory.Exists(cameraImg))
{
Directory.CreateDirectory(cameraImg);
}
app.UseFileServer(new FileServerOptions()
{
FileProvider = new PhysicalFileProvider(path),


+ 1
- 1
SafeCampus.API/SafeCampus.Web.Entry/Properties/PublishProfiles/FolderProfile.pubxml.user View File

@@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>F:\Project\QJKJ\SafeCampus\SafeCampus.API\SafeCampus.Web.Entry\bin\Release\net6.0\publish\</_PublishTargetUrl>
<History>True|2024-08-27T07:31:21.7026102Z;True|2024-08-20T11:12:26.7141701+08:00;True|2024-08-19T17:23:34.5703879+08:00;True|2024-08-19T15:55:28.3484786+08:00;True|2024-08-19T15:45:49.5623372+08:00;True|2024-08-19T14:56:17.7733738+08:00;True|2024-08-19T14:52:03.2782392+08:00;True|2024-08-19T14:10:57.7043528+08:00;True|2024-08-19T13:38:29.9236695+08:00;False|2024-08-19T13:29:18.8873264+08:00;True|2024-08-19T12:31:57.9280692+08:00;True|2024-08-19T11:50:36.7241244+08:00;True|2024-08-19T10:24:05.0018377+08:00;True|2024-08-19T10:23:30.0445364+08:00;True|2024-08-19T10:12:33.8316906+08:00;True|2024-08-19T10:10:48.0967630+08:00;True|2024-08-16T12:17:51.5743944+08:00;True|2024-08-16T11:36:15.1880346+08:00;True|2024-08-12T11:27:42.2864171+08:00;True|2024-08-09T14:54:42.9062124+08:00;True|2024-08-09T11:49:01.0339449+08:00;True|2024-08-09T11:43:21.9947939+08:00;True|2024-08-09T10:43:25.7641675+08:00;True|2024-08-08T15:23:17.0510180+08:00;True|2024-08-08T15:20:50.3450876+08:00;True|2024-08-08T11:06:43.0783261+08:00;True|2024-08-07T17:24:03.0780935+08:00;True|2024-08-07T17:20:50.6266614+08:00;True|2024-08-07T17:18:15.6367265+08:00;True|2024-08-06T17:31:40.3452266+08:00;True|2024-07-31T16:54:03.1890463+08:00;True|2024-07-30T17:11:33.2514194+08:00;True|2024-07-30T17:08:14.5888060+08:00;True|2024-07-30T09:56:08.6349163+08:00;True|2024-07-30T09:50:02.2368269+08:00;True|2024-07-29T16:20:12.3202393+08:00;True|2024-07-29T16:16:29.9634841+08:00;True|2024-07-29T16:09:51.7696392+08:00;True|2024-07-29T16:06:49.4145658+08:00;True|2024-07-29T15:58:50.6654249+08:00;True|2024-07-29T11:32:11.6206514+08:00;True|2024-07-29T11:26:26.1574563+08:00;True|2024-07-29T11:04:41.1896705+08:00;True|2024-07-29T10:38:38.4560275+08:00;True|2024-07-29T10:33:38.5288332+08:00;False|2024-07-29T10:33:21.0642261+08:00;False|2024-07-29T10:33:00.1005216+08:00;True|2024-07-29T09:54:59.2794860+08:00;True|2024-07-29T09:08:54.4899269+08:00;True|2024-07-26T18:02:13.5407348+08:00;True|2024-07-26T17:46:06.7922851+08:00;True|2024-07-26T15:50:48.6986834+08:00;True|2024-07-26T15:11:17.1696147+08:00;True|2024-07-26T13:58:49.6884964+08:00;True|2024-07-25T17:31:33.0050952+08:00;True|2024-07-25T17:09:12.7084910+08:00;True|2024-07-25T17:02:01.2617736+08:00;True|2024-07-25T16:59:51.6271873+08:00;True|2024-07-25T16:58:05.5249148+08:00;True|2024-07-25T14:14:10.2008367+08:00;False|2024-07-25T14:13:54.0300465+08:00;True|2024-07-25T14:08:57.0244482+08:00;True|2024-07-25T13:41:48.8201522+08:00;True|2024-07-25T10:41:30.7277553+08:00;True|2024-07-25T10:16:05.9105335+08:00;True|2024-07-24T15:31:54.7914854+08:00;True|2024-07-24T09:54:17.6182454+08:00;True|2024-07-23T17:01:18.1510211+08:00;True|2024-07-23T16:41:53.3366577+08:00;True|2024-07-23T16:07:25.4129335+08:00;True|2024-07-23T15:50:42.2437488+08:00;True|2024-07-23T15:19:00.1900116+08:00;True|2024-07-23T14:59:22.8551233+08:00;True|2024-07-23T14:19:55.1193373+08:00;True|2024-07-19T18:04:32.2703039+08:00;True|2024-07-19T15:56:25.4103701+08:00;True|2024-07-19T15:09:00.9662436+08:00;True|2024-07-19T15:05:35.7255851+08:00;True|2024-07-19T13:14:42.9559521+08:00;False|2024-07-19T11:37:52.4020673+08:00;True|2024-07-19T11:10:22.8661346+08:00;True|2024-07-19T11:00:00.8819251+08:00;True|2024-07-19T10:45:46.8271770+08:00;True|2024-07-19T10:45:03.8183458+08:00;True|2024-07-18T18:04:42.1000382+08:00;True|2024-07-18T18:01:51.3964409+08:00;True|2024-07-18T17:57:50.3509206+08:00;True|2024-07-18T16:32:46.2184830+08:00;True|2024-07-18T16:00:11.1381449+08:00;True|2024-07-18T15:11:52.6472758+08:00;True|2024-07-18T11:54:49.4848006+08:00;True|2024-07-18T09:25:58.7204846+08:00;True|2024-07-17T17:29:28.6175272+08:00;True|2024-07-17T17:10:54.5184246+08:00;True|2024-07-17T16:57:59.8174060+08:00;True|2024-07-17T16:18:13.8137834+08:00;True|2024-07-17T15:59:16.2360757+08:00;True|2024-07-17T15:31:41.9159909+08:00;True|2024-07-17T14:41:14.6127340+08:00;True|2024-07-17T14:28:53.4455461+08:00;</History>
<History>True|2024-09-04T08:01:07.1761640Z;True|2024-09-04T15:47:33.3094448+08:00;True|2024-09-04T13:33:22.9396193+08:00;True|2024-08-30T13:27:03.2003529+08:00;True|2024-08-27T15:31:21.7026102+08:00;True|2024-08-20T11:12:26.7141701+08:00;True|2024-08-19T17:23:34.5703879+08:00;True|2024-08-19T15:55:28.3484786+08:00;True|2024-08-19T15:45:49.5623372+08:00;True|2024-08-19T14:56:17.7733738+08:00;True|2024-08-19T14:52:03.2782392+08:00;True|2024-08-19T14:10:57.7043528+08:00;True|2024-08-19T13:38:29.9236695+08:00;False|2024-08-19T13:29:18.8873264+08:00;True|2024-08-19T12:31:57.9280692+08:00;True|2024-08-19T11:50:36.7241244+08:00;True|2024-08-19T10:24:05.0018377+08:00;True|2024-08-19T10:23:30.0445364+08:00;True|2024-08-19T10:12:33.8316906+08:00;True|2024-08-19T10:10:48.0967630+08:00;True|2024-08-16T12:17:51.5743944+08:00;True|2024-08-16T11:36:15.1880346+08:00;True|2024-08-12T11:27:42.2864171+08:00;True|2024-08-09T14:54:42.9062124+08:00;True|2024-08-09T11:49:01.0339449+08:00;True|2024-08-09T11:43:21.9947939+08:00;True|2024-08-09T10:43:25.7641675+08:00;True|2024-08-08T15:23:17.0510180+08:00;True|2024-08-08T15:20:50.3450876+08:00;True|2024-08-08T11:06:43.0783261+08:00;True|2024-08-07T17:24:03.0780935+08:00;True|2024-08-07T17:20:50.6266614+08:00;True|2024-08-07T17:18:15.6367265+08:00;True|2024-08-06T17:31:40.3452266+08:00;True|2024-07-31T16:54:03.1890463+08:00;True|2024-07-30T17:11:33.2514194+08:00;True|2024-07-30T17:08:14.5888060+08:00;True|2024-07-30T09:56:08.6349163+08:00;True|2024-07-30T09:50:02.2368269+08:00;True|2024-07-29T16:20:12.3202393+08:00;True|2024-07-29T16:16:29.9634841+08:00;True|2024-07-29T16:09:51.7696392+08:00;True|2024-07-29T16:06:49.4145658+08:00;True|2024-07-29T15:58:50.6654249+08:00;True|2024-07-29T11:32:11.6206514+08:00;True|2024-07-29T11:26:26.1574563+08:00;True|2024-07-29T11:04:41.1896705+08:00;True|2024-07-29T10:38:38.4560275+08:00;True|2024-07-29T10:33:38.5288332+08:00;False|2024-07-29T10:33:21.0642261+08:00;False|2024-07-29T10:33:00.1005216+08:00;True|2024-07-29T09:54:59.2794860+08:00;True|2024-07-29T09:08:54.4899269+08:00;True|2024-07-26T18:02:13.5407348+08:00;True|2024-07-26T17:46:06.7922851+08:00;True|2024-07-26T15:50:48.6986834+08:00;True|2024-07-26T15:11:17.1696147+08:00;True|2024-07-26T13:58:49.6884964+08:00;True|2024-07-25T17:31:33.0050952+08:00;True|2024-07-25T17:09:12.7084910+08:00;True|2024-07-25T17:02:01.2617736+08:00;True|2024-07-25T16:59:51.6271873+08:00;True|2024-07-25T16:58:05.5249148+08:00;True|2024-07-25T14:14:10.2008367+08:00;False|2024-07-25T14:13:54.0300465+08:00;True|2024-07-25T14:08:57.0244482+08:00;True|2024-07-25T13:41:48.8201522+08:00;True|2024-07-25T10:41:30.7277553+08:00;True|2024-07-25T10:16:05.9105335+08:00;True|2024-07-24T15:31:54.7914854+08:00;True|2024-07-24T09:54:17.6182454+08:00;True|2024-07-23T17:01:18.1510211+08:00;True|2024-07-23T16:41:53.3366577+08:00;True|2024-07-23T16:07:25.4129335+08:00;True|2024-07-23T15:50:42.2437488+08:00;True|2024-07-23T15:19:00.1900116+08:00;True|2024-07-23T14:59:22.8551233+08:00;True|2024-07-23T14:19:55.1193373+08:00;True|2024-07-19T18:04:32.2703039+08:00;True|2024-07-19T15:56:25.4103701+08:00;True|2024-07-19T15:09:00.9662436+08:00;True|2024-07-19T15:05:35.7255851+08:00;True|2024-07-19T13:14:42.9559521+08:00;False|2024-07-19T11:37:52.4020673+08:00;True|2024-07-19T11:10:22.8661346+08:00;True|2024-07-19T11:00:00.8819251+08:00;True|2024-07-19T10:45:46.8271770+08:00;True|2024-07-19T10:45:03.8183458+08:00;True|2024-07-18T18:04:42.1000382+08:00;True|2024-07-18T18:01:51.3964409+08:00;True|2024-07-18T17:57:50.3509206+08:00;True|2024-07-18T16:32:46.2184830+08:00;True|2024-07-18T16:00:11.1381449+08:00;True|2024-07-18T15:11:52.6472758+08:00;True|2024-07-18T11:54:49.4848006+08:00;True|2024-07-18T09:25:58.7204846+08:00;True|2024-07-17T17:29:28.6175272+08:00;True|2024-07-17T17:10:54.5184246+08:00;True|2024-07-17T16:57:59.8174060+08:00;True|2024-07-17T16:18:13.8137834+08:00;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

+ 1
- 0
SafeCampus.API/SafeCampus.Web.Entry/appsettings.json View File

@@ -49,6 +49,7 @@
"PersonImg": "personImg",
"AttendanceImg": "attendanceImg",
"RoomCallImg": "roomCallImg",
"CameraImg": "cameraImg",
"Python": "D:\\Program Files\\py39\\python.exe"
},
//腾讯云短信配置


Loading…
Cancel
Save