Răsfoiți Sursa

feat(web):站点信息配置页接口

Zhenghanjv 7 luni în urmă
părinte
comite
5147346d45

+ 7 - 7
FccLite.sln

@@ -3,11 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio Version 17
 VisualStudioVersion = 17.8.34601.278
 MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FccLife.Web", "src\FccLife.Web\FccLife.Web.csproj", "{5B1F4FB6-2881-406F-B3F2-AD4877FEA410}"
-EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Device", "Device", "{819D9FAB-5D03-4E85-AA78-CB21DA92B8C1}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FccLite.Device", "src\FccLite.Device\FccLite.Device.csproj", "{1AD1DF98-AEB7-47C6-AA39-190955FCC583}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FccLite.Device", "src\FccLite.Device\FccLite.Device.csproj", "{1AD1DF98-AEB7-47C6-AA39-190955FCC583}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FccLite.Web", "src\FccLife.Web\FccLite.Web.csproj", "{6D8BA5A6-16A3-40DE-9EB3-BD2985F04BDE}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,14 +15,14 @@ Global
 		Release|Any CPU = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{5B1F4FB6-2881-406F-B3F2-AD4877FEA410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{5B1F4FB6-2881-406F-B3F2-AD4877FEA410}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{5B1F4FB6-2881-406F-B3F2-AD4877FEA410}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{5B1F4FB6-2881-406F-B3F2-AD4877FEA410}.Release|Any CPU.Build.0 = Release|Any CPU
 		{1AD1DF98-AEB7-47C6-AA39-190955FCC583}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{1AD1DF98-AEB7-47C6-AA39-190955FCC583}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{1AD1DF98-AEB7-47C6-AA39-190955FCC583}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{1AD1DF98-AEB7-47C6-AA39-190955FCC583}.Release|Any CPU.Build.0 = Release|Any CPU
+		{6D8BA5A6-16A3-40DE-9EB3-BD2985F04BDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6D8BA5A6-16A3-40DE-9EB3-BD2985F04BDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6D8BA5A6-16A3-40DE-9EB3-BD2985F04BDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6D8BA5A6-16A3-40DE-9EB3-BD2985F04BDE}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 63 - 0
src/FccLife.Web/Controller/ConfigController.cs

@@ -0,0 +1,63 @@
+using FccLite.Web.Domain.FccStationInfo.Input;
+using FccLite.Web.Domain.FccStationInfo.Output;
+using FccLite.Web.Services.FccStaionInfo;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+using System.Drawing;
+using System.Xml.Linq;
+
+namespace FccLite.Web.Controller
+{
+    [Route("qrFueling/config")]
+    [ApiController]
+    public class ConfigController : ControllerBase
+    {
+        private readonly IStationService _stationService;
+        public ConfigController(IStationService stationService) 
+        {
+            _stationService = stationService;
+        }
+
+        /// <summary>
+        /// 新增、更改站点信息
+        /// </summary>
+        /// <param name="stationInfoInput">站点信息</param>
+        /// <returns></returns>
+        [HttpPost("upLoadBaseInfo")]
+        public async Task<StationSetOutput> UpLoadBaseInfo(StationInfoInput 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)
+        {
+            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)
+        {
+            var response = await _stationService.DeleteBaseInfo(id);
+            return Ok(response);
+
+        }
+    }
+}

+ 21 - 0
src/FccLife.Web/Core/database/MysqlDbContext.cs

@@ -0,0 +1,21 @@
+using FccLite.Web.Domain.FccStationInfo;
+using Microsoft.EntityFrameworkCore;
+
+namespace FccLite.Web.utils.database
+{
+    public class MysqlDbContext:DbContext
+    {
+        public MysqlDbContext(DbContextOptions<MysqlDbContext> options):base(options) { }
+
+        public DbSet<FccStationInfo> FccStationInfos { get; set; }
+
+        protected override void OnModelCreating(ModelBuilder modelBuilder)
+        {
+            //modelBuilder.Entity<FccStationInfo>(entity =>
+            //{
+            //    entity.ToTable("qr_station_info");
+            //});
+            base.OnModelCreating(modelBuilder);
+        }
+    }
+}

+ 20 - 0
src/FccLife.Web/Core/database/QueryableExtensions.cs

@@ -0,0 +1,20 @@
+using System.Linq.Expressions;
+
+namespace FccLite.Web.Core.database
+{
+    public static class QueryableExtensions
+    {
+        /// <summary>  
+        /// 根据条件动态地应用 WHERE 子句。  
+        /// </summary>  
+        /// <typeparam name="T">实体类型。</typeparam>  
+        /// <param name="query">原始的 IQueryable 查询。</param>  
+        /// <param name="condition">是否应用 WHERE 子句的条件。</param>  
+        /// <param name="predicate">要应用的 WHERE 子句的条件表达式。</param>  
+        /// <returns>根据条件返回应用了 WHERE 子句或未应用的 IQueryable 查询。</returns>  
+        public static IQueryable<T> WhereIf<T>(this IQueryable<T> query, bool condition, Expression<Func<T, bool>> predicate)
+        {
+            return condition ? query.Where(predicate) : query;
+        }
+    }
+}

+ 67 - 0
src/FccLife.Web/Domain/FccStationInfo/FccStationInfo.cs

@@ -0,0 +1,67 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Numerics;
+
+namespace FccLite.Web.Domain.FccStationInfo
+{
+    [Table("qr_station_info")]
+    public class FccStationInfo
+    {
+        /// <summary>
+        /// id
+        /// </summary>
+        [Key]
+        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 云端站点 id
+        /// </summary>
+        public string BuildId { get; set; }
+
+        /// <summary>
+        /// 站点名称
+        /// </summary>
+        public string Name { get; set; }
+
+        /// <summary>
+        /// 经度
+        /// </summary>
+        public decimal Longitude { get; set; }
+
+        /// <summary>
+        /// 纬度
+        /// </summary>
+        public decimal Latitude { get; set; }
+
+        /// <summary>
+        /// 小程序链接地址
+        /// </summary>
+        public string SmallProgram { get; set; }
+
+        /// <summary>
+        /// 云端地址
+        /// </summary>
+        public string CloudService {  get; set; }
+
+        /// <summary>
+        /// 云端  MQTT 地址
+        /// </summary>
+        public string MqttService { get; set; }
+
+        /// <summary>
+        /// icard 数据库连接地址
+        /// </summary>
+        public string IcardService { get; set; }
+
+        /// <summary>
+        /// 本地 fcc 与油机 socket 通讯端口
+        /// </summary>
+        public string ServicePort { get; set; }
+
+        /// <summary>
+        /// 本地 fcc 与 fcc 页面 webSocket 端口
+        /// </summary>
+        public string WebSocketPort { get; set; }
+    }
+}

+ 87 - 0
src/FccLife.Web/Domain/FccStationInfo/Input/StationInfoInput.cs

@@ -0,0 +1,87 @@
+using System.Numerics;
+
+namespace FccLite.Web.Domain.FccStationInfo.Input
+{
+    public class StationInfoInput
+    {
+        /// <summary>
+        /// id
+        /// </summary>
+        public long? Id { get; set; }
+
+        /// <summary>
+        /// 云端站点 id
+        /// </summary>
+        public string? BuildId { get; set; }
+
+        /// <summary>
+        /// 站点名称
+        /// </summary>
+        public string? Name { get; set; }
+
+        /// <summary>
+        /// 经度
+        /// </summary>
+        public decimal? Longitude { get; set; }
+
+        /// <summary>
+        /// 纬度
+        /// </summary>
+        public decimal? Latitude { get; set; }
+
+        /// <summary>
+        /// 小程序链接地址
+        /// </summary>
+        public string? SmallProgram { get; set; }
+
+        /// <summary>
+        /// 云端地址
+        /// </summary>
+        public string? CloudService { get; set; }
+
+        /// <summary>
+        /// 云端  MQTT 地址
+        /// </summary>
+        public string? MqttService { get; set; }
+
+        /// <summary>
+        /// icard 数据库连接地址
+        /// </summary>
+        public string? IcardService { get; set; }
+
+        /// <summary>
+        /// 本地 fcc 与油机 socket 通讯端口
+        /// </summary>
+        public string? ServicePort { get; set; }
+
+        /// <summary>
+        /// 本地 fcc 与 fcc 页面 webSocket 端口
+        /// </summary>
+        public string? WebSocketPort { get; set; }
+
+        public FccStationInfo? ToComponent()
+        {
+            if (IsNotNorm()) return null;
+            
+            return new FccStationInfo()
+            {
+                BuildId = this.BuildId,
+                Name = this.Name != null ? this.Name : "",
+                Longitude = (decimal)(this.Longitude != null ? this.Longitude : new decimal(0)),
+                Latitude = (decimal)(this.Latitude != null ? this.Latitude : new decimal(0)),
+                SmallProgram = this.SmallProgram,
+                CloudService = this.CloudService,
+                MqttService = this.MqttService,
+                IcardService = this.IcardService != null ? this.IcardService : "",
+                ServicePort = this.ServicePort,
+                WebSocketPort = this.WebSocketPort
+            };
+        }
+
+        public Boolean IsNotNorm()
+        {
+            return string.IsNullOrEmpty(this.BuildId) || !this.Longitude.HasValue || !this.Latitude.HasValue || string.IsNullOrEmpty(this.SmallProgram) || string.IsNullOrEmpty(this.CloudService)
+                || string.IsNullOrEmpty(this.MqttService) || string.IsNullOrEmpty(this.ServicePort) || string.IsNullOrEmpty(this.WebSocketPort);
+        }
+    }
+}

+ 78 - 0
src/FccLife.Web/Domain/FccStationInfo/Output/StationInfoOutput.cs

@@ -0,0 +1,78 @@
+using System.Numerics;
+
+namespace FccLite.Web.Domain.FccStationInfo.Output
+{
+    /// <summary>
+    /// 获取站点基本信息结果
+    /// </summary>
+    public class StationInfoOutput
+    {
+        /// <summary>
+        /// 总数量
+        /// </summary>
+        public int Total { get; set; }
+
+        /// <summary>
+        /// 站点信息
+        /// </summary>
+        public List<StationInfo> StationList { get; set; }
+    }
+
+    public class StationInfo
+    {
+        /// <summary>
+        /// id
+        /// </summary>
+        public long? Id { get; set; }
+
+        /// <summary>
+        /// 云端站点 id
+        /// </summary>
+        public string BuildId { get; set; }
+
+        /// <summary>
+        /// 站点名称
+        /// </summary>
+        public string? Name { get; set; }
+
+        /// <summary>
+        /// 经度
+        /// </summary>
+        public decimal Longitude { get; set; }
+
+        /// <summary>
+        /// 纬度
+        /// </summary>
+        public decimal Latitude { get; set; }
+
+        /// <summary>
+        /// 小程序链接地址
+        /// </summary>
+        public string SmallProgram { get; set; }
+
+        /// <summary>
+        /// 云端地址
+        /// </summary>
+        public string CloudService { get; set; }
+
+        /// <summary>
+        /// 云端  MQTT 地址
+        /// </summary>
+        public string MqttService { get; set; }
+
+        /// <summary>
+        /// icard 数据库连接地址
+        /// </summary>
+        public string? IcardService { get; set; }
+
+        /// <summary>
+        /// 本地 fcc 与油机 socket 通讯端口
+        /// </summary>
+        public string ServicePort { get; set; }
+
+        /// <summary>
+        /// 本地 fcc 与 fcc 页面 webSocket 端口
+        /// </summary>
+        public string WebSocketPort { get; set; }
+    }
+}

+ 22 - 0
src/FccLife.Web/Domain/FccStationInfo/Output/StationSetOutput.cs

@@ -0,0 +1,22 @@
+using System.Numerics;
+
+namespace FccLite.Web.Domain.FccStationInfo.Output
+{
+    /// <summary>
+    /// 新增/修改/删除站点基本信息结果
+    /// </summary>
+    public class StationSetOutput
+    {
+        /// <summary>
+        /// 保存结果
+        /// </summary>
+        public bool Result { get; set; }
+
+        /// <summary>
+        /// 信息
+        /// </summary>
+        public string Message { get; set; }
+    }
+
+
+}

+ 6 - 0
src/FccLife.Web/FccLite.Web.csproj

@@ -6,4 +6,10 @@
     <ImplicitUsings>enable</ImplicitUsings>
   </PropertyGroup>
 
+  <ItemGroup>
+    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
+    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
+    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
+  </ItemGroup>
+
 </Project>

+ 54 - 1
src/FccLife.Web/Program.cs

@@ -1,6 +1,59 @@
+using FccLite.Web.Repositories.FccStationInfo;
+using FccLite.Web.Services.FccStaionInfo;
+using FccLite.Web.utils.database;
+using Microsoft.EntityFrameworkCore;
+
 var builder = WebApplication.CreateBuilder(args);
+
+//数据库
+builder.Services.AddDbContext<MysqlDbContext>(options =>
+    options.UseMySql(builder.Configuration.GetConnectionString("DefaultConnection"), ServerVersion.AutoDetect(builder.Configuration.GetConnectionString("DefaultConnection")))
+    .LogTo(Console.WriteLine,LogLevel.Debug));
+
+
+
+//controller
+builder.Services.AddControllers();
+
+//服务注册
+builder.Services.AddScoped<IStationService, StationServiceImpl>();
+builder.Services.AddScoped<IStationRepository, StationRepository>();
+
+//swagger
+builder.Services.AddSwaggerGen(c =>
+{
+    c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo
+    {
+        Title = ".NET 6.0 API",
+        Version = "v1",
+        Description = "二维码项目 FCC 页面接口",
+    });
+});
 var app = builder.Build();
 
