/// <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;
 }
示例#2
0
        /// <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="userList"></param>
 /// <param name="isEmail"></param>
 /// <returns></returns>
 private IDictionary<Int64, string> GetAuthorDcit(IList<Int64> userList, Int64 JournalID, bool isEmail)
 {
     if (isEmail)
     {
         AuthorInfoQuery query = new AuthorInfoQuery();
         query.AuthorIDs = userList.Distinct().ToArray();
         query.JournalID = JournalID;
         query.PageSize = userList.Count;
         query.CurrentPage = 1;
         AuthorFacadeAPIService service = new AuthorFacadeAPIService();
         var list = service.GetAuthorList(query).ItemList;
         if (list == null || list.Count == 0)
             return null;
         return list.Where(p => !string.IsNullOrWhiteSpace(p.LoginName))
             .ToDictionary(p => p.AuthorID, q => q.LoginName);
     }
     else
     {
         AuthorDetailQuery query = new AuthorDetailQuery();
         query.AuthorIDs = userList.Distinct().ToArray();
         query.JournalID = JournalID;
         query.PageSize = userList.Count;
         query.CurrentPage = 1;
         AuthorPlatformFacadeAPIService service = new AuthorPlatformFacadeAPIService();
         var list = service.GetAuthorDetailList(query);
         return list.Where(p => !string.IsNullOrWhiteSpace(p.Mobile))
             .Where(p => p.Mobile.IsMobilePhone())
             .ToDictionary(p => p.AuthorID, q => q.Mobile);
     }
 }