/// <summary> /// 批量保存缴费通知数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult BatchSavePayNotice(IList<PayNoticeEntity> list) { ExecResult result = new ExecResult(); if (list != null && list.Count > 0) { HttpClientHelper clientHelper = new HttpClientHelper(); result = clientHelper.Post<ExecResult, IList<PayNoticeEntity>>(GetAPIUrl(APIConstant.PAYNOTICE_BATCHSAVE), list); if (result.result == EnumJsonResult.success.ToString()) { int index = 0; string returnData = string.Empty; foreach (var model in list) { SiteConfigFacadeAPIService service = new SiteConfigFacadeAPIService(); MessageRecodeEntity logModel = new MessageRecodeEntity(); logModel.MsgType = 1; logModel.JournalID = model.JournalID; logModel.SendUser = model.SendUser; logModel.MsgTitle = model.Title; logModel.MsgContent = model.Body; logModel.CID = model.CID; if (model.PayType == 1) logModel.SendType = -3; else if (model.PayType == 2) logModel.SendType = -4; IList<Int64> userList = new List<Int64>() { model.AuthorID }; var emailResult = service.SendEmailOrSms(userList, logModel); index++; returnData = emailResult.msg; if (model.IsSms && !string.IsNullOrWhiteSpace(model.SmsContent)) { logModel.MsgType = 2; logModel.MsgContent = model.SmsContent; var smsResult = service.SendEmailOrSms(userList, logModel); result.msg += smsResult.msg; } } result.msg += returnData + "共计通知 " + index + " 人"; } } return result; }
/// <summary> /// 获取菜单列表,带有权限标示 /// </summary> /// <param name="query"></param> /// <returns></returns> public IList<TreeModel> GetHaveRightMenu(RoleMenuQuery queryRoleMenu) { if (queryRoleMenu.GroupID == 2) { MenuQuery query = new MenuQuery(); query.JournalID = queryRoleMenu.JournalID; query.GroupID = 2; query.Status = 1; return GetTreeNodeList(query); } # region 找到内容菜单,添加栏目列表 Func<IList<TreeModel>> funcGetSiteChanneNodes = () => { IList<TreeModel> channelTreeList = new List<TreeModel>(); SiteChannelQuery channelQuery = new SiteChannelQuery(); channelQuery.JournalID = queryRoleMenu.JournalID; channelQuery.Status = 1; SiteConfigFacadeAPIService siteConfigAPIService = new SiteConfigFacadeAPIService(); channelTreeList = siteConfigAPIService.GetSiteChannelTreeList(channelQuery,true); TreeModel root = channelTreeList.Single(p => p.Id == 0); return root.children; }; # endregion IList<TreeModel> listResult = new List<TreeModel>(); HttpClientHelper clientHelper = new HttpClientHelper(); // 给指定的作者设置了例外的菜单 IDictionary<long, string> dictExceptionRightMenu = new Dictionary<long, string>(); if (queryRoleMenu.AuthorID != null) { AuthorMenuRightExceptionEntity authorExecEntity = new AuthorMenuRightExceptionEntity(); authorExecEntity.AuthorID = queryRoleMenu.AuthorID.Value; authorExecEntity.JournalID = queryRoleMenu.JournalID; dictExceptionRightMenu = clientHelper.PostAuth<IDictionary<long, string>, AuthorMenuRightExceptionEntity>(GetAPIUrl(APIConstant.SYSGETAUTHOREXCEPTIONRIGHTMENU), authorExecEntity); } IList<MenuEntity> listHaveRightMenuList = clientHelper.Post<IList<MenuEntity>, RoleMenuQuery>(GetAPIUrl(APIConstant.SYSGETHAVERIGHTMENULIST), queryRoleMenu); if (listHaveRightMenuList != null) { IList<MenuEntity> listRoot = listHaveRightMenuList.Where(item => item.PMenuID == 0).ToList<MenuEntity>(); TreeModel treeNode = null; foreach (MenuEntity item in listRoot) { if (!dictExceptionRightMenu.ContainsKey(item.MenuID)) { bool first = true; treeNode = new TreeModel(); treeNode.key = item.MenuID.ToString(); treeNode.text = item.MenuName; treeNode.url = SiteConfig.RootPath + item.MenuUrl; treeNode.icon = SiteConfig.RootPath + item.IconUrl; treeNode.isexpand = queryRoleMenu.IsExpend; IList<MenuEntity> listChild = listHaveRightMenuList.Where(p => p.PMenuID == item.MenuID).ToList<MenuEntity>(); if (listChild != null) { treeNode.isexpand = (first != queryRoleMenu.IsExpend) && first ? first : queryRoleMenu.IsExpend; // 二级 foreach (MenuEntity itemChild in listChild) { if (!dictExceptionRightMenu.ContainsKey(itemChild.MenuID)) { TreeModel treeChildNode = new TreeModel(); treeChildNode.key = itemChild.MenuID.ToString(); treeChildNode.text = itemChild.MenuName; treeChildNode.url = SiteConfig.RootPath + itemChild.MenuUrl; treeChildNode.icon = SiteConfig.RootPath + itemChild.IconUrl; treeChildNode.isexpand = queryRoleMenu.IsExpend; // 如果是网站内容管理节点,则载入站点栏目设置 if (itemChild.IsContentMenu) { treeChildNode.children = funcGetSiteChanneNodes(); treeNode.children.Add(treeChildNode); } else { treeNode.children.Add(treeChildNode); // 三级 IList<MenuEntity> lastListChild = listHaveRightMenuList.Where(p => p.PMenuID == itemChild.MenuID).ToList<MenuEntity>(); foreach (MenuEntity lastChild in lastListChild) { if (!dictExceptionRightMenu.ContainsKey(lastChild.MenuID)) { TreeModel treeLastNode = new TreeModel(); treeLastNode.key = lastChild.MenuID.ToString(); treeLastNode.text = lastChild.MenuName; treeLastNode.url = SiteConfig.RootPath + lastChild.MenuUrl; treeLastNode.icon = SiteConfig.RootPath + lastChild.IconUrl; treeLastNode.isexpand = queryRoleMenu.IsExpend; treeChildNode.children.Add(treeLastNode); } } } } } first = false; } listResult.Add(treeNode); } } } return listResult; }
/// <summary> /// 投稿 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult SaveContributionInfo(ContributionInfoEntity model) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult result = clientHelper.Post<ExecResult, ContributionInfoEntity>(GetAPIUrl(APIConstant.CONTRIBUTIONINFO_SAVE), model); if (result.result.Equals(EnumJsonResult.success.ToString()) && model.CID == 0 && model.Status != -1)//新投稿,不是草稿 { #region 投稿回执 Action action = () => { try { SiteConfigFacadeAPIService service = new SiteConfigFacadeAPIService(); MessageTemplateQuery queryTemp = new MessageTemplateQuery(); queryTemp.JournalID = model.JournalID; queryTemp.TCategory = -5;//回执 var tempList = service.GetMessageTempList(queryTemp).ToList(); if (tempList == null) return; var EmailModel = tempList.Find(p => p.TType == 1); var SmsModel = tempList.Find(p => p.TType == 2); if (EmailModel == null && SmsModel == null) return; MessageRecodeEntity LogModel = new MessageRecodeEntity(); LogModel.JournalID = model.JournalID; LogModel.SendType = -5; LogModel.SendUser = model.AuthorID; IDictionary<string, string> dict = service.GetEmailVariable(); var user = new AuthorFacadeAPIService().GetAuthorInfo(new AuthorInfoQuery() { JournalID = model.JournalID, AuthorID = model.AuthorID }); dict["${接收人}$"] = user.RealName; dict["${邮箱}$"] = user.LoginName; dict["${手机}$"] = user.Mobile; dict["${稿件编号}$"] = result.resultStr; dict["${稿件标题}$"] = model.Title; dict["$稿件主键$"] = result.resultID.ToString(); ExecResult execResult = new ExecResult(); if (EmailModel != null) { LogModel.MsgType = 1; execResult = service.SendEmailOrSms(new Dictionary<Int64, IDictionary<string, string>>() { { model.AuthorID, dict } }, LogModel); } if (SmsModel != null) { LogModel.MsgType = 2; execResult = service.SendEmailOrSms(new Dictionary<Int64, IDictionary<string, string>>() { { model.AuthorID, dict } }, LogModel); } if (!execResult.result.Equals(EnumJsonResult.success.ToString())) throw new Exception(execResult.msg); } catch (Exception ex) { LogProvider.Instance.Error("发送投稿回执失败,稿件编码【" + result.resultStr + "】:" + ex.ToString()); } }; action.BeginInvoke(null, null); #endregion } return result; }
/// <summary> /// 保存缴费通知数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult SavePayNotice(PayNoticeEntity model) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult result = clientHelper.Post<ExecResult, PayNoticeEntity>(GetAPIUrl(APIConstant.PAYNOTICE_SAVE), model); if (result.result == EnumJsonResult.success.ToString()) { SiteConfigFacadeAPIService service = new SiteConfigFacadeAPIService(); MessageRecodeEntity logModel = new MessageRecodeEntity(); logModel.MsgType = 1; logModel.JournalID = model.JournalID; logModel.SendUser = model.SendUser; logModel.MsgTitle = model.Title; logModel.MsgContent = model.Body; logModel.CID = model.CID; if (model.PayType == 1) logModel.SendType = -3; else if (model.PayType == 2) logModel.SendType = -4; IList<Int64> userList = new List<Int64>() { model.AuthorID }; var emailResult = service.SendEmailOrSms(userList, logModel); result.msg += emailResult.msg; if (model.IsSms && !string.IsNullOrWhiteSpace(model.SmsContent)) { logModel.MsgType = 2; logModel.MsgContent = model.SmsContent; var smsResult = service.SendEmailOrSms(userList, logModel); result.msg += smsResult.msg; } } return result; }
/// <summary> /// 获取缴费通知实体 /// </summary> /// <param name="query"></param> /// <returns></returns> public PayNoticeEntity GetPayNoticeModel(PayNoticeQuery query) { PayNoticeEntity model = null; try { if (query.NoticeID > 0) { HttpClientHelper clientHelper = new HttpClientHelper(); model = clientHelper.Post<PayNoticeEntity, PayNoticeQuery>(GetAPIUrl(APIConstant.PAYNOTICE_GETMODEL), query); } if (model == null) { model = new PayNoticeEntity(); model.JournalID = query.JournalID; model.PayType = query.PayType.Value; model.CID = query.CID.Value; SiteConfigFacadeAPIService service = new SiteConfigFacadeAPIService(); MessageTemplateEntity temp = null; if (model.PayType == 1) temp = service.GetMessageTemplate(model.JournalID, -3, 1); else if (model.PayType == 2) temp = service.GetMessageTemplate(model.JournalID, -4, 1); if (temp != null) model.Body = temp.TContent; if (!string.IsNullOrWhiteSpace(model.Body)) { AuthorPlatformFacadeAPIService authorService = new AuthorPlatformFacadeAPIService(); ContributionInfoQuery authorQuery = new ContributionInfoQuery(); authorQuery.JournalID = model.JournalID; authorQuery.CID = model.CID; authorQuery.IsAuxiliary = false; var contribution = authorService.GetContributionInfoModel(authorQuery); if (contribution != null) { IDictionary<string, string> dict = service.GetEmailVariable(); var user = new AuthorFacadeAPIService().GetAuthorInfo(new AuthorInfoQuery() { JournalID = model.JournalID, AuthorID = contribution.AuthorID }); if (!query.IsBatch) { dict["${接收人}$"] = user.RealName; dict["${邮箱}$"] = user.LoginName; dict["${手机}$"] = user.Mobile; dict["${稿件编号}$"] = contribution.CNumber; dict["${稿件标题}$"] = contribution.Title; model.Body = service.GetEmailOrSmsContent(dict, service.GetSiteConfig(model.JournalID), model.Body); } else { query.AuthorName = user.RealName; query.LoginName = user.LoginName; query.Mobile = user.Mobile; query.CNumber = contribution.CNumber; query.Title = contribution.Title; } } } } } catch (Exception ex) { LogProvider.Instance.Error("获取通知单失败:" + ex.ToString()); model = new PayNoticeEntity(); model.JournalID = query.JournalID; model.PayType = query.PayType.Value; model.CID = query.CID.Value; } return model; }