浏览代码

Merge branch 'feature/fcc页面接口' into develop

Zhenghanjv 1 年之前
父节点
当前提交
1453a5e15a
共有 43 个文件被更改,包括 2325 次插入8 次删除
  1. 7 7
      FccLite.sln
  2. 116 0
      src/FccLife.Web/Controller/ConfigController.cs
  3. 81 0
      src/FccLife.Web/Controller/TankController.cs
  4. 38 0
      src/FccLife.Web/Core/database/MysqlDbContext.cs
  5. 20 0
      src/FccLife.Web/Core/database/QueryableExtensions.cs
  6. 49 0
      src/FccLife.Web/Domain/FccNozzleInfo/FccNozzleInfo.cs
  7. 54 0
      src/FccLife.Web/Domain/FccNozzleInfo/Input/UploadNozzleInfoInput.cs
  8. 58 0
      src/FccLife.Web/Domain/FccNozzleInfo/Output/DetailsNozzleInfoOutput.cs
  9. 19 0
      src/FccLife.Web/Domain/FccNozzleInfo/Output/SetNozzleInfoOutput.cs
  10. 34 0
      src/FccLife.Web/Domain/FccOilInfo/FccOilInfo.cs
  11. 35 0
      src/FccLife.Web/Domain/FccOilInfo/Input/OilInfoInput.cs
  12. 32 0
      src/FccLife.Web/Domain/FccOilInfo/Ouput/OilInfoOutput.cs
  13. 18 0
      src/FccLife.Web/Domain/FccOilInfo/Ouput/OilInfoSetOutput.cs
  14. 69 0
      src/FccLife.Web/Domain/FccStationInfo/FccStationInfo.cs
  15. 87 0
      src/FccLife.Web/Domain/FccStationInfo/Input/StationInfoInput.cs
  16. 78 0
      src/FccLife.Web/Domain/FccStationInfo/Output/StationInfoOutput.cs
  17. 22 0
      src/FccLife.Web/Domain/FccStationInfo/Output/StationSetOutput.cs
  18. 52 0
      src/FccLife.Web/Domain/FccTankInfo/FccTankInfo.cs
  19. 43 0
      src/FccLife.Web/Domain/FccTankInfo/Input/AddTankInput.cs
  20. 32 0
      src/FccLife.Web/Domain/FccTankInfo/Input/UpdateTankInput.cs
  21. 44 0
      src/FccLife.Web/Domain/FccTankInfo/Output/BaseTankInfoOutput.cs
  22. 48 0
      src/FccLife.Web/Domain/FccTankInfo/Output/DetailsTankInfoOutput.cs
  23. 19 0
      src/FccLife.Web/Domain/FccTankInfo/Output/SetTankInfoOutput.cs
  24. 13 0
      src/FccLife.Web/FccLite.Web.csproj
  25. 64 1
      src/FccLife.Web/Program.cs
  26. 28 0
      src/FccLife.Web/Repositories/FccNozzleInfo/INozzleInfoReposity.cs
  27. 76 0
      src/FccLife.Web/Repositories/FccNozzleInfo/NozzleInfoReposity.cs
  28. 39 0
      src/FccLife.Web/Repositories/FccOilInfo/IOilInfoReposity.cs
  29. 109 0
      src/FccLife.Web/Repositories/FccOilInfo/OilInfoReposity.cs
  30. 40 0
      src/FccLife.Web/Repositories/FccStationInfo/IStationRepository.cs
  31. 116 0
      src/FccLife.Web/Repositories/FccStationInfo/StationRepository.cs
  32. 51 0
      src/FccLife.Web/Repositories/FccTankInfo/ITankReposity.cs
  33. 124 0
      src/FccLife.Web/Repositories/FccTankInfo/TankReposity.cs
  34. 29 0
      src/FccLife.Web/Services/FccNozzleInfo/INozzleInfnService.cs
  35. 101 0
      src/FccLife.Web/Services/FccNozzleInfo/NozzleInfoServiceImpl.cs
  36. 33 0
      src/FccLife.Web/Services/FccOilInfo/IOilInfoService.cs
  37. 98 0
      src/FccLife.Web/Services/FccOilInfo/OilInfoServiceImpl.cs
  38. 34 0
      src/FccLife.Web/Services/FccStaionInfo/IStationService.cs
  39. 109 0
      src/FccLife.Web/Services/FccStaionInfo/StationServiceImpl.cs
  40. 43 0
      src/FccLife.Web/Services/FccTankInfo/ITankInfoService.cs
  41. 136 0
      src/FccLife.Web/Services/FccTankInfo/TankInfoServiceImpl.cs
  42. 4 0
      src/FccLife.Web/appsettings.Development.json
  43. 23 0
      src/FccLife.Web/nlog.config

+ 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

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

@@ -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);
+        }
+    }
+}

+ 81 - 0
src/FccLife.Web/Controller/TankController.cs

@@ -0,0 +1,81 @@
+using FccLite.Web.Domain.FccNozzleInfo.Input;
+using FccLite.Web.Domain.FccTankInfo.Input;
+using FccLite.Web.Services.FccNozzleInfo;
+using FccLite.Web.Services.FccTankInfo;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace FccLite.Web.Controller
+{
+    [Route("qrFueling/tank")]
+    [ApiController]
+    public class TankController : ControllerBase
+    {
+        private readonly ITankInfoService _tankInfoService;
+        private readonly INozzleInfnService _nozzleInfnService;
+        public TankController(ITankInfoService tankInfoService,INozzleInfnService nozzleInfnService) 
+        {
+            _tankInfoService = tankInfoService;
+            _nozzleInfnService = nozzleInfnService;
+        }
+
+
+        [HttpGet("getBaseTankInfo")]
+        public async Task<IActionResult> GetBaseTankInfo(long id)
+        {
+            List<Domain.FccTankInfo.Output.BaseTankInfoOutput> baseTankInfos = await _tankInfoService.GetBaseTankByStationIdAsync(id);
+            return Ok(baseTankInfos);
+        }
+
+        [HttpGet("getDetailsTankInfo")]
+        public async Task<IActionResult> GetDetailsTankInfo(long id)
+        {
+            Domain.FccTankInfo.Output.DetailsTankInfoOutput? detailsTankInfoOutput = await _tankInfoService.GetDetailsTankByTankIdAsync(id);
+            if(detailsTankInfoOutput == null) return Ok("查找不到该油罐详情");
+            return Ok(detailsTankInfoOutput);
+        }
+
+        [HttpPost("addDetailsTankInfo")]
+        public async Task<IActionResult> AddDetailsTankInfo(AddTankInput addTankInput)
+        {
+            Domain.FccTankInfo.Output.SetTankInfoOutput result = await _tankInfoService.AddDetailsTankAsync(addTankInput);
+            return Ok(result);
+        }
+
+        [HttpPost("updateDetailsTankInfo")]
+        public async Task<IActionResult> UpdateDetailsTankInfo(UpdateTankInput updateTankInput)
+        {
+            Domain.FccTankInfo.Output.SetTankInfoOutput result = await _tankInfoService.UpdateDetailsTankAsync(updateTankInput);
+            return Ok(result);
+        }
+
+        [HttpPost("deleteTank")]
+        public async Task<IActionResult> DeleteTank(long id)
+        {
+            Domain.FccTankInfo.Output.SetTankInfoOutput result = await _tankInfoService.DeleteTankById(id);
+            return Ok(result);
+        }
+
+        [HttpGet("getDetailsNozzleInfo")]
+        public async Task<IActionResult> GetDetailsNozzleInfo(long id)
+        {
+            Domain.FccNozzleInfo.Output.DetailsNozzleInfoOutput? result = await _nozzleInfnService.GetDetailsNozzleInfoById(id);
+            if (result == null) return Ok("查找不到该油枪信息");
+            return Ok(result);
+        }
+
+        [HttpPost("uploadDetailsNozzleInfo")]
+        public async Task<IActionResult> UploadDetailsNozzleInfo(UploadNozzleInfoInput uploadNozzleInfoInput)
+        {
+            Domain.FccNozzleInfo.Output.SetNozzleInfoOutput result = await _nozzleInfnService.UploadDetailsNozzleInfo(uploadNozzleInfoInput);
+            return Ok(result);
+        }
+
+        [HttpPost("deleteNozzle")]
+        public async Task<IActionResult> DeleteNozzle(long id)
+        {
+            Domain.FccNozzleInfo.Output.SetNozzleInfoOutput result = await _nozzleInfnService.DeleteNozzleInfoByID(id);
+            return Ok(result);
+        }
+    }
+}

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

