优化热门院校接口
This commit is contained in:
zhouwentao 2024-06-03 16:43:58 +08:00
parent 1b08f94f5e
commit 519db33c65
6 changed files with 168 additions and 1154 deletions

View File

@ -1,9 +1,11 @@
package org.jeecg.modules.web.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Set;
/**
* @Description 热门院校返回对象
@ -12,12 +14,28 @@ import java.util.List;
*/
@Data
public class ArtHotSchoolDTO implements Serializable {
//本省 本科院校
List<ArtSchoolDTO> nowProvinceBenSchoolList;
//本省 专科院校
List<ArtSchoolDTO> nowProvinceZhuanSchoolList;
//外省 本科院校
List<ArtSchoolDTO> otherProvinceBenSchoolList;
//外省 专科院校
List<ArtSchoolDTO> otherProvinceZhuanSchoolList;
//院校编号
private String schoolCode;
//院校名称
private String schoolName;
//学校层次
@JsonIgnore
private String schoolType;
//办学性质
private String schoolNature;
//院校类型
private String institutionType;
//院校图标
private String schoolIcon;
//是否211
@JsonIgnore
private String is211;
//是否985
@JsonIgnore
private String is985;
@JsonIgnore
//是否双一流
private String sfsyl;
private Set<String> tagsList;
}

View File

