public ExecResult Del(MessageTemplateQuery query)
 {
     ExecResult execResult = new ExecResult();
     IMessageTemplateService service = ServiceContainer.Instance.Container.Resolve<IMessageTemplateService>();
     Int64[] TemplateIDs = query.TemplateIDs;
     if (TemplateIDs == null)
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "没有删除任何数据!";
         return execResult;
     }
     string msg = query.TType == 2 ? "短信模版" : "邮件模版";
     bool result = service.BatchDeleteMessageTemplate(TemplateIDs);
     if (result)
     {
         execResult.result = EnumJsonResult.success.ToString();
         execResult.msg = "删除" + msg + "成功!";
     }
     else
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "删除" + msg + "失败!";
     }
     return execResult;
 }
示例#2
0
 public ActionResult GetList(MessageTemplateQuery query)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     query.JournalID = CurAuthor.JournalID;
     query.TType = 2;
     IList<MessageTemplateEntity> list = service.GetMessageTempList(query);
     return Json(new { list });
 }
示例#3
0
 public ActionResult Delete(Int64[] TemplateIDs)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     MessageTemplateQuery query = new MessageTemplateQuery();
     query.JournalID = CurAuthor.JournalID;
     query.TType = 2;
     query.TemplateIDs = TemplateIDs;
     ExecResult result = service.DelMessageTemp(query);
     return Json(new { result = result.result, msg = result.msg });
 }
示例#4
0
 public ActionResult GetPageList(MessageTemplateQuery query)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     query.JournalID = CurAuthor.JournalID;
     query.TType = 2;
     query.CurrentPage = Convert.ToInt32(Request.Params["page"]);
     query.PageSize = Convert.ToInt32(Request.Params["pagesize"]);
     Pager<MessageTemplateEntity> pager = service.GetMessageTempPageList(query);
     return Json(new { Rows = pager.ItemList, Total = pager.TotalRecords });
 }
 public MessageTemplateEntity GetModel(MessageTemplateQuery query)
 {
     IMessageTemplateService service = ServiceContainer.Instance.Container.Resolve<IMessageTemplateService>();
     MessageTemplateEntity model = null;
     if (query.ModelType == 1)
         model = service.GetMessageTemplate(query.JournalID, query.TCategory.Value, query.TType.Value);
     else
         model = service.GetMessageTemplate(query.TemplateID.Value);
     return model;
 }
 /// <summary>
 /// 获取邮件短信模版实体
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public MessageTemplateEntity GetMessageTempModel(MessageTemplateQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     MessageTemplateEntity model = clientHelper.Post<MessageTemplateEntity, MessageTemplateQuery>(GetAPIUrl(APIConstant.MESSAGETEMP_GETMODEL), query);
     return model;
 }
 public IList<MessageTemplateEntity> GetList(MessageTemplateQuery query)
 {
     IMessageTemplateService service = ServiceContainer.Instance.Container.Resolve<IMessageTemplateService>();
     IList<MessageTemplateEntity> list = service.GetMessageTemplateList(query);
     return list;
 }
 public Pager<MessageTemplateEntity> GetPageList(MessageTemplateQuery query)
 {
     IMessageTemplateService service = ServiceContainer.Instance.Container.Resolve<IMessageTemplateService>();
     Pager<MessageTemplateEntity> pager = service.GetMessageTemplatePageList(query);
     return pager;
 }
 public IDictionary<int, string> GetTCategoryDictChecked(MessageTemplateQuery query)
 {
     IMessageTemplateService service = ServiceContainer.Instance.Container.Resolve<IMessageTemplateService>();
     return service.GetTCategoryDcit(query.JournalID, query.TType.Value, true);
 }
 /// <summary>
 /// 删除邮件短信模版
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public ExecResult DelMessageTemp(MessageTemplateQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult result = clientHelper.Post<ExecResult, MessageTemplateQuery>(GetAPIUrl(APIConstant.MESSAGETEMP_DEL), query);
     return result;
 }