@@ -0,0 +1,38 @@
+using FccLite.Web.Domain.FccNozzleInfo;
+using FccLite.Web.Domain.FccOilInfo;
+using FccLite.Web.Domain.FccStationInfo;
+using FccLite.Web.Domain.FccTankInfo;
+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; }
+
+        public DbSet<FccOilInfo> OilInfos { get; set; }
+
+        public DbSet<FccTankInfo> TankInfos { get; set; }
+
+        public DbSet<FccNozzleInfo> NozzleInfos { get; set; }
+
+        protected override void OnModelCreating(ModelBuilder modelBuilder)
+        {
+            modelBuilder.Entity<FccTankInfo>()
+                .HasOne(tankInfos => tankInfos.Oil)
+                .WithMany(oilInfo => oilInfo.FccTankInfo)
+                .HasForeignKey(tankInfo => tankInfo.OilId)
+                .OnDelete(DeleteBehavior.Restrict);
+                
+            modelBuilder.Entity<FccNozzleInfo>()
+                .HasOne(nozzleInfo => nozzleInfo.Tank)
+                .WithMany(tankInfo => tankInfo.FccNozzleInfos)
+                .HasForeignKey(nozzleInfo => nozzleInfo.TankId)
+                .OnDelete(DeleteBehavior.Restrict);
+
+            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;
+        }
+    }
+}

+ 49 - 0
src/FccLife.Web/Domain/FccNozzleInfo/FccNozzleInfo.cs

@@ -0,0 +1,49 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace FccLite.Web.Domain.FccNozzleInfo
+{
+    [Table("qr_nozzle")]
+    public class FccNozzleInfo
+    {
+        /// <summary>
+        /// 油枪id
+        /// </summary>
+        [Key]
+        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 油机ip
+        /// </summary>
+        public string MachineIp { get; set; }
+
+        /// <summary>
+        /// 加油点
+        /// </summary>
+        public int FuelPoint { get; set; }
+
+        /// <summary>
+        /// 内部枪号
+        /// </summary>
+        public int InternalNum { get; set; }
+
+        /// <summary>
+        /// 外部枪号
+        /// </summary>
+        public int ExternalNum { get; set; }
+
+        /// <summary>
+        /// 关联油罐id
+        /// </summary>
+        [ForeignKey("Tank")]
+        public long TankId { get; set; }
+
+        /// <summary>
+        /// 关联油罐号
+        /// </summary>
+        public int TankNum { get; set; }
+
+        public FccTankInfo.FccTankInfo Tank { get; set; }
+    }
+}

+ 54 - 0
src/FccLife.Web/Domain/FccNozzleInfo/Input/UploadNozzleInfoInput.cs

@@ -0,0 +1,54 @@
+
+namespace FccLite.Web.Domain.FccNozzleInfo.Input
+{
+    public class UploadNozzleInfoInput
+    {
+        /// <summary>
+        /// 油枪id
+        /// </summary>
+        public long? Id { get; set; }
+
+        /// <summary>
+        /// 油机ip
+        /// </summary>
+        public string Ip { get; set; }
+
+        /// <summary>
+        /// 加油点
+        /// </summary>
+        public int FuelPoint { get; set; }
+
+        /// <summary>
+        /// 内部枪号
+        /// </summary>
+        public int InternalNum { get; set; }
+
+        /// <summary>
+        /// 外部枪号
+        /// </summary>
+        public int NozzleNum { get; set; }
+
+        /// <summary>
+        /// 关联油罐id
+        /// </summary>
+        public long TankId { get; set; }
+
+        /// <summary>
+        /// 关联油罐号
+        /// </summary>
+        public int TankNum { get; set; }
+
+        public FccNozzleInfo ToComponent()
+        {
+            return new FccNozzleInfo()
+            {
+                MachineIp = this.Ip,
+                FuelPoint = this.FuelPoint,
+                InternalNum = this.InternalNum,
+                ExternalNum = this.NozzleNum,
+                TankId = this.TankId,
+                TankNum = this.TankNum
+            };
+        }
+    }
+}

+ 58 - 0
src/FccLife.Web/Domain/FccNozzleInfo/Output/DetailsNozzleInfoOutput.cs

@@ -0,0 +1,58 @@
+namespace FccLite.Web.Domain.FccNozzleInfo.Output
+{
+    public class DetailsNozzleInfoOutput
+    {
+        /// <summary>
+        /// 油枪id
+        /// </summary>
+        public long? Id { get; set; }
+
+        /// <summary>
+        /// 油机ip
+        /// </summary>
+        public string Ip { get; set; }
+
+        /// <summary>
+        /// 加油点
+        /// </summary>
+        public int FuelPoint { get; set; }
+
+        /// <summary>
+        /// 内部枪号
+        /// </summary>
+        public int InternalNum { get; set; }
+
+        /// <summary>
+        /// 外部枪号
+        /// </summary>
+        public int NozzleNum { get; set; }
+
+        /// <summary>
+        /// 关联油罐id
+        /// </summary>
+        public long TankId { get; set; }
+
+        /// <summary>
+        /// 关联油罐号
+        /// </summary>
+        public int TankNum { get; set; }
+
+        /// <summary>
+        /// 可关联的油罐
+        /// </summary>
+        public List<RelatableTank> RelatableTanks { get; set; }
+
+        public class RelatableTank
+        {
+            /// <summary>
+            /// 油罐id
+            /// </summary>
+            public long TankId { get; set; }
+
+            /// <summary>
+            /// 油罐号
+            /// </summary>
+            public int TankNum { get; set; }
+        }
+    }
+}

+ 19 - 0
src/FccLife.Web/Domain/FccNozzleInfo/Output/SetNozzleInfoOutput.cs

@@ -0,0 +1,19 @@
+namespace FccLite.Web.Domain.FccNozzleInfo.Output
+{
+    /// <summary>
+    /// 新增、修改、删除油枪结果
+    /// </summary>
+    public class SetNozzleInfoOutput
+    {
+        /// <summary>
+        /// 结果
+        /// </summary>
+        public Boolean Result { get; set; }
+
+
+        /// <summary>
+        /// 信息
+        /// </summary>
+        public String Message { get; set; }
+    }
+}

+ 34 - 0
src/FccLife.Web/Domain/FccOilInfo/FccOilInfo.cs

