站点基本信息Controller

master
lch 6 months ago
parent 664578f7af
commit c6c56bdc5f

@ -15,11 +15,11 @@ namespace Entity.Api.Req
/// <summary>
/// 仓位编号
/// </summary>
public string? BinNum { get; set; }
public string No { get; set; } = "";
/// <summary>
/// 仓位名称
/// </summary>
public string? BinName { get; set; }
public string Name { get; set; } = "";
}
}

@ -12,12 +12,143 @@ namespace Entity.Api.Req
public class StationBaseInfoReq
{
/// <summary>
/// 站控基础信息名称
/// 换电站编码
/// </summary>
public string BaseStationInfoName { get; set; }
public string StationNo { get; set; }
/// <summary>
/// 站控基础信息内容
/// 换电站名称
/// </summary>
public string BaseStationInfoContent { get; set; }
public string StationName { get; set; }
/// <summary>
/// 站类型
/// </summary>
public string StationType { get; set; }
/// <summary>
/// 换电站识别号
/// </summary>
public string StationSn { get; set; }
/// <summary>
/// 地理位置
/// </summary>
public string? StationLocation { get; set; }
/// <summary>
/// 经度
/// </summary>
public string? Longitude { get; set; }
/// <summary>
/// 纬度
/// </summary>
public string? Latitude { get; set; }
/// <summary>
/// 区域编号
/// </summary>
public string? AreaCode { get; set; }
/// <summary>
/// 区域名称
/// </summary>
public string? AreaName { get; set; }
/// <summary>
/// 营运开始时间
/// </summary>
public DateTime Operatetionstime { get; set; }
/// <summary>
/// 营运结束时间
/// </summary>
public DateTime Operatetionetime { get; set; }
/// <summary>
/// 服务状态
/// </summary>
public sbyte Sevstatus { get; set; }
/// <summary>
/// 换电站状态: 1营运中 2歇业中 3设备维护状态 4暂停营业
/// </summary>
public sbyte Status { get; set; }
/// <summary>
/// 投放时间
/// </summary>
public DateTime? LaunchTime { get; set; }
/// <summary>
/// 联系方式
/// </summary>
public string ContactWay { get; set; }
/// <summary>
/// 负责人
/// </summary>
public string Principal { get; set; }
/// <summary>
/// 所属运营企业
/// </summary>
public string? StationCompany { get; set; }
/// <summary>
/// 所属运营企业统一社会信用代码
/// </summary>
public string? SocialCreditCode { get; set; }
/// <summary>
/// 站控主机软件版本号
/// </summary>
public string StationSftVer { get; set; }
/// <summary>
/// 供应商代码
/// </summary>
public string SupplierCode { get; set; }
/// <summary>
/// 换电站基础信息版本号
/// </summary>
public string StationVersion { get; set; }
/// <summary>
/// 换电站硬件版本
/// </summary>
public sbyte? HardwareVersion { get; set; }
/// <summary>
/// 总体故障等级
/// </summary>
public int? Faultlevel { get; set; }
/// <summary>
/// 加解锁方式
/// </summary>
public sbyte? LockType { get; set; }
/// <summary>
/// 进入方式
/// </summary>
public sbyte? AccessType { get; set; }
/// <summary>
/// 举升方式
/// </summary>
public sbyte? RiseType { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime? ModifyTime { get; set; }
/// <summary>
/// 配电容量kVA
/// </summary>
public int? DistributionCapacity { get; set; }
/// <summary>
/// 总功率kW
/// </summary>
public int? TotalPower { get; set; }
/// <summary>
/// 省份
/// </summary>
public string StationProvince { get; set; }
/// <summary>
/// 城市
/// </summary>
public string StationCity { get; set; }
/// <summary>
/// 组织机构ID
/// </summary>
public int? OrganizationId { get; set; }
/// <summary>
/// 站控电脑MAC地址
/// </summary>
public string StationMac { get; set; }
}
}

