增加上锁接口 启用禁用接口

master
lxw 6 months ago
parent e903270fa1
commit 8e78621716

@ -1,4 +1,5 @@
using SqlSugar; using Entity.Base;
using SqlSugar;
namespace Entity.DbModel.Station namespace Entity.DbModel.Station
{ {
@ -18,7 +19,7 @@ namespace Entity.DbModel.Station
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")] [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")]
public int Id { get; set; } public int? Id { get; set; }
/// <summary> /// <summary>
/// Desc:仓位编号 /// Desc:仓位编号
@ -26,7 +27,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "no")] [SugarColumn(ColumnName = "no")]
public string No { get; set; } public string? No { get; set; }
/// <summary> /// <summary>
/// Desc:仓位编码 /// Desc:仓位编码
@ -34,7 +35,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "code")] [SugarColumn(ColumnName = "code")]
public string Code { get; set; } public string? Code { get; set; }
/// <summary> /// <summary>
/// Desc:仓位名称 /// Desc:仓位名称
@ -42,7 +43,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "name")] [SugarColumn(ColumnName = "name")]
public string Name { get; set; } public string? Name { get; set; }
/// <summary> /// <summary>
/// Desc:在位状态0-不在位1-在位2-无效 /// Desc:在位状态0-不在位1-在位2-无效
@ -50,7 +51,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "exists")] [SugarColumn(ColumnName = "exists")]
public int Exists { get; set; } public int? Exists { get; set; }
/// <summary> /// <summary>
/// Desc:电池编号 /// Desc:电池编号
@ -58,7 +59,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "battery_no")] [SugarColumn(ColumnName = "battery_no")]
public string BatteryNo { get; set; } public string? BatteryNo { get; set; }
/// <summary> /// <summary>
/// Desc:充电机编号 /// Desc:充电机编号
@ -66,7 +67,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "charger_no")] [SugarColumn(ColumnName = "charger_no")]
public string ChargerNo { get; set; } public string? ChargerNo { get; set; }
/// <summary> /// <summary>
/// Desc:充电枪编号 /// Desc:充电枪编号
@ -74,7 +75,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "charger_gun_no")] [SugarColumn(ColumnName = "charger_gun_no")]
public string ChargerGunNo { get; set; } public string? ChargerGunNo { get; set; }
/// <summary> /// <summary>
/// Desc:水冷编号 /// Desc:水冷编号
@ -82,7 +83,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "water_cool_no")] [SugarColumn(ColumnName = "water_cool_no")]
public string WaterCoolNo { get; set; } public string? WaterCoolNo { get; set; }
/// <summary> /// <summary>
/// Desc:是否有电插头;0-无电插头1-有电插头 /// Desc:是否有电插头;0-无电插头1-有电插头
@ -98,7 +99,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "elec_plugin_status")] [SugarColumn(ColumnName = "elec_plugin_status")]
public string ElecPluginStatus { get; set; } public string? ElecPluginStatus { get; set; }
/// <summary> /// <summary>
/// Desc:是否有水插头;0-无水插头1-有水插头 /// Desc:是否有水插头;0-无水插头1-有水插头
@ -106,7 +107,7 @@ namespace Entity.DbModel.Station
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(ColumnName = "water_plugin_flag")] [SugarColumn(ColumnName = "water_plugin_flag")]
public string WaterPluginFlag { get; set; } public string? WaterPluginFlag { get; set; }
/// <summary> /// <summary>
/// Desc:预约锁定;0-未锁定1-锁定 /// Desc:预约锁定;0-未锁定1-锁定
@ -114,7 +115,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "amt_lock")] [SugarColumn(ColumnName = "amt_lock")]
public int AmtLock { get; set; } public int? AmtLock { get; set; }
/// <summary> /// <summary>
/// Desc:soc /// Desc:soc
@ -170,15 +171,17 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "created_by")] [SugarColumn(ColumnName = "created_by")]
public string CreatedBy { get; set; } public string? CreatedBy { get; set; }
/// <summary> /// <summary>
/// Desc:创建时间 /// Desc:创建时间
/// Default:CURRENT_TIMESTAMP /// Default:CURRENT_TIMESTAMP
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "created_time")] /// [SugarColumn(IsPrimaryKey = false, , ColumnDescription = "创建时间")]
public DateTime? CreatedTime { get; set; } [SugarColumn(ColumnName = "created_time", IsOnlyIgnoreUpdate = true)]
public DateTime? CreatedTime { get; set; }= DateTime.Now;
/// <summary> /// <summary>
/// Desc:更新人 /// Desc:更新人
@ -186,7 +189,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "updated_by")] [SugarColumn(ColumnName = "updated_by")]
public string UpdatedBy { get; set; } public string? UpdatedBy { get; set; }
/// <summary> /// <summary>
/// Desc:最后结束充电时间 结束充电后更新 /// Desc:最后结束充电时间 结束充电后更新
@ -202,25 +205,25 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "updated_time")] [SugarColumn(ColumnName = "updated_time")]
public DateTime? UpdatedTime { get; set; } public DateTime? UpdatedTime { get; set; }= DateTime.Now;
/// <summary> /// <summary>
/// 缓存仓标记 0:不是 1:是 /// 缓存仓标记 0:不是 1:是
/// </summary> /// </summary>
[SugarColumn(ColumnName = "cache_bin_flag")] [SugarColumn(ColumnName = "cache_bin_flag")]
public int CacheBinFlag { get; set; } public int? CacheBinFlag { get; set; }
/// <summary> /// <summary>
/// 是否可以换电 0:不可换 1可换 /// 是否可以换电 0:不可换 1可换
/// </summary> /// </summary>
[SugarColumn(ColumnName = "can_swap_flag")] [SugarColumn(ColumnName = "can_swap_flag")]
public int CanSwapFlag { get; set; } public int? CanSwapFlag { get; set; }
/// <summary> /// <summary>
/// 是否可以充电 0:不可换 1可换 /// 是否可以充电 0:不可换 1可换
/// </summary> /// </summary>
[SugarColumn(ColumnName = "can_charge_flag")] [SugarColumn(ColumnName = "can_charge_flag")]
public int CanChargeFlag { get; set; } public int? CanChargeFlag { get; set; }