@@ -0,0 +1,34 @@
+using FccLite.Web.Domain.FccTankInfo;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace FccLite.Web.Domain.FccOilInfo
+{
+    [Table("qr_oil")]
+    public class FccOilInfo
+    {
+        /// <summary>
+        /// id
+        /// </summary>
+        [Key]
+        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 油品码
+        /// </summary>
+        public int Code { get; set; }
+
+        /// <summary>
+        /// 油品名
+        /// </summary>
+        public string Name { get; set; }
+
+        /// <summary>
+        /// 单价
+        /// </summary>
+        public decimal Price { get; set; }
+
+        public ICollection<FccTankInfo.FccTankInfo> FccTankInfo { get; set; }
+    }
+}

+ 35 - 0
src/FccLife.Web/Domain/FccOilInfo/Input/OilInfoInput.cs

@@ -0,0 +1,35 @@
+namespace FccLite.Web.Domain.FccOilInfo.Input
+{
+    public class OilInfoInput
+    {
+        /// <summary>
+        /// id
+        /// </summary>
+        public long? Id { get; set; }
+
+        /// <summary>
+        /// 油品id
+        /// </summary>
+        public int Code { get; set; }
+
+        /// <summary>
+        /// 油品名
+        /// </summary>
+        public string Name { get; set; }
+
+        /// <summary>
+        /// 单价
+        /// </summary>
+        public decimal Price { get; set; }
+
+        public FccOilInfo ToComponent()
+        {
+            return new FccOilInfo()
+            {
+                Code = this.Code,
+                Name = this.Name,
+                Price = this.Price,
+            };
+        }
+    }
+}

+ 32 - 0
src/FccLife.Web/Domain/FccOilInfo/Ouput/OilInfoOutput.cs

@@ -0,0 +1,32 @@
+namespace FccLite.Web.Domain.FccOilInfo.Ouput
+{
+    public class OilInfoOutput
+    {
+        public int Total {  get; set; }
+
+        public List<OilInfo> OilInfoList { get; set; }
+
+        public class OilInfo
+        {
+            /// <summary>
+            /// id
+            /// </summary>
+            public long? Id { get; set; }
+
+            /// <summary>
+            /// 油品id
+            /// </summary>
+            public int Code { get; set; }
+
+            /// <summary>
+            /// 油品名
+            /// </summary>
+            public string Name { get; set; }
+
+            /// <summary>
+            /// 单价
+            /// </summary>
+            public decimal Price { get; set; }
+        }
+    }
+}

+ 18 - 0
src/FccLife.Web/Domain/FccOilInfo/Ouput/OilInfoSetOutput.cs

@@ -0,0 +1,18 @@
+namespace FccLite.Web.Domain.FccOilInfo.Ouput
+{
+    /// <summary>
+    /// 新增/修改/删除油品基本信息结果
+    /// </summary>
+    public class OilInfoSetOutput
+    {
+        /// <summary>
+        /// 保存结果
+        /// </summary>
+        public bool Result { get; set; }
+
+        /// <summary>
+        /// 信息
+        /// </summary>
+        public string Message { get; set; }
+    }
+}

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

@@ -0,0 +1,69 @@
+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; }
+
+        public ICollection<FccTankInfo.FccTankInfo> FccTankInfo { 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; }
+    }
+
+
+}

+ 52 - 0
src/FccLife.Web/Domain/FccTankInfo/FccTankInfo.cs

@@ -0,0 +1,52 @@
+using FccLite.Web.Domain.FccNozzleInfo;
+using FccLite.Web.Domain.FccOilInfo;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace FccLite.Web.Domain.FccTankInfo
+{
+
+    [Table("qr_oil_tank")]
+    public class FccTankInfo
+    {
+        /// <summary>
+        /// 油罐id
+        /// </summary>
+        [Key]
+        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 油罐号
+        /// </summary>
+        public int Number { get; set; }
+
+        /// <summary>
+        /// 油罐容量
+        /// </summary>
+        public decimal Capacity { get; set; }
+
+        /// <summary>
+        /// 关联油品名
+        /// </summary>
+        public string? OilName { get; set; }
+
+        /// <summary>
+        /// 关联油品id
+        /// </summary>
+        [ForeignKey("Oil")]
+        public long? OilId { get; set; }
+
+        /// <summary>
+        /// 关联站点id
+        /// </summary>
+        [ForeignKey("Station")]
+        public long? StationId { get; set; }
+
+        public FccOilInfo.FccOilInfo? Oil { get; set; }
+
+        public FccStationInfo.FccStationInfo? Station { get; set; }
+
+        public ICollection<FccNozzleInfo.FccNozzleInfo> FccNozzleInfos { get; set; }
+    }
+}

+ 43 - 0
src/FccLife.Web/Domain/FccTankInfo/Input/AddTankInput.cs

@@ -0,0 +1,43 @@
+namespace FccLite.Web.Domain.FccTankInfo.Input
+{
+    public class AddTankInput
+    {
+        /// <summary>
+        /// 关联的油站id
+        /// </summary>
+        public long StationId { get; set; }
+
+        /// <summary>
+        /// 油罐号
+        /// </summary>
+        public int Number {  get; set; }
+
+        /// <summary>
+        /// 要关联的油品id
+        /// </summary>
+        public long OilId { get; set; }
+
+        /// <summary>
+        /// 要关联的油品名
+        /// </summary>
+        public String OilName { get; set; }
+
+        /// <summary>
+        /// 油罐容量
+        /// </summary>
+        public decimal Capacity { get; set; }
+
+        public FccTankInfo ToComponent()
+        {
+            return new FccTankInfo()
+            {
+                StationId = this.StationId,
+                Number = this.Number,
+                OilId = this.OilId,
+                OilName = this.OilName,
+                Capacity = this.Capacity
+            };
+        }
+
+    }
+}

+ 32 - 0
src/FccLife.Web/Domain/FccTankInfo/Input/UpdateTankInput.cs

@@ -0,0 +1,32 @@
+namespace FccLite.Web.Domain.FccTankInfo.Input
+{
+    public class UpdateTankInput
+    {
+        /// <summary>
+        /// 要修改的油罐对应的id
+        /// </summary>
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 油罐号
+        /// </summary>
+        public int Number { get; set; }
+
+        /// <summary>
+        /// 要关联的油品id
+        /// </summary>
+        public long? OilId { get; set; }
+
+        /// <summary>
+        /// 要关联的油品名
+        /// </summary>
+        public String? OilName { get; set; }
+
+        /// <summary>
+        /// 油罐容量
+        /// </summary>
+        public decimal Capacity { get; set; }
+
+        
+    }
+}

+ 44 - 0
src/FccLife.Web/Domain/FccTankInfo/Output/BaseTankInfoOutput.cs

@@ -0,0 +1,44 @@
+
+namespace FccLite.Web.Domain.FccTankInfo.Output
+{
+    public class BaseTankInfoOutput
+    {
+        /// <summary>
+        /// 油罐id
+        /// </summary>
+        public long Id {  get; set; }
+
+        /// <summary>
+        /// 油罐号
+        /// </summary>
+        public int Number { get; set; }
+
+        /// <summary>
+        /// 关联油品名
+        /// </summary>
+        public string? OilName { get; set; }
+
+        /// <summary>
+        /// 关联油品id
+        /// </summary>
+        public long? OilId { get; set; }
+
+        /// <summary>
+        /// 当前关联的油枪
+        /// </summary>
+        public List<AssociatedNozzle> AssociatedNozzles { get; set; }
+
+        public class AssociatedNozzle
+        {
+            /// <summary>
+            /// 油枪id
+            /// </summary>
+            public long NozzleId { get; set; }
+
+            /// <summary>
+            /// 油枪号
+            /// </summary>
+            public int NozzleNum { get; set; }
+        }
+    }
+}

+ 48 - 0
src/FccLife.Web/Domain/FccTankInfo/Output/DetailsTankInfoOutput.cs

