瀏覽代碼

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

leiy 1 年之前
父節點
當前提交
175eb1b5bc

+ 4 - 4
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -183,8 +183,8 @@ namespace OASystem.API.Controllers
             #region 应用推送
             try
             {
-                int dailyId = Convert.ToInt32(result.Data.dailyId);
-                int sign = Convert.ToInt32(result.Data.sign);
+                int dailyId = result.Data.GetType().GetProperty("dailyId").GetValue(result.Data, null);
+                int sign = result.Data.GetType().GetProperty("sign").GetValue(result.Data, null);
 
                 await AppNoticeLibrary.DailyPayReminders_Create_ToCaiwuChat(dailyId, sign, QiyeWeChatEnum.CaiWuChat);
             }
@@ -216,8 +216,8 @@ namespace OASystem.API.Controllers
             #region 应用推送
             try
             {
-                int dailyId = Convert.ToInt32(result.Data.dailyId);
-                int sign = Convert.ToInt32(result.Data.sign);
+                int dailyId = result.Data.GetType().GetProperty("dailyId").GetValue(result.Data, null);
+                int sign = result.Data.GetType().GetProperty("sign").GetValue(result.Data, null);
 
                 await AppNoticeLibrary.DailyPayReminders_Create_ToCaiwuChat(dailyId, sign, QiyeWeChatEnum.CaiWuChat);
             }

+ 14 - 14
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -2077,8 +2077,8 @@ namespace OASystem.API.Controllers
                 #region 应用推送
                 try
                 {
-                    int ccpId = Convert.ToInt32(groupData.Data.ccpId);
-                    int sign = Convert.ToInt32(groupData.Data.sign);
+                    int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
+                    int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
 
                     await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
                 }
@@ -2970,8 +2970,8 @@ namespace OASystem.API.Controllers
                 #region 应用推送
                 try
                 {
-                    int ccpId = Convert.ToInt32(groupData.Data.ccpId);
-                    int sign = Convert.ToInt32(groupData.Data.sign);
+                    int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
+                    int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
 
                     await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
                 }
@@ -3245,8 +3245,8 @@ namespace OASystem.API.Controllers
                 #region 应用推送
                 try
                 {
-                    int ccpId = Convert.ToInt32(groupData.Data.ccpId);
-                    int sign = Convert.ToInt32(groupData.Data.sign);
+                    int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
+                    int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
 
                     await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
                 }
@@ -5574,8 +5574,8 @@ namespace OASystem.API.Controllers
                 #region 应用推送
                 try
                 {
-                    int ccpId = Convert.ToInt32(groupData.Data.ccpId);
-                    int sign = Convert.ToInt32(groupData.Data.sign);
+                    int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
+                    int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
 
                     await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
                 }
@@ -5770,8 +5770,8 @@ namespace OASystem.API.Controllers
                 #region 应用推送
                 try
                 {
-                    int ccpId = Convert.ToInt32(groupData.Data.ccpId);
-                    int sign = Convert.ToInt32(groupData.Data.sign);
+                    int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
+                    int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
 
                     await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
                 }
@@ -9754,8 +9754,8 @@ namespace OASystem.API.Controllers
                 #region 应用推送
                 try
                 {
-                    int ccpId = Convert.ToInt32(data.Data.ccpId);
-                    int sign = Convert.ToInt32(data.Data.sign);
+                    int ccpId = data.Data.GetType().GetProperty("ccpId").GetValue(data.Data, null);
+                    int sign = data.Data.GetType().GetProperty("sign").GetValue(data.Data, null);
 
                     await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
                 }
@@ -10576,8 +10576,8 @@ namespace OASystem.API.Controllers
                 #region 应用推送
                 try
                 {
-                    int ccpId = Convert.ToInt32(groupData.Data.ccpId);
-                    int sign = Convert.ToInt32(groupData.Data.sign);
+                    int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
+                    int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
 
                     await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
                 }

+ 76 - 33
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Library.cs

@@ -13,6 +13,32 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 
         private static readonly DelegationInfoRepository _grpDeleRep = AutofacIocManager.Instance.GetService<DelegationInfoRepository>();
 
+        #region 获取企微Id
+
+        public static List<string> GetQiyeChatUserIdList(List<string> userId)
+        {
+            List<string> result = new List<string>();
+
+            try
+            {
+                foreach (string item in userId)
+                {
+                    int uid = int.Parse(item);
+                    Sys_Users users = _grpDeleRep.Query<Sys_Users>(s => s.Id == uid).First();
+                    if (!string.IsNullOrEmpty(users.QiyeChatUserId))
+                    {
+                        result.Add(users.QiyeChatUserId);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+            }
+            return result;
+        }
+
+        #endregion
+
         #region 确认出团
 
         /// <summary>
@@ -77,13 +103,17 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
             };
 
             //发送信息
-            ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(userId, MarkdownLib.GroupStatus_Create(info));
-            if (result.errcode != 0)
+            List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
+            if (qwUserIdList.Count > 0)
             {
-                //抄送日志 
-                return false;
-            }
+                ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(userId, MarkdownLib.GroupStatus_Create(info));
 
+                if (result.errcode != 0)
+                {
+                    //抄送日志 
+                    return false;
+                }
+            }
             return true;
         }
 