@ -14,39 +14,39 @@ namespace Entity.Api.Resp
/// <summary>
/// 换电站编码
/// </summary>
public string StationNo { get; set; } = null!;
public string StationNo { get; set; }
/// <summary>
/// 换电站名称
/// </summary>
public string StationName { get; set; } = null!;
public string StationName { get; set; }
/// <summary>
/// 站类型
/// </summary>
public string StationType { get; set; } = null!;
public string StationType { get; set; }
/// <summary>
/// 换电站识别号
/// </summary>
public string StationSn { get; set; } = null!;
public string StationSn { get; set; }
/// <summary>
/// 地理位置
/// </summary>
public string StationLocation { get; set; } = null!;
public string? StationLocation { get; set; }
/// <summary>
/// 经度
/// </summary>
public string Longitude { get; set; } = null!;
public string? Longitude { get; set; }
/// <summary>
/// 纬度
/// </summary>
public string Latitude { get; set; } = null!;
public string? Latitude { get; set; }
/// <summary>
/// 区域编号
/// </summary>
public string AreaCode { get; set; } = null!;
public string? AreaCode { get; set; }
/// <summary>
/// 区域名称
/// </summary>
public string AreaName { get; set; } = null!;
public string? AreaName { get; set; }
/// <summary>
/// 营运开始时间
/// </summary>
@ -60,7 +60,7 @@ namespace Entity.Api.Resp
/// </summary>
public sbyte Sevstatus { get; set; }
/// <summary>
/// 运营状态1营业状态 2暂停营业 3设备维护 4歇业状态
/// 换电站状态: 1营运中 2歇业中 3设备维护状态 4暂停营业
/// </summary>
public sbyte Status { get; set; }
/// <summary>
@ -78,11 +78,11 @@ namespace Entity.Api.Resp
/// <summary>
/// 所属运营企业
/// </summary>
public string StationCompany { get; set; }
public string? StationCompany { get; set; }
/// <summary>
/// 所属运营企业统一社会信用代码
/// </summary>
public string SocialCreditCode { get; set; } = null!;
public string? SocialCreditCode { get; set; }
/// <summary>
/// 站控主机软件版本号
/// </summary>
@ -90,7 +90,7 @@ namespace Entity.Api.Resp
/// <summary>
/// 供应商代码
/// </summary>
public string SupplierCode { get; set; } = null!;
public string SupplierCode { get; set; }
/// <summary>
/// 换电站基础信息版本号
/// </summary>
@ -100,5 +100,57 @@ namespace Entity.Api.Resp
/// </summary>
public sbyte? HardwareVersion { get; set; }
/// <summary>
/// 封面图片文件id
/// </summary>
public string Cover { get; set; }
/// <summary>
/// 总体故障等级
/// </summary>
public int? Faultlevel { get; set; }
/// <summary>
/// 加解锁方式
/// </summary>
public sbyte? LockType { get; set; }
/// <summary>
/// 进入方式
/// </summary>
public sbyte? AccessType { get; set; }
/// <summary>
/// 举升方式
/// </summary>
public sbyte? RiseType { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public string? ModifyTime { get; set; }
/// <summary>
/// 配电容量kVA
/// </summary>
public int? DistributionCapacity { get; set; }
/// <summary>
/// 总功率kW
/// </summary>
public int? TotalPower { get; set; }
/// <summary>
/// 省份
/// </summary>
public string StationProvince { get; set; }
/// <summary>
/// 城市
/// </summary>
public string StationCity { get; set; }
/// <summary>
/// 组织机构ID
/// </summary>
public int? OrganizationId { get; set; }
/// <summary>
/// 站控电脑MAC地址
/// </summary>
public string StationMac { get; set; }
}
}

@ -632,16 +632,12 @@ public abstract class BaseRepository<T> where T : class, new()
}
public async Task<List<TResult>> QueryByClauseAsync<TResult>(
Expression<Func<T, bool>> expression,
bool isWhere, Expression<Func<T, bool>> expression2,
Expression<Func<T, TResult>> expression3)
public async Task<List<T>> QueryListByClauseAsync(
Expression<Func<T, bool>> expression)
{
return await DbBaseClient
.Queryable<T>()
.Where(expression)
.WhereIF(isWhere, expression2)
.Select(expression3)
.ToListAsync();
}

