|
|
|
@ -10,6 +10,7 @@ using Entity.DbModel.System.SysBaseObject;
|
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
|
using Microsoft.VisualBasic;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using Service.Init;
|
|
|
|
|
using Service.Station;
|
|
|
|
|
using Service.System;
|
|
|
|
|
|
|
|
|
@ -133,105 +134,44 @@ namespace WebStarter.Controllers.BasicConfig
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取换电策略设置 、灯光日间时间、充电运营模式、营业时间段、换电运营模式
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("BaseSetStationConfigInfo")]
|
|
|
|
|
public async Task<Result<BaseSetStationConfigInfo>> BaseSetStationConfigInfo()
|
|
|
|
|
[HttpPost("StationBaseConfig")]
|
|
|
|
|
public async Task<Result<StationConfigResp>> StationBaseConfig()
|
|
|
|
|
{
|
|
|
|
|
BaseSetStationConfigInfo stationBaseInfoResp = new BaseSetStationConfigInfo();
|
|
|
|
|
List<SysConfig> sysConfigs = await _sysConfigService.GetGroupList("Station");
|
|
|
|
|
foreach (var item in sysConfigs)
|
|
|
|
|
{
|
|
|
|
|
switch (item.Code)
|
|
|
|
|
{
|
|
|
|
|
case "LightDayStartTime":
|
|
|
|
|
stationBaseInfoResp.LigthStartTime = item.Value;
|
|
|
|
|
break;
|
|
|
|
|
case "LightDayEndTime":
|
|
|
|
|
stationBaseInfoResp.LigthEndTime = item.Value;
|
|
|
|
|
break;
|
|
|
|
|
case "SwapSoc":
|
|
|
|
|
stationBaseInfoResp.SetSwapSoc = Convert.ToInt32(item.Value);
|
|
|
|
|
break;
|
|
|
|
|
case "FullSoc":
|
|
|
|
|
stationBaseInfoResp.SetFullSoc = Convert.ToInt32(item.Value);
|
|
|
|
|
break;
|
|
|
|
|
case "ChargeType":
|
|
|
|
|
stationBaseInfoResp.ChargeType = Convert.ToInt32(item.Value);
|
|
|
|
|
break;
|
|
|
|
|
case "SwapType":
|
|
|
|
|
stationBaseInfoResp.SwapType = Convert.ToInt32(item.Value);
|
|
|
|
|
break;
|
|
|
|
|
case "BusinessStartHours":
|
|
|
|
|
stationBaseInfoResp.BusinessStartHours = item.Value;
|
|
|
|
|
break;
|
|
|
|
|
case "BusinessEndHours":
|
|
|
|
|
stationBaseInfoResp.BusinessEndHours = item.Value;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
StationConfigResp stationBaseRespResp = new StationConfigResp();
|
|
|
|
|
|
|
|
|
|
stationBaseInfoResp.Version = await _elecPriceModelVersionService.GetNowVersion();
|
|
|
|
|
return Result<BaseSetStationConfigInfo>.Success(stationBaseInfoResp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stationBaseRespResp.SwapSoc = StaticStationInfo.SwapSoc;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 提交换电策略设置
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("SetReplacementStrategy")]
|
|
|
|
|
public async Task<Result<bool>> SetReplacementStrategy([FromBody] SetReplacementStrategyReq input)
|
|
|
|
|
{
|
|
|
|
|
bool setResult = SetConfigPorperty(input);
|
|
|
|
|
return Result<bool>.Success(setResult);
|
|
|
|
|
}
|
|
|
|
|
stationBaseRespResp.SwapFinishChargeTime = StaticStationInfo.SwapFinishChargeTime;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 日间时间设置
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("SetDaytime")]
|
|
|
|
|
public async Task<Result<bool>> SetDaytime([FromBody] SetDayTimeReq input)
|
|
|
|
|
{
|
|
|
|
|
bool setResult = SetConfigPorperty(input);
|
|
|
|
|
return Result<bool>.Success(setResult);
|
|
|
|
|
}
|
|
|
|
|
stationBaseRespResp.StationWay = StaticStationInfo.StationWay;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 充电运营模式 0:手动充电;1:自动充电
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("SetChargingOperationMode")]
|
|
|
|
|
public async Task<Result<bool>> SetChargingOperationMode([FromBody] SetChargingOperationModeReq input)
|
|
|
|
|
{
|
|
|
|
|
bool setResult = SetConfigPorperty(input);
|
|
|
|
|
return Result<bool>.Success(setResult);
|
|
|
|
|
}
|
|
|
|
|
stationBaseRespResp.Ceid = StaticStationInfo.Ceid;
|
|
|
|
|
stationBaseRespResp.AutoChargeEnabled = StaticStationInfo.AutoChargeEnabled;
|
|
|
|
|
stationBaseRespResp.Oid = StaticStationInfo.Oid;
|
|
|
|
|
stationBaseRespResp.StationStatus = StaticStationInfo.StationStatus;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 营业时间设置
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("SetBusinessHours")]
|
|
|
|
|
public async Task<Result<bool>> SetBusinessHours([FromBody] SetBusinessHoursReq input)
|
|
|
|
|
{
|
|
|
|
|
bool setResult = SetConfigPorperty(input);
|
|
|
|
|
return Result<bool>.Success(setResult);
|
|
|
|
|
return Result<StationConfigResp>.Success(stationBaseRespResp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 换电运营模式:1:自动;2:手动
|
|
|
|
|
/// 提交换电策略设置
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("SetSwitchingOperaModeReq")]
|
|
|
|
|
public async Task<Result<bool>> SetSwitchingOperationMode([FromBody] SetSwitchingOperaModeReq input)
|
|
|
|
|
[HttpPost("SetStationConfig")]
|
|
|
|
|
public async Task<Result<bool>> SetStationConfig([FromBody] StationConfigReq input)
|
|
|
|
|
{
|
|
|
|
|
bool setResult = SetConfigPorperty(input);
|
|
|
|
|
return Result<bool>.Success(setResult);
|
|
|
|
|
StaticStationInfo.SwapSoc = input.SwapSoc;
|
|
|
|
|
StaticStationInfo.StationStatus = input.StationStatus;
|
|
|
|
|
StaticStationInfo.SwapFinishChargeTime = input.SwapFinishChargeTime;
|
|
|
|
|
|
|
|
|
|
StaticStationInfo.AutoChargeEnabled = input.AutoChargeEnabled;
|
|
|
|
|
return Result<bool>.Success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询电价信息
|
|
|
|
|
/// </summary>
|
|
|
|
@ -248,12 +188,13 @@ namespace WebStarter.Controllers.BasicConfig
|
|
|
|
|
elecPriceModelVersionDetailResps.Add(new ElecPriceModelVersionDetailResp()
|
|
|
|
|
{
|
|
|
|
|
Version = item.Version,
|
|
|
|
|
StartTime = new TimeSpan(item.StartHour,item.StartMinute,item.StartSecond),
|
|
|
|
|
EndTime = new TimeSpan(item.EndHour,item.EndMinute,item.EndSecond),
|
|
|
|
|
StartTime = new TimeSpan(item.StartHour, item.StartMinute, item.StartSecond),
|
|
|
|
|
EndTime = new TimeSpan(item.EndHour, item.EndMinute, item.EndSecond),
|
|
|
|
|
Price = item.Price,
|
|
|
|
|
Type = item.Price
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Result<List<ElecPriceModelVersionDetailResp>>.Success(elecPriceModelVersionDetailResps);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -263,13 +204,14 @@ namespace WebStarter.Controllers.BasicConfig
|
|
|
|
|
/// <param name="model"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("AddStationElecPriceInfoList")]
|
|
|
|
|
public async Task<Result<bool>> AddStationElecPriceInfoList([FromBody] List<ElecPriceModelVersionDetailReq> model)
|
|
|
|
|
public async Task<Result<bool>> AddStationElecPriceInfoList(
|
|
|
|
|
[FromBody] List<ElecPriceModelVersionDetailReq> model)
|
|
|
|
|
{
|
|
|
|
|
if (null == model || model.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
Result<bool>.Fail("参数不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ElecPriceModelVersionDetail> elecPriceModelVersionDetails = new List<ElecPriceModelVersionDetail>();
|
|
|
|
|
foreach (var item in model)
|
|
|
|
|
{
|
|
|
|
@ -286,12 +228,13 @@ namespace WebStarter.Controllers.BasicConfig
|
|
|
|
|
Type = item.Type
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<ElecPriceModelVersionDetail> modelFromDbs = await _elecPriceModelVersionDetailServices.QueryListByClauseAsync(u => u.Version == model[0].Version);
|
|
|
|
|
|
|
|
|
|
List<ElecPriceModelVersionDetail> modelFromDbs =
|
|
|
|
|
await _elecPriceModelVersionDetailServices.QueryListByClauseAsync(u => u.Version == model[0].Version);
|
|
|
|
|
if (modelFromDbs != null)
|
|
|
|
|
{
|
|
|
|
|
modelFromDbs.AddRange(elecPriceModelVersionDetails);
|
|
|
|
|
if ( TimeListIfContains(modelFromDbs))
|
|
|
|
|
if (TimeListIfContains(modelFromDbs))
|
|
|
|
|
{
|
|
|
|
|
await _elecPriceModelVersionDetailServices.InsertAsync(elecPriceModelVersionDetails);
|
|
|
|
|
return Result<bool>.Success(true);
|
|
|
|
@ -300,26 +243,28 @@ namespace WebStarter.Controllers.BasicConfig
|
|
|
|
|
|
|
|
|
|
return Result<bool>.Fail("时间区间重复请检查");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新电价信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("UpdateStationElecPriceInfoList")]
|
|
|
|
|
public async Task<Result<bool>> UpdateStationElecPriceInfoList([FromBody] List<ElecPriceModelVersionDetailReq> model)
|
|
|
|
|
public async Task<Result<bool>> UpdateStationElecPriceInfoList(
|
|
|
|
|
[FromBody] List<ElecPriceModelVersionDetailReq> model)
|
|
|
|
|
{
|
|
|
|
|
if (null == model || model.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
Result<bool>.Fail("参数不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<ElecPriceModelVersionDetail> modelFromDbs = await _elecPriceModelVersionDetailServices.QueryListByClauseAsync(u => u.Version == model[0].Version);
|
|
|
|
|
|
|
|
|
|
List<ElecPriceModelVersionDetail> modelFromDbs =
|
|
|
|
|
await _elecPriceModelVersionDetailServices.QueryListByClauseAsync(u => u.Version == model[0].Version);
|
|
|
|
|
if (modelFromDbs != null)
|
|
|
|
|
{
|
|
|
|
|
await _elecPriceModelVersionDetailServices.DeleteAsync(i => i.Version == model[0].Version);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ElecPriceModelVersionDetail> elecPriceModelVersionDetails = new List<ElecPriceModelVersionDetail>();
|
|
|
|
|
foreach (var item in model)
|
|
|
|
|
{
|
|
|
|
@ -337,11 +282,12 @@ namespace WebStarter.Controllers.BasicConfig
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( TimeListIfContains(elecPriceModelVersionDetails))
|
|
|
|
|
if (TimeListIfContains(elecPriceModelVersionDetails))
|
|
|
|
|
{
|
|
|
|
|
await _elecPriceModelVersionDetailServices.InsertAsync(elecPriceModelVersionDetails);
|
|
|
|
|
return Result<bool>.Success(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Result<bool>.Fail("时间区间重复请检查");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|