diff --git a/Entity/Api/Resp/BaseSetStationConfigInfo.cs b/Entity/Api/Resp/BaseSetStationConfigInfo.cs index 2c8c7e4..971da49 100644 --- a/Entity/Api/Resp/BaseSetStationConfigInfo.cs +++ b/Entity/Api/Resp/BaseSetStationConfigInfo.cs @@ -34,4 +34,8 @@ public class BaseSetStationConfigInfo /// 换电运营模式:1-自动 2-手动 /// public int SwapType{ get; set; } + /// + /// 电价模型板 版本号 + /// + public int Version{ get; set; } } \ No newline at end of file diff --git a/Service/Station/ElecPriceModelVersionService.cs b/Service/Station/ElecPriceModelVersionService.cs new file mode 100644 index 0000000..ae6e261 --- /dev/null +++ b/Service/Station/ElecPriceModelVersionService.cs @@ -0,0 +1,25 @@ +using Entity.DbModel.Station; +using HybirdFrameworkCore.Autofac.Attribute; +using Repository.Station; +namespace Service.Station; + +[Scope("SingleInstance")] +public class ElecPriceModelVersionService : BaseServices +{ + ElecPriceModelVersionRepository _elecPriceModelVersionRepository; + public ElecPriceModelVersionService(ElecPriceModelVersionRepository dal) + { + _elecPriceModelVersionRepository = dal; + BaseDal = dal; + } + + /// + /// 返回当前版本号 + /// + /// + public async Task GetNowVersion() + { + ElecPriceModelVersion elecPriceModelVersion =await _elecPriceModelVersionRepository.QueryByClauseAsync(u => u.EndTime > DateTime.Now); + return elecPriceModelVersion.Version; + } +} \ No newline at end of file diff --git a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs index b61af8d..801db85 100644 --- a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs +++ b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs @@ -24,6 +24,7 @@ namespace WebStarter.Controllers.BasicConfig { private readonly SysConfigService _sysConfigService; private readonly ElecPriceModelVersionDetailServices _elecPriceModelVersionDetailServices; + private readonly ElecPriceModelVersionService _elecPriceModelVersionService; public BaseConfigController(SysConfigService sysConfigService, ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices) { _sysConfigService = sysConfigService; @@ -145,9 +146,13 @@ namespace WebStarter.Controllers.BasicConfig case "BusinessEndHours": stationBaseInfoResp.BusinessEndHours = item.Value; break; } } + stationBaseInfoResp.Version=await _elecPriceModelVersionService.GetNowVersion(); return Result.Success(stationBaseInfoResp); } + + + /// /// 提交换电策略设置 /// @@ -273,6 +278,7 @@ namespace WebStarter.Controllers.BasicConfig /// /// /// + [ApiExplorerSettings(IgnoreApi = true)] public bool TimeListIfContains(List timePeriods) { bool hasOverlap = false;