@@ -0,0 +1,48 @@
+namespace FccLite.Web.Domain.FccTankInfo.Output
+{
+    public class DetailsTankInfoOutput
+    {
+        /// <summary>
+        /// 油罐id
+        /// </summary>
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 油罐号
+        /// </summary>
+        public int Number { get; set; }
+
+        /// <summary>
+        /// 当前关联的油品id
+        /// </summary>
+        public long? AssociatedOilId { get; set; }
+
+        /// <summary>
+        /// 当前关联的油品名
+        /// </summary>
+        public string? AssociatedOilName { get; set; }
+
+        /// <summary>
+        /// 油罐容量
+        /// </summary>
+        public decimal Capacity { get; set; }
+
+        /// <summary>
+        /// 可关联的油品
+        /// </summary>
+        public List<RelatableOil> RelatableOils { get; set; }
+
+        public class RelatableOil
+        {
+            /// <summary>
+            /// 油品id
+            /// </summary>
+            public long OilId { get; set; }
+
+            /// <summary>
+            /// 油品名
+            /// </summary>
+            public string OilName { get; set; }
+        }
+    }
+}

+ 19 - 0
src/FccLife.Web/Domain/FccTankInfo/Output/SetTankInfoOutput.cs

@@ -0,0 +1,19 @@
+namespace FccLite.Web.Domain.FccTankInfo.Output
+{
+    /// <summary>
+    /// 新增、修改、删除油罐结果
+    /// </summary>
+    public class SetTankInfoOutput
+    {
+        /// <summary>
+        /// 结果
+        /// </summary>
+        public Boolean Result { get; set; }
+
+
+        /// <summary>
+        /// 信息
+        /// </summary>
+        public String Message { get; set; }
+    }
+}

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

@@ -6,4 +6,17 @@
     <ImplicitUsings>enable</ImplicitUsings>
   </PropertyGroup>
 
+  <ItemGroup>
+    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
+    <PackageReference Include="NLog" Version="5.3.4" />
+    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
+    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Content Update="nlog.config">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+
 </Project>

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

@@ -1,6 +1,69 @@
+using FccLite.Web.Repositories.FccNozzleInfo;
+using FccLite.Web.Repositories.FccOilInfo;
+using FccLite.Web.Repositories.FccStationInfo;
+using FccLite.Web.Repositories.FccTankInfo;
+using FccLite.Web.Services.FccNozzleInfo;
+using FccLite.Web.Services.FccOilInfo;
+using FccLite.Web.Services.FccStaionInfo;
+using FccLite.Web.Services.FccTankInfo;
+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>();
+builder.Services.AddScoped<IOilInfoService, OilInfoServiceImpl>();
+builder.Services.AddScoped<IOilInfoReposity, OilInfoReposity>();
+builder.Services.AddScoped<ITankInfoService, TankInfoServiceImpl>();
+builder.Services.AddScoped<ITankReposity, TankReposity>();
+builder.Services.AddScoped<INozzleInfnService, NozzleInfoServiceImpl>();
+builder.Services.AddScoped<INozzleInfoReposity, NozzleInfoReposity>();
+
+//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();

+ 28 - 0
src/FccLife.Web/Repositories/FccNozzleInfo/INozzleInfoReposity.cs

@@ -0,0 +1,28 @@
+using FccLite.Web.Domain.FccNozzleInfo.Input;
+
+namespace FccLite.Web.Repositories.FccNozzleInfo
+{
+    public interface INozzleInfoReposity
+    {
+        /// <summary>
+        /// 根据油枪 id 找油枪信息
+        /// </summary>
+        /// <param name="id">油枪id</param>
+        /// <returns></returns>
+        Task<Domain.FccNozzleInfo.FccNozzleInfo?> GetNozzleInfoById(long id);
+
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="uploadNozzleInfoInput">油枪信息</param>
+        /// <returns></returns>
+        Task<int> UploadNozzleInfo(UploadNozzleInfoInput uploadNozzleInfoInput);
+
+        /// <summary>
+        /// 根据id 删除油枪信息
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<int> DeleteNozzleInfoById(long id);
+    }
+}

+ 76 - 0
src/FccLife.Web/Repositories/FccNozzleInfo/NozzleInfoReposity.cs

@@ -0,0 +1,76 @@
+using FccLite.Web.Domain.FccNozzleInfo.Input;
+using FccLite.Web.utils.database;
+using Microsoft.EntityFrameworkCore;
+
+namespace FccLite.Web.Repositories.FccNozzleInfo
+{
+    public class NozzleInfoReposity : INozzleInfoReposity
+    {
+        static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
+
+        private readonly MysqlDbContext _dbContext;
+
+        public NozzleInfoReposity(MysqlDbContext dbContext)
+        {
+            _dbContext = dbContext;
+        }
+
+        /// <summary>
+        /// 根据油枪 id 找油枪信息
+        /// </summary>
+        /// <param name="id">油枪id</param>
+        /// <returns></returns>
+        public async Task<Domain.FccNozzleInfo.FccNozzleInfo?> GetNozzleInfoById(long id)
+        {
+            return await _dbContext.NozzleInfos.FirstOrDefaultAsync(info => info.Id == id);
+        }
+
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="uploadNozzleInfoInput">油枪信息</param>
+        /// <returns></returns>
+        public async Task<int> UploadNozzleInfo(UploadNozzleInfoInput uploadNozzleInfoInput)
+        {
+            if(uploadNozzleInfoInput.Id != null)
+            {
+                Domain.FccNozzleInfo.FccNozzleInfo? fccNozzleInfo = await _dbContext.NozzleInfos.FirstOrDefaultAsync(info => info.Id == uploadNozzleInfoInput.Id);
+                if(fccNozzleInfo == null)
+                {
+                    Logger.Info($"find nozzle info with id : {uploadNozzleInfoInput.Id} for update, result is null");
+                    return 0;
+                }
+                fccNozzleInfo.MachineIp = uploadNozzleInfoInput.Ip;
+                fccNozzleInfo.FuelPoint = uploadNozzleInfoInput.FuelPoint;
+                fccNozzleInfo.InternalNum = uploadNozzleInfoInput.InternalNum;
+                fccNozzleInfo.ExternalNum = uploadNozzleInfoInput.NozzleNum;
+                fccNozzleInfo.TankId = uploadNozzleInfoInput.TankId;
+                fccNozzleInfo.TankNum = uploadNozzleInfoInput.TankNum;
+                
+                return await _dbContext.SaveChangesAsync();
+            }
+
+            Domain.FccNozzleInfo.FccNozzleInfo info = uploadNozzleInfoInput.ToComponent();
+            _dbContext.NozzleInfos.Add(info);
+            return await _dbContext.SaveChangesAsync();
+        }
+
+        /// <summary>
+        /// 根据id 删除油枪信息
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<int> DeleteNozzleInfoById(long id)
+        {
+            Domain.FccNozzleInfo.FccNozzleInfo? fccNozzleInfo = await _dbContext.NozzleInfos.FirstOrDefaultAsync(info => info.Id == id);
+            if (fccNozzleInfo == null)
+            {
+                Logger.Info($"find nozzle info with id : {id} for delete,result is null");
+                return 0;
+            }
+
+            _dbContext.NozzleInfos.Remove(fccNozzleInfo);
+            return await _dbContext.SaveChangesAsync();
+        }
+    }
+}

+ 39 - 0
src/FccLife.Web/Repositories/FccOilInfo/IOilInfoReposity.cs