@ -98,7 +98,7 @@ public class SwapOrderReportCloudTask : AbstractTaskHandler
updateDbBattery.Add(swapOrderBattery); updateDbBattery.Add(swapOrderBattery);
} }
//TODO::获取本日第几次换 //TODO::获取本日第几次换
var uploadSwapOrder = CloudApi.UploadSwapOrder(swapOrder, 0, swapOrderBattery, 1); var uploadSwapOrder = CloudApi.UploadSwapOrder(swapOrder, 0, swapOrderBattery, 1);
if (uploadSwapOrder == 0) if (uploadSwapOrder == 0)
{ {

@ -25,13 +25,18 @@ namespace WebStarter.Controllers.BasicConfig
private readonly SysConfigService _sysConfigService; private readonly SysConfigService _sysConfigService;
private readonly ElecPriceModelVersionDetailServices _elecPriceModelVersionDetailServices; private readonly ElecPriceModelVersionDetailServices _elecPriceModelVersionDetailServices;
private readonly ElecPriceModelVersionService _elecPriceModelVersionService; private readonly ElecPriceModelVersionService _elecPriceModelVersionService;
public BaseConfigController(SysConfigService sysConfigService, ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices)
public BaseConfigController(SysConfigService sysConfigService,
ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices,
ElecPriceModelVersionService priceModelVersionService)
{ {
_sysConfigService = sysConfigService; _sysConfigService = sysConfigService;
_elecPriceModelVersionDetailServices = elecPriceModelVersionDetailServices; _elecPriceModelVersionDetailServices = elecPriceModelVersionDetailServices;
_elecPriceModelVersionService = priceModelVersionService;
} }
#region RFID配置 #region RFID配置
// /// <summary> // /// <summary>
// /// 预览 // /// 预览
// /// 车型 的ASCLL、解析后信息 // /// 车型 的ASCLL、解析后信息
@ -122,6 +127,7 @@ namespace WebStarter.Controllers.BasicConfig
// return Result<List<string>>.Success(); // return Result<List<string>>.Success();
// } // }
#endregion RFID配置 #endregion RFID配置
/// <summary> /// <summary>
@ -136,23 +142,38 @@ namespace WebStarter.Controllers.BasicConfig
{ {
switch (item.Code) switch (item.Code)
{ {
case "LightDayStartTime": stationBaseInfoResp.LigthStartTime = item.Value; break; case "LightDayStartTime":
case "LightDayEndTime": stationBaseInfoResp.LigthEndTime = item.Value; break; stationBaseInfoResp.LigthStartTime = item.Value;
case "SwapSoc": stationBaseInfoResp.SetSwapSoc = Convert.ToInt32(item.Value); break; break;
case "FullSoc": stationBaseInfoResp.SetFullSoc = Convert.ToInt32(item.Value); break; case "LightDayEndTime":
case "ChargeType": stationBaseInfoResp.ChargeType = Convert.ToInt32(item.Value); break; stationBaseInfoResp.LigthEndTime = item.Value;
case "SwapType": stationBaseInfoResp.SwapType = Convert.ToInt32(item.Value); break; break;
case "BusinessStartHours": stationBaseInfoResp.BusinessStartHours = item.Value; break; case "SwapSoc":
case "BusinessEndHours": stationBaseInfoResp.BusinessEndHours = item.Value; break; 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;
} }
} }
stationBaseInfoResp.Version = await _elecPriceModelVersionService.GetNowVersion(); stationBaseInfoResp.Version = await _elecPriceModelVersionService.GetNowVersion();
return Result<BaseSetStationConfigInfo>.Success(stationBaseInfoResp); return Result<BaseSetStationConfigInfo>.Success(stationBaseInfoResp);
} }
/// <summary> /// <summary>
/// 提交换电策略设置 /// 提交换电策略设置
/// </summary> /// </summary>
@ -198,6 +219,7 @@ namespace WebStarter.Controllers.BasicConfig
bool setResult = SetConfigPorperty(input); bool setResult = SetConfigPorperty(input);
return Result<bool>.Success(setResult); return Result<bool>.Success(setResult);
} }
/// <summary> /// <summary>
/// 换电运营模式1:自动2:手动 /// 换电运营模式1:自动2:手动
/// </summary> /// </summary>
@ -234,7 +256,9 @@ namespace WebStarter.Controllers.BasicConfig
{ {
Result<bool>.Fail("参数不能为空"); Result<bool>.Fail("参数不能为空");
} }
var queryByClauseAsync = _elecPriceModelVersionDetailServices.QueryByClauseAsync(u => u.Version == model[0].Version);
var queryByClauseAsync =
_elecPriceModelVersionDetailServices.QueryByClauseAsync(u => u.Version == model[0].Version);
if (queryByClauseAsync != null) if (queryByClauseAsync != null)
await _elecPriceModelVersionDetailServices.DeleteAsync(i => i.Version == model[0].Version); await _elecPriceModelVersionDetailServices.DeleteAsync(i => i.Version == model[0].Version);
if (TimeListIfContains(model)) if (TimeListIfContains(model))
@ -242,6 +266,7 @@ namespace WebStarter.Controllers.BasicConfig
await _elecPriceModelVersionDetailServices.InsertAsync(model); await _elecPriceModelVersionDetailServices.InsertAsync(model);
return Result<bool>.Success(true); return Result<bool>.Success(true);
} }
return Result<bool>.Fail("时间区间重复请检查"); return Result<bool>.Fail("时间区间重复请检查");
} }
@ -258,7 +283,9 @@ namespace WebStarter.Controllers.BasicConfig
{ {
Result<bool>.Fail("参数不能为空"); Result<bool>.Fail("参数不能为空");
} }
var queryByClauseAsync = _elecPriceModelVersionDetailServices.QueryByClauseAsync(u => u.Version == model[0].Version);
var queryByClauseAsync =
_elecPriceModelVersionDetailServices.QueryByClauseAsync(u => u.Version == model[0].Version);
if (queryByClauseAsync != null) if (queryByClauseAsync != null)
await _elecPriceModelVersionDetailServices.DeleteAsync(i => i.Version == model[0].Version); await _elecPriceModelVersionDetailServices.DeleteAsync(i => i.Version == model[0].Version);
if (TimeListIfContains(model)) if (TimeListIfContains(model))
@ -266,13 +293,11 @@ namespace WebStarter.Controllers.BasicConfig
await _elecPriceModelVersionDetailServices.InsertAsync(model); await _elecPriceModelVersionDetailServices.InsertAsync(model);
return Result<bool>.Success(true); return Result<bool>.Success(true);
} }
return Result<bool>.Fail("时间区间重复请检查"); return Result<bool>.Fail("时间区间重复请检查");
} }
/// <summary> /// <summary>
/// List中判断一个时间段是否包含另一个时间段包括开始和结束时间的秒数 /// List中判断一个时间段是否包含另一个时间段包括开始和结束时间的秒数
/// </summary> /// </summary>
@ -294,6 +319,7 @@ namespace WebStarter.Controllers.BasicConfig
} }
} }
} }
return hasOverlap; return hasOverlap;
} }
@ -314,6 +340,7 @@ namespace WebStarter.Controllers.BasicConfig
if (getContent != null) if (getContent != null)
setResult = _sysConfigService.Set(newConstConfigInfo, getContent); setResult = _sysConfigService.Set(newConstConfigInfo, getContent);
} }
return setResult; return setResult;
} }
} }

