From 519db33c65082b6fbfa1058cf7988a5e781dda73 Mon Sep 17 00:00:00 2001 From: zhouwentao <1577701412@qq.com> Date: Mon, 3 Jun 2024 16:43:58 +0800 Subject: [PATCH] =?UTF-8?q?updates=20=E4=BC=98=E5=8C=96=E7=83=AD=E9=97=A8?= =?UTF-8?q?=E9=99=A2=E6=A0=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/web/dto/ArtHotSchoolDTO.java | 34 +- .../yx/controller/YxSchoolController.java | 979 ------------------ .../modules/yx/mapper/YxSchoolMapper.java | 7 +- .../modules/yx/mapper/xml/YxSchoolMapper.xml | 78 +- .../modules/yx/service/IYxSchoolService.java | 4 +- .../yx/service/impl/YxSchoolServiceImpl.java | 220 ++-- 6 files changed, 168 insertions(+), 1154 deletions(-) diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/web/dto/ArtHotSchoolDTO.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/web/dto/ArtHotSchoolDTO.java index c397be7..5f3b016 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/web/dto/ArtHotSchoolDTO.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/web/dto/ArtHotSchoolDTO.java @@ -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 nowProvinceBenSchoolList; - //本省 专科院校 - List nowProvinceZhuanSchoolList; - //外省 本科院校 - List otherProvinceBenSchoolList; - //外省 专科院校 - List 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 tagsList; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/controller/YxSchoolController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/controller/YxSchoolController.java index 6bc6849..15eb997 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/controller/YxSchoolController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/controller/YxSchoolController.java @@ -238,892 +238,6 @@ public class YxSchoolController extends JeecgController 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 schoolList = yxSchoolService.list(new LambdaQueryWrapper().isNotNull(YxSchool::getSchoolCode)); - - //本科(职业教育) - Map majorNameZyMap = new LinkedHashMap<>(); - - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if (file.getName().contains("高职高专")) { - //高职高专 - queryWrapper.eq(YxMajor::getEducationalLevel, "2"); - } else { - //本科 - queryWrapper.eq(YxMajor::getEducationalLevel, "1"); - queryWrapper.eq(YxMajor::getIsVte, "0"); - } - List 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 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 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 historyScoreControlLineList = yxHistoryScoreControlLineService.list(yxHistoryScoreControlLineLambdaQueryWrapper); - Map scoreControlLineMap = historyScoreControlLineList.stream().collect(Collectors.toMap(h -> h.getYear() + h.getBatch() + h.getProfessionalCategory() + h.getCategory(), h -> h)); - Map schoolNameMap = schoolList.stream().collect(Collectors.toMap(YxSchool::getSchoolCode, s -> s)); - Map majorNameMap = majorList.stream().collect(Collectors.toMap(YxMajor::getMajorName, m -> m)); - Set notSchoolList = new HashSet<>(); - List yxHistoryMajorEnrollList = new ArrayList<>(); - try { - fileInputStream = new FileInputStream(file); - List 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 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 schoolList = yxSchoolService.list(new LambdaQueryWrapper().isNotNull(YxSchool::getSchoolCode)); - - //本科(职业教育) - Map majorNameZyMap = new LinkedHashMap<>(); - - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if (file.getName().contains("高职高专")) { - //高职高专 - queryWrapper.eq(YxMajor::getEducationalLevel, "2"); - } else { - //本科 - queryWrapper.eq(YxMajor::getEducationalLevel, "1"); - queryWrapper.eq(YxMajor::getIsVte, "0"); - } - List 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 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 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 historyScoreControlLineList = yxHistoryScoreControlLineService.list(yxHistoryScoreControlLineLambdaQueryWrapper); - Map scoreControlLineMap = historyScoreControlLineList.stream().collect(Collectors.toMap(h -> h.getYear() + h.getBatch() + h.getProfessionalCategory() + h.getCategory(), h -> h)); - Map schoolNameMap = schoolList.stream().collect(Collectors.toMap(YxSchool::getSchoolCode, s -> s)); - Map majorNameMap = majorList.stream().collect(Collectors.toMap(YxMajor::getMajorName, m -> m)); - Set notSchoolList = new HashSet<>(); - List yxHistoryMajorEnrollList = new ArrayList<>(); - try { - fileInputStream = new FileInputStream(file); - List 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 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 importSchoolIcon(HttpServletRequest request, HttpServletResponse response) { - //获取旧的院校信息, - List schoolList = yxSchoolService.oldList(); - Map schoolIconMap = schoolList.stream().collect(Collectors.toMap(YxSchool::getSchoolName, YxSchool::getSchoolIcon)); - List list = yxSchoolService.list(); - String schoolIcon=null; - List 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 historyMajorEnrollList = yxHistoryMajorEnrollService.list(); - List list = yxSchoolService.list(); - Map yxSchoolMap = list.stream().collect(Collectors.toMap(YxSchool::getSchoolName, l -> l)); - List schoolChildList = yxSchoolChildService.list(); - Map schoolChildMap = schoolChildList.stream().collect(Collectors.toMap(s -> s.getSchoolName() +"_"+ s.getSchoolCode(), s -> s)); - Set notSchoolNameSet=new HashSet<>(); - String key=null; - YxSchoolChild yxSchoolChild= null; - List addSchoolList=new ArrayList<>(); - Set 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 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) { // 获取上传文件对象 diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/mapper/YxSchoolMapper.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/mapper/YxSchoolMapper.java index b952dfe..562959a 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/mapper/YxSchoolMapper.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/mapper/YxSchoolMapper.java @@ -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 { */ MiniSchoolDTO getMiniDtoBySchoolCode(@Param("schoolCode") String schoolCode); - List artSchoolList1(@Param("province") String province,@Param("schoolType") String schoolType); + List artSchoolList1(@Param("province") String province,@Param("schoolType") String schoolType); - List artSchoolList2(@Param("province") String province,@Param("schoolType") String schoolType ); + List artSchoolList2(@Param("province") String province,@Param("schoolType") String schoolType ); + + List artSchoolListBySchoolCodeList(@Param("schoolCodeList") List schoolCodeList); } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/mapper/xml/YxSchoolMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/mapper/xml/YxSchoolMapper.xml index 8532a82..35a9816 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/mapper/xml/YxSchoolMapper.xml +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/mapper/xml/YxSchoolMapper.xml @@ -423,64 +423,56 @@ WHERE s.school_name = #{schoolName} or sc.school_name = #{schoolName} limit 1 - 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 - 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 + diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/IYxSchoolService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/IYxSchoolService.java index e558448..b2d8165 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/IYxSchoolService.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/IYxSchoolService.java @@ -22,8 +22,6 @@ public interface IYxSchoolService extends IService { Map mapsForSchoolName(); YxSchoolDTO getBySchoolName(String schoolName); - List oldList(); - //PC前台端================================================== /** * PC前台端-院校列表查询 @@ -32,7 +30,7 @@ public interface IYxSchoolService extends IService { ArtSchoolDTO getArtSchoolInfoBySchoolCode(String schoolCode); - ArtHotSchoolDTO hotList(); + Map hotList(); //======================================================== //小程序代码================================================= /** diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/impl/YxSchoolServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/impl/YxSchoolServiceImpl.java index b6c42b5..39e974d 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/impl/YxSchoolServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/impl/YxSchoolServiceImpl.java @@ -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 i @Resource private IYxUserScoreService yxUserScoreService; @Resource - private IYxArwuService yxArwuService; + private RedisUtil redisUtil; ///=========================小程序 @Override public IPage miniSchoolSearch(QueryRecommendMajorVO queryRecommendMajorVO) { @@ -279,128 +281,108 @@ public class YxSchoolServiceImpl extends ServiceImpl i } @Override - public List oldList() { - return baseMapper.oldList(); - } - - @Override - public ArtHotSchoolDTO hotList() { - ArtHotSchoolDTO artHotSchoolDTO = new ArtHotSchoolDTO(); - + public Map hotList() { + Map resultMap = new HashMap<>(); //获取当前省份的学校 - //获取本科 String province = "河南"; - List nowProvinceBenSchoolList = baseMapper.artSchoolList1(province,"本科"); - List nowProvinceZhuanSchoolList = baseMapper.artSchoolList1(province,"专科"); - + List nowProvinceBenSchoolList = baseMapper.artSchoolListBySchoolCodeList(Arrays.asList("6000","6005","6030","6010","6085","6110","6100","6105","6095","6080")); + List nowProvinceZhuanSchoolList = baseMapper.artSchoolList1(province,"专科"); //获取外省的学校 - List otherProvinceBenSchoolList = baseMapper.artSchoolList2(province,"本科"); - List otherProvinceZhuanSchoolList = baseMapper.artSchoolList2(province,"专科"); + List otherProvinceBenSchoolList = baseMapper.artSchoolListBySchoolCodeList(Arrays.asList("1150","1410","1190","1125", "1400", "1280", "1355", "1495", "1210", "1165")); + List 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 tagsList; + List 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 tagsList; - List 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; } }