瀏覽代碼

根据用户获取自己接收的通知公告优化

长阳分支推送专用
zhangli 2 年之前
父節點
當前提交
08130e7d2b
共有 5 個文件被更改,包括 175 次插入141 次删除
  1. +88
    -88
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs
  2. +46
    -46
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs
  3. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs
  4. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs
  5. +38
    -4
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs

+ 88
- 88
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs 查看文件

@@ -187,52 +187,52 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers
{
var userinfo = LoginUserInfo.Get();
Pagination paginationobj = new Pagination();
var newsList = noticeIBLL.GetList(keyword, userinfo.userId, categoryId);
var newsListOfSelf = new List<NewsEntity>();
var newsList = noticeIBLL.GetList(keyword, categoryId);
//var newsListOfSelf = new List<NewsEntity>();

foreach (var newsitemEntity in newsList)
{
if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
{
if (!string.IsNullOrEmpty(userinfo.postIds))
{
if (userinfo.postIds.Contains(","))
{
foreach (var postid in userinfo.postIds.Split(','))
{
if (newsitemEntity.F_SendPostId.Contains(postid))
{
newsListOfSelf.Add(newsitemEntity);
break;
}
}
}
else
{
if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
{
newsListOfSelf.Add(newsitemEntity);
}
}
}
}
else
{
if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
{
if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
{
newsListOfSelf.Add(newsitemEntity);
}
}
else
{
newsListOfSelf.Add(newsitemEntity);
}
}
}
//foreach (var newsitemEntity in newsList)
//{
// if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
// {
// if (!string.IsNullOrEmpty(userinfo.postIds))
// {
// if (userinfo.postIds.Contains(","))
// {
// foreach (var postid in userinfo.postIds.Split(','))
// {
// if (newsitemEntity.F_SendPostId.Contains(postid))
// {
// newsListOfSelf.Add(newsitemEntity);
// break;
// }
// }
// }
// else
// {
// if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
// {
// newsListOfSelf.Add(newsitemEntity);
// }
// }
// }
// }
// else
// {
// if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
// {
// if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
// {
// newsListOfSelf.Add(newsitemEntity);
// }
// }
// else
// {
// newsListOfSelf.Add(newsitemEntity);
// }
// }
//}

return JsonResult(newsListOfSelf);
return JsonResult(newsList);
}
/// <summary>
/// 查看通知公告
@@ -244,53 +244,53 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers
{
var userinfo = LoginUserInfo.Get();
Pagination paginationobj = new Pagination();
var newsList = noticeIBLL.GetList(keyword, userinfo.userId, categoryId).
var newsList = noticeIBLL.GetList(keyword, categoryId).
Where(a => a.F_Status == "2");
var newsListOfSelf = new List<NewsEntity>();
//var newsListOfSelf = new List<NewsEntity>();

foreach (var newsitemEntity in newsList)
{
if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
{
if (!string.IsNullOrEmpty(userinfo.postIds))
{
if (userinfo.postIds.Contains(","))
{
foreach (var postid in userinfo.postIds.Split(','))
{
if (newsitemEntity.F_SendPostId.Contains(postid))
{
newsListOfSelf.Add(newsitemEntity);
break;
}
}
}
else
{
if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
{
newsListOfSelf.Add(newsitemEntity);
}
}
}
}
else
{
if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
{
if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
{
newsListOfSelf.Add(newsitemEntity);
}
}
else
{
newsListOfSelf.Add(newsitemEntity);
}
}
}
//foreach (var newsitemEntity in newsList)
//{
// if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
// {
// if (!string.IsNullOrEmpty(userinfo.postIds))
// {
// if (userinfo.postIds.Contains(","))
// {
// foreach (var postid in userinfo.postIds.Split(','))
// {
// if (newsitemEntity.F_SendPostId.Contains(postid))
// {
// newsListOfSelf.Add(newsitemEntity);
// break;
// }
// }
// }
// else
// {
// if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
// {
// newsListOfSelf.Add(newsitemEntity);
// }
// }
// }
// }
// else
// {
// if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
// {
// if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
// {
// newsListOfSelf.Add(newsitemEntity);
// }
// }
// else
// {
// newsListOfSelf.Add(newsitemEntity);
// }
// }
//}

return JsonResult(newsListOfSelf);
return JsonResult(newsList);
}
/// <summary>
/// 获取实体数据


+ 46
- 46
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs 查看文件