示例#11
0
        /// <summary>
        /// 审稿单
        /// </summary>
        /// <param name="ActionID">当前所做操作ID</param>
        /// <param name="StatusID">当前状态</param>
        /// <param name="CIDS">稿件ID,多个稿件ID用逗号分隔</param>
        /// <returns></returns>
        public ActionResult AuditBill(long ActionID, long StatusID, string CIDS)
        {
            //继续送交
            int IsContinueSubmit = 0;
            int ActionType = 0;//操作类型:标识继续送交/继续送专家复审
            if (ActionID == 0)
            {
                ActionType = 0;
                ISiteConfigFacadeService facadeService = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
                DictEntity dicteEntity = facadeService.GetDictModelByKey(new DictQuery() { JournalID = CurAuthor.JournalID, DictKey = "MoreSubmit" });
                if (dicteEntity != null)
                {
                    IsContinueSubmit = 1;
                    ISiteConfigFacadeService currentService = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
                    IList<DictValueEntity> list = currentService.GetDictValueList(new DictValueQuery() { JournalID = CurAuthor.JournalID, DictKey = dicteEntity.DictKey });
                    if (list != null && list.Count > 0)
                    {
                        DictValueEntity entity = list.Single<DictValueEntity>();
                        if (entity != null)
                        {
                            ActionID = entity.ValueID;
                        }
                    }
                }
                else
                {
                    IsContinueSubmit = -1;
                }
            }

            //继续送复审
            int IsContinueReSubmit = 0;
            if (ActionID == -1)
            {
                ActionType = -1;
                ISiteConfigFacadeService facadeService = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
                DictEntity dicteEntity = facadeService.GetDictModelByKey(new DictQuery() { JournalID = CurAuthor.JournalID, DictKey = "MoreReSubmit" });
                if (dicteEntity != null)
                {
                    IsContinueReSubmit = 1;
                    ISiteConfigFacadeService currentService = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
                    IList<DictValueEntity> list = currentService.GetDictValueList(new DictValueQuery() { JournalID = CurAuthor.JournalID, DictKey = dicteEntity.DictKey });
                    if (list != null && list.Count > 0)
                    {
                        DictValueEntity entity = list.Single<DictValueEntity>();
                        if (entity != null)
                        {
                            ActionID = entity.ValueID;
                        }
                    }
                }
                else
                {
                    IsContinueReSubmit = -1;
                }

            }

            //新加实体
            SiteConfigQuery SiteConfigQuery = new SiteConfigQuery();
            SiteConfigQuery.JournalID = CurAuthor.JournalID;
            ISiteConfigFacadeService SiteConfigService = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
            SiteConfigEntity model = SiteConfigService.GetSiteConfigModel(SiteConfigQuery);
            if (model == null)
                model = new SiteConfigEntity();
            CirculationEntity cirEntity = new CirculationEntity();
            cirEntity.ActionID = ActionID;
            cirEntity.JournalID = JournalID;
            cirEntity.StatusID = StatusID;
            IDictionary<long, long> dictCIDMap = new Dictionary<long, long>();
            string[] CIDArray = CIDS.Split(',');
            long CID = 0;
            long FlowLogID = 0;
            foreach (string CIDLogID in CIDArray)
            {
                if (!string.IsNullOrEmpty(CIDLogID))
                {
                    string[] CIDANDLogID = CIDLogID.Split(':');
                    CID = TypeParse.ToLong(CIDANDLogID[0]);
                    FlowLogID = TypeParse.ToLong(CIDANDLogID[1]);
                    if (!dictCIDMap.ContainsKey(CID) && CID > 0)
                    {
                        dictCIDMap.Add(CID, FlowLogID);
                    }
                }
            }
            cirEntity.CIDS = string.Join(",", dictCIDMap.Keys);
            cirEntity.DictLogID = dictCIDMap;
            IFlowFacadeService flowService = ServiceContainer.Instance.Container.Resolve<IFlowFacadeService>();
            FlowStep flowStepInfo = flowService.GetNextFlowStep(cirEntity);

            # region 让当前用户排第一个

            if (flowStepInfo.FlowAuthorList != null)
            {
                WKT.Model.AuthorInfoEntity curEditor = null;
                foreach (WKT.Model.AuthorInfoEntity item in flowStepInfo.FlowAuthorList)
                {
                    if (item.AuthorID == CurAuthor.AuthorID)
                    {
                        curEditor = item;
                        break;
                    }
                }
                if (curEditor != null)
                {
                    flowStepInfo.FlowAuthorList.Remove(curEditor);
                    flowStepInfo.FlowAuthorList.Insert(0, curEditor);
                }
            }

            # endregion

            flowStepInfo.DictLogID = dictCIDMap;
            ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
            MessageTemplateQuery query = new MessageTemplateQuery();
            query.JournalID = CurAuthor.JournalID;
            query.TType = 1;
            if (flowStepInfo.FlowAction != null)
            {
                if (flowStepInfo.FlowAction.EmailTemplate > 0)
                {
                    query.TemplateID = flowStepInfo.FlowAction.EmailTemplate;
                    flowStepInfo.EmailTemplate = service.GetMessageTempModel(query);
                    if (CIDArray.Length == 1)//仅选择一篇稿件处理时,替换其中的稿件编号/标题变量为具体内容
                        flowStepInfo.EmailTemplate.TContent = ReplaceContent(CID,flowStepInfo.EmailTemplate.TContent);
                }
                if (flowStepInfo.FlowAction.SMSTemplate > 0)
                {
                    query.TType = 2;
                    query.TemplateID = flowStepInfo.FlowAction.SMSTemplate;
                    flowStepInfo.SMSTemplate = service.GetMessageTempModel(query);
                    if (CIDArray.Length == 1)
                        flowStepInfo.SMSTemplate.TContent = ReplaceContent(CID, flowStepInfo.SMSTemplate.TContent);
                }
            }
            else
            {
                flowStepInfo.FlowAction = new FlowActionEntity { ActionID = -1, ActionType = 1, ActionRoleID = 0 };
                flowStepInfo.FlowConfig = new FlowConfigEntity();
            }
            ViewBag.StatusID = StatusID;
            ViewBag.ActionType = ActionType;
            ViewBag.IsContinueSubmit = IsContinueSubmit;
            ViewBag.IsContinueReSubmit = IsContinueReSubmit;
            return View(flowStepInfo);
        }
 /// <summary>
 /// 获取邮件短信模版分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<MessageTemplateEntity> GetMessageTempPageList(MessageTemplateQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     Pager<MessageTemplateEntity> pager = clientHelper.Post<Pager<MessageTemplateEntity>, MessageTemplateQuery>(GetAPIUrl(APIConstant.MESSAGETEMP_GETPAGELIST), query);
     return pager;
 }
 /// <summary>
 /// 获取邮件短信模版数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<MessageTemplateEntity> GetMessageTempList(MessageTemplateQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     IList<MessageTemplateEntity> list = clientHelper.Post<IList<MessageTemplateEntity>, MessageTemplateQuery>(GetAPIUrl(APIConstant.MESSAGETEMP_GETLIST), query);
     return list;
 }
 /// <summary>
 /// 将查询实体转换为Where语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Where语句,不包含Where</returns>
 /// </summary>
 public string MessageTemplateQueryToSQLWhere(MessageTemplateQuery query)
 {
     StringBuilder strFilter = new StringBuilder(" JournalID=" + query.JournalID);
     if (query.TType != null)
         strFilter.AppendFormat(" and TType={0}", query.TType.Value);
     if (query.TCategory != null)
         strFilter.AppendFormat(" and TCategory={0}", query.TCategory);
     query.Title = query.Title.TextFilter();
     if (string.IsNullOrWhiteSpace(query.Title))
     {
         strFilter.AppendFormat(" and Title like '%{0}%'", query.Title);
     }
     return strFilter.ToString();
 }
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="messageTemplateQuery">MessageTemplateQuery查询实体对象</param>
 /// <returns>Pager<MessageTemplateEntity></returns>
 public Pager<MessageTemplateEntity> GetMessageTemplatePageList(MessageTemplateQuery messageTemplateQuery)
 {
     return MessageTemplateBusProvider.GetMessageTemplatePageList(messageTemplateQuery);
 }
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string MessageTemplateQueryToSQLOrder(MessageTemplateQuery query)
 {
     return " TemplateID DESC";
 }
 public Pager<MessageTemplateEntity> GetMessageTemplatePageList(MessageTemplateQuery query)
 {
     string strSql = "SELECT *,ROW_NUMBER() OVER(ORDER BY TemplateID DESC) AS ROW_ID FROM dbo.MessageTemplate with(nolock)",
           sumStr = "SELECT RecordCount=COUNT(1) FROM dbo.MessageTemplate with(nolock)";
     string whereSQL = MessageTemplateQueryToSQLWhere(query);
     if (!string.IsNullOrWhiteSpace(whereSQL))
     {
         strSql += " WHERE " + whereSQL;
         sumStr += " WHERE " + whereSQL;
     }
     return db.GetPageList<MessageTemplateEntity>(string.Format(SQL_Page_Select, strSql, query.StartIndex, query.EndIndex)
         , sumStr
         , query.CurrentPage, query.PageSize
         , (dr, pager) =>
         {
             pager.TotalRecords = TypeParse.ToLong(dr["RecordCount"]);
         }
         , MakeMessageTemplateList);
 }
 public List<MessageTemplateEntity> GetMessageTemplateList(MessageTemplateQuery query)
 {
     string strSql = "SELECT * FROM dbo.MessageTemplate with(nolock)";
     string whereSQL = MessageTemplateQueryToSQLWhere(query);
     if (!string.IsNullOrWhiteSpace(whereSQL))
     {
         strSql += " WHERE " + whereSQL;
     }
     strSql += " order by TemplateID";
     return db.GetList<MessageTemplateEntity>(strSql, MakeMessageTemplateList);
 }