@@ -0,0 +1,39 @@
+
+using FccLite.Web.Domain.FccOilInfo.Input;
+
+namespace FccLite.Web.Repositories.FccOilInfo
+{
+    public interface IOilInfoReposity
+    {
+        /// <summary>
+        /// 新增、更改油品信息
+        /// </summary>
+        /// <param name="oilInfoInput"></param>
+        /// <returns></returns>
+        Task<FccLite.Web.Domain.FccOilInfo.FccOilInfo> UploadOilInfo(OilInfoInput oilInfoInput);
+
+        /// <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>
+        Task<IEnumerable<FccLite.Web.Domain.FccOilInfo.FccOilInfo>> GetPage(int page, int size, long? id, string? name, int? code);
+
+        /// <summary>
+        /// 通过id 删除油品信息
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<Boolean> DeleteByID(long id);
+
+        /// <summary>
+        /// 获取所有油品
+        /// </summary>
+        /// <returns></returns>
+        Task<List<Domain.FccOilInfo.FccOilInfo>> GetOilInfo();
+    }
+}

+ 109 - 0
src/FccLife.Web/Repositories/FccOilInfo/OilInfoReposity.cs

@@ -0,0 +1,109 @@
+using FccLite.Web.Core.database;
+using FccLite.Web.Domain.FccOilInfo.Input;
+using FccLite.Web.utils.database;
+using Microsoft.EntityFrameworkCore;
+
+namespace FccLite.Web.Repositories.FccOilInfo
+{
+    public class OilInfoReposity : IOilInfoReposity
+    {
+        static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
+        private readonly MysqlDbContext _dbContext;
+        public OilInfoReposity(MysqlDbContext mysqlDbContext) 
+        {
+            _dbContext = mysqlDbContext;
+        }
+
+        /// <summary>
+        /// 通过id 删除油品信息
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<bool> DeleteByID(long id)
+        {
+            Domain.FccOilInfo.FccOilInfo? oilInfo = await _dbContext.OilInfos.FirstOrDefaultAsync(info => info.Id == id);
+            if (oilInfo == null)
+            {
+                Logger.Info($"find oil info with id:{id} for delete,result is null");
+                return false;
+            }
+            //批量将油罐关联的油品置为null
+            List<Domain.FccTankInfo.FccTankInfo> fccTankInfos = await _dbContext.TankInfos.Where(info => info.OilId == oilInfo.Id).ToListAsync();
+            foreach(var tank in fccTankInfos)
+            {
+                _dbContext.Entry(tank).State = EntityState.Modified;
+                tank.OilId = null;
+                tank.OilName = null;
+            }
+
+            _dbContext.OilInfos.Remove(oilInfo);
+            await _dbContext.SaveChangesAsync();
+            return true;
+        }
+
+        
+
+        /// <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>
+        public async Task<IEnumerable<Domain.FccOilInfo.FccOilInfo>> GetPage(int page, int size, long? id, string? name, int? code)
+        {
+            IQueryable<Domain.FccOilInfo.FccOilInfo> query = _dbContext.OilInfos.AsQueryable();
+
+            query = query.WhereIf(id != null, info => info.Id == id);
+            query = query.WhereIf(!string.IsNullOrEmpty(name), info => info.Name.Contains(name));
+            query = query.WhereIf(code != null, info => info.Code == code);
+
+            return await query.Skip((page - 1) * size).Take(size).ToListAsync();
+        }
+
+        /// <summary>
+        /// 新增、更改油品信息
+        /// </summary>
+        /// <param name="oilInfoInput"></param>
+        /// <returns></returns>
+        public async Task<Domain.FccOilInfo.FccOilInfo?> UploadOilInfo(OilInfoInput? oilInfoInput)
+        {
+            if (oilInfoInput == null)
+            {
+                Logger.Info($"oilInfoInput is null");
+                return null;
+            }
+            if(oilInfoInput.Id != null)
+            {
+                Domain.FccOilInfo.FccOilInfo? info = await _dbContext.OilInfos.FindAsync(oilInfoInput.Id);
+                if (info == null)
+                {
+                    Logger.Info($"find oil info with id: {oilInfoInput.Id} for update,result is null");
+                    return null;
+                }
+                info.Name = oilInfoInput.Name;
+                info.Code = oilInfoInput.Code;
+                info.Price = oilInfoInput.Price;
+                await _dbContext.SaveChangesAsync();
+                return info;
+            }
+            Domain.FccOilInfo.FccOilInfo fccOilInfo = oilInfoInput.ToComponent();
+            _dbContext.OilInfos.Add(fccOilInfo);
+            await _dbContext.SaveChangesAsync();
+            return fccOilInfo;
+        }
+
+
+        /// <summary>
+        /// 获取所有油品
+        /// </summary>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        public async Task<List<Domain.FccOilInfo.FccOilInfo>> GetOilInfo()
+        {
+            return await _dbContext.OilInfos.ToListAsync();
+        }
+    }
+}

+ 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);
+    }
+}

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