@ -37,8 +37,8 @@ namespace Service.Station
{
RefAsync<int> total = 0;
var items = await _binInfoRepository.QueryPageAsync(
!string.IsNullOrEmpty(input.BinNum), u => u.No == input.BinNum,
!string.IsNullOrEmpty(input.BinName), u => u.Name == input.BinName,
!string.IsNullOrEmpty(input.No), u => u.No == input.No,
!string.IsNullOrEmpty(input.Name), u => u.Name == input.Name,
input.Page, input.PageSize, total
);
return SqlSugarPagedExtensions.CreateSqlSugarPagedList(items, total, input.Page, input.PageSize);

@ -29,9 +29,8 @@ namespace Service.Station
/// 展示换电站日运行统计结果
/// </summary>
/// <returns></returns>
public async Task<PageResult<ExchangeStationDayRunResult>> ExStationDaySwapRunRes()
public async Task<PageResult<ExchangeStationDayRunResult>> ExStationDaySwapRunRes(QueryPageModel queryPageModel)
{
QueryPageModel queryPageModel = new QueryPageModel();
return PageResult<ExchangeStationDayRunResult>.ConvertPage(_exStationDayRunResultRepository.QueryIPageByCause(queryPageModel, null));
}

@ -52,7 +52,7 @@ public class StationParamConst
/// </summary>
public static readonly string Sevstatus = "Station.Sevstatus";
/// <summary>
/// 运营状态1营业状态 2暂停营业 3设备维护 4歇业状态
/// 换电站状态: 1营运中 2歇业中 3设备维护状态 4暂停营业
/// </summary>
public static readonly string Status = "Station.Status";
/// <summary>

@ -67,6 +67,15 @@ namespace Service.System
{
return await _sysConfigRep.QueryByGroupByAsync<string>(u => u.GroupCode, u => u.GroupCode);
}
/// <summary>
/// 获得同一分组下 SysConfig
/// </summary>
/// <param name="GroupCode"></param>
/// <returns></returns>
public async Task<List<SysConfig>> GetGroupList(string GroupCode)
{
return await _sysConfigRep.QueryListByClauseAsync(u => u.GroupCode == GroupCode);
}
/// <summary>
@ -235,8 +244,11 @@ namespace Service.System
public async Task<SysFile> UploadAvatar([Required] IFormFile file, string path)
{
var sysFile = await _sysFileMgr.HandleUploadFile(file, path, _imageType);
Set(StationParamConst.Cover,sysFile.Url);
bool setResult = Set(StationParamConst.Cover, sysFile.Url);
if (setResult)
return sysFile;
else
return null;
}
}

@ -25,10 +25,10 @@ namespace WebStarter.Controllers
/// 展示换电站日运行统计结果
/// </summary>
/// <returns></returns>
[HttpGet("GetExStationDaySwapRunRes")]
public async Task<PageResult<ExchangeStationDayRunResult>> GetExStationDaySwapRunRes()
[HttpPost("GetExStationDaySwapRunRes")]
public async Task<PageResult<ExchangeStationDayRunResult>> GetExStationDaySwapRunRes([FromBody] QueryPageModel queryPageModel)
{
return await _exStationDayRunResultService.ExStationDaySwapRunRes();
return await _exStationDayRunResultService.ExStationDaySwapRunRes(queryPageModel);
}
/// <summary>