@ -238,892 +238,6 @@ public class YxSchoolController extends JeecgController<YxSchool, IYxSchoolServi
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
/*@RequiresPermissions("yx:yx_school:importExcel")*/
@RequestMapping(value = "/importExcel3", method = RequestMethod.POST)
public Result<?> importExcel3(HttpServletRequest request, HttpServletResponse response) {
// 获取上传文件对象
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\表演提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\表演A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\表演B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\表演高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\播音提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\播音A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\播音B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\播音高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\国标舞提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\国标舞A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\国标舞B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\国标舞高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\美术提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\美术A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\美术B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\美术高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\书法提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\书法A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\书法B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\书法高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\艺术舞蹈提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\艺术舞蹈A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\艺术舞蹈B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\艺术舞蹈高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\音乐提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\音乐A段2.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\音乐B段.xlsx");
// File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\体育本科1.xlsx");
File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\体育高职高专1.xlsx");
FileInputStream fileInputStream = null;
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setNeedSave(true);
int index = 0;
List<YxSchool> schoolList = yxSchoolService.list(new LambdaQueryWrapper<YxSchool>().isNotNull(YxSchool::getSchoolCode));
//本科(职业教育)
Map<String, YxMajor> majorNameZyMap = new LinkedHashMap<>();
LambdaQueryWrapper<YxMajor> queryWrapper = new LambdaQueryWrapper<>();
if (file.getName().contains("高职高专")) {
//高职高专
queryWrapper.eq(YxMajor::getEducationalLevel, "2");
} else {
//本科
queryWrapper.eq(YxMajor::getEducationalLevel, "1");
queryWrapper.eq(YxMajor::getIsVte, "0");
}
List<YxMajor> majorList = yxMajorService.list(queryWrapper);
boolean isB = false;
String batch = null;
String batch2 = null;
if (file.getName().contains("A段")) {
batch = "本科A段";
batch2 = "本科A段";
} else if (file.getName().contains("提前批")) {
batch = "提前批";
batch2 = "本科A段";
} else if (file.getName().contains("高职高专")) {
batch = "高职高专";
batch2 = "高职高专";
} else if (file.getName().contains("B段")) {
batch = "本科B段";
batch2 = "本科B段";
isB = true;
//获取职业本科
queryWrapper.clear();
queryWrapper.eq(YxMajor::getEducationalLevel, "1");
queryWrapper.eq(YxMajor::getIsVte, "1");
List<YxMajor> list = yxMajorService.list(queryWrapper);
majorNameZyMap = list.stream().collect(Collectors.toMap(m -> m.getMajorName(), m -> m));
} else if (file.getName().contains("本科")) {
batch = "本科";
batch2 = "本科";
}
String majorType = "";
LambdaQueryWrapper<YxHistoryScoreControlLine> yxHistoryScoreControlLineLambdaQueryWrapper = new LambdaQueryWrapper<>();
if (file.getName().contains("美术")) {
majorType = "美术类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "美术类");
} else if (file.getName().contains("音乐")) {
majorType = "音乐类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "音乐类");
} else if (file.getName().contains("艺术舞蹈")) {
majorType = "艺术舞蹈类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "艺术舞蹈类");
} else if (file.getName().contains("国标舞")) {
majorType = "国际标准舞类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "国际标准舞类");
} else if (file.getName().contains("编导")) {
majorType = "编导制作类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "编导制作类");
} else if (file.getName().contains("播音")) {
majorType = "播音与主持类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "播音与主持类");
} else if (file.getName().contains("表演")) {
majorType = "表演类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "表演类");
} else if (file.getName().contains("书法")) {
majorType = "书法类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "书法类");
} else if (file.getName().contains("体育")) {
majorType = "体育类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "体育类");
}
List<YxHistoryScoreControlLine> historyScoreControlLineList = yxHistoryScoreControlLineService.list(yxHistoryScoreControlLineLambdaQueryWrapper);
Map<String, YxHistoryScoreControlLine> scoreControlLineMap = historyScoreControlLineList.stream().collect(Collectors.toMap(h -> h.getYear() + h.getBatch() + h.getProfessionalCategory() + h.getCategory(), h -> h));
Map<String, YxSchool> schoolNameMap = schoolList.stream().collect(Collectors.toMap(YxSchool::getSchoolCode, s -> s));
Map<String, YxMajor> majorNameMap = majorList.stream().collect(Collectors.toMap(YxMajor::getMajorName, m -> m));
Set<LiNianShuJuDTO> notSchoolList = new HashSet<>();
List<YxHistoryMajorEnroll> yxHistoryMajorEnrollList = new ArrayList<>();
try {
fileInputStream = new FileInputStream(file);
List<LiNianShuJuDTO> list = ExcelImportUtil.importExcel(fileInputStream, LiNianShuJuDTO.class, params);
String schoolCode = null;
String schoolName = null;
String zhuanye = null;
String zhuanyeName = null;
String zhuanyeCode = null;
String zhuanyeNameLast = null;
String nianfen = null;
String kelei = null;
String wenhuaBili = null;
String zhuanyeBili = null;
String jihuashu = null;
String luqushu = null;
String shijitoudangrenshu = null;
String yizhiyuanluqushu = null;
String yizhiyuanzuidipaixuchengji = null;
String sortType = null;
int i = 0, ii1 = 0, i2 = 0, i3 = 0;
YxHistoryScoreControlLine yxHistoryScoreControlLine = null;
BigDecimal bigDecimal100 = new BigDecimal(100);
//识别专业名称 库中没有则创建
if (batch2.equals("高职高专")) {
for (LiNianShuJuDTO liNianShuJuDTO : list) {
index++;
zhuanye = liNianShuJuDTO.getZhuanye();
zhuanye = zhuanye.replace(" ", "")
.replace(".", "")
.replace("(", "")
.replace(")", "")
.replace("", "")
.replace("", "")
.replace("美末", "美术")
.replace("艺采", "艺术")
.replace("艺末", "艺术")
.replace("艺未", "艺术")
.replace("设讦", "设计")
.replace("设评", "设计")
.replace("搬影", "摄影")
.replace("室内艺术设计", "室内艺术设")
.replace("室内艺术设", "室内艺术设计")
.replace("数字媒体艺术设计", "数字媒体艺术设")
.replace("数字媒体艺术设", "数字媒体艺术设计").replace("\n", "");
i2 = zhuanye.indexOf("");
zhuanyeCode = zhuanye.substring(1, i2);
zhuanyeName = zhuanye.substring(i2 + 1, zhuanye.length());
i3 = zhuanyeName.indexOf("");
YxMajor yxMajor = null;
if (isB && liNianShuJuDTO.getYuanxiao().contains("职业") && !liNianShuJuDTO.getYuanxiao().contains("陶瓷")) {
if (i3 == -1) {
yxMajor = majorNameZyMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameZyMap.get(zhuanyeName.substring(0, i3));
}
//如果 没有从 职业本科中找到那就去找普通本科
if (yxMajor == null) {
if (i3 == -1) {
yxMajor = majorNameMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameMap.get(zhuanyeName.substring(0, i3));
}
}
} else {
if (i3 == -1) {
yxMajor = majorNameMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameMap.get(zhuanyeName.substring(0, i3));
}
}
if (zhuanyeName.contains("广告设计与制作")) {
yxMajor = majorNameMap.get("广告艺术设计");
}
if (yxMajor == null) {
yxMajor = new YxMajor();
yxMajor.setMajorCode(zhuanyeCode);
yxMajor.setMajorName(zhuanyeName);
if (batch2.contains("")) {
yxMajor.setEducationalLevel("1");
yxMajor.setSemester("4");
if (zhuanyeName.contains("表演")) {
yxMajor.setFirstLevelDiscipline("1731184290459099137");//表演艺术
}
} else {
yxMajor.setEducationalLevel("2");
yxMajor.setSemester("3");
if (zhuanyeName.contains("表演")) {
yxMajor.setFirstLevelDiscipline("1729376091326214145");//表演艺术
} else if (zhuanyeName.contains("媒体")) {
yxMajor.setFirstLevelDiscipline("1731488738330918913");//广播影视类
} else if (zhuanyeName.contains("设计")) {
yxMajor.setFirstLevelDiscipline("1729376034648584193");//艺术设计类
} else if (zhuanyeName.contains("美术")) {
yxMajor.setFirstLevelDiscipline("1729376034648584193");//艺术设计类
}
}
yxMajor.setIsVte(0);
yxMajorService.save(yxMajor);
majorNameMap.put(zhuanyeName, yxMajor);
}
}
majorList = yxMajorService.list(queryWrapper);
majorNameMap = majorList.stream().collect(Collectors.toMap(m -> m.getMajorName(), m -> m));
index = 0;
}
for (LiNianShuJuDTO liNianShuJuDTO : list) {
index++;
//获取专业名
zhuanye = liNianShuJuDTO.getZhuanye();
//院校
String yuanxiao = liNianShuJuDTO.getYuanxiao();
if (StringUtils.isBlank(yuanxiao)) {
continue;
}
yuanxiao = yuanxiao.replace(" ", "").replace("\n", "").replace("(", "").replace(")", "");
i = yuanxiao.indexOf("");
schoolCode = yuanxiao.substring(1, i);
schoolName = yuanxiao.substring(i + 1, yuanxiao.length());
if (schoolName.contains("中外合作") || schoolName.contains("(原") || schoolName.contains("(源")) {
ii1 = schoolName.indexOf("");
if (ii1 != -1) {
schoolName = schoolName.substring(0, ii1);
}
}
YxSchool school = schoolNameMap.get(schoolCode);
if (schoolName.contains("漂河职业技术学院")) {
school = schoolNameMap.get("漯河职业技术学院");
}
if (school == null) {
//学校库没有这个学校
notSchoolList.add(liNianShuJuDTO);
continue;
}
school.setInstitutionCode(schoolCode);//院校编码
schoolNameMap.put(schoolName, school);//再保存到map等最后循环完后一起修改
zhuanye = zhuanye.replace(" ", "")
.replace(".", "")
.replace("(", "")
.replace(")", "")
.replace("", "")
.replace("", "")
.replace("美末", "美术")
.replace("艺采", "艺术")
.replace("艺末", "艺术")
.replace("艺未", "艺术")
.replace("设讦", "设计")
.replace("设评", "设计")
.replace("搬影", "摄影")
.replace("室内艺术设计", "室内艺术设")
.replace("室内艺术设", "室内艺术设计")
.replace("数字媒体艺术设计", "数字媒体艺术设")
.replace("数字媒体艺术设", "数字媒体艺术设计").replace("\n", "");
i2 = zhuanye.indexOf("");
zhuanyeCode = zhuanye.substring(1, i2);
zhuanyeName = zhuanye.substring(i2 + 1, zhuanye.length());
i3 = zhuanyeName.indexOf("");
YxMajor yxMajor = null;
if (isB && schoolName.contains("职业") && !zhuanyeName.contains("陶瓷")) {
if (i3 == -1) {
yxMajor = majorNameZyMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameZyMap.get(zhuanyeName.substring(0, i3));
}
//如果 没有从 职业本科中找到那就去找普通本科
if (yxMajor == null) {
if (i3 == -1) {
yxMajor = majorNameMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameMap.get(zhuanyeName.substring(0, i3));
}
}
} else {
if (i3 == -1) {
yxMajor = majorNameMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameMap.get(zhuanyeName.substring(0, i3));
}
}
if (zhuanyeName.contains("广告设计与制作")) {
yxMajor = majorNameMap.get("广告艺术设计");
}
if (yxMajor == null) {
notSchoolList.add(liNianShuJuDTO);
continue;
}
sortType = liNianShuJuDTO.getSortType();
//科类
kelei = liNianShuJuDTO.getKelei();
//获取年份
nianfen = liNianShuJuDTO.getNianfen();
//文化成绩比例
wenhuaBili = liNianShuJuDTO.getWenhuaBili();
//专业成绩比例
zhuanyeBili = liNianShuJuDTO.getZhuanyeBili();
//计划数
jihuashu = liNianShuJuDTO.getJihuashu();
//录取数
luqushu = liNianShuJuDTO.getLuqushu();
//实际投档人数
shijitoudangrenshu = liNianShuJuDTO.getShijitoudangrenshu();
//一志愿录取数
yizhiyuanluqushu = liNianShuJuDTO.getYizhiyuanluqushu();
jihuashu = jihuashu == null ? "0" : jihuashu;
luqushu = luqushu == null ? "0" : luqushu;
shijitoudangrenshu = shijitoudangrenshu == null ? "0" : shijitoudangrenshu;
yizhiyuanluqushu = yizhiyuanluqushu == null ? "0" : yizhiyuanluqushu;
//一志愿最低排序成绩
yizhiyuanzuidipaixuchengji = liNianShuJuDTO.getYizhiyuanzuidipaixuchengji();
if (yizhiyuanzuidipaixuchengji == null) {
continue;
//yizhiyuanzuidipaixuchengji = "0";
}
yizhiyuanzuidipaixuchengji = yizhiyuanzuidipaixuchengji.replace("g", "9");
YxHistoryMajorEnroll yxHistoryMajorEnroll = new YxHistoryMajorEnroll();
yxHistoryMajorEnroll.setInstitutionCode(schoolCode);
yxHistoryMajorEnroll.setSchoolCode(school.getSchoolCode());
yxHistoryMajorEnroll.setSchoolName(schoolName);
yxHistoryMajorEnroll.setEnrollmentCode(zhuanyeCode);//招生代码
yxHistoryMajorEnroll.setMajorCode(yxMajor.getMajorCode());//专业编号
yxHistoryMajorEnroll.setMajorName(zhuanyeName);//专业名称
yxHistoryMajorEnroll.setYear(nianfen);//年份
yxHistoryMajorEnroll.setCategory(kelei);//文科/理科
yxHistoryMajorEnroll.setAdmissionLine(new BigDecimal(yizhiyuanzuidipaixuchengji));//一志愿最低排序成绩
yxHistoryMajorEnroll.setEnrollNum(new BigDecimal(jihuashu).intValue());//计划人数
yxHistoryMajorEnroll.setActualPitcherNum(Integer.valueOf(shijitoudangrenshu));//实际投递人数
yxHistoryMajorEnroll.setAdmissionNum(Integer.valueOf(luqushu));//录取数
yxHistoryMajorEnroll.setOneVolunteerAdmissionNum(Integer.valueOf(yizhiyuanluqushu));//录取数
yxHistoryMajorEnroll.setMajorType(majorType);//专业类别
//排序方法
yxHistoryScoreControlLine = scoreControlLineMap.get(nianfen + batch2 + majorType + kelei);
//文化成绩分
BigDecimal culturalScore = yxHistoryScoreControlLine.getCulturalScore();
//专业成绩分
BigDecimal specialScore = yxHistoryScoreControlLine.getSpecialScore();
if (sortType.equals("专业课上线,文化课排队")) {
//专过文排
yxHistoryMajorEnroll.setRulesEnrollProbability("专过文排");
BigDecimal wenhuaBl = new BigDecimal(wenhuaBili).divide(bigDecimal100, 4, RoundingMode.HALF_UP);
yxHistoryMajorEnroll.setControlLine(wenhuaBl.multiply(culturalScore));
} else if (sortType.equals("文化课上线,专业课排队")) {
//文过专排
yxHistoryMajorEnroll.setRulesEnrollProbability("文过专排");
BigDecimal zhuanyeBl = new BigDecimal(zhuanyeBili).divide(bigDecimal100, 4, RoundingMode.HALF_UP);
yxHistoryMajorEnroll.setControlLine(zhuanyeBl.multiply(specialScore));
} else if (sortType.equals("其他计算办法")) {
continue;
} else {
BigDecimal wenhuaBl = new BigDecimal(wenhuaBili).divide(bigDecimal100, 4, RoundingMode.HALF_UP);
BigDecimal zhuanyeBl = new BigDecimal(zhuanyeBili).divide(bigDecimal100, 4, RoundingMode.HALF_UP);
BigDecimal controlLine = wenhuaBl.multiply(culturalScore).add(zhuanyeBl.multiply(specialScore));
yxHistoryMajorEnroll.setControlLine(controlLine);
yxHistoryMajorEnroll.setRulesEnrollProbability("" + wenhuaBl.toString() + "" + zhuanyeBl.toString());
yxHistoryMajorEnroll.setProbabilityOperator("文*" + wenhuaBl.toString() + "专*" + zhuanyeBl.toString());
}
yxHistoryMajorEnroll.setBatch(batch);
yxHistoryMajorEnrollList.add(yxHistoryMajorEnroll);
}
Set<String> renameYuanxiaos = new HashSet<>();
for (LiNianShuJuDTO liNianShuJuDTO : notSchoolList) {
if (liNianShuJuDTO.getYuanxiao().contains("")) {
renameYuanxiaos.add(liNianShuJuDTO.getYuanxiao().replace(" ", "").replace("\n", ""));
}
}
if (CollectionUtils.isNotEmpty(renameYuanxiaos)) {
for (String renameYuanxiao : renameYuanxiaos) {
System.out.println(renameYuanxiao);
}
}
} catch (FileNotFoundException fileNotFoundException) {
log.error("文件不存在," + file.getAbsolutePath());
throw new RuntimeException(fileNotFoundException);
} catch (Exception e) {
System.out.println(index);
throw new RuntimeException(e);
}
//yxHistoryMajorEnrollService.saveBatch(yxHistoryMajorEnrollList);
System.out.println("未找到学校及专业的数据数量:" + notSchoolList.size());
return Result.error("文件导入成功!");
}
@RequestMapping(value = "/importExcel32", method = RequestMethod.POST)
public Result<?> importExcel32(HttpServletRequest request, HttpServletResponse response) {
// 获取上传文件对象
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\表演提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\表演A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\表演B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\表演高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\播音提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\播音A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\播音B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\播音高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\国标舞提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\国标舞A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\国标舞B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\国标舞高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\美术提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\美术A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\美术B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术录取分数线2022-2020\\美术高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\书法提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\书法A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\书法B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\书法高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\艺术舞蹈提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\艺术舞蹈A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\艺术舞蹈B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\艺术舞蹈高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\音乐提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\音乐A段2.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\音乐B段.xlsx");
File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\体育本科2021.xlsx");
// File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\体育高职高专2021.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\书法、艺术舞蹈、音乐、体育\\体育高职高专1.xlsx");
FileInputStream fileInputStream = null;
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setNeedSave(true);
int index = 0;
List<YxSchool> schoolList = yxSchoolService.list(new LambdaQueryWrapper<YxSchool>().isNotNull(YxSchool::getSchoolCode));
//本科(职业教育)
Map<String, YxMajor> majorNameZyMap = new LinkedHashMap<>();
LambdaQueryWrapper<YxMajor> queryWrapper = new LambdaQueryWrapper<>();
if (file.getName().contains("高职高专")) {
//高职高专
queryWrapper.eq(YxMajor::getEducationalLevel, "2");
} else {
//本科
queryWrapper.eq(YxMajor::getEducationalLevel, "1");
queryWrapper.eq(YxMajor::getIsVte, "0");
}
List<YxMajor> majorList = yxMajorService.list(queryWrapper);
boolean isB = false;
String batch = null;
String batch2 = null;
if (file.getName().contains("A段")) {
batch = "本科A段";
batch2 = "本科A段";
} else if (file.getName().contains("提前批")) {
batch = "提前批";
batch2 = "本科A段";
} else if (file.getName().contains("高职高专")) {
batch = "高职高专";
batch2 = "高职高专";
} else if (file.getName().contains("B段")) {
batch = "本科B段";
batch2 = "本科B段";
isB = true;
//获取职业本科
queryWrapper.clear();
queryWrapper.eq(YxMajor::getEducationalLevel, "1");
queryWrapper.eq(YxMajor::getIsVte, "1");
List<YxMajor> list = yxMajorService.list(queryWrapper);
majorNameZyMap = list.stream().collect(Collectors.toMap(m -> m.getMajorName(), m -> m));
} else if (file.getName().contains("本科")) {
batch = "本科";
batch2 = "本科";
}
String majorType = "";
LambdaQueryWrapper<YxHistoryScoreControlLine> yxHistoryScoreControlLineLambdaQueryWrapper = new LambdaQueryWrapper<>();
if (file.getName().contains("美术")) {
majorType = "美术类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "美术类");
} else if (file.getName().contains("音乐")) {
majorType = "音乐类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "音乐类");
} else if (file.getName().contains("艺术舞蹈")) {
majorType = "艺术舞蹈类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "艺术舞蹈类");
} else if (file.getName().contains("国标舞")) {
majorType = "国际标准舞类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "国际标准舞类");
} else if (file.getName().contains("编导")) {
majorType = "编导制作类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "编导制作类");
} else if (file.getName().contains("播音")) {
majorType = "播音与主持类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "播音与主持类");
} else if (file.getName().contains("表演")) {
majorType = "表演类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "表演类");
} else if (file.getName().contains("书法")) {
majorType = "书法类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "书法类");
} else if (file.getName().contains("体育")) {
majorType = "体育类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, "体育类");
}
List<YxHistoryScoreControlLine> historyScoreControlLineList = yxHistoryScoreControlLineService.list(yxHistoryScoreControlLineLambdaQueryWrapper);
Map<String, YxHistoryScoreControlLine> scoreControlLineMap = historyScoreControlLineList.stream().collect(Collectors.toMap(h -> h.getYear() + h.getBatch() + h.getProfessionalCategory() + h.getCategory(), h -> h));
Map<String, YxSchool> schoolNameMap = schoolList.stream().collect(Collectors.toMap(YxSchool::getSchoolCode, s -> s));
Map<String, YxMajor> majorNameMap = majorList.stream().collect(Collectors.toMap(YxMajor::getMajorName, m -> m));
Set<LiNianShuJuDTO> notSchoolList = new HashSet<>();
List<YxHistoryMajorEnroll> yxHistoryMajorEnrollList = new ArrayList<>();
try {
fileInputStream = new FileInputStream(file);
List<LiNianShuJuDTO> list = ExcelImportUtil.importExcel(fileInputStream, LiNianShuJuDTO.class, params);
String schoolCode = null;
String schoolName = null;
String zhuanye = null;
String detail = null;
String zhuanyeName = null;
String zhuanyeCode = null;
String zhuanyeNameLast = null;
String nianfen = null;
String kelei = null;
String wenhuaBili = null;
String zhuanyeBili = null;
String jihuashu = null;
String luqushu = null;
String shijitoudangrenshu = null;
String yizhiyuanluqushu = null;
String yizhiyuanzuidipaixuchengji = null;
String sortType = null;
int i = 0, ii1 = 0, i2 = 0, i3 = 0;
YxHistoryScoreControlLine yxHistoryScoreControlLine = null;
BigDecimal bigDecimal100 = new BigDecimal(100);
//识别专业名称 库中没有则创建
if (1 == 2 && batch2.equals("高职高专")) {
for (LiNianShuJuDTO liNianShuJuDTO : list) {
index++;
zhuanye = liNianShuJuDTO.getZhuanye();
if (StringUtils.isBlank(zhuanye)) {
continue;
}
zhuanye = zhuanye.replace(" ", "")
.replace(".", "")
.replace("(", "")
.replace(")", "")
.replace("", "")
.replace("", "")
.replace("美末", "美术")
.replace("艺采", "艺术")
.replace("艺末", "艺术")
.replace("艺未", "艺术")
.replace("设讦", "设计")
.replace("设评", "设计")
.replace("搬影", "摄影")
.replace("室内艺术设计", "室内艺术设")
.replace("室内艺术设", "室内艺术设计")
.replace("数字媒体艺术设计", "数字媒体艺术设")
.replace("数字媒体艺术设", "数字媒体艺术设计").replace("\n", "");
i3 = zhuanye.indexOf("");
zhuanyeCode = liNianShuJuDTO.getZhuanyeCode();
if (i3 != -1) {
zhuanyeName = zhuanye.substring(0, i3);
} else {
zhuanyeName = zhuanye;
}
//i3 = zhuanyeName.indexOf("");
YxMajor yxMajor = null;
if (isB && liNianShuJuDTO.getYuanxiao().contains("职业") && !liNianShuJuDTO.getYuanxiao().contains("陶瓷")) {
if (i3 == -1) {
yxMajor = majorNameZyMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameZyMap.get(zhuanyeName.substring(0, i3));
}
//如果 没有从 职业本科中找到那就去找普通本科
if (yxMajor == null) {
if (i3 == -1) {
yxMajor = majorNameMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameMap.get(zhuanyeName.substring(0, i3));
}
}
} else {
if (i3 == -1) {
yxMajor = majorNameMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameMap.get(zhuanyeName.substring(0, i3));
}
}
if (zhuanyeName.contains("广告设计与制作")) {
yxMajor = majorNameMap.get("广告艺术设计");
}
if (yxMajor == null) {
yxMajor = new YxMajor();
yxMajor.setMajorCode(zhuanyeCode);
yxMajor.setMajorName(zhuanyeName);
if (batch2.contains("")) {
yxMajor.setEducationalLevel("1");
yxMajor.setSemester("4");
if (zhuanyeName.contains("表演")) {
yxMajor.setFirstLevelDiscipline("1731184290459099137");//表演艺术
}
} else {
yxMajor.setEducationalLevel("2");
yxMajor.setSemester("3");
if (zhuanyeName.contains("表演")) {
yxMajor.setFirstLevelDiscipline("1729376091326214145");//表演艺术
} else if (zhuanyeName.contains("媒体")) {
yxMajor.setFirstLevelDiscipline("1731488738330918913");//广播影视类
} else if (zhuanyeName.contains("设计")) {
yxMajor.setFirstLevelDiscipline("1729376034648584193");//艺术设计类
} else if (zhuanyeName.contains("美术")) {
yxMajor.setFirstLevelDiscipline("1729376034648584193");//艺术设计类
}
}
yxMajor.setIsVte(0);
yxMajorService.save(yxMajor);
majorNameMap.put(zhuanyeName, yxMajor);
}
}
majorList = yxMajorService.list(queryWrapper);
majorNameMap = majorList.stream().collect(Collectors.toMap(m -> m.getMajorName(), m -> m));
index = 0;
}
for (LiNianShuJuDTO liNianShuJuDTO : list) {
index++;
//获取专业名
zhuanye = liNianShuJuDTO.getZhuanye();
detail = liNianShuJuDTO.getDetail();
//院校
String yuanxiao = liNianShuJuDTO.getYuanxiao();
if (StringUtils.isBlank(yuanxiao)) {
continue;
}
schoolCode = liNianShuJuDTO.getYuanxiaoCode();
yuanxiao = yuanxiao.replace(" ", "").replace("\n", "").replace("(", "").replace(")", "");
i = yuanxiao.indexOf("");
//schoolCode = yuanxiao.substring(1, i);
schoolName = yuanxiao.substring(i + 1, yuanxiao.length());
if (schoolName.contains("中外合作") || schoolName.contains("(原") || schoolName.contains("(源")) {
ii1 = schoolName.indexOf("");
if (ii1 != -1) {
schoolName = schoolName.substring(0, ii1);
}
}
YxSchool school = schoolNameMap.get(schoolCode);
if (schoolName.contains("漂河职业技术学院")) {
school = schoolNameMap.get("漯河职业技术学院");
}
if (school == null) {
//学校库没有这个学校
notSchoolList.add(liNianShuJuDTO);
continue;
}
school.setInstitutionCode(schoolCode);//院校编码
schoolNameMap.put(schoolName, school);//再保存到map等最后循环完后一起修改
if (StringUtils.isBlank(zhuanye)) {
continue;
}
zhuanye = zhuanye.replace(" ", "")
.replace(".", "")
.replace("(", "")
.replace(")", "")
.replace("", "")
.replace("", "")
.replace("美末", "美术")
.replace("艺采", "艺术")
.replace("艺末", "艺术")
.replace("艺未", "艺术")
.replace("设讦", "设计")
.replace("设评", "设计")
.replace("搬影", "摄影")
.replace("室内艺术设计", "室内艺术设")
.replace("室内艺术设", "室内艺术设计")
.replace("数字媒体艺术设计", "数字媒体艺术设")
.replace("数字媒体艺术设", "数字媒体艺术设计").replace("\n", "");
i2 = zhuanye.indexOf("");
//zhuanyeCode = zhuanye.substring(1, i2);
zhuanyeCode = liNianShuJuDTO.getZhuanyeCode();
i3 = zhuanye.indexOf("");
if (i3 != -1) {
zhuanyeName = zhuanye.substring(0, i3);
} else {
zhuanyeName = zhuanye;
}
//zhuanyeName = zhuanye.substring(i3 + 1, zhuanye.length());
YxMajor yxMajor = null;
yxMajor = majorNameMap.get(zhuanyeName);
/*if (isB && schoolName.contains("职业") && !zhuanyeName.contains("陶瓷")) {
if (i3 == -1) {
yxMajor = majorNameZyMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameZyMap.get(zhuanyeName.substring(0, i3));
}
//如果 没有从 职业本科中找到那就去找普通本科
if (yxMajor == null) {
if (i3 == -1) {
yxMajor = majorNameMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameMap.get(zhuanyeName.substring(0, i3));
}
}
} else {
if (i3 == -1) {
yxMajor = majorNameMap.get(zhuanyeName);
} else {
//专业名称后半段
zhuanyeNameLast = zhuanyeName.replace(zhuanyeName.substring(0, i3), "");
yxMajor = majorNameMap.get(zhuanyeName.substring(0, i3));
}
}*/
if (zhuanyeName.contains("广告设计与制作")) {
yxMajor = majorNameMap.get("广告艺术设计");
}
if (yxMajor == null) {
notSchoolList.add(liNianShuJuDTO);
continue;
}
sortType = liNianShuJuDTO.getSortType();
//科类
kelei = liNianShuJuDTO.getKelei();
//获取年份
nianfen = liNianShuJuDTO.getNianfen();
//文化成绩比例
wenhuaBili = liNianShuJuDTO.getWenhuaBili();
//专业成绩比例
zhuanyeBili = liNianShuJuDTO.getZhuanyeBili();
//计划数
jihuashu = liNianShuJuDTO.getJihuashu();
//录取数
luqushu = liNianShuJuDTO.getLuqushu();
//实际投档人数
shijitoudangrenshu = liNianShuJuDTO.getShijitoudangrenshu();
//一志愿录取数
yizhiyuanluqushu = liNianShuJuDTO.getYizhiyuanluqushu();
jihuashu = jihuashu == null ? "0" : jihuashu;
luqushu = luqushu == null ? "0" : luqushu;
shijitoudangrenshu = shijitoudangrenshu == null ? "0" : shijitoudangrenshu;
yizhiyuanluqushu = yizhiyuanluqushu == null ? "0" : yizhiyuanluqushu;
//一志愿最低排序成绩
yizhiyuanzuidipaixuchengji = liNianShuJuDTO.getYizhiyuanzuidipaixuchengji();
if (yizhiyuanzuidipaixuchengji == null) {
continue;
//yizhiyuanzuidipaixuchengji = "0";
}
yizhiyuanzuidipaixuchengji = yizhiyuanzuidipaixuchengji.replace("g", "9");
YxHistoryMajorEnroll yxHistoryMajorEnroll = new YxHistoryMajorEnroll();
yxHistoryMajorEnroll.setInstitutionCode(schoolCode);
yxHistoryMajorEnroll.setSchoolCode(school.getSchoolCode());
yxHistoryMajorEnroll.setSchoolName(schoolName);
yxHistoryMajorEnroll.setEnrollmentCode(zhuanyeCode);//招生代码
yxHistoryMajorEnroll.setMajorCode(yxMajor.getMajorCode());//专业编号
yxHistoryMajorEnroll.setMajorName(zhuanyeName);//专业名称
yxHistoryMajorEnroll.setYear(nianfen);//年份
yxHistoryMajorEnroll.setCategory(kelei);//文科/理科
yxHistoryMajorEnroll.setAdmissionLine(new BigDecimal(yizhiyuanzuidipaixuchengji));//一志愿最低排序成绩
yxHistoryMajorEnroll.setEnrollNum(new BigDecimal(jihuashu).intValue());//计划人数
yxHistoryMajorEnroll.setActualPitcherNum(Integer.valueOf(shijitoudangrenshu));//实际投递人数
yxHistoryMajorEnroll.setAdmissionNum(Integer.valueOf(luqushu));//录取数
yxHistoryMajorEnroll.setOneVolunteerAdmissionNum(Integer.valueOf(yizhiyuanluqushu));//录取数
yxHistoryMajorEnroll.setMajorType(majorType);//专业类别
yxHistoryMajorEnroll.setDetail(detail);
//排序方法
yxHistoryScoreControlLine = scoreControlLineMap.get(nianfen + batch2 + majorType + kelei);
//文化成绩分
BigDecimal culturalScore = yxHistoryScoreControlLine.getCulturalScore();
//专业成绩分
BigDecimal specialScore = yxHistoryScoreControlLine.getSpecialScore();
if (sortType.equals("专业课上线,文化课排队")) {
//专过文排
yxHistoryMajorEnroll.setRulesEnrollProbability("专过文排");
BigDecimal wenhuaBl = new BigDecimal(wenhuaBili).divide(bigDecimal100, 4, RoundingMode.HALF_UP);
yxHistoryMajorEnroll.setControlLine(wenhuaBl.multiply(culturalScore));
} else if (sortType.equals("文化课上线,专业课排队")) {
//文过专排
yxHistoryMajorEnroll.setRulesEnrollProbability("文过专排");
BigDecimal zhuanyeBl = new BigDecimal(zhuanyeBili).divide(bigDecimal100, 4, RoundingMode.HALF_UP);
yxHistoryMajorEnroll.setControlLine(zhuanyeBl.multiply(specialScore));
} else if (sortType.equals("其他计算办法")) {
continue;
} else {
BigDecimal wenhuaBl = new BigDecimal(wenhuaBili).divide(bigDecimal100, 4, RoundingMode.HALF_UP);
BigDecimal zhuanyeBl = new BigDecimal(zhuanyeBili).divide(bigDecimal100, 4, RoundingMode.HALF_UP);
BigDecimal controlLine = wenhuaBl.multiply(culturalScore).add(zhuanyeBl.multiply(specialScore));
yxHistoryMajorEnroll.setControlLine(controlLine);
yxHistoryMajorEnroll.setRulesEnrollProbability("" + wenhuaBl.toString() + "" + zhuanyeBl.toString());
yxHistoryMajorEnroll.setProbabilityOperator("文*" + wenhuaBl.toString() + "专*" + zhuanyeBl.toString());
}
yxHistoryMajorEnroll.setBatch(batch);
yxHistoryMajorEnrollList.add(yxHistoryMajorEnroll);
}
Set<String> renameYuanxiaos = new HashSet<>();
for (LiNianShuJuDTO liNianShuJuDTO : notSchoolList) {
if (liNianShuJuDTO.getYuanxiao().contains("")) {
renameYuanxiaos.add(liNianShuJuDTO.getYuanxiao().replace(" ", "").replace("\n", ""));
}
}
if (CollectionUtils.isNotEmpty(renameYuanxiaos)) {
for (String renameYuanxiao : renameYuanxiaos) {
System.out.println(renameYuanxiao);
}
}
} catch (FileNotFoundException fileNotFoundException) {
log.error("文件不存在," + file.getAbsolutePath());
throw new RuntimeException(fileNotFoundException);
} catch (Exception e) {
System.out.println(index);
throw new RuntimeException(e);
}
//yxHistoryMajorEnrollService.saveBatch(yxHistoryMajorEnrollList);
System.out.println("未找到学校及专业的数据数量:" + notSchoolList.size());
return Result.error("文件导入成功!");
}
@PostMapping(value = "/importSchoolMajor")
public Result<?> importSchoolMajor() {
/*if(true){
@ -1557,34 +671,6 @@ public class YxSchoolController extends JeecgController<YxSchool, IYxSchoolServi
}
}
return Result.error("文件导入成功!");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\美术提前批.20231130112125080.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\美术A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\美术B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\美术高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\音乐提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\音乐A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\音乐B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\音乐高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\艺术舞蹈提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\艺术舞蹈A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\艺术舞蹈B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\艺术舞蹈高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\国标舞提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\国标舞A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\国标舞B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\国标舞高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\播音提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\播音A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\播音B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\播音高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\表演提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\表演A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\表演B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\表演高职高专.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\编导提前批.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\编导A段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\编导B段.xlsx");
//File file = new File("C:\\Users\\Denim\\Desktop\\艺术类表格\\编导高职高专.xlsx");
}
@ -1803,71 +889,6 @@ public class YxSchoolController extends JeecgController<YxSchool, IYxSchoolServi
return Result.error("文件导入成功!");
}
@RequestMapping(value = "/importSchoolIcon", method = RequestMethod.POST)
public Result<?> importSchoolIcon(HttpServletRequest request, HttpServletResponse response) {
//获取旧的院校信息
List<YxSchool> schoolList = yxSchoolService.oldList();
Map<String, String> schoolIconMap = schoolList.stream().collect(Collectors.toMap(YxSchool::getSchoolName, YxSchool::getSchoolIcon));
List<YxSchool> list = yxSchoolService.list();
String schoolIcon=null;
List<String> notSchoolIconOfSchoolNameList=new ArrayList<>();
for (YxSchool school : list) {
if (StringUtils.isNotBlank(school.getSchoolIcon())) {
//如果这个院校已经有图片了
continue;
}
schoolIcon = schoolIconMap.get(school.getSchoolName());
if (StringUtils.isBlank(schoolIcon)) {
notSchoolIconOfSchoolNameList.add(school.getSchoolName());
continue;
}
}
System.out.println("不存在的院校有:"+notSchoolIconOfSchoolNameList.size());
for (String s : notSchoolIconOfSchoolNameList) {
System.out.println(s);
}
if (CollectionUtils.isEmpty(notSchoolIconOfSchoolNameList)) {
yxSchoolService.updateBatchById(schoolList);
}
return Result.OK();
}
@RequestMapping(value = "/importExcelSchoolNew1", method = RequestMethod.POST)
public Result<?> importExcelSchoolNew1(HttpServletRequest request, HttpServletResponse response) {
List<YxHistoryMajorEnroll> historyMajorEnrollList = yxHistoryMajorEnrollService.list();
List<YxSchool> list = yxSchoolService.list();
Map<String, YxSchool> yxSchoolMap = list.stream().collect(Collectors.toMap(YxSchool::getSchoolName, l -> l));
List<YxSchoolChild> schoolChildList = yxSchoolChildService.list();
Map<String, YxSchoolChild> schoolChildMap = schoolChildList.stream().collect(Collectors.toMap(s -> s.getSchoolName() +"_"+ s.getSchoolCode(), s -> s));
Set<String> notSchoolNameSet=new HashSet<>();
String key=null;
YxSchoolChild yxSchoolChild= null;
List<YxSchoolChild> addSchoolList=new ArrayList<>();
Set<String> ids=new HashSet<>();
for (YxHistoryMajorEnroll yxHistoryMajorEnroll : historyMajorEnrollList) {
key =yxHistoryMajorEnroll.getSchoolName()+"_"+ yxHistoryMajorEnroll.getSchoolCode();
yxSchoolChild = schoolChildMap.get(key);
if (yxSchoolChild == null) {
notSchoolNameSet.add(key);
}
ids.add(yxSchoolChild.getSchoolId());
}
System.out.println("没找到的院校数量:"+notSchoolNameSet.size());
LambdaUpdateWrapper<YxSchool> yxSchoolLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
yxSchoolLambdaUpdateWrapper.in(YxSchool::getId,ids);
yxSchoolLambdaUpdateWrapper.set(YxSchool::getIsYs,"1");
yxSchoolService.update(yxSchoolLambdaUpdateWrapper);
/*if (CollectionUtils.isEmpty(notSchoolNameSet)) {
yxSchoolChildService.saveBatch(addSchoolList);
}*/
for (String s : notSchoolNameSet) {
System.out.println(s);
}
return Result.OK();
}
@RequestMapping(value = "/importExcelSchoolNew", method = RequestMethod.POST)
public Result<?> importExcelSchoolNew(HttpServletRequest request, HttpServletResponse response) {
// 获取上传文件对象

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.web.dto.ArtHotSchoolDTO;
import org.jeecg.modules.web.dto.ArtSchoolDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.mini.dto.MiniSchoolDTO;
@ -50,7 +51,9 @@ public interface YxSchoolMapper extends BaseMapper<YxSchool> {
*/
MiniSchoolDTO getMiniDtoBySchoolCode(@Param("schoolCode") String schoolCode);
List<ArtSchoolDTO> artSchoolList1(@Param("province") String province,@Param("schoolType") String schoolType);
List<ArtHotSchoolDTO> artSchoolList1(@Param("province") String province,@Param("schoolType") String schoolType);
List<ArtSchoolDTO> artSchoolList2(@Param("province") String province,@Param("schoolType") String schoolType );
List<ArtHotSchoolDTO> artSchoolList2(@Param("province") String province,@Param("schoolType") String schoolType );
List<ArtHotSchoolDTO> artSchoolListBySchoolCodeList(@Param("schoolCodeList") List<String> schoolCodeList);
}

View File

@ -423,64 +423,56 @@
WHERE s.school_name = #{schoolName} or sc.school_name = #{schoolName}
limit 1
</select>
<select id="artSchoolList1" resultType="org.jeecg.modules.web.dto.ArtSchoolDTO">
<select id="artSchoolList1" resultType="org.jeecg.modules.web.dto.ArtHotSchoolDTO">
SELECT
sc.school_name,
sc.school_code,
s.id,
s.school_icon,
s.school_nature,
s.institution_type,
s.school_type,
s.province,
s.city,
s.area,
s.street,
IFNULL(s.is211,"0") as is211,
IFNULL(s.is985,"0") as is985,
s.sfsyl,
s.sjyl,
s.gzsz,
s.gjtszy,
s.gzd,
s.yldx,
s.byl,
s.stszy,
s.is_strengthen,
s.tags
s.id,
sc.school_code,
sc.school_name,
s.school_type,
s.school_nature,
s.institution_type,
s.school_icon,
IFNULL(s.is211,"0") as is211,
IFNULL(s.is985,"0") as is985,
s.sfsyl
FROM yx_school_child sc
LEFT JOIN yx_school s ON sc.school_id = s.id
WHERE s.province = #{province} AND s.school_type = #{schoolType}
LIMIT 0,10
</select>
<select id="artSchoolList2" resultType="org.jeecg.modules.web.dto.ArtSchoolDTO">
<select id="artSchoolList2" resultType="org.jeecg.modules.web.dto.ArtHotSchoolDTO">
SELECT
sc.school_name,
sc.school_code,
s.id,
s.school_icon,
sc.school_code,
sc.school_name,
s.school_type,
s.school_nature,
s.institution_type,
s.school_type,
s.province,
s.city,
s.area,
s.street,
s.school_icon,
IFNULL(s.is211,"0") as is211,
IFNULL(s.is985,"0") as is985,
s.sfsyl,
s.sjyl,
s.gzsz,
s.gjtszy,
s.gzd,
s.yldx,
s.byl,
s.stszy,
s.is_strengthen,
s.tags
s.sfsyl
FROM yx_school_child sc
LEFT JOIN yx_school s ON sc.school_id = s.id
WHERE s.province != #{province} AND s.school_type = #{schoolType}
LIMIT 0,10
</select>
<select id="artSchoolListBySchoolCodeList" resultType="org.jeecg.modules.web.dto.ArtHotSchoolDTO">
SELECT
s.id,
sc.school_code,
sc.school_name,
s.school_type,
s.school_nature,
s.institution_type,
s.school_icon,
IFNULL(s.is211,"0") as is211,
IFNULL(s.is985,"0") as is985,
s.sfsyl
FROM yx_school_child sc
LEFT JOIN yx_school s ON sc.school_id = s.id
WHERE sc.school_code in
<foreach collection="schoolCodeList" index="index" item="b" open="(" separator="," close=")">#{b}</foreach>
ORDER BY FIELD(sc.school_code,<foreach collection="schoolCodeList" index="index" item="b" open="" separator="," close="">#{b}</foreach>)
</select>
</mapper>

View File

@ -22,8 +22,6 @@ public interface IYxSchoolService extends IService<YxSchool> {
Map<String,YxSchool> mapsForSchoolName();
YxSchoolDTO getBySchoolName(String schoolName);
List<YxSchool> oldList();
//PC前台端==================================================
/**
* PC前台端-院校列表查询
@ -32,7 +30,7 @@ public interface IYxSchoolService extends IService<YxSchool> {
ArtSchoolDTO getArtSchoolInfoBySchoolCode(String schoolCode);
ArtHotSchoolDTO hotList();
Map<String,Object> hotList();
//========================================================
//小程序代码=================================================
/**

View File

@ -1,11 +1,13 @@
package org.jeecg.modules.yx.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.web.dto.ArtHotSchoolDTO;
import org.jeecg.modules.web.dto.ArtSchoolDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
@ -41,7 +43,7 @@ public class YxSchoolServiceImpl extends ServiceImpl<YxSchoolMapper, YxSchool> i
@Resource
private IYxUserScoreService yxUserScoreService;
@Resource
private IYxArwuService yxArwuService;
private RedisUtil redisUtil;
///=========================小程序
@Override
public IPage<MiniSchoolDTO> miniSchoolSearch(QueryRecommendMajorVO queryRecommendMajorVO) {
@ -279,128 +281,108 @@ public class YxSchoolServiceImpl extends ServiceImpl<YxSchoolMapper, YxSchool> i
}
@Override
public List<YxSchool> oldList() {
return baseMapper.oldList();
}
@Override
public ArtHotSchoolDTO hotList() {
ArtHotSchoolDTO artHotSchoolDTO = new ArtHotSchoolDTO();
public Map<String,Object> hotList() {
Map<String,Object> resultMap = new HashMap<>();
//获取当前省份的学校
//获取本科
String province = "河南";
List<ArtSchoolDTO> nowProvinceBenSchoolList = baseMapper.artSchoolList1(province,"本科");
List<ArtSchoolDTO> nowProvinceZhuanSchoolList = baseMapper.artSchoolList1(province,"专科");
List<ArtHotSchoolDTO> nowProvinceBenSchoolList = baseMapper.artSchoolListBySchoolCodeList(Arrays.asList("6000","6005","6030","6010","6085","6110","6100","6105","6095","6080"));
List<ArtHotSchoolDTO> nowProvinceZhuanSchoolList = baseMapper.artSchoolList1(province,"专科");
//获取外省的学校
List<ArtSchoolDTO> otherProvinceBenSchoolList = baseMapper.artSchoolList2(province,"本科");
List<ArtSchoolDTO> otherProvinceZhuanSchoolList = baseMapper.artSchoolList2(province,"专科");
List<ArtHotSchoolDTO> otherProvinceBenSchoolList = baseMapper.artSchoolListBySchoolCodeList(Arrays.asList("1150","1410","1190","1125", "1400", "1280", "1355", "1495", "1210", "1165"));
List<ArtHotSchoolDTO> otherProvinceZhuanSchoolList = baseMapper.artSchoolList2(province,"专科");
String key = "hotSchool";
String json = null;
if(redisUtil.hasKey(key)){
json = (String) redisUtil.get(key);
resultMap = JSONObject.parseObject(json).toJavaObject(Map.class);
}else{
//处理标签
Set<String> tagsList;
List<String> list985211 = Arrays.asList("211", "985");
for (ArtHotSchoolDTO artSchoolDTO : nowProvinceBenSchoolList) {
tagsList = new LinkedHashSet<>();
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
artSchoolDTO.setTagsList(tagsList);
}
for (ArtHotSchoolDTO artSchoolDTO : nowProvinceZhuanSchoolList) {
tagsList = new LinkedHashSet<>();
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
artSchoolDTO.setTagsList(tagsList);
}
for (ArtHotSchoolDTO artSchoolDTO : otherProvinceBenSchoolList) {
tagsList = new LinkedHashSet<>();
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
artSchoolDTO.setTagsList(tagsList);
}
for (ArtHotSchoolDTO artSchoolDTO : otherProvinceZhuanSchoolList) {
tagsList = new LinkedHashSet<>();
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
artSchoolDTO.setTagsList(tagsList);
}
//处理标签
Set<String> tagsList;
List<String> list985211 = Arrays.asList("211", "985");
String tags = null;
for (ArtSchoolDTO artSchoolDTO : nowProvinceBenSchoolList) {
tagsList = new LinkedHashSet<>();
//处理 标签字符串转 array
tags = artSchoolDTO.getTags();
if (StringUtils.isNotEmpty(tags)) {
tagsList = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(tags.split(","))));
}
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
artSchoolDTO.setTagsList(tagsList);
resultMap.put("nowProvinceBenSchoolList",nowProvinceBenSchoolList);
resultMap.put("nowProvinceZhuanSchoolList",nowProvinceZhuanSchoolList);
resultMap.put("otherProvinceBenSchoolList",otherProvinceBenSchoolList);
resultMap.put("otherProvinceZhuanSchoolList",otherProvinceZhuanSchoolList);
redisUtil.set(key,JSONObject.toJSONString(resultMap),360);
}
for (ArtSchoolDTO artSchoolDTO : nowProvinceZhuanSchoolList) {
tagsList = new LinkedHashSet<>();
//处理 标签字符串转 array
tags = artSchoolDTO.getTags();
if (StringUtils.isNotEmpty(tags)) {
tagsList = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(tags.split(","))));
}
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
artSchoolDTO.setTagsList(tagsList);
}
for (ArtSchoolDTO artSchoolDTO : otherProvinceBenSchoolList) {
tagsList = new LinkedHashSet<>();
//处理 标签字符串转 array
tags = artSchoolDTO.getTags();
if (StringUtils.isNotEmpty(tags)) {
tagsList = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(tags.split(","))));
}
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
artSchoolDTO.setTagsList(tagsList);
}
for (ArtSchoolDTO artSchoolDTO : otherProvinceZhuanSchoolList) {
tagsList = new LinkedHashSet<>();
//处理 标签字符串转 array
tags = artSchoolDTO.getTags();
if (StringUtils.isNotEmpty(tags)) {
tagsList = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(tags.split(","))));
}
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
artSchoolDTO.setTagsList(tagsList);
}
artHotSchoolDTO.setNowProvinceBenSchoolList(nowProvinceBenSchoolList);
artHotSchoolDTO.setNowProvinceZhuanSchoolList(nowProvinceZhuanSchoolList);
artHotSchoolDTO.setOtherProvinceBenSchoolList(otherProvinceBenSchoolList);
artHotSchoolDTO.setOtherProvinceZhuanSchoolList(otherProvinceZhuanSchoolList);
return artHotSchoolDTO;
return resultMap;
}
}