|
|
|
|
using Entity.Api.Req;
|
|
|
|
|
using Entity.Api.Resp;
|
|
|
|
|
using Entity.Base;
|
|
|
|
|
using Entity.DbModel.System.SysBaseObject;
|
|
|
|
|
using Entity.Dto.Req;
|
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Service.Mgr;
|
|
|
|
|
using Service.Station;
|
|
|
|
|
using Service.System;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
|
|
|
|
namespace WebStarter.Controllers.System
|
|
|
|
|
{
|
|
|
|
|
[Produces("application/json")]
|
|
|
|
|
[ApiController]
|
|
|
|
|
public class SysConfigController
|
|
|
|
|
{
|
|
|
|
|
private readonly SysConfigService _sysConfigService;
|
|
|
|
|
private readonly IWebHostEnvironment _webHostEnvironment;
|
|
|
|
|
|
|
|
|
|
public SysConfigController(SysConfigService sysConfigService, IWebHostEnvironment webHostEnvironment)
|
|
|
|
|
{
|
|
|
|
|
_sysConfigService = sysConfigService;
|
|
|
|
|
_webHostEnvironment = webHostEnvironment;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[Route("/api/sysConfig/page")]
|
|
|
|
|
public async Task<SqlSugarPagedList<SysConfig>> Page(PageConfigReq input)
|
|
|
|
|
{
|
|
|
|
|
return await _sysConfigService.Page(input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
[Route("/api/sysConfig/list")]
|
|
|
|
|
public async Task<List<SysConfig>> GetList()
|
|
|
|
|
{
|
|
|
|
|
return await _sysConfigService.GetList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
[Route("/api/sysConfig/detail")]
|
|
|
|
|
public async Task<SysConfig> GetDetail([FromQuery] ConfigReq input)
|
|
|
|
|
{
|
|
|
|
|
return await _sysConfigService.GetDetail(input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
[Route("/api/sysConfig/groupList")]
|
|
|
|
|
public async Task<List<string>> GetGroupList()
|
|
|
|
|
{
|
|
|
|
|
return await _sysConfigService.GetGroupList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[Route("/api/sysConfig/add")]
|
|
|
|
|
public async Task Add(AddConfigReq input)
|
|
|
|
|
{
|
|
|
|
|
await _sysConfigService.AddConfig(input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[Route("/api/sysConfig/update")]
|
|
|
|
|
public async Task Update(UpdateConfigReq input)
|
|
|
|
|
{
|
|
|
|
|
await _sysConfigService.UpdateConfig(input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[Route("/api/sysConfig/delete")]
|
|
|
|
|
public async Task Delete(DeleteConfigReq input)
|
|
|
|
|
{
|
|
|
|
|
await _sysConfigService.DeleteConfig(input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[Route("/api/sysConfig/batchDelete")]
|
|
|
|
|
public async Task BatchDelete(List<long> input)
|
|
|
|
|
{
|
|
|
|
|
await _sysConfigService.BatchDeleteConfig(input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 返回 站点基础信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[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)),
|
|
|
|
|
};
|
|
|
|
|
return Result<StationBaseInfoResp>.Success(stationBaseInfoResp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 站点编辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("StationInfoEditor")]
|
|
|
|
|
public void StationInfoEditor(List<StationBaseInfoReq> listStationBaseInfoReq)
|
|
|
|
|
{
|
|
|
|
|
foreach(var req in listStationBaseInfoReq)
|
|
|
|
|
{
|
|
|
|
|
_sysConfigService.Set(req.BaseStationInfoName, req.BaseStationInfoContent);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 系统基础配置 上传图片
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="file"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("ImgUpLoad")]
|
|
|
|
|
public async Task<SysFile> ImgUpLoad([Required] IFormFile file)
|
|
|
|
|
{
|
|
|
|
|
return await _sysConfigService.UploadAvatar(file, _webHostEnvironment.WebRootPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|