Browse Source

feat:2025.02.04,导出订单表超时

Zhenghanjv 2 weeks ago
parent
commit
633482fe6d

+ 50 - 12
HengshanPaymentTerminal/HengshanPayTermHandler.cs

@@ -109,6 +109,8 @@ namespace HengshanPaymentTerminal
 
 
         //记录油枪状态,key-枪号,value:01:离线  02:锁枪  03:空闲  04:提枪  06:开始加油  08:加油中
         //记录油枪状态,key-枪号,value:01:离线  02:锁枪  03:空闲  04:提枪  06:开始加油  08:加油中
         private ConcurrentDictionary<int, int> nozzleStatusDic = new ConcurrentDictionary<int, int>(); 
         private ConcurrentDictionary<int, int> nozzleStatusDic = new ConcurrentDictionary<int, int>(); 
+        //记录需要更新二维码信息的油枪
+        private HashSet<int> needUpdateQRSet = new HashSet<int>();
         #endregion
         #endregion
 
 
         #region Logger
         #region Logger
@@ -858,15 +860,6 @@ namespace HengshanPaymentTerminal
             
             
             foreach (var item in nozzleInfoList)
             foreach (var item in nozzleInfoList)
             {
             {
-                //List<Byte> list = new List<Byte>();
-                //byte[] commandAndNozzle = { 0x63, (byte)item.NozzleNum };
-                //string qrCode = smallProgram + "/" + item.NozzleNum;
-                //byte[] qrCodeBytes = Encoding.ASCII.GetBytes(qrCode);
-                //list.AddRange(commandAndNozzle);
-                //list.Add((byte)qrCodeBytes.Length);
-                //list.AddRange(qrCodeBytes);
-                //byte[] sendBytes = content2data(list.ToArray(), null);
-
                 SendQrCode sendQrCode = new SendQrCode((int)item.CloundNozzleId,item.NozzleNum, smallProgram, getFrame(null));
                 SendQrCode sendQrCode = new SendQrCode((int)item.CloundNozzleId,item.NozzleNum, smallProgram, getFrame(null));
                 byte[] commandAndNozzle = { sendQrCode.Handle, (byte)sendQrCode.NozzleNum };
                 byte[] commandAndNozzle = { sendQrCode.Handle, (byte)sendQrCode.NozzleNum };
 
 
@@ -880,8 +873,6 @@ namespace HengshanPaymentTerminal
                     }
                     }
                     return false;
                     return false;
                 }, sendQrCode);
                 }, sendQrCode);
-                //CommonMessage commonMessage = await SendMessageToMaichine("发送二维码", BitConverter.ToString(commandAndNozzle).Replace("-", ""), sendQrCode);
-                //CommonMessage commonMessage = await SendRequestToMachine("发送二维码", BitConverter.ToString(commandAndNozzle).Replace("-", ""), sendBytes);
                 if (commonMessage.IsError && commonMessage.TheErrorType == CommonMessage.ErrorType.DISCONNECT) break;
                 if (commonMessage.IsError && commonMessage.TheErrorType == CommonMessage.ErrorType.DISCONNECT) break;
             }
             }
 
 
@@ -979,7 +970,8 @@ namespace HengshanPaymentTerminal
             sendAuthorizationResult.NozzleId = request.NozzleId;
             sendAuthorizationResult.NozzleId = request.NozzleId;
 
 
             //添加订单到数据库
             //添加订单到数据库
