updates 删除院校表部分字段

This commit is contained in:
zhouwentao 2024-06-21 18:17:00 +08:00
parent 580dd09462
commit 6ef570095a
10 changed files with 39 additions and 716 deletions

View File

@ -98,12 +98,6 @@ public class MiniSchoolDTO implements Serializable {
@ApiModelProperty(value = "标签")
private Set<String> tagsList;
/**
* 旧院校名称
*/
@Excel(name = "旧院校名称", width = 15)
@ApiModelProperty(value = "旧院校名称")
private String oldSchoolName;
/**
* 统一代码
*/

View File

@ -98,12 +98,6 @@ public class ArtSchoolDTO implements Serializable {
@ApiModelProperty(value = "标签")
private Set<String> tagsList;
/**
* 旧院校名称
*/
@Excel(name = "旧院校名称", width = 15)
@ApiModelProperty(value = "旧院校名称")
private java.lang.String oldSchoolName;
/**
* 统一代码
*/

View File

@ -30,9 +30,6 @@ public class RecommendMajorDTO implements Serializable {
private String schoolCode;
@ApiModelProperty(value = "学校图标")
private String schoolIcon;
@ApiModelProperty(value = "院校代码")
private String institutionCode;
@ApiModelProperty(value = "省市")
private String province;
@ApiModelProperty(value = "办学类型")

View File

@ -120,6 +120,7 @@ public class YxHistoryMajorEnrollController extends JeecgController<YxHistoryMaj
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody YxHistoryMajorEnroll yxHistoryMajorEnroll) {
String id = yxHistoryMajorEnroll.getId();
String majorCode = yxHistoryMajorEnroll.getMajorCode();
String majorName = yxHistoryMajorEnroll.getMajorName();
String schoolCode = yxHistoryMajorEnroll.getSchoolCode();
@ -128,8 +129,13 @@ public class YxHistoryMajorEnrollController extends JeecgController<YxHistoryMaj
AssertUtils.notEmpty(majorName, "请输入[专业名称]!");
AssertUtils.notNull(yxHistoryMajorEnroll.getYear(), "请输入[年份]!");
//AssertUtils.notTrue(yxHistoryMajorEnrollService.exist(yxHistoryMajorEnroll), String.format("专业-[%s]-已经录入", majorCode));
yxHistoryMajorEnrollService.updateById(yxHistoryMajorEnroll);
return Result.OK("编辑成功!");
if (StringUtils.isNotBlank(id)) {
yxHistoryMajorEnrollService.updateById(yxHistoryMajorEnroll);
return Result.OK("编辑成功!");
}else{
yxHistoryMajorEnrollService.save(yxHistoryMajorEnroll);
return Result.OK("保存成功!");
}
}
/**

View File

@ -205,14 +205,14 @@ public class YxSchoolController extends JeecgController<YxSchool, IYxSchoolServi
try {
List<YxSchool> list = ExcelImportUtil.importExcel(file.getInputStream(), YxSchool.class, params);
if (CollectionUtils.isNotEmpty(list)) {
for (YxSchool yxSchool : list) {
long count = service.count(new LambdaQueryWrapper<YxSchool>().eq(YxSchool::getSchoolCode, yxSchool.getSchoolCode()));
if (count > 0) {
return Result.error(String.format("文件导入失败:学校代码-%s-已存在!", yxSchool.getSchoolCode()));
}
}
}
// if (CollectionUtils.isNotEmpty(list)) {
// for (YxSchool yxSchool : list) {
// long count = service.count(new LambdaQueryWrapper<YxSchool>().eq(YxSchool::getSchoolCode, yxSchool.getSchoolCode()));
// if (count > 0) {
// return Result.error(String.format("文件导入失败:学校代码-%s-已存在!", yxSchool.getSchoolCode()));
// }
// }
// }
//update-begin-author:taoyan date:20190528 for:批量插入数据
long start = System.currentTimeMillis();
service.saveBatch(list);
@ -240,21 +240,6 @@ public class YxSchoolController extends JeecgController<YxSchool, IYxSchoolServi
@PostMapping(value = "/importSchoolMajor")
public Result<?> importSchoolMajor() {
/*if(true){
LambdaQueryWrapper<YxHistoryMajorEnroll> yxHistoryMajorEnrollLambdaQueryWrapper = new LambdaQueryWrapper<>();
yxHistoryMajorEnrollLambdaQueryWrapper.groupBy(YxHistoryMajorEnroll::getSchoolCode);
List<YxHistoryMajorEnroll> list1 = yxHistoryMajorEnrollService.list(yxHistoryMajorEnrollLambdaQueryWrapper);
LambdaUpdateWrapper<YxSchool> yxSchoolLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
for (YxHistoryMajorEnroll yxHistoryMajorEnroll : list1) {
yxSchoolLambdaUpdateWrapper.clear();
yxSchoolLambdaUpdateWrapper.eq(YxSchool::getSchoolCode,yxHistoryMajorEnroll.getSchoolCode());
yxSchoolLambdaUpdateWrapper.set(YxSchool::getInstitutionCode,yxHistoryMajorEnroll.getInstitutionCode());
yxSchoolService.update(yxSchoolLambdaUpdateWrapper);
}
return Result.OK();
}*/
//将本科专业 入库
//获取 本科 专业 分类
LambdaQueryWrapper<YxFirstLevelDisciplines> yxFirstLevelDisciplinesLambdaQueryWrapper = new LambdaQueryWrapper<>();
@ -352,647 +337,4 @@ public class YxSchoolController extends JeecgController<YxSchool, IYxSchoolServi
return Result.OK();
}
@RequestMapping(value = "/importExcel4", method = RequestMethod.POST)
public Result<?> importExcel4(HttpServletRequest request, HttpServletResponse response) {
// 获取上传文件对象
File fileMaster = new File("C:\\Users\\Denim\\Desktop\\艺术类表格2");
for (File file : fileMaster.listFiles()) {
FileInputStream fileInputStream = null;
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setNeedSave(true);
int index = 0;
List<YxSchool> schoolList = yxSchoolService.list();
//本科(职业教育)
Map<String, YxMajor> majorNameZyMap = new LinkedHashMap<>();
LambdaQueryWrapper<YxMajor> queryWrapper = new LambdaQueryWrapper<YxMajor>();
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;
if (file.getName().contains("A段")) {
batch = "本科A段";
} else if (file.getName().contains("提前批")) {
batch = "提前批";
} else if (file.getName().contains("高职高专")) {
batch = "高职高专";
} else if (file.getName().contains("B段")) {
batch = "本科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));
}
String type = null;
LambdaQueryWrapper<YxHistoryScoreControlLine> yxHistoryScoreControlLineLambdaQueryWrapper = new LambdaQueryWrapper<>();
if (file.getName().contains("美术")) {
type = "美术类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory, "美术类");
} else if (file.getName().contains("音乐")) {
type = "音乐类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory, "音乐类");
} else if (file.getName().contains("艺术舞蹈")) {
type = "艺术舞蹈类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory, "艺术舞蹈类");
} else if (file.getName().contains("国标舞")) {
type = "国际标准舞类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory, "国际标准舞类");
} else if (file.getName().contains("编导")) {
type = "编导制作类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory, "编导制作类");
} else if (file.getName().contains("播音")) {
type = "播音与主持类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory, "播音与主持类");
} else if (file.getName().contains("表演")) {
type = "表演类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory, "表演类");
} else if (file.getName().contains("书法")) {
type = "书法类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory, "书法类");
} else if (file.getName().contains("体育")) {
type = "体育类";
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory, "体育类");
}
List<YxHistoryScoreControlLine> historyScoreControlLineList = yxHistoryScoreControlLineService.list(yxHistoryScoreControlLineLambdaQueryWrapper);
Map<String, YxHistoryScoreControlLine> scoreControlLineMap = historyScoreControlLineList.stream().collect(Collectors.toMap(h -> h.getYear() + h.getProfessionalCategory(), h -> h));
Map<String, YxSchool> schoolNameMap = schoolList.stream().collect(Collectors.toMap(s -> s.getSchoolName(), s -> s));
Map<String, YxMajor> majorNameMap = majorList.stream().collect(Collectors.toMap(m -> m.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;
LambdaQueryWrapper<YxSchoolMajor> yxSchoolMajorLambdaQueryWrapper = null;
BigDecimal bigDecimal100 = new BigDecimal(100);
for (LiNianShuJuDTO liNianShuJuDTO : list) {
index++;
if (index == 899) {
//index++;
System.out.println(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 (yuanxiao.contains("燕京理工学院")) {
System.out.println("111");
}
if (schoolName.contains("中外合作") || schoolName.contains("(原") || schoolName.contains("(源")) {
ii1 = schoolName.indexOf("");
if (ii1 != -1) {
schoolName = schoolName.substring(0, ii1);
}
}
YxSchool school = schoolNameMap.get(schoolName);
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 (zhuanyeName.contains("媒体营销")) {
continue;
}
if (zhuanyeName.contains("服装表演")) {
continue;
}
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";
}
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(type);
//排序方法
yxHistoryScoreControlLine = scoreControlLineMap.get(nianfen + kelei);
//文化成绩分
BigDecimal culturalScore = yxHistoryScoreControlLine.getCulturalScore();
//专业成绩分
BigDecimal specialScore = yxHistoryScoreControlLine.getSpecialScore();
if (sortType.equals("专业课上线,文化课排队")) {
//专过文排
yxHistoryMajorEnroll.setRulesEnrollProbability("专过文排");
BigDecimal wenhuaBl = new BigDecimal(wenhuaBili).divide(bigDecimal100, 2, RoundingMode.HALF_UP);
yxHistoryMajorEnroll.setControlLine(wenhuaBl.multiply(culturalScore));
} else if (sortType.equals("文化课上线,专业课排队")) {
//文过专排
yxHistoryMajorEnroll.setRulesEnrollProbability("文过专排");
BigDecimal zhuanyeBl = new BigDecimal(zhuanyeBili).divide(bigDecimal100, 2, RoundingMode.HALF_UP);
yxHistoryMajorEnroll.setControlLine(zhuanyeBl.multiply(specialScore));
} else if (sortType.equals("其他计算办法")) {
continue;
} else {
BigDecimal wenhuaBl = new BigDecimal(wenhuaBili).divide(bigDecimal100, 2, RoundingMode.HALF_UP);
BigDecimal zhuanyeBl = new BigDecimal(zhuanyeBili).divide(bigDecimal100, 2, RoundingMode.HALF_UP);
yxHistoryMajorEnroll.setControlLine(wenhuaBl.multiply(culturalScore).add(zhuanyeBl.multiply(specialScore)));
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 (StringIndexOutOfBoundsException e) {
} catch (Exception e) {
System.out.println(index);
throw new RuntimeException(e);
}
yxHistoryMajorEnrollService.saveBatch(yxHistoryMajorEnrollList);
System.out.println("未找到学校及专业的数据数量:" + notSchoolList.size());
System.out.println(file.getName() + "_文件导入成功");
if (notSchoolList.size() > 0) {
break;
}
}
return Result.error("文件导入成功!");
}
@RequestMapping(value = "/importExcel5", method = RequestMethod.POST)
public Result<?> importExcel5(HttpServletRequest request, HttpServletResponse response) {
List<YxHistoryScoreControlLine> historyScoreControlLineList = yxHistoryScoreControlLineService.list(new LambdaQueryWrapper<YxHistoryScoreControlLine>().eq(YxHistoryScoreControlLine::getYear, "2023"));
Map<String, YxHistoryScoreControlLine> historyScoreControlLineMap = new LinkedHashMap<>();
for (YxHistoryScoreControlLine controlLine : historyScoreControlLineList) {
historyScoreControlLineMap.put(controlLine.getYear() + "_" + controlLine.getBatch() + "_" + controlLine.getCategory() + "_" + controlLine.getProfessionalCategory(), controlLine);
}
// 获取上传文件对象
if (true) {
List<YxHistoryMajorEnroll> historyMajorEnrollList = null;
List<YxSchoolMajor> yxSchoolMajorList = yxSchoolMajorService.list(new LambdaQueryWrapper<YxSchoolMajor>().isNull(YxSchoolMajor::getMajorType));
Map<String, YxHistoryMajorEnroll> yxHistoryMajorEnrollMap = new LinkedHashMap<>();
LambdaQueryWrapper<YxHistoryMajorEnroll> yxHistoryMajorEnrollLambdaQueryWrapper = new LambdaQueryWrapper<>();
for (YxSchoolMajor yxSchoolMajor : yxSchoolMajorList) {
yxHistoryMajorEnrollLambdaQueryWrapper.clear();
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getBatch, yxSchoolMajor.getBatch());
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getCategory, yxSchoolMajor.getCategory());
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getSchoolCode, yxSchoolMajor.getSchoolCode());
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getMajorName, yxSchoolMajor.getMajorName());
yxHistoryMajorEnrollLambdaQueryWrapper.orderByDesc(YxHistoryMajorEnroll::getYear);
historyMajorEnrollList = yxHistoryMajorEnrollService.list(yxHistoryMajorEnrollLambdaQueryWrapper);
//String key =yxSchoolMajor.getBatch()+"_"+yxSchoolMajor.getCategory()+"_"+yxSchoolMajor.getSchoolCode()+"_"+yxSchoolMajor.getMajorName();
/*if (CollectionUtils.isEmpty(historyMajorEnrollList)) {
continue;
}*/
if (CollectionUtils.isNotEmpty(historyMajorEnrollList)) {
YxHistoryMajorEnroll yxHistoryMajorEnroll = historyMajorEnrollList.get(0);
yxSchoolMajor.setRulesEnrollProbability(yxHistoryMajorEnroll.getRulesEnrollProbability());
yxSchoolMajor.setProbabilityOperator(yxHistoryMajorEnroll.getProbabilityOperator());
yxSchoolMajor.setMajorType(yxHistoryMajorEnroll.getMajorType());
} else {
yxHistoryMajorEnrollLambdaQueryWrapper.clear();
yxHistoryMajorEnrollLambdaQueryWrapper.last("limit 0,1");
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getMajorCode, yxSchoolMajor.getMajorCode());
YxHistoryMajorEnroll one = yxHistoryMajorEnrollService.getOne(yxHistoryMajorEnrollLambdaQueryWrapper);
if (one != null) {
yxSchoolMajor.setMajorType(one.getMajorType());
}
}
String batch = yxSchoolMajor.getBatch();
if (yxSchoolMajor.getBatch().equals("提前批")) {
batch = "本科A段";
} else if (yxSchoolMajor.getBatch().equals("高职高专")) {
batch = "高职高专";
}
if (yxSchoolMajor.getMajorType() != null) {
YxHistoryScoreControlLine yxHistoryScoreControlLine = historyScoreControlLineMap.get("2023_" + batch + "_" + yxSchoolMajor.getCategory() + "_" + yxSchoolMajor.getMajorType());
BigDecimal culturalScore = yxHistoryScoreControlLine.getCulturalScore();
BigDecimal specialScore = yxHistoryScoreControlLine.getSpecialScore();
yxSchoolMajor.setCulturalControlLine(culturalScore);
yxSchoolMajor.setSpecialControlLine(specialScore);
}
}
yxSchoolMajorService.updateBatchById(yxSchoolMajorList);
} else {
File file = new File("C:\\Users\\Denim\\Desktop\\数据信息\\2023河南招生计划统计.xlsx");
FileInputStream fileInputStream = null;
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setNeedSave(true);
int i = 0;
try {
fileInputStream = new FileInputStream(file);
List<SchoolMajorImport3> list = ExcelImportUtil.importExcel(fileInputStream, SchoolMajorImport3.class, params);
List<YxSchool> schoolList = yxSchoolService.list(new LambdaQueryWrapper<YxSchool>().isNotNull(YxSchool::getSchoolCode));
List<YxMajor> majorList = yxMajorService.list(new LambdaQueryWrapper<YxMajor>().isNotNull(YxMajor::getMajorCode));
Map<String, YxSchool> schoolMap = schoolList.stream().collect(Collectors.toMap(YxSchool::getSchoolCode, c -> c));
Map<String, YxMajor> majorMap = new LinkedHashMap<>();
Map<String, YxMajor> majorZhuanMap = new LinkedHashMap<>();
for (YxMajor yxMajor : majorList) {
if (yxMajor.getEducationalLevel().equals("1")) {
//本科
majorMap.put(yxMajor.getMajorName(), yxMajor);
} else {
//
majorZhuanMap.put(yxMajor.getMajorName(), yxMajor);
}
}
YxSchool school = null;
List<YxSchoolMajor> schoolMajorList = new ArrayList<>();
List<YxHistoryMajorEnroll> historyMajorEnrollList2023 = new ArrayList<>();
YxSchoolMajor schoolMajor = null;
//同步 学校专业关联信息
if (true) {
Set<SchoolMajorImport3> notSchoolList = new HashSet<>();
YxSchool school1 = null;
String batch = null;
String category = null;
String jhs = null;
String yxmc = null;
String yxdm = null;
String zymc = null;
String zydm = null;
String zspc = null;
String xf = null;
String zybz = null;
String zyyx = null;
YxMajor major = null;
String majorType = null;
boolean wenli = false;
for (SchoolMajorImport3 schoolMajorImport3 : list) {
wenli = false;
i++;
yxmc = schoolMajorImport3.getYxmc();//院校名称
yxdm = schoolMajorImport3.getYxdm();//院校代码
zymc = schoolMajorImport3.getZymc();//专业名称
zydm = schoolMajorImport3.getZydm();//专业代码
zspc = schoolMajorImport3.getZspc();//招生批次
jhs = schoolMajorImport3.getJhs();//计划数
xf = schoolMajorImport3.getXf();//学费
zybz = schoolMajorImport3.getZybz();//专业备注
zymc = zymc.replace("(", "");
zymc = zymc.replace(")", "");
//先屏蔽体育
//if (zymc.contains("体育") || zspc.contains("体育")) {
if (!zymc.contains("体育") || !zspc.contains("体育")) {
continue;
}
school1 = schoolMap.get(yxdm);
//获取没找到的学校
if (school1 == null) {
notSchoolList.add(schoolMajorImport3);
continue;
}
//判断批次
if (true) {
if (zspc.contains("本科提前批")) {
batch = "提前批";
} else if (zspc.contains("本科A段")) {
batch = "本科A段";
} else if (zspc.contains("本科B段")) {
batch = "本科B段";
} else if (zspc.contains("本科")) {
batch = "本科";
} else if (zspc.contains("高职高专")) {
batch = "高职高专";
} else {
notSchoolList.add(schoolMajorImport3);
continue;
}
}
//文理分科
if (true) {
if (zspc.contains("文科") && zspc.contains("理科")) {
wenli = true;
//文理同招
} else if (zspc.contains("文科")) {
category = "文科";
} else if (zspc.contains("理科")) {
category = "理科";
} else {
notSchoolList.add(schoolMajorImport3);
continue;
}
if (yxmc.contains("河南大学") && zydm.equals("01")) {
System.out.println("111");
}
}
//获取专业信息表数据
String majorName = zymc;
int start = zymc.indexOf("");
int lasti = zymc.indexOf("");
if (start != -1) {
majorName = majorName.substring(0, start);
}
major = null;
if (batch.equals("高职高专")) {
//高职高专
major = majorZhuanMap.get(majorName);
} else {
//本科
major = majorMap.get(majorName);
}
if (major == null) {
notSchoolList.add(schoolMajorImport3);
continue;
}
schoolMajor = new YxSchoolMajor();
schoolMajor.setSchoolCode(school1.getSchoolCode());//院校代码
schoolMajor.setMajorCode(major.getMajorCode());//专业代码
schoolMajor.setMajorName(zymc);//专业名称
schoolMajor.setTuition(xf.contains("待定") ? new BigDecimal("0") : new BigDecimal(xf));//学费
schoolMajor.setDetail(zybz);//专业备注
schoolMajor.setCategory(category);//科类
//schoolMajor.setRulesEnrollProbability()
schoolMajor.setBatch(batch);
schoolMajor.setEnrollmentCode(zydm);//专业代码
schoolMajor.setMajorType(null);
if (StringUtils.isNotBlank(jhs)) {
schoolMajor.setPlanNum(Integer.valueOf(jhs));
}
schoolMajorList.add(schoolMajor);
}
System.out.println("没找到的学校");
System.out.println(notSchoolList.size());
if (CollectionUtils.isEmpty(notSchoolList) && CollectionUtils.isNotEmpty(schoolMajorList)) {
yxSchoolMajorService.saveBatch(schoolMajorList);
}
}
} catch (FileNotFoundException fileNotFoundException) {
log.error("文件不存在," + file.getAbsolutePath());
throw new RuntimeException(fileNotFoundException);
} catch (Exception e) {
System.out.println("错误index:" + i);
throw new RuntimeException(e);
}
}
return Result.error("文件导入成功!");
}
@RequestMapping(value = "/importExcelSchoolNew", method = RequestMethod.POST)
public Result<?> importExcelSchoolNew(HttpServletRequest request, HttpServletResponse response) {
// 获取上传文件对象
File file = new File("C:\\Users\\Denim\\Desktop\\01.大学院校基础信息表3237所大学.xlsx");
FileInputStream fileInputStream = null;
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setNeedSave(true);
int i = 0;
try {
fileInputStream = new FileInputStream(file);
List<SchoolImport2> list = ExcelImportUtil.importExcel(fileInputStream, SchoolImport2.class, params);
List<YxSchool> schoolList = new ArrayList<>(); //yxSchoolService.list(new LambdaQueryWrapper<YxSchool>());
Map<String, YxSchool> yxSchoolMap = new LinkedHashMap<>();
for (YxSchool school : schoolList) {
yxSchoolMap.put(school.getSchoolName(),school);
}
//schoolList.stream().collect(Collectors.toMap(YxSchool::getSchoolName, s -> s));
YxSchool oldSchool = null;
List<SchoolImport2> notSchoolList = new ArrayList<>();
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
for (SchoolImport2 school : list) {
i++;
oldSchool = new YxSchool();
//新院校名称
if (StringUtils.isNotBlank(school.getXyxmc())) {
oldSchool.setSchoolName(school.getXyxmc().replace("(","").replace(")",""));
oldSchool.setOldSchoolName(school.getXxmc().replace("(","").replace(")",""));
}else{
oldSchool.setSchoolName(school.getXxmc().replace("(","").replace(")",""));
}
oldSchool.setNumId(String.valueOf(i));
oldSchool.setProvince(school.getSzs());//所在省
oldSchool.setCity(school.getCs());//城市
oldSchool.setInstitutionType(school.getLx());//类型
//隶属单位
oldSchool.setAffiliation(school.getLsdw());
//是否985
String is985 = school.getIs985();
if (StringUtils.isBlank(is985)) {
is985 = "0";
}
//是否211
String is211 = school.getIs211();
if (StringUtils.isBlank(is211)) {
is211 = "0";
}
oldSchool.setIs985(Integer.valueOf(is985));
oldSchool.setIs211(Integer.valueOf(is211));
oldSchool.setSchoolNature(school.getGsxz());
oldSchool.setYldx(school.getYldx()); //一流大学
oldSchool.setGzsz(school.getGzsz());//国重/省重
oldSchool.setSchoolType(school.getBkzk());//本科/高职高专
oldSchool.setByl(school.getByl());//保研率
oldSchool.setGjtszy(school.getGjtszy());//国家特色专业
oldSchool.setStszy(school.getStszy());//省特色专业
oldSchool.setGzd(school.getSfgzd());//是否国重点
oldSchool.setSjyl(school.getSjyl());//世界一流
oldSchool.setSfsyl(school.getSfsyl());//是否双一流
// if (StringUtils.isNotBlank(school.getSsd())) {
// oldSchool.setMasterPoint(Integer.valueOf(school.getSsd()));//硕士点
// }else{
// oldSchool.setMasterPoint(0);
// }
// if (StringUtils.isNotBlank(school.getBsd())) {
// oldSchool.setDoctoralPoint(Integer.valueOf(school.getBsd()));//博士点
// }else{
// oldSchool.setDoctoralPoint(0);
// }
//成立时间
if (StringUtils.isNotBlank(school.getClsj()) && !school.getClsj().equals("-") && !school.getClsj().equals("0")) {
oldSchool.setSchoolOpenDate(school.getClsj());
}
oldSchool.setSchoolPhone(school.getZbdh());//招办电话
oldSchool.setSchoolEmail(school.getDzyx());//电子邮件
oldSchool.setStreet(school.getTxdz());//通讯地址
oldSchool.setSchoolWebsiteAddress(school.getGw());//官网
if (StringUtils.isNotBlank(school.getNvsbl())) {
oldSchool.setFemaleRatio(Double.parseDouble(school.getNvsbl()));//女生比例
}
if (StringUtils.isNotBlank(school.getNsbl())) {
oldSchool.setMaleRatio(Double.parseDouble(school.getNsbl()));//男生比例
}
oldSchool.setBaseInfo(school.getDxjj());//大学简介
schoolList.add(oldSchool);
}
System.out.println("不存在的院校:" + notSchoolList.size());
if (notSchoolList.isEmpty()) {
yxSchoolService.saveOrUpdateBatch(schoolList);
}
//同步 学校专业关联信息
} catch (FileNotFoundException fileNotFoundException) {
log.error("文件不存在," + file.getAbsolutePath());
throw new RuntimeException(fileNotFoundException);
} catch (Exception e) {
System.out.println("错误index:" + i);
throw new RuntimeException(e);
}
return Result.error("文件导入成功!");
}
}

