/// <summary> /// 作者投稿 /// </summary> /// <param name="cirEntity"></param> /// <returns></returns> public bool AuthorContribute(CirculationEntity cirEntity) { bool flag = false; long EditorID = 0; try { # region 得到自动分配责编 EditorAutoAllotQuery editorQuery = new EditorAutoAllotQuery(); editorQuery.JournalID = cirEntity.JournalID; editorQuery.CNumber = cirEntity.CNumber; editorQuery.SubjectCategoryID = cirEntity.SubjectCategoryID; // 得到自动分配责编 AuthorInfoEntity autoAllotAuthor = EditorAutoAllotDataAccess.Instance.GetAutoAllotEditor(editorQuery); if (autoAllotAuthor != null) // 没有设置自动分配责任编辑 { EditorID = autoAllotAuthor.AuthorID; } # endregion DbCommand cmd = db.GetStoredProcCommand("UP_AuthorContribute"); db.AddInParameter(cmd, "@JournalID", DbType.Int64, cirEntity.JournalID); db.AddInParameter(cmd, "@CID", DbType.Int64, cirEntity.CID); db.AddInParameter(cmd, "@AuthorID", DbType.Int64, cirEntity.AuthorID); db.AddInParameter(cmd, "@Editor", DbType.Int64, EditorID); db.AddInParameter(cmd, "@CPath", DbType.String, cirEntity.CPath == null ? "" : cirEntity.CPath); db.AddInParameter(cmd, "@FigurePath", DbType.String, cirEntity.FigurePath == null ? "" : cirEntity.FigurePath); db.AddInParameter(cmd, "@OtherPath", DbType.String, cirEntity.OtherPath == null ? "" : cirEntity.OtherPath); db.AddInParameter(cmd, "@DealAdvice", DbType.String, cirEntity.DealAdvice == null ? "" : cirEntity.DealAdvice.HtmlFilter()); db.ExecuteNonQuery(cmd); flag = true; }
// 投稿自动分配 public ActionResult AutoAllot() { string ss = System.DateTime.Now.ToString("yymdd"); EditorAutoAllotQuery query = new EditorAutoAllotQuery(); query.JournalID = JournalID; IContributionFacadeService service = ServiceContainer.Instance.Container.Resolve<IContributionFacadeService>(); EditorAutoAllotEntity autoAllotEntity = service.GetAllowAllotInfo(query); return View(autoAllotEntity); }
/// <summary> /// 获取投稿自动分配编辑 /// </summary> /// <param name="cSetEntity">指定稿件编号,编辑部ID,学科ID</param> /// <returns></returns> public AuthorInfoEntity GetAutoAllotEditor(EditorAutoAllotQuery cSetEntity) { AuthorInfoEntity result = null; try { IEditorAutoAllotService cSetService = ServiceContainer.Instance.Container.Resolve<IEditorAutoAllotService>(); result = cSetService.GetAutoAllotEditor(cSetEntity); } catch (Exception ex) { LogProvider.Instance.Error("获取投稿自动分配编辑出现异常:" + ex.Message); } return result; }
/// <summary> /// 得到投稿自动分配设置 /// </summary> /// <param name="query"></param> /// <returns></returns> public EditorAutoAllotEntity GetAllowAllotInfo(EditorAutoAllotQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); EditorAutoAllotEntity cSetResult = clientHelper.PostAuth<EditorAutoAllotEntity, EditorAutoAllotQuery>(GetAPIUrl(APIConstant.CONTRIBUTION_GETAUTOALLOTINFO), query); if (cSetResult.SubjectAuthorMap != null && cSetResult.SubjectAuthorMap.Count > 0) { foreach (SubjectAuthorMapEntity item in cSetResult.SubjectAuthorMap) { item.AuthorName = GetMemberName(item.AuthorID); } } else { cSetResult.SubjectAuthorMap = new List<SubjectAuthorMapEntity>(0); } cSetResult.AuthorName = GetMemberName(cSetResult.AuthorID); cSetResult.OddAuthorName = GetMemberName(cSetResult.OddAuthorID); return cSetResult; }
/// <summary> /// 得到投稿自动分配配置 /// </summary> /// <param name="autoAllotQuery"></param> /// <returns></returns> public EditorAutoAllotEntity GetEditorAutoAllot(EditorAutoAllotQuery autoAllotQuery) { return EditorAutoAllotDataAccess.Instance.GetEditorAutoAllot(autoAllotQuery); }
/// <summary> /// 得到投稿自动分配的编辑 /// </summary> /// <param name="autoAllotQuery"></param> /// <returns></returns> public AuthorInfoEntity GetAutoAllotEditor(EditorAutoAllotQuery autoAllotQuery) { return EditorAutoAllotDataAccess.Instance.GetAutoAllotEditor(autoAllotQuery); }
/// <summary> /// 得到投稿自动分配的编辑 /// </summary> /// <param name="autoAllotQuery"></param> /// <returns></returns> public AuthorInfoEntity GetAutoAllotEditor(EditorAutoAllotQuery autoAllotQuery) { AuthorInfoEntity authorInfoEntity = null; long AuthorID = 0; # region bak //EditorAutoAllotEntity editorAutoAllotEntity = GetEditorAutoAllot(autoAllotQuery); //if (editorAutoAllotEntity != null) //{ // switch (editorAutoAllotEntity.AllotPattern) // { // case 1:// 按学科分类 // string sql = "SELECT TOP 1 AuthorID FROM dbo.SubjectAuthorMap s WITH(NOLOCK) WHERE JournalID=@JournalID AND SubjectCategoryID=@SubjectCategoryID"; // DbCommand cmd = db.GetSqlStringCommand(sql); // db.AddInParameter(cmd, "@JournalID", DbType.Int64, autoAllotQuery.JournalID); // db.AddInParameter(cmd, "@SubjectCategoryID", DbType.Int32, autoAllotQuery.SubjectCategoryID); // using (IDataReader dr = db.ExecuteReader(cmd)) // { // if (dr.Read()) // { // AuthorID = TypeParse.ToLong(dr["AuthorID"], 0); // } // dr.Close(); // } // break; // case 2:// 奇偶分配 // // 得到尾数 // string mantissa = autoAllotQuery.CNumber.Substring(autoAllotQuery.CNumber.Length - 2, 1); // int evenOdd = TypeParse.ToInt(mantissa, 0) % 2; // 判断奇偶 // if (evenOdd == 0) // { // // 偶数 // AuthorID = editorAutoAllotEntity.AuthorID; // } // else // { // // 奇数 // AuthorID = editorAutoAllotEntity.OddAuthorID; // } // break; // case 3:// 固定责编 // AuthorID = editorAutoAllotEntity.AuthorID; // break; // } // if (AuthorID > 0) // { // AuthorInfoQuery query = new AuthorInfoQuery(); // query.JournalID = editorAutoAllotEntity.JournalID; // query.AuthorID = AuthorID; // authorInfoEntity = AuthorInfoDataAccess.Instance.GetMemberInfo(query); // } //} # endregion DbCommand cmd = db.GetSqlStringCommand("SELECT dbo.fn_GetAutoAllotEditor(@JournalID,@CNumber,@SubjectCategoryID)"); db.AddInParameter(cmd, "@JournalID", DbType.Int64, autoAllotQuery.JournalID); db.AddInParameter(cmd, "CNumber", DbType.String, autoAllotQuery.CNumber); db.AddInParameter(cmd, "@SubjectCategoryID", DbType.Int32, autoAllotQuery.SubjectCategoryID); try { object obj = db.ExecuteScalar(cmd); if (obj != null) { long.TryParse(obj.ToString(), out AuthorID); } if (AuthorID > 0) { AuthorInfoQuery query = new AuthorInfoQuery(); query.JournalID = autoAllotQuery.JournalID; query.AuthorID = AuthorID; authorInfoEntity = AuthorInfoDataAccess.Instance.GetMemberInfo(query); } } catch (Exception ex) { throw ex; } return authorInfoEntity; }
/// <summary> /// 得到投稿自动分配配置 /// </summary> /// <param name="autoAllotQuery"></param> /// <returns></returns> public EditorAutoAllotEntity GetEditorAutoAllot(EditorAutoAllotQuery autoAllotQuery) { EditorAutoAllotEntity editorAutoAllotEntity = null; StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append("SELECT TOP 1 PKID,JournalID,AllotPattern,AuthorID,OddAuthorID,AddDate FROM dbo.EditorAutoAllot WITH(NOLOCK)"); sqlCommandText.Append(" WHERE JournalID=@JournalID"); DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString()); db.AddInParameter(cmd, "@JournalID", DbType.Int64, autoAllotQuery.JournalID); using(IDataReader dr = db.ExecuteReader(cmd)) { editorAutoAllotEntity = MakeEditorAutoAllot(dr); if (editorAutoAllotEntity != null) { // 如果是按照学科分类设置,则取学科分类的明细 if (editorAutoAllotEntity.AllotPattern == 1) { editorAutoAllotEntity.SubjectAuthorMap = new List<SubjectAuthorMapEntity>(); StringBuilder sqlGetSubjectCategoryText = new StringBuilder(); sqlGetSubjectCategoryText.Append("SELECT SubjectCategoryID,AuthorID FROM dbo.SubjectAuthorMap WITH(NOLOCK)"); sqlGetSubjectCategoryText.Append(" WHERE JournalID=@JournalID"); DbCommand cmdGetSubjectCategory = db.GetSqlStringCommand(sqlGetSubjectCategoryText.ToString()); db.AddInParameter(cmdGetSubjectCategory, "@JournalID", DbType.Int64, autoAllotQuery.JournalID); using (IDataReader drSubject = db.ExecuteReader(cmdGetSubjectCategory)) { SubjectAuthorMapEntity subjectMap = null; while (drSubject.Read()) { subjectMap = new SubjectAuthorMapEntity(); subjectMap.SubjectCategoryID = TypeParse.ToInt(drSubject["SubjectCategoryID"]); subjectMap.AuthorID = TypeParse.ToInt(drSubject["AuthorID"]); subjectMap.JournalID = autoAllotQuery.JournalID; editorAutoAllotEntity.SubjectAuthorMap.Add(subjectMap); } drSubject.Close(); } } } dr.Close(); } return editorAutoAllotEntity; }
/// <summary> /// 得到投稿自动分配配置 /// </summary> /// <param name="autoAllotQuery"></param> /// <returns></returns> public EditorAutoAllotEntity GetEditorAutoAllot(EditorAutoAllotQuery autoAllotQuery) { return EditorAutoAllotBusProvider.GetEditorAutoAllot(autoAllotQuery); }
/// <summary> /// 得到投稿自动分配的编辑 /// </summary> /// <param name="autoAllotQuery">指定稿件编号,编辑部ID,学科ID</param> /// <returns></returns> public AuthorInfoEntity GetAutoAllotEditor(EditorAutoAllotQuery autoAllotQuery) { return EditorAutoAllotBusProvider.GetAutoAllotEditor(autoAllotQuery); }
public EditorAutoAllotEntity GetContributeAutoAllotInfo(EditorAutoAllotQuery query) { try { IEditorAutoAllotService cSetService = ServiceContainer.Instance.Container.Resolve<IEditorAutoAllotService>(); EditorAutoAllotEntity cSetEntity = cSetService.GetEditorAutoAllot(query); if (cSetEntity == null) { cSetEntity = new EditorAutoAllotEntity(); cSetEntity.SubjectAuthorMap = new List<SubjectAuthorMapEntity>(); } else { if (cSetEntity.SubjectAuthorMap == null) { cSetEntity.SubjectAuthorMap = new List<SubjectAuthorMapEntity>(); } } if (cSetEntity.SubjectAuthorMap.Count == 0) { # region 获取学科分类 IDictValueService service = ServiceContainer.Instance.Container.Resolve<IDictValueService>(); DictValueQuery dictQuery = new DictValueQuery(); dictQuery.JournalID = query.JournalID; dictQuery.DictKey = EnumDictKey.SubjectCat.ToString(); List<DictValueEntity> listDictValue = service.GetDictValueList(dictQuery); SubjectAuthorMapEntity subjectItem = null; foreach (DictValueEntity item in listDictValue) { subjectItem = new SubjectAuthorMapEntity(); subjectItem.SubjectCategoryID = item.ValueID; subjectItem.CategoryName = item.ValueText; subjectItem.AuthorID = 0; cSetEntity.SubjectAuthorMap.Add(subjectItem); } # endregion } else { IDictValueService service = ServiceContainer.Instance.Container.Resolve<IDictValueService>(); IDictionary<int, string> dictValues = service.GetDictValueDcit(query.JournalID, EnumDictKey.SubjectCat.ToString()); string subjectCategoryName = ""; foreach (SubjectAuthorMapEntity item in cSetEntity.SubjectAuthorMap) { dictValues.TryGetValue(item.SubjectCategoryID,out subjectCategoryName); item.CategoryName = subjectCategoryName; subjectCategoryName = ""; } } return cSetEntity; }
/// <summary> /// 得到投稿自动分配编辑 /// </summary> /// <param name="query">指定稿件编号,编辑部ID,学科ID</param> /// <returns></returns> public AuthorInfoEntity GetAutoAllotEditor(EditorAutoAllotQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); AuthorInfoEntity authorResult = clientHelper.PostAuth<AuthorInfoEntity, EditorAutoAllotQuery>(GetAPIUrl(APIConstant.CONTRIBUTION_GETAUTOALLOTEDITOR), query); return authorResult; }