From 016e7c62c18fb6e92020326f0f6c4fb46e821f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=81=20=E4=BB=BB?= Date: Mon, 26 Jan 2026 16:09:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E5=87=BA=E5=B1=B1=E7=99=BB=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FmFireSiteManage/FmFireSiteApp.cs | 494 ++++++++---------- .../Response/EnteringInfoResp.cs | 112 ++++ .../FmFireSiteManage/Response/EnumItem.cs | 31 ++ .../FireManagement/FmFireSiteController.cs | 80 +++ 4 files changed, 442 insertions(+), 275 deletions(-) create mode 100644 OpenAuth.App/ServiceApp/FmFireSiteManage/Response/EnteringInfoResp.cs create mode 100644 OpenAuth.App/ServiceApp/FmFireSiteManage/Response/EnumItem.cs diff --git a/OpenAuth.App/ServiceApp/FmFireSiteManage/FmFireSiteApp.cs b/OpenAuth.App/ServiceApp/FmFireSiteManage/FmFireSiteApp.cs index 3c07a51..52f9c1a 100644 --- a/OpenAuth.App/ServiceApp/FmFireSiteManage/FmFireSiteApp.cs +++ b/OpenAuth.App/ServiceApp/FmFireSiteManage/FmFireSiteApp.cs @@ -1,7 +1,9 @@ -using DocumentFormat.OpenXml.Office2021.DocumentTasks; +using DocumentFormat.OpenXml.EMMA; +using DocumentFormat.OpenXml.Office2021.DocumentTasks; using DocumentFormat.OpenXml.Spreadsheet; using DocumentFormat.OpenXml.Wordprocessing; using Infrastructure; +using Infrastructure.Extensions; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; using NPOI.HSSF.UserModel; @@ -159,7 +161,7 @@ namespace OpenAuth.App.ServiceApp.FmFireSiteManage rowHeader.Cells[4].SetCellValue("负责人电话"); #endregion - #region 填充数据 + #region 填充数据 var val = (k + 1) * 60000; var num = 60000; if (val > list.Count) @@ -253,7 +255,7 @@ namespace OpenAuth.App.ServiceApp.FmFireSiteManage .LeftJoin((a, b) => a.SiteUserId == b.Id.ToString()) .LeftJoin((a, b, c) => a.SiteUserId == c.UserId.ToString()) .Where((a, b, c) => a.SiteId == siteId) - .WhereIF(roleid!=null, (a, b, c) => c.RoleId == roleid) + .WhereIF(roleid != null, (a, b, c) => c.RoleId == roleid) .Select((a, b) => new SiteUserRes() { Id = a.Id, @@ -340,7 +342,7 @@ namespace OpenAuth.App.ServiceApp.FmFireSiteManage if (fmSite != null) { fmSite.CreateTime = DateTime.Now; - fmSite.State = 0; + fmSite.State = 0; using (var db = base.UnitWork.CreateContext()) { if (db.FmSiteInfo.AsQueryable().Any(a => a.SiteName == fmSite.SiteName)) @@ -425,7 +427,6 @@ namespace OpenAuth.App.ServiceApp.FmFireSiteManage } } - /// /// 获取站点详情 /// @@ -433,7 +434,6 @@ namespace OpenAuth.App.ServiceApp.FmFireSiteManage /// public async Task> GetSiteInfo(long siteId) { - TableData data = new TableData(); using (var db = base.UnitWork.CreateContext()) { var info = await db.FmSiteInfo.AsQueryable() @@ -460,285 +460,229 @@ namespace OpenAuth.App.ServiceApp.FmFireSiteManage } } #endregion - //#region 进山人员管理 - ///// - ///// 进出山类型 - ///// - ///// - //public TableData InTypes() - //{ - // List list = new List(); + #region 进山人员管理 + /// + /// 进出山类型 + /// + /// + public Response> InTypes() + { + List list = new List(); - // foreach (var e in Enum.GetValues(typeof(InType))) - // { - // list.Add(new EnumItem - // { - // Value = Convert.ToInt32(e), - // Descprtion = ((InType)e).GetDescription() - // }); - // } - // return new TableData - // { - // code = 200, - // count = list.Count, - // data = list.OrderBy(a => a.Value), - // msg = "success" - // }; - //} - ///// - ///// 获取进出山人员信息 - ///// - ///// - ///// - ///// - ///// - ///// - ///// - //// This code is a method that loads in user data from a database. It takes in seven parameters: userName, cardNo, siteId, pageIndex, pageSize, startTime, and endTime - //// It then creates a TableData object and sets the startTime and endTime to the current date and time if the year is 0001. It then uses the SqlSugarOper class to query - //// the FmEnteringInfo, SysUser, and FmSiteInfo tables. It filters the results based on the parameters passed in and selects certain fields from the tables. - //// It then orders the results by InTime in descending order and maps the InType field to its description. Finally, it returns the TableData object with the filtered - //// results and the total count of the results. - //public TableData LoadInUser(string userName, string cardNo, long siteId, int pageIndex, int pageSize, DateTime startTime, DateTime endTime) - //{ - // var currentUser = _auth.GetCurrentUser(); - // TableData data = new TableData(); - // if (startTime.Year == 0001) - // { - // startTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); - // endTime = DateTime.Now; - // } - // using (var db = SqlSugarOper.GetInstance(_configuration)) - // { - // int totalCount = 0; - // //获取当前用户的乡镇信息 - // var currentAreaUser = db.Queryable().Where(r => r.UserId == currentUser.User.Id && r.UserRole == 1).ToList(); + foreach (var e in Enum.GetValues(typeof(InType))) + { + list.Add(new EnumItem + { + Value = Convert.ToInt32(e), + Descprtion = ((InType)e).GetDescription() + }); + } - // if (currentAreaUser.Count > 0) - // { - // var areaid = currentAreaUser.Select(r => r.AreaId); - // var areaids = db.Queryable() - // .Where(r => areaid.Contains(r.PId) || areaid.Contains(r.Id)) - // .Select(r => r.Id).ToList(); - // var fuser = db.Queryable() - // .Where((a) => areaids.Contains(a.AreaId)) - // .Select(r => r.UserId).ToList(); - // var site = db.Queryable() - // .Where(r => fuser.Contains(r.SiteUserId)) - // .Select(r => r.SiteId).ToList(); - // var list = db.Queryable() - // .LeftJoin((a, b) => a.CreateUserId == b.Id) - // .LeftJoin((a, b, c) => a.SiteId == c.Id) - // .WhereIF(siteId != 0, (a, b, c) => a.SiteId == siteId) - // .WhereIF(!string.IsNullOrEmpty(userName), (a, b, c) => a.UserName.Contains(userName)) - // .WhereIF(!string.IsNullOrEmpty(cardNo), (a, b, c) => a.CardNo == cardNo) - // .Where((a, b, c) => a.InTime >= startTime && a.InTime <= endTime) - // .Where((a, b, c) => site.Contains(a.SiteId)) - // .Select((a, b, c) => new EnteringInfoResp() - // { - // Id = a.Id, - // UserName = a.UserName, - // InType = a.InType, - // Phone = a.Phone, - // InTime = a.InTime, - // SiteName = c.SiteName, - // CardNo = a.CardNo, - // UserAddress = a.UserAddress, - // Name = b.Name, - // OutTime = a.OutTime, - // Reason = a.Reason, - // RegistrationType = a.RegistrationType, - // ProjectName = a.ProjectName - // }) - // .OrderBy((a) => a.InTime, OrderByType.Desc)//倒序 - // .Mapper(it => it.InTypeName = ((InType)it.InType).GetDescription()) - // .Mapper(it => it.RegistrationTypeName = ((RegistrationType)it.RegistrationType).GetDescription()) - // .ToPageList(pageIndex, pageSize, ref totalCount); - // data.data = list; - // data.count = totalCount; - // data.code = 200; - // data.msg = "请求成功"; - // } - // else - // { - // var list = db.Queryable() - // .LeftJoin((a, b) => a.CreateUserId == b.Id) - // .LeftJoin((a, b, c) => a.SiteId == c.Id) - // .WhereIF(siteId != 0, (a, b, c) => a.SiteId == siteId) - // .WhereIF(!string.IsNullOrEmpty(userName), (a, b, c) => a.UserName.Contains(userName)) - // .WhereIF(!string.IsNullOrEmpty(cardNo), (a, b, c) => a.CardNo == cardNo) - // .Where((a, b, c) => a.InTime >= startTime && a.InTime <= endTime) - // .Select((a, b, c) => new EnteringInfoResp() - // { - // Id = a.Id, - // UserName = a.UserName, - // InType = a.InType, - // Phone = a.Phone, - // InTime = a.InTime, - // SiteName = c.SiteName, - // CardNo = a.CardNo, - // UserAddress = a.UserAddress, - // Name = b.Name, - // OutTime = a.OutTime, - // Reason = a.Reason, - // RegistrationType = a.RegistrationType, - // ProjectName = a.ProjectName - // }) - // .OrderBy((a) => a.InTime, OrderByType.Desc)//倒序 - // .Mapper(it => it.InTypeName = ((InType)it.InType).GetDescription()) - // .Mapper(it => it.RegistrationTypeName = ((RegistrationType)it.RegistrationType).GetDescription()) - // .ToPageList(pageIndex, pageSize, ref totalCount); - // data.data = list; - // data.count = totalCount; - // data.code = 200; - // data.msg = "请求成功"; - // } + return new Response> { Result = list }; + } + /// + /// 获取进出山人员信息 + /// + /// + /// + /// + /// + /// + /// + public async Task>>> LoadInUser(string userName, string cardNo, long? siteId, int pageIndex, int pageSize, DateTime startTime, DateTime endTime) + { + if (startTime.Year == 0001) + { + startTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); + endTime = DateTime.Now; + } + using (var db = base.UnitWork.CreateContext()) + { + RefAsync totalNumber = 0; + var list = await db.FmEnteringInfo.AsQueryable() + .LeftJoin((a, b) => a.CreateUserId == b.Id.ToString()) + .LeftJoin((a, b, c) => a.SiteId == c.Id) + .WhereIF(siteId != null, (a, b, c) => a.SiteId == siteId) + .WhereIF(!string.IsNullOrEmpty(userName), (a, b, c) => a.UserName.Contains(userName)) + .WhereIF(!string.IsNullOrEmpty(cardNo), (a, b, c) => a.CardNo == cardNo) + .Where((a, b, c) => a.InTime >= startTime && a.InTime <= endTime) + .Select((a, b, c) => new EnteringInfoResp() + { + Id = a.Id, + UserName = a.UserName, + InType = a.InType, + Phone = a.Phone, + InTime = a.InTime, + SiteName = c.SiteName, + CardNo = a.CardNo, + UserAddress = a.UserAddress, + Name = b.Name, + OutTime = a.OutTime, + Reason = a.Reason, + RegistrationType = a.RegistrationType, + ProjectName = a.ProjectName + }) + .OrderBy((a) => a.InTime, OrderByType.Desc)//倒序 + .Mapper(it => it.InTypeName = ((InType)it.InType).GetDescription()) + .Mapper(it => it.RegistrationTypeName = ((RegistrationType)it.RegistrationType).GetDescription()) + .ToPageListAsync(pageIndex, pageSize, totalNumber); + return new Response>> + { + Result = new PageInfo> { Items = list, Total = totalNumber } + }; + } + } + /// + /// 导出进出山人员信息 + /// + /// + public Response ExportInUser(long? siteId, DateTime startTime, DateTime endTime) + { + Response response = new Response(); + if (startTime.Year == 0001) + { + startTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); + endTime = DateTime.Now; + } + try + { + HSSFWorkbook workbook = new HSSFWorkbook(); + #region 内容样式 - // } - // return data; - //} - ///// - ///// 导出进出山人员信息 - ///// - ///// - //public MemoryStream ExportInUser(long siteId, DateTime startTime, DateTime endTime) - //{ - // var currentUser = _auth.GetCurrentUser(); - // if (startTime.Year == 0001) - // { - // startTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); - // endTime = DateTime.Now; - // } - // using (var db = SqlSugarOper.GetInstance(_configuration)) - // { - // List list = new List(); - // //获取当前用户的乡镇信息 - // var currentAreaUser = db.Queryable().Where(r => r.UserId == currentUser.User.Id).ToList(); + IFont font1 = workbook.CreateFont(); //创建一个字体样式对象 + font1.FontName = "Microsoft YaHei"; //和excel里面的字体对应 + //font1.Boldweight = short.MaxValue;//字体加粗 + font1.FontHeightInPoints = 12; //字体大小 + ICellStyle style = workbook.CreateCellStyle(); //创建样式对象 + style.BorderBottom = BorderStyle.Thin; + style.BorderLeft = BorderStyle.Thin; + style.BorderRight = BorderStyle.Thin; + style.BorderTop = BorderStyle.Thin; + style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center; + style.VerticalAlignment = VerticalAlignment.Center; + style.SetFont(font1); //将字体样式赋给样式对象 + style.WrapText = true; - // if (currentAreaUser.Count > 0) - // { - // var areaid = currentAreaUser.Select(r => r.AreaId); - // var areaids = db.Queryable() - // .Where(r => areaid.Contains(r.PId) || areaid.Contains(r.Id)) - // .Select(r => r.Id).ToList(); - // var fuser = db.Queryable() - // .Where((a) => areaids.Contains(a.AreaId)) - // .Select(r => r.UserId).ToList(); - // var site = db.Queryable() - // .Where(r => fuser.Contains(r.SiteUserId)) - // .Select(r => r.SiteId).ToList(); - // list = db.Queryable() - // .LeftJoin((a, b) => a.CreateUserId == b.Id) - // .LeftJoin((a, b, c) => a.SiteId == c.Id) - // .WhereIF(siteId != 0, (a, b, c) => a.SiteId == siteId) - // .Where((a, b, c) => a.InTime >= startTime && a.InTime <= endTime) - // .Where((a, b, c) => site.Contains(a.SiteId)) - // .Select((a, b, c) => new EnteringInfoResp() - // { - // Id = a.Id, - // UserName = a.UserName, - // InType = a.InType, - // Phone = a.Phone, - // InTime = a.InTime, - // SiteName = c.SiteName, - // CardNo = a.CardNo, - // UserAddress = a.UserAddress, - // Name = b.Name, - // OutTime = a.OutTime, - // Reason = a.Reason, - // RegistrationType = a.RegistrationType, - // ProjectName = a.ProjectName - // }) - // .OrderBy((a) => a.InTime, OrderByType.Desc)//倒序 - // .Mapper(it => it.InTypeName = ((InType)it.InType).GetDescription()) - // .Mapper(it => it.RegistrationTypeName = ((RegistrationType)it.RegistrationType).GetDescription()) - // .ToList(); - // } - // else - // { - // list = db.Queryable() - // .LeftJoin((a, b) => a.CreateUserId == b.Id) - // .LeftJoin((a, b, c) => a.SiteId == c.Id) - // .WhereIF(siteId != 0, (a, b, c) => a.SiteId == siteId) - // .Where((a, b, c) => a.InTime >= startTime && a.InTime <= endTime) - // .Select((a, b, c) => new EnteringInfoResp() - // { - // Id = a.Id, - // UserName = a.UserName, - // InType = a.InType, - // Phone = a.Phone, - // InTime = a.InTime, - // SiteName = c.SiteName, - // CardNo = a.CardNo, - // UserAddress = a.UserAddress, - // Name = b.Name, - // OutTime = a.OutTime, - // Reason = a.Reason, - // RegistrationType = a.RegistrationType, - // ProjectName = a.ProjectName - // }) - // .OrderBy((a) => a.InTime, OrderByType.Desc)//倒序 - // .Mapper(it => it.InTypeName = ((InType)it.InType).GetDescription()) - // .Mapper(it => it.RegistrationTypeName = ((RegistrationType)it.RegistrationType).GetDescription()) - // .ToList(); - // } + #endregion + #region 标题样式 - // //根目录 - // var root = AppDomain.CurrentDomain.BaseDirectory; - // //Execl 文件 - // var execlPath = "ExportFiles/ExportInterphoneInfo.xlsx"; + IFont font = workbook.CreateFont(); //创建一个字体样式对象 + font.FontName = "Microsoft YaHei"; //和excel里面的字体对应 + font.Boldweight = (short)FontBoldWeight.Bold; //字体加粗 + font.FontHeightInPoints = 12; //字体大小 + ICellStyle style1 = workbook.CreateCellStyle(); //创建样式对象 + style1.BorderBottom = BorderStyle.Thin; + style1.BorderLeft = BorderStyle.Thin; + style1.BorderRight = BorderStyle.Thin; + style1.BorderTop = BorderStyle.Thin; + style1.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center; + style1.VerticalAlignment = VerticalAlignment.Center; + style1.SetFont(font); //将字体样式赋给样式对象 - // using (FileStream fs = new FileStream($"{root}{execlPath}", FileMode.Open, FileAccess.Read)) - // { - // var workBook = new XSSFWorkbook(fs); + #endregion + using (var db = base.UnitWork.CreateContext()) + { + List list = new List(); + //获取当前用户的乡镇信息 + list = db.FmEnteringInfo.AsQueryable() + .LeftJoin((a, b) => a.CreateUserId == b.Id.ToString()) + .LeftJoin((a, b, c) => a.SiteId == c.Id) + .WhereIF(siteId != null, (a, b, c) => a.SiteId == siteId) + .Where((a, b, c) => a.InTime >= startTime && a.InTime <= endTime) + .Select((a, b, c) => new EnteringInfoResp() + { + Id = a.Id, + UserName = a.UserName, + InType = a.InType, + Phone = a.Phone, + InTime = a.InTime, + SiteName = c.SiteName, + CardNo = a.CardNo, + UserAddress = a.UserAddress, + Name = b.Name, + OutTime = a.OutTime, + Reason = a.Reason, + RegistrationType = a.RegistrationType, + ProjectName = a.ProjectName + }) + .OrderBy((a) => a.InTime, OrderByType.Desc)//倒序 + .Mapper(it => it.InTypeName = ((InType)it.InType).GetDescription()) + .Mapper(it => it.RegistrationTypeName = ((RegistrationType)it.RegistrationType).GetDescription()) + .ToList(); - // #region + #region 创建表头 + int m = list.Count / 60000 + 1; + for (int k = 0; k < m; k++) + { + ISheet sheet = workbook.CreateSheet("Sheet" + k.ToString()); + IRow rowHeader = sheet.CreateRow(0); + rowHeader.Height = 20 * 30; + for (int i = 0; i < 9; i++) + { + //ModuleColumn header = headers[i]; + rowHeader.CreateCell(i); + rowHeader.Cells[i].CellStyle = style1; + sheet.SetColumnWidth(i, 20 * 350); + } + rowHeader.Cells[0].SetCellValue("人员姓名"); + rowHeader.Cells[1].SetCellValue("身份证号"); + rowHeader.Cells[2].SetCellValue("电话"); + rowHeader.Cells[3].SetCellValue("登记类型"); + rowHeader.Cells[4].SetCellValue("进山时间"); + rowHeader.Cells[5].SetCellValue("出山时间"); + rowHeader.Cells[6].SetCellValue("防火站点"); + rowHeader.Cells[7].SetCellValue("登记方式"); + rowHeader.Cells[8].SetCellValue("进山原因"); - // var sheet = workBook.GetSheetAt(0); + #endregion - // var columnWidth = 20 * 256; // 一个字符等于 256 个单位 - // for (int i = 0; i < list.Count; i++) - // { - // sheet.SetColumnWidth(i, columnWidth); - // } - // var row1 = sheet.CreateRow(0); - // row1.Height = 30 * 20; - // row1.CreateCell(0).SetCellValue("人员姓名"); - // row1.CreateCell(1).SetCellValue("身份证号"); - // row1.CreateCell(2).SetCellValue("电话"); - // row1.CreateCell(3).SetCellValue("登记类型"); - // row1.CreateCell(4).SetCellValue("进山时间"); - // row1.CreateCell(5).SetCellValue("出山时间"); - // row1.CreateCell(6).SetCellValue("防火站点"); - // row1.CreateCell(7).SetCellValue("登记方式"); - // row1.CreateCell(8).SetCellValue("进山原因"); + #region 填充数据 + var val = (k + 1) * 60000; + var num = 60000; + if (val > list.Count) + { + num = list.Count - k * 60000; + } + for (int i = 0; i < num; i++) //循环数据 + { + var item = list[k * 60000 + i]; //获取数据 + IRow dataRow = sheet.CreateRow(i + 1); //创建行 + for (int j = 0; j < 9; j++) //循环表头 + { + //创建单元格 + dataRow.CreateCell(j); + dataRow.Cells[j].CellStyle = style; //添加单元格样式 + } + dataRow.Cells[0].SetCellValue(list[i].UserName == null ? "" : list[i].UserName); + dataRow.Cells[1].SetCellValue(list[i].CardNo == null ? "" : list[i].CardNo); + dataRow.Cells[2].SetCellValue(list[i].Phone == null ? "" : list[i].Phone); + dataRow.Cells[3].SetCellValue(list[i].RegistrationTypeName == null ? "" : list[i].RegistrationTypeName); + dataRow.Cells[4].SetCellValue(list[i].InTime == null ? "" : list[i].InTime.ToString()); + dataRow.Cells[5].SetCellValue(list[i].OutTime == null ? "" : list[i].OutTime.ToString()); + dataRow.Cells[6].SetCellValue(list[i].SiteName == null ? "" : list[i].SiteName); + dataRow.Cells[7].SetCellValue(list[i].InTypeName == null ? "" : list[i].InTypeName); + dataRow.Cells[8].SetCellValue(list[i].Reason == null ? "" : list[i].Reason); + } + } - // for (int i = 0; i < list.Count; i++) - // { - // var num = i + 1; - // var row = sheet.CreateRow(num); - // row.Height = 30 * 20; - // row.CreateCell(0).SetCellValue(list[i].UserName == null ? "" : list[i].UserName); - // row.CreateCell(1).SetCellValue(list[i].CardNo == null ? "" : list[i].CardNo); - // row.CreateCell(2).SetCellValue(list[i].Phone == null ? "" : list[i].Phone); - // row.CreateCell(3).SetCellValue(list[i].RegistrationTypeName == null ? "" : list[i].RegistrationTypeName); - // row.CreateCell(4).SetCellValue(list[i].InTime == null ? "" : list[i].InTime.ToString()); - // row.CreateCell(5).SetCellValue(list[i].OutTime == null ? "" : list[i].OutTime.ToString()); - // row.CreateCell(6).SetCellValue(list[i].SiteName == null ? "" : list[i].SiteName); - // row.CreateCell(7).SetCellValue(list[i].InTypeName == null ? "" : list[i].InTypeName); - // row.CreateCell(8).SetCellValue(list[i].Reason == null ? "" : list[i].Reason); - // } - // #endregion - // MemoryStream ms = new MemoryStream(); - - // workBook.Write(ms); - // return ms; - // } - // } - - - //} - //#endregion + #endregion + response.Result = new MemoryStream(); + workbook.Write(response.Result); + workbook = null; + response.Result.Close(); + response.Result.Dispose(); + response.Code = 200; + response.Message = "获取成功"; + } + } + catch (Exception ex) + { + response.Code = 500; + response.Message = ex.Message; + } + return response; + } + #endregion } } diff --git a/OpenAuth.App/ServiceApp/FmFireSiteManage/Response/EnteringInfoResp.cs b/OpenAuth.App/ServiceApp/FmFireSiteManage/Response/EnteringInfoResp.cs new file mode 100644 index 0000000..b122aef --- /dev/null +++ b/OpenAuth.App/ServiceApp/FmFireSiteManage/Response/EnteringInfoResp.cs @@ -0,0 +1,112 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenAuth.App.ServiceApp.FmFireSiteManage.Response +{ + public class EnteringInfoResp + { + + /// + /// Desc:流水号 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true)] + public long Id { get; set; } + + /// + /// Desc:人员名称 + /// Default: + /// Nullable:True + /// + public string UserName { get; set; } + + /// + /// Desc:人员电话 + /// Default: + /// Nullable:True + /// + public string Phone { get; set; } + + /// + /// Desc:进入方式(1-扫码,2-代填) + /// Default: + /// Nullable:False + /// + public int InType { get; set; } + /// + /// Desc:进入方式(1-扫码,2-代填) + /// Default: + /// Nullable:False + /// + public string InTypeName { get; set; } + + /// + /// Desc:身份证号 + /// Default: + /// Nullable:True + /// + public string CardNo { get; set; } + + /// + /// Desc:联系地址 + /// Default: + /// Nullable:True + /// + public string UserAddress { get; set; } + + /// + /// Desc:进山时间 + /// Default: + /// Nullable:True + /// + public DateTime InTime { get; set; } + + /// + /// Desc:站点名称 + /// Default: + /// Nullable:False + /// + public string SiteName { get; set; } + + /// + /// Desc:代替人名称 + /// Default: + /// Nullable:True + /// + public string Name { get; set; } + /// + /// Desc:离山时间 + /// Default: + /// Nullable:True + /// + public DateTime OutTime { get; set; } + /// + /// Desc:原因 + /// Default: + /// Nullable:True + /// + public string Reason { get; set; } + /// + /// Desc:登记类型(1-进山,2-出山) + /// Default: + /// Nullable:False + /// + public int RegistrationType { get; set; } + /// + /// Desc:登记类型(1-进山,2-出山) + /// Default: + /// Nullable:False + /// + public string RegistrationTypeName { get; set; } + /// + /// 项目名称 + /// + public string ProjectName { get; set; } + } + +} diff --git a/OpenAuth.App/ServiceApp/FmFireSiteManage/Response/EnumItem.cs b/OpenAuth.App/ServiceApp/FmFireSiteManage/Response/EnumItem.cs new file mode 100644 index 0000000..d0415ea --- /dev/null +++ b/OpenAuth.App/ServiceApp/FmFireSiteManage/Response/EnumItem.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenAuth.App.ServiceApp.FmFireSiteManage.Response +{ + public class EnumItem + { + public int Value { get; set; } + public string Descprtion { get; set; } + } + + + public enum InType + { + [Description("扫码")] + SMJS = 1, + [Description("登记")] + DJJS = 2 + } + public enum RegistrationType + { + [Description("进山")] + JINSHAN = 1, + [Description("出山")] + CHUSHAN = 2 + } +} diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FmFireSiteController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FmFireSiteController.cs index f859a30..d35b193 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FmFireSiteController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FmFireSiteController.cs @@ -231,5 +231,85 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement return response; } #endregion + + #region + /// + /// 进出山类型 + /// + /// + [HttpGet] + [AllowAnonymous] + public Response> InTypes() + { + Response> response = new Response>(); + try + { + return _app.InTypes(); + } + catch (Exception ex) + { + response.Code = 500; + response.Message = ex.InnerException?.Message ?? ex.Message; + } + return response; + } + + + /// + /// 获取进出山人员 + /// + /// 用户名 + /// 身份证号 + /// 站点id + /// 当前页 + /// 每页条数 + /// 开始时间 + /// 结束时间 + /// + [HttpGet] + [AllowAnonymous] + public async Task>>> LoadInUser(string userName, string cardNo, long? siteId, int pageIndex, int pageSize, DateTime startTime, DateTime endTime) + { + Response>> response = new Response>>(); + try + { + return await _app.LoadInUser(userName,cardNo,siteId, pageIndex, pageSize,startTime,endTime); + } + catch (Exception ex) + { + response.Code = 500; + response.Message = ex.InnerException?.Message ?? ex.Message; + } + return response; + } + + + /// + /// 导出进出山人员 + /// + /// 站点id + /// 开始时间 + /// 结束时间 + /// + [HttpGet] + [AllowAnonymous] + public IActionResult ExportInUser(long? siteId, DateTime startTime, DateTime endTime) + { + var res = new Response(); + var excelRes = _app.ExportInUser(siteId,startTime,endTime); + if (excelRes.Code == 200) + { + return File(excelRes.Result.ToArray(), + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "进出山人员" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"); + } + else + { + res.Code = excelRes.Code; + res.Message = "导出失败"; + } + return Ok(res); + } + #endregion } }