/// <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); }
/// <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); }