Sfoglia il codice sorgente

feat:1、站点信息接口添加支付类型;2、增加查询站点和支付类型接口;3、订单信息增加支付方式,支付用户或手机号过滤条件,信息增加油站、支付方式、支付用户名、手机号信息

Zhenghanjv 5 mesi fa
parent
commit
9f70860343

+ 15 - 0
Edge.Core/Domain/FccOrderInfo/FccOrderInfo.cs

@@ -96,6 +96,21 @@ namespace Edge.Core.Domain.FccOrderInfo
         /// 是否删除——0:否;1:是
         /// </summary>
         public int IsDelete { get; set; }
+
+        /// <summary>
+        /// 支付用户名
+        /// </summary>
+        public string UserName { get; set; }
+
+        /// <summary>
+        /// 手机号
+        /// </summary>
+        public string PhoneNumber { get; set; }
+
+        /// <summary>
+        /// 支付类型名称
+        /// </summary>
+        public string PaymentName { get; set; }
     }
 
 }

+ 9 - 9
Edge.Core/Domain/FccOrderInfo/Input/OrderInfoPageInput.cs

@@ -41,14 +41,14 @@ namespace Edge.Core.Domain.FccOrderInfo.Input
         /// </summary>
         public DateTime? endCheckTime { get; set; }
 
-        ///// <summary>
-        ///// 流水号
-        ///// </summary>
-        //public int? ttc { get; set; }
-
-        ///// <summary>
-        ///// 支付状态
-        ///// </summary>
-        //public int? paymentStatus { get; set; }
+        /// <summary>
+        /// 支付类型
+        /// </summary>
+        public string? paymentType { get; set; }
+
+        /// <summary>
+        /// 手机号或支付用户名
+        /// </summary>
+        public string? phoneNumberOruserName { get; set; }
     }
 }

+ 30 - 12
Edge.Core/Domain/FccOrderInfo/Output/OrderInfoOutput.cs

@@ -26,19 +26,23 @@ namespace Edge.Core.Domain.FccOrderInfo.Output
         public OrderInfo(FccOrderInfo fccOrderInfo)
         {
             this.Id = fccOrderInfo.Id;
-            this.CloundOrderId = fccOrderInfo.CloundOrderId;
             this.Ttc = fccOrderInfo.Ttc;
+            this.AuthorizationTime = fccOrderInfo.AuthorizationTime;
+            this.EndTime = fccOrderInfo.EndTime;
+            this.PaymentTime = fccOrderInfo.PaymentTime;
             this.NozzleNum = fccOrderInfo.NozzleNum;
             this.OilName = fccOrderInfo.OilName;
+            this.PaymentStatus = fccOrderInfo.PaymentStatus;
+            this.PayType = fccOrderInfo.PayType;
+            this.CloundOrderId = fccOrderInfo.CloundOrderId;
             this.Amount = fccOrderInfo.Amount;
             this.Volume = fccOrderInfo.Volume;
             this.AmountPayable = fccOrderInfo.AmountPayable;
             this.Price = fccOrderInfo.Price;
-            this.AuthorizationTime = fccOrderInfo.AuthorizationTime;
-            this.EndTime = fccOrderInfo.EndTime;
-            this.PaymentTime = fccOrderInfo.PaymentTime;
-            this.PaymentStatus = fccOrderInfo.PaymentStatus;
-            this.PayType = fccOrderInfo.PayType;
+            this.RefundAmount = fccOrderInfo.RefundAmount;
+            this.UserName = fccOrderInfo.UserName;
+            this.PhoneNumber = fccOrderInfo.PhoneNumber;
+            this.PaymentName = fccOrderInfo.PaymentName;
         }
         /// <summary>
         /// 订单id
@@ -111,14 +115,25 @@ namespace Edge.Core.Domain.FccOrderInfo.Output
         public decimal Price { get; set; }
 
         /// <summary>
-        /// 是否已上传云端—— 0:未上传;1:已上传;2:不需要上传
+        /// 退款金额
+        /// </summary>
+        public decimal? RefundAmount { get; set; }
+
+        /// <summary>
+        /// 用户名
+        /// </summary>
+        public string UserName { get; set; }
+
+
+        /// <summary>
+        /// 手机号
         /// </summary>
