diff --git a/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs b/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs index 2a3b99b..be3a4e6 100644 --- a/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs +++ b/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs @@ -6,12 +6,14 @@ using Microsoft.AspNetCore.Mvc; using System; using System.Linq.Expressions; using System.Threading.Tasks; +using New_College.Model.ViewModels; +using System.Linq; namespace New_College.Api.Controllers { [Route("api/[controller]/[action]")] [ApiController] - [Authorize(Permissions.Name)] + [Authorize] public class D_PlanMajorDescController : ControllerBase { /// @@ -24,52 +26,36 @@ namespace New_College.Api.Controllers _d_PlanMajorDescServices = D_PlanMajorDescServices; } + + /// + /// 一键填报 + /// + /// + /// [HttpGet] - public async Task>> Get(int page = 1, string key = "", int intPageSize = 50) + public async Task>> OneSubmitGo([FromQuery] OneSubmitGoRequest request) { - if (string.IsNullOrEmpty(key) || string.IsNullOrWhiteSpace(key)) + + var response = await _d_PlanMajorDescServices.GetPlanMajorList(request); + if (!response.data.Any() || response.dataCount <= 0) { - key = ""; + return new MessageModel>() + { + msg = "获取失败", + success = false, + response = response + }; } - Expression> whereExpression = a => a.Id > 0; - - return new MessageModel>() + return new MessageModel>() { msg = "获取成功", success = true, - response = await _d_PlanMajorDescServices.QueryPage(whereExpression, page, intPageSize) + response = response }; } - [HttpGet("{id}")] - public async Task> Get(int id = 0) - { - return new MessageModel() - { - msg = "获取成功", - success = true, - response = await _d_PlanMajorDescServices.QueryById(id) - }; - } - - [HttpPost] - public async Task> Post([FromBody] D_PlanMajorDesc request) - { - var data = new MessageModel(); - - var id = await _d_PlanMajorDescServices.Add(request); - data.success = id > 0; - - if (data.success) - { - data.response = id.ObjToString(); - data.msg = "添加成功"; - } - - return data; - } diff --git a/New_College.Api/Controllers/Front/HighSchoolRankController.cs b/New_College.Api/Controllers/Front/HighSchoolRankController.cs new file mode 100644 index 0000000..a41afff --- /dev/null +++ b/New_College.Api/Controllers/Front/HighSchoolRankController.cs @@ -0,0 +1,80 @@ +using New_College.IServices; +using New_College.Model; +using New_College.Model.Models; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Linq.Expressions; +using System.Threading.Tasks; +using System.Collections.Generic; +using New_College.Model.ViewModels; +using SqlSugar; +using System.Linq; + +namespace New_College.Api.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + [Authorize(Permissions.Name)] + public class HighSchoolRankController : ControllerBase + { + /// + /// 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下 + /// + private readonly ID_HighSchoolRankServices _d_HighSchoolRankServices; + + public HighSchoolRankController(ID_HighSchoolRankServices D_HighSchoolRankServices) + { + _d_HighSchoolRankServices = D_HighSchoolRankServices; + } + + + + /// + /// 获取高中学校名单 + /// + /// 通过省份名称当作过滤条件模糊查询学校名称 + /// + [HttpGet] + public async Task>> Get(HighSchoolRankRequest highSchoolRank) + { + if (string.IsNullOrWhiteSpace(highSchoolRank.City)) + { + return new MessageModel>() + { + msg = "请传入省份或城市字段:City", + success = false + }; + } + if (string.IsNullOrWhiteSpace(highSchoolRank.Province)) + { + return new MessageModel>() + { + msg = "请传入省份或城市字段:Province", + success = false + }; + } + Expression> exp = Expressionable.Create() + .And(c => c.IsDelete == false) + .AndIF(!string.IsNullOrWhiteSpace(highSchoolRank.Province), c => c.Province == highSchoolRank.Province) + .AndIF(!string.IsNullOrWhiteSpace(highSchoolRank.City), c => c.City == highSchoolRank.City) + .AndIF(!string.IsNullOrWhiteSpace(highSchoolRank.Area), c => c.City == highSchoolRank.Area) + .AndIF(!string.IsNullOrWhiteSpace(highSchoolRank.Name), c => SqlFunc.Contains(highSchoolRank.Name, c.SchoolName)) + .ToExpression(); + var query = (await _d_HighSchoolRankServices.Query(exp)).Select(c => new HighSchoolRankResponse() + { + SchoolName = c.SchoolName, + Id = c.Id, + }).ToList(); + + return new MessageModel>() + { + msg = "获取成功", + success = true, + response = query + }; + + } + + } +} \ No newline at end of file diff --git a/New_College.Api/New_College.Model.xml b/New_College.Api/New_College.Model.xml index a34f6ae..4d1ccb9 100644 --- a/New_College.Api/New_College.Model.xml +++ b/New_College.Api/New_College.Model.xml @@ -632,7 +632,7 @@ - 办学性质 + 办学性质:公办 民办 @@ -3590,6 +3590,151 @@ 类型 1本科 2专科 + + + 一键填报传入参数 + + + + + 批次名称 + + + + + 选科组合 + + + + + 用户所在省份 + + + + + 分数 + + + + + 高考年份 + + + + + 检索省份 + + + + + 办学性质 0、公办,1、民办,2中外合作,3 港澳台 + + + + + 大学类型 综合,理工类,医学类... + + + + + 1专业到学校 2学校到专业 + + + + + 是否985 0、否,1、是 + + + + + 是否211 0、否,1、是 + + + + + 是否双一流 0、否,1、是 + + + + + 学校归属:教育部,上海市-湖北省 + + + + + 一键填报返回值 + + + + + 冲稳保 类型 + + + + + 排名 + + + + + 全国统一招生代码 + + + + + + + + + + 计划数 + + + + + 学费 + + + + + 专业代码 + + + + + 专业组 + + + + + 专业名称 + + + + + 专业备注 + + + + + 选科组合 + + + + + + + + + + 招生计划Id + + + + + 位次 + + 1支付宝支付 2微信支付 diff --git a/New_College.Api/New_College.xml b/New_College.Api/New_College.xml index 8dd3569..1f2de7b 100644 --- a/New_College.Api/New_College.xml +++ b/New_College.Api/New_College.xml @@ -835,6 +835,18 @@ + + + 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下 + + + + + 获取高中学校名单 + + 通过省份名称当作过滤条件模糊查询学校名称 + + 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下 diff --git a/New_College.IServices/ID_HighSchoolRankServices.cs b/New_College.IServices/ID_HighSchoolRankServices.cs new file mode 100644 index 0000000..5838659 --- /dev/null +++ b/New_College.IServices/ID_HighSchoolRankServices.cs @@ -0,0 +1,12 @@ +using New_College.IServices.BASE; +using New_College.Model.Models; + +namespace New_College.IServices +{ + /// + /// ID_HighSchoolRankServices + /// + public interface ID_HighSchoolRankServices :IBaseServices + { + } +} \ No newline at end of file diff --git a/New_College.IServices/ID_PlanMajorDescServices.cs b/New_College.IServices/ID_PlanMajorDescServices.cs index 7000701..8a540c7 100644 --- a/New_College.IServices/ID_PlanMajorDescServices.cs +++ b/New_College.IServices/ID_PlanMajorDescServices.cs @@ -1,5 +1,8 @@ using New_College.IServices.BASE; +using New_College.Model; using New_College.Model.Models; +using New_College.Model.ViewModels; +using System.Threading.Tasks; namespace New_College.IServices { @@ -8,5 +11,12 @@ namespace New_College.IServices /// public interface ID_PlanMajorDescServices :IBaseServices { + + /// + /// 一键填报 + /// + /// + /// + Task> GetPlanMajorList(OneSubmitGoRequest request); } } \ No newline at end of file diff --git a/New_College.Model/Models/D_HighSchoolRank.cs b/New_College.Model/Models/D_HighSchoolRank.cs new file mode 100644 index 0000000..62a59c3 --- /dev/null +++ b/New_College.Model/Models/D_HighSchoolRank.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace New_College.Model.Models +{ + public class D_HighSchoolRank : EntityModel + { + public string SchoolName { get; set; } + public string City { get; set; } + public string Area { get; set; } + public string Province { get; set; } + + + + } +} diff --git a/New_College.Model/Models/D_PlanMajorDesc.cs b/New_College.Model/Models/D_PlanMajorDesc.cs index 0a1eb2b..7546dc5 100644 --- a/New_College.Model/Models/D_PlanMajorDesc.cs +++ b/New_College.Model/Models/D_PlanMajorDesc.cs @@ -131,7 +131,7 @@ namespace New_College.Model.Models public string Location { get; set; } /// - /// 办学性质 + /// 办学性质:公办 民办 /// public string Nature { get; set; } diff --git a/New_College.Model/ViewModels/Query/HighSchoolRankRequest.cs b/New_College.Model/ViewModels/Query/HighSchoolRankRequest.cs new file mode 100644 index 0000000..2f99923 --- /dev/null +++ b/New_College.Model/ViewModels/Query/HighSchoolRankRequest.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace New_College.Model.ViewModels +{ + public class HighSchoolRankRequest + { + + public string Province { get; set; } + public string City { get; set; } + + public string Area { get; set; } + public string Name { get; set; } + + } + + + public class HighSchoolRankResponse + { + public int Id { get; set; } + public string SchoolName { get; set; } + + } + +} diff --git a/New_College.Model/ViewModels/Query/OneSubmitGoRequest.cs b/New_College.Model/ViewModels/Query/OneSubmitGoRequest.cs new file mode 100644 index 0000000..13e4a82 --- /dev/null +++ b/New_College.Model/ViewModels/Query/OneSubmitGoRequest.cs @@ -0,0 +1,191 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Text; + +namespace New_College.Model.ViewModels +{ + + /// + /// 一键填报传入参数 + /// + public class OneSubmitGoRequest : BasePageRequest + { + + /// + ///批次名称 + /// + public string BatchName { get; set; } + + /// + /// 选科组合 + /// + public string SubjectClaim { get; set; } + + /// + /// 用户所在省份 + /// + public string Location { get; set; } + + /// + /// 分数 + /// + public int Score { get; set; } + + /// + /// 高考年份 + /// + public int Year { get; set; } + + /// + /// 检索省份 + /// + public string Province { get; set; } + + + ///// + ///// 学科层次 1、本科,2、专科 + ///// + public int? SubjectLevel { get; set; } + + /// + /// 办学性质 0、公办,1、民办,2中外合作,3 港澳台 + /// + public string Nature { get; set; } + + /// + ///大学类型 综合,理工类,医学类... + /// + public string SchoolType { get; set; } + + /// + /// 1专业到学校 2学校到专业 + /// + public int? SearchType { get; set; } + + + /// + /// 是否985 0、否,1、是 + /// + public int? _985 { get; set; } + /// + /// 是否211 0、否,1、是 + /// + public int? _211 { get; set; } + + /// + /// 是否双一流 0、否,1、是 + /// + public int? Syl { get; set; } + + /// + ///学校归属:教育部,上海市-湖北省 + /// + public string Ownership { get; set; } + + public string Major { get; set; } + + } + + + + /// + /// 一键填报返回值 + /// + public class OneSubmitGoResponse + { + + /// + /// 冲稳保 类型 + /// + public string Type { get; set; } + /// + /// 排名 + /// + public string Rank { get; set; } + + public int UniversityId { get; set; } + + public string UniversityName { get; set; } + + + /// + /// 全国统一招生代码 + /// + public string UniversityCode { get; set; } + + public string AreaName { get; set; } + + public string _985 { get; set; } + + + public string _211 { get; set; } + + /// + /// + /// + public string _SYL { get; set; } + + /// + /// 计划数 + /// + public int planCount { get; set; } + + /// + /// 学费 + /// + public string fee { get; set; } + + + /// + /// 专业代码 + /// + public string MajorCode { get; set; } + /// + /// 专业组 + /// + public string MajorGroup { get; set; } + /// + /// 专业名称 + /// + public string Major { get; set; } + + /// + /// 专业备注 + /// + public string MajorRemark { get; set; } + + /// + /// 选科组合 + /// + public string SubjectClam { get; set; } + + /// + /// + /// + public List PlanItems { get; set; } + + /// + /// 招生计划Id + /// + public int PlanId { get; set; } + + + } + + public class PlanItem + { + public string Year { get; set; } + public int PlanCount { get; set; } + public int Count { get; set; } + /// + /// 位次 + /// + public int RankLine { get; set; } + ///// + ///// 最低分 + ///// + public int Scoreline { get; set; } + } + +} diff --git a/New_College.Repository/BASE/D_HighSchoolRankRepository.cs b/New_College.Repository/BASE/D_HighSchoolRankRepository.cs new file mode 100644 index 0000000..97409c8 --- /dev/null +++ b/New_College.Repository/BASE/D_HighSchoolRankRepository.cs @@ -0,0 +1,17 @@ +using New_College.IRepository; +using New_College.IRepository.UnitOfWork; +using New_College.Model.Models; +using New_College.Repository.Base; + +namespace New_College.Repository +{ + /// + /// D_HighSchoolRankRepository + /// + public class D_HighSchoolRankRepository : BaseRepository, ID_HighSchoolRankRepository + { + public D_HighSchoolRankRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + } + } +} \ No newline at end of file diff --git a/New_College.Repository/BASE/ID_HighSchoolRankRepository.cs b/New_College.Repository/BASE/ID_HighSchoolRankRepository.cs new file mode 100644 index 0000000..4d067cc --- /dev/null +++ b/New_College.Repository/BASE/ID_HighSchoolRankRepository.cs @@ -0,0 +1,12 @@ +using New_College.IRepository.Base; +using New_College.Model.Models; + +namespace New_College.IRepository +{ + /// + /// ID_HighSchoolRankRepository + /// + public interface ID_HighSchoolRankRepository : IBaseRepository + { + } +} \ No newline at end of file diff --git a/New_College.Services/D_HighSchoolRankServices.cs b/New_College.Services/D_HighSchoolRankServices.cs new file mode 100644 index 0000000..5f75e0d --- /dev/null +++ b/New_College.Services/D_HighSchoolRankServices.cs @@ -0,0 +1,18 @@ + +using New_College.IServices; +using New_College.Model.Models; +using New_College.Services.BASE; +using New_College.IRepository.Base; + +namespace New_College.Services +{ + public class D_HighSchoolRankServices : BaseServices, ID_HighSchoolRankServices + { + private readonly IBaseRepository _dal; + public D_HighSchoolRankServices(IBaseRepository dal) + { + this._dal = dal; + base.BaseDal = dal; + } + } +} \ No newline at end of file diff --git a/New_College.Services/D_PlanMajorDescServices.cs b/New_College.Services/D_PlanMajorDescServices.cs index 2333fc3..47f0cc8 100644 --- a/New_College.Services/D_PlanMajorDescServices.cs +++ b/New_College.Services/D_PlanMajorDescServices.cs @@ -3,9 +3,20 @@ using New_College.IServices; using New_College.Model.Models; using New_College.Services.BASE; using New_College.IRepository.Base; +using System.Threading.Tasks; +using New_College.Model.ViewModels; +using New_College.Model; +using SqlSugar; +using System.Linq.Expressions; +using System; +using System.Linq; namespace New_College.Services { + + /// + /// 填报数据整合 + /// public class D_PlanMajorDescServices : BaseServices, ID_PlanMajorDescServices { private readonly IBaseRepository _dal; @@ -14,5 +25,122 @@ namespace New_College.Services this._dal = dal; base.BaseDal = dal; } + + + + /// + /// 一键填报招生计划展示 + /// + /// + /// + public async Task> GetPlanMajorList(OneSubmitGoRequest request) + { + if (string.IsNullOrWhiteSpace(request.Location)) + { + return new PageModel() + { + }; + } + if (request.Year <= 0) + { + return new PageModel() + { + + }; + } + var pagemodel = new PageModel(); + Expression> expression = Expressionable.Create() + .And(c => c.IsDelete == false) + .And(c => c.Location == request.Location) + .AndIF(!string.IsNullOrWhiteSpace(request.Major), c => SqlFunc.Contains(request.Major, c.Major)) + .AndIF(!string.IsNullOrWhiteSpace(request.SubjectClaim), c => SqlFunc.Contains(request.SubjectClaim, c.SelectSubject)) + .AndIF(!string.IsNullOrWhiteSpace(request.BatchName), c => c.BatchName.Equals(request.BatchName)) + .AndIF(!string.IsNullOrWhiteSpace(request.Province), c => SqlFunc.Contains(request.Province, c.AreaName)) + .And(c => c.Years == request.Year) + .AndIF(!string.IsNullOrWhiteSpace(request.SchoolType), c => c.SchoolType == request.SchoolType) + .AndIF(request.Score > 0, c => SqlFunc.Between(c.LowScore, request.Score - 15, request.Score + 15)) + .AndIF(request.Syl.HasValue && request.Syl == 1, c => c._SYL == "是") + .AndIF(request._211.HasValue && request._211 == 1, c => c._211 == "是") + .AndIF(request._985.HasValue && request._985 == 1, c => c._985 == "是") + .AndIF(!string.IsNullOrWhiteSpace(request.Ownership), c => c.Ownership == request.Ownership) + .AndIF(!string.IsNullOrWhiteSpace(request.Nature), c => c.Nature == request.Nature) + //.AndIF(request. > 0, c => SqlFunc.Between(c.LowScore, request.Score, request.Score)) 位次区间 + .ToExpression(); + var query = await _dal.QueryPage(expression, request.PageIndex, request.PageSize, " order by LowScoreRank desc"); + + var majorarry = query.data.Select(c => c.Major).ToArray(); + var universityarry = query.data.Select(c => c.UniversityName).ToArray(); + Expression> expression2 = Expressionable.Create() + .And(c => c.IsDelete == false) + .And(c => c.Location == request.Location) + .AndIF(!string.IsNullOrWhiteSpace(request.Major), c => SqlFunc.Contains(request.Major, c.Major)) + .AndIF(!string.IsNullOrWhiteSpace(request.SubjectClaim), c => SqlFunc.Contains(request.SubjectClaim, c.SelectSubject)) + .AndIF(!string.IsNullOrWhiteSpace(request.BatchName), c => c.BatchName.Equals(request.BatchName)) + .AndIF(!string.IsNullOrWhiteSpace(request.Province), c => SqlFunc.Contains(request.Province, c.AreaName)) + //.And(c => c.Years == request.Year) + .AndIF(!string.IsNullOrWhiteSpace(request.SchoolType), c => c.SchoolType == request.SchoolType) + .AndIF(request.Score > 0, c => SqlFunc.Between(c.LowScore, request.Score - 15, request.Score + 15)) + .AndIF(request.Syl.HasValue && request.Syl == 1, c => c._SYL == "是") + .AndIF(request._211.HasValue && request._211 == 1, c => c._211 == "是") + .AndIF(request._985.HasValue && request._985 == 1, c => c._985 == "是") + .AndIF(!string.IsNullOrWhiteSpace(request.Ownership), c => c.Ownership == request.Ownership) + .AndIF(!string.IsNullOrWhiteSpace(request.Nature), c => c.Nature == request.Nature) + .AndIF(query.data.Any(), c => SqlFunc.ContainsArray(majorarry, c.Major)) + .AndIF(query.data.Any(), c => SqlFunc.ContainsArray(universityarry, c.UniversityName)) + //.AndIF(request. > 0, c => SqlFunc.Between(c.LowScore, request.Score, request.Score)) 位次区间 + .ToExpression(); + var list = (await _dal.Query(expression2)).Select(c => new D_PlanMajorDesc() + { + Major = c.Major, + MajorCode = c.MajorCode, + UniversityName = c.UniversityName, + Years = c.Years, + LowScore = c.LowScore, + LowScoreRank = c.LowScoreRank, + PlanCount = c.PlanCount, + AcademicYear = c.Years.ToString() + + }).ToList(); + var responselist = query.data.Select(c => new OneSubmitGoResponse() + { + AreaName = c.AreaName, + fee = c.Free, + Major = c.Major, + MajorGroup = c.MajorGroup, + MajorRemark = c.Remark, + planCount = c.PlanCount, + Rank = c.Rank, + _985 = c._985, + _211 = c._211, + _SYL = c._SYL, + UniversityId = c.UId, + UniversityName = c.UniversityName, + SubjectClam = c.SelectSubject, + Type = "冲",//还缺冲稳保 + PlanId = c.Id, + UniversityCode = c.EnrollmentCode, + MajorCode = c.MajorCode, + PlanItems = list.Where(e => e.UniversityName.Equals(c.UniversityName) && e.Major.Equals(c.Major) && e.MajorCode.Equals(c.MajorCode)).Select(s => new PlanItem() + { + PlanCount = s.PlanCount, + RankLine = s.LowScoreRank, + Scoreline = s.LowScore, + Year = s.AcademicYear + + }).OrderByDescending(k => k.Year).ToList() + }).ToList(); + return new PageModel() + { + data = responselist, + dataCount = query.dataCount, + page = query.page, + pageCount = query.pageCount, + PageSize = query.PageSize + }; + } + + + + } } \ No newline at end of file