@@ -4,6 +4,7 @@ using Learun.Application.TwoDevelopment.LR_Desktop; | |||
using System.Web.Mvc; | |||
using System.Collections.Generic; | |||
using System.Collections; | |||
using System; | |||
namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||
{ | |||
@@ -17,6 +18,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||
public class MessageRindController : MvcControllerBase | |||
{ | |||
private MessageRindIBLL messageRindIBLL = new MessageRindBLL(); | |||
private PsychologyReplyInfoIBLL psychologyReplyInfoIBLL = new PsychologyReplyInfoBLL(); | |||
#region 视图功能 | |||
@@ -99,7 +101,47 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||
public ActionResult GetListForUnread() | |||
{ | |||
var data = messageRindIBLL.GetListForUnread(); | |||
//心理咨询数据 | |||
var PsychologyReplyData = psychologyReplyInfoIBLL.GetListForUnread(); | |||
List<Hashtable> list = new List<Hashtable>(); | |||
foreach (var item in PsychologyReplyData) | |||
{ | |||
var url = "/LR_Desktop/PsychologyReplyInfo/Index"; | |||
//跳转地址 | |||
if (item.Description == "学生") | |||
{ | |||
url = "/EducationalAdministration/PsychologyInfo/Index"; | |||
} | |||
else | |||
{ | |||
if (item.State == 3) | |||
{ | |||
url = "/LR_Desktop/PsychologyReplyInfo/Index3"; | |||
} | |||
else if (item.State == 4) | |||
{ | |||
url = "/LR_Desktop/PsychologyReplyInfo/Index4"; | |||
} | |||
else if (item.State == 5) | |||
{ | |||
url = "/LR_Desktop/PsychologyReplyInfo/IndexFive"; | |||
} | |||
else if (item.State == 6) | |||
{ | |||
url = "/LR_Desktop/PsychologyReplyInfo/IndexSix"; | |||
} | |||
} | |||
Hashtable ht = new Hashtable(); | |||
ht["MessageId"] = item.Id; | |||
ht["SenderName"] = ""; | |||
ht["TheTitle"] = "心理咨询"; | |||
ht["TheContent"] = item.Concent; | |||
ht["ConnectionUrl"] = url + "?keyvalue="; | |||
ht["InstanceId"] = item.Id; | |||
ht["isReply"] = item.IsReply; | |||
list.Add(ht); | |||
} | |||
foreach (var entity in data) | |||
{ | |||
Hashtable ht = new Hashtable(); | |||
@@ -109,6 +151,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||
ht["TheContent"] = entity.TheContent; | |||
ht["ConnectionUrl"] = entity.ConnectionUrl; | |||
ht["InstanceId"] = entity.InstanceId; | |||
ht["isReply"] = 1; | |||
list.Add(ht); | |||
} | |||
return ToJsonResult(list); | |||
@@ -173,11 +216,18 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult SaveReadSigns(string keyValue) | |||
public ActionResult SaveReadSigns(string keyValue, string title) | |||
{ | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
messageRindIBLL.SaveReadSigns(keyValue); | |||
if (title.Contains("心理咨询")) | |||
{ | |||
psychologyReplyInfoIBLL.UpdateEntity(keyValue); | |||
} | |||
else | |||
{ | |||
messageRindIBLL.SaveReadSigns(keyValue); | |||
} | |||
} | |||
return Success("保存成功!"); | |||
} | |||
@@ -32,8 +32,8 @@ | |||
color: blue; | |||
border: 1px solid blue; | |||
border-radius: 3px; | |||
cursor:pointer; | |||
margin-bottom:5px; | |||
cursor: pointer; | |||
margin-bottom: 5px; | |||
} | |||
</style> | |||
</head> | |||
@@ -62,6 +62,7 @@ | |||
dataType: "json", | |||
async: false, | |||
success: function (data) { | |||
//console.log(data); | |||
var content = ""; | |||
if (data.length > 0) { | |||
content += "<ul id='uldata'>"; | |||
@@ -76,7 +77,22 @@ | |||
} | |||
var param = data[i]["TheTitle"] + "、" + data[i]["InstanceId"] + "、" + data[i]["MessageId"] + "、" + data[i]["ConnectionUrl"]; | |||
content += "<li>"; | |||
content += " 【" + data[i]["TheTitle"] + "】" + theContent + " "; | |||
if (data[i]["TheTitle"].indexOf('心理咨询') != -1) { | |||
if (data[i]["isReply"] == 1) { | |||
//已回复绿色显示 | |||
content += "<span style='color:green;'>"; | |||
content += " 【" + data[i]["TheTitle"] + "】" + theContent + " "; | |||
content += "</span>"; | |||
} else { | |||
//待回复红色显示 | |||
content += "<span style='color:red;'>"; | |||
content += " 【" + data[i]["TheTitle"] + "】" + theContent + " "; | |||
content += "</span>"; | |||
} | |||
} else { | |||
content += " 【" + data[i]["TheTitle"] + "】" + theContent + " "; | |||
} | |||
content += '<a id="' + param + '" href="javascript:void(0);" class="lr-item" style="color:blue;textDecoration:underline">点击查看>>'; | |||
content += "</a>"; | |||
content += "</li>"; | |||
@@ -97,9 +113,10 @@ | |||
//更改状态为已读 | |||
var MessageId = params[2]; | |||
var title = params[0]; | |||
if (top.learun.checkrow(MessageId)) { | |||
$.ajax({ | |||
url: top.$.rootUrl + '/LR_Desktop/MessageRind/SaveReadSigns', | |||
url: top.$.rootUrl + '/LR_Desktop/MessageRind/SaveReadSigns?title=' + title, | |||
type: "post", | |||
data: { keyValue: MessageId }, | |||
dataType: "json", | |||
@@ -108,7 +125,6 @@ | |||
//弹窗查看详情 | |||
var keyValue = params[1]; | |||
var ConnectionUrl = params[3]; | |||
var title = params[0]; | |||
if (top.learun.checkrow(keyValue)) { | |||
top.learun.layerForm({ | |||
id: 'formview', | |||
@@ -71,7 +71,7 @@ var bootstrap = function ($, learun) { | |||
var PsychologyInfoId = $('#gridtable').jfGridValue('PsychologyInfoId'); | |||
if (learun.checkrow(PsychologyInfoId)) { | |||
learun.layerForm({ | |||
id: 'formview', | |||
id: 'formview_PsychologyInfo', | |||
title: '查看', | |||
url: top.$.rootUrl + '/LR_Desktop/PsychologyReplyInfo/FormView?PsychologyInfoId=' + PsychologyInfoId, | |||
width: 800, | |||
@@ -207,7 +207,13 @@ var bootstrap = function ($, learun) { | |||
}, | |||
{ label: "回复内容", name: "ReplyContent", width: 100, align: "left" }, | |||
{ label: "回复日期", name: "ReplyTime", width: 150, align: "left" }, | |||
{ | |||
label: "回复日期", name: "ReplyTime", width: 150, align: "left", | |||
formatter: function (cellvalue) { | |||
if (cellvalue != '1900-01-01 00:00:00') { | |||
return cellvalue; | |||
} | |||
} }, | |||
{ | |||
label: "状态", name: "State", width: 100, align: "left", | |||
formatter: function (cellvalue) { | |||
@@ -71,7 +71,7 @@ var bootstrap = function ($, learun) { | |||
var PsychologyInfoId = $('#gridtable').jfGridValue('PsychologyInfoId'); | |||
if (learun.checkrow(PsychologyInfoId)) { | |||
learun.layerForm({ | |||
id: 'formview', | |||
id: 'formview_PsychologyInfo3', | |||
title: '查看', | |||
url: top.$.rootUrl + '/LR_Desktop/PsychologyReplyInfo/FormView?PsychologyInfoId=' + PsychologyInfoId + '&type=' + 3, | |||
width: 800, | |||
@@ -207,7 +207,14 @@ var bootstrap = function ($, learun) { | |||
}, | |||
{ label: "回复内容", name: "ReplyContent", width: 100, align: "left" }, | |||
{ label: "回复日期", name: "ReplyTime", width: 150, align: "left" }, | |||
{ | |||
label: "回复日期", name: "ReplyTime", width: 150, align: "left", | |||
formatter: function (cellvalue) { | |||
if (cellvalue != '1900-01-01 00:00:00') { | |||
return cellvalue; | |||
} | |||
} | |||
}, | |||
{ | |||
label: "状态", name: "State", width: 100, align: "left", | |||
formatter: function (cellvalue) { | |||
@@ -71,7 +71,7 @@ var bootstrap = function ($, learun) { | |||
var PsychologyInfoId = $('#gridtable').jfGridValue('PsychologyInfoId'); | |||
if (learun.checkrow(PsychologyInfoId)) { | |||
learun.layerForm({ | |||
id: 'formview', | |||
id: 'formview_PsychologyInfo4', | |||
title: '查看', | |||
url: top.$.rootUrl + '/LR_Desktop/PsychologyReplyInfo/FormView?PsychologyInfoId=' + PsychologyInfoId + '&type=' + 4, | |||
width: 800, | |||
@@ -207,7 +207,13 @@ var bootstrap = function ($, learun) { | |||
}, | |||
{ label: "回复内容", name: "ReplyContent", width: 100, align: "left" }, | |||
{ label: "回复日期", name: "ReplyTime", width: 150, align: "left" }, | |||
{ | |||
label: "回复日期", name: "ReplyTime", width: 150, align: "left", | |||
formatter: function (cellvalue) { | |||
if (cellvalue != '1900-01-01 00:00:00') { | |||
return cellvalue; | |||
} | |||
} }, | |||
{ | |||
label: "状态", name: "State", width: 100, align: "left", | |||
formatter: function (cellvalue) { | |||
@@ -58,7 +58,7 @@ var bootstrap = function ($, learun) { | |||
var PsychologyInfoId = $('#gridtable').jfGridValue('PsychologyInfoId'); | |||
if (learun.checkrow(PsychologyInfoId)) { | |||
learun.layerForm({ | |||
id: 'formview', | |||
id: 'formview_PsychologyInfo5', | |||
title: '查看', | |||
url: top.$.rootUrl + '/LR_Desktop/PsychologyReplyInfo/FormFiveView?PsychologyInfoId=' + PsychologyInfoId + '&type=5', | |||
width: 800, | |||
@@ -177,7 +177,13 @@ var bootstrap = function ($, learun) { | |||
}, | |||
{ label: "回复内容", name: "ReplyContent", width: 100, align: "left" }, | |||
{ label: "回复日期", name: "ReplyTime", width: 150, align: "left" }, | |||
{ | |||
label: "回复日期", name: "ReplyTime", width: 150, align: "left", | |||
formatter: function (cellvalue) { | |||
if (cellvalue != '1900-01-01 00:00:00') { | |||
return cellvalue; | |||
} | |||
} }, | |||
{ | |||
label: "状态", name: "State", width: 100, align: "left", | |||
formatter: function (cellvalue) { | |||
@@ -1,5 +1,5 @@ | |||
@{ | |||
ViewBag.Title = "心理咨询回复(班级辅导员)"; | |||
ViewBag.Title = "心理咨询回复(汇总表)"; | |||
Layout = "~/Views/Shared/_Index.cshtml"; | |||
} | |||
<div class="lr-layout " > | |||
@@ -2,7 +2,7 @@ | |||
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2023-03-06 12:21 | |||
* 描 述:心理咨询回复(班级辅导员) | |||
* 描 述:心理咨询回复(汇总表) | |||
*/ | |||
var refreshGirdData; | |||
var bootstrap = function ($, learun) { | |||
@@ -59,7 +59,7 @@ var bootstrap = function ($, learun) { | |||
var PsychologyInfoId = $('#gridtable').jfGridValue('PsychologyInfoId'); | |||
if (learun.checkrow(PsychologyInfoId)) { | |||
learun.layerForm({ | |||
id: 'formview', | |||
id: 'formview_PsychologyInfo6', | |||
title: '查看', | |||
url: top.$.rootUrl + '/LR_Desktop/PsychologyReplyInfo/FormView?PsychologyInfoId=' + PsychologyInfoId + '&type=' + 6, | |||
width: 800, | |||
@@ -178,7 +178,13 @@ var bootstrap = function ($, learun) { | |||
}, | |||
{ label: "回复内容", name: "ReplyContent", width: 100, align: "left" }, | |||
{ label: "回复日期", name: "ReplyTime", width: 150, align: "left" }, | |||
{ | |||
label: "回复日期", name: "ReplyTime", width: 150, align: "left", | |||
formatter: function (cellvalue) { | |||
if (cellvalue != '1900-01-01 00:00:00') { | |||
return cellvalue; | |||
} | |||
} }, | |||
{ | |||
label: "状态", name: "State", width: 100, align: "left", | |||
formatter: function (cellvalue, row) { | |||
@@ -317,6 +317,7 @@ | |||
shade: [0], | |||
area: ['340px', '215px'], | |||
offset: 'rb', //右下角弹出 | |||
scrollbar:true, | |||
anim: 2, | |||
content: top.$.rootUrl + '/LR_Desktop/MessageRind/UnreadIndex', | |||
callBack: function (id) { | |||
@@ -512,7 +512,7 @@ | |||
} | |||
}); | |||
return result; | |||
}, | |||
}, | |||
HighestRecordNo: function (value) { | |||
var result; | |||
top.learun.clientdata.getAsync('dataItem', { | |||
@@ -777,6 +777,7 @@ | |||
<iframe class="lr-layout-iframe" frameborder="0" src="~/UserCenter/LanguageForm"></iframe> | |||
</div> | |||
</div> | |||
<audio id="sound" autoplay="autoplay"></audio> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -790,7 +791,8 @@ | |||
if ('@ViewBag.UserType' == '学生') { | |||
$("#lr_left_list").children('li').eq(4).addClass("active"); | |||
$('.lr-layout-wrap-item').eq(5).addClass("active"); | |||
funopen(); | |||
window.setInterval(funopen, 60000); | |||
} else { | |||
$("#lr_left_list").children('li').eq(0).addClass("active"); | |||
$('.lr-layout-wrap-item').eq(0).addClass("active"); | |||
@@ -823,6 +825,37 @@ | |||
}); | |||
} | |||
}); | |||
}); | |||
//消息提醒 | |||
function funopen() { | |||
$.ajax({ | |||
url: top.$.rootUrl + '/LR_Desktop/MessageRind/GetCountForUnread', | |||
type: "get", | |||
dataType: "json", | |||
async: false, | |||
success: function (data) { | |||
if (data.data != 0) { | |||
document.getElementById("sound").src = '/Resource/wav/收到新消息.wav'; | |||
top.learun.layeropen({ | |||
//id: 'form', | |||
type: 2, | |||
title: "消息提示", | |||
closeBtn: 0, //不显示关闭按钮 | |||
shade: [0], | |||
area: ['340px', '215px'], | |||
offset: 'rb', //右下角弹出 | |||
scrollbar: true, | |||
anim: 2, | |||
content: top.$.rootUrl + '/LR_Desktop/MessageRind/UnreadIndex', | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
} | |||
} | |||
}); | |||
}; | |||
</script> | |||
@Html.AppendJsFile("/Views/UserCenter/IndexForDC.js") |
@@ -0,0 +1,30 @@ | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using Learun.Application.TwoDevelopment.LR_Desktop; | |||
using System.Data.Entity.ModelConfiguration; | |||
namespace Learun.Application.Mapping | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2023-03-06 12:21 | |||
/// 描 述:心理咨询阅读提醒 | |||
/// </summary> | |||
public class PsychologyReadInfoMap : EntityTypeConfiguration<PsychologyReadInfo> | |||
{ | |||
public PsychologyReadInfoMap() | |||
{ | |||
#region 表、主键 | |||
//表 | |||
this.ToTable("PSYCHOLOGYREADINFO"); | |||
//主键 | |||
this.HasKey(t => t.Id); | |||
#endregion | |||
#region 配置关系 | |||
#endregion | |||
} | |||
} | |||
} | |||
@@ -143,6 +143,7 @@ | |||
<Compile Include="LR_CRM\CrmChanceMap.cs" /> | |||
<Compile Include="LR_Desktop\LostArticleInfoMap.cs" /> | |||
<Compile Include="LR_Desktop\MessageRemindMap.cs" /> | |||
<Compile Include="LR_Desktop\PsychologyReadInfoMap.cs" /> | |||
<Compile Include="LR_Desktop\SSO_Drag_CardSortManageMap.cs" /> | |||
<Compile Include="LR_Desktop\SSO_Drag_DesktopManageMap.cs" /> | |||
<Compile Include="LR_Desktop\WeChatDevelopMap.cs" /> | |||
@@ -82,7 +82,97 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
public DateTime? ReplyTime { get; set; } | |||
[NotMapped] | |||
public string ReplyUser { get; set; } | |||
[NotMapped] | |||
public int? IsReply { get; set; } | |||
[NotMapped] | |||
public string Description { get; set; } | |||
} | |||
/// <summary> | |||
/// 心理咨询阅读表 | |||
/// </summary> | |||
public class PsychologyReadInfo | |||
{ | |||
#region 实体成员 | |||
/// <summary> | |||
/// Id | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("ID")] | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 心理预约表主键 | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("PSYCHOLOGYINFOID")] | |||
public string PsychologyInfoId { get; set; } | |||
/// <summary> | |||
/// 状态 | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("State")] | |||
public int? State { get; set; } | |||
/// <summary> | |||
/// 回复人/阅读人 | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("ACCOUNT")] | |||
public string Account { get; set; } | |||
/// <summary> | |||
/// 是否需要回复 | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("ISREPLY")] | |||
public int? IsReply { get; set; } | |||
/// <summary> | |||
/// 数据归档后是否已阅读 | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("ISREAD")] | |||
public int? IsRead { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("DESCRIPTION")] | |||
public string Description { get; set; } | |||
/// <summary> | |||
/// 创建日期 | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("CREATETIME")] | |||
public DateTime? CreateTime { get; set; } | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("CREATEUSER")] | |||
public string CreateUser { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
/// <summary> | |||
/// 新增调用 | |||
/// </summary> | |||
public void Create() | |||
{ | |||
this.Id = Guid.NewGuid().ToString(); | |||
this.CreateTime = DateTime.Now; | |||
this.CreateUser = LoginUserInfo.Get().account; | |||
this.IsReply = 0; | |||
this.IsRead = 0; | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
public void Modify(string keyValue) | |||
{ | |||
this.Id = keyValue; | |||
} | |||
#endregion | |||
} | |||
} | |||
@@ -224,8 +224,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
var entity = db.FindEntity<PsychologyInfoEntity>(keyValue); | |||
entity.State = 2; | |||
db.Update(entity); | |||
//添加回复表数据 | |||
db.ExecuteBySql(@"INSERT INTO PsychologyReplyInfo(Id, PsychologyInfoId, State, ReplyContent, ReplyType, Url, ReplyUser, ReplyTime, CreateTime) | |||
VALUES('" + Guid.NewGuid().ToString() + "', '" + keyValue + "', '2', '', '', '', '',NUll, '" + DateTime.Now + "') "); | |||
//添加消息提醒阅读表数据 | |||
var account = LoginUserInfo.Get().account; | |||
//查询当前学生辅导员 | |||
var classinfo = db.FindList<ClassInfoEntity>($"select t.* from classinfo t join StuInfoBasic stu on t.classno=stu.ClassNo and stu.StuNo='{account}'").FirstOrDefault(); | |||
if (classinfo != null && !string.IsNullOrEmpty(classinfo.ClassTutorNo)) | |||
{ | |||
PsychologyReadInfo model = new PsychologyReadInfo(); | |||
model.Create(); | |||
model.PsychologyInfoId = keyValue; | |||
model.State = entity.State; | |||
model.Account = classinfo.ClassTutorNo; | |||
model.Description = "教师"; | |||
db.Insert(model); | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
@@ -1,4 +1,5 @@ | |||
using Dapper; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using Learun.DataBase.Repository; | |||
using Learun.Util; | |||
using System; | |||
@@ -99,10 +100,44 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
sql += $" and ReceiptId='{userInfo.userId}'"; | |||
var obj = this.BaseRepository().FindObject(sql); | |||
if (obj == null) | |||
return 0; | |||
else | |||
if (obj != null && Convert.ToInt32(obj) > 0) | |||
{ | |||
return Convert.ToInt32(obj); | |||
} | |||
else | |||
{ | |||
if (userInfo.Description.Trim() != "学生") | |||
{ | |||
//2023.3.27 心理咨询数据加入消息提醒,显示已归档的数据、待当前用户回复的数据、当前用户已回复过的或当前用户所在角色已回复过的 | |||
//查询心理咨询数据 | |||
var roles = userInfo.roleIds; | |||
if (!roles.Contains("2f52a949-4e71-4ad5-8cc5-edc2d89f85cc") && !roles.Contains("6a8e92d5-d135-4937-9fcb-5b84434cb18a") && !roles.Contains("8596cacc-8232-41a2-aa13-d039cc22a56e") && !roles.Contains("e443f997-dc6c-4bb0-998a-534163c852f6") && !roles.Contains("29cf249b-8582-4016-975c-ca7668acc19f")) | |||
{ | |||
return 0; | |||
} | |||
string pSql = $@" select count(a.id) from PsychologyReadInfo t | |||
join PsychologyInfo a on t.PsychologyInfoId=a.Id | |||
where t.IsRead=0 and [Description]='教师' and t.Account='{userInfo.account}'"; | |||
var count = this.BaseRepository("CollegeMIS").FindObject(pSql); | |||
if (count != null && Convert.ToInt32(count) > 0) | |||
{ | |||
return Convert.ToInt32(count); | |||
} | |||
else return 0; | |||
} | |||
else | |||
{ | |||
//学生显示已归档的 | |||
var obj_stu = this.BaseRepository("CollegeMIS").FindObject($@" select count(a.id) from PsychologyReadInfo t | |||
join PsychologyInfo a on t.PsychologyInfoId = a.Id | |||
where t.IsRead = 0 and [Description] = '学生' and a.[state] = 7 and t.Account = '{userInfo.account}'"); | |||
if (obj_stu != null) | |||
{ | |||
return Convert.ToInt32(obj_stu); | |||
} | |||
else return 0; | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -2,6 +2,7 @@ | |||
using System; | |||
using System.Data; | |||
using System.Collections.Generic; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
{ | |||
@@ -67,7 +68,24 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
} | |||
} | |||
} | |||
public List<PsychologyInfoEntity> GetListForUnread() | |||
{ | |||
try | |||
{ | |||
return psychologyReplyInfoService.GetListForUnread(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取PsychologyReplyInfo表实体数据 | |||
/// </summary> | |||
@@ -113,7 +131,24 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
#endregion | |||
#region 提交数据 | |||
public void UpdateEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
psychologyReplyInfoService.UpdateEntity(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
@@ -1,6 +1,7 @@ | |||
using Learun.Util; | |||
using System.Data; | |||
using System.Collections.Generic; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
{ | |||
@@ -22,6 +23,8 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
/// <returns></returns> | |||
IEnumerable<PsychologyReplyInfoEntity> GetPageList(Pagination pagination, string queryJson, int type); | |||
IEnumerable<PsychologyReplyInfoEntity> GetPageList2(Pagination pagination, string queryJson, int type); | |||
List<PsychologyInfoEntity> GetListForUnread(); | |||
/// <summary> | |||
/// 获取PsychologyReplyInfo表实体数据 | |||
/// </summary> | |||
@@ -32,7 +35,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
#endregion | |||
#region 提交数据 | |||
void UpdateEntity(string keyValue); | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
@@ -133,7 +133,7 @@ s.StuNo,s.StuName,info.createtime as SubmitTime,s.DeptNo,s.MajorNo,s.ClassNo,s.I | |||
union | |||
SELECT distinct | |||
s.StuNo,s.StuName,info.createtime as SubmitTime,s.DeptNo,s.MajorNo,s.ClassNo,s.IdentityCardNo,s.IsSingle,info.Concent,a.Id,a.Appointor | |||
,'' as ReplyUser,'' as ReplyContent,'' as ReplyTime,info.[state],info.id as PsychologyInfoId FROM PsychologyInfo info | |||
,'' as ReplyUser,'' as ReplyContent,NULL as ReplyTime,info.[state],info.id as PsychologyInfoId FROM PsychologyInfo info | |||
join StuInfoBasic s on info.StuNo=s.StuNo | |||
join (select * from PsychologyReplyInfo where [state]={type} and PsychologyInfoId in (select PsychologyInfoId from PsychologyReplyInfo group by PsychologyInfoId having MAX([state])={type})) a on a.PsychologyInfoid=info.id | |||
WHERE 1=1 and info.[state]>=2 and info.[state]<7 | |||
@@ -287,6 +287,79 @@ where a.Id='{keyValue}'"; | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取允许当前用户查看的心理咨询数据,加入消息提醒 | |||
/// </summary> | |||
/// <returns></returns> | |||
public List<PsychologyInfoEntity> GetListForUnread() | |||
{ | |||
try | |||
{ | |||
var userInfo = LoginUserInfo.Get(); | |||
var list = new List<PsychologyInfoEntity>(); | |||
if (userInfo.Description.Trim() != "学生") | |||
{ | |||
//2023.3.27 心理咨询数据加入消息提醒,显示已归档的数据、待当前用户回复的数据、当前用户已回复过的或当前用户所在角色已回复过的 | |||
//查询心理咨询数据 | |||
var roles = userInfo.roleIds; | |||
if (!roles.Contains("2f52a949-4e71-4ad5-8cc5-edc2d89f85cc") && !roles.Contains("6a8e92d5-d135-4937-9fcb-5b84434cb18a") && !roles.Contains("8596cacc-8232-41a2-aa13-d039cc22a56e") && !roles.Contains("e443f997-dc6c-4bb0-998a-534163c852f6") && !roles.Contains("29cf249b-8582-4016-975c-ca7668acc19f")) | |||
{ | |||
return list; | |||
} | |||
string pSql = $@" select t.*,a.Concent from PsychologyReadInfo t | |||
join PsychologyInfo a on t.PsychologyInfoId=a.Id | |||
where t.IsRead=0 and [Description]='教师' and t.Account='{userInfo.account}'"; | |||
return this.BaseRepository("CollegeMIS").FindList<PsychologyInfoEntity>(pSql).ToList(); | |||
} | |||
else | |||
{ | |||
string pSql = $@" select t.*,a.Concent from PsychologyReadInfo t | |||
join PsychologyInfo a on t.PsychologyInfoId=a.Id | |||
where t.IsRead=0 and [Description]='学生' and a.[state]=7 and t.Account='{userInfo.account}'"; | |||
return this.BaseRepository("CollegeMIS").FindList<PsychologyInfoEntity>(pSql).ToList(); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 心理咨询阅读改为已读 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void UpdateEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
var entity = this.BaseRepository("CollegeMIS").FindEntity<PsychologyReadInfo>(keyValue); | |||
if (entity.IsReply == 1) | |||
{ | |||
this.BaseRepository("CollegeMIS").ExecuteBySql($"update PsychologyReadInfo set IsRead=1 where Id='{keyValue}'"); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -325,11 +398,21 @@ where a.Id='{keyValue}'"; | |||
try | |||
{ | |||
db.BeginTrans(); | |||
var basedbname = BaseRepository().getDbConnection().Database; | |||
var userInfo = LoginUserInfo.Get(); | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
entity.Modify(keyValue); | |||
var model = this.BaseRepository("CollegeMIS").FindEntity<PsychologyReplyInfoEntity>(keyValue); | |||
var psychologyInfoId = model.PsychologyInfoId; | |||
var psychologyInfo = this.BaseRepository("CollegeMIS").FindEntity<PsychologyInfoEntity>(psychologyInfoId); | |||
//学生信息 | |||
var stuInfoBasic = db.FindList<StuInfoBasicEntity>($@"select s.* from PsychologyInfo info | |||
join StuInfoBasic s on info.StuNo=s.StuNo | |||
where s.stuno='{psychologyInfo.StuNo}'").FirstOrDefault(); | |||
if (entity.ReplyType == "1") | |||
{ | |||
int state = 0; | |||
@@ -363,6 +446,139 @@ where a.Id='{keyValue}'"; | |||
//修改主表state | |||
var updSql = $" update PsychologyInfo set [state]='{state}' where Id='{psychologyInfoId}'"; | |||
db.ExecuteBySql(updSql); | |||
#region 操作阅读表 | |||
/* | |||
1.删除当前用户(和当前角色其他人)待回复提醒数据 | |||
2.添加下一步用户待回复提醒 | |||
*/ | |||
db.ExecuteBySql($@"delete from PsychologyReadInfo where PsychologyInfoId='{psychologyInfoId}' and [State]='{model.State}' "); | |||
//班级辅导员上报,添加分院心理辅导站负责人提醒 | |||
if (psychologyInfo.State == 2) | |||
{ | |||
//分院心理辅导站负责人 | |||
var empInfo = db.FindList<EmpInfoEntity>($@"select a.* from {basedbname}.dbo.LR_Base_UserRelation t | |||
join {basedbname}.dbo.lr_base_user u on t.f_userid=u.f_userid | |||
join empinfo a on u.f_account=a.empno | |||
where t.f_objectId='6a8e92d5-d135-4937-9fcb-5b84434cb18a' and a.deptno='{stuInfoBasic.DeptNo}' "); | |||
foreach (var item in empInfo) | |||
{ | |||
db.ExecuteBySql($@"INSERT INTO [dbo].[PsychologyReadInfo] | |||
([Id] | |||
,[PsychologyInfoId] | |||
,[State] | |||
,[Account] | |||
,[IsReply] | |||
,[IsRead] | |||
,[Description] | |||
,[CreateTime] | |||
,[CreateUser]) | |||
VALUES | |||
(newid() | |||
,'{psychologyInfoId}' | |||
,'{state}' | |||
,'{item.EmpNo}' | |||
,0 | |||
,0 | |||
,'教师' | |||
,GETDATE() | |||
,'{userInfo.account}')"); | |||
} | |||
} | |||
//分院心理辅导站负责人上报,添加学工处心理老师提醒 | |||
if (psychologyInfo.State == 3) | |||
{ | |||
var empInfo = db.FindList<EmpInfoEntity>($@"select a.* from {basedbname}.dbo.LR_Base_UserRelation t | |||
join {basedbname}.dbo.lr_base_user u on t.f_userid=u.f_userid | |||
join empinfo a on u.f_account=a.empno | |||
where t.f_objectId='8596cacc-8232-41a2-aa13-d039cc22a56e' "); | |||
foreach (var item in empInfo) | |||
{ | |||
db.ExecuteBySql($@"INSERT INTO [dbo].[PsychologyReadInfo] | |||
([Id] | |||
,[PsychologyInfoId] | |||
,[State] | |||
,[Account] | |||
,[IsReply] | |||
,[IsRead] | |||
,[Description] | |||
,[CreateTime] | |||
,[CreateUser]) | |||
VALUES | |||
(newid() | |||
,'{psychologyInfoId}' | |||
,'{state}' | |||
,'{item.EmpNo}' | |||
,0 | |||
,0 | |||
,'教师' | |||
,GETDATE() | |||
,'{userInfo.account}')"); | |||
} | |||
} | |||
//学工处心理老师上报,添加心理总站负责人(徐启东老师)提醒 | |||
if (psychologyInfo.State == 4) | |||
{ | |||
var empInfo = db.FindList<EmpInfoEntity>($@"select a.* from {basedbname}.dbo.LR_Base_UserRelation t | |||
join {basedbname}.dbo.lr_base_user u on t.f_userid=u.f_userid | |||
join empinfo a on u.f_account=a.empno | |||
where t.f_objectId='e443f997-dc6c-4bb0-998a-534163c852f6' "); | |||
foreach (var item in empInfo) | |||
{ | |||
db.ExecuteBySql($@"INSERT INTO [dbo].[PsychologyReadInfo] | |||
([Id] | |||
,[PsychologyInfoId] | |||
,[State] | |||
,[Account] | |||
,[IsReply] | |||
,[IsRead] | |||
,[Description] | |||
,[CreateTime] | |||
,[CreateUser]) | |||
VALUES | |||
(newid() | |||
,'{psychologyInfoId}' | |||
,'{state}' | |||
,'{item.EmpNo}' | |||
,0 | |||
,0 | |||
,'教师' | |||
,GETDATE() | |||
,'{userInfo.account}')"); | |||
} | |||
} | |||
//心理总站负责人(徐启东老师)上报,添加指派的心理老师提醒 | |||
if (psychologyInfo.State == 5 && !string.IsNullOrEmpty(entity.Appointor)) | |||
{ | |||
db.ExecuteBySql($@"INSERT INTO [dbo].[PsychologyReadInfo] | |||
([Id] | |||
,[PsychologyInfoId] | |||
,[State] | |||
,[Account] | |||
,[IsReply] | |||
,[IsRead] | |||
,[Description] | |||
,[CreateTime] | |||
,[CreateUser]) | |||
VALUES | |||
(newid() | |||
,'{psychologyInfoId}' | |||
,'{state}' | |||
,'{entity.Appointor}' | |||
,0 | |||
,0 | |||
,'教师' | |||
,GETDATE() | |||
,'{userInfo.account}')"); | |||
} | |||
#endregion | |||
} | |||
if (entity.ReplyType == "2")//回复 | |||
@@ -391,6 +607,183 @@ where a.Id='{keyValue}'"; | |||
//修改主表state | |||
var updSql = $" update PsychologyInfo set [state]='7' where Id='{psychologyInfoId}'"; | |||
db.ExecuteBySql(updSql); | |||
#region 操作阅读表 | |||
/* | |||
1.修改当前角色下阅读者状态 | |||
2.已归档后通知学生查看 | |||
3.通知之前步骤的老师和当前步骤角色中的其他老师 | |||
1)班级辅导员回复(state=2)时,不需要通知其他老师,只需通知学生; | |||
2)分院心理辅导站负责人回复(state=3)时,通知班级辅导员和该角色其他负责人; | |||
3)学工处心理老师回复(state=4)时,通知班级辅导员、分院心理辅导站负责人、该角色其他老师; | |||
以此类推... | |||
*/ | |||
#region 修改阅读表状态 | |||
//修改阅读表为已回复已读(当前用户已回复已读,角色下其他人已回复未读) | |||
db.ExecuteBySql($"update PsychologyReadInfo set IsReply=1,IsRead=1 where PsychologyInfoId='{psychologyInfoId}' and [State]='{psychologyInfo.State}' and Account='{userInfo.account}'"); | |||
db.ExecuteBySql($"update PsychologyReadInfo set IsReply=1,IsRead=0 where PsychologyInfoId='{psychologyInfoId}' and [State]='{psychologyInfo.State}' and Account<>'{userInfo.account}'"); | |||
#endregion | |||
#region 添加学生阅读提醒 | |||
//学生 | |||
db.ExecuteBySql($@"INSERT INTO [dbo].[PsychologyReadInfo] | |||
([Id] | |||
,[PsychologyInfoId] | |||
,[State] | |||
,[Account] | |||
,[IsReply] | |||
,[IsRead] | |||
,[Description] | |||
,[CreateTime] | |||
,[CreateUser]) | |||
VALUES | |||
(newid() | |||
,'{psychologyInfoId}' | |||
,7 | |||
,'{psychologyInfo.StuNo}' | |||
,1 | |||
,0 | |||
,'学生' | |||
,GETDATE() | |||
,'{userInfo.account}')"); | |||
#endregion | |||
#region 添加老师阅读提醒 | |||
if (psychologyInfo.State >= 3) | |||
{ | |||
//班级辅导员 | |||
var classinfo = db.FindList<ClassInfoEntity>($@"select class.* from PsychologyInfo info | |||
join StuInfoBasic s on info.StuNo=s.StuNo | |||
left join classinfo class on s.classno=class.classno | |||
where s.stuno='{psychologyInfo.StuNo}'").FirstOrDefault(); | |||
db.ExecuteBySql($@"INSERT INTO [dbo].[PsychologyReadInfo] | |||
([Id] | |||
,[PsychologyInfoId] | |||
,[State] | |||
,[Account] | |||
,[IsReply] | |||
,[IsRead] | |||
,[Description] | |||
,[CreateTime] | |||
,[CreateUser]) | |||
VALUES | |||
(newid() | |||
,'{psychologyInfoId}' | |||
,'2' | |||
,'{classinfo.ClassTutorNo}' | |||
,1 | |||
,0 | |||
,'教师' | |||
,GETDATE() | |||
,'{userInfo.account}')"); | |||
} | |||
if (psychologyInfo.State >= 4) | |||
{ | |||
//分院心理辅导站负责人 | |||
var empInfo = db.FindList<EmpInfoEntity>($@"select a.* from {basedbname}.dbo.LR_Base_UserRelation t | |||
join {basedbname}.dbo.lr_base_user u on t.f_userid=u.f_userid | |||
join empinfo a on u.f_account=a.empno | |||
where t.f_objectId='6a8e92d5-d135-4937-9fcb-5b84434cb18a' and deptno='{stuInfoBasic.DeptNo}'"); | |||
foreach (var item in empInfo) | |||
{ | |||
db.ExecuteBySql($@"INSERT INTO [dbo].[PsychologyReadInfo] | |||
([Id] | |||
,[PsychologyInfoId] | |||
,[State] | |||
,[Account] | |||
,[IsReply] | |||
,[IsRead] | |||
,[Description] | |||
,[CreateTime] | |||
,[CreateUser]) | |||
VALUES | |||
(newid() | |||
,'{psychologyInfoId}' | |||
,'3' | |||
,'{item.EmpNo}' | |||
,1 | |||
,0 | |||
,'教师' | |||
,GETDATE() | |||
,'{userInfo.account}')"); | |||
} | |||
} | |||
if (psychologyInfo.State >= 5) | |||
{ | |||
//学工处心理老师 | |||
var empInfo = db.FindList<EmpInfoEntity>($@"select a.* from {basedbname}.dbo.LR_Base_UserRelation t | |||
join {basedbname}.dbo.lr_base_user u on t.f_userid=u.f_userid | |||
join empinfo a on u.f_account=a.empno | |||
where t.f_objectId='8596cacc-8232-41a2-aa13-d039cc22a56e' "); | |||
foreach (var item in empInfo) | |||
{ | |||
db.ExecuteBySql($@"INSERT INTO [dbo].[PsychologyReadInfo] | |||
([Id] | |||
,[PsychologyInfoId] | |||
,[State] | |||
,[Account] | |||
,[IsReply] | |||
,[IsRead] | |||
,[Description] | |||
,[CreateTime] | |||
,[CreateUser]) | |||
VALUES | |||
(newid() | |||
,'{psychologyInfoId}' | |||
,'4' | |||
,'{item.EmpNo}' | |||
,1 | |||
,0 | |||
,'教师' | |||
,GETDATE() | |||
,'{userInfo.account}')"); | |||
} | |||
} | |||
if (psychologyInfo.State >= 6) | |||
{ | |||
//心理总站负责人(徐启东老师) | |||
var empInfo = db.FindList<EmpInfoEntity>($@"select a.* from {basedbname}.dbo.LR_Base_UserRelation t | |||
join {basedbname}.dbo.lr_base_user u on t.f_userid=u.f_userid | |||
join empinfo a on u.f_account=a.empno | |||
where t.f_objectId='e443f997-dc6c-4bb0-998a-534163c852f6' "); | |||
foreach (var item in empInfo) | |||
{ | |||
db.ExecuteBySql($@"INSERT INTO [dbo].[PsychologyReadInfo] | |||
([Id] | |||
,[PsychologyInfoId] | |||
,[State] | |||
,[Account] | |||
,[IsReply] | |||
,[IsRead] | |||
,[Description] | |||
,[CreateTime] | |||
,[CreateUser]) | |||
VALUES | |||
(newid() | |||
,'{psychologyInfoId}' | |||
,'5' | |||
,'{item.EmpNo}' | |||
,1 | |||
,0 | |||
,'教师' | |||
,GETDATE() | |||
,'{userInfo.account}')"); | |||
} | |||
} | |||
#endregion | |||
#endregion | |||
} | |||
db.Update(entity); | |||
} | |||