From 354492d6efa9a90fc3e8fc75d58ae5dd524c39bb Mon Sep 17 00:00:00 2001
From: pangwenpeng <17302161021@163.com>
Date: Tue, 27 Aug 2024 15:42:00 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E6=B4=81=E8=BF=90=E8=B6=8B=E5=8A=BF?=
=?UTF-8?q?=E6=A0=BC=E5=BC=8F=E6=98=BE=E7=A4=BA=E5=8A=A0=E9=A5=BC=E5=9B=BE?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=EF=BC=8C=E9=97=A8=E7=A6=81=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E5=86=85=E5=AE=B9=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F=E5=8C=96?=
=?UTF-8?q?=E5=8A=A0=E6=96=87=E5=AD=97=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
langguanApi/Model/CleanTransportation.cs | 32 ++++++++++++++++++++++++
langguanApi/Model/Transport.cs | 28 +++++++++++++++++++++
langguanApi/Service/TransportService.cs | 13 ++++++++--
3 files changed, 71 insertions(+), 2 deletions(-)
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()
{