diff --git a/New_College.Api/Controllers/Front/PcVolunteerController.cs b/New_College.Api/Controllers/Front/PcVolunteerController.cs index 262d951..409498d 100644 --- a/New_College.Api/Controllers/Front/PcVolunteerController.cs +++ b/New_College.Api/Controllers/Front/PcVolunteerController.cs @@ -148,7 +148,7 @@ namespace New_College.Api.Controllers.Front SubjectClam = c.SelectSubject, PlanItems = planmajorcomplist.Where(ee => ee.UId == s.UniversityId && ee.Major == c.Major).Select(tt => new PlanItem() { - Count = tt.PlanCount, + Count = (tt.PlanCount==0?"--": tt.PlanCount.ToString()), PlanCount = tt.PlanCount, RankLine = tt.LowScoreRank, Scoreline = tt.LowScore, diff --git a/New_College.Api/Controllers/HealthCheckController.cs b/New_College.Api/Controllers/HealthCheckController.cs index 1f387c4..a16e281 100644 --- a/New_College.Api/Controllers/HealthCheckController.cs +++ b/New_College.Api/Controllers/HealthCheckController.cs @@ -48,6 +48,8 @@ namespace New_College.Controllers // return t_EnrollmentPlane.categoryupdate(); + + return d_LongIdMapServices.Import(); diff --git a/New_College.Api/New_College.Model.xml b/New_College.Api/New_College.Model.xml index 3335252..2f01b62 100644 --- a/New_College.Api/New_College.Model.xml +++ b/New_College.Api/New_College.Model.xml @@ -1126,6 +1126,11 @@ 是否双一流 0、否,1、是 + + + 院校代码 + + 强基计划 diff --git a/New_College.Common/Helper/UniversityTypeRelsove.cs b/New_College.Common/Helper/UniversityTypeRelsove.cs index f13858d..2461e03 100644 --- a/New_College.Common/Helper/UniversityTypeRelsove.cs +++ b/New_College.Common/Helper/UniversityTypeRelsove.cs @@ -68,6 +68,63 @@ namespace New_College.Common.Helper } + /// + /// + /// + /// + /// + public static int GetTypeName(string name) + { + int type = 0; + switch (name) + { + case "综合": + type = 0; + break; + case "理工": + type = 1; + break; + case "医学": + type = 2; + break; + case "军事": + type = 3; + break; + case "语言": + type = 4; + break; + case "师范": + type = 5; + break; + case "财经": + type = 6; + break; + case "政法": + type = 7; + break; + case "民族": + type = 8; + break; + case "农林": + type = 9; + break; + case "艺术": + type = 10; + break; + case "体育": + type = 11; + break; + case "其他": + type = 12; + break; + } + + + + return type; + } + + public static string GetFileJson(string filepath) { string json = string.Empty; @@ -77,7 +134,7 @@ namespace New_College.Common.Helper { json = sr.ReadToEnd().ToString(); - // var obj = JsonConvert.DeserializeObject(json); + // var obj = JsonConvert.DeserializeObject(json); } } return json; diff --git a/New_College.Model/Models/D_University.cs b/New_College.Model/Models/D_University.cs index 4cf863d..2db591c 100644 --- a/New_College.Model/Models/D_University.cs +++ b/New_College.Model/Models/D_University.cs @@ -77,6 +77,11 @@ namespace New_College.Model.Models public int Syl { get; set; } + /// + /// 院校代码 + /// + [SugarColumn(IsNullable = true)] + public string UniversityCode { get; set; } /// /// 强基计划 /// diff --git a/New_College.Model/ViewModels/Query/OneSubmitGoRequest.cs b/New_College.Model/ViewModels/Query/OneSubmitGoRequest.cs index 2db2b68..32fa190 100644 --- a/New_College.Model/ViewModels/Query/OneSubmitGoRequest.cs +++ b/New_College.Model/ViewModels/Query/OneSubmitGoRequest.cs @@ -286,7 +286,7 @@ namespace New_College.Model.ViewModels { public string Year { get; set; } public int PlanCount { get; set; } - public int Count { get; set; } + public string Count { get; set; } /// /// 位次 /// diff --git a/New_College.Repository/BASE/D_UniversityRankRepository.cs b/New_College.Repository/BASE/D_UniversityRankRepository.cs index 43b9bd0..1e3ebcb 100644 --- a/New_College.Repository/BASE/D_UniversityRankRepository.cs +++ b/New_College.Repository/BASE/D_UniversityRankRepository.cs @@ -26,7 +26,7 @@ namespace New_College.Repository var response = await this.Db.Queryable((rank, u) => new object[] { JoinType.Left, rank.UniversityName == u.Name }) .Where((rank, u) => rank.UniversityType == query.Type) - .WhereIF(!string.IsNullOrWhiteSpace(query.Name), (rank, u) => SqlFunc.Contains(query.Name, rank.UniversityName)) + .WhereIF(!string.IsNullOrWhiteSpace(query.Name), (rank, u) => SqlFunc.Contains(rank.UniversityName, query.Name)) .WhereIF(query.SubjectType.HasValue, (rank, u) => u.Type == query.SubjectType) .WhereIF(!string.IsNullOrWhiteSpace(query.Year), (rank, u) => rank.Year == query.Year) .OrderBy((rank, u) => rank.Rank, OrderByType.Asc) @@ -34,7 +34,7 @@ namespace New_College.Repository { AreaName = u.Area_Name, Logo = u.Logo, - Name = u.Name, + Name = rank.UniversityName, Syl = u.Syl == 1 ? true : false, Nhef = u.Nhef == 1 ? true : false, Sff = u.Sff == 1 ? true : false, diff --git a/New_College.Services/D_LongIdMapServices.cs b/New_College.Services/D_LongIdMapServices.cs index fa93414..8ed9465 100644 --- a/New_College.Services/D_LongIdMapServices.cs +++ b/New_College.Services/D_LongIdMapServices.cs @@ -23,6 +23,8 @@ using Org.BouncyCastle.Asn1.Ocsp; using Essensoft.AspNetCore.Payment.Alipay.Domain; using StackExchange.Redis; using New_College.Repository; +using NPOI.Util.ArrayExtensions; +using System.Threading; namespace New_College.Services { @@ -1670,7 +1672,7 @@ namespace New_College.Services public async Task Import() { // var universitylist = await d_UniversityRepository.Query(); - var plist = await this._PlanMajorDescRepository.Query(c => c.Location == "山东省" && c.Years == 2021 && c.PlanCount > 0); + // var plist = await this._PlanMajorDescRepository.Query(c => c.Location == "山东省" && c.Years == 2021 && c.PlanCount > 0); //universitylist.ForEach(async u => //{ // plist.ForEach(async cc => @@ -1782,17 +1784,52 @@ namespace New_College.Services // await d_PlanMajorDescRepository.Update(a); // } //}); - var plistpro = await d_PlanMajorDescProRepository.Query(c => c.Location == "山东省" && c.Years == 2023); - plist.ForEach(async c => + //var plistpro = await d_PlanMajorDescProRepository.Query(c => c.Location == "山东省" && c.Years == 2023); + //plist.ForEach(async c => + //{ + // if (plistpro.Where(w => w.UId == c.UId && w.Major == c.Major && c.BatchName == w.BatchName && w.Location == "山东省").Any()) + // { + // var pmodel = plistpro.Where(w => w.UId == c.UId && w.Major == c.Major && c.BatchName == w.BatchName && w.Location == "山东省").FirstOrDefault(); + // pmodel.NewCount = pmodel.PlanCount - c.PlanCount; + // pmodel.ModifyTime = DateTime.Now; + // await d_PlanMajorDescProRepository.Update(pmodel); + // } + //}); + #region *******************院校信息更新****************** + + for (var i = 1; i <= 147; i++) { - if (plistpro.Where(w => w.UId == c.UId && w.Major == c.Major && c.BatchName == w.BatchName && w.Location == "山东省").Any()) + var body = new HttpHelperPostRequest() { pageIndex = i }; + var info = HttpHelper.PostApi("http://192.168.104.104:3000/youzy.dms.basiclib.api.college.query", body); + + info.result.items.ToList().ForEach(async a => { - var pmodel = plistpro.Where(w => w.UId == c.UId && w.Major == c.Major && c.BatchName == w.BatchName && w.Location == "山东省").FirstOrDefault(); - pmodel.NewCount = pmodel.PlanCount - c.PlanCount; - pmodel.ModifyTime = DateTime.Now; - await d_PlanMajorDescProRepository.Update(pmodel); - } - }); + + //http://192.168.104.104:3000/youzy.dms.basiclib.api.college.bycode.get?code=10017 //详情 + // var bodydetail = new httphelperdetailrequest() { code = a.code }; + var undetail = HttpHelper.GetApi("http://192.168.104.104:3000/", "youzy.dms.basiclib.api.college.bycode.get?code=" + a.code + "", ""); + Thread.Sleep(1000); + var universitymodel = await d_UniversityRepository.Query(c => c.Name == a.cnName); + if (universitymodel.Any() && undetail != null && undetail.result != null) + { + var updatemodel = universitymodel.FirstOrDefault(); + 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); + } + + }); + + } + #endregion + + + return true; } @@ -1800,6 +1837,181 @@ namespace New_College.Services + public class httphelperdetailrequest + { + + public string code { get; set; } + } + public class HttpHelperPostRequest + { + public int pageIndex { get; set; } + + } + + + public class HttpHelperPostobject + { + public Result result { get; set; } + public string code { get; set; } + public string message { get; set; } + public string fullMessage { get; set; } + public DateTime timestamp { get; set; } + public bool isSuccess { get; set; } + } + + public class Result + { + public int totalCount { get; set; } + public Item[] items { get; set; } + } + + public class Item + { + public int numId { get; set; } + public string code { get; set; } + public string gbCode { get; set; } + public string cnName { get; set; } + public string logoUrl { get; set; } + public string natureType { get; set; } + public string eduLevel { get; set; } + public string belong { get; set; } + public string[] categories { get; set; } + public string[] features { get; set; } + public object[] artFeatures { get; set; } + public string provinceCode { get; set; } + public string provinceName { get; set; } + public string cityName { get; set; } + public int hits { get; set; } + public int ranking { get; set; } + public int rankingOfWSL { get; set; } + public int rankingOfRK { get; set; } + public int rankingOfXYH { get; set; } + public int rankingOfQS { get; set; } + public int rankingOfUSNews { get; set; } + public int rankingOfEdu { get; set; } + public float comScore { get; set; } + public string id { get; set; } + } + + + + + public class UniversityDetailobject + { + public DetailResult result { get; set; } + public string code { get; set; } + public string message { get; set; } + public string fullMessage { get; set; } + public DateTime timestamp { get; set; } + public bool isSuccess { get; set; } + } + + public class DetailResult + { + public int numId { get; set; } + public string code { get; set; } + public string gbCode { get; set; } + public string cnName { get; set; } + public string logoUrl { get; set; } + public string vrUrl { get; set; } + public string vrShortUrl { get; set; } + public string provinceCode { get; set; } + public string provinceName { get; set; } + public string cityName { get; set; } + public Address[] address { get; set; } + public string createdYear { get; set; } + public string celebrateDay { get; set; } + public string natureType { get; set; } + public string eduLevel { get; set; } + public string[] categories { get; set; } + public string[] features { get; set; } + public object[] artFeatures { get; set; } + public string[] entranceType { get; set; } + public string belong { get; set; } + public string introduction { get; set; } + public Nameused[] nameUsed { get; set; } + public string enName { get; set; } + public string shortName { get; set; } + public string motto { get; set; } + public string song { get; set; } + public string songMp3Url { get; set; } + public Award[] awards { get; set; } + public int numberOfStu { get; set; } + public int maleRateOfStu { get; set; } + public int femaleRateOfStu { get; set; } + public int numberOfBen { get; set; } + public int maleRateOfBen { get; set; } + public int femaleRateOfBen { get; set; } + public int numberOfYan { get; set; } + public int maleRateOfYan { get; set; } + public int femaleRateOfYan { get; set; } + public int numberOfBo { get; set; } + public int maleRateOfBo { get; set; } + public int femaleRateOfBo { get; set; } + public Pointsofshuo[] pointsOfShuo { get; set; } + public Pointsofbo[] pointsOfBo { get; set; } + public int numberOfBSH { get; set; } + public object[] academicians { get; set; } + public string rateOfBaoYan { get; set; } + public object[] histories { get; set; } + public object[] alumnis { get; set; } + public string webSite { get; set; } + public string zhaoBanWZ { get; set; } + public string[] zhaoBanDH { get; set; } + public string shuoShiWebSite { get; set; } + public string shuoShiZBWZ { get; set; } + public string[] shuoShiZBDH { get; set; } + public string lastOperator { get; set; } + public DateTime updatedAt { get; set; } + public string bannerUrl { get; set; } + public int hits { get; set; } + public string[] bxType { get; set; } + public string[] bxLevel { get; set; } + public string star { get; set; } + public string majorRule { get; set; } + public int rankingOfWSL { get; set; } + public int rankingOfRK { get; set; } + public int rankingOfXYH { get; set; } + public int rankingOfUSNews { get; set; } + public int rankingOfQS { get; set; } + public int rankingOfEdu { get; set; } + public string id { get; set; } + } + + public class Address + { + public string name { get; set; } + public string address { get; set; } + public string coordinate { get; set; } + } + + public class Nameused + { + public int startYear { get; set; } + public string startTimeText { get; set; } + public string endTimeText { get; set; } + public int endYear { get; set; } + public string name { get; set; } + } + + public class Award + { + public string name { get; set; } + public int year { get; set; } + public int month { get; set; } + } + + public class Pointsofshuo + { + public int number { get; set; } + public string type { get; set; } + } + + public class Pointsofbo + { + public int number { get; set; } + public string type { get; set; } + }