报表导出

master
洁 任 2026-03-09 16:12:18 +08:00
parent ba811c515a
commit 976378a3e0
5 changed files with 757 additions and 9 deletions

View File

@ -845,6 +845,46 @@ namespace OpenAuth.App
return result; return result;
} }
} }
/// <summary>
/// 根据id查询解除扣押单信息
/// </summary>
/// <param name="reportid">违法上报id</param>
/// <returns></returns>
public async Task<dynamic> GetReleaseDocumentByReportId(string reportid)
{
using (var uow = UnitWork.CreateContext())
{
var item = await uow.MiReleaseDocument.AsQueryable()
.Where(p => p.ViolationReportId == reportid)
.LeftJoin<MiParking>((p, r) => p.ParkingLot == r.Id)
.OrderByDescending(p => p.CreatedAt)
.Select<dynamic>((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 #endregion
} }

View File

@ -1,11 +1,14 @@
using DocumentFormat.OpenXml.Bibliography; using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.EMMA; using DocumentFormat.OpenXml.EMMA;
using DocumentFormat.OpenXml.Math;
using DocumentFormat.OpenXml.Office.CustomUI; using DocumentFormat.OpenXml.Office.CustomUI;
using Infrastructure; using Infrastructure;
using Infrastructure.Extensions; using Infrastructure.Extensions;
using Infrastructure.Helpers; using Infrastructure.Helpers;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.SS.Util; using NPOI.SS.Util;
using OpenAuth.App.BaseApp.Base; using OpenAuth.App.BaseApp.Base;
using OpenAuth.App.Common; using OpenAuth.App.Common;
@ -1069,7 +1072,7 @@ namespace OpenAuth.App
PartyName = p.PartyName, PartyName = p.PartyName,
Status=p.Status, Status=p.Status,
VechileCount = SqlFunc.Subqueryable<MiVehicle>().Where(r => r.ViolationReportId == p.Id).Count(), VechileCount = SqlFunc.Subqueryable<MiVehicle>().Where(r => r.ViolationReportId == p.Id).Count(),
ImageCount = SqlFunc.Subqueryable<MiScenePhoto>().Where(r => r.ViolationReportId != p.Id).Count(), ImageCount = SqlFunc.Subqueryable<MiScenePhoto>().Where(r => r.ViolationReportId == p.Id).Count(),
OtherPersonCount = SqlFunc.Subqueryable<MiViolationUsers>().Where(r => r.ViolationReportId == p.Id).Count(), OtherPersonCount = SqlFunc.Subqueryable<MiViolationUsers>().Where(r => r.ViolationReportId == p.Id).Count(),
}).ToPageListAsync(page, limit, totalCount); }).ToPageListAsync(page, limit, totalCount);
foreach (var item in data) foreach (var item in data)
@ -1118,7 +1121,7 @@ namespace OpenAuth.App
Id = r.Id.SelectAll(), Id = r.Id.SelectAll(),
UserName = u.Name, UserName = u.Name,
PointName = p.Name, PointName = p.Name,
StreetName=p.StreetName, StreetName = p.StreetName,
p.CountyName, p.CountyName,
p.CommunityName, p.CommunityName,
StatusName = SqlFunc.Subqueryable<SysDataItemDetail>().Where(a => a.ItemCode == "JGMinePointStatus" && a.ItemValue == r.PunchStatus.ToString()).Select(a => a.ItemName) StatusName = SqlFunc.Subqueryable<SysDataItemDetail>().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()) using (var uow = UnitWork.CreateContext())
{ {
var result = await uow.MiPunchRecord.AsQueryable() var result = await uow.MiPunchRecord.AsQueryable()
.Where(p => p.MinePointId == pointid) .Where(r=>r.MinePointId==pointid)
.OrderByDescending(p => p.PunchTime) .LeftJoin<SysUser>((r, u) => r.UserId == u.Id)
.Select<dynamic>((p) => new .LeftJoin<MiMinePoint>((r, u, p) => r.MinePointId == p.Id)
.OrderByDescending((r, u, p) => r.PunchTime)
.Select<dynamic>((r, u, p) => new
{ {
Id = p.Id.SelectAll() Id = r.Id.SelectAll(),
}).ToListAsync(); UserName = u.Name,
PointName = p.Name,
StreetName = p.StreetName,
p.CountyName,
p.CommunityName,
StatusName = SqlFunc.Subqueryable<SysDataItemDetail>().Where(a => a.ItemCode == "JGMinePointStatus" && a.ItemValue == r.PunchStatus.ToString()).Select(a => a.ItemName)
})
.ToListAsync();
return result; return result;
} }
} }
@ -1257,5 +1269,587 @@ namespace OpenAuth.App
} }
} }
#endregion #endregion
#region
//导出 巡查台账--人员
public async Task<Response<MemoryStream>> ExportPunchStatistics()
{
Response<MemoryStream> response = new Response<MemoryStream>();
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<Response<MemoryStream>> ExportPointPunchStatistics()
{
Response<MemoryStream> response = new Response<MemoryStream>();
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<Response<MemoryStream>> ExportPunchRecordDetails()
{
Response<MemoryStream> response = new Response<MemoryStream>();
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<SysUser>((r, u) => r.UserId == u.Id)
.LeftJoin<MiMinePoint>((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<SysDataItemDetail>()
.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<Response<MemoryStream>> ExportViolationReportDetails()
{
Response<MemoryStream> response = new Response<MemoryStream>();
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<ViolateReportStatistics> list = new List<ViolateReportStatistics>();
using (var uow = UnitWork.CreateContext())
{
var data = await uow.MiViolationReport.AsQueryable()
.Where(p => p.IsDelete == false)
.LeftJoin<MiMinePoint>((p, m) => p.MinePointId == m.Id)
.LeftJoin<SysUser>((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<MiVehicle>().Where(r => r.ViolationReportId == p.Id).Count(),
ImageCount = SqlFunc.Subqueryable<MiScenePhoto>().Where(r => r.ViolationReportId == p.Id).Count(), // 注意:原查询条件是 !=,保留原样
OtherPersonCount = SqlFunc.Subqueryable<MiViolationUsers>().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
} }
} }

View File

@ -10,7 +10,7 @@ namespace OpenAuth.App.ServiceApp.MiManager.Response
{ {
public long UserId { get; set; } public long UserId { get; set; }
/// <summary> /// <summary>
/// 组织架构名 /// 单位
/// </summary> /// </summary>
public string OrgName { get; set; } public string OrgName { get; set; }
/// <summary> /// <summary>

View File

@ -233,6 +233,28 @@ namespace OpenAuth.WebApi.Controllers
return result; return result;
} }
/// <summary>
/// 根据违法上报id查询解除扣押单信息
/// </summary>
/// <param name="reportid">违法上报id</param>
/// <returns></returns>
[HttpGet]
public async Task<Response<dynamic>> GetReleaseDocumentByReportId(string reportid)
{
var result = new Response<dynamic>();
try
{
result.Result = await _app.GetReleaseDocumentByReportId(reportid);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
#endregion #endregion
#endregion #endregion
} }

View File

@ -448,7 +448,99 @@ namespace OpenAuth.WebApi.Controllers
return result; return result;
} }
#endregion #endregion
#region 导出
/// <summary>
/// 巡查台账--人员导出
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> 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);
}
/// <summary>
/// 巡查台账--人员导出
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> 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);
}
/// <summary>
/// 巡查台账清单
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> 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);
}
/// <summary>
/// 违法处置台账导出
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> 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 #endregion
} }
} }