@@ -40,56 +40,56 @@ namespace Learun.Application.WebApi.Modules
{
var userinfo = LoginUserInfo.Get();
Pagination paginationobj = new Pagination();
var newsList = noticeIBLL.GetList("", userinfo.userId, (Request.Query["F_CategoryId"] != null ? Request.Query["F_CategoryId"].ToString() : ""));
var newsListOfSelf = new List<NewsEntity>();
var newsList = noticeIBLL.GetList("",(Request.Query["F_CategoryId"]!=null?Request.Query["F_CategoryId"].ToString():""));
//var newsListOfSelf = new List<NewsEntity>();

foreach (var newsitemEntity in newsList)
{
if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
{
if (!string.IsNullOrEmpty(userinfo.postIds))
{
if (userinfo.postIds.Contains(","))
{
foreach (var postid in userinfo.postIds.Split(','))
{
if (newsitemEntity.F_SendPostId.Contains(postid))
{
newsListOfSelf.Add(newsitemEntity);
break;
}
}
}
else
{
if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
{
newsListOfSelf.Add(newsitemEntity);
}
}
}
}
else
{
if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
{
if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
{
newsListOfSelf.Add(newsitemEntity);
}
}
else
{
newsListOfSelf.Add(newsitemEntity);
}
}
}
//foreach (var newsitemEntity in newsList)
//{
// if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
// {
// if (!string.IsNullOrEmpty(userinfo.postIds))
// {
// if (userinfo.postIds.Contains(","))
// {
// foreach (var postid in userinfo.postIds.Split(','))
// {
// if (newsitemEntity.F_SendPostId.Contains(postid))
// {
// newsListOfSelf.Add(newsitemEntity);
// break;
// }
// }
// }
// else
// {
// if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
// {
// newsListOfSelf.Add(newsitemEntity);
// }
// }
// }
// }
// else
// {
// if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
// {
// if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
// {
// newsListOfSelf.Add(newsitemEntity);
// }
// }
// else
// {
// newsListOfSelf.Add(newsitemEntity);
// }
// }
//}
var jsonData = new
{
rows = newsListOfSelf,
total = newsListOfSelf.Count,
rows = newsList,
total = newsList.Count,
page = 0,
records = newsListOfSelf.Count
records = newsList.Count
};
return Success(jsonData);
}


+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs 查看文件

@@ -161,11 +161,11 @@ namespace Learun.Application.OA
/// </summary>
/// <param name="keyword">关键词</param>
/// <returns></returns>
public IEnumerable<NewsEntity> GetList(string keyword, string userId, string categoryId = null)
public IEnumerable<NewsEntity> GetList(string keyword, string categoryId = null)
{
try
{
return noticeService.GetList(keyword, userId, categoryId);
return noticeService.GetList(keyword, categoryId);
}
catch (Exception ex)
{


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs 查看文件

@@ -50,7 +50,7 @@ namespace Learun.Application.OA
/// </summary>
/// <param name="keyword">关键词</param>
/// <returns></returns>
IEnumerable<NewsEntity> GetList(string keyword, string userId,string categoryId=null);
IEnumerable<NewsEntity> GetList(string keyword,string categoryId=null);

#endregion



+ 38
- 4
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs 查看文件

@@ -206,21 +206,55 @@ namespace Learun.Application.OA
/// </summary>
/// <param name="keyword">关键词</param>
/// <returns></returns>
public IEnumerable<NewsEntity> GetList(string keyword, string userId, string categoryId = null)
public IEnumerable<NewsEntity> GetList(string keyword, string categoryId = null)
{
try
{
var userinfo = LoginUserInfo.Get();
var userId = userinfo.userId;
var deptId = userinfo.departmentId;
var postIds = userinfo.postIds;
var strSql = new StringBuilder();
strSql.Append("SELECT t.*,r.RNewsId,r.RTime FROM LR_OA_News t ");
strSql.Append(" left join LR_OA_NewsRead r on t.F_NewsId = r.NewsId and r.RUserId=@userId ");
strSql.Append(" WHERE t.F_TypeId = 2 and F_Status<>'-1' and t.F_DeleteMark=0 ");
strSql.Append(" WHERE t.F_TypeId = 2 and t.F_DeleteMark=0 and t.F_EnabledMark=1 ");
strSql.Append($@" and (
((t.F_SendDeptId is null or len(t.F_SendDeptId)=0) and (t.F_SendPostId is null or len(t.F_SendPostId)=0))
");
if (!string.IsNullOrEmpty(deptId))
{
strSql.Append($" or (t.F_SendDeptId is not null and t.F_SendDeptId like '%{deptId}%')");
}
if (!string.IsNullOrEmpty(postIds))
{
strSql.Append(" or (t.F_SendPostId is not null and ");
if (postIds.Contains(","))
{
string postidSql = " (";
foreach (var postId in postIds)
{
postidSql += $" t.F_SendPostId like '%{postId}%' or";
}

postidSql = postidSql.Substring(0, postidSql.LastIndexOf("or")) + ")";
strSql.Append(postidSql);
}
else
{
strSql.Append($" t.F_SendPostId like '%{postIds}%'");
}

strSql.Append(")");
}

strSql.Append(") ");
if (!string.IsNullOrEmpty(categoryId))
{
strSql.Append($" AND F_CategoryId = '{categoryId}'");
strSql.Append($" AND t.F_CategoryId = '{categoryId}'");
}
if (!string.IsNullOrEmpty(keyword))
{
strSql.Append(" AND F_FullHead like @keyword");
strSql.Append(" AND t.F_FullHead like @keyword");
}
strSql.Append(" ORDER BY t.F_ReleaseTime DESC ");
return this.BaseRepository().FindList<NewsEntity>(strSql.ToString(), new { keyword = "%" + keyword + "%", userId = userId });


Loading…
取消
儲存