-        public int UploadState { get; set; }
+        public string PhoneNumber { get; set; }
 
         /// <summary>
-        /// 是否删除——0:否;1:是
+        /// 支付类型名称
         /// </summary>
-        public int IsDelete { get; set; }
+        public string PaymentName { get; set; }
 
         public FccOrderInfo ToComponent()
         {
@@ -136,8 +151,11 @@ namespace Edge.Core.Domain.FccOrderInfo.Output
                 Amount = this.Amount,
                 Volume = this.Volume,
                 AmountPayable = this.AmountPayable,
-                UploadState = this.UploadState,
-                IsDelete = this.IsDelete
+                Price = this.Price,
+                RefundAmount =  this.RefundAmount,
+                UserName = this.UserName,
+                PhoneNumber = this.PhoneNumber,
+                PaymentName = this.PaymentName
             };
         }
     }

+ 37 - 0
Edge.Core/Domain/FccStationInfo/Output/OrderFilterOutput.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Edge.Core.Domain.FccStationInfo.Output
+{
+    /// <summary>
+    /// 订单过滤条件输出
+    /// </summary>
+    public class OrderFilterOutput
+    {
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public List<PaymentType> payments { get; set; }
+
+        /// <summary>
+        /// 站点
+        /// </summary>
+        public string stations { get; set; }
+    }
+
+    public class PaymentType
+    {
+        /// <summary>
+        /// 支付类型id
+        /// </summary>
+        public long id { get; set; }
+
+        /// <summary>
+        /// 支付类型名称
+        /// </summary>
+        public string paymentName { get; set; }
+    }
+}

+ 1 - 0
HengshanPaymentTerminal/HengshanPayTermHandler.cs

@@ -841,6 +841,7 @@ namespace HengshanPaymentTerminal
                 return;
             }
             fccOrderInfo.AmountPayable = request.ActualPaymentAmount;
+            fccOrderInfo.PaymentTime = request.TransactionTime;
             fccOrderInfo.PaymentStatus = 1;
             MysqlDbContext.SaveChanges();
 

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

@@ -71,6 +71,17 @@ namespace FccLite.Web.Controller
 
         }
 
+        /// <summary>
+        /// 获取订单过滤条件
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("getOrderFilter")]
+        public async Task<IActionResult> GetOrderFilter()
+        {
+            OrderFilterOutput orderFilterOutput = await _stationService.GetOrderFilter();
+            return Ok(orderFilterOutput);
+        }
+
         /// <summary>
         /// 分页获取油品信息
         /// </summary>

+ 5 - 0
src/FccLife.Web/Repositories/FccOrderInfo/IOrderInfoReposity.cs

@@ -5,6 +5,11 @@ namespace FccLite.Web.Repositories.FccOrderInfo
 {
     public interface IOrderInfoReposity
     {
+        /// <summary>
+        /// 分页查询订单
+        /// </summary>
+        /// <param name="orderInfoPageInput"></param>
+        /// <returns></returns>
         Task<IEnumerable<Edge.Core.Domain.FccOrderInfo.FccOrderInfo>> GetPage(OrderInfoPageInput orderInfoPageInput);
     }
 }

+ 7 - 0
src/FccLife.Web/Repositories/FccOrderInfo/OrderInfoReposity.cs

@@ -13,6 +13,11 @@ namespace FccLite.Web.Repositories.FccOrderInfo
             _dbContext = mysqlDbContext;
         }
 
