diff --git a/langguanApi/Model/CleanTransportation.cs b/langguanApi/Model/CleanTransportation.cs index 84bd4e2..59bca40 100644 --- a/langguanApi/Model/CleanTransportation.cs +++ b/langguanApi/Model/CleanTransportation.cs @@ -41,32 +41,64 @@ /// public string V5Percent { get; set; } /// + /// 国五比例数量 + /// + public double V5Numer { get; set; } + /// /// 国五运输量百分比 /// public string V5WeightPercent { get; set; } /// + /// 国五运输量比例 + /// + public double V5WeightNumber { get; set; } + /// /// 国六百分比 /// public string V6Percent { get; set; } /// + /// 国六运输量 + /// + public double V6Number { get; set; } + /// /// 国六运输量百分比 /// public string V6WeightPercent { get; set; } /// + /// 国六运输量 + /// + public double V6WeightNumber { get; set; } + /// /// 电动百分比 /// public string ElectricPrecent { get; set; } /// + /// 电动运输量 + /// + public double ElectricNumber { get; set; } + /// /// 电动运输量百分比 /// public string ElectricWeightPrecent { get; set; } /// + /// 电动运输量 + /// + public double ElectricWeightNumber { get; set; } + /// /// 其他百分比 /// public string OtherPrecent { get; set; } /// + /// 其他运输量 + /// + public double OtherNumber { get; set; } + /// /// 其他运输量百分比 /// public string OtherWeightPrecent { get; set; } + /// + /// 其他运输量 + /// + public double OtherWeightNumber { get; set; } } } diff --git a/langguanApi/Model/Transport.cs b/langguanApi/Model/Transport.cs index 7ed433d..231c02c 100644 --- a/langguanApi/Model/Transport.cs +++ b/langguanApi/Model/Transport.cs @@ -132,6 +132,34 @@ public string TransportTypeString { get; set; } public string TimeString { get; set; } + + /// + /// 排放标准(0-7是国1-7,D:电动 X:无排放阶段) + /// + public string EmissionLevelString(string sort) + { + switch (sort) + { + case "1": + return "国I"; + case "2": + return "国II"; + case "3": + return "国III"; + case "4": + return "国IV"; + case "5": + return "国V"; + case "6": + return "国VI"; + case "7": + return "国VII"; + case "D": + return "电动"; + default: + return "无排放阶段"; + } + } } public enum CarColor { diff --git a/langguanApi/Service/TransportService.cs b/langguanApi/Service/TransportService.cs index 1285121..a881e89 100644 --- a/langguanApi/Service/TransportService.cs +++ b/langguanApi/Service/TransportService.cs @@ -55,7 +55,8 @@ namespace langguanApi.Service var entity = item.Adapt(); entity.CarColorString = GetColorString(item.CarColor); entity.TransportTypeString = item.TransportType == 1 ? "进场" : "出场"; - entity.TimeString = item.Time.ToString(); + entity.TimeString = item.Time.ToString("yyyy-MM-dd HH:mm:ss"); + entity.effluent = GetEffluentString(item.effluent); result.Add(entity); } } @@ -108,7 +109,7 @@ namespace langguanApi.Service CarColor = GetColorString(transport.CarColor), CarNumber = transport.CarNumber, CarType = transport.CarType, - Time = transport.Time.ToString(), + Time = transport.Time.ToString("yyyy-MM-dd HH:mm:ss"), Weight = item.Weight, Effluent = GetEffluentString(transport.effluent) }); @@ -129,13 +130,21 @@ namespace langguanApi.Service if (result.cleans.Any()) { result.V5Percent =((double)result.cleans.Count(p => p.Effluent == "国五") / result.cleans.Count()).ToString(); + result.V5Numer = (double)result.cleans.Count(p => p.Effluent == "国五"); result.V5WeightPercent = (result.cleans.Where(p => p.Effluent == "国五").Sum(p=>p.Weight) / result.cleans.Sum(p=>p.Weight)).ToString("0.00"); + result.V5WeightNumber = result.cleans.Where(p => p.Effluent == "国五").Sum(p => p.Weight); result.V6Percent = ((double)result.cleans.Count(p => p.Effluent == "国六") / result.cleans.Count()).ToString("0.00"); + result.V6Number = (double)result.cleans.Count(p => p.Effluent == "国六"); result.V6WeightPercent = (result.cleans.Where(p => p.Effluent == "国六").Sum(p => p.Weight) / result.cleans.Sum(p => p.Weight)).ToString("0.00"); + result.V6WeightNumber = result.cleans.Where(p => p.Effluent == "国六").Sum(p => p.Weight); result.ElectricPrecent = ((double)result.cleans.Count(p => p.Effluent == "电动") / result.cleans.Count()).ToString("0.00"); + result.ElectricNumber = (double)result.cleans.Count(p => p.Effluent == "电动"); result.ElectricWeightPrecent = (result.cleans.Where(p => p.Effluent == "电动").Sum(p => p.Weight) / result.cleans.Sum(p => p.Weight)).ToString("0.00"); + result.ElectricWeightNumber = result.cleans.Where(p => p.Effluent == "电动").Sum(p => p.Weight); result.OtherPrecent = ((double)result.cleans.Count(p => p.Effluent != "电动" && p.Effluent != "国五" && p.Effluent != "国六") / result.cleans.Count()).ToString("0.00"); + result.OtherNumber = (double)result.cleans.Count(p => p.Effluent != "电动" && p.Effluent != "国五" && p.Effluent != "国六"); result.OtherWeightPrecent = (result.cleans.Where(p => p.Effluent != "电动" && p.Effluent != "国五" && p.Effluent != "国六").Sum(p => p.Weight) / result.cleans.Sum(p => p.Weight)).ToString("0.00"); + result.OtherWeightNumber = (double)result.cleans.Where(p => p.Effluent != "电动" && p.Effluent != "国五" && p.Effluent != "国六").Sum(p => p.Weight); } return new ApiResult() {