From dc791b849b2e35c3a7fd56f2bc5556ba607d3287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Fri, 1 Mar 2024 14:51:26 +0800 Subject: [PATCH] bug fixed --- .../Back/PlanMajorScoreLineController.cs | 1 + .../Front/UniversityRankController.cs | 2 +- New_College.Api/New_College.xml | 8 +++ .../BASE/D_PlanMajorDescProRepository.cs | 15 +++++ .../BASE/ID_PlanMajorDescProRepository.cs | 3 + New_College.Services/D_LongIdMapServices.cs | 61 ++++++++++--------- .../D_PlanMajorDescServices.cs | 4 +- 7 files changed, 62 insertions(+), 32 deletions(-) diff --git a/New_College.Api/Controllers/Back/PlanMajorScoreLineController.cs b/New_College.Api/Controllers/Back/PlanMajorScoreLineController.cs index 521d560..9392fbf 100644 --- a/New_College.Api/Controllers/Back/PlanMajorScoreLineController.cs +++ b/New_College.Api/Controllers/Back/PlanMajorScoreLineController.cs @@ -230,6 +230,7 @@ namespace New_College.Api.Controllers } Expression> expression = Expressionable.Create() .And(c => c.UId == request.Uid) + .And(c => c.IsDelete == false) .AndIF(!string.IsNullOrWhiteSpace(request.BatchName), c => c.BatchName == request.BatchName) .AndIF(request.Year.HasValue && request.Year > 0, c => c.Years == request.Year) .ToExpression(); diff --git a/New_College.Api/Controllers/Front/UniversityRankController.cs b/New_College.Api/Controllers/Front/UniversityRankController.cs index 4285c1b..4107aca 100644 --- a/New_College.Api/Controllers/Front/UniversityRankController.cs +++ b/New_College.Api/Controllers/Front/UniversityRankController.cs @@ -46,7 +46,7 @@ namespace New_College.Api.Controllers status = 200 }; } - string years = DateTime.Now.Year.ToString(); + string years = (DateTime.Now.Year-1).ToString(); var query = await _UniversityRankRepository.Query(c => c.Year == years && c.UniversityName == single.UniversityName); return new MessageModel> () { diff --git a/New_College.Api/New_College.xml b/New_College.Api/New_College.xml index c1a808f..70c28bd 100644 --- a/New_College.Api/New_College.xml +++ b/New_College.Api/New_College.xml @@ -252,6 +252,14 @@ + + + 增加粉丝 + + + + + 同步合并数据 diff --git a/New_College.Repository/BASE/D_PlanMajorDescProRepository.cs b/New_College.Repository/BASE/D_PlanMajorDescProRepository.cs index 1a5c2f8..0a98c20 100644 --- a/New_College.Repository/BASE/D_PlanMajorDescProRepository.cs +++ b/New_College.Repository/BASE/D_PlanMajorDescProRepository.cs @@ -24,6 +24,21 @@ namespace New_College.Repository } + + /// + /// + /// + /// + /// + 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; + } + + public async Task> GetUniversityPlanPro(UniversityProViewQuery request) { RefAsync totalCount = 0; diff --git a/New_College.Repository/BASE/ID_PlanMajorDescProRepository.cs b/New_College.Repository/BASE/ID_PlanMajorDescProRepository.cs index 1dd6138..60ab6e6 100644 --- a/New_College.Repository/BASE/ID_PlanMajorDescProRepository.cs +++ b/New_College.Repository/BASE/ID_PlanMajorDescProRepository.cs @@ -2,6 +2,7 @@ using New_College.Model; using New_College.Model.Models; using New_College.Model.ViewModels; +using System.Collections.Generic; using System.Threading.Tasks; namespace New_College.IRepository @@ -12,5 +13,7 @@ namespace New_College.IRepository public interface ID_PlanMajorDescProRepository : IBaseRepository { Task> GetUniversityPlanPro(UniversityProViewQuery request); + + 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 facd915..de5b742 100644 --- a/New_College.Services/D_LongIdMapServices.cs +++ b/New_College.Services/D_LongIdMapServices.cs @@ -860,19 +860,14 @@ namespace New_College.Services /// public async Task> GetPlanBySchollId(PlanQuery query) { - Expression> whereexp = Expressionable.Create() //创建表达式 + Expression> whereexp = Expressionable.Create() //创建表达式 + .And(c => c.IsDelete == false) .AndIF(!string.IsNullOrEmpty(query.AreaName), c => c.Location == query.AreaName) .And(c => c.UId == query.UnviersityId) .AndIF(!string.IsNullOrEmpty(query.BatchName), c => c.BatchName == query.BatchName) .AndIF(query.Year > 0, c => c.Years == query.Year) .ToExpression(); - ////var check = await t_EnrollmentBatchRepository.Query(x => x.Type == query.Type && x.Year == query.Year && x.Batch_name == query.BatchName && x.AreaName == query.AreaName); - ////if (check.Count <= 0) - //var check = await d_PlanMajorDescRepository.Query(x => x.Years == query.Year && x.BatchName == query.BatchName && x.Location == query.AreaName); - //if (check.Count <= 0) - // return new List() { }; - // var batchid = check.Select(x => x.Id)?.FirstOrDefault(); - var info = await d_PlanMajorDescRepository.Query(whereexp); + var info = await d_PlanMajorDescProRepository.Query(whereexp); List list = new List() { }; foreach (var item in info) { @@ -1073,7 +1068,7 @@ namespace New_College.Services }; } - + #region 数据导入 @@ -2030,30 +2025,38 @@ namespace New_College.Services #endregion + + + + + + //var universitylist=await un #region 更新专业计划信息 - //var plist = await this._PlanMajorDescRepository.Query(c => c.Location == "山东省" && c.Years == 2023 && c.IsDelete == false && c.UId <= 0); - //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); + var plist = await this.d_PlanMajorDescProRepository.Query(c => c.Location == "山东省" && c.Years == 2023 && c.IsDelete == false && c.UId <= 0); + plist.ForEach(p => + { + var newmodel = tbinfo.Where(e => (e.EnrollmentCode == p.EnrollmentCode || e.UniversityName == p.UniversityName) && 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.NewCount = int.Parse(newmodel._23Count) - int.Parse(newmodel._22Count); + p.PlanCount = int.Parse(newmodel._23Count); + p.LowScore = int.Parse(newmodel._23Score); + p.LowScoreRank = int.Parse(newmodel._23ScoreLine); - // } + } - //}); + }); - //await this._PlanMajorDescRepository.Batchupdate(plist); + await this.d_PlanMajorDescProRepository.Batchupdate(plist); #endregion @@ -2079,7 +2082,7 @@ namespace New_College.Services return true; } - + diff --git a/New_College.Services/D_PlanMajorDescServices.cs b/New_College.Services/D_PlanMajorDescServices.cs index 9588702..6b8ecc9 100644 --- a/New_College.Services/D_PlanMajorDescServices.cs +++ b/New_College.Services/D_PlanMajorDescServices.cs @@ -243,8 +243,8 @@ namespace New_College.Services c._frank = items.Min(e => int.Parse(e._23SchoolScoreLine)); c._sscore = items.Min(e => int.Parse(e._22Score)); c._srank = items.Min(e => int.Parse(e._22ScoreLine)); - c._tscore = items.Min(e => int.Parse(e._22Score)); - c._trank = items.Min(e => int.Parse(e._22ScoreLine)); + c._tscore = items.Min(e => int.Parse(e._21Score)); + c._trank = items.Min(e => int.Parse(e._21ScoreLine)); } c.iGoPlanMajorItems = items.Select(t => new AIGoPlanMajorItem() {