@@ -0,0 +1,116 @@
+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.Text.Json;
+using System.Xml.Linq;
+
+namespace FccLite.Web.Repositories.FccStationInfo
+{
+    public class StationRepository : IStationRepository
+    {
+        static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
+
+        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 || stationInfoInput.IsNotNorm())
+            {
+                Logger.Info($"stationInput not norm,it is {JsonSerializer.Serialize(stationInfoInput)}");
+                return null;
+            }
+            if (stationInfoInput.Id != null)
+            {
+                Domain.FccStationInfo.FccStationInfo? station = await _dbContext.FccStationInfos.FindAsync(stationInfoInput.Id);
+
+                if (station == null)
+                {
+                    Logger.Info($"find station info with id:{stationInfoInput.Id} for update,result is 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)
+            {
+                Logger.Info($"find station info with id:{id} for delete,result is null");
+                return false;
+            }
+            _dbContext.FccStationInfos.Remove(info);
+            _dbContext.SaveChanges();
+            return true;
+        }
+    }
+}

+ 51 - 0
src/FccLife.Web/Repositories/FccTankInfo/ITankReposity.cs

@@ -0,0 +1,51 @@
+using FccLite.Web.Domain.FccNozzleInfo.Output;
+using FccLite.Web.Domain.FccTankInfo;
+using FccLite.Web.Domain.FccTankInfo.Input;
+using FccLite.Web.Domain.FccTankInfo.Output;
+
+namespace FccLite.Web.Repositories.FccTankInfo
+{
+    public interface ITankReposity
+    {
+        /// <summary>
+        /// 统计站点 id 获取油罐基本信息
+        /// </summary>
+        /// <param name="stationId">站点id</param>
+        /// <returns></returns>
+        Task<List<BaseTankInfoOutput>> GetBaseTankByStationIdAsync(long stationId);
+
+        /// <summary>
+        /// 通过油罐id获取油罐详情信息
+        /// </summary>
+        /// <param name="tankId">油罐id</param>
+        /// <returns></returns>
+        Task<Domain.FccTankInfo.FccTankInfo?> GetDetailsTankByTankIdAsync(long tankId);
+
+        /// <summary>
+        /// 增加油罐
+        /// </summary>
+        /// <param name="addTankInput">油罐信息</param>
+        /// <returns></returns>
+        Task<int> AddDetailsTankAsync(AddTankInput addTankInput);
+
+        /// <summary>
+        /// 修改油罐
+        /// </summary>
+        /// <param name="updateTankInput">油罐信息</param>
+        /// <returns></returns>
+        Task<int> UpdateDetailsTankAsync(UpdateTankInput updateTankInput);
+
+        /// <summary>
+        /// 通过油罐id删除油罐
+        /// </summary>
+        /// <param name="id">油罐id</param>
+        /// <returns></returns>
+        Task<int> DeleteTankById(long id);
+
+        /// <summary>
+        /// 获取油罐id,油罐号
+        /// </summary>
+        /// <returns></returns>
+        Task<List<DetailsNozzleInfoOutput.RelatableTank>> GetTankInfo();
+    }
+}

+ 124 - 0
src/FccLife.Web/Repositories/FccTankInfo/TankReposity.cs

@@ -0,0 +1,124 @@
+using FccLite.Web.Domain.FccNozzleInfo.Output;
+using FccLite.Web.Domain.FccTankInfo.Input;
+using FccLite.Web.Domain.FccTankInfo.Output;
+using FccLite.Web.utils.database;
+using Microsoft.EntityFrameworkCore;
+
+namespace FccLite.Web.Repositories.FccTankInfo
+{
+    public class TankReposity : ITankReposity
+    {
+        static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
+
+        private readonly MysqlDbContext _dbContext;
+
+        public TankReposity(MysqlDbContext dbContext)
+        {
+            _dbContext = dbContext;
+        }
+
+        /// <summary>
+        /// 增加油罐
+        /// </summary>
+        /// <param name="addTankInput">油罐信息</param>
+        /// <returns></returns>
+        public async Task<int> AddDetailsTankAsync(AddTankInput addTankInput)
+        {
+            _dbContext.TankInfos.Add(addTankInput.ToComponent());
+            return await _dbContext.SaveChangesAsync();
+        }
+
+        /// <summary>
+        /// 通过油罐id删除油罐
+        /// </summary>
+        /// <param name="id">油罐id</param>
+        /// <returns></returns>
+        public async Task<int> DeleteTankById(long id)
+        {
+            Domain.FccTankInfo.FccTankInfo? tankInfo = await _dbContext.TankInfos.FirstOrDefaultAsync(info => info.Id == id);
+            if (tankInfo == null)
+            {
+                Logger.Info($"find tank info with id :{id} for delete,result is null");
+                return 0;
+            }
+            //先批量删除所关联的油枪
+            List<Domain.FccNozzleInfo.FccNozzleInfo> fccNozzleInfos = await _dbContext.NozzleInfos.Where(info => info.TankId == tankInfo.Id).ToListAsync();
+            _dbContext.NozzleInfos.RemoveRange(fccNozzleInfos);
+            //再删除油罐
+            _dbContext.TankInfos.Remove(tankInfo);
+            return await _dbContext.SaveChangesAsync();
+        }
+
+        /// <summary>
+        /// 统计站点 id 获取油罐基本信息
+        /// </summary>
+        /// <param name="stationId">站点id</param>
+        /// <returns></returns>
+        public async Task<List<BaseTankInfoOutput>> GetBaseTankByStationIdAsync(long stationId)
+        {
+            var query = from tank in _dbContext.TankInfos
+                        join nozzle in _dbContext.NozzleInfos
+                        on tank.Id equals nozzle.TankId
+                        into baseTankInfo
+                        select new BaseTankInfoOutput()
+                        {
+                            Id = tank.Id,
+                            Number = tank.Number,
+                            OilId = tank.OilId,
+                            OilName = tank.OilName,
+                            AssociatedNozzles = baseTankInfo.Select(info => new BaseTankInfoOutput.AssociatedNozzle()
+                            {
+                                NozzleId = info.Id,
+                                NozzleNum = info.ExternalNum
+                            }).ToList()
+                        };
+
+            return await query.ToListAsync();
+        }
+
+        /// <summary>
+        /// 通过油罐id获取油罐详情信息
+        /// </summary>
+        /// <param name="tankId">油罐id</param>
+        /// <returns></returns>
+        public async Task<Domain.FccTankInfo.FccTankInfo?> GetDetailsTankByTankIdAsync(long tankId)
+        {
+            return await _dbContext.TankInfos.FirstOrDefaultAsync(info => info.Id == tankId);
+        }
+
+        /// <summary>
+        /// 修改油罐
+        /// </summary>
+        /// <param name="updateTankInput">油罐信息</param>
+        /// <returns></returns>
+        public async Task<int> UpdateDetailsTankAsync(UpdateTankInput updateTankInput)
+        {
+            Domain.FccTankInfo.FccTankInfo? fccTankInfo = await _dbContext.TankInfos.FirstOrDefaultAsync(info => info.Id == updateTankInput.Id);
+            if (fccTankInfo == null)
+            {
+                Logger.Info($"find tank info with id : {updateTankInput.Id} for update,result is null");
+                return 0;
+            }
+
+            fccTankInfo.Number = updateTankInput.Number;
+            fccTankInfo.OilId = updateTankInput.OilId;
+            fccTankInfo.OilName = updateTankInput.OilName;
+            fccTankInfo.Capacity = updateTankInput.Capacity;
+
+            return await _dbContext.SaveChangesAsync();
+        }
+
+        /// <summary>
+        /// 获取油罐id,油罐号
+        /// </summary>
+        /// <returns></returns>
+        public async Task<List<DetailsNozzleInfoOutput.RelatableTank>> GetTankInfo()
+        {
+            return await _dbContext.TankInfos.Select(info => new DetailsNozzleInfoOutput.RelatableTank
+            {
+                TankId = info.Id,
+                TankNum = info.Number
+            }).ToListAsync();
+        }
+    }
+}

+ 29 - 0
src/FccLife.Web/Services/FccNozzleInfo/INozzleInfnService.cs

@@ -0,0 +1,29 @@
+using FccLite.Web.Domain.FccNozzleInfo.Input;
+using FccLite.Web.Domain.FccNozzleInfo.Output;
+
+namespace FccLite.Web.Services.FccNozzleInfo
+{
+    public interface INozzleInfnService
+    {
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="nozzleInfoInput">油枪信息</param>
+        /// <returns></returns>
+        Task<SetNozzleInfoOutput> UploadDetailsNozzleInfo(UploadNozzleInfoInput nozzleInfoInput);
+
+        /// <summary>
+        /// 根据id获取油枪信息
+        /// </summary>
+        /// <param name="id">油枪id</param>
+        /// <returns></returns>
+        Task<DetailsNozzleInfoOutput?> GetDetailsNozzleInfoById(long id);
+
+        /// <summary>
+        /// 根据油枪id删除油枪信息
+        /// </summary>
+        /// <param name="id">油枪id</param>
+        /// <returns></returns>
+        Task<SetNozzleInfoOutput> DeleteNozzleInfoByID(long id);
+    }
+}

+ 101 - 0
src/FccLife.Web/Services/FccNozzleInfo/NozzleInfoServiceImpl.cs

@@ -0,0 +1,101 @@
+using FccLite.Web.Domain.FccNozzleInfo.Input;
+using FccLite.Web.Domain.FccNozzleInfo.Output;
+using FccLite.Web.Repositories.FccNozzleInfo;
+using FccLite.Web.Repositories.FccTankInfo;
+
+namespace FccLite.Web.Services.FccNozzleInfo
+{
+    public class NozzleInfoServiceImpl : INozzleInfnService
+    {
+        static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
+
+        private readonly INozzleInfoReposity _nozzleInfoReposity;
+        private readonly ITankReposity _tankReposity;
+        public NozzleInfoServiceImpl(INozzleInfoReposity nozzleInfoReposity,ITankReposity tankReposity)
+        {
+            _nozzleInfoReposity = nozzleInfoReposity;
+            _tankReposity = tankReposity;
+        }
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="nozzleInfoInput">油枪信息</param>
+        /// <returns></returns>
+        public async Task<SetNozzleInfoOutput> UploadDetailsNozzleInfo(UploadNozzleInfoInput nozzleInfoInput)
+        {
+            int row = await _nozzleInfoReposity.UploadNozzleInfo(nozzleInfoInput);
+            Logger.Info($"upload nozzle info ,chage row {row}");
+            if(row > 0)
+            {
+                return new SetNozzleInfoOutput()
+                {
+                    Result = true,
+                    Message = "保存成功"
+                };
+            }
+
+            return new SetNozzleInfoOutput()
+            {
+                Result = false,
+                Message = "保存失败"
+            };
+        }
+
+        /// <summary>
+        /// 根据id获取油枪信息
+        /// </summary>
+        /// <param name="id">油枪id</param>
+        /// <returns></returns>
+        public async Task<DetailsNozzleInfoOutput?> GetDetailsNozzleInfoById(long id)
+        {
+            Domain.FccNozzleInfo.FccNozzleInfo? fccNozzleInfo = await _nozzleInfoReposity.GetNozzleInfoById(id);
+            if (fccNozzleInfo == null)
+            {
+                Logger.Info($"find nozzle Info with id {id} for details ,result is null");
+                return null;
+            }
+            List<DetailsNozzleInfoOutput.RelatableTank> tanks = await _tankReposity.GetTankInfo();
+            Logger.Info($"find all tanks info for nozzle info details,count is {tanks.Count}");
+
+            return new DetailsNozzleInfoOutput()
+            {
+                Id = fccNozzleInfo.Id,
+                NozzleNum = fccNozzleInfo.ExternalNum,
+                Ip = fccNozzleInfo.MachineIp,
+                FuelPoint = fccNozzleInfo.FuelPoint,
+                InternalNum = fccNozzleInfo.InternalNum,
+                TankId = fccNozzleInfo.TankId,
+                TankNum = fccNozzleInfo.TankNum,
+                RelatableTanks = tanks,
+            };
+            
+        }
+
+
+
+        /// <summary>
+        /// 根据油枪id删除油枪信息
+        /// </summary>
+        /// <param name="id">油枪id</param>
+        /// <returns></returns>
+        public async Task<SetNozzleInfoOutput> DeleteNozzleInfoByID(long id)
+        {
+            int row = await _nozzleInfoReposity.DeleteNozzleInfoById(id);
+            Logger.Info($"delete nozzle info ,chage row {row}");
+            if (row > 0)
+            {
+                return new SetNozzleInfoOutput()
+                {
+                    Result = true,
+                    Message = "删除成功"
+                };
+            }
+
+            return new SetNozzleInfoOutput()
+            {
+                Result = false,
+                Message = "删除失败"
+            };
+        }
+    }
+}

+ 33 - 0
src/FccLife.Web/Services/FccOilInfo/IOilInfoService.cs

@@ -0,0 +1,33 @@
+using FccLite.Web.Domain.FccOilInfo.Input;
+using FccLite.Web.Domain.FccOilInfo.Ouput;
+
+namespace FccLite.Web.Services.FccOilInfo
+{
+    public interface IOilInfoService
+    {
+        /// <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>
+        Task<OilInfoOutput> GetPage(int page, int size, long? id, string? name, int? code);
+
+        /// <summary>
+        /// 新增、修改油品信息
+        /// </summary>
+        /// <param name="oilInfoInput">油品信息</param>
+        /// <returns></returns>
+        Task<OilInfoSetOutput> Save(OilInfoInput oilInfoInput);
+
+        /// <summary>
+        /// 通过 id 删除油品信息
+        /// </summary>
+        /// <param name="id">id</param>
+        /// <returns></returns>
+        Task<OilInfoSetOutput> DeleteById(long id);
+    }
+}

+ 98 - 0
src/FccLife.Web/Services/FccOilInfo/OilInfoServiceImpl.cs

@@ -0,0 +1,98 @@
+using FccLite.Web.Domain.FccOilInfo.Input;
+using FccLite.Web.Domain.FccOilInfo.Ouput;
+using FccLite.Web.Repositories.FccOilInfo;
+using System.Text.Json;
+
+namespace FccLite.Web.Services.FccOilInfo
+{
+    public class OilInfoServiceImpl : IOilInfoService
+    {
+        static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
+        private readonly IOilInfoReposity _oilInfoReposity;
+        public OilInfoServiceImpl(IOilInfoReposity oilInfoReposity) 
+        {
+            _oilInfoReposity = oilInfoReposity;
+        }
+
+        /// <summary>
+        /// 通过 id 删除油品信息
+        /// </summary>
+        /// <param name="id">id</param>
+        /// <returns></returns>
+        public async Task<OilInfoSetOutput> DeleteById(long id)
+        {
+            bool result = await _oilInfoReposity.DeleteByID(id);
+            Logger.Info($"delete oil info by id result:{result}");
+            if (result)
+            {
+                return new OilInfoSetOutput()
+                {
+                    Result = true,
+                    Message = "删除成功"
+                };
+            }
+
+            return new OilInfoSetOutput()
+            {
+                Result = false,
+                Message = "删除失败"
+            };
+        }
+
+        /// <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>
+        public async Task<OilInfoOutput> GetPage(int page, int size, long? id, string? name, int? code)
+        {
+            IEnumerable<Domain.FccOilInfo.FccOilInfo> enumerable = await _oilInfoReposity.GetPage(page, size, id, name, code);
+
+            List<OilInfoOutput.OilInfo> oilInfos = enumerable.Select(info =>
+                new OilInfoOutput.OilInfo()
+                {
+                    Id = info.Id,
+                    Name = info.Name,
+                    Code = info.Code,
+                    Price = info.Price
+                }
+            ).ToList();
+
+            Logger.Info($"get page of oil info,count is {oilInfos.Count}");
+            return new OilInfoOutput()
+            {
+                Total = oilInfos.Count,
+                OilInfoList = oilInfos
+            };
+        }
+
+        /// <summary>
+        /// 新增、修改油品信息
+        /// </summary>
+        /// <param name="oilInfoInput">油品信息</param>
+        /// <returns></returns>
+        public async Task<OilInfoSetOutput> Save(OilInfoInput oilInfoInput)
+        {
+            Domain.FccOilInfo.FccOilInfo fccOilInfo = await _oilInfoReposity.UploadOilInfo(oilInfoInput);
+            Logger.Info($"add or update oil info,{JsonSerializer.Serialize(fccOilInfo)}");
+            if (fccOilInfo == null)
+            {
+                return new OilInfoSetOutput()
+                {
+                    Result = false,
+                    Message = "保存失败"
+                };
+            }
+
+            return new OilInfoSetOutput()
+            {
+                Result = true,
+                Message = "保存成功"
+            };
+        }
+    }
+}

+ 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);
+    }
+}

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

