feat:增加学科代码转换

develop
old易 2023-12-11 13:43:51 +08:00
parent 3f7aec848e
commit 5014bf1941
4 changed files with 126 additions and 7 deletions

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using New_College.Common;
using New_College.Common.Helper;
using New_College.IServices;
using System.Threading.Tasks;
@ -32,6 +33,19 @@ namespace New_College.Controllers
return Ok();
}
/// <summary>
///
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
//[HttpGet("GetCode")]
//public IActionResult GetCode([FromQuery] string code)
//{
// var str = UniversityCodeConvertRules.UniversityCodeConvertRulesMap(code);
// return Ok(str);
//}
/// <summary>
///
/// </summary>
@ -42,7 +56,7 @@ namespace New_College.Controllers
// return t_EnrollmentPlane.Import();
// return t_EnrollmentPlane.Importuniverbaseinfo();
// return t_EnrollmentPlane.universitydetailupdate();
// return t_EnrollmentPlane.universitydetailupdate();
//return t_EnrollmentPlane.tradeupadte();
@ -50,9 +64,9 @@ namespace New_College.Controllers
return d_LongIdMapServices.Import();
return d_LongIdMapServices.Import();
}
}

View File

@ -0,0 +1,82 @@
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace New_College.Common
{
/// <summary>
/// 院校招生代码转换
/// </summary>
public static class UniversityCodeConvertRules
{
/// <summary>
/// 山东省 部标代码前两位数字转换为字母10—>A11—>B12—>C13—>D14—>E15 —> T,16—>F18—>G19—>H50—>K51—>M81—>N91—>P
/// </summary>
/// <param name="code">院校招生代码</param>
/// <returns></returns>
public static string UniversityCodeConvertRulesMap(string code)
{
if (string.IsNullOrEmpty(code))
{
return code;
}
int strleft = int.Parse(code.Substring(0, 2));
string strright = code.Substring(2, code.Length-2);
string codestr = string.Empty;
switch (strleft)
{
case 10:
codestr = "A";
break;
case 11:
codestr = "B";
break;
case 12:
codestr = "C";
break;
case 13:
codestr = "D";
break;
case 14:
codestr = "E";
break;
case 15:
codestr = "T";
break;
case 16:
codestr = "F";
break;
case 18:
codestr = "G";
break;
case 19:
codestr = "H";
break;
case 50:
codestr = "K";
break;
case 51:
codestr = "M";
break;
case 81:
codestr = "N";
break;
case 91:
codestr = "P";
break;
default:
codestr = strleft.ToString();
break;
}
return codestr + strright;
}
}
}

View File

@ -157,6 +157,7 @@ namespace New_College.Services
Name = c.Name,
Nature = c.Nature,
AscriptionName = c.AscriptionName,
UniversityCode = c.UniversityCode,
AreaName = c.Area_Name,
AcademicianCount = c.Academician_Count,
Address = c.Address,
@ -381,7 +382,7 @@ namespace New_College.Services
QJJH = university.QJJH == 1 ? true : false,
UniversityType = university.Type,
SubjectLevel = university.Subject_Level,
BuildDate=university.Build_Date,
BuildDate = university.Build_Date,
Imglist = imgs,
DoctorateCount = university.Doctorate_Count,
MasterCount = university.Master_Count,
@ -1697,7 +1698,7 @@ namespace New_College.Services
/// <returns></returns>
public async Task<bool> Import()
{
// var universitylist = await d_UniversityRepository.Query();
// var universitylist = await d_UniversityRepository.Query();
// var plist = await this._PlanMajorDescRepository.Query(c => c.Location == "山东省" && c.Years == 2021 && c.PlanCount > 0);
//universitylist.ForEach(async u =>
//{
@ -1855,6 +1856,28 @@ namespace New_College.Services
// });
//}
#endregion
#region *********************院校代码更新******************************
//var universitylist = await d_UniversityRepository.Query();
//var plist = await this._PlanMajorDescRepository.Query(c => c.Location == "山东省" && c.Years == 2021 && c.PlanCount > 0);
//universitylist.ForEach(async u =>
//{
// plist.ForEach(async cc =>
// {
// if (cc.UId == u.Id&&string.IsNullOrWhiteSpace(cc.EnrollmentCode))
// {
// cc.EnrollmentCode = u.UniversityCode;
// cc.ModifyTime = DateTime.Now;
// await this._PlanMajorDescRepository.Update(cc);
// }
// });
//});
#endregion

View File

@ -106,7 +106,7 @@ namespace New_College.Services
_SYL = c._SYL,
UniversityId = c.UId,
UniversityName = c.UniversityName,
UniversityCode = c.RecruitCode.ToString(),
UniversityCode = UniversityCodeConvertRules.UniversityCodeConvertRulesMap(c.RecruitCode.ToString()),
LowScoreRank = c.LowScoreRank,
Ownership = c.Ownership,
//_fscore = c.LowScore,
@ -260,7 +260,7 @@ namespace New_College.Services
Type = MajorPlanScoreTool.GetPlanScore(c.LowScore, request.Score),//还缺冲稳保
Percentage = MajorPlanScoreTool.GetPlanPercentage(c.LowScore, request.Score),
PlanId = c.Id,
UniversityCode = c.EnrollmentCode,
UniversityCode =UniversityCodeConvertRules.UniversityCodeConvertRulesMap(c.EnrollmentCode),
MajorCode = c.MajorCode,
LowScoreRank = c.LowScoreRank,
PlanItems = list.Where(e => e.UId == c.UId && e.Major.Equals(c.Major)).Select(s => new PlanItem()