BaseConfig接口修改

master
lxw 6 months ago
parent e8f118f86f
commit 2832c7b584

@ -5,5 +5,5 @@ public class SetSwitchingOperaModeReq
/// <summary>
/// 换电运营模式1:自动2:手动
/// </summary>
public int SwapType { get; set; }
public int SwapWay { get; set; }
}

@ -0,0 +1,39 @@
namespace Entity.Api.Req;
public class StationConfigReq
{
/// <summary>
/// 换电soc
/// </summary>
public int SwapSoc { get; set; }
/// <summary>
/// 充电运营模式:/// 0-关闭 1-开启
/// </summary>
public byte AutoChargeEnabled { get; set; }
/// <summary>
/// 换电运营模式1-自动 2-手动
/// </summary>
public int StationWay { get; set; }
/// <summary>
/// 电价模型板 版本号
/// </summary>
public int Ceid { get; set; }
/// <summary>
/// 运营版本号
/// </summary>
/// <returns></returns>
public string Oid { get; set; }
/// <summary>
/// 选包策略: 充电结束时间大于SwapFinishChargeTime分钟的可以被选包
/// </summary>
/// <returns></returns>
public int SwapFinishChargeTime { get; set; }
public int StationStatus { get; set; }
}

@ -1,41 +0,0 @@
namespace Entity.Api.Resp;
public class BaseSetStationConfigInfo
{
/// <summary>
/// 灯光日间时间:开始时间
/// </summary>
public string LigthStartTime { get; set; }
/// <summary>
/// 灯光日间时间:结束时间
/// </summary>
public string LigthEndTime { get; set; }
/// <summary>
/// 换电策略换电标准Soc
/// </summary>
public int SetSwapSoc { get; set; }
/// <summary>
/// 换电策略充电标准Soc
/// </summary>
public int SetFullSoc { get; set; }
/// <summary>
/// 营业时间:开始时间
/// </summary>
public string BusinessStartHours { get; set; }
/// <summary>
/// 营业时间:结束时间
/// </summary>
public string BusinessEndHours{ get; set; }
/// <summary>
/// 充电运营模式0-手动 1-自动
/// </summary>
public int ChargeType{ get; set; }
/// <summary>
/// 换电运营模式1-自动 2-手动
/// </summary>
public int SwapType{ get; set; }
/// <summary>
/// 电价模型板 版本号 0-数据库不存在 尖峰平谷版本
/// </summary>
public int Version{ get; set; }
}

@ -62,7 +62,7 @@ namespace Entity.Api.Resp
/// <summary>
/// 换电站状态: 1营运中 2歇业中 3设备维护状态 4暂停营业
/// </summary>
public sbyte Status { get; set; }
public int StationStatus { get; set; }
/// <summary>
/// 投放时间
/// </summary>

@ -0,0 +1,40 @@
namespace Entity.Api.Resp;
public class StationConfigResp
{
/// <summary>
/// 换电soc
/// </summary>
public int SwapSoc { get; set; }
/// <summary>
/// 充电运营模式:/// 0-关闭 1-开启
/// </summary>
public byte AutoChargeEnabled { get; set; }
/// <summary>
/// 换电运营模式1-自动 2-手动
/// </summary>
public int StationWay { get; set; }
/// <summary>
/// 电价模型板 版本号
/// </summary>
public int Ceid { get; set; }
/// <summary>
/// 运营版本号
/// </summary>
/// <returns></returns>
public string Oid { get; set; }
/// <summary>
/// 选包策略: 充电结束时间大于SwapFinishChargeTime分钟的可以被选包
/// </summary>
/// <returns></returns>
public int SwapFinishChargeTime { get; set; }
public int StationStatus { get; set; }
}

@ -64,10 +64,7 @@ public class StationParamConst
/// </summary>
public static readonly string Sevstatus = "Station.Sevstatus";
/// <summary>
/// 换电站状态: 1营运中 2歇业中 3设备维护状态 4暂停营业
/// </summary>
public static readonly string Status = "Station.Status";
/// <summary>
/// 投放时间
@ -185,18 +182,8 @@ public class StationParamConst
//提交灯光日间时间
public static readonly string SetLightDayStartTime = "Station.LightDayStartTime";
public static readonly string SetLightDayEndTime = "Station.LightDayEndTime";
//换电策略设置换电标准SOC
public static readonly string SetSwapSoc = "Station.SwapSoc";
//换电策略设置充电标准SOC
public static readonly string SetFullSoc = "Station.FullSoc";
//充电运营模式: 0手动充电1自动充电
public static readonly string ChargeType = "Station.ChargeType";
//换电运营模式1:自动2:手动
public static readonly string SwapType = "Station.SwapType";
//营业时间:开始时间
public static readonly string BusinessStartHours = "Station.BusinessStartHours";
//营业时间:结束时间
public static readonly string BusinessEndHours = "Station.BusinessEndHours";
#endregion 系统管理-基础设置
@ -212,7 +199,9 @@ public class StationParamConst
public static readonly string ChargePower = "Station.ChargePower";
public static readonly string AutoChargeEnabled = "Station.AutoChargeEnabled";
public static readonly string Eid = "Station.Eid";
//运营模型
public static readonly string Oid = "Station.Oid";
//电价模型
public static readonly string Ceid = "Station.Ceid";
public static readonly string StationStatus = "Station.StationStatus";