@@ -0,0 +1,109 @@
+using FccLite.Web.Domain.FccStationInfo.Input;
+using FccLite.Web.Domain.FccStationInfo.Output;
+using FccLite.Web.Repositories.FccStationInfo;
+using System.Text.Json;
+
+namespace FccLite.Web.Services.FccStaionInfo
+{
+    public class StationServiceImpl : IStationService
+    {
+        static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
+
+        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();
+            Logger.Info($"get staion info,count is {fccStationInfos.Count}");
+            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);
+            Logger.Info($"add or update result: {JsonSerializer.Serialize(info)}");
+            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);
+            Logger.Info($"deleted station info by id:{id},result = {result}");
+            if(result)
+            {
+                return new StationSetOutput()
+                {
+                    Result = true,
+                    Message = "删除成功"
+                };
+            }
+
+            return new StationSetOutput()
+            {
+                Result = false,
+                Message = "删除失败"
+            };
+        }
+
+
+    }
+}

+ 43 - 0
src/FccLife.Web/Services/FccTankInfo/ITankInfoService.cs

@@ -0,0 +1,43 @@
+using FccLite.Web.Domain.FccTankInfo.Input;
+using FccLite.Web.Domain.FccTankInfo.Output;
+
+namespace FccLite.Web.Services.FccTankInfo
+{
+    public interface ITankInfoService
+    {
+        /// <summary>
+        /// 统计站点 id 获取油罐基本信息
+        /// </summary>
+        /// <param name="stationId">站点id</param>
+        /// <returns></returns>
+        Task<List<BaseTankInfoOutput>> GetBaseTankByStationIdAsync(long stationId);
+
+        /// <summary>
+        /// 通过油罐id获取油罐详情信息
+        /// </summary>
+        /// <param name="tankId">油罐id</param>
+        /// <returns></returns>
+        Task<DetailsTankInfoOutput?> GetDetailsTankByTankIdAsync(long tankId);
+
+        /// <summary>
+        /// 增加油罐
+        /// </summary>
+        /// <param name="addTankInput">油罐信息</param>
+        /// <returns></returns>
+        Task<SetTankInfoOutput> AddDetailsTankAsync(AddTankInput addTankInput);
+
+        /// <summary>
+        /// 修改油罐
+        /// </summary>
+        /// <param name="updateTankInput">油罐信息</param>
+        /// <returns></returns>
+        Task<SetTankInfoOutput> UpdateDetailsTankAsync(UpdateTankInput updateTankInput);
+
+        /// <summary>
+        /// 通过油罐id删除油罐
+        /// </summary>
+        /// <param name="id">油罐id</param>
+        /// <returns></returns>
+        Task<SetTankInfoOutput> DeleteTankById(long id);
+    }
+}

