@@ -163,7 +163,8 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||||
} | } | ||||
} | } | ||||
} | } | ||||
var readnewslist = newsIBLL.GetList("", userinfo.userId).Where(m => !string.IsNullOrEmpty(m.RNewsId)).Select(m => m.F_NewsId); | |||||
//var readnewslist = newsIBLL.GetList("", userinfo.userId).Where(m => !string.IsNullOrEmpty(m.RNewsId)).Select(m => m.F_NewsId); | |||||
var readnewslist = readbll.GetListOfSelf().Select(m => m.NewsId).ToList(); | |||||
int UnreadNews = outnewslist.Count(m => !readnewslist.Contains(m.F_NewsId)); | int UnreadNews = outnewslist.Count(m => !readnewslist.Contains(m.F_NewsId)); | ||||
paginationobj.sidx = "SendTime"; | paginationobj.sidx = "SendTime"; | ||||
int UnreadFile = sys_ReceiveFileIBLL.GetPageListBySenderId(userinfo.userId).Count(); | int UnreadFile = sys_ReceiveFileIBLL.GetPageListBySenderId(userinfo.userId).Count(); | ||||
@@ -184,6 +185,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||||
}; | }; | ||||
return Success(data); | return Success(data); | ||||
} | } | ||||
private static LR_OA_NewsReadBLL readbll = new LR_OA_NewsReadBLL(); | |||||
/// <summary> | /// <summary> | ||||
/// 获取未读的消息 | /// 获取未读的消息 | ||||
/// </summary> | /// </summary> | ||||
@@ -338,11 +340,32 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||||
else | else | ||||
{ | { | ||||
messageRindIBLL.SaveReadSigns(keyValue); | messageRindIBLL.SaveReadSigns(keyValue); | ||||
//var loginUserInfo = LoginUserInfo.Get(); | |||||
//var model = messageRindIBLL.GetMessageRemindEntity(keyValue); | |||||
////判断当前用户是否阅读当前通知公告 | |||||
//var entity = lR_OA_NewsReadIBLL.GetLR_OA_NewsReadEntityByNewsIdAndUserId(model.InstanceId, loginUserInfo.userId); | |||||
//if (entity == null) | |||||
//{ | |||||
// var lR_OA_NewsRead = new LR_OA_NewsReadEntity() | |||||
// { | |||||
// NewsId = model.InstanceId, | |||||
// RUserId = loginUserInfo.userId, | |||||
// RUserName = loginUserInfo.realName, | |||||
// RTime = DateTime.Now | |||||
// }; | |||||
// lR_OA_NewsReadIBLL.SaveEntity("", lR_OA_NewsRead); | |||||
// //修改当前通知公告的浏览量 | |||||
// lR_OA_NewsReadIBLL.UpdateNewsPV(model.InstanceId); | |||||
//} | |||||
} | } | ||||
} | } | ||||
return Success("保存成功!"); | return Success("保存成功!"); | ||||
} | } | ||||
private static LR_OA_NewsReadBLL lR_OA_NewsReadIBLL = new LR_OA_NewsReadBLL(); | |||||
/// <summary> | /// <summary> | ||||
/// 更改状态为已读 | /// 更改状态为已读 | ||||
/// </summary> | /// </summary> | ||||
@@ -166,13 +166,15 @@ namespace Learun.Application.Web.Controllers | |||||
} | } | ||||
} | } | ||||
} | } | ||||
var readnewslist = newsIBLL.GetList("", userinfo.userId).Where(m => !string.IsNullOrEmpty(m.RNewsId)).Select(m => m.F_NewsId); | |||||
//var readnewslist = newsIBLL.GetList("", userinfo.userId).Where(m => !string.IsNullOrEmpty(m.RNewsId)).Select(m => m.F_NewsId); | |||||
var readnewslist = readbll.GetListOfSelf().Select(m => m.NewsId).ToList(); | |||||
ViewBag.UnreadNews = outnewslist.Count(m => !readnewslist.Contains(m.F_NewsId)); | ViewBag.UnreadNews = outnewslist.Count(m => !readnewslist.Contains(m.F_NewsId)); | ||||
paginationobj.sidx = "SendTime"; | paginationobj.sidx = "SendTime"; | ||||
//ViewBag.UnreadFile = sys_ReceiveFileIBLL.GetPageListByUserId(paginationobj, "{}", userinfo.userId).Where(a => a.STypeId == 1).Count(); | //ViewBag.UnreadFile = sys_ReceiveFileIBLL.GetPageListByUserId(paginationobj, "{}", userinfo.userId).Where(a => a.STypeId == 1).Count(); | ||||
ViewBag.UnreadFile = sys_ReceiveFileIBLL.GetPageListBySenderId(userinfo.userId); | ViewBag.UnreadFile = sys_ReceiveFileIBLL.GetPageListBySenderId(userinfo.userId); | ||||
return View(); | return View(); | ||||
} | } | ||||
private static LR_OA_NewsReadBLL readbll = new LR_OA_NewsReadBLL(); | |||||
public ActionResult GoTo() | public ActionResult GoTo() | ||||
{ | { | ||||
@@ -41,6 +41,29 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 获取页面显示列表数据 | |||||
/// <summary> | |||||
/// <param name="queryJson">查询参数</param> | |||||
/// <returns></returns> | |||||
public IEnumerable<LR_OA_NewsReadEntity> GetListOfSelf() | |||||
{ | |||||
try | |||||
{ | |||||
return lR_OA_NewsReadService.GetListOfSelf(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 获取LR_OA_NewsRead表实体数据 | /// 获取LR_OA_NewsRead表实体数据 | ||||
@@ -130,6 +130,32 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||||
} | } | ||||
} | } | ||||
} | } | ||||
public IEnumerable<LR_OA_NewsReadEntity> GetListOfSelf() | |||||
{ | |||||
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.NewsId,t.RUserId FROM LR_OA_NewsRead t "); | |||||
strSql.Append(" WHERE t.RUserId = '"+userinfo.userId+"' "); | |||||
return this.BaseRepository().FindList<LR_OA_NewsReadEntity>(strSql.ToString(), new { }); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
#region 提交数据 | #region 提交数据 | ||||
@@ -321,6 +321,27 @@ where t.IsRead = 0 and [Description] = '学生' and a.[state] = 7 and t.Account | |||||
this.BaseRepository().ExecuteBySql(sql); | this.BaseRepository().ExecuteBySql(sql); | ||||
} | } | ||||
} | } | ||||
else if (model.TheTitle == "通知公告") | |||||
{ | |||||
var userInfo = LoginUserInfo.Get(); | |||||
var existmodel = this.BaseRepository().FindEntity<LR_OA_NewsReadEntity>(c=>c.NewsId==model.InstanceId&&c.RUserId==userInfo.userId); | |||||
if (existmodel==null) | |||||
{ | |||||
LR_OA_NewsReadEntity insertmodel = new LR_OA_NewsReadEntity(); | |||||
insertmodel.NewsId = model.InstanceId; | |||||
insertmodel.RUserId = userInfo.userId; | |||||
insertmodel.RUserName = userInfo.realName; | |||||
insertmodel.RTime = DateTime.Now; | |||||
//插入公告查看日志 | |||||
insertmodel.Create(); | |||||
this.BaseRepository().Insert(insertmodel); | |||||
var readNum = this.BaseRepository().FindList<LR_OA_NewsReadEntity>(x => x.NewsId == model.InstanceId).Count(); | |||||
var strSql = "update LR_OA_News set F_PV=" + readNum + " where F_NewsId='" + model.InstanceId + "'"; | |||||
this.BaseRepository().ExecuteBySql(strSql); | |||||
} | |||||
this.BaseRepository().ExecuteBySql(sql); | |||||
} | |||||
else | else | ||||
{ | { | ||||
this.BaseRepository().ExecuteBySql(sql); | this.BaseRepository().ExecuteBySql(sql); | ||||
@@ -347,6 +368,9 @@ where t.IsRead = 0 and [Description] = '学生' and a.[state] = 7 and t.Account | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
var userInfo = LoginUserInfo.Get(); | |||||
string unreadnotice_sql = "select * from MessageRemind where thetitle='通知公告' and receiptid='" + userInfo.userId + "' and readsigns=0"; | |||||
var unreadnotice_ = this.BaseRepository().FindList<MessageRemindEntity>(unreadnotice_sql).ToList(); | |||||
#region 报修待处理 | #region 报修待处理 | ||||
//查询维修通告中没有处理的id | //查询维修通告中没有处理的id | ||||
//教师报修 | //教师报修 | ||||
@@ -384,6 +408,28 @@ where t.IsRead = 0 and [Description] = '学生' and a.[state] = 7 and t.Account | |||||
string sql_e = $"update MessageRemind set ReadSigns=0 where ReceiptId='{userId}' and ReadSigns<>0 and instanceid in ('" + ids_e.Replace(",", "','") + "') and TheTitle='评价通知'"; | string sql_e = $"update MessageRemind set ReadSigns=0 where ReceiptId='{userId}' and ReadSigns<>0 and instanceid in ('" + ids_e.Replace(",", "','") + "') and TheTitle='评价通知'"; | ||||
this.BaseRepository().ExecuteBySql(sql_e); | this.BaseRepository().ExecuteBySql(sql_e); | ||||
} | } | ||||
foreach (var item in unreadnotice_) | |||||
{ | |||||
string updatesql = $"update MessageRemind set ReadSigns=1 where MessageId='{item.MessageId}'"; | |||||
LR_OA_NewsReadEntity insertmodel = new LR_OA_NewsReadEntity(); | |||||
insertmodel.NewsId = item.InstanceId; | |||||
insertmodel.RUserId = userInfo.userId; | |||||
insertmodel.RUserName = userInfo.realName; | |||||
insertmodel.RTime = DateTime.Now; | |||||
//插入公告查看日志 | |||||
insertmodel.Create(); | |||||
this.BaseRepository().Insert(insertmodel); | |||||
var readNum = this.BaseRepository().FindList<LR_OA_NewsReadEntity>(x => x.NewsId == item.InstanceId).Count(); | |||||
var strSql = "update LR_OA_News set F_PV=" + readNum + " where F_NewsId='" + item + "'"; | |||||
this.BaseRepository().ExecuteBySql(strSql); | |||||
this.BaseRepository().ExecuteBySql(updatesql); | |||||
} | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||