From c3b14901031d985ef750027d4952264369a1d7b0 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 02 三月 2026 10:26:21 +0800
Subject: [PATCH] 1
---
WebAPI/Service/GeTuiService.cs | 89 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 81 insertions(+), 8 deletions(-)
diff --git a/WebAPI/Service/GeTuiService.cs b/WebAPI/Service/GeTuiService.cs
index 164895e..4dab471 100644
--- a/WebAPI/Service/GeTuiService.cs
+++ b/WebAPI/Service/GeTuiService.cs
@@ -9,6 +9,7 @@
using Newtonsoft.Json;
using com.igetui.api.openservice.igetui.template;
using com.igetui.api.openservice.igetui;
+using System.Collections.Concurrent;
namespace WebAPI.Service
{
@@ -28,6 +29,9 @@
// 鎺ㄩ�佹湇鍔″疄渚�
private static IGtPush push = new IGtPush(HOST, APPKEY, MASTERSECRET);
+ private static Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+
+
// 鍗曟潯娑堟伅鎺ㄩ��
public static void PubishSingle(int HInterID)
{
@@ -42,29 +46,96 @@
select * from Gy_UserClientIdRelation
", "h_v_OA_WorkLinkBillAllList");
NotificationTemplate template = null;
+ ConcurrentDictionary<string, List<string>> userClientIDDictionary = new ConcurrentDictionary<string, List<string>>();
+ // 灏嗙敤鎴疯澶囧叧鑱旇〃 鏀堕泦涓� Map
+ if (ds.Tables[1].Rows.Count > 0)
+ {
+ foreach (DataRow row in ds.Tables[1].Rows)
+ {
+ if (userClientIDDictionary.ContainsKey(row["HUserName"].ToString())){
+ userClientIDDictionary[row["HUserName"].ToString()].Add(row["HClientID"].ToString());
+ }
+ else
+ {
+ userClientIDDictionary.TryAdd(row["HUserName"].ToString(), new List<string>() { row["HClientID"].ToString() });
+ }
+ }
+ }
if(ds.Tables[0].Rows.Count > 0)
{
string title = ds.Tables[0].Rows[0]["涓婚"].ToString();
string content = ds.Tables[0].Rows[0]["鍐呭"].ToString();
template = GetNotificationTemplate(title, content, "/pages/ZLGL/OA_WorkLink/OA_WorkLinkBillQuery", "0"); // 璺宠浆鍒板伐浣滆仈绯诲崟鏌ヨ椤甸潰
+ bool pushSuccess = false;
// 骞挎挱
if(ds.Tables[0].Rows[0]["鍙戦�佺被鍨�"].ToString() == "鍏叡")
{
- // 閬嶅巻 鍏ㄦ帹閫�
- foreach(DataRow row in ds.Tables[1].Rows)
+ string sReturn = "";
+ if (oSystemParameter.ShowBill(ref sReturn) == true)
{
- PushMessageToSingle(template, row["HClientID"].ToString());
+ if (oSystemParameter.omodel.WMS_CampanyName == "鍗庤垷")
+ {
+ // 鎺ㄩ�佺粰鎺ユ敹浜� 鍜� 鎶勯�佷汉
+ foreach (DataRow row in ds.Tables[0].Rows)
+ {
+ List<string> clientIDList = new List<string>();
+ if (userClientIDDictionary.ContainsKey(row["鎺ユ敹浜�"].ToString()))
+ {
+ clientIDList = userClientIDDictionary[row["鎺ユ敹浜�"].ToString()];
+ }
+ else if (userClientIDDictionary.ContainsKey(row["鎶勯�佹帴鏀朵汉"].ToString()))
+ {
+ clientIDList = userClientIDDictionary[row["鎶勯�佹帴鏀朵汉"].ToString()];
+ }
+
+
+ foreach(string clientID in clientIDList)
+ {
+ pushSuccess = PushMessageToSingle(template, clientID);
+
+ }
+ }
+ }
+ else
+ {
+ // 閬嶅巻 鍏ㄦ帹閫�
+ foreach (DataRow row in ds.Tables[1].Rows)
+ {
+ pushSuccess = PushMessageToSingle(template, row["HClientID"].ToString());
+ }
+ }
}
}else // 鍗曠嫭鎺ㄩ��
{
// 鎺ㄩ�佺粰鎺ユ敹浜� 鍜� 鎶勯�佷汉
- foreach (DataRow row in ds.Tables[1].Rows)
+ foreach (DataRow row in ds.Tables[0].Rows)
{
- if(ds.Tables[0].Rows[0]["鎺ユ敹浜�"].ToString() == row["HUserName"].ToString()
- || ds.Tables[0].Rows[0]["鎶勯�佹帴鏀朵汉"].ToString() == row["HUserName"].ToString())
- PushMessageToSingle(template, row["HClientID"].ToString());
+ List<string> clientIDList = new List<string>();
+ if (userClientIDDictionary.ContainsKey(row["鎺ユ敹浜�"].ToString()))
+ {
+ clientIDList = userClientIDDictionary[row["鎺ユ敹浜�"].ToString()];
+ }
+ else if (userClientIDDictionary.ContainsKey(row["鎶勯�佹帴鏀朵汉"].ToString()))
+
+ {
+ clientIDList = userClientIDDictionary[row["鎶勯�佹帴鏀朵汉"].ToString()];
+ }
+
+
+ foreach (string clientID in clientIDList)
+ {
+ pushSuccess = PushMessageToSingle(template, clientID);
+
+ }
}
+ }
+
+ if(!pushSuccess)
+ {
+ // 涓帹 鎺ㄩ�佷笉鎴愬姛(鍐呯綉鐜) 浣跨敤webSocket杩涜鎺ㄩ��
+ // TODO: 浣跨敤 rabbitMQ 瀹炵幇娑堟伅闃熷垪
+ // WebSocketServer.PushOne(HInterID);
}
}
}
@@ -76,7 +147,7 @@
}
// 鍗曟帹 浣跨敤閫氱煡娑堟伅妯″瀷
- private static void PushMessageToSingle(NotificationTemplate template, string ClientID)
+ private static bool PushMessageToSingle(NotificationTemplate template, string ClientID)
{
IGtPush push = new IGtPush(HOST, APPKEY, MASTERSECRET);
@@ -100,6 +171,7 @@
LogService.Write("-----------------------------------------------");
LogService.Write("-----------------------------------------------");
LogService.Write("----------------鏈嶅姟绔繑鍥炵粨鏋滐細" + pushResult);
+ return true;
}
catch (RequestException e)
{
@@ -109,6 +181,7 @@
LogService.Write("-----------------------------------------------");
LogService.Write("-----------------------------------------------");
LogService.Write("----------------鏈嶅姟绔繑鍥炵粨鏋滐細" + pushResult);
+ return false;
}
}
--
Gitblit v1.9.1