增加导入各省份一分一段表

develop
old易 2024-05-13 17:46:25 +08:00
parent c60205ca00
commit 700d1e81c3
2 changed files with 56 additions and 0 deletions

View File

@ -6,6 +6,10 @@ using Microsoft.AspNetCore.Mvc;
using System;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using New_College.Common;
using System.IO;
using System.Linq;
namespace New_College.Api.Controllers
{
@ -72,6 +76,8 @@ namespace New_College.Api.Controllers
}
}
}

View File

@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using New_College.Common;
using New_College.Common.Helper;
using System.Security.Cryptography.Xml;
namespace New_College.Api.Controllers
{
@ -50,6 +51,55 @@ namespace New_College.Api.Controllers
/// <summary>
/// 导入各个省份一分一段表数据
/// </summary>
/// <param name="file"></param>
/// <returns></returns>
[HttpPost]
public async Task<MessageModel<bool>> ImportScoreLine(IFormFile file)
{
try
{
var list = ExcelProUtil<ScoreLineRepDto>.InputExcel(file);
var modelist = new List<D_ScoreLine>();
list.ForEach(a =>
{
modelist.Add(new D_ScoreLine()
{
Count = a.Count,
CreateTime = DateTime.Now,
IsDelete = false,
ModifyTime = DateTime.Now,
OrderSort = 0,
Province = a.Province,
Score = a.Score,
SumCount = a.SumCountStart,
Type = a.Type,
Years = a.Years
});
});
bool status = await id_coreLineServices.Add(modelist) > 0;
return new MessageModel<bool>()
{
response = status,
success = true
};
}
catch (Exception ex)
{
return new MessageModel<bool>()
{
success = false,
response = false,
msg = ex.Message.ToString()
};
}
}
/// <summary>
/// 导入专业最低录取位次表=同步更新专业数据与学校专业分数线(--高考时可通用此功能)
/// </summary>