-            DateTime authorizationTime = request.AuthorizationTime ?? DateTime.Now;
+            //DateTime authorizationTime = request.AuthorizationTime ?? DateTime.Now;
+            DateTime authorizationTime = DateTime.Now;
             string paymentName = "未知类型";
             string paymentName = "未知类型";
             if (request.PaymentMethod != null)
             if (request.PaymentMethod != null)
             {
             {
@@ -1104,6 +1096,7 @@ namespace HengshanPaymentTerminal
             sendUnAuthorizationResult.NozzleId = request.NozzleId;
             sendUnAuthorizationResult.NozzleId = request.NozzleId;
             sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
             sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
             sendUnAuthorizationResult.TransactionID = request.Id;
             sendUnAuthorizationResult.TransactionID = request.Id;
+            sendUnAuthorizationResult.TransactionNumber = ttc.ToString();
 
 
             if (ttc != 0 && !isUnauthorization)
             if (ttc != 0 && !isUnauthorization)
             {
             {
@@ -1320,6 +1313,7 @@ namespace HengshanPaymentTerminal
             SendUnAuthorizationResult sendUnAuthorizationResult = new SendUnAuthorizationResult();
             SendUnAuthorizationResult sendUnAuthorizationResult = new SendUnAuthorizationResult();
             sendUnAuthorizationResult.NozzleId = fccOrderInfo.NozzleNum;
             sendUnAuthorizationResult.NozzleId = fccOrderInfo.NozzleNum;
             sendUnAuthorizationResult.TransactionID = fccOrderInfo.CloundOrderId;
             sendUnAuthorizationResult.TransactionID = fccOrderInfo.CloundOrderId;
+            sendUnAuthorizationResult.TransactionNumber = fccOrderInfo.Ttc.ToString();
             sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
             sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
 
 
             SendUnAuthorization sendUnAuthorization = new SendUnAuthorization(fccOrderInfo.NozzleNum, fccOrderInfo.AuthorizationTime, fccOrderInfo.Ttc, getFrame(null));
             SendUnAuthorization sendUnAuthorization = new SendUnAuthorization(fccOrderInfo.NozzleNum, fccOrderInfo.AuthorizationTime, fccOrderInfo.Ttc, getFrame(null));
@@ -1367,6 +1361,7 @@ namespace HengshanPaymentTerminal
 
 
             mysqlDbContext.SaveChanges();
             mysqlDbContext.SaveChanges();
 
 
+            logger.Info($"定时任务取消授权:发送结果:{JsonConvert.SerializeObject(sendUnAuthorizationResult)}");
             HttpResponseMessage httpResponseMessage = await httpClientUtil.SendUnAuthorizationResult(JsonConvert.SerializeObject(sendUnAuthorizationResult));
             HttpResponseMessage httpResponseMessage = await httpClientUtil.SendUnAuthorizationResult(JsonConvert.SerializeObject(sendUnAuthorizationResult));
             logger.Info($"定时任务取消授权:send Unauthorization timer result response:{JsonConvert.SerializeObject(httpResponseMessage.Content.ReadAsStringAsync())}");
             logger.Info($"定时任务取消授权:send Unauthorization timer result response:{JsonConvert.SerializeObject(httpResponseMessage.Content.ReadAsStringAsync())}");
 
 
@@ -1503,6 +1498,14 @@ namespace HengshanPaymentTerminal
             List<int> fuelingNozzle = new List<int>();
             List<int> fuelingNozzle = new List<int>();
             foreach (var nozzleState in heartBeatMessage.NozzleStatus)
             foreach (var nozzleState in heartBeatMessage.NozzleStatus)
             {
             {
+                //油机UI重启,重发二维码
+                if (nozzleState.STATU == 1) needUpdateQRSet.Add(nozzleState.NozzleNum);
+                if (nozzleState.STATU == 3 && needUpdateQRSet.Contains(nozzleState.NozzleNum))
+                {
+                    UpdateQRCode(nozzleState.NozzleNum);
+                    needUpdateQRSet.Remove(nozzleState.NozzleNum);
+                }
+
                 if (nozzleStatusDic.TryGetValue(nozzleState.NozzleNum, out var value))
                 if (nozzleStatusDic.TryGetValue(nozzleState.NozzleNum, out var value))
                 {
                 {
                     if (nozzleState.STATU == value) continue;
                     if (nozzleState.STATU == value) continue;
@@ -1556,6 +1559,41 @@ namespace HengshanPaymentTerminal
             
             
         }
         }
 
 
+        /// <summary>
+        /// 更新二维码信息
+        /// 油机ui进入配置后退出,会重启UI,此时需要重新发送二维码
+        /// </summary>
+        public async void UpdateQRCode(int nozzleNum)
+        {
+            string smallProgram = stationInfo?.SmallProgram ?? "";
+            if (string.IsNullOrEmpty(smallProgram))
+            {
+                logger.Info($"更新二维码信息:can not get smallProgram link");
+                return;
+            }
+
+            DetailsNozzleInfoOutput? item = nozzleInfoList.Find(nozzle => nozzle.NozzleNum == nozzleNum);
+            if (item == null)
+            {
+                logger.Error($"找不到{nozzleNum}号枪信息");
+                return;
+            }
+            SendQrCode sendQrCode = new SendQrCode((int)item.CloundNozzleId, item.NozzleNum, smallProgram, getFrame(null));
+            byte[] commandAndNozzle = { sendQrCode.Handle, (byte)sendQrCode.NozzleNum };
+
+            Thread.Sleep(5000);
+            CommonMessage commonMessage = await SendMessageToMaichine($"发送{sendQrCode.NozzleNum}号枪二维码", (request, response) =>
+            {
+                if (response.Handle == (byte)CommonMessage.Command.COMMON)
+                {
+                    CommonAnswerBack commonAnswerBack = (CommonAnswerBack)response;
+                    return commonAnswerBack.Command == (byte)CommonMessage.Command.SEND_QR_CODE && commonAnswerBack.NozzleNum == sendQrCode.NozzleNum;
+                }
+                return false;
+            }, sendQrCode);
+
+        }
+
         /// <summary>
         /// <summary>
         /// 获取发送帧号
         /// 获取发送帧号
         /// </summary>
         /// </summary>

+ 1 - 0
src/FccLife.Web/Controller/OrderInfoController.cs

@@ -39,6 +39,7 @@ namespace FccLite.Web.Controller
         {
         {
             logger.Info($"download after pay order excel:{JsonConvert.SerializeObject(orderInfoPageInput)}");
             logger.Info($"download after pay order excel:{JsonConvert.SerializeObject(orderInfoPageInput)}");
             byte[] fileBytes = await _orderInfoService.DownloadAfterPayOrderExcel(orderInfoPageInput);
             byte[] fileBytes = await _orderInfoService.DownloadAfterPayOrderExcel(orderInfoPageInput);
+            logger.Info($"导出后支付excel,数据长度:{fileBytes.Length}");
             return File(fileBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "orders.xlsx");
             return File(fileBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "orders.xlsx");
         }
         }
 
 

+ 1 - 1
src/FccLife.Web/Services/FccOrderInfo/OrderInfoService.cs

@@ -98,7 +98,7 @@ namespace FccLite.Web.Services.FccOrderInfo
             } catch(Exception e)
             } catch(Exception e)
             {
             {
                 Console.WriteLine(e);
                 Console.WriteLine(e);
-                Logger.Error(e.Message);
+                Logger.Error($"报错:{e.Message}");
             }
             }
 
 
             return new byte[0];
             return new byte[0];

+ 1 - 1
src/FccLife.Web/appsettings.Production.json

@@ -21,5 +21,5 @@
     "user": "HSClient",
     "user": "HSClient",
     "password": "HS202503"
     "password": "HS202503"
   },
   },
-  "Version": "2025.02.03"
+  "Version": "2025.02.04"
 }
 }

+ 1 - 1
src/FccWeb/admin.ui.plus-master/src/api/api.ts

@@ -205,7 +205,7 @@ export const getOrderFilter =(data:any)=>{
 //导出后支付订单excel
 //导出后支付订单excel
 export const downloadAfterpayOrder = (data:any) => {
 export const downloadAfterpayOrder = (data:any) => {
 	const send = axios.create({
 	const send = axios.create({
-		timeout: 5000, // 超时
+		timeout: 60000, // 超时
 		baseURL: import.meta.env.VITE_API_URL_FCC,
 		baseURL: import.meta.env.VITE_API_URL_FCC,
 	})
 	})
 	return send.post('/qrFueling/order/downloadOrderAfterPayOrderExcel', data, { responseType: 'arraybuffer' })
 	return send.post('/qrFueling/order/downloadOrderAfterPayOrderExcel', data, { responseType: 'arraybuffer' })