public static Dictionary <string, object> GetBatchList(int pageIndex, string stDate, string edDate, string batchId, string remark, string content, int sourceType, int channel) { Dictionary <string, object> dicData = MessageSysBLL.GetBatchList(pageIndex, stDate, edDate, batchId, remark, content, sourceType, channel);; if (dicData != null) { int rowCount = Convert.ToInt32(dicData["count"]); int maxPage = rowCount % 15 == 0 ? rowCount / 15 : (rowCount / 15 + 1); dicData["maxPage"] = maxPage; List <MessageBatch> list = (List <MessageBatch>)dicData["data"]; foreach (var item in list) { if (item.FeedBackArrive != 0) { item.OpenRatio = (Convert.ToDouble(item.FeedBackOpen) / item.FeedBackArrive * 100).ToString("F2") + "%"; } else { item.OpenRatio = "无数据"; } item.OperatorName = Sys_Manage_UserBLL.GetManageUserNameById(item.Operator); } } return(dicData); }
/// <summary> /// 后台HangFire调用定时任务 /// </summary> /// <param name="settingId"></param> public static void ExcuteTimerTask(int settingId) { //从后台任务列表获取到需要发送的记录 ConditionSettingModel.SettingModel model = ConditionSettingBLL.GetSendingTaskItem(settingId); string batchId = ""; if (string.IsNullOrEmpty(model.LatestBatchId)) { //从后台设置的任务生成消息批次 batchId = PreparePushingMsg(model.AccIdSet, model.AccIdCount, 3, model.MobileTitle, model.PubTitle, model.EmailTitle, model.SmsContent, model.MobileContent, model.PubContent, model.EmailContent, model.Remark + "(" + model.SendingDate + "定时发送)", model.Verification, "1"); //更新任务的批次Id防止重复提交 ConditionSettingBLL.SetBatchId(settingId, batchId); } else { batchId = model.LatestBatchId; } string uName = Sys_Manage_UserBLL.GetManageUserNameById(model.Operator); SendMsgAuto(batchId, model.Operator, uName); }
/// <summary> /// 后台HangFire调用循环任务 /// </summary> /// <param name="settingId"></param> public static void ExcuteRecurringTask(int settingId) { //从后台任务列表获取到需要发送的记录 ConditionSettingModel.SettingModel model = ConditionSettingBLL.GetSendingTaskItem(settingId); //获取循环任务的Sql List <string> sqlSet = CommonLib.Helper.JsonDeserializeObject <List <string> >(ConditionSettingBLL.GetSqlJsonById(settingId)); //拼装Sql组的字典 Dictionary <int, List <int> > dicData = new Dictionary <int, List <int> >(); for (int i = 0; i < sqlSet.Count; i++) { dicData[i] = RuleListBLL.GetAccIdByStr(sqlSet[i]); } #region 处理产生的集合并合并 if (dicData.Count > 0) { List <int> temp = dicData.First().Value; foreach (var item in dicData) { temp = temp.Intersect(item.Value).ToList(); } if (temp.Count > 0) { string accIdSet = CommonLib.Helper.JsonSerializeObject(temp); int accIdCount = temp.Count; //从后台设置的任务生成消息批次 string batchId = PreparePushingMsg(accIdSet, accIdCount, 4, model.MobileTitle, model.PubTitle, model.EmailTitle, model.SmsContent, model.MobileContent, model.PubContent, model.EmailContent, model.Remark + "(" + model.SendingDate + "循环定时发送)", model.Verification, "1"); //更新任务的批次Id防止重复提交 ConditionSettingBLL.SetBatchId(settingId, batchId); string uName = Sys_Manage_UserBLL.GetManageUserNameById(model.Operator); SendMsgAuto(batchId, model.Operator, uName); } } #endregion }
/// <summary> /// 获取需求列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="stDate"></param> /// <param name="edDate"></param> /// <param name="reqType"></param> /// <param name="status"></param> /// <param name="content"></param> /// <returns></returns> public static string GetRequireList(int pageIndex, string stDate, string edDate, int reqType, int status, string content, int terminal) { Dictionary <string, object> dicData = RequirementManageBLL.GetRequireList(pageIndex, stDate, edDate, reqType, status, content, terminal); if (dicData != null) { int rowCount = Convert.ToInt32(dicData["count"]); int maxPage = rowCount % 15 == 0 ? rowCount / 15 : (rowCount / 15 + 1); dicData["maxPage"] = maxPage; List <Model.RequirementManage> list = (List <Model.RequirementManage>)dicData["data"]; foreach (var item in list) { item.OpName = Sys_Manage_UserBLL.GetManageUserNameById(item.Operator); item.CateName = RequirementManageBLL.GetCateNameById(item.CategoryId); } } return (CommonLib.Helper.JsonSerializeObject(dicData, "yyyy-MM-dd HH:mm:ss")); }