-app.MapGet("/", () => "Hello World!");
+//controller
+app.UseHttpsRedirection();
+app.UseAuthorization();
+app.MapControllers();
+
+//swagger
+app.UseSwagger();
+app.UseSwaggerUI(c =>
+{
+    c.SwaggerEndpoint("/swagger/v1/swagger.json", ".NET 6 API V1");
+});
+
+//迁移数据库
+//string? isMigrate = builder.Configuration.GetConnectionString("isMigrate");
+//if (isMigrate != null && "true".Equals(isMigrate))
+//{
+//    //using var context = new MysqlDbContext();
+//    //context.Database.Migrate();
+//    using (var scope = app.Services.CreateScope())
+//    {
+//        var context = scope.ServiceProvider.GetRequiredService<MysqlDbContext>();
+//        context.Database.Migrate();
+//    }
+//}
 
 app.Run();

+ 40 - 0
src/FccLife.Web/Repositories/FccStationInfo/IStationRepository.cs

@@ -0,0 +1,40 @@
+using FccLite.Web.Domain.FccStationInfo.Input;
+
+namespace FccLite.Web.Repositories.FccStationInfo
+{
+    public interface IStationRepository
+    {
+        /// <summary>
+        /// 分页查询
+        /// </summary>
+        /// <param name="page">页码</param>
+        /// <param name="pageSize">页数</param>
+        /// <param name="id">过滤条件——id</param>
+        /// <param name="name">过滤条件——站名</param>
+        /// <param name="longitude">过滤条件——经度</param>
+        /// <param name="latitude">过滤条件——纬度</param>
+        /// <returns></returns>
+        Task<IEnumerable<FccLite.Web.Domain.FccStationInfo.FccStationInfo>> GetPage(int page, int pageSize, long? id, string? name, decimal? longitude, decimal? latitude);
+
+        /// <summary>
+        /// 通过 id 查找站点信息
+        /// </summary>
+        /// <param name="id">id</param>
+        /// <returns>站点信息</returns>
+        Task<FccLite.Web.Domain.FccStationInfo.FccStationInfo?> FindByID(long id);
+
+        /// <summary>
+        /// 保存
+        /// </summary>
+        /// <param name="stationInfoInput">站点信息</param>
+        /// <returns></returns>
+        Task<FccLite.Web.Domain.FccStationInfo.FccStationInfo> Save(StationInfoInput stationInfoInput);
+
+        /// <summary>
+        /// 通过 id 删除站点信息
+        /// </summary>
+        /// <param name="id">id</param>
+        /// <returns>站点信息</returns>
+        Task<Boolean> DeleteByID(long id);
+    }
+}