@ -19,7 +19,7 @@ public class BinInfoRepository : BaseRepository<BinInfo>
/// <param name="swapSoc"> StaticStationInfo.SwapSoc </param>
/// <param name="swapFinishChargeTime">StaticStationInfo.SwapFinishChargeTime</param>
/// <returns></returns>
public SelectPackDto SelectPack(string swapSoc, string swapFinishChargeTime)
public SelectPackDto SelectPack(int swapSoc, int swapFinishChargeTime)
{
SelectPackDto selectPackDto = new()
{
@ -44,7 +44,7 @@ public class BinInfoRepository : BaseRepository<BinInfo>
}
list = list.Where(i => i.Soc != null && i.Soc > int.Parse(swapSoc)).ToList();
list = list.Where(i => i.Soc != null && i.Soc > swapSoc).ToList();
if (list.Count <= 0 && cacheBinBattery == null)
{
selectPackDto.Info = InfoEnum.SelectBinStatusInfo.LessOfSoc;
@ -53,7 +53,7 @@ public class BinInfoRepository : BaseRepository<BinInfo>
list = list.Where(i => i.LastChargeFinishTime != null && new TimeSpan(DateTime.Now.Ticks -
i.LastChargeFinishTime.ToDateTime().Ticks)
.TotalMinutes > int.Parse(swapFinishChargeTime)).ToList();
.TotalMinutes > swapFinishChargeTime).ToList();
if (list.Count <= 0 && cacheBinBattery == null)
{
selectPackDto.Info = InfoEnum.SelectBinStatusInfo.LessOf3Minute;

@ -22,7 +22,7 @@ public class ParameterAcquisitionHandler : IBaseHandler
if (req != null)
{
ParameterAcquisitionResp resp = new ParameterAcquisitionResp();
resp.chsoc = Char.Parse(StaticStationInfo.SwapSoc);
resp.chsoc = Convert.ToChar(StaticStationInfo.SwapSoc);
resp.eid = StaticStationInfo.Eid;
resp.oid = StaticStationInfo.Oid;
resp.ceid = StaticStationInfo.Ceid;

@ -22,7 +22,7 @@ public class SetConfigurationParametersHandler : IBaseHandler
if (setConfigurationParameters != null)
{
char chsoc = setConfigurationParameters.chsoc;
StaticStationInfo.SwapSoc = chsoc.ToString();
StaticStationInfo.SwapSoc = chsoc.ToInt();
StaticStationInfo.Eid = setConfigurationParameters.eid;
StaticStationInfo.Oid = setConfigurationParameters.oid;
StaticStationInfo.Ceid = setConfigurationParameters.ceid;

@ -132,8 +132,8 @@ public class CommonMgr
&& UpBin.AmtLock == (int)InfoEnum.AmtBatLockStatus.Lock && new TimeSpan(DateTime.Now.Ticks -
UpBin.LastChargeFinishTime.ToDateTime()
.Ticks)
.TotalMinutes > int.Parse(StaticStationInfo.SwapFinishChargeTime) &&
UpBin.Soc > int.Parse(StaticStationInfo.SwapSoc);
.TotalMinutes > StaticStationInfo.SwapFinishChargeTime &&
UpBin.Soc > StaticStationInfo.SwapSoc;
if (!CanSwap)
{
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.AmtError;

@ -11,62 +11,65 @@ namespace Service.Init;
/// </summary>
public class StaticStationInfo
{
public static int StationStatus
{
get => int.Parse(Resolve(StationParamConst.StationStatus));
set => Set(StationParamConst.StationStatus, value);
}
public static string OperationStartTime
{
get => Resolve(StationParamConst.OperationStartTime);
set => Set(StationParamConst.OperationStartTime, value);
}
public static string OperationEndTime
{
get => Resolve(StationParamConst.OperationEndTime);
set => Set(StationParamConst.OperationEndTime, value);
}
public static int StationWay
{
get => int.Parse(Resolve(StationParamConst.StationWay));
set => Set(StationParamConst.StationWay, value);
}
public static int StationModel
{
get =>int.Parse( Resolve(StationParamConst.StationModel));
get => int.Parse(Resolve(StationParamConst.StationModel));
set => Set(StationParamConst.StationModel, value);
}
public static string StationName
{
get => Resolve(StationParamConst.StationName);
set => Set(StationParamConst.StationName, value);
}
public static string StationNo
{
get => Resolve(StationParamConst.StationNo);
set => Set(StationParamConst.StationNo, value);
}
public static string StationSn
{
get => Resolve(StationParamConst.StationSn);
set => Set(StationParamConst.StationSn, value);
}
public static string SwapFinishChargeTime
public static int SwapFinishChargeTime
{
get => Resolve(StationParamConst.SwapFinishChargeTime);
get => int.Parse(Resolve(StationParamConst.SwapFinishChargeTime));
set => Set(StationParamConst.SwapFinishChargeTime, value);
}
public static string SwapSoc
public static int SwapSoc
{
get => Resolve(StationParamConst.SwapSoc);
get => int.Parse(Resolve(StationParamConst.SwapSoc));
set => Set(StationParamConst.SwapSoc, value);
}
@ -78,24 +81,30 @@ public class StaticStationInfo
set => Set(StationParamConst.Eid, value);
}
/// <summary>
/// 运营版本号
/// </summary>
public static string Oid
{
get => Resolve(StationParamConst.Oid);
set => Set(StationParamConst.Oid, value);
}
public static int Ceid
{
get => int.Parse(Resolve(StationParamConst.Ceid));
set => Set(StationParamConst.Ceid, value);
}
public static byte ChargeSoc
public static byte ChargeSoc
{
get => byte.Parse(Resolve(StationParamConst.ChargeSoc));
set => Set(StationParamConst.ChargeSoc, value);
}
public static float ChargePower
{
get => float.Parse(Resolve(StationParamConst.ChargePower));
@ -110,10 +119,8 @@ public class StaticStationInfo
get => byte.Parse(Resolve(StationParamConst.AutoChargeEnabled));
set => Set(StationParamConst.AutoChargeEnabled, value);
}
#endregion
#region cloud
@ -133,6 +140,7 @@ public class StaticStationInfo
{
return 33000;
}
return int.Parse(port);
}
set => Set(StationParamConst.CloudServerPort, value);

@ -69,11 +69,11 @@ public class MonitorService
BatteryTotalCount = binInfos.Count,
UsingSwapBatteryCount = binInfos.Select(i => i.ChargeStatus == 2 &&
i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock &&
i.Soc > int.Parse(StaticStationInfo.SwapSoc) &&
i.Soc > StaticStationInfo.SwapSoc &&
new TimeSpan(DateTime.Now.Ticks -
i.LastChargeFinishTime.ToDateTime().Ticks)
.TotalMinutes >
int.Parse(StaticStationInfo.SwapFinishChargeTime)).Count()
StaticStationInfo.SwapFinishChargeTime).Count()
}
};

@ -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("时间区间重复请检查");
}