示例#19
0
 private MessageTemplateEntity GetModel(Int64 TemplateID)
 {
     MessageTemplateEntity model = null;
     if (TemplateID > 0)
     {
         MessageTemplateQuery query = new MessageTemplateQuery();
         query.JournalID = CurAuthor.JournalID;
         query.TType = 2;
         query.TemplateID = TemplateID;
         ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
         model = service.GetMessageTempModel(query);
     }
     if (model == null)
         model = new MessageTemplateEntity();
     return model;
 }
示例#20
0
        /// <summary>
        /// 消息通知
        /// </summary>
        /// <param name="ActionID">操作ID</param>
        /// <param name="StatusID">当前审稿状态</param>
        /// <param name="CIDS">稿件ID,多个稿件ID用逗号分隔</param>
        /// <returns></returns>
        public ActionResult SendMessage(long ActionID, long StatusID, string CIDS)
        {
            CirculationEntity cirEntity = new CirculationEntity();
            cirEntity.ActionID = ActionID;
            cirEntity.JournalID = JournalID;
            cirEntity.StatusID = StatusID;
            IDictionary<long, long> dictCIDMap = new Dictionary<long, long>();
            string[] CIDArray = CIDS.Split(',');
            long CID = 0;
            long FlowLogID = 0;
            foreach (string CIDLogID in CIDArray)
            {
                if (!string.IsNullOrEmpty(CIDLogID))
                {
                    string[] CIDANDLogID = CIDLogID.Split(':');
                    CID = TypeParse.ToLong(CIDANDLogID[0]);
                    FlowLogID = TypeParse.ToLong(CIDANDLogID[1]);
                    if (!dictCIDMap.ContainsKey(CID) && CID > 0)
                    {
                        dictCIDMap.Add(CID, FlowLogID);
                    }
                }
            }
            cirEntity.CIDS = string.Join(",", dictCIDMap.Keys);
            cirEntity.DictLogID = dictCIDMap;
            IFlowFacadeService flowService = ServiceContainer.Instance.Container.Resolve<IFlowFacadeService>();
            FlowStep flowStepInfo = flowService.GetNextFlowStep(cirEntity);
            flowStepInfo.DictLogID = dictCIDMap;
            if (flowStepInfo.FlowAction != null)
            {
                MessageTemplateQuery query = new MessageTemplateQuery();
                query.JournalID = CurAuthor.JournalID;
                query.TType = 1;
                ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();

                if (flowStepInfo.FlowAction.EmailTemplate > 0)
                {
                    query.TemplateID = flowStepInfo.FlowAction.EmailTemplate;
                    flowStepInfo.EmailTemplate = service.GetMessageTempModel(query);
                }

                if (flowStepInfo.FlowAction.SMSTemplate > 0)
                {
                    query.TType = 2;
                    query.TemplateID = flowStepInfo.FlowAction.SMSTemplate;
                    flowStepInfo.SMSTemplate = service.GetMessageTempModel(query);
                }
            }
            ViewBag.StatusID = StatusID;
            return View(flowStepInfo);
        }
        /// <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="query"></param>
 /// <returns></returns>
 public IDictionary<int, string> GetTCategoryDictChecked(MessageTemplateQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     IDictionary<int, string> dict = clientHelper.Post<IDictionary<int, string>, MessageTemplateQuery>(GetAPIUrl(APIConstant.MESSAGETEMP_TCATEGORYDICTCHECKED), query);
     return dict;
 }
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="messageTemplateQuery">MessageTemplateQuery查询实体对象</param>
 /// <returns>List<MessageTemplateEntity></returns>
 public List<MessageTemplateEntity> GetMessageTemplateList(MessageTemplateQuery messageTemplateQuery)
 {
     return MessageTemplateDataAccess.Instance.GetMessageTemplateList(messageTemplateQuery);
 }
 /// <summary>
 /// 获取邮件短信模版实体
 /// </summary>
 /// <param name="JournalID"></param>
 /// <param name="TCategory"></param>
 /// <returns></returns>
 public MessageTemplateEntity GetMessageTemplate(Int64 JournalID, Int32 TCategory, Byte TType)
 {
     MessageTemplateQuery query = new MessageTemplateQuery();
     query.JournalID = JournalID;
     query.TCategory = TCategory;
     query.TType = TType;
     query.ModelType = 1;
     return GetMessageTempModel(query);
 }