+ 102 - 0
src/FccLife.Web/Repositories/FccStationInfo/StationRepository.cs

@@ -0,0 +1,102 @@
+using FccLite.Web.Core.database;
+using FccLite.Web.Domain.FccStationInfo.Input;
+using FccLite.Web.utils.database;
+using Microsoft.AspNetCore.Cors.Infrastructure;
+using Microsoft.EntityFrameworkCore;
+using System.Net;
+using System.Xml.Linq;
+
+namespace FccLite.Web.Repositories.FccStationInfo
+{
+    public class StationRepository : IStationRepository
+    {
+        private readonly MysqlDbContext _dbContext;
+        public StationRepository(MysqlDbContext dbContext)
+        {
+            _dbContext = dbContext;
+        }
+
+
+        /// <summary>
+        /// 通过id查找站点信息
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        public async Task<Domain.FccStationInfo.FccStationInfo?> FindByID(long id)
+        {
+            Domain.FccStationInfo.FccStationInfo? station = await _dbContext.FccStationInfos.FindAsync(id);
+            return station;
+        }
+
+        /// <summary>
+        /// 条件分页查询
+        /// </summary>
+        /// <param name="page">页码</param>
+        /// <param name="pageSize">页数</param>
+        /// <param name="id">过滤条件——id</param>
+        /// <param name="name">过滤条件——站名</param>
+        /// <param name="longitude">过滤条件——经度</param>
+        /// <param name="latitude">过滤条件——纬度</param>
+        /// <returns></returns>
+        public async Task<IEnumerable<Domain.FccStationInfo.FccStationInfo>> GetPage(int page, int pageSize, long? id, string? name, decimal? longitude, decimal? latitude)
+        {
+            IQueryable<Domain.FccStationInfo.FccStationInfo> query = _dbContext.FccStationInfos.AsQueryable();
+            query = query.WhereIf(id != null, info => info.Id == id);
+            query = query.WhereIf(!string.IsNullOrEmpty(name), info => info.Name.Contains(name));
+            query = query.WhereIf(longitude != null, info => info.Longitude == longitude);
+            query = query.WhereIf(latitude != null, info => info.Latitude == latitude);
+
+            return await query.Skip((page - 1) * pageSize).Take(pageSize).ToListAsync();
+        }
+
+        /// <summary>
+        /// 新增/修改站点信息
+        /// </summary>
+        /// <param name="stationInfoInput">站点信息</param>
+        /// <returns></returns>
+        public async Task<Domain.FccStationInfo.FccStationInfo?> Save(StationInfoInput stationInfoInput)
+        {
+           
+            if (stationInfoInput == null) return null;
+            if (stationInfoInput.IsNotNorm()) return null;
+            if (stationInfoInput.Id != null)
+            {
+                Domain.FccStationInfo.FccStationInfo? station = await _dbContext.FccStationInfos.FindAsync(stationInfoInput.Id);
+
+                if (station == null) return null;
+
+                station.BuildId = stationInfoInput.BuildId;
+                station.Name = stationInfoInput.Name != null ? stationInfoInput.Name : "";
+                station.Longitude = (decimal)(stationInfoInput.Longitude != null ? stationInfoInput.Longitude : new decimal(0));
+                station.Latitude = (decimal)(stationInfoInput.Latitude != null ? stationInfoInput.Latitude : new decimal(0));
+                station.SmallProgram = stationInfoInput.SmallProgram;
+                station.CloudService = stationInfoInput.CloudService;
+                station.MqttService = stationInfoInput.MqttService;
+                station.IcardService = stationInfoInput.IcardService != null ? stationInfoInput.IcardService : "";
+                station.ServicePort = stationInfoInput.ServicePort;
+                station.WebSocketPort = stationInfoInput.WebSocketPort;
+                _dbContext.SaveChanges();
+                return station;
+            }
+            Domain.FccStationInfo.FccStationInfo? fccStationInfo = stationInfoInput.ToComponent();
+            _dbContext.FccStationInfos.Add(fccStationInfo);
+            _dbContext.SaveChanges();
+            return fccStationInfo;
+        }
+
+        /// <summary>
+        /// 通过id 删除站点信息
+        /// </summary>
+        /// <param name="id">站点id</param>
+        /// <returns></returns>
+        public async Task<bool> DeleteByID(long id)
+        {
+            Domain.FccStationInfo.FccStationInfo? info = await _dbContext.FccStationInfos.FindAsync(id);
+            if (info == null) return false;
+            _dbContext.FccStationInfos.Remove(info);
+            _dbContext.SaveChanges();
+            return true;
+        }
+    }
+}

