Browse Source

PostMessageByWebhook_VisitToHR

jiangjc 6 months ago
parent
commit
03b798a654

+ 29 - 0
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Config.cs

@@ -200,6 +200,35 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 
 <font color='info'>请各位注意检查业务费用是否录入完整</font>
 
+[详细信息请前往OA系统查看](http://oa.pan-american-intl.com:4399/)  ", teamNames2);
+
+            return result;
+        }
+
+        /// <summary>
+        /// 团组出发前一周提醒HR
+        /// </summary>
+        /// <returns></returns>
+        public static string GroupRemindersToHR(List<Grp_DelegationInfo> list_7day)
+        {
+            string teamNames2 = "><font color='comment'>暂无</font>";
+
+            if (list_7day.Count > 0)
+            {
+                teamNames2 = "";
+                foreach (var item in list_7day)
+                {
+                    string startDt = item.VisitStartDate.ToString("yyyy-MM-dd");
+                    teamNames2 += ">(" + startDt + ")" + item.TeamName + " \n\n";
+                }
+            }
+
+
+            string result = string.Format(@" `团组行程提醒`  
+
+><font color='warning'> - 下列团组将于7天内出发:</font>
+{0}
+
 [详细信息请前往OA系统查看](http://oa.pan-american-intl.com:4399/)  ", teamNames2);
 
             return result;

+ 21 - 0
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Library.cs

@@ -646,6 +646,27 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 
         #endregion
 
+        #region 团组出发提醒(HR)
+
+        public static async Task<bool> SendUserMsg_DelegationVisit_ToHR(List<Grp_DelegationInfo> list_3day, List<string> userId)
+        {
+            //发送信息
+            List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
+            if (qwUserIdList.Count > 0)
+            {
+                ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.GroupRemindersToHR(list_3day));
+
+                if (result.errcode != 0)
+                {
+                    //抄送日志 
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        #endregion
+
         #region 市场部新增客户资源统计
 
         /// <summary>

+ 20 - 0
OASystem/OASystem.Api/OAMethodLib/Quartz/Business/DeleReminderMessage.cs

@@ -116,6 +116,26 @@ namespace OASystem.API.OAMethodLib.Quartz.Business
 
         }
 
+        public static async void PostMessageByWebhook_VisitToHR()
+        {
+            DateTime dtNow = DateTime.Now;
+            string now = dtNow.ToString("yyyy-MM-dd");
+            string add1day = dtNow.AddDays(1).ToString("yyyy-MM-dd"); 
+            string add7day = dtNow.AddDays(7).ToString("yyyy-MM-dd"); 
+
+            //string sql = string.Format(@" Select * From Grp_DelegationInfo With(Nolock) Where IsDel=0 And VisitEndDate ='{0}' Or VisitStartDate='{1}' ", add3day, add7day);
+            //List<Grp_DelegationInfo> list_source = _grpDeleRep._sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).ToList();
+
+            string sql7day = string.Format(@" Select * From Grp_DelegationInfo With(Nolock) where IsDel = 0 And VisitStartDate Between '{0} 00:00:00' And  '{1} 23:59:59' Order By VisitStartDate Asc ", add1day, add7day);
+
+            List<Grp_DelegationInfo> listAdd7day = _grpDeleRep._sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql7day).ToList();
+
+            List<string> temp = new List<string>() { "234", "309" };
+            //List<string> temp = new List<string>() { "234" };
+            await AppNoticeLibrary.SendUserMsg_DelegationVisit_ToHR(listAdd7day, temp);
+
+        }
+
         public static async void PostMessageByWebhook_CRMStatistics()
         {
             DateTime dtNow = DateTime.Now;

+ 1 - 0
OASystem/OASystem.Api/OAMethodLib/Quartz/Jobs/ALiYunPostMessageJob.cs

@@ -17,6 +17,7 @@ namespace QuzrtzJob.Factory
             //在此处编写任务业务代码
             DeleReminderMessage.PostMessageByWebhook();
             DeleReminderMessage.PostMessageByWebhook_CRMStatistics();
+            DeleReminderMessage.PostMessageByWebhook_VisitToHR();
             return Task.CompletedTask;
         }
     }