@ -35,14 +35,20 @@ public class BinInfoController : ControllerBase
/// <param name="putBinNo"></param> /// <param name="putBinNo"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("UpdateCanChargeFlag/{id}/{flag}")] [HttpGet("UpdateCanChargeFlag/{id}/{flag}")]
public async Task<Result<bool>> UpdateCanChargeFlag(int id, int flag) public Result<bool> UpdateCanChargeFlag(int id, int flag)
{ {
BinInfo binInfo = new BinInfo() _BinInfoRepository.Update(it=>it.CanChargeFlag==flag,it=>it.Id==id);
return Result<bool>.Success();
}
[HttpGet("insert")]
public Result<bool> insert()
{ {
Id = id, _BinInfoRepository.Insert(new BinInfo()
CanChargeFlag = flag {
}; No = "10"
_BinInfoRepository.Update(binInfo); });
BinInfo queryByClause = _BinInfoRepository.QueryByClause(i=>i.Id==16);
return Result<bool>.Success(); return Result<bool>.Success();
} }
@ -58,12 +64,8 @@ public class BinInfoController : ControllerBase
[HttpGet("UpdateCanSwapFlag/{id}/{flag}")] [HttpGet("UpdateCanSwapFlag/{id}/{flag}")]
public async Task<Result<bool>> UpdateCanSwapFlag(int id, int flag) public async Task<Result<bool>> UpdateCanSwapFlag(int id, int flag)
{ {
BinInfo binInfo = new BinInfo()
{ _BinInfoRepository.Update(it=>it.CanSwapFlag==flag,it=>it.Id==id);
Id = id,
CanSwapFlag = flag
};
_BinInfoRepository.Update(binInfo);
return Result<bool>.Success(); return Result<bool>.Success();
} }

Loading…
Cancel
Save