|
|
|
@ -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,13 +145,34 @@ 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)
|
|
|
|
|
{
|
|
|
|
|
_sysConfigService.Set(req.BaseStationInfoName, req.BaseStationInfoContent);
|
|
|
|
|
string newConstConfigInfo = "Station" + "." + fieldInfo.Name;
|
|
|
|
|
object getContent = fieldInfo.GetValue(listStationBaseInfoReq);
|
|
|
|
|
|
|
|
|
|
if (fieldInfo.Name == "ModifyTime")
|
|
|
|
|
{
|
|
|
|
|
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>
|
|
|
|
|
/// 系统基础配置 上传图片
|
|
|
|
@ -133,9 +180,13 @@ namespace WebStarter.Controllers.System
|
|
|
|
|
/// <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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|