@ -214,4 +214,16 @@ public class SwapMonitorController : ControllerBase
StaticStationInfo.StationWay = (int)StationConstant.StationWay.Auto;
return Result<bool>.Success();
}
/// <summary>
/// 切换成 营业状态
/// 换电站状态: 1营运中 2歇业中 3设备维护状态 4暂停营业
/// </summary>
[HttpPost("HandoverStationStatus/{status}")]
public Result<bool> HandoverStationStatus(int status)
{
StaticStationInfo.StationStatus = status;
return Result<bool>.Success();
}
}

@ -16,6 +16,7 @@ using Service.System;
using SqlSugar;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using Service.Init;
namespace WebStarter.Controllers.System
{
@ -113,7 +114,7 @@ namespace WebStarter.Controllers.System
case "Operatetionstime": stationBaseInfoResp.Operatetionstime = item.Value; break;
case "Sevstatus": stationBaseInfoResp.Sevstatus = Convert.ToSByte(item.Value); break;
case "Operatetionetime": stationBaseInfoResp.Operatetionetime = item.Value; break;
case "Status": stationBaseInfoResp.Status = Convert.ToSByte(item.Value); break;
case "StationStatus": stationBaseInfoResp.StationStatus = StaticStationInfo.StationStatus; break;
case "LaunchTime": stationBaseInfoResp.LaunchTime = item.Value; break;
case "ContactWay": stationBaseInfoResp.ContactWay = item.Value; break;
case "Principal": stationBaseInfoResp.Principal = item.Value; break;

Loading…
Cancel
Save