From 976378a3e01597dcec34fc581c62f05c11650b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=81=20=E4=BB=BB?= Date: Mon, 9 Mar 2026 16:12:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MiManager/MiVehiclePickupApp.cs | 40 ++ .../MiManager/MiViolationReportApp.cs | 610 +++++++++++++++++- .../MiManager/Response/PunchStatistics.cs | 2 +- .../MiVehiclePickupController.cs | 22 + .../MiViolationReportController.cs | 92 +++ 5 files changed, 757 insertions(+), 9 deletions(-) diff --git a/OpenAuth.App/ServiceApp/MiManager/MiVehiclePickupApp.cs b/OpenAuth.App/ServiceApp/MiManager/MiVehiclePickupApp.cs index 76e50fd..1685bfa 100644 --- a/OpenAuth.App/ServiceApp/MiManager/MiVehiclePickupApp.cs +++ b/OpenAuth.App/ServiceApp/MiManager/MiVehiclePickupApp.cs @@ -845,6 +845,46 @@ namespace OpenAuth.App return result; } } + + /// + /// 根据id查询解除扣押单信息 + /// + /// 违法上报id + /// + public async Task GetReleaseDocumentByReportId(string reportid) + { + using (var uow = UnitWork.CreateContext()) + { + var item = await uow.MiReleaseDocument.AsQueryable() + .Where(p => p.ViolationReportId == reportid) + .LeftJoin((p, r) => p.ParkingLot == r.Id) + .OrderByDescending(p => p.CreatedAt) + .Select((p, r) => new + { + Id = p.Id.SelectAll(), + ParkingName = r.Name, + }).FirstAsync(); + + var result = new + { + item.Id, + item.Year, + Number = item.SerialNumber.ToString("D3"), // 格式化为 "002" + item.Party, + item.ClueLocation, + item.ViolationType, + item.ReleaseDate, + item.PickupDeadline, + item.Items, + item.CreatedAt, + item.CreatedBy, + item.ViolationReportId, + item.ParkingName, + item.FilePath + }; + return result; + } + } #endregion } diff --git a/OpenAuth.App/ServiceApp/MiManager/MiViolationReportApp.cs b/OpenAuth.App/ServiceApp/MiManager/MiViolationReportApp.cs index b2f945c..e288aa3 100644 --- a/OpenAuth.App/ServiceApp/MiManager/MiViolationReportApp.cs +++ b/OpenAuth.App/ServiceApp/MiManager/MiViolationReportApp.cs @@ -1,11 +1,14 @@ using DocumentFormat.OpenXml.Bibliography; using DocumentFormat.OpenXml.EMMA; +using DocumentFormat.OpenXml.Math; using DocumentFormat.OpenXml.Office.CustomUI; using Infrastructure; using Infrastructure.Extensions; using Infrastructure.Helpers; using Microsoft.AspNetCore.Hosting; +using NPOI.HSSF.UserModel; +using NPOI.SS.UserModel; using NPOI.SS.Util; using OpenAuth.App.BaseApp.Base; using OpenAuth.App.Common; @@ -1069,7 +1072,7 @@ namespace OpenAuth.App PartyName = p.PartyName, Status=p.Status, VechileCount = SqlFunc.Subqueryable().Where(r => r.ViolationReportId == p.Id).Count(), - ImageCount = SqlFunc.Subqueryable().Where(r => r.ViolationReportId != p.Id).Count(), + ImageCount = SqlFunc.Subqueryable().Where(r => r.ViolationReportId == p.Id).Count(), OtherPersonCount = SqlFunc.Subqueryable().Where(r => r.ViolationReportId == p.Id).Count(), }).ToPageListAsync(page, limit, totalCount); foreach (var item in data) @@ -1118,7 +1121,7 @@ namespace OpenAuth.App Id = r.Id.SelectAll(), UserName = u.Name, PointName = p.Name, - StreetName=p.StreetName, + StreetName = p.StreetName, p.CountyName, p.CommunityName, StatusName = SqlFunc.Subqueryable().Where(a => a.ItemCode == "JGMinePointStatus" && a.ItemValue == r.PunchStatus.ToString()).Select(a => a.ItemName) @@ -1207,12 +1210,21 @@ namespace OpenAuth.App using (var uow = UnitWork.CreateContext()) { var result = await uow.MiPunchRecord.AsQueryable() - .Where(p => p.MinePointId == pointid) - .OrderByDescending(p => p.PunchTime) - .Select((p) => new - { - Id = p.Id.SelectAll() - }).ToListAsync(); + .Where(r=>r.MinePointId==pointid) + .LeftJoin((r, u) => r.UserId == u.Id) + .LeftJoin((r, u, p) => r.MinePointId == p.Id) + .OrderByDescending((r, u, p) => r.PunchTime) + .Select((r, u, p) => new + { + Id = r.Id.SelectAll(), + UserName = u.Name, + PointName = p.Name, + StreetName = p.StreetName, + p.CountyName, + p.CommunityName, + StatusName = SqlFunc.Subqueryable().Where(a => a.ItemCode == "JGMinePointStatus" && a.ItemValue == r.PunchStatus.ToString()).Select(a => a.ItemName) + }) + .ToListAsync(); return result; } } @@ -1257,5 +1269,587 @@ namespace OpenAuth.App } } #endregion + + #region + //导出 巡查台账--人员 + public async Task> ExportPunchStatistics() + { + Response response = new Response(); + try + { + HSSFWorkbook workbook = new HSSFWorkbook(); + + #region 内容样式 + IFont font1 = workbook.CreateFont(); + font1.FontName = "Microsoft YaHei"; + 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; + #endregion + + #region 标题样式 + IFont font = workbook.CreateFont(); + font.FontName = "Microsoft YaHei"; + 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); + #endregion + + // 获取统计数据 + var list = await GetPunchStatistics(); + int totalCount = list.Count; + int pageSize = 60000; // 每个Sheet最大行数 + int sheetCount = (totalCount / pageSize) + (totalCount % pageSize > 0 ? 1 : 0); + + for (int s = 0; s < sheetCount; s++) + { + ISheet sheet = workbook.CreateSheet($"Sheet{s + 1}"); + + #region 创建表头 + IRow headerRow = sheet.CreateRow(0); + headerRow.Height = 20 * 30; + string[] headers = { "单位", "人员", "巡查日期(范围)", "巡查次数", "上报异常次数", "违法处理次数" }; + for (int i = 0; i < headers.Length; i++) + { + ICell cell = headerRow.CreateCell(i); + cell.SetCellValue(headers[i]); + cell.CellStyle = style1; + sheet.SetColumnWidth(i, 20 * 350); // 适当调整列宽 + } + #endregion + + #region 填充数据 + int startIndex = s * pageSize; + int endIndex = Math.Min(startIndex + pageSize, totalCount); + for (int i = startIndex, row = 1; i < endIndex; i++, row++) + { + var item = list[i]; + IRow dataRow = sheet.CreateRow(row); + + // 单位 + ICell cell0 = dataRow.CreateCell(0); + cell0.SetCellValue(item.OrgName ?? ""); + cell0.CellStyle = style; + + // 人员 + ICell cell1 = dataRow.CreateCell(1); + cell1.SetCellValue(item.UserName ?? ""); + cell1.CellStyle = style; + + // 巡查日期范围 + ICell cell2 = dataRow.CreateCell(2); + cell2.SetCellValue(item.PunchScope ?? ""); + cell2.CellStyle = style; + + // 巡查次数 + ICell cell3 = dataRow.CreateCell(3); + cell3.SetCellValue(item.PunchCount); + cell3.CellStyle = style; + + // 上报异常次数 + ICell cell4 = dataRow.CreateCell(4); + cell4.SetCellValue(item.ReportCount); + cell4.CellStyle = style; + + // 违法处理次数 + ICell cell5 = dataRow.CreateCell(5); + cell5.SetCellValue(item.DealCount); + cell5.CellStyle = style; + } + #endregion + } + + response.Result = new MemoryStream(); + workbook.Write(response.Result); + workbook = null; + response.Result.Position = 0; // 重置流位置,便于后续读取 + response.Code = 200; + response.Message = "导出成功"; + } + catch (Exception ex) + { + response.Code = 500; + response.Message = ex.Message; + } + return response; + } + + + public async Task> ExportPointPunchStatistics() + { + Response response = new Response(); + try + { + HSSFWorkbook workbook = new HSSFWorkbook(); + + #region 内容样式 + IFont font1 = workbook.CreateFont(); + font1.FontName = "Microsoft YaHei"; + 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; + #endregion + + #region 标题样式 + IFont font = workbook.CreateFont(); + font.FontName = "Microsoft YaHei"; + 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); + #endregion + + // 获取统计数据 + var list = await GetPointPunchStatistics(); + int totalCount = list.Count; + int pageSize = 60000; // 每个Sheet最大行数 + int sheetCount = (totalCount / pageSize) + (totalCount % pageSize > 0 ? 1 : 0); + + for (int s = 0; s < sheetCount; s++) + { + ISheet sheet = workbook.CreateSheet($"Sheet{s + 1}"); + + #region 创建表头 + IRow headerRow = sheet.CreateRow(0); + headerRow.Height = 20 * 30; + string[] headers = { "片区", "乡镇", "村居", "点位名称", "巡查日期(范围)", "巡查次数", "上报异常次数", "违法处理次数" }; + for (int i = 0; i < headers.Length; i++) + { + ICell cell = headerRow.CreateCell(i); + cell.SetCellValue(headers[i]); + cell.CellStyle = style1; + sheet.SetColumnWidth(i, 20 * 350); // 可根据实际内容调整列宽 + } + #endregion + + #region 填充数据 + int startIndex = s * pageSize; + int endIndex = Math.Min(startIndex + pageSize, totalCount); + for (int i = startIndex, row = 1; i < endIndex; i++, row++) + { + var item = list[i]; + IRow dataRow = sheet.CreateRow(row); + + // 片区 + ICell cell0 = dataRow.CreateCell(0); + cell0.SetCellValue(item.CountyName ?? ""); + cell0.CellStyle = style; + + // 乡镇 + ICell cell1 = dataRow.CreateCell(1); + cell1.SetCellValue(item.StreetName ?? ""); + cell1.CellStyle = style; + + // 村居 + ICell cell2 = dataRow.CreateCell(2); + cell2.SetCellValue(item.CommunityName ?? ""); + cell2.CellStyle = style; + + // 点位名称 + ICell cell3 = dataRow.CreateCell(3); + cell3.SetCellValue(item.Name ?? ""); + cell3.CellStyle = style; + + // 巡查日期范围 + ICell cell4 = dataRow.CreateCell(4); + cell4.SetCellValue(item.PunchScope ?? ""); + cell4.CellStyle = style; + + // 巡查次数 + ICell cell5 = dataRow.CreateCell(5); + cell5.SetCellValue(item.PunchCount); + cell5.CellStyle = style; + + // 上报异常次数 + ICell cell6 = dataRow.CreateCell(6); + cell6.SetCellValue(item.ReportCount); + cell6.CellStyle = style; + + // 违法处理次数 + ICell cell7 = dataRow.CreateCell(7); + cell7.SetCellValue(item.DealCount); + cell7.CellStyle = style; + } + #endregion + } + + response.Result = new MemoryStream(); + workbook.Write(response.Result); + workbook = null; + response.Result.Position = 0; // 重置流位置,便于后续读取 + response.Code = 200; + response.Message = "导出成功"; + } + catch (Exception ex) + { + response.Code = 500; + response.Message = ex.Message; + } + return response; + } + + public async Task> ExportPunchRecordDetails() + { + Response response = new Response(); + try + { + HSSFWorkbook workbook = new HSSFWorkbook(); + + #region 内容样式 + IFont font1 = workbook.CreateFont(); + font1.FontName = "Microsoft YaHei"; + 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; + #endregion + + #region 标题样式 + IFont font = workbook.CreateFont(); + font.FontName = "Microsoft YaHei"; + 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); + #endregion + + // 获取数据(使用 dynamic 接收匿名类型列表) + using (var uow = UnitWork.CreateContext()) + { + var list = await uow.MiPunchRecord.AsQueryable() + .LeftJoin((r, u) => r.UserId == u.Id) + .LeftJoin((r, u, p) => r.MinePointId == p.Id) + .OrderByDescending((r, u, p) => r.PunchTime) + .Select((r, u, p) => new + { + PunchTime = r.PunchTime, + UserName = u.Name, + PointName = p.Name, + StreetName = p.StreetName, + CountyName = p.CountyName, + CommunityName = p.CommunityName, + StatusName = SqlFunc.Subqueryable() + .Where(a => a.ItemCode == "JGMinePointStatus" && a.ItemValue == r.PunchStatus.ToString()) + .Select(a => a.ItemName) + }) + .ToListAsync(); + + int totalCount = list.Count; + int pageSize = 60000; + int sheetCount = (totalCount / pageSize) + (totalCount % pageSize > 0 ? 1 : 0); + + // 即使无数据,也创建一个带表头的空 Sheet + if (sheetCount == 0) sheetCount = 1; + + for (int s = 0; s < sheetCount; s++) + { + ISheet sheet = workbook.CreateSheet($"Sheet{s + 1}"); + + #region 创建表头 + IRow headerRow = sheet.CreateRow(0); + headerRow.Height = 20 * 30; + string[] headers = { "片区", "乡镇", "村居", "点位名称", "巡查时间", "人员", "巡查结果" }; + for (int i = 0; i < headers.Length; i++) + { + ICell cell = headerRow.CreateCell(i); + cell.SetCellValue(headers[i]); + cell.CellStyle = style1; + sheet.SetColumnWidth(i, 20 * 350); + } + #endregion + + #region 填充数据 + int startIndex = s * pageSize; + int endIndex = Math.Min(startIndex + pageSize, totalCount); + for (int i = startIndex, row = 1; i < endIndex; i++, row++) + { + var item = list[i]; + IRow dataRow = sheet.CreateRow(row); + + // 片区 + ICell cell0 = dataRow.CreateCell(0); + cell0.SetCellValue(item.CountyName ?? ""); + cell0.CellStyle = style; + + // 乡镇 + ICell cell1 = dataRow.CreateCell(1); + cell1.SetCellValue(item.StreetName ?? ""); + cell1.CellStyle = style; + + // 村居 + ICell cell2 = dataRow.CreateCell(2); + cell2.SetCellValue(item.CommunityName ?? ""); + cell2.CellStyle = style; + + // 点位名称 + ICell cell3 = dataRow.CreateCell(3); + cell3.SetCellValue(item.PointName ?? ""); + cell3.CellStyle = style; + + // 巡查时间(格式化为 yyyy-MM-dd HH:mm:ss,若为空则显示空字符串) + ICell cell4 = dataRow.CreateCell(4); + cell4.SetCellValue(item.PunchTime?.ToString("yyyy-MM-dd HH:mm:ss") ?? ""); + cell4.CellStyle = style; + + // 人员 + ICell cell5 = dataRow.CreateCell(5); + cell5.SetCellValue(item.UserName ?? ""); + cell5.CellStyle = style; + + // 巡查结果 + ICell cell6 = dataRow.CreateCell(6); + cell6.SetCellValue(item.StatusName ?? ""); + cell6.CellStyle = style; + } + #endregion + } + } + + response.Result = new MemoryStream(); + workbook.Write(response.Result); + workbook = null; + response.Result.Position = 0; + response.Code = 200; + response.Message = "导出成功"; + } + catch (Exception ex) + { + response.Code = 500; + response.Message = ex.Message; + } + return response; + } + + + public async Task> ExportViolationReportDetails() + { + Response response = new Response(); + try + { + HSSFWorkbook workbook = new HSSFWorkbook(); + + #region 内容样式 + IFont font1 = workbook.CreateFont(); + font1.FontName = "Microsoft YaHei"; + 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; + #endregion + + #region 标题样式 + IFont font = workbook.CreateFont(); + font.FontName = "Microsoft YaHei"; + 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); + #endregion + + // 获取数据 + List list = new List(); + using (var uow = UnitWork.CreateContext()) + { + var data = await uow.MiViolationReport.AsQueryable() + .Where(p => p.IsDelete == false) + .LeftJoin((p, m) => p.MinePointId == m.Id) + .LeftJoin((p, m, u) => p.Reporter == u.Id.ToString()) + .Select((p, m, u) => new ViolateReportStatistics + { + Id = p.Id, + PointName = m.Name, + StreetName = m.StreetName, + CountyName = m.CountyName, + CommunityName = m.CommunityName, + ReportTime = p.ReportTime, + ReporterName = u.Name, + ViolationTypeName = p.ViolationTypeName, + MineralTypes = p.MineralTypes, + PartyName = p.PartyName, + Status = p.Status, + VechileCount = SqlFunc.Subqueryable().Where(r => r.ViolationReportId == p.Id).Count(), + ImageCount = SqlFunc.Subqueryable().Where(r => r.ViolationReportId == p.Id).Count(), // 注意:原查询条件是 !=,保留原样 + OtherPersonCount = SqlFunc.Subqueryable().Where(r => r.ViolationReportId == p.Id).Count(), + }) + .ToListAsync(); + + // 计算当前状态 + foreach (var item in data) + { + var vechile = uow.MiVehicle.AsQueryable().Where(r => r.ViolationReportId == item.Id).ToList(); + if (vechile.Where(r => r.State == 2 || r.State == 3).Count() == 0) + { + item.CurrentStatusName = "扣押中"; + } + else + { + if (vechile.Where(r => r.State == 0 || r.State == 1).Count() == 0) + { + item.CurrentStatusName = "全部放还"; + } + else + { + item.CurrentStatusName = "部分放还"; + } + } + } + list = data; + } + + int totalCount = list.Count; + int pageSize = 60000; + int sheetCount = (totalCount / pageSize) + (totalCount % pageSize > 0 ? 1 : 0); + if (sheetCount == 0) sheetCount = 1; + + for (int s = 0; s < sheetCount; s++) + { + ISheet sheet = workbook.CreateSheet($"Sheet{s + 1}"); + + #region 创建表头 + IRow headerRow = sheet.CreateRow(0); + headerRow.Height = 20 * 30; + string[] headers = { + "片区", "乡镇", "村居", "点位名称", "处置时间", "人员", + "违法类型", "矿产品种", "当事人", "车辆及设备数量", + "现场照片数量", "其他涉案人员数量", "当前状态" + }; + for (int i = 0; i < headers.Length; i++) + { + ICell cell = headerRow.CreateCell(i); + cell.SetCellValue(headers[i]); + cell.CellStyle = style1; + sheet.SetColumnWidth(i, 20 * 350); + } + #endregion + + #region 填充数据 + int startIndex = s * pageSize; + int endIndex = Math.Min(startIndex + pageSize, totalCount); + for (int i = startIndex, row = 1; i < endIndex; i++, row++) + { + var item = list[i]; + IRow dataRow = sheet.CreateRow(row); + + // 片区 + dataRow.CreateCell(0).SetCellValue(item.CountyName ?? ""); + dataRow.Cells[0].CellStyle = style; + + // 乡镇 + dataRow.CreateCell(1).SetCellValue(item.StreetName ?? ""); + dataRow.Cells[1].CellStyle = style; + + // 村居 + dataRow.CreateCell(2).SetCellValue(item.CommunityName ?? ""); + dataRow.Cells[2].CellStyle = style; + + // 点位名称 + dataRow.CreateCell(3).SetCellValue(item.PointName ?? ""); + dataRow.Cells[3].CellStyle = style; + + // 处置时间 + dataRow.CreateCell(4).SetCellValue(item.ReportTime?.ToString("yyyy-MM-dd HH:mm:ss") ?? ""); + dataRow.Cells[4].CellStyle = style; + + // 人员 + dataRow.CreateCell(5).SetCellValue(item.ReporterName ?? ""); + dataRow.Cells[5].CellStyle = style; + + // 违法类型 + dataRow.CreateCell(6).SetCellValue(item.ViolationTypeName ?? ""); + dataRow.Cells[6].CellStyle = style; + + // 矿产品种 + dataRow.CreateCell(7).SetCellValue(item.MineralTypes ?? ""); + dataRow.Cells[7].CellStyle = style; + + // 当事人 + dataRow.CreateCell(8).SetCellValue(item.PartyName ?? ""); + dataRow.Cells[8].CellStyle = style; + + // 车辆及设备数量 + dataRow.CreateCell(9).SetCellValue(item.VechileCount); + dataRow.Cells[9].CellStyle = style; + + // 现场照片数量 + dataRow.CreateCell(10).SetCellValue(item.ImageCount); + dataRow.Cells[10].CellStyle = style; + + // 其他涉案人员数量 + dataRow.CreateCell(11).SetCellValue(item.OtherPersonCount); + dataRow.Cells[11].CellStyle = style; + + // 当前状态 + dataRow.CreateCell(12).SetCellValue(item.CurrentStatusName ?? ""); + dataRow.Cells[12].CellStyle = style; + } + #endregion + } + + response.Result = new MemoryStream(); + workbook.Write(response.Result); + workbook = null; + response.Result.Position = 0; + response.Code = 200; + response.Message = "导出成功"; + } + catch (Exception ex) + { + response.Code = 500; + response.Message = ex.Message; + } + return response; + } + #endregion } } \ No newline at end of file diff --git a/OpenAuth.App/ServiceApp/MiManager/Response/PunchStatistics.cs b/OpenAuth.App/ServiceApp/MiManager/Response/PunchStatistics.cs index 81ff0ff..c703966 100644 --- a/OpenAuth.App/ServiceApp/MiManager/Response/PunchStatistics.cs +++ b/OpenAuth.App/ServiceApp/MiManager/Response/PunchStatistics.cs @@ -10,7 +10,7 @@ namespace OpenAuth.App.ServiceApp.MiManager.Response { public long UserId { get; set; } /// - /// 组织架构名 + /// 单位 /// public string OrgName { get; set; } /// diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/MiVehiclePickupController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/MiVehiclePickupController.cs index 4d73d88..10c5df4 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/MiVehiclePickupController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/MiVehiclePickupController.cs @@ -233,6 +233,28 @@ namespace OpenAuth.WebApi.Controllers return result; } + + /// + /// 根据违法上报id查询解除扣押单信息 + /// + /// 违法上报id + /// + [HttpGet] + public async Task> GetReleaseDocumentByReportId(string reportid) + { + var result = new Response(); + try + { + result.Result = await _app.GetReleaseDocumentByReportId(reportid); + } + catch (Exception ex) + { + result.Code = 500; + result.Message = ex.InnerException?.Message ?? ex.Message; + } + + return result; + } #endregion #endregion } diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/MiViolationReportController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/MiViolationReportController.cs index ccfbdf3..b94fe0d 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/MiViolationReportController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/MiViolationReportController.cs @@ -448,7 +448,99 @@ namespace OpenAuth.WebApi.Controllers return result; } #endregion + #region 导出 + /// + /// 巡查台账--人员导出 + /// + /// + [HttpGet] + public async Task ExportPunchStatistics() + { + var res = new Response(); + var excelRes = await _app.ExportPunchStatistics(); + 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); + } + /// + /// 巡查台账--人员导出 + /// + /// + [HttpGet] + public async Task ExportPointPunchStatistics() + { + var res = new Response(); + var excelRes = await _app.ExportPointPunchStatistics(); + 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); + } + + /// + /// 巡查台账清单 + /// + /// + [HttpGet] + public async Task ExportPunchRecordDetails() + { + var res = new Response(); + var excelRes = await _app.ExportPunchRecordDetails(); + 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); + } + + /// + /// 违法处置台账导出 + /// + /// + [HttpGet] + public async Task ExportViolationReportDetails() + { + var res = new Response(); + var excelRes = await _app.ExportViolationReportDetails(); + 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 #endregion } } \ No newline at end of file