|
|
|
|
using Entity.Api.Req;
|
|
|
|
|
using Entity.Api.Resp;
|
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
|
using Repository.Station;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System.Linq.Expressions;
|
|
|
|
|
|
|
|
|
|
namespace Service.Station;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>綩<EFBFBD><E7B6A9>
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Scope("SingleInstance")]
|
|
|
|
|
public class ChargeOrderService : BaseServices<ChargeOrder>
|
|
|
|
|
{
|
|
|
|
|
ChargeOrderRepository chargeOrderRepository;
|
|
|
|
|
public ChargeOrderService(ChargeOrderRepository dal)
|
|
|
|
|
{
|
|
|
|
|
chargeOrderRepository = dal;
|
|
|
|
|
BaseDal = dal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="equipAlarmLevel"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public PageResult<ChargeOrderResp> QueryChargeOrder(QueryChargeOrderReq chargeOrder)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>յı<D5B5><C4B1><EFBFBD>ʽ<EFBFBD><CABD>
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> where = null;
|
|
|
|
|
//// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
ParameterExpression parameter = Expression.Parameter(typeof(ChargeOrder), "u");
|
|
|
|
|
|
|
|
|
|
#region <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><CCAC>ѯ<EFBFBD><D1AF>
|
|
|
|
|
if (chargeOrder.Id != 0)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition1Expr = u => u.Id == chargeOrder.Id;
|
|
|
|
|
where = condition1Expr;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(chargeOrder.Sn))
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.Sn == chargeOrder.Sn;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(chargeOrder.BatteryNo))
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.BatteryNo == chargeOrder.BatteryNo;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (chargeOrder.CmdStatus!=0)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.CmdStatus == chargeOrder.CmdStatus;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(chargeOrder.ChargerNo))
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.ChargerNo == chargeOrder.ChargerNo;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(chargeOrder.ChargerGunNo))
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.ChargerGunNo == chargeOrder.ChargerGunNo;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (chargeOrder.ChargeMode != 0)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.ChargeMode == chargeOrder.ChargeMode;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (chargeOrder.StartMode!=0)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.StartMode == chargeOrder.StartMode;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (chargeOrder.StartTime != null && chargeOrder.StartTime != DateTime.MinValue)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.StartTime == chargeOrder.StartTime;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (chargeOrder.EndTime != null && chargeOrder.EndTime != DateTime.MinValue)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.EndTime == chargeOrder.EndTime;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (chargeOrder.ChargeTimeCount!=0)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.ChargeTimeCount == chargeOrder.ChargeTimeCount;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (chargeOrder.StopReason != 0)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.StopReason == chargeOrder.StopReason;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(chargeOrder.ElecPriceModelVersion))
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.ElecPriceModelVersion == chargeOrder.ElecPriceModelVersion;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(chargeOrder.SwapOrderSn))
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.SwapOrderSn == chargeOrder.SwapOrderSn;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (chargeOrder.CloudReportStatus != 0)
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.CloudReportStatus == chargeOrder.CloudReportStatus;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(chargeOrder.CloudSn))
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.CloudSn == chargeOrder.CloudSn;
|
|
|
|
|
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
//<2F><>ѯ
|
|
|
|
|
return PageResult<ChargeOrderResp>.ConvertPage(chargeOrderRepository.QueryIPageByCause(chargeOrder, where));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|