+ 34 - 0
src/FccLife.Web/Services/FccStaionInfo/IStationService.cs

@@ -0,0 +1,34 @@
+using FccLite.Web.Domain.FccStationInfo.Input;
+using FccLite.Web.Domain.FccStationInfo.Output;
+
+namespace FccLite.Web.Services.FccStaionInfo
+{
+    public interface IStationService
+    {
+        /// <summary>
+        /// 新增/修改站点基本信息
+        /// </summary>
+        /// <param name="stationInfoDTO">新增/修改内容</param>
+        /// <returns>保存结果</returns>
+        Task<StationSetOutput> UploadBaseInfo(StationInfoInput stationInfoDTO);
+
+        /// <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>
+        Task<StationInfoOutput> GetBaseInfo(int page,int size, long? id, string? name, decimal? longitude, decimal? latitude);
+
+        /// <summary>
+        /// 删除站点信息
+        /// </summary>
+        /// <param name="id">站点id</param>
+        /// <returns></returns>
+        Task<StationSetOutput> DeleteBaseInfo(long id);
+    }
+}

+ 103 - 0
src/FccLife.Web/Services/FccStaionInfo/StationServiceImpl.cs

@@ -0,0 +1,103 @@
+using FccLite.Web.Domain.FccStationInfo.Input;
+using FccLite.Web.Domain.FccStationInfo.Output;
+using FccLite.Web.Repositories.FccStationInfo;
+
+namespace FccLite.Web.Services.FccStaionInfo
+{
+    public class StationServiceImpl : IStationService
+    {
+        private readonly IStationRepository _stationRepository;
+        public StationServiceImpl(IStationRepository stationRepository)
+        {
+            _stationRepository = stationRepository;
+        }
+
+        /// <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>
+        public async Task<StationInfoOutput> GetBaseInfo(int page, int size, long? id, string? name, decimal? longitude, decimal? latitude)
+        {
+            IEnumerable<Domain.FccStationInfo.FccStationInfo> enumerable = await _stationRepository.GetPage(page, size, id, name, longitude, latitude);
+            
+            List<StationInfo> fccStationInfos = enumerable.Select(stationInfo =>
+                new StationInfo()
+                {
+                    Id = stationInfo.Id,
+                    BuildId = stationInfo.BuildId,
+                    Name = stationInfo.Name,
+                    Longitude = stationInfo.Longitude,
+                    Latitude = stationInfo.Latitude,
+                    SmallProgram = stationInfo.SmallProgram,
+                    CloudService = stationInfo.CloudService,
+                    MqttService = stationInfo.MqttService,
+                    IcardService = stationInfo.IcardService,
+                    ServicePort = stationInfo.ServicePort,
+                    WebSocketPort = stationInfo.WebSocketPort
+                }
+            ).ToList();
+            return new StationInfoOutput()
+            {
+                Total = fccStationInfos.Count,
+                StationList = fccStationInfos
+            };
+        }
+
+        /// <summary>
+        /// 新增/修改站点信息
+        /// </summary>
+        /// <param name="stationInfoInput"></param>
+        /// <returns></returns>
+        public async Task<StationSetOutput> UploadBaseInfo(StationInfoInput stationInfoInput)
+        {
+            Domain.FccStationInfo.FccStationInfo info = await _stationRepository.Save(stationInfoInput);
+            if (info == null)
+            {
+                return new StationSetOutput()
+                {
+                    Result = false,
+                    Message = "入参格式错误" + stationInfoInput.ToString()
+                };
+            }
+
+            return new StationSetOutput()
+            {
+                Result = true,
+                Message = "保存成功"
+            };
+        }
+
+        /// <summary>
+        /// 上传站点信息
+        /// </summary>
+        /// <param name="id">站点id</param>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        public async Task<StationSetOutput> DeleteBaseInfo(long id)
+        {
+            Boolean result = await _stationRepository.DeleteByID(id);
+            if(result)
+            {
+                return new StationSetOutput()
+                {
+                    Result = true,
+                    Message = "删除成功"
+                };
+            }
+
+            return new StationSetOutput()
+            {
+                Result = false,
+                Message = "删除失败"
+            };
+        }
+
+
+    }
+}

+ 4 - 0
src/FccLife.Web/appsettings.Development.json

@@ -4,5 +4,9 @@
       "Default": "Information",
       "Microsoft.AspNetCore": "Warning"
     }
+  },
+  "ConnectionStrings": {
+    "DefaultConnection": "Server=localhost;Port=3306;Database=qrFueling;User=root;Password=123456",
+    "isMigrate": "true"
   }
 }