Explorar el Código

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

娄底高职分支
zhangli hace 2 años
padre
commit
7f7e12f3ab
Se han modificado 5 ficheros con 179 adiciones y 145 borrados
  1. +92
    -92
      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

+ 92
- 92
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs Ver fichero

@@ -136,52 +136,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>();
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);
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);
// }
// }
//}
return JsonResult(newsList);
}
/// <summary>
/// 查看通知公告
@@ -193,53 +193,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>();
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);
//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);
// }
// }
//}
return JsonResult(newsList);
}
/// <summary>
/// 获取实体数据


+ 46
- 46
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs Ver fichero

@@ -32,56 +32,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 Ver fichero

@@ -121,11 +121,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 Ver fichero

@@ -49,7 +49,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 Ver fichero

@@ -154,21 +154,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 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 });


Cargando…
Cancelar
Guardar