View File

@ -20,7 +20,9 @@ import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.modules.system.service.ISysDictService;
import org.jeecg.modules.yx.constant.YxConstant;
import org.jeecg.modules.yx.dto.LiNianShuJuDTO;
import org.jeecg.modules.yx.dto.SchoolMajorImport3;
@ -70,6 +72,8 @@ public class YxSchoolMajorController extends JeecgController<YxSchoolMajor, IYxS
private IYxSchoolService yxSchoolService;
@Autowired
private IYxHistoryScoreControlLineService yxHistoryScoreControlLineService;
@Autowired
private ISysDictService sysDictService;
/**
* 分页列表查询
@ -290,7 +294,10 @@ public class YxSchoolMajorController extends JeecgController<YxSchoolMajor, IYxS
String majorType = null;
String mainSubjects = null;
String majorTypeChild = null;
String stateValue = null;
List<String> batchList = Arrays.asList("提前批", "本科A段", "本科B段", "本科", "高职高专");
List<DictModel> schoolMajorStateDict = sysDictService.getDictItems("school_major_state");
Map<String, String> schoolMajorStateTextMap = schoolMajorStateDict.stream().collect(Collectors.toMap(s -> s.getText(), s -> s.getValue()));
for (YxSchoolMajor item : list) {
index++;
if (org.apache.commons.lang.StringUtils.isBlank(item.getSchoolCode()) && org.apache.commons.lang.StringUtils.isBlank(item.getMajorName())) {
@ -299,12 +306,15 @@ public class YxSchoolMajorController extends JeecgController<YxSchoolMajor, IYxS
majorType = item.getMajorType();
mainSubjects = item.getMainSubjects();
majorTypeChild = item.getMajorTypeChild();
AssertUtils.notEmpty(item.getSchoolCode(), String.format("行[%s],请输入学校代码", index));
AssertUtils.notEmpty(item.getBatch(), String.format("行[%s],请输入批次", index));
AssertUtils.notEmpty(item.getEnrollmentCode(), String.format("行[%s],请输入专业代码", index));
AssertUtils.notEmpty(item.getMajorName(), String.format("行[%s],请输入专业名称", index));
AssertUtils.notEmpty(item.getMajorType(), String.format("行[%s],请输入专业类型", index));
AssertUtils.notEmpty(item.getCategory(), String.format("行[%s],请输入科类", index));
AssertUtils.notEmpty(item.getState(), String.format("行[%s],请输入状态", index));
/*AssertUtils.notEmpty(item.getRulesEnrollProbabilitySx(), String.format("行[%s],请输入录取方式缩写", index));
AssertUtils.notEmpty(item.getRulesEnrollProbability(), String.format("行[%s],请输入对外录取方式", index));
AssertUtils.notEmpty(item.getProbabilityOperator(), String.format("行[%s],请输入对外录取方式运算符", index));
@ -325,6 +335,7 @@ public class YxSchoolMajorController extends JeecgController<YxSchoolMajor, IYxS
//判断批次是否有效
AssertUtils.isTrue(batchList.contains(item.getBatch()), String.format("行[%s],批次 无效", index));
//判断专业类型
if ("舞蹈类".equals(majorType)) {
AssertUtils.notEmpty(mainSubjects, String.format("行[%s],未识别到舞蹈类型-主考科目", index));
@ -369,6 +380,12 @@ public class YxSchoolMajorController extends JeecgController<YxSchoolMajor, IYxS
throw new JeecgBootException(String.format("行[%s],未识别到表演类型-主考科目", index));
}
}
// 状态参数判断
stateValue = schoolMajorStateTextMap.get(item.getState());
AssertUtils.notEmpty(stateValue, String.format("行[%s],状态有误", index));
item.setState(stateValue);
}
index=3;

View File

@ -18,13 +18,6 @@ public class SchoolUpdateCodeImport implements Serializable {
@ApiModelProperty(value = "学校名称")
private java.lang.String schoolName;
@ApiModelProperty(value = "numId")
private java.lang.String numId;
@Excel(name = "学校编码", width = 15)
@ApiModelProperty(value = "学校编码")
private String institutionCode;
@Excel(name = "国标Code", width = 15)
@ApiModelProperty(value = "国标Code")
private java.lang.String schoolCode;

View File

@ -40,29 +40,12 @@ public class YxSchool implements Serializable {
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**
* 自定id
*/
@ApiModelProperty(value = "自定id")
private String numId;
/**
* 学校名称
*/
@Excel(name = "学校名称", width = 15)
@ApiModelProperty(value = "学校名称")
private java.lang.String schoolName;
/**
* 学校编码
*/
@Excel(name = "学校编码", width = 15)
@ApiModelProperty(value = "学校编码")
private java.lang.String schoolCode;
/**
* 院校编码
*/
@Excel(name = "院校编码", width = 15)
@ApiModelProperty(value = "院校编码")
private java.lang.String institutionCode;
/**
* 官方网址
*/
@ -228,13 +211,6 @@ public class YxSchool implements Serializable {
@ApiModelProperty(value = "占地面积(亩)")
private java.lang.Double are;
/**
* 旧院校名称
*/
@Excel(name = "旧院校名称", width = 15)
@ApiModelProperty(value = "旧院校名称")
private java.lang.String oldSchoolName;
/**
* 统一代码
*/

View File

@ -189,4 +189,9 @@ public class YxSchoolMajor implements Serializable {
@ApiModelProperty(value = "外语成绩限制")
@Excel(name = "外语成绩限制", width = 15)
private BigDecimal englishScoreLimitation;
/**状态*/
@ApiModelProperty(value = "状态 1招生2新增0停招")
@Excel(name = "状态", width = 15,dicCode = "school_major_state")
private String state;
}

View File

@ -6,7 +6,6 @@
SELECT
s.id as schoolId,
s.school_name,
s.institution_code as institutionCode,
s.province as province,
s.school_nature as propertyName,
s.institution_type as institutionType,
@ -45,7 +44,7 @@
BY major_desc ) m ON m.major_code = sm.major_code
LEFT JOIN (SELECT school_id,school_code FROM yx_school_child group by school_code) sc ON sc.school_code = sm.school_code
LEFT JOIN yx_school s ON s.id = sc.school_id
WHERE 1=1
WHERE 1=1 AND sm.state>0
<if test="queryvo.schoolName!=null and queryvo.schoolName!=''">
AND (s.school_name like concat('%',#{queryvo.schoolName},'%') or sc.schooL_code like concat('%',#{queryvo.schoolName},'%') or sm.major_name like
concat('%',#{queryvo.schoolName},'%'))