From 8ec82f7a9eae0f59c31dcdff9283f9477e36acce Mon Sep 17 00:00:00 2001 From: hwh2023 <598694955@qq.com> Date: Wed, 18 Oct 2023 12:06:34 +0800 Subject: [PATCH 1/3] xunlian --- .../Notice_Train_TeamsController.cs | 186 ++---------------- .../Ask/Views/Notice_Train_Sum/Form.cshtml | 4 + .../Areas/Ask/Views/Notice_Train_Sum/Form.js | 2 + .../Ask/Views/Notice_Train_Sum/Index.cshtml | 1 + .../Areas/Ask/Views/Notice_Train_Sum/Index.js | 15 ++ .../Ask/Views/Notice_Train_Teams/Form.cshtml | 75 +------ .../Ask/Views/Notice_Train_Teams/Form.js | 122 +++--------- .../Ask/Views/Notice_Train_Teams/Index.cshtml | 14 +- .../Ask/Views/Notice_Train_Teams/Index.js | 61 ++---- .../Ask/Notice_Train_TeamsMap.cs | 6 +- .../Notice_Train_SumEntity.cs | 5 + .../Notice_Train_TeamsBLL.cs | 32 +-- .../Notice_Train_TeamsEntity.cs | 82 ++------ .../Notice_Train_TeamsIBLL.cs | 12 +- .../Notice_Train_TeamsService.cs | 57 +----- 15 files changed, 128 insertions(+), 546 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_TeamsController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_TeamsController.cs index 3d449e7b4..d91aae81f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_TeamsController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_TeamsController.cs @@ -3,17 +3,6 @@ using System.Data; using Learun.Application.TwoDevelopment.Ask; using System.Web.Mvc; using System.Collections.Generic; -using Learun.Application.TwoDevelopment.EducationalAdministration; -using Learun.Application.TwoDevelopment.LR_Desktop; -using System.Threading.Tasks; -using Learun.Application.Organization; -using System.Linq; -using System.Web; -using Learun.Application.Base.AuthorizeModule; -using Learun.Util.Operat; -using System; -using Newtonsoft.Json; -using Learun.Application.OA; namespace Learun.Application.Web.Areas.Ask.Controllers { @@ -21,21 +10,12 @@ namespace Learun.Application.Web.Areas.Ask.Controllers /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 /// 创 建:超级管理员 - /// 日 期:2023-09-28 14:30 - /// 描 述:运动对集训安排 + /// 日 期:2023-10-18 00:50 + /// 描 述:队伍管理 /// public class Notice_Train_TeamsController : MvcControllerBase { - private Notice_Train_SportsIBLL notice_Train_TeamsIBLL = new Notice_Train_SportsBLL(); - - - private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); - private MessageRindIBLL messageRindIBLL = new MessageRindBLL(); - private WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); - private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); - private UserIBLL userIbll = new UserBLL(); - private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); - + private Notice_Train_TeamsIBLL notice_Train_TeamsIBLL = new Notice_Train_TeamsBLL(); #region 视图功能 @@ -91,16 +71,11 @@ namespace Learun.Application.Web.Areas.Ask.Controllers [AjaxOnly] public ActionResult GetFormData(string keyValue) { - var data = notice_Train_TeamsIBLL.GetNotice_Train_SportsEntity(keyValue); - data.T_Content = WebHelper.HtmlDecode(data.T_Content); - return JsonResult(data); - //var Notice_Train_TeamsData = notice_Train_TeamsIBLL.GetNotice_Train_SportsEntity( keyValue ); - //var NoticeLog_Train_TeamsData = notice_Train_TeamsIBLL.GetNoticeLog_Train_TeamsEntity( Notice_Train_TeamsData.T_id ); - //var jsonData = new { - // Notice_Train_Teams = Notice_Train_TeamsData, - // NoticeLog_Train_Teams = NoticeLog_Train_TeamsData, - //}; - //return Success(jsonData); + var Notice_Train_TeamsData = notice_Train_TeamsIBLL.GetNotice_Train_TeamsEntity( keyValue ); + var jsonData = new { + Notice_Train_Teams = Notice_Train_TeamsData, + }; + return Success(jsonData); } #endregion @@ -127,154 +102,15 @@ namespace Learun.Application.Web.Areas.Ask.Controllers [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] - public ActionResult SaveForm(string keyValue, string strEntity, string strnoticeLog_Train_TeamsEntity) + public ActionResult SaveForm(string keyValue, string strEntity) { - Notice_Train_SportsEntity entity = strEntity.ToObject(); - //NoticeLog_Train_TeamsEntity noticeLog_Train_TeamsEntity = strnoticeLog_Train_TeamsEntity.ToObject(); - //notice_Train_TeamsIBLL.SaveEntity(keyValue,entity,noticeLog_Train_TeamsEntity); + Notice_Train_TeamsEntity entity = strEntity.ToObject(); + notice_Train_TeamsIBLL.SaveEntity(keyValue,entity); if (keyValue != null) { } return Success("保存成功!"); } - - - - - [HttpPost, ValidateAntiForgeryToken, AjaxOnly, ValidateInput(false)] - public ActionResult SaveFormAndSubmit(string keyValue, Notice_Train_SportsEntity entity) - { - entity.Type = "4"; - entity.T_Content = WebHelper.HtmlEncode(entity.T_Content); - notice_Train_TeamsIBLL.SaveEntity(keyValue, entity); - //推送通知 - //读取信息推送管理-通知公告推送(01)的配置 - var informationPushEntity = sys_InformationPushIBLL.GetEntityByPushItem("01"); - if (informationPushEntity != null && informationPushEntity.Status == true) - { - //推送微信 - Task.Run(async () => { await DoWeixinPush(entity); }); - } - return Success("保存成功!"); - } - Task DoWeixinPush(Notice_Train_SportsEntity entity) - { - //微信推送 - try - { - var allteacherlist = userIbll.GetAllList().Where(m => - m.F_DeleteMark != 1 && m.F_EnabledMark == 1 && m.F_Description == "教师"); - var userralationlist = userRelationIBLL.GetUserIdList("2"); - var needpostuserlist = new List(); - if (!string.IsNullOrEmpty(entity.Noticedept)) - { - if (!entity.Noticedept.Contains(",")) - { - var departteacherlist = allteacherlist.Where(m => entity.Noticedept == m.F_DepartmentId); - needpostuserlist.AddRange(departteacherlist.ToList()); - } - else - { - foreach (var senddeptid in entity.Noticedept.Split(',')) - { - var departteacherlist = allteacherlist.Where(m => senddeptid == m.F_DepartmentId); - needpostuserlist.AddRange(departteacherlist.ToList()); - } - } - } - PushWeixin(needpostuserlist, entity.T_title); - - //消息提醒表 - PushMessageRemind(needpostuserlist, entity); - return Task.CompletedTask; - } - catch (Exception e) - { - return Task.FromException(e); - } - } - - public void PushWeixin(List needpostuserlist, string title) - { - var WeChatConfigentity = weChatConfigIbll.GetEnableEntity(); - string appid = WeChatConfigentity.APPId; - string secret = WeChatConfigentity.secret; - var wechatemplete = weChatTempletIbll.GetWeChatTemplateEntityByCodeConfigId(WeChatConfigentity.ID, "task"); - string weixintaskurl = wechatemplete.TUrl; - string weixintasktempid = wechatemplete.TempId; - var responsejson = Util.HttpMethods.HttpGet("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret); - - OperateLogModel operateLogModel = new OperateLogModel(); - operateLogModel.title = title; - operateLogModel.type = OperationType.Other; - operateLogModel.url = "NoticeController"; - operateLogModel.sourceObjectId = "002"; - operateLogModel.sourceContentJson = responsejson; - OperatorHelper.Instance.WriteOperateLog(operateLogModel); - - foreach (UserEntity userinfo in needpostuserlist) - { - if (userinfo != null && !string.IsNullOrEmpty(userinfo.OpenIdForWeixin)) - { - //执行推送任务 - if (!string.IsNullOrEmpty(appid) && !string.IsNullOrEmpty(secret) && !string.IsNullOrEmpty(weixintaskurl) && !string.IsNullOrEmpty(weixintasktempid)) - { - if (!string.IsNullOrEmpty(responsejson)) - { - var weixintokenobj = JsonConvert.DeserializeObject(responsejson); - if (string.IsNullOrEmpty(weixintokenobj.errcode)) - { - string access_token = weixintokenobj.access_token; - string jsondata = "{\"touser\":\"" + userinfo.OpenIdForWeixin + "\"," + - "\"template_id\":\"" + weixintasktempid + "\"," + - "\"url\":\"" + weixintaskurl + "\"," + - "\"data\":{" + - "\"first\": {\"value\":\"您有新的未读通知公告\",\"color\":\"#173177\"}," + - "\"keyword1\":{\"value\":\"未读通知公告\",\"color\":\"#173177\"}," + - "\"keyword2\": {\"value\":\"" + title + "\",\"color\":\"#173177\"}," + - "\"keyword3\": {\"value\":\"待查看\",\"color\":\"#173177\"}," + - "\"keyword4\": {\"value\":\"您有新的未读通知公告【" + title + "】\",\"color\":\"#173177\"}" + - "}" + - "}"; - string pushresult = Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); - - operateLogModel.title = title; - operateLogModel.type = OperationType.Other; - operateLogModel.url = "NoticeController"; - operateLogModel.sourceObjectId = "002"; - operateLogModel.sourceContentJson = pushresult; - OperatorHelper.Instance.WriteOperateLog(operateLogModel); - } - } - } - } - } - } - - /// - /// 消息提醒 - /// - /// - /// - public void PushMessageRemind(List needpostuserlist, Notice_Train_SportsEntity model) - { - foreach (UserEntity userinfo in needpostuserlist) - { - MessageRemindEntity entity = new MessageRemindEntity(); - entity.ReceiptId = userinfo.F_UserId; - entity.ReceiptName = userinfo.F_RealName; - entity.SenderId = model.Creator; - entity.SenderName = model.Creator; - entity.TheTitle = "通知公告"; - entity.TheContent = model.T_title; - entity.InstanceId = model.T_id; - entity.ConnectionUrl = "/Utility/ListContentIndex?id="; - entity.SendTime = DateTime.Now; - entity.ReadSigns = false; - messageRindIBLL.SaveEntity("", entity); - } - - } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Form.cshtml index 13f319b73..f53873c56 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Form.cshtml @@ -3,6 +3,10 @@ Layout = "~/Views/Shared/_Form.cshtml"; }
+
+
队伍
+
+
教练
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Form.js index e67273dea..11a458380 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Form.js @@ -21,6 +21,8 @@ var bootstrap = function ($, learun) { var ContentsUE = UE.getEditor('Contents'); $('#Coachs').lrUserSelect(1); $('#Peoples').lrUserSelect(1); + //$('#Teamid').lrUserSelect(1); + $('#Teamid').lrDataSourceSelect({ code: 'Trainteam', value: 'name', text: 'name' }); //$('#Peoples').lrDataItemSelect({ code: '' }); $('#Contents')[0].ue = ContentsUE; }, initData: function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Index.cshtml index f4b6a228c..dd1309a49 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Index.cshtml @@ -56,6 +56,7 @@
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Index.js index 004e8914a..7f6f86b13 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Sum/Index.js @@ -189,6 +189,21 @@ var bootstrap = function ($, learun) { } }); }); + /*分类管理*/ + $('#lr_team').on('click', function () { + learun.layerForm({ + id: 'ClassifyIndex', + title: '队伍管理', + url: top.$.rootUrl + '/Ask/Notice_Train_Teams/Index', + width: 800, + height: 500, + maxmin: true, + btn: null, + end: function () { + location.reload(); + } + }); + }); }, initTree: function () { $('#lr_left_tree').lrtree({ diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Form.cshtml index cde6b22d6..e1678b4f2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Form.cshtml @@ -1,76 +1,15 @@ @{ - ViewBag.Title = "运动对集训安排"; + ViewBag.Title = "队伍管理"; Layout = "~/Views/Shared/_Form.cshtml"; } -@*
-
-
标题*
- -
-
-
类别
-
-
-
-
发布时间*
- -
-
-
信息来源
- -
-
-
来源地址
- -
-
-
下发部门
-
-
-
-
附件上传
-
-
-
-
内容*
- -
-
*@
-
-
公告标题*
- -
-
-
公告类别*
-
- -
-
-
发布时间*
- -
-
-
信息来源
- -
-
-
来源地址
- -
-
-
接收部门
-
-
-
-
附件上传
-
+
+
队伍名称*
+
-
-
公告内容
-
- @**@ +
+
下拉框*
+
@Html.AppendJsFile("/Areas/Ask/Views/Notice_Train_Teams/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Form.js index 44aadab4a..2ad6c5b00 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Form.js @@ -1,128 +1,52 @@ /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 * 创建人:超级管理员 - * 日 期:2023-09-28 14:30 - * 描 述:运动对集训安排 + * 日 期:2023-10-18 00:50 + * 描 述:队伍管理 */ -//var acceptClick; -//var keyValue = request('keyValue'); -//var bootstrap = function ($, learun) { -// "use strict"; -// var page = { -// init: function () { -// $('.lr-form-wrap').lrscroll(); -// page.bind(); -// page.initData(); -// }, -// bind: function () { -// $('#T_type').lrRadioCheckbox({ -// type: 'radio', -// code: '', -// }); -// $('#Noticedept').lrRadioCheckbox({ -// type: 'checkbox', -// dataType: 'dataSource', -// code: 'classdata', -// value: 'id', -// text: 'name', -// }); -// $('#Files').lrUploader(); -// }, -// initData: function () { -// if (!!keyValue) { -// $.lrSetForm(top.$.rootUrl + '/Ask/Notice_Train_Teams/GetFormData?keyValue=' + keyValue, function (data) { -// for (var id in data) { -// if (!!data[id].length && data[id].length > 0) { -// $('#' + id ).jfGridSet('refreshdata', data[id]); -// } -// else { -// $('[data-table="' + id + '"]').lrSetFormData(data[id]); -// } -// } -// }); -// } -// } -// }; -// // 保存数据 -// acceptClick = function (callBack) { -// if (!$('body').lrValidform()) { -// return false; -// } -// var postData = {}; -// postData.strEntity = JSON.stringify($('[data-table="Notice_Train_Teams"]').lrGetFormData()); -// postData.strnoticeLog_Train_TeamsEntity = JSON.stringify($('[data-table="NoticeLog_Train_Teams"]').lrGetFormData()); -// $.lrSaveForm(top.$.rootUrl + '/Ask/Notice_Train_Teams/SaveForm?keyValue=' + keyValue, postData, function (res) { -// // 保存成功后才回调 -// if (!!callBack) { -// callBack(); -// } -// }); -// }; -// page.init(); -//} - var acceptClick; var keyValue = request('keyValue'); var bootstrap = function ($, learun) { "use strict"; - var ue; var page = { init: function () { + $('.lr-form-wrap').lrscroll(); page.bind(); page.initData(); }, bind: function () { - //公告类别 - $('#T_typename').lrDataItemSelect({ - code: 'Notice_Train_Teams', - maxHeight: 230, - select: function (item) { - if (item != null && item != undefined) { - $("#T_type").val(item.text); - } - } - }); - $('#Files').lrUploader(); - $('#Noticedept').lrDepartmentSelect({ type: 'treemultiple' }); - //内容编辑器 - ue = UE.getEditor('editor'); + $('#Teamusers').lrUserSelect(1); + //$('#Teamusers').lrDataSourceSelect({ code: 'teacheruserdata',value: 'f_userid',text: 'f_userid' }); }, initData: function () { if (!!keyValue) { - //$('#form').lrSetFormData(selectedRow); - //$("#F_ReleaseTime").val(learun.formatDate(selectedRow.F_ReleaseTime, 'yyyy/MM/dd hh:mm')); $.lrSetForm(top.$.rootUrl + '/Ask/Notice_Train_Teams/GetFormData?keyValue=' + keyValue, function (data) { - $('#form').lrSetFormData(data); - setTimeout(function () { - ue.setContent(data.T_Content); - }, 100); + for (var id in data) { + if (!!data[id].length && data[id].length > 0) { + $('#' + id ).jfGridSet('refreshdata', data[id]); + } + else { + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } }); } } }; + // 保存数据 acceptClick = function (callBack) { - if (!$('#form').lrValidform()) { + if (!$('body').lrValidform()) { return false; } - learun.clientdata.getAsync('dataItem', { - key: $("#T_typename").lrselectGet(), - code: 'Notice_Train_Teams', - callback: function (_data) { - $("#T_type").val(_data.text); - - var postData = $('#form').lrGetFormData(keyValue); - postData["T_Content"] = ue.getContent(null, null, true); - //var postData = {}; - //postData.strEntity = $('#form').lrGetFormData(keyValue); - - $.lrSaveForm(top.$.rootUrl + '/Ask/Notice_Train_Teams/SaveFormAndSubmit?keyValue=' + keyValue, postData, function (res) { - // 保存成功后才回调 - if (!!callBack) { - callBack(); - } - }); + var postData = { + strEntity: JSON.stringify($('body').lrGetFormData()) + }; + $.lrSaveForm(top.$.rootUrl + '/Ask/Notice_Train_Teams/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); } }); - } + }; page.init(); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Index.cshtml index 4d588564d..316e32edb 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Index.cshtml @@ -1,5 +1,5 @@ @{ - ViewBag.Title = "运动对集训安排"; + ViewBag.Title = "队伍管理"; Layout = "~/Views/Shared/_Index.cshtml"; }
@@ -7,20 +7,14 @@
-
- -
-
-  查询 -
- diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Index.js index 2412d8819..b893826ad 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_Train_Teams/Index.js @@ -1,8 +1,8 @@ /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 * 创建人:超级管理员 - * 日 期:2023-09-28 14:30 - * 描 述:运动对集训安排 + * 日 期:2023-10-18 00:50 + * 描 述:队伍管理 */ var refreshGirdData; var bootstrap = function ($, learun) { @@ -13,11 +13,6 @@ var bootstrap = function ($, learun) { page.bind(); }, bind: function () { - // 查询 - $('#btn_Search').on('click', function () { - var keyword = $('#txt_Keyword').val(); - page.search({ keyword: keyword }); - }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); @@ -28,8 +23,8 @@ var bootstrap = function ($, learun) { id: 'form', title: '新增', url: top.$.rootUrl + '/Ask/Notice_Train_Teams/Form', - width: 1000, - height: 650, + width: 600, + height: 400, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } @@ -37,14 +32,14 @@ var bootstrap = function ($, learun) { }); // 编辑 $('#lr_edit').on('click', function () { - var keyValue = $('#gridtable').jfGridValue('T_id'); + var keyValue = $('#gridtable').jfGridValue('BelongId'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/Ask/Notice_Train_Teams/Form?keyValue=' + keyValue, - width: 1000, - height: 650, + width: 600, + height: 400, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } @@ -53,7 +48,7 @@ var bootstrap = function ($, learun) { }); // 删除 $('#lr_delete').on('click', function () { - var keyValue = $('#gridtable').jfGridValue('T_id'); + var keyValue = $('#gridtable').jfGridValue('BelongId'); if (learun.checkrow(keyValue)) { learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { @@ -70,40 +65,26 @@ var bootstrap = function ($, learun) { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/Ask/Notice_Train_Teams/GetPageList', headData: [ - { label: "标题", name: "T_title", width: 100, align: "left"}, - { label: "类别", name: "T_type", width: 100, align: "left"}, - { label: "发布时间", name: "Createtime", width: 100, align: "left"}, - { label: "信息来源", name: "Source", width: 100, align: "left"}, - { label: "来源地址", name: "SourceUrl", width: 100, align: "left"}, - { label: "下发部门", name: "Noticedept", width: 100, align: "left", - formatterAsync: function (callback, value, row, op, $cell) { - if (value) { - learun.clientdata.getsAsync('custmerData', { - url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata', - key: value, - keyId: 'id', - textId: 'name', - callback: function (text) { - callback(text); - } - }); - } + { label: "队伍名称", name: "Name", width: 100, align: "left"}, + { label: "下拉框", name: "Teamusers", width: 100, align: "left", + formatterAsync: function (callback, value, row, op,$cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata', + key: value, + keyId: 'f_userid', + callback: function (_data) { + callback(_data['f_userid']); + } + }); }}, - //{ label: "附件上传", name: "Files", width: 100, align: "left"}, - //{ label: "内容", name: "T_Content", width: 100, align: "left"}, ], - mainId: 'T_id', - reloadSelected: true, - isMultiselect: true, - isPage: true, - sidx: 'Createtime', - sord: 'desc' + mainId:'BelongId', + isPage: true }); page.search(); }, search: function (param) { param = param || {}; - param.Type = "4"; $('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); } }; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Ask/Notice_Train_TeamsMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Ask/Notice_Train_TeamsMap.cs index 9263f525d..e4a2ad694 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Ask/Notice_Train_TeamsMap.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Ask/Notice_Train_TeamsMap.cs @@ -7,8 +7,8 @@ namespace Learun.Application.Mapping /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 /// 创 建:超级管理员 - /// 日 期:2023-09-28 14:30 - /// 描 述:运动对集训安排 + /// 日 期:2023-10-18 00:50 + /// 描 述:队伍管理 /// public class Notice_Train_TeamsMap : EntityTypeConfiguration { @@ -18,7 +18,7 @@ namespace Learun.Application.Mapping //表 this.ToTable("NOTICE_TRAIN_TEAMS"); //主键 - this.HasKey(t => t.T_id); + this.HasKey(t => t.Id); #endregion #region 配置关系 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Sum/Notice_Train_SumEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Sum/Notice_Train_SumEntity.cs index 90d8fe73d..a99b9576b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Sum/Notice_Train_SumEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Sum/Notice_Train_SumEntity.cs @@ -59,6 +59,11 @@ namespace Learun.Application.TwoDevelopment.Ask /// [Column("TYPENAME")] public string Typename { get; set; } + /// + /// Typename + /// + [Column("TEAMID")] + public string Teamid { get; set; } #endregion #region 扩展操作 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsBLL.cs index ca256dd09..b4c48603a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsBLL.cs @@ -9,8 +9,8 @@ namespace Learun.Application.TwoDevelopment.Ask /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 /// 创 建:超级管理员 - /// 日 期:2023-09-28 14:30 - /// 描 述:运动对集训安排 + /// 日 期:2023-10-18 00:50 + /// 描 述:队伍管理 /// public class Notice_Train_TeamsBLL : Notice_Train_TeamsIBLL { @@ -67,30 +67,6 @@ namespace Learun.Application.TwoDevelopment.Ask } } - /// - /// 获取NoticeLog_Train_Teams表实体数据 - /// - /// 主键 - /// - public NoticeLog_Train_TeamsEntity GetNoticeLog_Train_TeamsEntity(string keyValue) - { - try - { - return notice_Train_TeamsService.GetNoticeLog_Train_TeamsEntity(keyValue); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - #endregion #region 提交数据 @@ -124,11 +100,11 @@ namespace Learun.Application.TwoDevelopment.Ask /// 主键 /// 实体 /// - public void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity,NoticeLog_Train_TeamsEntity noticeLog_Train_TeamsEntity) + public void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity) { try { - notice_Train_TeamsService.SaveEntity(keyValue, entity,noticeLog_Train_TeamsEntity); + notice_Train_TeamsService.SaveEntity(keyValue, entity); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsEntity.cs index 1bc292860..28a9e657a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsEntity.cs @@ -8,82 +8,37 @@ namespace Learun.Application.TwoDevelopment.Ask /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 /// 创 建:超级管理员 - /// 日 期:2023-09-28 14:30 - /// 描 述:运动对集训安排 + /// 日 期:2023-10-18 00:50 + /// 描 述:队伍管理 /// public class Notice_Train_TeamsEntity { #region 实体成员 /// - /// T_id + /// Id /// - [Column("T_ID")] - public string T_id { get; set; } + [Column("ID")] + public string Id { get; set; } /// - /// T_type + /// Name /// - [Column("T_TYPE")] - public string T_type { get; set; } + [Column("NAME")] + public string Name { get; set; } /// - /// T_type + /// Teamusers /// - [Column("T_TYPENAME")] - public string T_typename { get; set; } - /// - /// T_title - /// - [Column("T_TITLE")] - public string T_title { get; set; } - /// - /// Source - /// - [Column("SOURCE")] - public string Source { get; set; } - /// - /// SourceUrl - /// - [Column("SOURCEURL")] - public string SourceUrl { get; set; } - /// - /// Files - /// - [Column("FILES")] - public string Files { get; set; } - /// - /// T_Content - /// - [Column("T_CONTENT")] - public string T_Content { get; set; } - /// - /// Noticedept - /// - [Column("NOTICEDEPT")] - public string Noticedept { get; set; } - /// - /// Noticepeople - /// - [Column("NOTICEPEOPLE")] - public string Noticepeople { get; set; } + [Column("TEAMUSERS")] + public string Teamusers { get; set; } /// /// Createtime /// [Column("CREATETIME")] public DateTime? Createtime { get; set; } /// - /// Updatetime - /// - [Column("UPDATETIME")] - public DateTime? Updatetime { get; set; } - /// /// Creator /// [Column("CREATOR")] public string Creator { get; set; } - /// - /// Status - /// - [Column("STATUS")] - public int? Status { get; set; } #endregion #region 扩展操作 @@ -92,16 +47,10 @@ namespace Learun.Application.TwoDevelopment.Ask /// public void Create() { - this.T_id = Guid.NewGuid().ToString(); - //this.F_CreateDate = DateTime.Now; - //this.F_ReleaseTime = DateTime.Now; - //this.F_DeleteMark = 0; - //this.F_EnabledMark = 0; - //this.F_PV = 0; - + this.Id = Guid.NewGuid().ToString(); UserInfo userInfo = LoginUserInfo.Get(); this.Creator = userInfo.userId; - //this.F_CreateUserName = userInfo.realName; + this.Createtime = DateTime.Now; } /// /// 编辑调用 @@ -109,7 +58,10 @@ namespace Learun.Application.TwoDevelopment.Ask /// public void Modify(string keyValue) { - this.T_id = keyValue; + this.Id = keyValue; + this.Createtime = DateTime.Now; + UserInfo userInfo = LoginUserInfo.Get(); + this.Creator = userInfo.userId; } #endregion #region 扩展字段 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsIBLL.cs index 01b4b37da..95344b0b6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsIBLL.cs @@ -8,8 +8,8 @@ namespace Learun.Application.TwoDevelopment.Ask /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 /// 创 建:超级管理员 - /// 日 期:2023-09-28 14:30 - /// 描 述:运动对集训安排 + /// 日 期:2023-10-18 00:50 + /// 描 述:队伍管理 /// public interface Notice_Train_TeamsIBLL { @@ -27,12 +27,6 @@ namespace Learun.Application.TwoDevelopment.Ask /// 主键 /// Notice_Train_TeamsEntity GetNotice_Train_TeamsEntity(string keyValue); - /// - /// 获取NoticeLog_Train_Teams表实体数据 - /// - /// 主键 - /// - NoticeLog_Train_TeamsEntity GetNoticeLog_Train_TeamsEntity(string keyValue); #endregion #region 提交数据 @@ -47,7 +41,7 @@ namespace Learun.Application.TwoDevelopment.Ask /// /// 主键 /// 实体 - void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity,NoticeLog_Train_TeamsEntity noticeLog_Train_TeamsEntity); + void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity); #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsService.cs index 680f4073a..4417d11ac 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Teams/Notice_Train_TeamsService.cs @@ -12,8 +12,8 @@ namespace Learun.Application.TwoDevelopment.Ask /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 /// 创 建:超级管理员 - /// 日 期:2023-09-28 14:30 - /// 描 述:运动对集训安排 + /// 日 期:2023-10-18 00:50 + /// 描 述:队伍管理 /// public class Notice_Train_TeamsService : RepositoryFactory { @@ -31,8 +31,7 @@ namespace Learun.Application.TwoDevelopment.Ask { var strSql = new StringBuilder(); strSql.Append("SELECT "); - strSql.Append(@" - t.* + strSql.Append(@" * "); strSql.Append(" FROM Notice_Train_Teams t "); strSql.Append(" WHERE 1=1 "); @@ -63,31 +62,7 @@ namespace Learun.Application.TwoDevelopment.Ask { try { - return this.BaseRepository("CollegeMIS").FindEntity(keyValue); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - - /// - /// 获取NoticeLog_Train_Teams表实体数据 - /// - /// 主键 - /// - public NoticeLog_Train_TeamsEntity GetNoticeLog_Train_TeamsEntity(string keyValue) - { - try - { - return this.BaseRepository("CollegeMIS").FindEntity(t=>t.N_id == keyValue); + return this.BaseRepository("CollegeMIS").FindEntity(keyValue.ToInt()); } catch (Exception ex) { @@ -112,17 +87,12 @@ namespace Learun.Application.TwoDevelopment.Ask /// 主键 public void DeleteEntity(string keyValue) { - var db = this.BaseRepository("CollegeMIS").BeginTrans(); try { - var notice_Train_TeamsEntity = GetNotice_Train_TeamsEntity(keyValue); - db.Delete(t=>t.T_id == keyValue); - //db.Delete(t=>t.N_id == notice_Train_TeamsEntity.T_id); - db.Commit(); + this.BaseRepository("CollegeMIS").Delete(t=>t.Id == keyValue); } catch (Exception ex) { - db.Rollback(); if (ex is ExceptionEx) { throw; @@ -139,34 +109,23 @@ namespace Learun.Application.TwoDevelopment.Ask /// /// 主键 /// 实体 - public void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity,NoticeLog_Train_TeamsEntity noticeLog_Train_TeamsEntity) + public void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity) { - var db = this.BaseRepository("CollegeMIS").BeginTrans(); try { if (!string.IsNullOrEmpty(keyValue)) { - var notice_Train_TeamsEntityTmp = GetNotice_Train_TeamsEntity(keyValue); entity.Modify(keyValue); - db.Update(entity); - //db.Delete(t=>t.N_id == notice_Train_TeamsEntityTmp.T_id); - //noticeLog_Train_TeamsEntity.Create(); - //noticeLog_Train_TeamsEntity.N_id = notice_Train_TeamsEntityTmp.T_id; - //db.Insert(noticeLog_Train_TeamsEntity); + this.BaseRepository("CollegeMIS").Update(entity); } else { entity.Create(); - db.Insert(entity); - //noticeLog_Train_TeamsEntity.Create(); - //noticeLog_Train_TeamsEntity.N_id = entity.T_id; - //db.Insert(noticeLog_Train_TeamsEntity); + this.BaseRepository("CollegeMIS").Insert(entity); } - db.Commit(); } catch (Exception ex) { - db.Rollback(); if (ex is ExceptionEx) { throw; From e76968960ae35a3644a612912e9acf684b5731bf Mon Sep 17 00:00:00 2001 From: hwh2023 <598694955@qq.com> Date: Thu, 19 Oct 2023 14:24:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=AD=E7=BB=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Notice_TrainTeamController.cs | 409 ++++++++++++++++++ .../Ask/Views/Notice_TrainTeam/Form.cshtml | 53 +++ .../Areas/Ask/Views/Notice_TrainTeam/Form.js | 116 +++++ .../Ask/Views/Notice_TrainTeam/Index.cshtml | 32 ++ .../Areas/Ask/Views/Notice_TrainTeam/Index.js | 116 +++++ .../Learun.Application.Web.csproj | 5 + 6 files changed, 731 insertions(+) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_TrainTeamController.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Form.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Form.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Index.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Index.js diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_TrainTeamController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_TrainTeamController.cs new file mode 100644 index 000000000..417178b70 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_TrainTeamController.cs @@ -0,0 +1,409 @@ +using Learun.Util; +using System.Data; +using Learun.Application.TwoDevelopment.Ask; +using System.Web.Mvc; +using System.Collections.Generic; +using Learun.Application.Organization; +using Learun.Application.TwoDevelopment.LR_Desktop; +using System; +using Learun.Util.Operat; +using Newtonsoft.Json; +using System.Threading.Tasks; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Application.Base.AuthorizeModule; +using System.Linq; + +namespace Learun.Application.Web.Areas.Ask.Controllers +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2023-10-12 10:31 + /// 描 述:运动员集训安排 + /// + public class Notice_TrainTeamController : MvcControllerBase + { + private Notice_Train_SportsIBLL notice_Train_SportsIBLL = new Notice_Train_SportsBLL(); + private NoticeLog_Train_SportsIBLL noticeLog_Train_SportsIBLL = new NoticeLog_Train_SportsBLL(); + + + private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); + private MessageRindIBLL messageRindIBLL = new MessageRindBLL(); + private WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); + private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); + private UserIBLL userIbll = new UserBLL(); + private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); + + #region 视图功能 + + /// + /// 主页面 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult Form() + { + return View(); + } + /// + /// 管理页面【查看通知公告】 + /// + /// + [HttpGet] + public ActionResult ViewIndex() + { + return View(); + } + /// + /// 表单页面【查看通知公告】 + /// + /// + [HttpGet] + public ActionResult ViewForm() + { + return View(); + } + + /// + /// 列表详情查看 + /// + /// + [HttpGet] + public ActionResult ListContentIndex() + { + return View(); + } + #endregion + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = notice_Train_SportsIBLL.GetPageList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + /// + /// 获取表单数据 + /// + /// 主键 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFormData(string keyValue) + { + var data = notice_Train_SportsIBLL.GetNotice_Train_SportsEntity(keyValue); + data.T_Content = WebHelper.HtmlDecode(data.T_Content); + return JsonResult(data); + //var Notice_Train_SportsData = notice_Train_SportsIBLL.GetNotice_Train_SportsEntity( keyValue ); + //var jsonData = new { + // Notice_Train_Sports = Notice_Train_SportsData, + //}; + //return Success(jsonData); + } + + + public ActionResult GetListOfSelfForView(string queryJson) + { + var newsList = notice_Train_SportsIBLL.GetListOfSelf(queryJson); + return JsonResult(newsList); + } + /// + /// 获取实体数据 + /// + /// 主键 + /// + public ActionResult GetEntity(string keyValue) + { + var data = notice_Train_SportsIBLL.GetNotice_Train_SportsEntity(keyValue); + data.T_Content = WebHelper.HtmlDecode(data.T_Content); + return JsonResult(data); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + notice_Train_SportsIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveForm(string keyValue, string strEntity) + { + Notice_Train_SportsEntity entity = strEntity.ToObject(); + entity.Type = "4"; + notice_Train_SportsIBLL.SaveEntity(keyValue,entity); + if (keyValue != null) + { + } + return Success("保存成功!"); + } + #endregion + + #region 扩展数据 + + /// + /// 获取页面显示列表数据 + /// + /// 新闻编号 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetNewsReadList(string newsId) + { + var data = noticeLog_Train_SportsIBLL.GetNoticeLog_Train_SportsList(newsId).ToList().OrderBy(x => x.RTime); + var jsonData = new + { + rows = data + }; + return Success(jsonData); + } + + /// + /// 阅读通知公告 + /// 主键 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult NewsRead(string newsId) + { + var loginUserInfo = LoginUserInfo.Get(); + + //判断当前用户是否阅读当前通知公告 + var entity = noticeLog_Train_SportsIBLL.GetNoticeLog_Train_SportsEntityByNewsIdAndUserId(newsId, loginUserInfo.userId); + if (entity == null) + { + var lR_OA_NewsRead = new NoticeLog_Train_SportsEntity() + { + NewsId = newsId, + RUserId = loginUserInfo.userId, + RUserName = loginUserInfo.realName, + RTime = DateTime.Now + }; + noticeLog_Train_SportsIBLL.SaveEntity("", lR_OA_NewsRead); + + //修改当前通知公告的浏览量 + //noticeLog_Train_SportsIBLL.UpdateNewsPV(newsId); + } + //判断消息提醒表中的消息是否已读 + var mrentity = messageRindIBLL.GetMessageRemindEntityByInstanceId(newsId, loginUserInfo.userId); + if (mrentity != null) + { + if (!mrentity.ReadSigns.HasValue || mrentity.ReadSigns.Value != true) + { + //修改消息为已读 + messageRindIBLL.SaveReadSigns(mrentity.MessageId); + } + } + + return Success("阅读成功!"); + } + #endregion + + + #region 消息推送处理 + [HttpPost, ValidateAntiForgeryToken, AjaxOnly, ValidateInput(false)] + public ActionResult SaveFormAndSubmit(string keyValue, Notice_Train_SportsEntity entity) + { + entity.Type = "1"; + entity.T_Content = WebHelper.HtmlEncode(entity.T_Content); + notice_Train_SportsIBLL.SaveEntity(keyValue, entity); + //推送通知 + //读取信息推送管理-通知公告推送(01)的配置 + var informationPushEntity = sys_InformationPushIBLL.GetEntityByPushItem("01"); + if (informationPushEntity != null && informationPushEntity.Status == true) + { + //推送微信 + Task.Run(async () => { await DoWeixinPush(entity); }); + } + return Success("保存成功!"); + } + Task DoWeixinPush(Notice_Train_SportsEntity entity) + { + //微信推送 + try + { + var allteacherlist = userIbll.GetAllList().Where(m => + m.F_DeleteMark != 1 && m.F_EnabledMark == 1 && m.F_Description == "教师"); + var userralationlist = userRelationIBLL.GetUserIdList("2"); + var needpostuserlist = new List(); + if (!string.IsNullOrEmpty(entity.Noticedept)) + { + if (!entity.Noticedept.Contains(",")) + { + var departteacherlist = allteacherlist.Where(m => entity.Noticedept == m.F_DepartmentId); + needpostuserlist.AddRange(departteacherlist.ToList()); + if (!string.IsNullOrEmpty(entity.Noticepeople)) + { + var newpostuserlist = new List(); + foreach (var uuitem in needpostuserlist) + { + var postids = userralationlist?.Count(m => m.F_UserId == uuitem.F_UserId && entity.Noticepeople.Contains(m.F_ObjectId)); + if (postids > 0) + { + newpostuserlist.Add(uuitem); + } + } + needpostuserlist = newpostuserlist; + } + } + else + { + foreach (var senddeptid in entity.Noticedept.Split(',')) + { + var departteacherlist = allteacherlist.Where(m => senddeptid == m.F_DepartmentId); + needpostuserlist.AddRange(departteacherlist.ToList()); + if (!string.IsNullOrEmpty(entity.Noticepeople)) + { + var newpostuserlist = new List(); + foreach (var uuitem in needpostuserlist) + { + var postids = userralationlist?.Count(m => m.F_UserId == uuitem.F_UserId && entity.Noticepeople.Contains(m.F_ObjectId)); + if (postids > 0) + { + newpostuserlist.Add(uuitem); + } + } + needpostuserlist = newpostuserlist; + } + } + } + } + PushWeixin(needpostuserlist, entity.T_title); + + //消息提醒表 + PushMessageRemind(needpostuserlist, entity); + return Task.CompletedTask; + } + catch (Exception e) + { + return Task.FromException(e); + } + } + + public void PushWeixin(List needpostuserlist, string title) + { + var WeChatConfigentity = weChatConfigIbll.GetEnableEntity(); + string appid = WeChatConfigentity.APPId; + string secret = WeChatConfigentity.secret; + var wechatemplete = weChatTempletIbll.GetWeChatTemplateEntityByCodeConfigId(WeChatConfigentity.ID, "task"); + string weixintaskurl = wechatemplete.TUrl; + string weixintasktempid = wechatemplete.TempId; + var responsejson = Util.HttpMethods.HttpGet("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret); + + OperateLogModel operateLogModel = new OperateLogModel(); + operateLogModel.title = title; + operateLogModel.type = OperationType.Other; + operateLogModel.url = "NoticeController"; + operateLogModel.sourceObjectId = "002"; + operateLogModel.sourceContentJson = responsejson; + OperatorHelper.Instance.WriteOperateLog(operateLogModel); + + foreach (UserEntity userinfo in needpostuserlist) + { + if (userinfo != null && !string.IsNullOrEmpty(userinfo.OpenIdForWeixin)) + { + //执行推送任务 + if (!string.IsNullOrEmpty(appid) && !string.IsNullOrEmpty(secret) && !string.IsNullOrEmpty(weixintaskurl) && !string.IsNullOrEmpty(weixintasktempid)) + { + if (!string.IsNullOrEmpty(responsejson)) + { + var weixintokenobj = JsonConvert.DeserializeObject(responsejson); + if (string.IsNullOrEmpty(weixintokenobj.errcode)) + { + string access_token = weixintokenobj.access_token; + string jsondata = "{\"touser\":\"" + userinfo.OpenIdForWeixin + "\"," + + "\"template_id\":\"" + weixintasktempid + "\"," + + "\"url\":\"" + weixintaskurl + "\"," + + "\"data\":{" + + "\"first\": {\"value\":\"您有新的未读通知公告\",\"color\":\"#173177\"}," + + "\"keyword1\":{\"value\":\"未读通知公告\",\"color\":\"#173177\"}," + + "\"keyword2\": {\"value\":\"" + title + "\",\"color\":\"#173177\"}," + + "\"keyword3\": {\"value\":\"待查看\",\"color\":\"#173177\"}," + + "\"keyword4\": {\"value\":\"您有新的未读通知公告【" + title + "】\",\"color\":\"#173177\"}" + + "}" + + "}"; + string pushresult = Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); + + operateLogModel.title = title; + operateLogModel.type = OperationType.Other; + operateLogModel.url = "NoticeController"; + operateLogModel.sourceObjectId = "002"; + operateLogModel.sourceContentJson = pushresult; + OperatorHelper.Instance.WriteOperateLog(operateLogModel); + } + } + } + } + } + } + + /// + /// 消息提醒 + /// + /// + /// + public void PushMessageRemind(List needpostuserlist, Notice_Train_SportsEntity model) + { + foreach (UserEntity userinfo in needpostuserlist) + { + MessageRemindEntity entity = new MessageRemindEntity(); + entity.ReceiptId = userinfo.F_UserId; + entity.ReceiptName = userinfo.F_RealName; + entity.SenderId = model.Creator; + entity.SenderName = model.Creator; + entity.TheTitle = "通知公告"; + entity.TheContent = model.T_title; + entity.InstanceId = model.T_id; + entity.ConnectionUrl = "/Utility/ListContentIndex?id="; + entity.SendTime = DateTime.Now; + entity.ReadSigns = false; + messageRindIBLL.SaveEntity("", entity); + } + + } + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Form.cshtml new file mode 100644 index 000000000..09585b9fc --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Form.cshtml @@ -0,0 +1,53 @@ +@{ + ViewBag.Title = "运动员集训安排"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +@*
+
+
标题*
+ +
+
*@ + +
+
+
公告标题*
+ +
+
+
公告类别*
+
+ +
+
+
发布时间*
+ +
+
+
信息来源
+ +
+
+
来源地址
+ +
+
+
接收部门
+
+
+
+
接收人
+
+
+
+
附件上传
+
+
+
+
公告内容
+
+ @**@ +
+
+@Html.AppendJsFile("/Areas/Ask/Views/Notice_Train_Sports/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Form.js new file mode 100644 index 000000000..6ea25be0d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Form.js @@ -0,0 +1,116 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2023-10-12 10:31 + * 描 述:运动员集训安排 + */ +//var acceptClick; +//var keyValue = request('keyValue'); +//var bootstrap = function ($, learun) { +// "use strict"; +// var page = { +// init: function () { +// $('.lr-form-wrap').lrscroll(); +// page.bind(); +// page.initData(); +// }, +// bind: function () { +// }, +// initData: function () { +// if (!!keyValue) { +// $.lrSetForm(top.$.rootUrl + '/Ask/Notice_Train_Sports/GetFormData?keyValue=' + keyValue, function (data) { +// for (var id in data) { +// if (!!data[id].length && data[id].length > 0) { +// $('#' + id ).jfGridSet('refreshdata', data[id]); +// } +// else { +// $('[data-table="' + id + '"]').lrSetFormData(data[id]); +// } +// } +// }); +// } +// } +// }; +// // 保存数据 +// acceptClick = function (callBack) { +// if (!$('body').lrValidform()) { +// return false; +// } +// var postData = { +// strEntity: JSON.stringify($('body').lrGetFormData()) +// }; +// $.lrSaveForm(top.$.rootUrl + '/Ask/Notice_Train_Sports/SaveForm?keyValue=' + keyValue, postData, function (res) { +// // 保存成功后才回调 +// if (!!callBack) { +// callBack(); +// } +// }); +// }; +// page.init(); +//} + +var acceptClick; +var keyValue = request('keyValue'); +var bootstrap = function ($, learun) { + "use strict"; + var ue; + var page = { + init: function () { + page.bind(); + page.initData(); + }, + bind: function () { + //公告类别 + $('#T_typename').lrDataItemSelect({ + code: 'Notice_Train_Sports', maxHeight: 230, select: function (item) { + if (item != null && item != undefined) { + $("#T_type").val(item.text); + } + } + }); + $('#Noticepeople').lrUserSelect(1); + $('#Files').lrUploader(); + $('#Noticedept').lrDepartmentSelect({ type: 'treemultiple' }); + $('#Noticepeople').lrDataItemSelect({ code: '' }); + //内容编辑器 + ue = UE.getEditor('editor'); + }, + initData: function () { + if (!!keyValue) { + //$('#form').lrSetFormData(selectedRow); + //$("#F_ReleaseTime").val(learun.formatDate(selectedRow.F_ReleaseTime, 'yyyy/MM/dd hh:mm')); + $.lrSetForm(top.$.rootUrl + '/Ask/Notice_Train_Sports/GetFormData?keyValue=' + keyValue, function (data) { + $('#form').lrSetFormData(data); + setTimeout(function () { + ue.setContent(data.T_Content); + }, 100); + }); + } + } + }; + acceptClick = function (callBack) { + if (!$('#form').lrValidform()) { + return false; + } + learun.clientdata.getAsync('dataItem', { + key: $("#T_typename").lrselectGet(), + code: 'Notice_Train_Sports', + callback: function (_data) { + $("#T_type").val(_data.text); + + var postData = $('#form').lrGetFormData(keyValue); + postData["T_Content"] = ue.getContent(null, null, true); + //var postData = {}; + //postData.strEntity = $('#form').lrGetFormData(keyValue); + + $.lrSaveForm(top.$.rootUrl + '/Ask/Notice_Train_Sports/SaveFormAndSubmit?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + } + }); + } + page.init(); +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Index.cshtml new file mode 100644 index 000000000..1857032cc --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Index.cshtml @@ -0,0 +1,32 @@ +@{ + ViewBag.Title = "运动员集训安排"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+ +
+
+  查询 +
+
+
+
+ +
+ +
+
+
+
+
+
+@Html.AppendJsFile("/Areas/Ask/Views/Notice_Train_Sports/Index.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Index.js new file mode 100644 index 000000000..03b77eb32 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Views/Notice_TrainTeam/Index.js @@ -0,0 +1,116 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2023-10-12 10:31 + * 描 述:运动员集训安排 + */ +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + // 查询 + $('#btn_Search').on('click', function () { + var keyword = $('#txt_Keyword').val(); + page.search({ keyword: keyword }); + }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + // 新增 + $('#lr_add').on('click', function () { + learun.layerForm({ + id: 'form', + title: '新增', + url: top.$.rootUrl + '/Ask/Notice_Train_Sports/Form', + width: 1000, + height: 650, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('T_id'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/Ask/Notice_Train_Sports/Form?keyValue=' + keyValue, + width: 1000, + height: 650, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + // 删除 + $('#lr_delete').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('T_id'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认删除该项!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/Ask/Notice_Train_Sports/DeleteForm', { keyValue: keyValue}, function () { + refreshGirdData(); + }); + } + }); + } + }); + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/Ask/Notice_Train_Sports/GetPageList', + headData: [ + { label: "标题", name: "T_title", width: 100, align: "left" }, + { label: "类别", name: "T_type", width: 100, align: "left" }, + { label: "发布时间", name: "Createtime", width: 100, align: "left" }, + { label: "信息来源", name: "Source", width: 100, align: "left" }, + { label: "来源地址", name: "SourceUrl", width: 100, align: "left" }, + { + label: "下发部门", name: "Noticedept", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + if (value) { + learun.clientdata.getsAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata', + key: value, + keyId: 'id', + textId: 'name', + callback: function (text) { + callback(text); + } + }); + } + } + }, + //{ label: "附件上传", name: "Files", width: 100, align: "left"}, + //{ label: "内容", name: "T_Content", width: 100, align: "left" }, + ], + mainId: 'T_id', + reloadSelected: true, + isMultiselect: true, + isPage: true, + sidx: 'Createtime', + sord: 'desc' + }); + page.search(); + }, + search: function (param) { + param = param || {}; + param.Type = "4"; + $('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 98ad6cc48..acde77549 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -309,6 +309,7 @@ + @@ -930,6 +931,8 @@ + + @@ -8353,6 +8356,8 @@ + + From 566bdae5f9600f769acce2f079b39e0c45a1ba37 Mon Sep 17 00:00:00 2001 From: hwh2023 <598694955@qq.com> Date: Fri, 20 Oct 2023 16:50:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=AD=E7=BB=83?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Notice_TrainTeamController.cs | 41 +++++++----------- .../Notice_Train_CoachController.cs | 43 +++++++------------ .../Notice_Train_SportsController.cs | 41 +++++++----------- .../Notice_Train_SportsService.cs | 5 ++- 4 files changed, 49 insertions(+), 81 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_TrainTeamController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_TrainTeamController.cs index 417178b70..87893be32 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_TrainTeamController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_TrainTeamController.cs @@ -275,19 +275,6 @@ namespace Learun.Application.Web.Areas.Ask.Controllers { var departteacherlist = allteacherlist.Where(m => entity.Noticedept == m.F_DepartmentId); needpostuserlist.AddRange(departteacherlist.ToList()); - if (!string.IsNullOrEmpty(entity.Noticepeople)) - { - var newpostuserlist = new List(); - foreach (var uuitem in needpostuserlist) - { - var postids = userralationlist?.Count(m => m.F_UserId == uuitem.F_UserId && entity.Noticepeople.Contains(m.F_ObjectId)); - if (postids > 0) - { - newpostuserlist.Add(uuitem); - } - } - needpostuserlist = newpostuserlist; - } } else { @@ -295,22 +282,24 @@ namespace Learun.Application.Web.Areas.Ask.Controllers { var departteacherlist = allteacherlist.Where(m => senddeptid == m.F_DepartmentId); needpostuserlist.AddRange(departteacherlist.ToList()); - if (!string.IsNullOrEmpty(entity.Noticepeople)) - { - var newpostuserlist = new List(); - foreach (var uuitem in needpostuserlist) - { - var postids = userralationlist?.Count(m => m.F_UserId == uuitem.F_UserId && entity.Noticepeople.Contains(m.F_ObjectId)); - if (postids > 0) - { - newpostuserlist.Add(uuitem); - } - } - needpostuserlist = newpostuserlist; - } } } } + + if (!string.IsNullOrEmpty(entity.Noticepeople)) + { + var newpostuserlist = new List(); + string[] strs = entity.Noticepeople.Split(','); + foreach (var uuitem in strs) + { + var postids = allteacherlist.Where(m => m.F_UserId == uuitem).FirstOrDefault(); + if (postids != null) + { + newpostuserlist.Add(postids); + } + } + needpostuserlist = newpostuserlist; + } PushWeixin(needpostuserlist, entity.T_title); //消息提醒表 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_CoachController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_CoachController.cs index af86e7acc..26f516a2e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_CoachController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_CoachController.cs @@ -163,19 +163,6 @@ namespace Learun.Application.Web.Areas.Ask.Controllers { var departteacherlist = allteacherlist.Where(m => entity.Noticedept == m.F_DepartmentId); needpostuserlist.AddRange(departteacherlist.ToList()); - if (!string.IsNullOrEmpty(entity.Noticepeople)) - { - var newpostuserlist = new List(); - foreach (var uuitem in needpostuserlist) - { - var postids = userralationlist?.Count(m => m.F_UserId == uuitem.F_UserId && entity.Noticepeople.Contains(m.F_ObjectId)); - if (postids > 0) - { - newpostuserlist.Add(uuitem); - } - } - needpostuserlist = newpostuserlist; - } } else { @@ -183,22 +170,24 @@ namespace Learun.Application.Web.Areas.Ask.Controllers { var departteacherlist = allteacherlist.Where(m => senddeptid == m.F_DepartmentId); needpostuserlist.AddRange(departteacherlist.ToList()); - if (!string.IsNullOrEmpty(entity.Noticepeople)) - { - var newpostuserlist = new List(); - foreach (var uuitem in needpostuserlist) - { - var postids = userralationlist?.Count(m => m.F_UserId == uuitem.F_UserId && entity.Noticepeople.Contains(m.F_ObjectId)); - if (postids > 0) - { - newpostuserlist.Add(uuitem); - } - } - needpostuserlist = newpostuserlist; - } } } } + + if (!string.IsNullOrEmpty(entity.Noticepeople)) + { + var newpostuserlist = new List(); + string[] strs = entity.Noticepeople.Split(','); + foreach (var uuitem in strs) + { + var postids = allteacherlist.Where(m => m.F_UserId == uuitem).FirstOrDefault(); + if (postids !=null) + { + newpostuserlist.Add(postids); + } + } + needpostuserlist = newpostuserlist; + } PushWeixin(needpostuserlist, entity.T_title); //消息提醒表 @@ -285,7 +274,7 @@ namespace Learun.Application.Web.Areas.Ask.Controllers entity.TheTitle = "通知公告"; entity.TheContent = model.T_title; entity.InstanceId = model.T_id; - entity.ConnectionUrl = "/Utility/ListContentIndex?id="; + entity.ConnectionUrl = "/Ask/Notice_Train_Sports/ListContentIndex?id="; entity.SendTime = DateTime.Now; entity.ReadSigns = false; messageRindIBLL.SaveEntity("", entity); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_SportsController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_SportsController.cs index bba92e008..d8b7cad00 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_SportsController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Ask/Controllers/Notice_Train_SportsController.cs @@ -275,19 +275,6 @@ namespace Learun.Application.Web.Areas.Ask.Controllers { var departteacherlist = allteacherlist.Where(m => entity.Noticedept == m.F_DepartmentId); needpostuserlist.AddRange(departteacherlist.ToList()); - if (!string.IsNullOrEmpty(entity.Noticepeople)) - { - var newpostuserlist = new List(); - foreach (var uuitem in needpostuserlist) - { - var postids = userralationlist?.Count(m => m.F_UserId == uuitem.F_UserId && entity.Noticepeople.Contains(m.F_ObjectId)); - if (postids > 0) - { - newpostuserlist.Add(uuitem); - } - } - needpostuserlist = newpostuserlist; - } } else { @@ -295,22 +282,24 @@ namespace Learun.Application.Web.Areas.Ask.Controllers { var departteacherlist = allteacherlist.Where(m => senddeptid == m.F_DepartmentId); needpostuserlist.AddRange(departteacherlist.ToList()); - if (!string.IsNullOrEmpty(entity.Noticepeople)) - { - var newpostuserlist = new List(); - foreach (var uuitem in needpostuserlist) - { - var postids = userralationlist?.Count(m => m.F_UserId == uuitem.F_UserId && entity.Noticepeople.Contains(m.F_ObjectId)); - if (postids > 0) - { - newpostuserlist.Add(uuitem); - } - } - needpostuserlist = newpostuserlist; - } } } } + + if (!string.IsNullOrEmpty(entity.Noticepeople)) + { + var newpostuserlist = new List(); + string[] strs = entity.Noticepeople.Split(','); + foreach (var uuitem in strs) + { + var postids = allteacherlist.Where(m => m.F_UserId == uuitem).FirstOrDefault(); + if (postids != null) + { + newpostuserlist.Add(postids); + } + } + needpostuserlist = newpostuserlist; + } PushWeixin(needpostuserlist, entity.T_title); //消息提醒表 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Sports/Notice_Train_SportsService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Sports/Notice_Train_SportsService.cs index 01ae52dd8..bef570336 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Sports/Notice_Train_SportsService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Ask/Notice_Train_Sports/Notice_Train_SportsService.cs @@ -250,7 +250,7 @@ namespace Learun.Application.TwoDevelopment.Ask strSql.Append(" left join NoticeLog_Train_Sports r on t.T_id = r.NewsId and r.RUserId =@userId "); strSql.Append(" left join adms7ultimate2_新疆体育.dbo.lr_base_user u on u.F_UserId =@userId "); strSql.Append(" left join adms7ultimate2_新疆体育.dbo.LR_BASE_DEPARTMENT d on d.F_DepartmentId = t.Noticedept "); - strSql.Append(" WHERE "); + strSql.Append(" WHERE 1=1 "); //去掉用户入职时间条件 //if (userinfo.account.Contains("20")) //{ @@ -260,8 +260,9 @@ namespace Learun.Application.TwoDevelopment.Ask //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($" t.Noticedept like '%{deptId}%'"); + strSql.Append($" and (t.Noticedept like '%{deptId}%' or t.Noticepeople like '%{userId}%')"); } + //strSql.Append($" "); //if (!string.IsNullOrEmpty(postIds)) //{ // strSql.Append(" or (t.F_SendPostId is not null and ");