- 将导出数据从手动构建Dictionary改为直接使用DTO序列化,简化Controller逻辑 - 为OdfCableFaultExportDto添加ExcelColumnName属性实现声明式中文列映射 - 在导出前填充计算字段FaultTimesDisplay和DisplayMileage - 将FaultTime和Mileage标记为ExcelIgnore,防止内部字段被导出 - Service层批量查询故障频次时间,并在分页结果中返回供前端使用 - 前端表格故障时间列增强展示,显示首次故障时间及额外频次时间列表
166 lines
4.3 KiB
C#
166 lines
4.3 KiB
C#
using Microsoft.AspNetCore.Http;
|
|
using MiniExcelLibs.Attributes;
|
|
|
|
namespace ZR.Model.Business.Dto
|
|
{
|
|
/// <summary>
|
|
/// 干线故障查询对象
|
|
/// </summary>
|
|
public class OdfCableFaultsQueryDto : PagerInfo
|
|
{
|
|
public int? CableId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 故障时间范围 - 开始
|
|
/// </summary>
|
|
public DateTime? BeginFaultTime { get; set; }
|
|
|
|
/// <summary>
|
|
/// 故障时间范围 - 结束
|
|
/// </summary>
|
|
public DateTime? EndFaultTime { get; set; }
|
|
|
|
public string FaultReason { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增故障输入对象(含图片上传)
|
|
/// </summary>
|
|
public class OdfCableFaultAddDto
|
|
{
|
|
public int CableId { get; set; }
|
|
|
|
public string FaultTime { get; set; }
|
|
|
|
public string Personnel { get; set; }
|
|
|
|
public string FaultReason { get; set; }
|
|
|
|
public string Mileage { get; set; }
|
|
|
|
public string MileageCorrection { get; set; }
|
|
|
|
public string Location { get; set; }
|
|
|
|
public decimal Latitude { get; set; }
|
|
|
|
public decimal Longitude { get; set; }
|
|
|
|
public string Remark { get; set; }
|
|
|
|
public long? UserId { get; set; }
|
|
|
|
public IFormFile[] Images { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 干线故障导入对象(列头与导出一致)
|
|
/// </summary>
|
|
public class OdfCableFaultImportDto
|
|
{
|
|
[ExcelColumnName("编号")]
|
|
public int? Id { get; set; }
|
|
|
|
[ExcelColumnName("光缆编号")]
|
|
public int? CableId { get; set; }
|
|
|
|
[ExcelColumnName("故障时间")]
|
|
public DateTime? FaultTime { get; set; }
|
|
|
|
[ExcelColumnName("人员")]
|
|
public string Personnel { get; set; }
|
|
|
|
[ExcelColumnName("故障原因")]
|
|
public string FaultReason { get; set; }
|
|
|
|
[ExcelColumnName("表显故障里程")]
|
|
public string Mileage { get; set; }
|
|
|
|
[ExcelColumnName("表显里程矫正")]
|
|
public string MileageCorrection { get; set; }
|
|
|
|
[ExcelColumnName("地点")]
|
|
public string Location { get; set; }
|
|
|
|
[ExcelColumnName("纬度")]
|
|
public decimal? Latitude { get; set; }
|
|
|
|
[ExcelColumnName("经度")]
|
|
public decimal? Longitude { get; set; }
|
|
|
|
[ExcelColumnName("备注")]
|
|
public string Remark { get; set; }
|
|
|
|
[ExcelColumnName("创建时间")]
|
|
public DateTime? CreatedAt { get; set; }
|
|
|
|
[ExcelColumnName("所属光缆")]
|
|
public string CableName { get; set; }
|
|
|
|
[ExcelColumnName("故障发生频次")]
|
|
public int? FaultCount { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新表显里程矫正
|
|
/// </summary>
|
|
public class MileageCorrectionDto
|
|
{
|
|
public string MileageCorrection { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 干线故障导出对象(联查光缆名称)
|
|
/// </summary>
|
|
public class OdfCableFaultExportDto
|
|
{
|
|
[ExcelColumnName("编号")]
|
|
public int Id { get; set; }
|
|
|
|
[ExcelColumnName("光缆编号")]
|
|
public int CableId { get; set; }
|
|
|
|
[ExcelColumnName("故障时间")]
|
|
public string FaultTimesDisplay { get; set; }
|
|
|
|
[ExcelColumnName("故障发生频次")]
|
|
public int FaultCount { get; set; }
|
|
|
|
[ExcelColumnName("人员")]
|
|
public string Personnel { get; set; }
|
|
|
|
[ExcelColumnName("故障原因")]
|
|
public string FaultReason { get; set; }
|
|
|
|
[ExcelColumnName("表显故障里程")]
|
|
public string DisplayMileage { get; set; }
|
|
|
|
[ExcelColumnName("表显里程矫正")]
|
|
public string MileageCorrection { get; set; }
|
|
|
|
[ExcelColumnName("地点")]
|
|
public string Location { get; set; }
|
|
|
|
[ExcelColumnName("纬度")]
|
|
public decimal Latitude { get; set; }
|
|
|
|
[ExcelColumnName("经度")]
|
|
public decimal Longitude { get; set; }
|
|
|
|
[ExcelColumnName("备注")]
|
|
public string Remark { get; set; }
|
|
|
|
[ExcelColumnName("创建时间")]
|
|
public DateTime? CreatedAt { get; set; }
|
|
|
|
[ExcelColumnName("所属光缆")]
|
|
public string CableName { get; set; }
|
|
|
|
// 以下字段不导出,仅内部使用
|
|
[ExcelIgnore]
|
|
public DateTime FaultTime { get; set; }
|
|
[ExcelIgnore]
|
|
public string Mileage { get; set; }
|
|
}
|
|
}
|