|
|
@ -3,10 +3,15 @@ using Microsoft.AspNetCore.Mvc;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
using System.Reflection;
|
|
|
|
using Entity.Api.Resp;
|
|
|
|
using Entity.Api.Resp;
|
|
|
|
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
|
|
|
|
using Entity.DbModel.System.SysBaseObject;
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
using Microsoft.VisualBasic;
|
|
|
|
using Microsoft.VisualBasic;
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
|
|
using Service.Station;
|
|
|
|
|
|
|
|
using Service.System;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WebStarter.Controllers.BasicConfig
|
|
|
|
namespace WebStarter.Controllers.BasicConfig
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -17,6 +22,14 @@ namespace WebStarter.Controllers.BasicConfig
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
public class BaseConfigController
|
|
|
|
public class BaseConfigController
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
private readonly SysConfigService _sysConfigService;
|
|
|
|
|
|
|
|
private readonly ElecPriceModelVersionDetailServices _elecPriceModelVersionDetailServices;
|
|
|
|
|
|
|
|
public BaseConfigController(SysConfigService sysConfigService, ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_sysConfigService = sysConfigService;
|
|
|
|
|
|
|
|
_elecPriceModelVersionDetailServices = elecPriceModelVersionDetailServices;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region RFID配置
|
|
|
|
#region RFID配置
|
|
|
|
// /// <summary>
|
|
|
|
// /// <summary>
|
|
|
|
// /// 预览
|
|
|
|
// /// 预览
|
|
|
@ -110,14 +123,192 @@ namespace WebStarter.Controllers.BasicConfig
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
#endregion RFID配置
|
|
|
|
#endregion RFID配置
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 获取换电策略设置 、灯光日间时间、充电运营模式、营业时间段、换电运营模式
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
[HttpPost("BaseSetStationConfigInfo")]
|
|
|
|
|
|
|
|
public async Task<Result<BaseSetStationConfigInfo>> BaseSetStationConfigInfo()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return Result<BaseSetStationConfigInfo>.Success(stationBaseInfoResp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 日间时间设置
|
|
|
|
/// 日间时间设置
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
[HttpPost("SetDaytime")]
|
|
|
|
[HttpPost("SetDaytime")]
|
|
|
|
public async Task<Result<bool>> SetDaytime([FromBody] SetDayTimeReq input)
|
|
|
|
public async Task<Result<bool>> SetDaytime([FromBody] SetDayTimeReq input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool setResult = SetConfigPorperty(input);
|
|
|
|
|
|
|
|
return Result<bool>.Success(setResult);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 换电运营模式:1:自动;2:手动
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost("SetSwitchingOperaModeReq")]
|
|
|
|
|
|
|
|
public async Task<Result<bool>> SetSwitchingOperationMode([FromBody] SetSwitchingOperaModeReq input)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bool setResult = SetConfigPorperty(input);
|
|
|
|
|
|
|
|
return Result<bool>.Success(setResult);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 查询电价信息
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="version">版本号</param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpGet("GetStationElecPriceInfoList/{version}")]
|
|
|
|
|
|
|
|
public async Task<Result<List<ElecPriceModelVersionDetail>>> GetStationElecPriceInfoList(int version)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var data = await _elecPriceModelVersionDetailServices.QueryListByClauseAsync(u => u.Version == version);
|
|
|
|
|
|
|
|
return Result<List<ElecPriceModelVersionDetail>>.Success(data);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 增加电价信息
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="model"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost("AddStationElecPriceInfoList")]
|
|
|
|
|
|
|
|
public async Task<Result<bool>> AddStationElecPriceInfoList([FromBody] List<ElecPriceModelVersionDetail> model)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (null==model||model.Count==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Result<bool>.Fail("参数不能为空");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var queryByClauseAsync = _elecPriceModelVersionDetailServices.QueryByClauseAsync(u => u.Version == model[0].Version);
|
|
|
|
|
|
|
|
if(queryByClauseAsync!=null)
|
|
|
|
|
|
|
|
await _elecPriceModelVersionDetailServices.DeleteAsync(i => i.Version ==model[0].Version);
|
|
|
|
|
|
|
|
if (TimeListIfContains(model))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await _elecPriceModelVersionDetailServices.InsertAsync(model);
|
|
|
|
|
|
|
|
return Result<bool>.Success(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return Result<bool>.Fail("时间区间重复请检查");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return Result<bool>.Success();
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 修改电价信息
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="model"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost("UpdateStationElecPriceInfo")]
|
|
|
|
|
|
|
|
public async Task<Result<bool>> UpdateStationElecPriceInfo([FromBody] List<ElecPriceModelVersionDetail> model)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (null==model||model.Count==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Result<bool>.Fail("参数不能为空");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var queryByClauseAsync = _elecPriceModelVersionDetailServices.QueryByClauseAsync(u => u.Version == model[0].Version);
|
|
|
|
|
|
|
|
if(queryByClauseAsync!=null)
|
|
|
|
|
|
|
|
await _elecPriceModelVersionDetailServices.DeleteAsync(i => i.Version ==model[0].Version);
|
|
|
|
|
|
|
|
if (TimeListIfContains(model))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await _elecPriceModelVersionDetailServices.InsertAsync(model);
|
|
|
|
|
|
|
|
return Result<bool>.Success(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return Result<bool>.Fail("时间区间重复请检查");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// List中判断一个时间段是否包含另一个时间段(包括开始和结束时间的秒数)
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="timePeriods"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public bool TimeListIfContains(List<ElecPriceModelVersionDetail> timePeriods)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bool hasOverlap = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < timePeriods.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (int j = i + 1; j < timePeriods.Count; j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (timePeriods[i].Contains(timePeriods[j]) || timePeriods[j].Contains(timePeriods[i]))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hasOverlap = true;
|
|
|
|
|
|
|
|
return hasOverlap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return hasOverlap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 设置类属性
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="t"></param>
|
|
|
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public bool SetConfigPorperty<T>(T t)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bool setResult = false;
|
|
|
|
|
|
|
|
PropertyInfo[] props = typeof(T).GetProperties();
|
|
|
|
|
|
|
|
foreach (PropertyInfo fieldInfo in props)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
string newConstConfigInfo = "Station" + "." + fieldInfo.Name;
|
|
|
|
|
|
|
|
object getContent = fieldInfo.GetValue(t);
|
|
|
|
|
|
|
|
if (getContent != null)
|
|
|
|
|
|
|
|
setResult = _sysConfigService.Set(newConstConfigInfo, getContent);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return setResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|