From 79dcd3be7eb8d30a3cb76c6d4e1a2c13d96d51dd Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Thu, 14 Jul 2022 09:15:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=BA=E6=85=A7=E5=A4=A7=E8=84=91=E6=95=99?= =?UTF-8?q?=E6=9D=90=E4=BF=A1=E6=81=AF=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DataCollectionController.cs | 15 +++- .../Views/DataCollection/Index.cshtml | 1 + .../LR_Desktop/Views/DataCollection/Index.js | 14 +++- .../DataCollection/DataCollectionBLL.cs | 21 +++++ .../DataCollection/DataCollectionIBLL.cs | 1 + .../DataCollection/DataCollectionService.cs | 77 +++++++++++++++---- 6 files changed, 112 insertions(+), 17 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/DataCollectionController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/DataCollectionController.cs index e6f44612c..d09deaef2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/DataCollectionController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/DataCollectionController.cs @@ -26,7 +26,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers [HttpGet] public ActionResult Index() { - return View(); + return View(); } #endregion /// @@ -51,6 +51,17 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers dataCollectionIBLL.SyncLesson(); return Success("操作成功"); } - + + /// + /// 教材信息 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult SyncTextBook() + { + dataCollectionIBLL.SyncTextBook(); + return Success("操作成功"); + } } } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/DataCollection/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/DataCollection/Index.cshtml index 8d2b955fa..920f3e6ec 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/DataCollection/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/DataCollection/Index.cshtml @@ -24,6 +24,7 @@
 校区基础数据  课程信息数据 +  教材信息数据
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/DataCollection/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/DataCollection/Index.js index 017d2fccb..a093b61f6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/DataCollection/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/DataCollection/Index.js @@ -25,7 +25,7 @@ var bootstrap = function ($, learun) { $('#lr_company').on('click', function () { learun.layerConfirm('是否确认推送校区基础数据!', function (res) { if (res) { - learun.deleteForm(top.$.rootUrl + '/LR_Desktop/DataCollection/SyncCompany', function () { + learun.postForm(top.$.rootUrl + '/LR_Desktop/DataCollection/SyncCompany', function () { refreshGirdData(); }); } @@ -35,13 +35,23 @@ var bootstrap = function ($, learun) { $('#lr_lesson').on('click', function () { learun.layerConfirm('是否确认推送课程信息数据!', function (res) { if (res) { - learun.deleteForm(top.$.rootUrl + '/LR_Desktop/DataCollection/SyncLesson', function () { + learun.postForm(top.$.rootUrl + '/LR_Desktop/DataCollection/SyncLesson', function () { refreshGirdData(); }); } }); }); + //教材数据 + $('#lr_textBook').on('click', function () { + learun.layerConfirm('是否确认推送教材信息数据!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/LR_Desktop/DataCollection/SyncTextBook', function () { + refreshGirdData(); + }); + } + }); + }); }, // 初始化列表 initGird: function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionBLL.cs index f65b93323..4122edbf4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionBLL.cs @@ -82,5 +82,26 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } } } + + + public void SyncTextBook() + { + try + { + dataCollectionService.SyncTextBook(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionIBLL.cs index e91e3fcec..5faf2e24c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionIBLL.cs @@ -8,5 +8,6 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop { void SaveXqjbsj(); void SyncLesson(); + void SyncTextBook(); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionService.cs index 876da18ab..04cabe58c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionService.cs @@ -86,7 +86,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop ///
private void refresh() { - var client_secret = (_redis.Read("client_secret"))?.Replace("\"",""); + var client_secret = (_redis.Read("client_secret"))?.Replace("\"", ""); var refresh_token = (_redis.Read("refresh_token"))?.Replace("\"", ""); var refresh_url = InsUrl + "/prod-api/api/web/collect/oauth2/refresh?grant_type=refresh_token&client_id=" + @@ -192,25 +192,76 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop { var param = new { - gzzyqksjid= lesson.LessonId, - xxjgdm=company.F_USCreditCode, + gzzyqksjid = lesson.LessonId, + xxjgdm = company.F_USCreditCode, xxjgmc = company.F_FullName, ssxqbh = company.F_EnCode, - kcmc= lesson.LessonName, + kcmc = lesson.LessonName, kcdm = lesson.LessonNo, - kclb =string.IsNullOrEmpty(lesson.LessonSortDetailNo)?"1": lesson.LessonSortDetailNo, - kcxz= lesson.LessonTypeName.Contains("公共")|| lesson.LessonTypeName.Contains("公开")?"1":"2", - kcsx=lesson.LessonSortNo, - kcfl="1", - xklb="14", - sfzyhxkc="0", - lvjxss=lesson.WeekStudyHour>0? lesson.WeekStudyHour :0, - sjjxsy = lesson.WeekPracticeHour > 0? lesson.WeekStudyHour :0, + kclb = string.IsNullOrEmpty(lesson.LessonSortDetailNo) ? "1" : lesson.LessonSortDetailNo, + kcxz = lesson.LessonTypeName.Contains("公共") || lesson.LessonTypeName.Contains("公开") ? "1" : "2", + kcsx = lesson.LessonSortNo, + kcfl = "1", + xklb = "14", + sfzyhxkc = "0", + lvjxss = lesson.WeekStudyHour > 0 ? lesson.WeekStudyHour : 0, + sjjxsy = lesson.WeekPracticeHour > 0 ? lesson.WeekStudyHour : 0, sjcjsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") }; list.Add(param); } - + + paramModel.fileds = list; + var json = JsonConvert.SerializeObject(paramModel); + var connect = _redis.Read("access_token"); + connect = (connect).Replace("\"", ""); + var res = HttpMethods.HttpPostConnect(saveIncrUrl, json, connect); + } + catch (ExceptionEx ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + + /// + /// 教材信息数据 + /// + public void SyncTextBook() + { + try + { + //校区信息 + var company = this.BaseRepository().FindList(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); + //课程数据 + var textBookInfo = this.BaseRepository("CollegeMIS").FindList(x => x.IsValid == true && x.IsDel == 0); + + ParamModel paramModel = new ParamModel(); + paramModel.dataObjName = "ods_jcxysj"; + + var list = new List(); + foreach (var book in textBookInfo) + { + var param = new + { + gzzyqksjid = book.ID, + xxjgdm = company.F_USCreditCode, + xxjgmc = company.F_FullName, + jcmc = book.TextBookName, + jcbh=book.TextBookNo, + + sjcjsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + }; + list.Add(param); + } + paramModel.fileds = list; var json = JsonConvert.SerializeObject(paramModel); var connect = _redis.Read("access_token");