@ -5,15 +5,23 @@ using Entity.DbModel.System.SysBaseObject;
using Entity.Dto.Req;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using NetTaste;
using NewLife.Reflection;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Org.BouncyCastle.Ocsp;
using Qiniu.Storage;
using Service.Mgr;
using Service.Station;
using Service.System;
using SqlSugar;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
namespace WebStarter.Controllers.System
{
[Produces("application/json")]
[ApiController]
[Route("api/[controller]")]
public class SysConfigController
{
private readonly SysConfigService _sysConfigService;
@ -26,56 +34,56 @@ namespace WebStarter.Controllers.System
}
[HttpPost]
[Route("/api/sysConfig/page")]
[Route("page")]
public async Task<SqlSugarPagedList<SysConfig>> Page(PageConfigReq input)
{
return await _sysConfigService.Page(input);
}
[HttpGet]
[Route("/api/sysConfig/list")]
[Route("list")]
public async Task<List<SysConfig>> GetList()
{
return await _sysConfigService.GetList();
}
[HttpGet]
[Route("/api/sysConfig/detail")]
[Route("detail")]
public async Task<SysConfig> GetDetail([FromQuery] ConfigReq input)
{
return await _sysConfigService.GetDetail(input);
}
[HttpGet]
[Route("/api/sysConfig/groupList")]
[Route("groupList")]
public async Task<List<string>> GetGroupList()
{
return await _sysConfigService.GetGroupList();
}
[HttpPost]
[Route("/api/sysConfig/add")]
[Route("add")]
public async Task Add(AddConfigReq input)
{
await _sysConfigService.AddConfig(input);
}
[HttpPost]
[Route("/api/sysConfig/update")]
[Route("update")]
public async Task Update(UpdateConfigReq input)
{
await _sysConfigService.UpdateConfig(input);
}
[HttpPost]
[Route("/api/sysConfig/delete")]
[Route("delete")]
public async Task Delete(DeleteConfigReq input)
{
await _sysConfigService.DeleteConfig(input);
}
[HttpPost]
[Route("/api/sysConfig/batchDelete")]
[Route("batchDelete")]
public async Task BatchDelete(List<long> input)
{
await _sysConfigService.BatchDeleteConfig(input);
@ -87,31 +95,49 @@ namespace WebStarter.Controllers.System
[HttpGet("StationBaseInfo")]
public async Task<Result<StationBaseInfoResp>> StationBaseInfo()
{
StationBaseInfoResp stationBaseInfoResp = new StationBaseInfoResp
{
StationNo = _sysConfigService.Get(StationParamConst.StationNo),
StationName = _sysConfigService.Get(StationParamConst.StationName),
StationType = _sysConfigService.Get(StationParamConst.StationType),
StationSn = _sysConfigService.Get(StationParamConst.StationSn),
StationLocation = _sysConfigService.Get(StationParamConst.StationLocation),
Longitude = _sysConfigService.Get(StationParamConst.Longitude),
Latitude = _sysConfigService.Get(StationParamConst.Latitude),
AreaCode = _sysConfigService.Get(StationParamConst.AreaCode),
AreaName = _sysConfigService.Get(StationParamConst.AreaName),
Operatetionstime = _sysConfigService.Get(StationParamConst.StationNo),
Operatetionetime = _sysConfigService.Get(StationParamConst.StationNo),
Sevstatus = Convert.ToSByte(_sysConfigService.Get(StationParamConst.StationNo)),
Status = Convert.ToSByte(_sysConfigService.Get(StationParamConst.StationNo)),
LaunchTime = _sysConfigService.Get(StationParamConst.StationNo),
ContactWay = _sysConfigService.Get(StationParamConst.StationNo),
Principal = _sysConfigService.Get(StationParamConst.StationNo),
StationCompany = _sysConfigService.Get(StationParamConst.StationNo),
SocialCreditCode = _sysConfigService.Get(StationParamConst.StationNo),
StationSftVer = _sysConfigService.Get(StationParamConst.StationNo),
SupplierCode = _sysConfigService.Get(StationParamConst.StationNo),
StationVersion = _sysConfigService.Get(StationParamConst.StationNo),
HardwareVersion = Convert.ToSByte(_sysConfigService.Get(StationParamConst.StationNo)),
};
StationBaseInfoResp stationBaseInfoResp = new StationBaseInfoResp();
List<SysConfig> sysConfigs = await _sysConfigService.GetGroupList("Station");
foreach (var item in sysConfigs)
{
switch (item.Code)
{
case "StationNo": stationBaseInfoResp.StationNo = item.Value; break;
case "StationName": stationBaseInfoResp.StationName = item.Value; break;
case "StationType": stationBaseInfoResp.StationType = item.Value; break;
case "StationSn": stationBaseInfoResp.StationSn = item.Value; break;
case "StationLocation": stationBaseInfoResp.StationLocation = item.Value; break;
case "Longitude": stationBaseInfoResp.Longitude = item.Value; break;
case "Latitude": stationBaseInfoResp.Latitude = item.Value; break;
case "AreaCode": stationBaseInfoResp.AreaCode = item.Value; break;
case "AreaName": stationBaseInfoResp.AreaName = item.Value; break;
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 "LaunchTime": stationBaseInfoResp.LaunchTime = item.Value; break;
case "ContactWay": stationBaseInfoResp.ContactWay = item.Value; break;
case "Principal": stationBaseInfoResp.Principal = item.Value; break;
case "StationCompany": stationBaseInfoResp.StationCompany = item.Value; break;
case "SocialCreditCode": stationBaseInfoResp.SocialCreditCode = item.Value; break;
case "StationSftVer": stationBaseInfoResp.StationSftVer = item.Value; break;
case "SupplierCode": stationBaseInfoResp.SupplierCode = item.Value; break;
case "StationVersion": stationBaseInfoResp.StationVersion = item.Value; break;
case "HardwareVersion": stationBaseInfoResp.HardwareVersion = Convert.ToSByte(item.Value); break;
case "Cover": stationBaseInfoResp.Cover = item.Value; break;
case "Faultlevel": stationBaseInfoResp.Faultlevel = Convert.ToInt32(item.Value); break;
case "LockType": stationBaseInfoResp.LockType = Convert.ToSByte(item.Value); break;
case "AccessType": stationBaseInfoResp.AccessType = Convert.ToSByte(item.Value); break;
case "RiseType": stationBaseInfoResp.RiseType = Convert.ToSByte(item.Value); break;
case "ModifyTime": stationBaseInfoResp.ModifyTime = item.Value; break;
case "DistributionCapacity": stationBaseInfoResp.DistributionCapacity = Convert.ToInt32(item.Value); break;
case "TotalPower": stationBaseInfoResp.TotalPower = Convert.ToInt32(item.Value); break;
case "StationProvince": stationBaseInfoResp.StationProvince = item.Value; break;
case "StationCity": stationBaseInfoResp.StationCity = item.Value; break;
case "OrganizationId": stationBaseInfoResp.OrganizationId = Convert.ToInt32(item.Value); break;
case "StationMac": stationBaseInfoResp.StationMac = item.Value; break;
}
}
return Result<StationBaseInfoResp>.Success(stationBaseInfoResp);
}
@ -119,23 +145,48 @@ namespace WebStarter.Controllers.System
/// 站点编辑
/// </summary>
[HttpPost("StationInfoEditor")]
public void StationInfoEditor(List<StationBaseInfoReq> listStationBaseInfoReq)
public Result<bool> StationInfoEditor([FromBody] StationBaseInfoReq listStationBaseInfoReq)
{
foreach(var req in listStationBaseInfoReq)
bool setResult = false;
PropertyInfo[] props = typeof(StationBaseInfoReq).GetProperties();
foreach (PropertyInfo fieldInfo in props)
{
string newConstConfigInfo = "Station" + "." + fieldInfo.Name;
object getContent = fieldInfo.GetValue(listStationBaseInfoReq);
if (fieldInfo.Name == "ModifyTime")
{
_sysConfigService.Set(req.BaseStationInfoName, req.BaseStationInfoContent);
if (getContent == null)
{
setResult = _sysConfigService.Set(newConstConfigInfo, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
}
else
setResult = _sysConfigService.Set(newConstConfigInfo, getContent);
}
if (getContent != null)
setResult = _sysConfigService.Set(newConstConfigInfo, getContent);
}
return Result<bool>.Success(setResult);
}
/// <summary>
/// 系统基础配置 上传图片
/// </summary>
/// <param name="file"></param>
/// <returns></returns>
[HttpPost("ImgUpLoad")]
public async Task<SysFile> ImgUpLoad([Required] IFormFile file)
public async Task<Result<SysFile>> ImgUpLoad([Required] IFormFile file)
{
return await _sysConfigService.UploadAvatar(file, _webHostEnvironment.WebRootPath);
SysFile sysFile = await _sysConfigService.UploadAvatar(file, _webHostEnvironment.WebRootPath);
if (sysFile != null)
return Result<SysFile>.Success(sysFile);
else
return Result<SysFile>.Fail();
}
}
}

@ -1,11 +1,77 @@
{
"Version": 1,
"Hash": "7euZr+Skxn+CPwHhQ3H6LZuur9IzJqC+CYg6oY75X7A=",
"Hash": "SIbd/wMGDFDb4PVjR2gB4U/BUVTP3CxZPCnoMCemIoA=",
"Source": "WebStarter",
"BasePath": "_content/WebStarter",
"Mode": "Default",
"ManifestType": "Build",
"ReferencedProjectsConfiguration": [],
"DiscoveryPatterns": [],
"Assets": []
"DiscoveryPatterns": [
{
"Name": "WebStarter\\wwwroot",
"Source": "WebStarter",
"ContentRoot": "D:\\AprojectFile\\huanneng\\huannengMain\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter",
"Pattern": "**"
}
],
"Assets": [
{
"Identity": "D:\\AprojectFile\\huanneng\\huannengMain\\WebStarter\\wwwroot\\20240523\\0.jpg",
"SourceId": "WebStarter",
"SourceType": "Discovered",
"ContentRoot": "D:\\AprojectFile\\huanneng\\huannengMain\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter",
"RelativePath": "20240523/0.jpg",
"AssetKind": "All",
"AssetMode": "All",
"AssetRole": "Primary",
"AssetMergeBehavior": "PreferTarget",
"AssetMergeSource": "",
"RelatedAsset": "",
"AssetTraitName": "",
"AssetTraitValue": "",
"CopyToOutputDirectory": "Never",
"CopyToPublishDirectory": "PreserveNewest",
"OriginalItemSpec": "wwwroot\\20240523\\0.jpg"
},
{
"Identity": "D:\\AprojectFile\\huanneng\\huannengMain\\WebStarter\\wwwroot\\20240524\\0.jpg",
"SourceId": "WebStarter",
"SourceType": "Discovered",
"ContentRoot": "D:\\AprojectFile\\huanneng\\huannengMain\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter",
"RelativePath": "20240524/0.jpg",
"AssetKind": "All",
"AssetMode": "All",
"AssetRole": "Primary",
"AssetMergeBehavior": "PreferTarget",
"AssetMergeSource": "",
"RelatedAsset": "",
"AssetTraitName": "",
"AssetTraitValue": "",
"CopyToOutputDirectory": "Never",
"CopyToPublishDirectory": "PreserveNewest",
"OriginalItemSpec": "wwwroot\\20240524\\0.jpg"
},
{
"Identity": "D:\\AprojectFile\\huanneng\\huannengMain\\WebStarter\\wwwroot\\20240524\\0.png",
"SourceId": "WebStarter",
"SourceType": "Discovered",
"ContentRoot": "D:\\AprojectFile\\huanneng\\huannengMain\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter",
"RelativePath": "20240524/0.png",
"AssetKind": "All",
"AssetMode": "All",
"AssetRole": "Primary",
"AssetMergeBehavior": "PreferTarget",
"AssetMergeSource": "",
"RelatedAsset": "",
"AssetTraitName": "",
"AssetTraitValue": "",
"CopyToOutputDirectory": "Never",
"CopyToPublishDirectory": "PreserveNewest",
"OriginalItemSpec": "wwwroot\\20240524\\0.png"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 KiB

Loading…
Cancel
Save