增加电价模型Version查询

zw
lch 6 months ago
parent f7642c0090
commit 51362eaa0c

@ -34,4 +34,8 @@ public class BaseSetStationConfigInfo
/// 换电运营模式1-自动 2-手动 /// 换电运营模式1-自动 2-手动
/// </summary> /// </summary>
public int SwapType{ get; set; } public int SwapType{ get; set; }
/// <summary>
/// 电价模型板 版本号
/// </summary>
public int Version{ get; set; }
} }

@ -0,0 +1,25 @@
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
using Repository.Station;
namespace Service.Station;
[Scope("SingleInstance")]
public class ElecPriceModelVersionService : BaseServices<ElecPriceModelVersion>
{
ElecPriceModelVersionRepository _elecPriceModelVersionRepository;
public ElecPriceModelVersionService(ElecPriceModelVersionRepository dal)
{
_elecPriceModelVersionRepository = dal;
BaseDal = dal;
}
/// <summary>
/// 返回当前版本号
/// </summary>
/// <returns></returns>
public async Task<int> GetNowVersion()
{
ElecPriceModelVersion elecPriceModelVersion =await _elecPriceModelVersionRepository.QueryByClauseAsync(u => u.EndTime > DateTime.Now);
return elecPriceModelVersion.Version;
}
}

@ -24,6 +24,7 @@ namespace WebStarter.Controllers.BasicConfig
{ {
private readonly SysConfigService _sysConfigService; private readonly SysConfigService _sysConfigService;
private readonly ElecPriceModelVersionDetailServices _elecPriceModelVersionDetailServices; private readonly ElecPriceModelVersionDetailServices _elecPriceModelVersionDetailServices;
private readonly ElecPriceModelVersionService _elecPriceModelVersionService;
public BaseConfigController(SysConfigService sysConfigService, ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices) public BaseConfigController(SysConfigService sysConfigService, ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices)
{ {
_sysConfigService = sysConfigService; _sysConfigService = sysConfigService;
@ -145,9 +146,13 @@ namespace WebStarter.Controllers.BasicConfig
case "BusinessEndHours": stationBaseInfoResp.BusinessEndHours = item.Value; break; case "BusinessEndHours": stationBaseInfoResp.BusinessEndHours = item.Value; break;
} }
} }
stationBaseInfoResp.Version=await _elecPriceModelVersionService.GetNowVersion();
return Result<BaseSetStationConfigInfo>.Success(stationBaseInfoResp); return Result<BaseSetStationConfigInfo>.Success(stationBaseInfoResp);
} }
/// <summary> /// <summary>
/// 提交换电策略设置 /// 提交换电策略设置
/// </summary> /// </summary>
@ -273,6 +278,7 @@ namespace WebStarter.Controllers.BasicConfig
/// </summary> /// </summary>
/// <param name="timePeriods"></param> /// <param name="timePeriods"></param>
/// <returns></returns> /// <returns></returns>
[ApiExplorerSettings(IgnoreApi = true)]
public bool TimeListIfContains(List<ElecPriceModelVersionDetail> timePeriods) public bool TimeListIfContains(List<ElecPriceModelVersionDetail> timePeriods)
{ {
bool hasOverlap = false; bool hasOverlap = false;

Loading…
Cancel
Save