+ 136 - 0
src/FccLife.Web/Services/FccTankInfo/TankInfoServiceImpl.cs

@@ -0,0 +1,136 @@
+using FccLite.Web.Domain.FccTankInfo.Input;
+using FccLite.Web.Domain.FccTankInfo.Output;
+using FccLite.Web.Repositories.FccOilInfo;
+using FccLite.Web.Repositories.FccTankInfo;
+
+namespace FccLite.Web.Services.FccTankInfo
+{
+    public class TankInfoServiceImpl : ITankInfoService
+    {
+        static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
+
+        private readonly ITankReposity _tankReposity;
+
+        private readonly IOilInfoReposity _oiilInfoReposity;
+        public TankInfoServiceImpl(ITankReposity tankReposity,IOilInfoReposity oilInfoReposity)
+        {
+            _tankReposity = tankReposity;
+            _oiilInfoReposity = oilInfoReposity;
+        }
+
+        /// <summary>
+        /// 通过站点 id 获取油罐基本信息
+        /// </summary>
+        /// <param name="stationId">站点id</param>
+        /// <returns></returns>
+        public async Task<List<BaseTankInfoOutput>> GetBaseTankByStationIdAsync(long stationId)
+        {
+            return await _tankReposity.GetBaseTankByStationIdAsync(stationId);
+        }
+
+        /// <summary>
+        /// 通过油罐id获取油罐详情信息
+        /// </summary>
+        /// <param name="tankId">油罐id</param>
+        /// <returns></returns>
+        public async Task<DetailsTankInfoOutput?> GetDetailsTankByTankIdAsync(long tankId)
+        {
+            Domain.FccTankInfo.FccTankInfo? fccTankInfo = await _tankReposity.GetDetailsTankByTankIdAsync(tankId);
+            if (fccTankInfo == null)
+            {
+                Logger.Info($"find tank info with id : {tankId} for details,result is null");
+                return null;
+            }
+
+            List<Domain.FccOilInfo.FccOilInfo> oilInfos = await _oiilInfoReposity.GetOilInfo();
+            List<DetailsTankInfoOutput.RelatableOil> relatableOils = oilInfos.Select(info => new DetailsTankInfoOutput.RelatableOil()
+            {
+                OilId = info.Id,
+                OilName = info.Name
+            }).ToList();
+            Logger.Info($"current oil info count is {relatableOils.Count}");
+
+            return new DetailsTankInfoOutput()
+            {
+                Id = fccTankInfo.Id,
+                Number = fccTankInfo.Number,
+                AssociatedOilId = fccTankInfo.OilId,
+                AssociatedOilName = fccTankInfo.OilName,
+                Capacity = fccTankInfo.Capacity,
+                RelatableOils = relatableOils
+            };
+        }
+
+        /// <summary>
+        /// 增加油罐
+        /// </summary>
+        /// <param name="addTankInput">油罐信息</param>
+        /// <returns></returns>
+        public async Task<SetTankInfoOutput> AddDetailsTankAsync(AddTankInput addTankInput)
+        {
+            int row = await _tankReposity.AddDetailsTankAsync(addTankInput);
+            Logger.Info($"add tank info change:{row}");
+            if(row > 0)
+            {
+                return new SetTankInfoOutput()
+                {
+                    Result = true,
+                    Message = "保存成功"
+                };
+            }
+            return new SetTankInfoOutput()
+            {
+                Result = false,
+                Message = "保存失败"
+            };
+        }
+
+        /// <summary>
+        /// 修改油罐
+        /// </summary>
+        /// <param name="updateTankInput">油罐信息</param>
+        /// <returns></returns>
+        public async Task<SetTankInfoOutput> UpdateDetailsTankAsync(UpdateTankInput updateTankInput)
+        {
+            int row = await _tankReposity.UpdateDetailsTankAsync(updateTankInput);
+            Logger.Info($"update tank info change:{row}");
+            if (row > 0)
+            {
+                return new SetTankInfoOutput()
+                {
+                    Result = true,
+                    Message = "保存成功"
+                };
+            }
+            return new SetTankInfoOutput()
+            {
+                Result = false,
+                Message = "保存失败"
+            };
+        }
+
+        /// <summary>
+        /// 通过油罐id删除油罐
+        /// </summary>
+        /// <param name="id">油罐id</param>
+        /// <returns></returns>
+        public async Task<SetTankInfoOutput> DeleteTankById(long id)
+        {
+            int row = await _tankReposity.DeleteTankById(id);
+            if (row > 0)
+            {
+                return new SetTankInfoOutput()
+                {
+                    Result = true,
+                    Message = "删除成功"
+                };
+            }
+
+            return new SetTankInfoOutput()
+            {
+                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"
   }
 }

+ 23 - 0
src/FccLife.Web/nlog.config

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+	<!-- 定义日志级别和规则 -->
+	<extensions>
+		<add assembly="NLog.Web.AspNetCore"/>
+	</extensions>
+
+	<targets>
+		<!-- 将日志写入文件 -->
+		<target xsi:type="File" name="file" archiveAboveSize="20480" archiveEvery="Day" archiveNumbering="Sequence" maxArchiveFiles="7" fileName="${basedir}/logs/nlog-${shortdate}.log"
+		layout="${date:format=HH\:mm\:ss.fff} [${threadid}:${level:uppercase=true}]${logger} - ${message} ${exception}" />
+
+		<!-- 将日志写入控制台 -->
+		<target xsi:type="Console" name="console" layout="${date:format=HH\:mm\:ss.fff} [${threadid}:${level:uppercase=true}]${logger} - ${message} ${exception}" />
+	</targets>
+
+	<rules>
+		<!-- 捕获所有级别的日志并将其写入文件和控制台 -->
+		<logger name="*" minlevel="Info" writeTo="file,console" />
+	</rules>
+</nlog>