1569 lines
73 KiB
C#
1569 lines
73 KiB
C#
|
||
using New_College.IServices;
|
||
using New_College.Model.Models;
|
||
using New_College.Services.BASE;
|
||
using New_College.IRepository.Base;
|
||
using New_College.IRepository;
|
||
using System.Threading.Tasks;
|
||
using New_College.Common.Excel;
|
||
using System.Data;
|
||
using System;
|
||
using System.Linq;
|
||
using System.Collections.Generic;
|
||
using New_College.Model.ViewModels;
|
||
using LinqKit;
|
||
using New_College.Model;
|
||
using New_College.Common.Helper;
|
||
using New_College.Common;
|
||
using New_College.Common.HttpRestSharp;
|
||
using System.Text;
|
||
|
||
|
||
namespace New_College.Services
|
||
{
|
||
public class D_LongIdMapServices : BaseServices<D_LongIdMap>, ID_LongIdMapServices
|
||
{
|
||
private readonly IBaseRepository<D_LongIdMap> _dal;
|
||
private readonly ID_MajorCategoryRepository d_MajorCategoryRepository;
|
||
private readonly ID_MajorClassRepository d_MajorClassRepository;
|
||
private readonly ID_MajorRepository d_MajorRepository;
|
||
private readonly ID_OccupationCategoryRepository d_OccupationCategoryRepository;
|
||
private readonly ID_OccupationRepository d_OccupationRepository;
|
||
private readonly ID_OccMapTagRepository d_OccMapTagRepository;
|
||
private readonly ID_MajorMapOccouptionRepository d_MajorMapOccouptionRepository;
|
||
private readonly ID_MajorMapTagRepository d_MajorMapTagRepository;
|
||
private readonly ID_MajorObtainRepository d_MajorObtainRepository;
|
||
private readonly ID_UniversityRepository d_UniversityRepository;
|
||
private readonly ID_UniversityimgRepository d_UniversityimgRepository;
|
||
private readonly ID_UniversityRankRepository d_UniversityRankRepository;
|
||
private readonly ID_MajorMapUniversityRepository d_MajorMapUniversityRepository;
|
||
private readonly ID_MajorInformationRepository d_MajorInformationRepository;
|
||
private readonly ID_UniversityCollectionRepository d_UniversityCollectionRepository;
|
||
private readonly IT_EnrollmentPlanedescRepository t_EnrollmentPlanedescRepository;
|
||
private readonly IT_EnrollmentBatchRepository t_EnrollmentBatchRepository;
|
||
private readonly ID_GraduateFlowRepository d_GraduateFlowRepository;
|
||
private readonly IT_EnrollmentPlaneRepository t_EnrollmentPlaneRepository;
|
||
|
||
public D_LongIdMapServices(IBaseRepository<D_LongIdMap> dal
|
||
, ID_MajorCategoryRepository ID_MajorCategoryRepository
|
||
, ID_MajorClassRepository ID_MajorClassRepository
|
||
, ID_MajorRepository ID_MajorRepository
|
||
, ID_OccupationCategoryRepository ID_OccupationCategoryRepository
|
||
, ID_OccupationRepository ID_OccupationRepository
|
||
, ID_OccMapTagRepository ID_OccMapTagRepository
|
||
, ID_MajorMapOccouptionRepository ID_MajorMapOccouptionRepository
|
||
, ID_MajorMapTagRepository ID_MajorMapTagRepository
|
||
, ID_MajorObtainRepository ID_MajorObtainRepository
|
||
, ID_UniversityRepository ID_UniversityRepository
|
||
, ID_UniversityimgRepository ID_UniversityimgRepository
|
||
, ID_UniversityRankRepository ID_UniversityRankRepository
|
||
, ID_MajorMapUniversityRepository ID_MajorMapUniversityRepository
|
||
, ID_MajorInformationRepository ID_MajorInformationRepository
|
||
, ID_UniversityCollectionRepository ID_UniversityCollectionRepository
|
||
, IT_EnrollmentPlanedescRepository IT_EnrollmentPlanedescRepository
|
||
, IT_EnrollmentBatchRepository IT_EnrollmentBatchRepository
|
||
, ID_GraduateFlowRepository ID_GraduateFlowRepository
|
||
, IT_EnrollmentPlaneRepository IT_EnrollmentPlaneRepository)
|
||
{
|
||
this._dal = dal;
|
||
d_MajorCategoryRepository = ID_MajorCategoryRepository;
|
||
d_MajorClassRepository = ID_MajorClassRepository;
|
||
d_MajorRepository = ID_MajorRepository;
|
||
d_OccupationCategoryRepository = ID_OccupationCategoryRepository;
|
||
d_OccupationRepository = ID_OccupationRepository;
|
||
d_OccMapTagRepository = ID_OccMapTagRepository;
|
||
d_MajorMapOccouptionRepository = ID_MajorMapOccouptionRepository;
|
||
d_MajorMapTagRepository = ID_MajorMapTagRepository;
|
||
d_MajorObtainRepository = ID_MajorObtainRepository;
|
||
d_UniversityRepository = ID_UniversityRepository;
|
||
d_UniversityimgRepository = ID_UniversityimgRepository;
|
||
d_UniversityRankRepository = ID_UniversityRankRepository;
|
||
d_MajorMapUniversityRepository = ID_MajorMapUniversityRepository;
|
||
d_MajorInformationRepository = ID_MajorInformationRepository;
|
||
d_UniversityCollectionRepository = ID_UniversityCollectionRepository;
|
||
t_EnrollmentPlanedescRepository = IT_EnrollmentPlanedescRepository;
|
||
t_EnrollmentBatchRepository = IT_EnrollmentBatchRepository;
|
||
d_GraduateFlowRepository = ID_GraduateFlowRepository;
|
||
t_EnrollmentPlaneRepository = IT_EnrollmentPlaneRepository;
|
||
base.BaseDal = dal;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取院校库 添加个人收藏和对比 的验证
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<PageModel<UniversityResult>> GetUniversitys(UniversityQuery query)
|
||
{
|
||
var wheres = PredicateBuilder.New<D_University>();
|
||
wheres = wheres.And(x => x.IsDelete == false);
|
||
if (!string.IsNullOrEmpty(query.AreaName) && query.AreaName != "全国")
|
||
wheres = wheres.And(x => x.Area_Name.Contains(query.AreaName));
|
||
if (query.SubjectLevel > 0)
|
||
wheres = wheres.And(x => x.Subject_Level == query.SubjectLevel);
|
||
if (query.Type >= 0)
|
||
wheres = wheres.And(x => x.Type == query.Type);
|
||
if (query.Nhef >= 0)
|
||
wheres = wheres.And(x => x.Nhef == query.Nhef);
|
||
if (query.Sff >= 0)
|
||
wheres = wheres.And(x => x.Sff == query.Sff);
|
||
if (query.Syl >= 0)
|
||
wheres = wheres.And(x => x.Syl == query.Syl);
|
||
if (!string.IsNullOrWhiteSpace(query.Name))
|
||
wheres = wheres.And(u => u.Name.Contains(query.Name));
|
||
if (query.Nature > 0)
|
||
wheres = wheres.And(x => x.Nature == query.Nature);
|
||
var info = await d_UniversityRepository.QueryPage(wheres, query.PageIndex, query.PageSize, "Rank Asc");
|
||
if (info.data.Count <= 0)
|
||
return new PageModel<UniversityResult>() { };
|
||
|
||
var collectionuniversity = await d_UniversityCollectionRepository.Query(x => x.CustomerId == query.CustomerId && x.IsDelete == false);
|
||
List<UniversityResult> list = new List<UniversityResult>() { };
|
||
info.data = info.data.OrderBy(s => s.Rank).ToList();
|
||
foreach (var c in info.data)
|
||
{
|
||
string attribute = "";
|
||
if (c.Nhef == 1)
|
||
attribute += "985";
|
||
if (c.Sff == 1)
|
||
attribute += "211";
|
||
if (c.Syl == 1)
|
||
attribute += "双一流";
|
||
list.Add(new UniversityResult
|
||
{
|
||
Id = c.Id,
|
||
Name = c.Name,
|
||
Nature = c.Nature,
|
||
AscriptionName = c.AscriptionName,
|
||
AreaName = c.Area_Name,
|
||
Logo = c.Logo,
|
||
Syl = c.Syl == 1,
|
||
Nhef = c.Nhef == 1,
|
||
Sff = c.Sff == 1,
|
||
UniversityType = c.Type,
|
||
IsNearScore = false,
|
||
SubjectLevel = c.Subject_Level,
|
||
Rank = c.Rank,
|
||
IsCollection = collectionuniversity.Count(x => x.Type == 1 && x.UniversityId == c.Id) > 0,
|
||
IsContrast = collectionuniversity.Count(x => x.Type == 2 && x.UniversityId == c.Id) > 0,
|
||
});
|
||
}
|
||
return new PageModel<UniversityResult>()
|
||
{
|
||
data = list,
|
||
dataCount = info.dataCount,
|
||
page = info.page,
|
||
pageCount = info.pageCount,
|
||
PageSize = info.PageSize
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// 专业库 一级二级列表
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<List<uniMajorInfoResult>> uniGetMajorInfo(MajorcategoryQuery query)
|
||
{
|
||
var majorcategories = (await d_MajorCategoryRepository.Query(x => x.Type == query.SchoolLevel && x.IsDelete == false)).Select(x => new uniMajorSelect() { Id = x.Id, Name = x.Name }); ;
|
||
var majorclasses = (await d_MajorClassRepository.Query(x => x.IsDelete == false)).Select(x => new uniMajorClassSelect() { Id = x.Id, Name = x.Name, TradeId = x.TradeId });
|
||
var majorinfo = (await d_MajorRepository.Query(x => x.IsDelete == false)).Select(s => new uniMajorSelect() { Id = s.CategoryClass_Id, Name = s.Name }).ToList();
|
||
List<uniMajorInfoResult> list = new List<uniMajorInfoResult>() { };
|
||
foreach (var item in majorcategories)
|
||
{
|
||
List<uniMajorSecond> scond = new List<uniMajorSecond>() { };
|
||
var nowmajoclass = majorclasses.Where(x => x.TradeId == item.Id).ToList();
|
||
scond = nowmajoclass.Select(s => new uniMajorSecond()
|
||
{
|
||
MajorName = s.Name,
|
||
SecondId = s.Id,
|
||
MajorNum = majorinfo.Count(x => x.Name != s.Name && x.Id == s.Id),
|
||
}).ToList();
|
||
|
||
if (scond.Count() == 0)
|
||
continue;
|
||
list.Add(new uniMajorInfoResult()
|
||
{
|
||
FirstName = item.Name,
|
||
SecondInfo = scond
|
||
});
|
||
}
|
||
return list;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取推荐职业
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public async Task<List<OccupationResult>> GetRecommendOccupation()
|
||
{
|
||
var info = await d_OccupationRepository.Query(x => x.Recommend > 0 && x.IsDelete == false);
|
||
if (info.Count <= 0)
|
||
return new List<OccupationResult>() { };
|
||
return info.Select(x => new OccupationResult() { Id = x.Id, Name = x.OccupationName }).ToList();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 职业库 一级二级列表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public async Task<List<uniMajorInfoResult>> uniGetOccupationInfo()
|
||
{
|
||
List<uniMajorInfoResult> list = new List<uniMajorInfoResult>() { };
|
||
var occupationCategoryList = (await d_OccupationCategoryRepository.Query(x => x.IsDelete == false)).Select(x => new uniOccSelect() { Id = x.Id, Level = x.Level, Name = x.Name, ParentId = x.ParentId, OccupationName = x.OccupationName });
|
||
var occupations = (await d_OccupationRepository.Query(x => x.IsDelete == false)).Select(s => s.CategoryId).ToList();
|
||
var nowoccupationCategoryList = occupationCategoryList.Where(x => x.Level == 0).ToList();
|
||
foreach (var item in nowoccupationCategoryList)
|
||
{
|
||
List<uniMajorSecond> scond = new List<uniMajorSecond>() { };
|
||
var nowmajoclass = occupationCategoryList.Where(x => x.ParentId == item.Id).ToList();
|
||
scond = nowmajoclass.Select(s => new uniMajorSecond()
|
||
{
|
||
MajorName = s.OccupationName,
|
||
MajorNum = occupations.Count(e => e == s.Id),
|
||
SecondId = s.Id
|
||
|
||
}).ToList();
|
||
list.Add(new uniMajorInfoResult()
|
||
{
|
||
FirstName = item.Name,
|
||
SecondInfo = scond
|
||
});
|
||
}
|
||
return list;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 院校详情
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<UniversityDetailResponse> GetUniversityDetails(IdQuery query)
|
||
{
|
||
if (query.Id <= 0)
|
||
return new UniversityDetailResponse() { Status = -1 };
|
||
var university = await d_UniversityRepository.QueryById(query.Id);
|
||
if (university == null)
|
||
return new UniversityDetailResponse() { Status = -2 };
|
||
var result = new UniversityDetailResponse();
|
||
string imgs = "";
|
||
var imglist = (await d_UniversityimgRepository.Query(x => x.UniversityId == query.Id && x.IsDelete == false)).FirstOrDefault();
|
||
if (imglist != null)
|
||
{
|
||
imgs = imglist.ImgList;
|
||
}
|
||
result.universityResult = new UniversityResult
|
||
{
|
||
Id = university.Id,
|
||
Name = university.Name,
|
||
Nature = university.Nature,
|
||
AscriptionName = university.AscriptionName,
|
||
Rank = university.Rank,
|
||
AreaName = university.Area_Name,
|
||
Logo = university.Logo,
|
||
Syl = university.Syl == 1 ? true : false,
|
||
Nhef = university.Nhef == 1 ? true : false,
|
||
Sff = university.Sff == 1 ? true : false,
|
||
UniversityType = university.Type,
|
||
SubjectLevel = university.Subject_Level,
|
||
Imglist = imgs,
|
||
DoctorateCount = university.Doctorate_Count,
|
||
MasterCount = university.Master_Count,
|
||
AcademicianCount = university.Academician_Count,
|
||
// IsCollection = false,
|
||
Description = ClearHtmlHelper.SHTML(university.Description),
|
||
LongSchoolId = (await _dal.Query(x => x.IsDelete == false && x.table == "D_University" && x.newid == university.Id)).Select(x => x.longid).FirstOrDefault()
|
||
};
|
||
var mapuniversity = await d_MajorMapUniversityRepository.Query(x => x.Universityid == query.Id && x.IsDelete == false);
|
||
var majorids = mapuniversity.Select(x => x.MajorId).ToList();
|
||
var majorlist = await d_MajorRepository.Query(x => majorids.Contains(x.Id) && x.IsDelete == false);
|
||
var majors = new List<RelatedMajorModel>();
|
||
var spmajors = new List<RelatedMajorModel>();
|
||
int m = 0;
|
||
int sp = 0;
|
||
mapuniversity.ForEach(o =>
|
||
{
|
||
if (majorlist.Where(s => s.Id == o.MajorId).Any())
|
||
{
|
||
|
||
if (o.sp == 0 && m <= 5)
|
||
{
|
||
m++;
|
||
majors.Add(new RelatedMajorModel()
|
||
{
|
||
majorName = majorlist.Single(s => s.Id == o.MajorId).MajorName,
|
||
mid = o.MajorId
|
||
});
|
||
}
|
||
else if (o.sp == 1 && sp <= 5)
|
||
{
|
||
spmajors.Add(new RelatedMajorModel()
|
||
{
|
||
majorName = majorlist.Single(s => s.Id == o.MajorId).MajorName,
|
||
mid = o.MajorId
|
||
});
|
||
}
|
||
}
|
||
});
|
||
var graduateFlowinfo = (await d_GraduateFlowRepository.Query(x => x.UniversityId == query.Id && x.IsDelete == false)).FirstOrDefault();
|
||
if (graduateFlowinfo != null)
|
||
{
|
||
result.graduateModels = new graduateModel()
|
||
{
|
||
provinces = graduateFlowinfo.Provinces,
|
||
attrs = graduateFlowinfo.Attrs
|
||
};
|
||
}
|
||
|
||
result.relatedMajors = majors;
|
||
result.relatespMajors = spmajors;
|
||
result.Status = 1;
|
||
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取专业介绍
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<MajorDetail> GetMajorDetail(MajorQuery query)
|
||
{
|
||
var info = (await d_MajorInformationRepository.Query(x => x.MajorId == query.MajorId && x.IsDelete == false)).FirstOrDefault();
|
||
if (info == null)
|
||
return new MajorDetail() { };//学校专业不匹配 获取专业概况信息为空
|
||
return new MajorDetail()
|
||
{
|
||
id = info.Id,
|
||
abstracts = info.Majordescription.ClearHtml(),
|
||
maincourse = info.Majorcourse.ClearHtml(),
|
||
studydirection = info.Postgraduate.ClearHtml(),
|
||
workdirection = info.Majorintent.ClearHtml(),
|
||
Name = info.Name
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// 相关院校
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<PageModel<UniversityResult>> GetRelevantSchool(MajorSchoolQuery query)
|
||
{
|
||
var majorinfo = await d_MajorMapUniversityRepository.Query(x => x.MajorId == query.MajorId && x.IsDelete == false);
|
||
if (majorinfo.Count <= 0)
|
||
return new PageModel<UniversityResult>() { };
|
||
var universityids = majorinfo.Select(x => x.Universityid).ToList();
|
||
var wheres = PredicateBuilder.New<D_University>();
|
||
wheres = wheres.And(x => x.IsDelete == false && universityids.Contains(x.Id));
|
||
if (!string.IsNullOrEmpty(query.AreaName) && query.AreaName != "全国")
|
||
wheres = wheres.And(x => x.Area_Name.Contains(query.AreaName));
|
||
if (query.SubjectLevel > 0)
|
||
wheres = wheres.And(x => x.Subject_Level == query.SubjectLevel);
|
||
if (query.Type >= 0)
|
||
wheres = wheres.And(x => x.Type == query.Type);
|
||
if (query.Nhef >= 0)
|
||
wheres = wheres.And(x => x.Nhef == query.Nhef);
|
||
if (query.Sff >= 0)
|
||
wheres = wheres.And(x => x.Sff == query.Sff);
|
||
if (query.Syl >= 0)
|
||
wheres = wheres.And(x => x.Syl == query.Syl);
|
||
wheres = wheres.And(x => x.Nature == query.Nature);
|
||
|
||
var info = await d_UniversityRepository.QueryPage(wheres, query.PageIndex, query.PageSize, "Rank Asc");
|
||
if (info.data.Count() <= 0)
|
||
return new PageModel<UniversityResult>() { };
|
||
List<UniversityResult> list = new List<UniversityResult>() { };
|
||
info.data = info.data.OrderBy(s => s.Rank).ToList();
|
||
foreach (var t in info.data)
|
||
{
|
||
//string typeStr = GetUniversityTypeName(t.Type);
|
||
//string ascription = GetAscriptionName(t.Ascription);
|
||
//string syl = t.Syl == 1 ? "双一流" : "";
|
||
//string nhefSff = GetNhefSff(t);
|
||
//string nature = t.Nature == 1 ? "公立" : "私立";
|
||
//string naturedetail = string.Format("{0}{1}{2}", typeStr, ascription, syl);
|
||
list.Add(new UniversityResult()
|
||
{
|
||
Id = t.Id,
|
||
Logo = t.Logo,
|
||
Name = t.Name,
|
||
AreaName = t.Area_Name,
|
||
Nature = t.Nature,
|
||
//naturedetail = naturedetail,
|
||
Sff = t.Sff == 1,
|
||
Syl = t.Syl == 1,
|
||
Nhef = t.Nhef == 1,
|
||
UniversityType = t.Type,
|
||
SubjectLevel = t.Subject_Level,
|
||
Rank = t.Rank,
|
||
});
|
||
}
|
||
return new PageModel<UniversityResult>()
|
||
{
|
||
data = list,
|
||
dataCount = info.dataCount,
|
||
page = info.page,
|
||
pageCount = info.pageCount,
|
||
PageSize = info.PageSize
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取专业就业前景
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<CareerProspects> GetCareerProspects(MajorCareerQuery query)
|
||
{
|
||
var info = (await d_MajorObtainRepository.Query(x => x.MajorId == query.MajorId)).FirstOrDefault();
|
||
if (info == null)
|
||
return new CareerProspects() { };
|
||
CareerProspects result = new CareerProspects() { };
|
||
List<distribution> TradeDistribute = new List<distribution>() { };
|
||
var array = JsonHelper.ParseJson<List<string>>(info.ObtainIndustryDis);
|
||
var arraynum = JsonHelper.ParseJson<List<int>>(info.ObtainIndustryDisProportion.Replace("%", ""));
|
||
for (int i = 0; i < array.Count; i++)
|
||
{
|
||
TradeDistribute.Add(new distribution() { name = array[i], data = arraynum[i] });
|
||
}
|
||
//就业地区
|
||
List<distribution> RegionDistribute = new List<distribution>() { };
|
||
var arrayarea = JsonHelper.ParseJson<List<string>>(info.ObtainRegionalDis);
|
||
var arrayareanum = JsonHelper.ParseJson<List<int>>(info.ObtainRegionalDisProportion.Replace("%", ""));
|
||
for (int i = 0; i < arrayarea.Count; i++)
|
||
{
|
||
RegionDistribute.Add(new distribution() { name = arrayarea[i], data = arrayareanum[i] });
|
||
}
|
||
//工资情况
|
||
List<distribution> MoneyDistribute = new List<distribution>() { };
|
||
var arraymoney = JsonHelper.ParseJson<List<string>>(info.WageSituation);
|
||
var arraymoneynum = JsonHelper.ParseJson<List<int>>(info.WageProportion.Replace("%", ""));
|
||
for (int i = 0; i < arraymoney.Count; i++)
|
||
{
|
||
MoneyDistribute.Add(new distribution() { name = arraymoney[i], data = arraymoneynum[i] });
|
||
}
|
||
//工作年限工资 WorkingYear
|
||
WorkingYear WorkingYear = new WorkingYear() { };
|
||
WorkingYear.WorkingYears = info.WorkingYears;
|
||
WorkingYear.WorkingYearsWage = info.WorkingYearsWage;
|
||
result.RegionDistribute = RegionDistribute;
|
||
result.TradeDistribute = TradeDistribute;
|
||
result.MoneyDistribute = MoneyDistribute;
|
||
result.WorkingYear = WorkingYear;
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取第三级
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<MessageModel<List<uniMajorInfo>>> uniGetMajorThree(ManageMajorQuery query)
|
||
{
|
||
List<uniMajorInfo> info = new List<uniMajorInfo>() { };
|
||
if (!string.IsNullOrWhiteSpace(query.Tags))
|
||
{
|
||
if (query.Tags.Length != 3)
|
||
return new MessageModel<List<uniMajorInfo>>() { success = false, msg = "传入标签长度错误..." };
|
||
//转化标签
|
||
var tags = new List<string>() { };
|
||
string n = query.Tags;
|
||
string m = "";
|
||
tags.AddRange(zuhe(n));
|
||
for (int j = 2; j > -1; j--)
|
||
{
|
||
m = m + n[j];
|
||
}
|
||
tags.AddRange(zuhe(m));
|
||
var ids = (await d_MajorMapTagRepository.Query(x => x.Tag.Contains(tags[0]) || x.Tag.Contains(tags[1]) || x.Tag.Contains(tags[2]) || x.Tag.Contains(tags[3]) || x.Tag.Contains(tags[4]) || x.Tag.Contains(tags[5]))).Select(x => x.MajorId).ToList();
|
||
if (ids.Count <= 0)
|
||
return new MessageModel<List<uniMajorInfo>>() { success = false, msg = "标签对应专业为空" };
|
||
info = (await d_MajorRepository.Query(x => ids.Contains(x.Id) && x.IsDelete == false)).Select(x => new uniMajorInfo() { Id = x.Id, Name = x.MajorName }).ToList();
|
||
|
||
if (!string.IsNullOrWhiteSpace(query.SubjectClaim))
|
||
{
|
||
var planinfo = await t_EnrollmentPlaneRepository.Query(w => w.Years == query.Year && w.Area_Id == query.AreaId);
|
||
if (planinfo == null)
|
||
return new MessageModel<List<uniMajorInfo>>() { success = false, msg = "所选省份年份的招生计划,正在完善中..." };
|
||
var planid = planinfo.FirstOrDefault().Id;
|
||
var wheres = PredicateBuilder.New<T_EnrollmentPlanedesc>();
|
||
wheres.And(x => x.IsDelete == false && x.PlanId == planid && x.Scoreline <= query.Score && x.UniversityId > 0);
|
||
if (query.SubjectClaim.Contains(","))
|
||
{
|
||
var cc = query.SubjectClaim.Split(",");
|
||
if (cc.Length == 2)
|
||
{
|
||
var cc1 = cc[0];
|
||
var cc2 = cc[1];
|
||
wheres.And(x => (x.Subjectclaim.Contains("/") && x.Subjectclaim.Contains(cc1)) == true || (x.Subjectclaim.Contains(cc2) && x.Subjectclaim.Contains("/")) == true || (x.Subjectclaim.Contains(",") && x.Subjectclaim.Contains(query.SubjectClaim)) == true);
|
||
}
|
||
else if (cc.Length == 3)
|
||
{
|
||
var cc1 = cc[0];
|
||
var cc2 = cc[1];
|
||
var cc3 = cc[2];
|
||
wheres.And(x => (x.Subjectclaim.Contains("/") && x.Subjectclaim.Contains(cc1)) == true || (x.Subjectclaim.Contains(cc2) && x.Subjectclaim.Contains("/")) == true || (x.Subjectclaim.Contains(cc3) && x.Subjectclaim.Contains("/")) == true || (x.Subjectclaim.Contains(",") && x.Subjectclaim.Contains(query.SubjectClaim)) == true);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
wheres.And(x => x.Subjectclaim.Contains(query.SubjectClaim) && !x.Subjectclaim.Contains(","));
|
||
}
|
||
var descinfo = await t_EnrollmentPlanedescRepository.Query(wheres);
|
||
var newmajorlist = descinfo.Select(x => x.MajorName).Distinct().ToList();
|
||
info = info.Where(x => newmajorlist.Contains(x.Name)).ToList();
|
||
}
|
||
}
|
||
else if (query.universityId > 0)
|
||
{
|
||
var majormapids = (await d_MajorMapUniversityRepository.Query(x => x.IsDelete == false && x.Universityid == query.universityId && x.MajorId > 0)).Select(x => x.MajorId).ToList();
|
||
info = (await d_MajorRepository.Query(x => majormapids.Contains(x.Id) && x.IsDelete == false)).Select(x => new uniMajorInfo() { Id = x.Id, Name = x.MajorName }).ToList();
|
||
}
|
||
else
|
||
{
|
||
var majorclasses = (await d_MajorClassRepository.Query(x => x.IsDelete == false)).Select(x => new uniMajorClassSelect() { Id = x.Id, Name = x.Name, TradeId = x.TradeId });
|
||
var nowmajorname = majorclasses.Where(x => x.Id == query.categoryclassid).Select(x => x.Name)?.FirstOrDefault();
|
||
var newmajorinfo = await d_MajorRepository.Query(x => x.IsDelete == false && x.CategoryClass_Id == query.categoryclassid);
|
||
info = newmajorinfo.Where(x => x.Name != nowmajorname).Select(x => new uniMajorInfo() { Id = x.Id, Name = x.MajorName }).ToList();
|
||
}
|
||
return new MessageModel<List<uniMajorInfo>>()
|
||
{
|
||
success = true,
|
||
msg = "获取成功",
|
||
response = info
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据标签推荐专业
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<MessageModel<List<uniMajorInfo>>> GetMajorThreeByTag(MajorThreeByTagQuery query)
|
||
{
|
||
if (string.IsNullOrWhiteSpace(query.Tags))
|
||
return new MessageModel<List<uniMajorInfo>>() { success = false, msg = "传入标签为空,请先去测试..." };
|
||
if (query.Tags.Length != 3)
|
||
return new MessageModel<List<uniMajorInfo>>() { success = false, msg = "传入标签长度错误..." };
|
||
//转化标签
|
||
var tags = new List<string>() { };
|
||
string n = query.Tags;
|
||
string m = "";
|
||
tags.AddRange(zuhe(n));
|
||
for (int j = 2; j > -1; j--)
|
||
{
|
||
m = m + n[j];
|
||
}
|
||
tags.AddRange(zuhe(m));
|
||
var ids = (await d_MajorMapTagRepository.Query(x => x.Tag.Contains(tags[0]) || x.Tag.Contains(tags[1]) || x.Tag.Contains(tags[2]) || x.Tag.Contains(tags[3]) || x.Tag.Contains(tags[4]) || x.Tag.Contains(tags[5]))).Select(x => x.MajorId).ToList();
|
||
if (ids.Count <= 0)
|
||
return new MessageModel<List<uniMajorInfo>>() { success = false, msg = "标签对应专业为空" };
|
||
var info = (await d_MajorRepository.Query(x => ids.Contains(x.Id) && x.IsDelete == false)).Select(x => new uniMajorInfo() { Id = x.Id, Name = x.MajorName }).ToList();
|
||
|
||
if (!string.IsNullOrWhiteSpace(query.SubjectClaim))
|
||
{
|
||
var planinfo = await t_EnrollmentPlaneRepository.Query(w => w.Years == query.Year && w.Area_Id == query.AreaId);
|
||
if (planinfo == null)
|
||
return new MessageModel<List<uniMajorInfo>>() { success = false, msg = "所选省份年份的招生计划,正在完善中..." };
|
||
var planid = planinfo.FirstOrDefault().Id;
|
||
var wheres = PredicateBuilder.New<T_EnrollmentPlanedesc>();
|
||
wheres.And(x => x.IsDelete == false && x.PlanId == planid && x.Scoreline <= query.Score && x.UniversityId > 0);
|
||
if (query.SubjectClaim.Contains(","))
|
||
{
|
||
var cc = query.SubjectClaim.Split(",");
|
||
if (cc.Length == 2)
|
||
{
|
||
var cc1 = cc[0];
|
||
var cc2 = cc[1];
|
||
wheres.And(x => (x.Subjectclaim.Contains("/") && x.Subjectclaim.Contains(cc1)) == true || (x.Subjectclaim.Contains(cc2) && x.Subjectclaim.Contains("/")) == true || (x.Subjectclaim.Contains(",") && x.Subjectclaim.Contains(query.SubjectClaim)) == true);
|
||
}
|
||
else if (cc.Length == 3)
|
||
{
|
||
var cc1 = cc[0];
|
||
var cc2 = cc[1];
|
||
var cc3 = cc[2];
|
||
wheres.And(x => (x.Subjectclaim.Contains("/") && x.Subjectclaim.Contains(cc1)) == true || (x.Subjectclaim.Contains(cc2) && x.Subjectclaim.Contains("/")) == true || (x.Subjectclaim.Contains(cc3) && x.Subjectclaim.Contains("/")) == true || (x.Subjectclaim.Contains(",") && x.Subjectclaim.Contains(query.SubjectClaim)) == true);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
wheres.And(x => x.Subjectclaim.Contains(query.SubjectClaim) && !x.Subjectclaim.Contains(","));
|
||
}
|
||
var descinfo = await t_EnrollmentPlanedescRepository.Query(wheres);
|
||
var newmajorlist = descinfo.Select(x => x.MajorName).Distinct().ToList();
|
||
info = info.Where(x => newmajorlist.Contains(x.Name)).ToList();
|
||
}
|
||
return new MessageModel<List<uniMajorInfo>>()
|
||
{
|
||
success = true,
|
||
msg = "获取成功",
|
||
response = info
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// 院校相关专业专用
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<List<uniMajorInfoResult>> GetUniversityMajor(IdQuery query)
|
||
{
|
||
var majormapids = (await d_MajorMapUniversityRepository.Query(x => x.IsDelete == false && x.Universityid == query.Id && x.MajorId > 0)).Select(x => x.MajorId).ToList();
|
||
var majorclass = (await d_MajorRepository.Query(x => x.IsDelete == false && majormapids.Contains(x.Id)));
|
||
var majorclassids = majorclass.Select(x => x.CategoryClass_Id).ToList();
|
||
List<uniMajorInfoResult> list = new List<uniMajorInfoResult>() { };
|
||
var majorclassinfo = await d_MajorClassRepository.Query(x => majorclassids.Contains(x.Id));
|
||
foreach (var item in majorclassinfo)
|
||
{
|
||
List<uniMajorSecond> second = new List<uniMajorSecond>() { };
|
||
second = majorclass.Where(x => x.CategoryClass_Id == item.Id).Select(x => new uniMajorSecond()
|
||
{
|
||
SecondId = x.Id,
|
||
MajorName = x.Name,
|
||
}).ToList();
|
||
if (second.Count > 0)
|
||
list.Add(new uniMajorInfoResult()
|
||
{
|
||
FirstName = item.Name,
|
||
SecondInfo = second,
|
||
MajorNum = second.Count()
|
||
});
|
||
}
|
||
return list;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取职业第三级
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<MessageModel<List<IdNameResult>>> GetOccupationThree(IdQuery query)
|
||
{
|
||
StringBuilder stringBuilder = new StringBuilder() { };
|
||
stringBuilder.AppendFormat("SELECT Id,Name FROM `D_Occupation` where CategoryId={0} and IsDelete=0", query.Id);
|
||
var info = await d_OccupationRepository.QuerySql(stringBuilder.ToString());
|
||
if (info.Count <= 0)
|
||
return new MessageModel<List<IdNameResult>>() { success = false, msg = "数据为空" };
|
||
return new MessageModel<List<IdNameResult>>()
|
||
{
|
||
success = true,
|
||
msg = "获取成功",
|
||
response = info.Select(x => new IdNameResult()
|
||
{
|
||
Id = x.Id,
|
||
Name = x.Name
|
||
}).ToList()
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取职业详情-职业介绍
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public async Task<OccupationDetailResult> GetRecommendIntroduce(IdQuery query)
|
||
{
|
||
if (query.Id <= 0)
|
||
return new OccupationDetailResult() { Status = -1 };
|
||
var occupation = await d_OccupationRepository.QueryById(query.Id);
|
||
return new OccupationDetailResult()
|
||
{
|
||
Status = 1,
|
||
OccupationIntraduce = occupation.OccupationIntraduce.ClearHtml(),
|
||
Id = occupation.Id.ToString()
|
||
};
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查学校省份的 年份批次
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<BatchYear> GetBatchYearBySchoolId(PlanYearQuery query)
|
||
{
|
||
BatchYear result = new BatchYear() { };
|
||
var info = await t_EnrollmentPlanedescRepository.Query(x => x.UniversityId == query.UnviersityId);
|
||
if (info.Count <= 0)
|
||
return new BatchYear() { };
|
||
var batchids = info.Select(x => x.BatchtypeId).Distinct().ToList();
|
||
var batchinfo = await t_EnrollmentBatchRepository.Query(x => batchids.Contains(x.Id) && x.AreaName == query.AreaName);
|
||
var batchselect = batchinfo.Select(x => x.Batch_name).Distinct().ToList();
|
||
var yearselect = batchinfo.Select(x => x.Year).Distinct().OrderByDescending(x => x).ToList();
|
||
var typeselect = batchinfo.Select(x => x.Type).Distinct().ToList();
|
||
result.Batch = batchselect;
|
||
result.Year = yearselect;
|
||
result.Type = typeselect;
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取招生计划 院校详情
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<List<NewPlanDescList>> GetPlanBySchollId(PlanQuery query)
|
||
{
|
||
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)
|
||
return new List<NewPlanDescList>() { };
|
||
var batchid = check.Select(x => x.Id)?.FirstOrDefault();
|
||
var info = await t_EnrollmentPlanedescRepository.Query(x => x.UniversityId == query.UnviersityId && x.BatchtypeId == batchid);
|
||
List<NewPlanDescList> list = new List<NewPlanDescList>() { };
|
||
foreach (var item in info)
|
||
{
|
||
list.Add(new NewPlanDescList()
|
||
{
|
||
Name = item.MajorName,
|
||
Money = string.IsNullOrWhiteSpace(item.Tuitionfee) || item.Tuitionfee == "0" || item.Tuitionfee == "待定" ? "--" : item.Tuitionfee,
|
||
PlanNum = item.Plancount,
|
||
Scoreline = item.Scoreline == 0 || string.IsNullOrWhiteSpace(item.Scoreline.ToString()) ? "--" : item.Scoreline.ToString()
|
||
});
|
||
}
|
||
return list;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取院校排名
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<List<UniversityRankList>> GetUniversityRank(UniversityRankQuery query)
|
||
{
|
||
var info = await d_UniversityRankRepository.Query(x => x.IsDelete == false && x.UniversityType == query.Type);
|
||
if (info.Count <= 0)
|
||
return new List<UniversityRankList>() { };
|
||
List<UniversityRankList> list = new List<UniversityRankList>() { };
|
||
return info.OrderBy(x => x.OrderSort).Select(x => new UniversityRankList() { Name = x.UniversityName, Sort = x.Rank }).ToList();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 专业搜索
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<MessageModel<PageModel<IdNameResult>>> uniGetSearchMajor(NameBaseQuery query)
|
||
{
|
||
var majorcategories = (await d_MajorCategoryRepository.Query(x => x.Type == query.Type && x.IsDelete == false)).Select(x => x.Id); ;
|
||
var majorclasses = (await d_MajorClassRepository.Query(x => x.IsDelete == false && majorcategories.Contains(x.TradeId))).Select(x => x.Id).ToList();
|
||
|
||
var info = await d_MajorRepository.QueryPage(x => majorclasses.Contains(x.CategoryClass_Id) && x.IsDelete == false && x.Name.Contains(query.Name), query.PageIndex, query.PageSize);
|
||
if (info.data.Count <= 0)
|
||
return new MessageModel<PageModel<IdNameResult>>() { success = false, msg = "获取失败,数据为空" };
|
||
List<IdNameResult> list = new List<IdNameResult>() { };
|
||
foreach (var item in info.data)
|
||
{
|
||
list.Add(new IdNameResult()
|
||
{
|
||
Id = item.Id,
|
||
Name = item.Name
|
||
});
|
||
}
|
||
return new MessageModel<PageModel<IdNameResult>>()
|
||
{
|
||
success = true,
|
||
msg = "获取成功",
|
||
response = new PageModel<IdNameResult>()
|
||
{
|
||
data = list,
|
||
dataCount = info.dataCount,
|
||
page = info.page,
|
||
pageCount = info.pageCount,
|
||
PageSize = info.PageSize
|
||
}
|
||
};
|
||
}
|
||
|
||
|
||
#region 数据处理
|
||
/// <summary>
|
||
/// 组合
|
||
/// </summary>
|
||
/// <param name="ssel"></param>
|
||
public List<string> zuhe(string ssel)
|
||
{
|
||
var list = new List<string>() { };
|
||
string m1 = "";
|
||
for (int i = 0; i < ssel.Length; i++)
|
||
{
|
||
m1 = ssel + ssel.Substring(i, 1);
|
||
list.Add(m1.Remove(i, 1));
|
||
}
|
||
return list;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取学校类型
|
||
/// </summary>
|
||
/// <param name="type"></param>
|
||
/// <returns></returns>
|
||
private string GetUniversityTypeName(int? type)
|
||
{
|
||
if (!Enum.IsDefined(typeof(EnumUniversityType), type))
|
||
return "";
|
||
//数字转为枚举
|
||
EnumUniversityType enumUniversityType = (EnumUniversityType)Enum.ToObject(typeof(EnumUniversityType), type);
|
||
return CommonTools.GetDescription(enumUniversityType);
|
||
}
|
||
/// <summary>
|
||
/// 获取学校归属
|
||
/// </summary>
|
||
/// <param name="AscriptionType"></param>
|
||
/// <returns></returns>
|
||
public string GetAscriptionName(int AscriptionType)
|
||
{
|
||
if (AscriptionType == 1)
|
||
return "教育部";
|
||
if (AscriptionType == 2)
|
||
return "省政府";
|
||
return "教育部";
|
||
}
|
||
/// <summary>
|
||
/// 获取学校性质
|
||
/// </summary>
|
||
/// <param name="t"></param>
|
||
/// <returns></returns>
|
||
private string GetNhefSff(D_University t)
|
||
{
|
||
List<string> array = new List<string>();
|
||
if (t.Nhef == 1)
|
||
array.Add("985");
|
||
if (t.Sff == 1)
|
||
array.Add("211");
|
||
string nhefSff = string.Join('、', array);
|
||
return nhefSff;
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 获取招生简章列表
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<MessageModel<List<RequestEnrollmentinproductionResult>>> GetRequestEnrollmentinproductionResult(UniversityIdQuery query)
|
||
{
|
||
var longinfo = (await _dal.Query(x => x.IsDelete == false && x.table == "D_University" && x.newid == query.Id)).FirstOrDefault();
|
||
if (longinfo == null)
|
||
return new MessageModel<List<RequestEnrollmentinproductionResult>>() { success = false, msg = "未找到数据" };
|
||
RequestQuery request = new RequestQuery() { Id = longinfo.longid, PageIndex = query.PageIndex, PageSize = query.PageSize };
|
||
|
||
var stringBuilder = new StringBuilder();
|
||
stringBuilder.AppendFormat("Id={0}&PageIndex={1}&PageSize={2}", longinfo.longid, query.PageIndex, query.PageSize);
|
||
var info = HttpHelper.GetApi<RequestBaseResponse>("https://hbs.yrtsedu.cn/", "api/University/GetEnrollmentinproductions", stringBuilder.ToString());
|
||
if (info.Success == false)
|
||
{
|
||
return new MessageModel<List<RequestEnrollmentinproductionResult>>() { success = false, msg = "请求失败" };
|
||
}
|
||
return new MessageModel<List<RequestEnrollmentinproductionResult>>()
|
||
{
|
||
success = info.Success,
|
||
msg = "获取成功",
|
||
response = info.Data
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取招生简介详情
|
||
/// </summary>
|
||
/// <param name="query"></param>
|
||
/// <returns></returns>
|
||
public async Task<MessageModel<RequestEnrollmentinproductionDetailResult>> GetRequestEnrollmentinproductionDetailResult(StringIdQuery query)
|
||
{
|
||
if (string.IsNullOrWhiteSpace(query.Id))
|
||
{
|
||
return new MessageModel<RequestEnrollmentinproductionDetailResult>() { success = false, msg = "传入为空" };
|
||
}
|
||
var stringBuilder = new StringBuilder();
|
||
stringBuilder.AppendFormat("Id={0}", query.Id);
|
||
var info = HttpHelper.GetApi<RequestDetailBaseResponse>("https://hbs.yrtsedu.cn/", "api/University/GetEnrollmentinproductionDetali", stringBuilder.ToString());
|
||
if (info.Success == false)
|
||
{
|
||
return new MessageModel<RequestEnrollmentinproductionDetailResult>() { success = false, msg = "请求失败" };
|
||
}
|
||
return new MessageModel<RequestEnrollmentinproductionDetailResult>()
|
||
{
|
||
success = info.Success,
|
||
msg = "获取成功",
|
||
response = info.Data
|
||
};
|
||
}
|
||
|
||
|
||
#region 数据导入
|
||
|
||
#region Majorcategory
|
||
///// <summary>
|
||
///// Majorcategory
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\Majorcategory.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string Name = dr["Name"].ToString();
|
||
// string Sort = dr["Sort"].ToString();
|
||
// string TradeName = dr["TradeName"].ToString();
|
||
// string TradeNumber = dr["TradeNumber"].ToString();
|
||
// string Type = dr["Type"].ToString();
|
||
// var info = await d_MajorCategoryRepository.Add(new D_MajorCategory()
|
||
// {
|
||
// OrderSort = Convert.ToInt32(Sort),
|
||
// Name = Name,
|
||
// TradeName = TradeName,
|
||
// TradeNumber = TradeNumber,
|
||
// Type = Convert.ToInt32(Type)
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// await _dal.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region Majorclass
|
||
///// <summary>
|
||
///// Majorclass
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\Majorclass.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string Categoryname = dr["Categoryname"].ToString();
|
||
// string Sort = dr["Sort"].ToString();
|
||
// string TradeId = dr["TradeId"].ToString();
|
||
// string Name = dr["Name"].ToString();
|
||
|
||
// var nowmapid = (await _dal.Query(x => x.longid == TradeId)).Select(x => x.newid).FirstOrDefault();
|
||
// var info = await d_MajorClassRepository.Add(new D_MajorClass()
|
||
// {
|
||
// OrderSort = Convert.ToInt32(Sort),
|
||
// Name = Name,
|
||
// Categoryname = Categoryname,
|
||
// TradeId = nowmapid
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// await _dal.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region Major
|
||
///// <summary>
|
||
///// Major
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\Major.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string MajorName = dr["MajorName"].ToString();
|
||
// string MajorCode = dr["MajorCode"].ToString();
|
||
// string Name = dr["Name"].ToString();
|
||
// string Type = dr["Type"].ToString();
|
||
// string CategoryClass_Id = dr["CategoryClass_Id"].ToString();
|
||
|
||
// var nowmapid = mapinfo.Where(x => x.longid == CategoryClass_Id).Select(x => x.newid).FirstOrDefault();
|
||
// var info = await d_MajorRepository.Add(new D_Major()
|
||
// {
|
||
// Name = Name,
|
||
// CategoryClass_Id = nowmapid,
|
||
// MajorCode = MajorCode,
|
||
// MajorName = MajorName,
|
||
// Type = Type == "" ? 0 : Convert.ToInt32(Type),
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// await _dal.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region OccupationCategory
|
||
///// <summary>
|
||
///// OccupationCategory
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\OccupationCategory.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// //var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string Level = dr["Level"].ToString();
|
||
// string Name = dr["Name"].ToString();
|
||
// string OccupationName = dr["OccupationName"].ToString();
|
||
// var ParentId = dr["ParentId"].ToString() == "0" ? 0 : (await _dal.Query(x => x.longid == dr["ParentId"].ToString())).Select(x => x.newid).FirstOrDefault();
|
||
// string Sort = dr["Sort"].ToString();
|
||
// var info = await d_OccupationCategoryRepository.Add(new D_OccupationCategory()
|
||
// {
|
||
// Level = Convert.ToInt32(Level),
|
||
// Name = Name,
|
||
// OccupationName = OccupationName,
|
||
// ParentId = ParentId,
|
||
// OrderSort = Convert.ToInt32(Sort)
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// await _dal.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region Occupation
|
||
///// <summary>
|
||
///// Occupation
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\Occupation.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string CategoryId = dr["CategoryId"].ToString();
|
||
// string Name = dr["Name"].ToString();
|
||
// string OccupationIntraduce = dr["OccupationIntraduce"].ToString();
|
||
// string OccupationName = dr["OccupationName"].ToString();
|
||
// var newid = mapinfo.Where(x => x.longid == CategoryId).Select(x => x.newid).FirstOrDefault();
|
||
|
||
// var info = await d_OccupationRepository.Add(new D_Occupation ()
|
||
// {
|
||
// CategoryId=newid,
|
||
// Name=Name,
|
||
// OccupationIntraduce=OccupationIntraduce,
|
||
// OccupationName=OccupationName,
|
||
// Recommend=0,
|
||
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// await _dal.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region OccMapTag
|
||
///// <summary>
|
||
///// OccMapTag
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\OccMapTag.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string OccId = dr["OccId"].ToString();
|
||
// string Name = dr["Name"].ToString();
|
||
// string Tag = dr["Tag"].ToString();
|
||
|
||
// var newid = mapinfo.Where(x => x.longid == OccId).Select(x => x.newid).FirstOrDefault();
|
||
|
||
// var info = await d_OccMapTagRepository.Add(new D_OccMapTag ()
|
||
// {
|
||
// Name=Name,
|
||
// OccId=newid,
|
||
// Tag=Tag
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// await _dal.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region MajorMapOccouption
|
||
///// <summary>
|
||
///// MajorMapOccouption
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\MajorMapOccouption.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string MajorId = dr["MajorId"].ToString();
|
||
// string OccouptionId = dr["OccouptionId"].ToString();
|
||
|
||
|
||
// var newMajorId = mapinfo.Where(x => x.longid == MajorId).Select(x => x.newid).FirstOrDefault();
|
||
// var newOccouptionId = mapinfo.Where(x => x.longid == OccouptionId).Select(x => x.newid).FirstOrDefault();
|
||
|
||
// var info = await d_MajorMapOccouptionRepository.Add(new D_MajorMapOccouption()
|
||
// {
|
||
// MajorId = newMajorId,
|
||
// OccouptionId = newOccouptionId
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// await _dal.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region MajorMapTag
|
||
///// <summary>
|
||
///// MajorMapTag
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\MajorMapTag.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// List<D_LongIdMap> list = new List<D_LongIdMap>() { };
|
||
// var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string MajorId = dr["MajorId"].ToString();
|
||
// string Name = dr["Name"].ToString();
|
||
// string Tag = dr["Tag"].ToString();
|
||
|
||
// var newMajorId = mapinfo.Where(x => x.longid == MajorId).Select(x => x.newid).FirstOrDefault();
|
||
// var info = await d_MajorMapTagRepository.Add(new D_MajorMapTag()
|
||
// {
|
||
// MajorId = newMajorId,
|
||
// Name=Name,
|
||
// Tag=Tag,
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// list.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// await _dal.Add(list);
|
||
// }
|
||
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region MajorObtain
|
||
///// <summary>
|
||
///// MajorObtain
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\MajorObtain.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// List<D_LongIdMap> list = new List<D_LongIdMap>() { };
|
||
// var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string AverageWage = dr["AverageWage"].ToString();
|
||
// string EducationalBackgroundRatio = dr["EducationalBackgroundRatio"].ToString();
|
||
// string EducationRequirements = dr["EducationRequirements"].ToString();
|
||
// string EmploymentDirection = dr["EmploymentDirection"].ToString();
|
||
// string Experience = dr["Experience"].ToString();
|
||
// string ExperienceRatio = dr["ExperienceRatio"].ToString();
|
||
// string MajorId = dr["MajorId"].ToString();
|
||
// string MajorName = dr["MajorName"].ToString();
|
||
// string ObtainIndustryDis = dr["ObtainIndustryDis"].ToString();
|
||
// string ObtainIndustryDisProportion = dr["ObtainIndustryDisProportion"].ToString();
|
||
// string ObtainMoreArea = dr["ObtainMoreArea"].ToString();
|
||
// string ObtainMostIndustries = dr["ObtainMostIndustries"].ToString();
|
||
// string ObtainRank = dr["ObtainRank"].ToString();
|
||
// string ObtainRankDetail = dr["ObtainRankDetail"].ToString();
|
||
// string ObtainRegionalDis = dr["ObtainRegionalDis"].ToString();
|
||
// string ObtainRegionalDisProportion = dr["ObtainRegionalDisProportion"].ToString();
|
||
// string Position = dr["Position"].ToString();
|
||
// string WageProportion = dr["WageProportion"].ToString();
|
||
// string WageSituation = dr["WageSituation"].ToString();
|
||
// string WorkingYears = dr["WorkingYears"].ToString();
|
||
// string WorkingYearsWage = dr["WorkingYearsWage"].ToString();
|
||
|
||
// var newMajorId = mapinfo.Where(x => x.longid == MajorId).Select(x => x.newid).FirstOrDefault();
|
||
// var info = await d_MajorObtainRepository.Add(new D_MajorObtain()
|
||
// {
|
||
// MajorId = newMajorId,
|
||
// AverageWage = AverageWage,
|
||
// ObtainMoreArea = ObtainMoreArea,
|
||
// EducationalBackgroundRatio = EducationalBackgroundRatio,
|
||
// EducationRequirements = EducationRequirements,
|
||
// EmploymentDirection = EmploymentDirection,
|
||
// Experience = Experience,
|
||
// ExperienceRatio = ExperienceRatio,
|
||
// ObtainIndustryDis = ObtainIndustryDis,
|
||
// MajorName = MajorName,
|
||
// ObtainRank = ObtainRank,
|
||
// ObtainIndustryDisProportion = ObtainIndustryDisProportion,
|
||
// ObtainMostIndustries = ObtainMostIndustries,
|
||
// ObtainRankDetail = ObtainRankDetail,
|
||
// ObtainRegionalDis = ObtainRegionalDis,
|
||
// Position = Position,
|
||
// ObtainRegionalDisProportion = ObtainRegionalDisProportion,
|
||
// WageProportion = WageProportion,
|
||
// WageSituation = WageSituation,
|
||
// WorkingYears = WorkingYears,
|
||
// WorkingYearsWage = WorkingYearsWage
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// list.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// await _dal.Add(list);
|
||
// }
|
||
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region University
|
||
///// <summary>
|
||
///// University
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\University.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// List<D_LongIdMap> list = new List<D_LongIdMap>() { };
|
||
// //var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string Area_Name = dr["Area_Name"].ToString();
|
||
// string Ascription = dr["Ascription"].ToString();
|
||
// string AscriptionName = dr["AscriptionName"].ToString();
|
||
// string Description = dr["Description"].ToString();
|
||
// string Doctorate_Count = dr["Doctorate_Count"].ToString();
|
||
// string Logo = dr["Logo"].ToString();
|
||
// string Master_Count = dr["Master_Count"].ToString();
|
||
// string Name = dr["Name"].ToString();
|
||
// string Nature = dr["Nature"].ToString();
|
||
// string Nhef = dr["Nhef"].ToString();
|
||
// string Rank = dr["Rank"].ToString();
|
||
// string Sff = dr["Sff"].ToString();
|
||
// string Subject_Level = dr["Subject_Level"].ToString();
|
||
// string Syl = dr["Syl"].ToString();
|
||
// string Type = dr["Type"].ToString();
|
||
// string Web = dr["Web"].ToString();
|
||
|
||
// //var newMajorId = mapinfo.Where(x => x.longid == MajorId).Select(x => x.newid).FirstOrDefault();
|
||
// var info = await d_UniversityRepository.Add(new D_University()
|
||
// {
|
||
// Name = Name,
|
||
// Area_Name = Area_Name,
|
||
// Ascription = Ascription == "" ? 0 : Convert.ToInt32(Ascription),
|
||
// AscriptionName = AscriptionName,
|
||
// Description = Description,
|
||
// Doctorate_Count = Doctorate_Count == "" ? 0 : Convert.ToInt32(Doctorate_Count),
|
||
// Logo = Logo,
|
||
// Master_Count = Master_Count == "" ? 0 : Convert.ToInt32(Master_Count),
|
||
// Nature = Nature == "" ? 0 : Convert.ToInt32(Nature),
|
||
// Nhef = Nhef == "" ? 0 : Convert.ToInt32(Nhef),
|
||
// Rank = Rank == "" ? 0 : Convert.ToInt32(Rank),
|
||
// Sff = Sff == "" ? 0 : Convert.ToInt32(Sff),
|
||
// Web = Web,
|
||
// Type = Type == "" ? 0 : Convert.ToInt32(Type),
|
||
// Syl = Syl == "" ? 0 : Convert.ToInt32(Syl),
|
||
// Subject_Level = Subject_Level == "" ? 0 : Convert.ToInt32(Subject_Level),
|
||
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// list.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// await _dal.Add(list);
|
||
// }
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region Universityimg
|
||
///// <summary>
|
||
///// Universityimg
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\Universityimg.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// List<D_LongIdMap> list = new List<D_LongIdMap>() { };
|
||
// var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string ImgList = dr["ImgList"].ToString();
|
||
// string UniversityId = dr["UniversityId"].ToString();
|
||
|
||
// var newuniversityid = mapinfo.Where(x => x.longid == UniversityId).Select(x => x.newid).FirstOrDefault();
|
||
// var info = await d_UniversityimgRepository.Add(new D_Universityimg()
|
||
// {
|
||
// ImgList=ImgList,
|
||
// UniversityId=newuniversityid,
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// list.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// await _dal.Add(list);
|
||
// }
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region UniversityRank
|
||
///// <summary>
|
||
///// UniversityRank
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\UniversityRank.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// List<D_LongIdMap> list = new List<D_LongIdMap>() { };
|
||
// //var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string Rank = dr["Rank"].ToString();
|
||
// string UniversityName = dr["UniversityName"].ToString();
|
||
// string UniversityType = dr["UniversityType"].ToString();
|
||
// string Year = dr["Year"].ToString();
|
||
|
||
// //var newuniversityid = mapinfo.Where(x => x.longid == UniversityId).Select(x => x.newid).FirstOrDefault();
|
||
// var info = await d_UniversityRankRepository.Add(new D_UniversityRank()
|
||
// {
|
||
// Rank = Convert.ToInt32(Rank),
|
||
// UniversityName = UniversityName,
|
||
// UniversityType = Convert.ToInt32(UniversityType),
|
||
// Year = Year
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// list.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// await _dal.Add(list);
|
||
// }
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region MajorMapUniversity
|
||
///// <summary>
|
||
///// MajorMapUniversity
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\MajorMapUniversity.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// List<D_LongIdMap> list = new List<D_LongIdMap>() { };
|
||
// var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string Universityid = dr["Universityid"].ToString();
|
||
// string majorid = dr["majorid"].ToString();
|
||
|
||
|
||
// var newuniversityid = mapinfo.Where(x => x.longid == Universityid).Select(x => x.newid).FirstOrDefault();
|
||
// var newmajorid = mapinfo.Where(x => x.longid == majorid).Select(x => x.newid).FirstOrDefault();
|
||
// var info = await d_MajorMapUniversityRepository.Add(new D_MajorMapUniversity()
|
||
// {
|
||
// MajorId = newmajorid,
|
||
// Universityid = newuniversityid,
|
||
// sp = 0
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// list.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// await _dal.Add(list);
|
||
// }
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region Majorinformation
|
||
///// <summary>
|
||
///// Majorinformation
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\Majorinformation.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// List<D_LongIdMap> list = new List<D_LongIdMap>() { };
|
||
// var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string Name = dr["Name"].ToString();
|
||
// string Universityid = dr["Universityid"].ToString();
|
||
// string MajorId = dr["MajorId"].ToString();
|
||
// string Majorcourse = dr["Majorcourse"].ToString();
|
||
// string Majorintent = dr["Majorintent"].ToString();
|
||
// string Majordescription = dr["Majordescription"].ToString();
|
||
// string Skill = dr["Skill"].ToString();
|
||
// string Postgraduate = dr["Postgraduate"].ToString();
|
||
|
||
// var newuniversityid = mapinfo.Where(x => x.longid == Universityid).Select(x => x.newid).FirstOrDefault();
|
||
// var newmajorid = mapinfo.Where(x => x.longid == MajorId).Select(x => x.newid).FirstOrDefault();
|
||
// var info = await d_MajorInformationRepository.Add(new D_MajorInformation()
|
||
// {
|
||
// Name = Name,
|
||
// UniversityId = newuniversityid <= 0 ? 0 : newuniversityid,
|
||
// MajorId = newmajorid <= 0 ? 0 :newmajorid,
|
||
// Majorcourse = Majorcourse,
|
||
// Majordescription = Majordescription,
|
||
// Majorintent = Majorintent,
|
||
// Skill = Skill,
|
||
// Postgraduate = Postgraduate
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// list.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// await _dal.Add(list);
|
||
// }
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
|
||
#region GraduateFlow
|
||
///// <summary>
|
||
///// GraduateFlow
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public async Task<bool> Import()
|
||
//{
|
||
// var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\GraduateFlow.xlsx");
|
||
// if (dataSet.Tables.Count > 0)
|
||
// {
|
||
// List<D_LongIdMap> list = new List<D_LongIdMap>() { };
|
||
// var mapinfo = await _dal.Query(x => x.IsDelete == false);
|
||
// foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
// {
|
||
// string id = dr["_id"].ToString();
|
||
// string universityId = dr["universityId"].ToString();
|
||
// string provinces = dr["provinces"].ToString();
|
||
// string attrs = dr["attrs"].ToString();
|
||
|
||
// var newuniversityid = mapinfo.Where(x => x.longid == universityId).Select(x => x.newid).FirstOrDefault();
|
||
// var info = await d_GraduateFlowRepository.Add(new D_GraduateFlow()
|
||
// {
|
||
// Attrs = attrs,
|
||
// Provinces = provinces,
|
||
// UniversityId = newuniversityid,
|
||
// OrderSort = 0
|
||
// });
|
||
// if (info > 0)
|
||
// {
|
||
// list.Add(new D_LongIdMap() { longid = id, newid = info });
|
||
// }
|
||
// }
|
||
// await _dal.Add(list);
|
||
// }
|
||
// return true;
|
||
//}
|
||
#endregion
|
||
#endregion
|
||
|
||
|
||
#region 院校排序
|
||
/// <summary>
|
||
/// 院校排序
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public async Task<bool> Import()
|
||
{
|
||
var dataSet = ExcelUtil.ReadExcelToDataSet("D:\\Ashuju\\院校专业职业\\院校排名.xlsx");
|
||
if (dataSet.Tables.Count > 0)
|
||
{
|
||
var stringBuilderinfo = new StringBuilder();
|
||
stringBuilderinfo.AppendFormat("select Id,Name,Logo,Nhef,Sff,Syl,Area_Name,AscriptionName from D_University where IsDelete=0");
|
||
var info = await d_UniversityRepository.QuerySql(stringBuilderinfo.ToString());
|
||
|
||
List<D_University> list = new List<D_University>() { };
|
||
foreach (DataRow dr in dataSet.Tables[0].Rows)
|
||
{
|
||
var rank = Convert.ToInt32(dr["排序"].ToString());
|
||
var name = dr["院校名称"].ToString();
|
||
var nowinfo = info.Where(x => x.Name == name).FirstOrDefault();
|
||
if (nowinfo != null)
|
||
{
|
||
nowinfo.Rank = rank;
|
||
list.Add(nowinfo);
|
||
}
|
||
}
|
||
await d_UniversityRepository.Update(list);
|
||
}
|
||
|
||
return true;
|
||
}
|
||
#endregion
|
||
}
|
||
} |