@@ -111,7 +141,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
             List<Grp_CreditCardPayment> entityList = _grpDeleRep
                    .Query<Grp_CreditCardPayment>(s => s.DIId == ccp.DIId && s.IsDel == 0 && s.CreateUserId > 0 && s.IsAuditGM == 0)
                    .ToList();
-            
+
             GroupStatus_ApplyFeeModel info = new GroupStatus_ApplyFeeModel()
             {
                 QueueCount = entityList.Count,
@@ -467,17 +497,21 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
             #endregion
 
             //发送信息
-            ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(userId, MarkdownLib.AuditResult_ApplyFee_User(info));
-            if (ccp.IsAuditGM == 1)
+            List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
+            if (qwUserIdList.Count > 0)
             {
-                await SendChatMsg_GroupStatus_AuditFee(Grp_CreditCardPaymentId, qwEnum);
-            }
-            if (result.errcode != 0)
-            {
-                //抄送日志 
-                return false;
-            }
+                ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(userId, MarkdownLib.AuditResult_ApplyFee_User(info));
 
+                if (ccp.IsAuditGM == 1)
+                {
+                    await SendChatMsg_GroupStatus_AuditFee(Grp_CreditCardPaymentId, qwEnum);
+                }
+                if (result.errcode != 0)
+                {
+                    //抄送日志 
+                    return false;
+                }
+            }
             return true;
         }
 
@@ -558,13 +592,17 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
             #endregion
 
             //发送信息
-            ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(userId, MarkdownLib.PayResult_Group_ToUser(info));
-            if (result.errcode != 0)
+            List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
+            if (qwUserIdList.Count > 0)
             {
-                //抄送日志 
-                return false;
-            }
+                ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(userId, MarkdownLib.PayResult_Group_ToUser(info));
 
+                if (result.errcode != 0)
+                {
+                    //抄送日志 
+                    return false;
+                }
+            }
             return true;
         }
 
@@ -603,7 +641,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 
             Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == fin_DailyFeePayment.CreateUserId).First();
             Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
-            string users = string.Format(@"{0}-{1}", user.CnName, job.JobName);
+            string users = string.Format(@"{0}-{1}", job.JobName, user.CnName );
 
             string[] companyArr = new string[] { "未知", "成都泛美商务有限公司", "四川泛美交流有限公司", "成都纽茵教育科技有限公司", "成都鸿企中元科技有限公司", "测试公司1" };
             string companyStr = "未知";
@@ -659,7 +697,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 
             Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == fin_DailyFeePayment.CreateUserId).First();
             Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
-            string users = string.Format(@"{0}-{1}", user.CnName, job.JobName);
+            string users = string.Format(@"{0}-{1}", job.JobName, user.CnName);
 
             string priceStr = fin_DailyFeePayment.SumPrice.ToString("#0.00");
 
@@ -702,12 +740,15 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
                 info.Result = "你有一笔日付申请未通过财务审核";
                 info.ResultColor = "warning";
             }
-
-            ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(userId, MarkdownLib.DailyPayReminder_Audit_ToUser(info));
-            if (result.errcode != 0)
+            List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
+            if (qwUserIdList.Count > 0)
             {
-                //抄送日志 
-                return false;
+                ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(userId, MarkdownLib.DailyPayReminder_Audit_ToUser(info));
+                if (result.errcode != 0)
+                {
+                    //抄送日志 
+                    return false;
+                }
             }
 
             return true;
@@ -728,14 +769,16 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
                 PriceName = fin_DailyFeePayment.Instructions,
                 Price = priceStr
             };
-
-            ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(userId, MarkdownLib.DailyPayReminder_Pay_ToUser(info));
-            if (result.errcode != 0)
+            List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
+            if (qwUserIdList.Count > 0)
             {
-                //抄送日志 
-                return false;
+                ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(userId, MarkdownLib.DailyPayReminder_Pay_ToUser(info));
+                if (result.errcode != 0)
+                {
+                    //抄送日志 
+                    return false;
+                }
             }
-
             return true;
         }
 

+ 2 - 2
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/QiYeWeChatApiService.cs

@@ -30,8 +30,8 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI
         private readonly string AddressBook_Corpsecret = "Y1tnjh7j-BvbqAytAoXZPUbmDR6dqLTL6mXtc6PZ7fo";  //通讯录同步 凭证密钥
         private readonly string Approve_AgentId = "3010040";     //审批 Id
         private readonly string Approve_Corpsecret = "k_Jo69Jw9Hqg_in-Rypbs30PNbxOYa1t4e-dxYuT-kw";  //审批 凭证密钥
-        private readonly string GroupStatus_AgentId = "1000008"; //团组状态通知 Id
-        private readonly string GroupStatus_Corpsecret = "7J_ST3jTPzbZpFwl7ttToTVufjEx6O2wuApvKHxt2Ak"; //团组状态通知Secret
+        private readonly string GroupStatus_AgentId = "1000008"; //OA通知 Id
+        private readonly string GroupStatus_Corpsecret = "7J_ST3jTPzbZpFwl7ttToTVufjEx6O2wuApvKHxt2Ak"; //OA通知Secret
 
         private readonly DateTime _1970 = new DateTime(1970, 1, 1, 0, 0, 0, 0);
         private readonly JobPostRepository _jobPostRep;