From ab5dfc7cfc34efa2ec29f16acd2ee0208a47ba98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Thu, 4 Jan 2024 10:43:55 +0800 Subject: [PATCH] bug fixed --- .../Controllers/HealthCheckController.cs | 4 +- New_College.Api/New_College.Model.xml | 15 ++ New_College.Api/appsettings.Development.json | 2 +- .../ServiceExtensions/SqlsugarSetup.cs | 2 +- New_College.IServices/ID_LongIdMapServices.cs | 1 + New_College.Model/Models/D_PlanMajorDesc.cs | 17 +++ New_College.Model/New_College.Model.csproj | 2 +- New_College.Model/Seed/MyContext.cs | 2 +- .../BASE/D_PlanMajorDescRepository.cs | 26 +++- .../BASE/ID_PlanMajorDescRepository.cs | 8 ++ New_College.Services/D_LongIdMapServices.cs | 132 +++++++++++++----- .../D_PlanMajorDescServices.cs | 6 +- 12 files changed, 168 insertions(+), 49 deletions(-) diff --git a/New_College.Api/Controllers/HealthCheckController.cs b/New_College.Api/Controllers/HealthCheckController.cs index 63ad05c..d30cd33 100644 --- a/New_College.Api/Controllers/HealthCheckController.cs +++ b/New_College.Api/Controllers/HealthCheckController.cs @@ -65,9 +65,9 @@ namespace New_College.Controllers - return d_LongIdMapServices.Import(); + // return d_LongIdMapServices.Import(); - // return d_LongIdMapServices.UpdateUniveristyInf(); + return d_LongIdMapServices.UpdatePlanProInf(); } } diff --git a/New_College.Api/New_College.Model.xml b/New_College.Api/New_College.Model.xml index 02216c5..a23845b 100644 --- a/New_College.Api/New_College.Model.xml +++ b/New_College.Api/New_College.Model.xml @@ -605,6 +605,11 @@ 批次 + + + + + 选科要求 @@ -630,6 +635,16 @@ 专业备注 + + + 专业别名(页面展示需要) + + + + + 内容所在书页码 + + 最低分 diff --git a/New_College.Api/appsettings.Development.json b/New_College.Api/appsettings.Development.json index 55fb186..779fb9b 100644 --- a/New_College.Api/appsettings.Development.json +++ b/New_College.Api/appsettings.Development.json @@ -97,7 +97,7 @@ "DBType": 0, "Enabled": true, "HitRate": 20, - "Connection": "Server=192.168.103.102; Port=3306;SslMode=None;Database=volunteerapp; Uid=ycymedu; Pwd=Vs..127134;CharSet=utf8mb4" + "Connection": "Server=192.168.103.102; Port=3306;SslMode=None;Database=volunteerapp; Uid=ycymedu; Pwd=Vs..127134;CharSet=utf8mb4;AllowLoadLocalInfile=true" }, { "ConnId": "WMBLOG_ORACLE", diff --git a/New_College.Extensions/ServiceExtensions/SqlsugarSetup.cs b/New_College.Extensions/ServiceExtensions/SqlsugarSetup.cs index 736f1ba..91d3bdb 100644 --- a/New_College.Extensions/ServiceExtensions/SqlsugarSetup.cs +++ b/New_College.Extensions/ServiceExtensions/SqlsugarSetup.cs @@ -46,7 +46,7 @@ namespace New_College.Extensions ConnectionString = m.Connection, DbType = (DbType)m.DbType, IsAutoCloseConnection = true, - IsShardSameThread = false, + // IsShardSameThread = false, AopEvents = new AopEvents { OnLogExecuting = (sql, p) => diff --git a/New_College.IServices/ID_LongIdMapServices.cs b/New_College.IServices/ID_LongIdMapServices.cs index 4639c80..d470c11 100644 --- a/New_College.IServices/ID_LongIdMapServices.cs +++ b/New_College.IServices/ID_LongIdMapServices.cs @@ -13,6 +13,7 @@ namespace New_College.IServices /// public interface ID_LongIdMapServices : IBaseServices { + Task UpdatePlanProInf(); Task Import(); Task UpdateUniveristyInf(); diff --git a/New_College.Model/Models/D_PlanMajorDesc.cs b/New_College.Model/Models/D_PlanMajorDesc.cs index 7546dc5..2b6a296 100644 --- a/New_College.Model/Models/D_PlanMajorDesc.cs +++ b/New_College.Model/Models/D_PlanMajorDesc.cs @@ -70,6 +70,12 @@ namespace New_College.Model.Models ///批次 /// public string BatchName { get; set; } + + /// + /// + /// + public string BatchItemName { get; set; } + /// /// 选科要求 /// @@ -99,6 +105,17 @@ namespace New_College.Model.Models /// public string Remark { get; set; } + /// + /// 专业别名(页面展示需要) + /// + public string ReName { get; set; } + + + /// + /// 内容所在书页码 + /// + public string BookPageNo { get; set; } + public string MajorCode { get; set; } diff --git a/New_College.Model/New_College.Model.csproj b/New_College.Model/New_College.Model.csproj index 3b2303a..1d47af0 100644 --- a/New_College.Model/New_College.Model.csproj +++ b/New_College.Model/New_College.Model.csproj @@ -15,7 +15,7 @@ - + diff --git a/New_College.Model/Seed/MyContext.cs b/New_College.Model/Seed/MyContext.cs index 9cd57b7..504bf3e 100644 --- a/New_College.Model/Seed/MyContext.cs +++ b/New_College.Model/Seed/MyContext.cs @@ -213,7 +213,7 @@ namespace New_College.Model.Seed { //DataInfoCacheService = new HttpRuntimeCache() }, - IsShardSameThread = blnIsShardSameThread + // IsShardSameThread = blnIsShardSameThread }; return config; } diff --git a/New_College.Repository/BASE/D_PlanMajorDescRepository.cs b/New_College.Repository/BASE/D_PlanMajorDescRepository.cs index 38c2d72..7ba7538 100644 --- a/New_College.Repository/BASE/D_PlanMajorDescRepository.cs +++ b/New_College.Repository/BASE/D_PlanMajorDescRepository.cs @@ -2,16 +2,36 @@ using New_College.IRepository.UnitOfWork; using New_College.Model.Models; using New_College.Repository.Base; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading.Tasks; namespace New_College.Repository { - /// - /// D_PlanMajorDescRepository - /// + /// + /// D_PlanMajorDescRepository + /// public class D_PlanMajorDescRepository : BaseRepository, ID_PlanMajorDescRepository { public D_PlanMajorDescRepository(IUnitOfWork unitOfWork) : base(unitOfWork) { } + + + /// + /// + /// + /// + /// + public async Task Batchupdate(List majorDescs) + { + // int k = this.Db.Updateable(majorDescs).ExecuteCommand(); + // this.Db.Fastest().BulkUpdate(GetList()) //适合大批量更新 + var kk = await this.Db.Fastest().BulkUpdateAsync(majorDescs); + return kk > 0; + } + + + } } \ No newline at end of file diff --git a/New_College.Repository/BASE/ID_PlanMajorDescRepository.cs b/New_College.Repository/BASE/ID_PlanMajorDescRepository.cs index 515e462..066fd91 100644 --- a/New_College.Repository/BASE/ID_PlanMajorDescRepository.cs +++ b/New_College.Repository/BASE/ID_PlanMajorDescRepository.cs @@ -1,5 +1,7 @@ using New_College.IRepository.Base; using New_College.Model.Models; +using System.Collections.Generic; +using System.Threading.Tasks; namespace New_College.IRepository { @@ -8,5 +10,11 @@ namespace New_College.IRepository /// public interface ID_PlanMajorDescRepository : IBaseRepository { + /// + /// 批量更新数据 + /// + /// + /// + Task Batchupdate(List majorDescs); } } \ No newline at end of file diff --git a/New_College.Services/D_LongIdMapServices.cs b/New_College.Services/D_LongIdMapServices.cs index 03ae5cd..6a8c8df 100644 --- a/New_College.Services/D_LongIdMapServices.cs +++ b/New_College.Services/D_LongIdMapServices.cs @@ -1860,21 +1860,21 @@ namespace New_College.Services var category = undetail.result.categories.ToList(); //if (category.Contains("医药")) //{ - // updatemodel.Type = UniversityTypeRelsove.GetTypeName("医药"); + // updatemodel.Type = UniversityTypeRelsove.GetTypeName("医药"); - //updatemodel.Web = undetail.result.webSite; - //updatemodel.Address = undetail.result.address[0].address; - //updatemodel.Phone = string.Join(",",undetail.result.zhaoBanDH); - // updatemodel.AscriptionName = undetail.result.belong; - //updatemodel.UniversityCode = a.code; - //updatemodel.Rank = a.ranking; - //updatemodel.Build_Date = undetail.result.createdYear; - //updatemodel.Description = undetail.result.introduction; - updatemodel.Master_Count = undetail.result.pointsOfShuo.Any() ? undetail.result.pointsOfShuo[0].number : 0; - updatemodel.Doctorate_Count = undetail.result.pointsOfBo.Any() ? undetail.result.pointsOfBo[0].number : 0; - //updatemodel.Type = UniversityTypeRelsove.GetTypeName((undetail.result.categories.Any() ? undetail.result.categories[0] : "")); - await d_UniversityRepository.Update(updatemodel); - // } + //updatemodel.Web = undetail.result.webSite; + //updatemodel.Address = undetail.result.address[0].address; + //updatemodel.Phone = string.Join(",",undetail.result.zhaoBanDH); + // updatemodel.AscriptionName = undetail.result.belong; + //updatemodel.UniversityCode = a.code; + //updatemodel.Rank = a.ranking; + //updatemodel.Build_Date = undetail.result.createdYear; + //updatemodel.Description = undetail.result.introduction; + updatemodel.Master_Count = undetail.result.pointsOfShuo.Any() ? undetail.result.pointsOfShuo[0].number : 0; + updatemodel.Doctorate_Count = undetail.result.pointsOfBo.Any() ? undetail.result.pointsOfBo[0].number : 0; + //updatemodel.Type = UniversityTypeRelsove.GetTypeName((undetail.result.categories.Any() ? undetail.result.categories[0] : "")); + await d_UniversityRepository.Update(updatemodel); + // } } }); @@ -1919,38 +1919,94 @@ namespace New_College.Services /// public async Task UpdateUniveristyInf() { - var tbinfo = await t_TbSNeedDataInfoRepository.Query(); - // var plist = await this._PlanMajorDescRepository.Query(c => c.Location == "山东省" && c.Years == 2023); + // var tbinfo = await t_TbSNeedDataInfoRepository.Query(); + // var plist = await this._PlanMajorDescRepository.Query(c => c.Location == "山东省" && c.Years == 2023); var info = await d_UniversityRepository.Query(); - var infoimg = await d_UniversityimgRepository.Query(); + //var infoimg = await d_UniversityimgRepository.Query(); + //info.ForEach(async a => + //{ + // if (tbinfo.Where(e => e.UniversityName == a.Name).Any()) + // { + // var baseinfo = tbinfo.Where(e => e.UniversityName == a.Name).FirstOrDefault(); + // var imginfo = infoimg.FirstOrDefault(o => o.UniversityId == a.Id); + // if (!string.IsNullOrWhiteSpace(baseinfo.VRUrl)&& imginfo!=null) + // { + // imginfo.VRUrl = baseinfo.VRUrl; + // await d_UniversityimgRepository.Update(imginfo); + // } + // if (baseinfo.LnstitutionalLevel != null) + // { + // a.Sff = baseinfo.LnstitutionalLevel.Contains("211") ? 0 : 1; + // a.Syl = baseinfo.LnstitutionalLevel.Contains("双一流") ? 0 : 1; + // a.QJJH = baseinfo.LnstitutionalLevel.Contains("强基") ? 0 : 1; + // a.Nhef = baseinfo.LnstitutionalLevel.Contains("985") ? 0 : 1; + // } + // //a.Doctorate_Count = int.Parse(baseinfo.PhDPoint); + // //a.Master_Count = int.Parse(baseinfo.MastersDegree); + // a.Nature = baseinfo.Nature.Contains("公办") ? 0 : baseinfo.Nature.Contains("民办") ? 1 : baseinfo.Nature.Contains("中外合作") ? 2 : baseinfo.Nature.Contains("港澳台") ? 3 : -1; + // a.Subject_Level = baseinfo.EducationCategory == "本科" ? 0 : 1; + // await d_UniversityRepository.Update(a); + // } + //}); + var plist = await this._PlanMajorDescRepository.Query(c => c.Location == "山东省" && c.Years == 2023); info.ForEach(async a => { - if (tbinfo.Where(e => e.UniversityName == a.Name).Any()) + var pplist = plist.Where(ee => ee.UniversityName == a.Name).ToList(); + + pplist.ForEach(c => { - var baseinfo = tbinfo.Where(e => e.UniversityName == a.Name).FirstOrDefault(); - var imginfo = infoimg.FirstOrDefault(o => o.UniversityId == a.Id); - if (!string.IsNullOrWhiteSpace(baseinfo.VRUrl)&& imginfo!=null) - { - imginfo.VRUrl = baseinfo.VRUrl; - await d_UniversityimgRepository.Update(imginfo); - } - if (baseinfo.LnstitutionalLevel != null) - { - a.Sff = baseinfo.LnstitutionalLevel.Contains("211") ? 0 : 1; - a.Syl = baseinfo.LnstitutionalLevel.Contains("双一流") ? 0 : 1; - a.QJJH = baseinfo.LnstitutionalLevel.Contains("强基") ? 0 : 1; - a.Nhef = baseinfo.LnstitutionalLevel.Contains("985") ? 0 : 1; - } - //a.Doctorate_Count = int.Parse(baseinfo.PhDPoint); - //a.Master_Count = int.Parse(baseinfo.MastersDegree); - a.Nature = baseinfo.Nature.Contains("公办") ? 0 : baseinfo.Nature.Contains("民办") ? 1 : baseinfo.Nature.Contains("中外合作") ? 2 : baseinfo.Nature.Contains("港澳台") ? 3 : -1; - a.Subject_Level = baseinfo.EducationCategory == "本科" ? 0 : 1; - await d_UniversityRepository.Update(a); + + c.UId = a.Id; + c.AreaName = a.Area_Name; + c.Rank = a.Rank.ToString(); + c._985 = a.Nhef == 1 ? "是" : "否"; + c._SYL = a.Syl == 1 ? "是" : "否"; + c._211 = a.Sff == 1 ? "是" : "否"; + c.Nature = a.Nature == 0 ? "公办" : a.Nature == 1 ? "民办" : a.Nature == 2 ? "中外合作办学" : "港澳台"; + c.ReName = c.Major; + c.Remark = "(" + c.Major.Remove(c.Major.Length - 1, 1).Replace(c.Major.Split("(")[0], ""); + c.Major = c.Major.Split("(")[0]; + + }); + if (pplist.Any() && pplist.Count() > 0) + { + this._PlanMajorDescRepository.Batchupdate(pplist); } }); + return true; + } + /// + /// 更新招生计划数据 + /// + /// + public async Task UpdatePlanProInf() + { + var tbinfo = await t_TbSNeedDataInfoRepository.Query(); + var plist = await this._PlanMajorDescRepository.Query(c => c.Location == "山东省" && c.Years == 2023 && c.IsDelete == false); + plist.ForEach(p => + { + var newmodel = tbinfo.Where(e => e.EnrollmentCode == p.EnrollmentCode && e.MajorCode == p.MajorCode).FirstOrDefault(); + if (newmodel != null) + { + p.CityName = newmodel.City; + p.EducationCategory = newmodel.EducationCategory; + // p.EnrollmentCode = newmodel.EnrollmentCode; + p.EnrollmentType = newmodel.EnrollmentType; + //p.SchoolType=newmodel.sch + p.FirstType = newmodel.FirstType; + p.Nature = newmodel.Nature; + p.Ownership = newmodel.Ownership; + p.LowScore = int.Parse(newmodel._23Score); + p.LowScoreRank = int.Parse(newmodel._23ScoreLine); + + } + + }); + + await this._PlanMajorDescRepository.Batchupdate(plist); return true; } @@ -1960,6 +2016,8 @@ namespace New_College.Services + + // #region 院校排序 /// /// 院校排序 diff --git a/New_College.Services/D_PlanMajorDescServices.cs b/New_College.Services/D_PlanMajorDescServices.cs index 03eed12..59d48c0 100644 --- a/New_College.Services/D_PlanMajorDescServices.cs +++ b/New_College.Services/D_PlanMajorDescServices.cs @@ -115,8 +115,8 @@ namespace New_College.Services // SubjectClam = c.SelectSubject, Type = MajorPlanScoreTool.GetPlanScore(c.LowScore, request.Score),//冲稳保院校 Percentage = MajorPlanScoreTool.GetPlanPercentage(c.LowScore, request.Score), - //planCount = list.Where(w => w.Years == DateTime.Now.Year && w.UId == c.UId).Sum(c => c.PlanCount), - iGoPlanMajorItems = list.Where(w => w.Years == (DateTime.Now.Year-1) && w.UId == c.UId).Select(t => new AIGoPlanMajorItem() + planCount = list.Where(w => w.Years == DateTime.Now.Year && w.UId == c.UId).Sum(c => c.PlanCount), + iGoPlanMajorItems = list.Where(w => w.Years == DateTime.Now.Year && w.UId == c.UId).Select(t => new AIGoPlanMajorItem() { PlanId = t.Id, MajorCode = t.MajorCode, @@ -268,7 +268,7 @@ namespace New_College.Services Type = MajorPlanScoreTool.GetPlanScore(c.LowScore, request.Score),//还缺冲稳保 Percentage = MajorPlanScoreTool.GetPlanPercentage(c.LowScore, request.Score), PlanId = c.Id, - UniversityCode = UniversityCodeConvertRules.UniversityCodeConvertRulesMap(c.EnrollmentCode), + UniversityCode = c.EnrollmentCode, collegeCode = c.EnrollmentCode, MajorCode = c.MajorCode, LowScoreRank = c.LowScoreRank,