diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/OfficeEquipmentController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/OfficeEquipmentController.cs index 94a636a4c..3923bba36 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/OfficeEquipmentController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/OfficeEquipmentController.cs @@ -43,11 +43,8 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers /// /// [HttpGet] - public ActionResult QRCode(string keyValue) + public ActionResult QRCode() { - var Data = officeEquipmentIBLL.GetOfficeEquipmentEntity(keyValue); - var emp = empinfoIBLL.GetEmpInfoEntityByEmpNo(Data.Name); - ViewBag.qrcode = "设备名称:" + Data.DeviceName + ",设备编号:" + Data.Code + ",配置:" + Data.Description + ",使用人:" + emp.EmpName; return View(); } #endregion @@ -90,7 +87,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers OfficeEquipment = OfficeEquipmentData, }; return Success(jsonData); - } + } #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/Index.js index 4299d04bf..746f1466d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/Index.js @@ -38,6 +38,10 @@ var bootstrap = function ($, learun) { // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); + if (keyValue.indexOf(',') != -1) { + learun.alert.warning("只能选择一条记录进行编辑!"); + return; + } if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', @@ -67,6 +71,10 @@ var bootstrap = function ($, learun) { // 查看二维码 $('#lr_qrCode').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); + if (keyValue.indexOf(',') != -1) { + learun.alert.warning("只能选择一条记录进行编辑!"); + return; + } if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'formqrCode', @@ -119,7 +127,8 @@ var bootstrap = function ($, learun) { { label: "备注", name: "Remark", width: 100, align: "left"}, ], mainId:'Id', - isPage: true + isPage: true, + isMultiselect: true, }); page.search(); }, diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/qrCode.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/qrCode.cshtml index a2464568d..296a90ca6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/qrCode.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/qrCode.cshtml @@ -39,5 +39,5 @@ @Html.AppendJsFile("/Areas/EducationalAdministration/Views/OfficeEquipment/qrCode.js") -@*@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuVolunteer/server.js")*@ +@*@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuVolunteerPhone/server.js")*@ @Html.AppendJsFile("/Content/jquery/jquery-1.10.2.min.js", "/Content/jquery/plugin/jqprint/jquery.jqprint-0.3.js", "/Content/js/qrcode.min.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/qrCode.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/qrCode.js index 91ae76c99..8063be689 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/qrCode.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OfficeEquipment/qrCode.js @@ -50,49 +50,16 @@ var bootstrap = function ($, learun) { param: {}, }); }, - initData: function () { + initData: function () { if (!!keyValue) { - $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/OfficeEquipment/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]); - } - //扫码签到 - makeCode(qrCode); - } - }); + var currentUrl1 = "http://api.cyzjzx.com"; + //var currentUrl1 = "http://192.168.10.58:8012"; + //扫码签到 + makeCode(currentUrl1 + '/arrangelesson/getqrcode?keyValue=' + keyValue); } } }; - //// 设置表单数据 - //setFormData = function (processId, param, callback) { - // if (!!processId) { - // $.lrSetForm(top.$.rootUrl + '/PersonnelManagement/MeetingManagement/GetFormDataByProcessId?processId=' + processId, function (data) { - // for (var id in data) { - // if (!!data[id] && data[id].length > 0) { - // $('#' + id).jfGridSet('refreshdata', data[id]); - // } - // else { - // if (id == 'MeetingManagement' && data[id]) { - // keyValue = data[id].Id; - // } - // $('[data-table="' + id + '"]').lrSetFormData(data[id]); - // } - // } - // }); - // } - // callback && callback(); - //} - // 验证数据是否填写完整 - //validForm = function () { - // if (!$('body').lrValidform()) { - // return false; - // } - // return true; - //}; + // 保存数据 save = function (processId, callBack, i) { if (!!callBack) { @@ -110,6 +77,6 @@ var qrcode = new QRCode(document.getElementById("qrCode"), { height: 420 }); function makeCode(urls) { - console.log(urls,"urls") + console.log(urls, "urls") qrcode.makeCode(urls); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs index 069d5455d..4ed103990 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs @@ -1,513 +1,518 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Web; -using Learun.Application.Base.SystemModule; -using Learun.Application.Organization; -using Learun.Application.TwoDevelopment.EducationalAdministration; -using Learun.Util; -using Nancy; - -namespace Learun.Application.WebApi.Modules -{ - public class Arrangelesson : BaseNoAuthentication - { - public Arrangelesson() - : base("/arrangelesson/") - { - Get["/lessontype"] = GetLessonTypes; - Get["/classtype"] = GetClassType; - Get["/student"] = GetStudents; - Get["/lessonsortdetail"] = GetLessonSortDetails; - Get["/lessonsort"] = GetLessonSorts; - Get["/classlesson"] = GetClassLessons; - Get["/bukaolist"] = GetBuKaoList; - //以下接口需要传值学年学期 - Get["/school"] = GetSchools; - Get["/dept"] = GetDepts; - Get["/major"] = GetMajors; - Get["/classroom"] = GetClassrooms; - Get["/lesson"] = GetLessons; - Get["/teacher"] = GetTeachers; - Get["/class"] = GetClasses; - Get["/stu"] = GetStus; - //以下返回全部 - Get["/department"] = GetDepartment; - Get["/allteacher"] = GetAllTeachers; - Get["/allstudent"] = GetAllStudents; - Get["/alldept"] = GetAllDept; - Get["/allmajor"] = GetAllMajor; - Get["/alllesson"] = GetAllLesson; - Get["/allclass"] = GetAllClass; - Get["/alluser"] = GetAllUsers; - Get["/allschool"] = GetAllSchools; - Get["/allclasslesson"] = GetAllClassLesson; - Get["/allelelectivelesson"] = GetAllElectiveLesson; - - //以下接口不往ArrangeLessonSync里记录已传数据 - Get["/schoolNotRecord"] = GetSchoolsNotRecord; - Get["/deptNotRecord"] = GetDeptsNotRecord; - Get["/majorNotRecord"] = GetMajorsNotRecord; - Get["/classroomNotRecord"] = GetClassroomsNotRecord; - Get["/lessonNotRecord"] = GetLessonsNotRecord; - Get["/teacherNotRecord"] = GetTeachersNotRecord; - Get["/classNotRecord"] = GetClassesNotRecord; - Get["/stuNotRecord"] = GetStusNotRecord; - Get["trantest"] = TranTest; - //按条件重置基础数据同步状态 - Get["/initbasicdata"] = InitBasicData; - - //信息浏览 - //校区简介 - Get["/getBriefIntroductionById"] = GetBriefIntroductionById; - //学校新闻、校园风光 - Get["/getSchoolNewList"] = GetSchoolNewList; - //专业列表 - Get["/getCdMajorList"] = GetCdMajorList; - //新闻详情 - Get["/getSchoolNewsDetails"] = GetSchoolNewsDetails; - //校历 - Get["/getCalendarList"] = GetCalendarList; - //校历详情 - Get["/getCalendarDetails"] = GetCalendarDetails; - - } - private readonly ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); - private readonly StuScoreIBLL stuScoreIBLL = new StuScoreBLL(); - private DepartmentIBLL departmentIBLL = new DepartmentBLL(); - EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); - private StuInfoBasicIBLL stuInfoBasicIbll = new StuInfoBasicBLL(); - CdDeptIBLL cdDeptIbll = new CdDeptBLL(); - CdMajorIBLL cdMajorIbll = new CdMajorBLL(); - private LessonInfoIBLL lessonInfoIbll = new LessonInfoBLL(); - ClassInfoIBLL classInfoIbll = new ClassInfoBLL(); - UserIBLL userIbll = new UserBLL(); - private CompanyIBLL companyIbll = new CompanyBLL(); - private SchoolNewsIBLL schoolNewsIBLL = new SchoolNewsBLL(); - private CdMajorIBLL cdMajorIBLL = new CdMajorBLL(); - private SchoolCalendarIBLL schoolCalendarIBLL = new SchoolCalendarBLL(); - - private StuSelectLessonListOfElectiveIBLL stuSelectLessonListOfElectiveIbll = - new StuSelectLessonListOfElectiveBLL(); - private AnnexesFileIBLL annexesFileIbll = new AnnexesFileBLL(); - - private Response TranTest(dynamic _) - { - return Success("ok"); - } - - private Response GetAllLesson(dynamic _) - { - var result = lessonInfoIbll.GetAllLesson(); - return Success(result); - } - private Response GetAllClass(dynamic _) - { - var result = classInfoIbll.GetAllClass(); - return Success(result); - } - private Response GetAllTeachers(dynamic _) - { - var result = empInfoIbll.GetAllList().Where(m => m.CheckMark == true).ToList(); - return Success(result); - } - private Response GetAllSchools(dynamic _) - { - var result = companyIbll.GetList(); - return Success(result); - } - private Response GetAllClassLesson(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetAllClassLesson(AcademicYearNo, Semester); - return Success(result); - } - private Response InitBasicData(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - string BaseTable = Request.Query["BaseTable"]; - if (string.IsNullOrEmpty(AcademicYearNo) || string.IsNullOrEmpty(Semester)) - { - return Fail("学年学期参数不能为空"); - } - if (string.IsNullOrEmpty(BaseTable)) - { - return Fail("基础表参数不能为空"); - } - ArrangeLessonTermEntity arrangeLessonTermEntity = new ArrangeLessonTermEntity(); - arrangeLessonTermEntity.AcademicYearNo = AcademicYearNo; - arrangeLessonTermEntity.Semester = Semester; - arrangeLessonTermEntity.SyncBasicTable = BaseTable; - arrangeLessonTermIBLL.InitAsyncDataByCondition(arrangeLessonTermEntity); - return Success("操作成功"); - } - private Response GetAllElectiveLesson(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = stuSelectLessonListOfElectiveIbll.GetAllElectiveLesson(AcademicYearNo, Semester); - return Success(result); - } - private Response GetAllUsers(dynamic _) - { - var webrootpath = Config.GetValue("webrootpath"); - var result = userIbll.GetAllList().Where(m => !m.F_Account.Contains("System") && m.F_DeleteMark == 0 && m.F_EnabledMark == 1).Select(m => new - { - m.F_UserId, - m.F_CompanyId, - m.F_DepartmentId, - F_Description = m.F_Description == "教师" ? "2" : "3", - ClassNo = stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(m.F_Account)?.ClassNo, - m.F_RealName, - m.F_Account, - Year = "20" + stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(m.F_Account)?.Grade, - m.F_IdentityCardNo, - F_HeadIcon = webrootpath + m?.F_HeadIcon - }); - return Success(result); - } - private Response GetAllStudents(dynamic _) - { - var webrootpath = Config.GetValue("webrootpath"); - var result = stuInfoBasicIbll.GetAllList(); - foreach (var item in result) - { - if (!string.IsNullOrEmpty(item.Photo)) - { - var annfile = annexesFileIbll.GetEntityByFolderId(item.Photo); - if (annfile != null && annfile.F_FilePath != null) - { - if (annfile.F_FilePath.IndexOf("Resource") != -1) - { - item.Photo = webrootpath + annfile.F_FilePath.Substring(annfile.F_FilePath.IndexOf("Resource") - 1); - } - else - item.Photo = ""; - } - else - item.Photo = ""; - } - else - { - item.Photo = ""; - } - } - return Success(result); - } - private Response GetDepartment(dynamic _) - { - var result = departmentIBLL.GetAllList(); - return Success(result); - } - private Response GetAllDept(dynamic _) - { - var result = cdDeptIbll.GetAllList(); - return Success(result); - } - private Response GetAllMajor(dynamic _) - { - var result = cdMajorIbll.GetAllList(); - return Success(result); - } - private Response GetLessonTypes(dynamic _) - { - var result = arrangeLessonTermIBLL.GetLessonTypes(); - return Success(result); - } - private Response GetDepts(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetDepts(AcademicYearNo, Semester); - return Success(result); - } - private Response GetDeptsNotRecord(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetDeptsNotRecord(AcademicYearNo, Semester); - return Success(result); - } - - private Response GetSchools(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetSchools(AcademicYearNo, Semester); - return Success(result); - } - private Response GetSchoolsNotRecord(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetSchoolsNotRecord(AcademicYearNo, Semester); - return Success(result); - } - - private Response GetClassLessons(dynamic _) - { - var result = arrangeLessonTermIBLL.GetClassLessons().Select(m => new - { - m.AcademicYearNo, - m.Semester, - m.DeptNo, - m.MajorNo, - m.LessonNo, - m.TeachClassNo, - m.EmpNo, - m.LessonSortNo - }); - return Success(result); - } - public Response GetStudents(dynamic _) - { - var result = arrangeLessonTermIBLL.GetStudents(); - return Success(result); - } - public Response GetMajors(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetMajors(AcademicYearNo, Semester); - return Success(result); - } - public Response GetMajorsNotRecord(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetMajorsNotRecord(AcademicYearNo, Semester); - return Success(result); - } - - public Response GetClassrooms(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetClassrooms(AcademicYearNo, Semester); - return Success(result); - } - public Response GetClassroomsNotRecord(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetClassroomsNotRecord(AcademicYearNo, Semester); - return Success(result); - } - - public Response GetClassType(dynamic _) - { - var result = arrangeLessonTermIBLL.GetClassType(); - return Success(result); - } - public Response GetLessons(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetLessons(AcademicYearNo, Semester); - return Success(result); - } - public Response GetLessonsNotRecord(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetLessonsNotRecord(AcademicYearNo, Semester); - return Success(result); - } - public Response GetLessonSortDetails(dynamic _) - { - var result = arrangeLessonTermIBLL.GetLessonSortDetails(); - return Success(result); - } - public Response GetLessonSorts(dynamic _) - { - var result = arrangeLessonTermIBLL.GetLessonSorts(); - return Success(result); - } - - public Response GetTeachers(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetTeachers(AcademicYearNo, Semester); - return Success(result); - } - public Response GetTeachersNotRecord(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetTeachersNotRecord(AcademicYearNo, Semester); - return Success(result); - } - - public Response GetClasses(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetClasses(AcademicYearNo, Semester); - return Success(result); - } - public Response GetClassesNotRecord(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetClassesNotRecord(AcademicYearNo, Semester); - return Success(result); - } - - public Response GetStus(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetStus(AcademicYearNo, Semester); - return Success(result); - } - - public Response GetStusNotRecord(dynamic _) - { - string AcademicYearNo = Request.Query["AcademicYearNo"]; - string Semester = Request.Query["Semester"]; - var result = arrangeLessonTermIBLL.GetStusNotRecord(AcademicYearNo, Semester); - return Success(result); - } - /// - /// 补考名单数据 - /// - /// - /// - private Response GetBuKaoList(dynamic _) - { - var allList = new List(); - var notPassList = stuScoreIBLL.GetStuScoreNotPassList(); - allList.AddRange(notPassList); - var notPassTwoList = stuScoreIBLL.GetStuScoreNotPassTwoList(); - allList.AddRange(notPassTwoList); - - var result = allList.Select(x => new { x.BuKaoFlag, x.AcademicYearNo, x.Semester, x.StuId, x.StuName, x.LessonId, x.LessonName, x.ClassId, x.ClassName, x.EmpId, x.EmpName }).OrderBy(x => x.BuKaoFlag).ThenByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.StuId); - return Success(result); - } - - - /// - /// 获取学校简介 - /// - /// - /// - private Response GetBriefIntroductionById(dynamic _) - { - var result = companyIbll.GetDetail(); - if (result == null) - return Success("");//Fail("找不到数据!"); - else - { - return Success(WebHelper.HtmlDecode(result.F_BriefIntroduction)); - } - } - - /// - /// 获取学校新闻列表、校园风光列表 - /// - /// - /// - public Response GetSchoolNewList(dynamic _) - { - string categoryId = Request.Query["categoryId"]; - var result = schoolNewsIBLL.GetListByCategoryId(categoryId); - return Success(result); - } - /// - /// 获取专业列表 - /// - /// - /// - public Response GetCdMajorList(dynamic _) - { - string keyword = Request.Query["keyword"]; - var result = cdMajorIBLL.GetAllList(keyword); - return Success(result); - } - /// - /// 获取详情 - /// - /// - /// - public Response GetSchoolNewsDetails(dynamic _) - { - string Id = Request.Query["Id"]; - //type: 1学校新闻,2校园风光,3 专业介绍 - string type = Request.Query["type"]; - - var title = ""; - var time = ""; - var desc = ""; - switch (type) - { - case "1": - { - //学校新闻 - var result = schoolNewsIBLL.GetLR_OA_SchoolNewsEntity(Id); - if (result != null) - { - title = result.F_FullHead; - time = result.F_ReleaseTime.HasValue ? result.F_ReleaseTime.Value.ToString("yyyy-MM-dd") : ""; - desc = result.F_NewsContent; - } - break; - } - case "2": - { - //校园风光 - var result = schoolNewsIBLL.GetLR_OA_SchoolNewsEntity(Id); - if (result != null) - { - title = result.F_FullHead; - time = result.F_ReleaseTime.HasValue ? result.F_ReleaseTime.Value.ToString("yyyy-MM-dd") : ""; - desc = result.F_NewsContent; - } - break; - } - case "3": - { - //专业介绍 - var result = cdMajorIBLL.GetCdMajorEntity(Id); - if (result != null) - { - title = result.MajorName; - time = ""; - desc = result.Introduce; - } - break; - } - - } - - object obj = new { title = title, desc = WebHelper.HtmlDecode(desc) }; - return Success(obj); - } - - /// - /// 获取校历 - /// - /// - /// - public Response GetCalendarList(dynamic _) - { - var result = schoolCalendarIBLL.GetList(); - return Success(result); - } - /// - /// 获取校历详情 - /// - /// - /// - public Response GetCalendarDetails(dynamic _) - { - string keyValue = Request.Query["keyValue"]; - var result = schoolCalendarIBLL.GetSchoolCalendarEntity(keyValue); - return Success(result); - } - - } +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Web; +using Learun.Application.Base.SystemModule; +using Learun.Application.Organization; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Util; +using Nancy; + +namespace Learun.Application.WebApi.Modules +{ + public class Arrangelesson : BaseNoAuthentication + { + public Arrangelesson() + : base("/arrangelesson/") + { + Get["/lessontype"] = GetLessonTypes; + Get["/classtype"] = GetClassType; + Get["/student"] = GetStudents; + Get["/lessonsortdetail"] = GetLessonSortDetails; + Get["/lessonsort"] = GetLessonSorts; + Get["/classlesson"] = GetClassLessons; + Get["/bukaolist"] = GetBuKaoList; + //以下接口需要传值学年学期 + Get["/school"] = GetSchools; + Get["/dept"] = GetDepts; + Get["/major"] = GetMajors; + Get["/classroom"] = GetClassrooms; + Get["/lesson"] = GetLessons; + Get["/teacher"] = GetTeachers; + Get["/class"] = GetClasses; + Get["/stu"] = GetStus; + //以下返回全部 + Get["/department"] = GetDepartment; + Get["/allteacher"] = GetAllTeachers; + Get["/allstudent"] = GetAllStudents; + Get["/alldept"] = GetAllDept; + Get["/allmajor"] = GetAllMajor; + Get["/alllesson"] = GetAllLesson; + Get["/allclass"] = GetAllClass; + Get["/alluser"] = GetAllUsers; + Get["/allschool"] = GetAllSchools; + Get["/allclasslesson"] = GetAllClassLesson; + Get["/allelelectivelesson"] = GetAllElectiveLesson; + + //以下接口不往ArrangeLessonSync里记录已传数据 + Get["/schoolNotRecord"] = GetSchoolsNotRecord; + Get["/deptNotRecord"] = GetDeptsNotRecord; + Get["/majorNotRecord"] = GetMajorsNotRecord; + Get["/classroomNotRecord"] = GetClassroomsNotRecord; + Get["/lessonNotRecord"] = GetLessonsNotRecord; + Get["/teacherNotRecord"] = GetTeachersNotRecord; + Get["/classNotRecord"] = GetClassesNotRecord; + Get["/stuNotRecord"] = GetStusNotRecord; + Get["trantest"] = TranTest; + //按条件重置基础数据同步状态 + Get["/initbasicdata"] = InitBasicData; + + //信息浏览 + //校区简介 + Get["/getBriefIntroductionById"] = GetBriefIntroductionById; + //学校新闻、校园风光 + Get["/getSchoolNewList"] = GetSchoolNewList; + //专业列表 + Get["/getCdMajorList"] = GetCdMajorList; + //新闻详情 + Get["/getSchoolNewsDetails"] = GetSchoolNewsDetails; + //校历 + Get["/getCalendarList"] = GetCalendarList; + //校历详情 + Get["/getCalendarDetails"] = GetCalendarDetails; + Get["/getqrcode"] = GetQRCode; + + } + private readonly ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); + private readonly StuScoreIBLL stuScoreIBLL = new StuScoreBLL(); + private DepartmentIBLL departmentIBLL = new DepartmentBLL(); + EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); + private StuInfoBasicIBLL stuInfoBasicIbll = new StuInfoBasicBLL(); + CdDeptIBLL cdDeptIbll = new CdDeptBLL(); + CdMajorIBLL cdMajorIbll = new CdMajorBLL(); + private LessonInfoIBLL lessonInfoIbll = new LessonInfoBLL(); + ClassInfoIBLL classInfoIbll = new ClassInfoBLL(); + UserIBLL userIbll = new UserBLL(); + private CompanyIBLL companyIbll = new CompanyBLL(); + private SchoolNewsIBLL schoolNewsIBLL = new SchoolNewsBLL(); + private CdMajorIBLL cdMajorIBLL = new CdMajorBLL(); + private SchoolCalendarIBLL schoolCalendarIBLL = new SchoolCalendarBLL(); + + private StuSelectLessonListOfElectiveIBLL stuSelectLessonListOfElectiveIbll = + new StuSelectLessonListOfElectiveBLL(); + private AnnexesFileIBLL annexesFileIbll = new AnnexesFileBLL(); + private OfficeEquipmentIBLL officeEquipmentIBLL = new OfficeEquipmentBLL(); + private EmpInfoIBLL empinfoIBLL = new EmpInfoBLL(); + + private Response TranTest(dynamic _) + { + return Success("ok"); + } + + private Response GetAllLesson(dynamic _) + { + var result = lessonInfoIbll.GetAllLesson(); + return Success(result); + } + private Response GetAllClass(dynamic _) + { + var result = classInfoIbll.GetAllClass(); + return Success(result); + } + private Response GetAllTeachers(dynamic _) + { + var result = empInfoIbll.GetAllList().Where(m => m.CheckMark == true).ToList(); + return Success(result); + } + private Response GetAllSchools(dynamic _) + { + var result = companyIbll.GetList(); + return Success(result); + } + private Response GetAllClassLesson(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetAllClassLesson(AcademicYearNo, Semester); + return Success(result); + } + private Response InitBasicData(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + string BaseTable = Request.Query["BaseTable"]; + if (string.IsNullOrEmpty(AcademicYearNo) || string.IsNullOrEmpty(Semester)) + { + return Fail("学年学期参数不能为空"); + } + if (string.IsNullOrEmpty(BaseTable)) + { + return Fail("基础表参数不能为空"); + } + ArrangeLessonTermEntity arrangeLessonTermEntity = new ArrangeLessonTermEntity(); + arrangeLessonTermEntity.AcademicYearNo = AcademicYearNo; + arrangeLessonTermEntity.Semester = Semester; + arrangeLessonTermEntity.SyncBasicTable = BaseTable; + arrangeLessonTermIBLL.InitAsyncDataByCondition(arrangeLessonTermEntity); + return Success("操作成功"); + } + private Response GetAllElectiveLesson(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = stuSelectLessonListOfElectiveIbll.GetAllElectiveLesson(AcademicYearNo, Semester); + return Success(result); + } + private Response GetAllUsers(dynamic _) + { + var webrootpath = Config.GetValue("webrootpath"); + var result = userIbll.GetAllList().Where(m => !m.F_Account.Contains("System") && m.F_DeleteMark == 0 && m.F_EnabledMark == 1).Select(m => new + { + m.F_UserId, + m.F_CompanyId, + m.F_DepartmentId, + F_Description = m.F_Description == "教师" ? "2" : "3", + ClassNo = stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(m.F_Account)?.ClassNo, + m.F_RealName, + m.F_Account, + Year = "20" + stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(m.F_Account)?.Grade, + m.F_IdentityCardNo, + F_HeadIcon = webrootpath + m?.F_HeadIcon + }); + return Success(result); + } + private Response GetAllStudents(dynamic _) + { + var webrootpath = Config.GetValue("webrootpath"); + var result = stuInfoBasicIbll.GetAllList(); + foreach (var item in result) + { + if (!string.IsNullOrEmpty(item.Photo)) + { + var annfile = annexesFileIbll.GetEntityByFolderId(item.Photo); + if (annfile != null && annfile.F_FilePath != null) + { + if (annfile.F_FilePath.IndexOf("Resource") != -1) + { + item.Photo = webrootpath + annfile.F_FilePath.Substring(annfile.F_FilePath.IndexOf("Resource") - 1); + } + else + item.Photo = ""; + } + else + item.Photo = ""; + } + else + { + item.Photo = ""; + } + } + return Success(result); + } + private Response GetDepartment(dynamic _) + { + var result = departmentIBLL.GetAllList(); + return Success(result); + } + private Response GetAllDept(dynamic _) + { + var result = cdDeptIbll.GetAllList(); + return Success(result); + } + private Response GetAllMajor(dynamic _) + { + var result = cdMajorIbll.GetAllList(); + return Success(result); + } + private Response GetLessonTypes(dynamic _) + { + var result = arrangeLessonTermIBLL.GetLessonTypes(); + return Success(result); + } + private Response GetDepts(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetDepts(AcademicYearNo, Semester); + return Success(result); + } + private Response GetDeptsNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetDeptsNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + private Response GetSchools(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetSchools(AcademicYearNo, Semester); + return Success(result); + } + private Response GetSchoolsNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetSchoolsNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + private Response GetClassLessons(dynamic _) + { + var result = arrangeLessonTermIBLL.GetClassLessons().Select(m => new + { + m.AcademicYearNo, + m.Semester, + m.DeptNo, + m.MajorNo, + m.LessonNo, + m.TeachClassNo, + m.EmpNo, + m.LessonSortNo + }); + return Success(result); + } + public Response GetStudents(dynamic _) + { + var result = arrangeLessonTermIBLL.GetStudents(); + return Success(result); + } + public Response GetMajors(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetMajors(AcademicYearNo, Semester); + return Success(result); + } + public Response GetMajorsNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetMajorsNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + public Response GetClassrooms(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetClassrooms(AcademicYearNo, Semester); + return Success(result); + } + public Response GetClassroomsNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetClassroomsNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + public Response GetClassType(dynamic _) + { + var result = arrangeLessonTermIBLL.GetClassType(); + return Success(result); + } + public Response GetLessons(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetLessons(AcademicYearNo, Semester); + return Success(result); + } + public Response GetLessonsNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetLessonsNotRecord(AcademicYearNo, Semester); + return Success(result); + } + public Response GetLessonSortDetails(dynamic _) + { + var result = arrangeLessonTermIBLL.GetLessonSortDetails(); + return Success(result); + } + public Response GetLessonSorts(dynamic _) + { + var result = arrangeLessonTermIBLL.GetLessonSorts(); + return Success(result); + } + + public Response GetTeachers(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetTeachers(AcademicYearNo, Semester); + return Success(result); + } + public Response GetTeachersNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetTeachersNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + public Response GetClasses(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetClasses(AcademicYearNo, Semester); + return Success(result); + } + public Response GetClassesNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetClassesNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + public Response GetStus(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetStus(AcademicYearNo, Semester); + return Success(result); + } + + public Response GetStusNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetStusNotRecord(AcademicYearNo, Semester); + return Success(result); + } + /// + /// 补考名单数据 + /// + /// + /// + private Response GetBuKaoList(dynamic _) + { + var allList = new List(); + var notPassList = stuScoreIBLL.GetStuScoreNotPassList(); + allList.AddRange(notPassList); + var notPassTwoList = stuScoreIBLL.GetStuScoreNotPassTwoList(); + allList.AddRange(notPassTwoList); + + var result = allList.Select(x => new { x.BuKaoFlag, x.AcademicYearNo, x.Semester, x.StuId, x.StuName, x.LessonId, x.LessonName, x.ClassId, x.ClassName, x.EmpId, x.EmpName }).OrderBy(x => x.BuKaoFlag).ThenByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.StuId); + return Success(result); + } + + + /// + /// 获取学校简介 + /// + /// + /// + private Response GetBriefIntroductionById(dynamic _) + { + var result = companyIbll.GetDetail(); + if (result == null) + return Success("");//Fail("找不到数据!"); + else + { + return Success(WebHelper.HtmlDecode(result.F_BriefIntroduction)); + } + } + + /// + /// 获取学校新闻列表、校园风光列表 + /// + /// + /// + public Response GetSchoolNewList(dynamic _) + { + string categoryId = Request.Query["categoryId"]; + var result = schoolNewsIBLL.GetListByCategoryId(categoryId); + return Success(result); + } + /// + /// 获取专业列表 + /// + /// + /// + public Response GetCdMajorList(dynamic _) + { + string keyword = Request.Query["keyword"]; + var result = cdMajorIBLL.GetAllList(keyword); + return Success(result); + } + /// + /// 获取详情 + /// + /// + /// + public Response GetSchoolNewsDetails(dynamic _) + { + string Id = Request.Query["Id"]; + //type: 1学校新闻,2校园风光,3 专业介绍 + string type = Request.Query["type"]; + + var title = ""; + var time = ""; + var desc = ""; + switch (type) + { + case "1": + { + //学校新闻 + var result = schoolNewsIBLL.GetLR_OA_SchoolNewsEntity(Id); + if (result != null) + { + title = result.F_FullHead; + time = result.F_ReleaseTime.HasValue ? result.F_ReleaseTime.Value.ToString("yyyy-MM-dd") : ""; + desc = result.F_NewsContent; + } + break; + } + case "2": + { + //校园风光 + var result = schoolNewsIBLL.GetLR_OA_SchoolNewsEntity(Id); + if (result != null) + { + title = result.F_FullHead; + time = result.F_ReleaseTime.HasValue ? result.F_ReleaseTime.Value.ToString("yyyy-MM-dd") : ""; + desc = result.F_NewsContent; + } + break; + } + case "3": + { + //专业介绍 + var result = cdMajorIBLL.GetCdMajorEntity(Id); + if (result != null) + { + title = result.MajorName; + time = ""; + desc = result.Introduce; + } + break; + } + + } + + object obj = new { title = title, desc = WebHelper.HtmlDecode(desc) }; + return Success(obj); + } + + /// + /// 获取校历 + /// + /// + /// + public Response GetCalendarList(dynamic _) + { + var result = schoolCalendarIBLL.GetList(); + return Success(result); + } + /// + /// 获取校历详情 + /// + /// + /// + public Response GetCalendarDetails(dynamic _) + { + string keyValue = Request.Query["keyValue"]; + var result = schoolCalendarIBLL.GetSchoolCalendarEntity(keyValue); + return Success(result); + } + + public string GetQRCode(dynamic _) { string keyValue = Request.Query["keyValue"]; + var Data = officeEquipmentIBLL.GetOfficeEquipmentEntity(keyValue); var emp = empinfoIBLL.GetEmpInfoEntityByEmpNo(Data.Name); var result = "设备名称:" + Data.DeviceName + ",设备编号:" + Data.Code + ",配置:" + Data.Description + ",使用人:" + emp.EmpName; return result; } + } } \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OfficeEquipment/OfficeEquipmentService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OfficeEquipment/OfficeEquipmentService.cs index 70875eb8c..51988136b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OfficeEquipment/OfficeEquipmentService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OfficeEquipment/OfficeEquipmentService.cs @@ -41,6 +41,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration dp.Add("Name", queryParam["Name"].ToString(), DbType.String); strSql.Append(" AND t.Name = @Name "); } + if (!queryParam["Code"].IsEmpty()) + { + dp.Add("Code", "%" + queryParam["Code"].ToString() + "%", DbType.String); + strSql.Append(" AND t.Code like @Code "); + } if (!queryParam["DeviceName"].IsEmpty()) { dp.Add("DeviceName", "%" + queryParam["DeviceName"].ToString() + "%", DbType.String); @@ -55,7 +60,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { if (!LoginUserInfo.Get().roleIds.Contains("5a6e22b1-2a08-4258-9964-3cb7fbb9ebee")) { - strSql.Append(" AND t.Name = " + LoginUserInfo.Get().account + " "); + strSql.Append(" AND t.Name = '" + LoginUserInfo.Get().account + "' "); } } return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); @@ -107,12 +112,20 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 主键 public void DeleteEntity(string keyValue) { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); try { - this.BaseRepository("CollegeMIS").Delete(t => t.Id == keyValue); + //多个删除 + var keyValueArr = keyValue.Split(','); + foreach (var item in keyValueArr) + { + db.Delete(t => t.Id == item); + } + db.Commit(); } catch (Exception ex) { + db.Rollback(); if (ex is ExceptionEx) { throw;