|
|
@@ -0,0 +1,116 @@
|
|
|
+using FccLite.Web.Domain.FccOilInfo.Input;
|
|
|
+using FccLite.Web.Domain.FccOilInfo.Ouput;
|
|
|
+using FccLite.Web.Domain.FccStationInfo.Input;
|
|
|
+using FccLite.Web.Domain.FccStationInfo.Output;
|
|
|
+using FccLite.Web.Services.FccOilInfo;
|
|
|
+using FccLite.Web.Services.FccStaionInfo;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
|
+using System.Drawing;
|
|
|
+using System.Text.Json;
|
|
|
+using System.Xml.Linq;
|
|
|
+
|
|
|
+namespace FccLite.Web.Controller
|
|
|
+{
|
|
|
+ [Route("qrFueling/config")]
|
|
|
+ [ApiController]
|
|
|
+ public class ConfigController : ControllerBase
|
|
|
+ {
|
|
|
+ static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
|
|
+
|
|
|
+ private readonly IStationService _stationService;
|
|
|
+ private readonly IOilInfoService _oilInfoService;
|
|
|
+ public ConfigController(IStationService stationService,IOilInfoService oilInfoService)
|
|
|
+ {
|
|
|
+ _stationService = stationService;
|
|
|
+ _oilInfoService = oilInfoService;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 新增、更改站点信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="stationInfoInput">站点信息</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("upLoadBaseInfo")]
|
|
|
+ public async Task<StationSetOutput> UpLoadBaseInfo(StationInfoInput stationInfoInput)
|
|
|
+ {
|
|
|
+ logger.Info($"add or update station info,{JsonSerializer.Serialize(stationInfoInput)}");
|
|
|
+ return await _stationService.UploadBaseInfo(stationInfoInput);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 分页获取站点信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="page">页码</param>
|
|
|
+ /// <param name="size">页数</param>
|
|
|
+ /// <param name="id">过滤信息——id</param>
|
|
|
+ /// <param name="name">过滤信息——站点名</param>
|
|
|
+ /// <param name="longitude">过滤信息——经度</param>
|
|
|
+ /// <param name="latitude">过滤信息——纬度</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("getBaseInfo")]
|
|
|
+ public async Task<IActionResult> GetBaseInfo(int page, int size,long? id,string? name, decimal? longitude,decimal? latitude)
|
|
|
+ {
|
|
|
+ logger.Info($"get page of station info:page = {page},size = {size}, id = {id},name = {name},longitude = {longitude},latitude = {latitude}");
|
|
|
+ var response = await _stationService.GetBaseInfo(page, size, id,name,longitude,latitude);
|
|
|
+ return Ok(response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 通过 id 删除站点信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id">站点id</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("deleteBaseInfo")]
|
|
|
+ public async Task<IActionResult> DeleteBaseInfo(long id)
|
|
|
+ {
|
|
|
+ logger.Info($"delete station info by id:{id}");
|
|
|
+ var response = await _stationService.DeleteBaseInfo(id);
|
|
|
+ return Ok(response);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 分页获取油品信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="page">页数</param>
|
|
|
+ /// <param name="size">页码</param>
|
|
|
+ /// <param name="id">过滤条件——id</param>
|
|
|
+ /// <param name="name">过滤条件——油品名</param>
|
|
|
+ /// <param name="code">过滤条件——油品码</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("getOilInfo")]
|
|
|
+ public async Task<IActionResult> GetOilInfo(int page,int size,long? id,string? name,int? code)
|
|
|
+ {
|
|
|
+ logger.Info($"get page of oil info,page = {page},size = {size},id = {id},name = {name},code = {code}");
|
|
|
+ var response = await _oilInfoService.GetPage(page, size, id, name, code);
|
|
|
+ return Ok(response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 新增、修改油品信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="oilInfoInput">油品信息</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("upLoadOilInfo")]
|
|
|
+ public async Task<OilInfoSetOutput> UpLoadOilInfo(OilInfoInput oilInfoInput)
|
|
|
+ {
|
|
|
+ logger.Info($"add or update oil info,{JsonSerializer.Serialize(oilInfoInput)}");
|
|
|
+ return await _oilInfoService.Save(oilInfoInput);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 通过 id 删除油品信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id">id</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("deleteOilInfo")]
|
|
|
+ public async Task<IActionResult> DeleteOilInfo(long id)
|
|
|
+ {
|
|
|
+ logger.Info($"delete oil info by id:{id}");
|
|
|
+ var response = await _oilInfoService.DeleteById(id);
|
|
|
+ return Ok(response);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|