+        /// <summary>
+        /// 分页查询订单
+        /// </summary>
+        /// <param name="orderInfoPageInput"></param>
+        /// <returns></returns>
         public async Task<IEnumerable<Edge.Core.Domain.FccOrderInfo.FccOrderInfo>> GetPage(OrderInfoPageInput orderInfoPageInput)
         {
             IQueryable<Edge.Core.Domain.FccOrderInfo.FccOrderInfo> query = _dbContext.FccOrderInfos.AsQueryable();
@@ -25,6 +30,8 @@ namespace FccLite.Web.Repositories.FccOrderInfo
             {
                 query = query.Where(order => order.EndTime != null && (order.EndTime >= orderInfoPageInput.startCheckTime && order.EndTime <= orderInfoPageInput.endCheckTime));
             }
+            query = query.WhereIf(orderInfoPageInput.paymentType != null, order => order.PaymentName.Equals(orderInfoPageInput.paymentType));
+            query = query.WhereIf(orderInfoPageInput.phoneNumberOruserName != null, order => order.UserName.Equals(orderInfoPageInput.phoneNumberOruserName) || order.PhoneNumber.Equals(orderInfoPageInput.phoneNumberOruserName));
             return await query.Skip((orderInfoPageInput.page - 1) * orderInfoPageInput.pageSize).Take(orderInfoPageInput.pageSize).ToListAsync();
         }
     }

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

@@ -1,4 +1,5 @@
 using Edge.Core.Domain.FccStationInfo.Input;
+using Edge.Core.Domain.FccStationInfo.Output;
 
 namespace FccLite.Web.Repositories.FccStationInfo
 {
@@ -36,5 +37,11 @@ namespace FccLite.Web.Repositories.FccStationInfo
         /// <param name="id">id</param>
         /// <returns>站点信息</returns>
         Task<Boolean> DeleteByID(long id);
+
+        /// <summary>
+        /// 获取第一个站点信息
+        /// </summary>
+        /// <returns></returns>
+        Task<Edge.Core.Domain.FccStationInfo.FccStationInfo?> GetFirstStation();
     }
 }

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

@@ -1,5 +1,6 @@
 using Edge.Core.Core.database;
 using Edge.Core.Domain.FccStationInfo.Input;
+using Edge.Core.Domain.FccStationInfo.Output;
 using Microsoft.AspNetCore.Cors.Infrastructure;
 using Microsoft.EntityFrameworkCore;
 using System.Net;
@@ -113,5 +114,14 @@ namespace FccLite.Web.Repositories.FccStationInfo
             _dbContext.SaveChanges();
             return true;
         }
+
+        /// <summary>
+        /// 获取第一个站点
+        /// </summary>
+        /// <returns></returns>
+        public async Task<Edge.Core.Domain.FccStationInfo.FccStationInfo?> GetFirstStation()
+        {
+            return await _dbContext.FccStationInfos.FirstOrDefaultAsync();
+        }
     }
 }

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

@@ -30,5 +30,11 @@ namespace FccLite.Web.Services.FccStaionInfo
         /// <param name="id">站点id</param>
         /// <returns></returns>
         Task<StationSetOutput> DeleteBaseInfo(long id);
+
+        /// <summary>
+        /// 获取订单过滤信息
+        /// </summary>
+        /// <returns></returns>
+        Task<OrderFilterOutput> GetOrderFilter();
     }
 }

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

@@ -94,6 +94,51 @@ namespace FccLite.Web.Services.FccStaionInfo
             };
         }
 
+        /// <summary>
+        /// 获取订单过滤信息
+        /// </summary>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        public async Task<OrderFilterOutput> GetOrderFilter()
+        {
+            FccStationInfo? fccStationInfo = await _stationRepository.GetFirstStation();
+            List<PaymentType> paymentTypes = new List<PaymentType>();
+
+            if (fccStationInfo == null)
+            {
+                return new OrderFilterOutput()
+                {
+                    payments = paymentTypes,
+                    stations = string.Empty
+                };
+            }
 
+            
+            string paymentType = fccStationInfo.PaymentType;
+            string[] paymentGround = paymentType.Split(",");
+            foreach (var item in paymentGround)
+            {
+                string[] payment = item.Split("+");
+                if (payment.Length == 2)
+                {
+                    if (long.TryParse(payment[0], out long id))
+                    {
+                        PaymentType type = new PaymentType()
+                        {
+                            id = id,
+                            paymentName = payment[1]
+                        };
+                        paymentTypes.Add(type);
+                    }
+                }
+            }
+
+
+            return new OrderFilterOutput()
+            {
+                payments = paymentTypes,
+                stations = fccStationInfo.Name
+            };
+        }
     }
 }