Commit 2a5c988d authored by 刘帅's avatar 刘帅

1.优化

parent 36025a6b
......@@ -128,7 +128,7 @@ public class ApiCheckingOutController {
new Thread(new Runnable() {
@Override
public void run() {
mallMemberUserService.updateRate(mallMemberUser.getId(), mallMemberUser.getCultureScore(), mallMemberUser.getMajorScore());
mallMemberUserService.updateRate(mallMemberUser.getId(), mallMemberUser.getCultureScore(), mallMemberUser.getMajorScore(), mallMemberUser.getSubjectType());
}
}).start();
}
......
......@@ -7,7 +7,7 @@ spring:
# 主库数据源
master:
# 本地数据源
# url: jdbc:mysql://localhost:3306/yikaozhiyuan_20250603?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
# url: jdbc:mysql://localhost:3306/yikaozhiyuan_20250623?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
# username: root
# password: 123456
# 正式数据源
......
......@@ -21,11 +21,9 @@ public class SchoolMajorLinkBO {
@Excel(name = "专业名称")
private String majorName;
@Excel(name="批次")
@Excel(name = "批次")
private String batchName;
@Excel(name = "专业一级分类")
private String parentMajorClass;
......@@ -40,14 +38,6 @@ public class SchoolMajorLinkBO {
this.linkId = linkId;
}
public String getBatchName() {
return batchName;
}
public void setBatchName(String batchName) {
this.batchName = batchName;
}
public String getSchoolName() {
return schoolName;
}
......@@ -64,6 +54,14 @@ public class SchoolMajorLinkBO {
this.majorName = majorName;
}
public String getBatchName() {
return batchName;
}
public void setBatchName(String batchName) {
this.batchName = batchName;
}
public String getParentMajorClass() {
return parentMajorClass;
}
......
......@@ -30,9 +30,15 @@ public class ZhuankeBO implements Serializable {
@Excel(name = "录取原则")
private String ruleStr;
@Excel(name = "23年录取最低分")
@Excel(name="参考分")
private BigDecimal reference;
@Excel(name = "录取最低分")
private BigDecimal acceptLowest;
@Excel(name = "年份")
private String acceptYear;
@Excel(name = "学科")
private String subjectType;
......@@ -88,12 +94,12 @@ public class ZhuankeBO implements Serializable {
this.ruleStr = ruleStr;
}
public String getSubjectType() {
return subjectType;
public BigDecimal getReference() {
return reference;
}
public void setSubjectType(String subjectType) {
this.subjectType = subjectType;
public void setReference(BigDecimal reference) {
this.reference = reference;
}
public BigDecimal getAcceptLowest() {
......@@ -104,6 +110,22 @@ public class ZhuankeBO implements Serializable {
this.acceptLowest = acceptLowest;
}
public String getAcceptYear() {
return acceptYear;
}
public void setAcceptYear(String acceptYear) {
this.acceptYear = acceptYear;
}
public String getSubjectType() {
return subjectType;
}
public void setSubjectType(String subjectType) {
this.subjectType = subjectType;
}
public BigDecimal getPrice() {
return price;
}
......
......@@ -57,7 +57,7 @@ public interface IMallMemberUserService
public int deleteMallMemberUserByIds(Long[] ids);
public void updateRate(Long userId, Integer cultureScore, Integer majorScore);
public void updateRate(Long userId, Integer cultureScore, Integer majorScore, String subjectType);
/**
* 删除用户会员信息
......
......@@ -740,14 +740,32 @@ public class CheckingOutServiceImpl implements CheckingOutService {
r.put("rateType", -2);
}
}else{
// 本科
mallSchoolAccept = mallSchoolAcceptMapper.selectMinReferenceBySchoolId(s.getSchoolId(), bo.getBatchId(), subjectType);
if(ObjectUtils.isNotEmpty(mallSchoolAccept)){
r = mallCountMethodService.getAcceptRateForReport(mallSchoolAccept.getReference(), mallSchoolAccept.getAcceptRuleId(), cultureScore, majorScore);
}else{
}else {
r.put("acceptRate", 0);
r.put("rateType", -2);
}
// boolean flag = false;
// // 选科:0-文科,1-理科
// if (subjectType.equals("0") && cultureScore >= 331 && majorScore >= 193) {
// flag = true;
// }else if (subjectType.equals("1") && cultureScore >= 328 && majorScore >= 193){
// flag = true;
// }
// 本科
// mallSchoolAccept = mallSchoolAcceptMapper.selectMinReferenceBySchoolId(s.getSchoolId(), bo.getBatchId(), subjectType);
// if(flag && ObjectUtils.isNotEmpty(mallSchoolAccept)){
// r = mallCountMethodService.getAcceptRateForReport(mallSchoolAccept.getReference(), mallSchoolAccept.getAcceptRuleId(), cultureScore, majorScore);
// }else {
// r.put("acceptRate", 0);
// r.put("rateType", -2);
// }
}
......
......@@ -141,7 +141,9 @@ public class MallMemberUserServiceImpl implements IMallMemberUserService
@Transactional(rollbackFor = Exception.class)
public int updateMallMemberUser(MallMemberUser mallMemberUser)
{
if (StringUtils.isNotBlank(mallMemberUser.getSubjectType()) && ObjectUtils.isNotEmpty(mallMemberUser.getCultureScore()) && ObjectUtils.isNotEmpty(mallMemberUser.getMajorScore())){
if (StringUtils.isNotBlank(mallMemberUser.getSubjectType())
&& null != mallMemberUser.getCultureScore()
&& null != mallMemberUser.getMajorScore()){
String newSubjectType = mallMemberUser.getSubjectType(); // 新学科
Integer newCultureScore = mallMemberUser.getCultureScore(); // 新文化分
Integer newMajorScore = mallMemberUser.getMajorScore(); // 新专业分
......@@ -161,7 +163,7 @@ public class MallMemberUserServiceImpl implements IMallMemberUserService
@Override
public void run() {
updateRate(mallMemberUser.getId(), newCultureScore, newMajorScore);
updateRate(mallMemberUser.getId(), newCultureScore, newMajorScore, newSubjectType);
}
}).start();
}
......@@ -174,7 +176,7 @@ public class MallMemberUserServiceImpl implements IMallMemberUserService
@Override
public void updateRate(Long userId, Integer cultureScore, Integer majorScore)
public void updateRate(Long userId, Integer cultureScore, Integer majorScore, String subjectType)
{
// 计算学生各种录取率下的成绩
List<MallAcceptRule> rules = acceptRuleMapper.selectNewAcceptRule();
......
......@@ -804,10 +804,10 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
@Override
@Transactional(rollbackFor = Exception.class)
public String importAcceptData(List<NewAcceptBO> list) {
String afterYear = "2023";
// String afterYear = "2023";
// 重置去年数据为旧数据
mallSchoolAcceptMapper.resetAfterData(afterYear);
mallSchoolAcceptMapper.resetAfterRecordData(afterYear);
// mallSchoolAcceptMapper.resetAfterData(afterYear);
// mallSchoolAcceptMapper.resetAfterRecordData(afterYear);
// 删除24年录取记录
mallSchoolAcceptRecordMapper.deleteRecord();
......@@ -842,7 +842,7 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
BigDecimal reference = newAcceptBO.getReference(); // 参考分
String acceptYear = newAcceptBO.getAcceptYear(); // 年份
String subjectType = newAcceptBO.getSubjectType().contains("文") ? "0" : "1"; // 学科
String subjectType = newAcceptBO.getSubjectType().contains("历") ? "0" : "1"; // 学科
if (StringUtils.isBlank(batchName)){
//return "第" + index + "行缺少批次名称";
sb.append("第【" +index + "】行学校【"+schoolName+"】缺少批次名称;").append(System.lineSeparator());
......@@ -1043,34 +1043,34 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
//addSchoolAcceptRecord( schoolAcceptRecordList,mallSchoolAccept,cultureLowest,majorLowest);
// 生成新招生计划
// MallAcceptPlan mallAcceptPlan = new MallAcceptPlan();
// mallAcceptPlan.setSchoolId(school.getSchoolId());
// mallAcceptPlan.setBatchId(mallBatch.getBatchId());
// mallAcceptPlan.setLinkId(linkId);
// mallAcceptPlan.setPlanYear(acceptYear);
// mallAcceptPlan.setSubjectType(subjectType.equals("0") ? 0 : 1);
// mallAcceptPlan.setAcceptNum(acceptNum);
// mallAcceptPlan.setSchoolPrice(schoolPrice);
// mallAcceptPlan.setAcceptRuleId(acceptRuleId);
// mallAcceptPlan.setLittleScoreLimit(littleScoreLimit);
// mallAcceptPlan.setCreateAt(DateUtils.getTime());
// mallAcceptPlan.setDelFlag("0");
// mallAcceptPlanMapper.insertMallAcceptPlan(mallAcceptPlan);
//
// // 生成记录
// MallSchoolAcceptRecord record = new MallSchoolAcceptRecord();
// record.setSchoolId(school.getSchoolId());
// record.setBatchId(mallBatch.getBatchId());
// record.setAcceptNum(acceptNum);
// record.setAcceptYear(acceptYear);
// record.setLowestScore(acceptLowest);
// record.setCultureLowest(cultureLowest);
// record.setMajorLowest(majorLowest);
// record.setAcceptRuleId(acceptRuleId);
// record.setSubjectType(subjectType);
// record.setCreateAt(DateUtils.getTime());
// record.setDelFlag("0");
// mallSchoolAcceptRecordMapper.insertMallSchoolAcceptRecord(record);
MallAcceptPlan mallAcceptPlan = new MallAcceptPlan();
mallAcceptPlan.setSchoolId(school.getSchoolId());
mallAcceptPlan.setBatchId(mallBatch.getBatchId());
mallAcceptPlan.setLinkId(linkId);
mallAcceptPlan.setPlanYear(acceptYear);
mallAcceptPlan.setSubjectType(Integer.valueOf(subjectType));
mallAcceptPlan.setAcceptNum(acceptNum);
mallAcceptPlan.setSchoolPrice(schoolPrice);
mallAcceptPlan.setAcceptRuleId(acceptRuleId);
mallAcceptPlan.setLittleScoreLimit(littleScoreLimit);
mallAcceptPlan.setCreateAt(DateUtils.getTime());
mallAcceptPlan.setDelFlag("0");
mallAcceptPlanMapper.insertMallAcceptPlan(mallAcceptPlan);
// 生成记录
MallSchoolAcceptRecord record = new MallSchoolAcceptRecord();
record.setSchoolId(school.getSchoolId());
record.setBatchId(mallBatch.getBatchId());
record.setAcceptNum(acceptNum);
record.setAcceptYear(acceptYear);
record.setLowestScore(acceptLowest);
record.setCultureLowest(cultureLowest);
record.setMajorLowest(majorLowest);
record.setAcceptRuleId(acceptRuleId);
record.setSubjectType(subjectType);
record.setCreateAt(DateUtils.getTime());
record.setDelFlag("0");
mallSchoolAcceptRecordMapper.insertMallSchoolAcceptRecord(record);
a++;
}else{
b++;
......@@ -1086,33 +1086,32 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
mallSchoolAcceptMapper.updateMallSchoolAccept(schoolAccept);
// 修改招生计划
// List<MallAcceptPlan> mallAcceptPlanList = mallAcceptPlanMapper.selectPlan(school.getSchoolId(), mallBatch.getBatchId(), acceptYear, Integer.valueOf(subjectType), linkId);
// if (!mallAcceptPlanList.isEmpty()){
// MallAcceptPlan plan = mallAcceptPlanList.get(0);
// plan.setAcceptNum(acceptNum);
// plan.setSchoolPrice(schoolPrice);
// plan.setAcceptRuleId(acceptRuleId);
// plan.setLittleScoreLimit(littleScoreLimit);
// plan.setUpdateAt(DateUtils.getTime());
// plan.setDelFlag("0");
// mallAcceptPlanMapper.updateMallAcceptPlan(plan);
// }
//
// // 生成记录
// MallSchoolAcceptRecord record = new MallSchoolAcceptRecord();
// record.setSchoolId(school.getSchoolId());
// record.setBatchId(mallBatch.getBatchId());
// record.setAcceptNum(acceptNum);
// record.setAcceptYear(acceptYear);
// record.setLowestScore(acceptLowest);
// record.setCultureLowest(cultureLowest);
// record.setMajorLowest(majorLowest);
// record.setAcceptRuleId(acceptRuleId);
// record.setSubjectType(subjectType);
// record.setCreateAt(DateUtils.getTime());
// record.setDelFlag("0");
// mallSchoolAcceptRecordMapper.insertMallSchoolAcceptRecord(record);
List<MallAcceptPlan> mallAcceptPlanList = mallAcceptPlanMapper.selectPlan(school.getSchoolId(), mallBatch.getBatchId(), acceptYear, Integer.valueOf(subjectType), linkId);
if (!mallAcceptPlanList.isEmpty()){
MallAcceptPlan plan = mallAcceptPlanList.get(0);
plan.setAcceptNum(acceptNum);
plan.setSchoolPrice(schoolPrice);
plan.setAcceptRuleId(acceptRuleId);
plan.setLittleScoreLimit(littleScoreLimit);
plan.setUpdateAt(DateUtils.getTime());
plan.setDelFlag("0");
mallAcceptPlanMapper.updateMallAcceptPlan(plan);
}
// 生成记录
MallSchoolAcceptRecord record = new MallSchoolAcceptRecord();
record.setSchoolId(school.getSchoolId());
record.setBatchId(mallBatch.getBatchId());
record.setAcceptNum(acceptNum);
record.setAcceptYear(acceptYear);
record.setLowestScore(acceptLowest);
record.setCultureLowest(cultureLowest);
record.setMajorLowest(majorLowest);
record.setAcceptRuleId(acceptRuleId);
record.setSubjectType(subjectType);
record.setCreateAt(DateUtils.getTime());
record.setDelFlag("0");
mallSchoolAcceptRecordMapper.insertMallSchoolAcceptRecord(record);
}
successNum++;
......@@ -1169,18 +1168,18 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
//要插入数据库的 院校录取数据
//List<MallSchoolAcceptRecord> schoolAcceptRecordList = new ArrayList<>();
List<MallSchool> schoolList = mallSchoolMapper.selectMallSchoolList(null);
for (ZhuankeBO zhuankeBO : list) {
int index = list.indexOf(zhuankeBO) + 2;
try{
String batchName = "专科";
String batchName = replaceOther(zhuankeBO.getBatchName());
String schoolNumber = replaceOther(zhuankeBO.getSchoolNumber()); // 代码 去空格回车等
String schoolName = replaceOther(zhuankeBO.getSchoolName()); // 学校名称
String majorName = replaceOther(zhuankeBO.getMajorName()); // 专业名
String ruleStr = "文化*0.067+联考*0.1667"; // 录取原则
String acceptYear = "2024"; // 年份
String subjectType = replaceOther(zhuankeBO.getSubjectType()).contains("文") ? "0" : "1"; // 学科
String ruleStr = replaceOther(zhuankeBO.getRuleStr()); // 录取原则
String acceptYear = zhuankeBO.getAcceptYear(); // 年份
String subjectType = replaceOther(zhuankeBO.getSubjectType()).contains("历") ? "0" : "1"; // 学科
if (StringUtils.isBlank(batchName)){
return "第" + index + "行缺少批次名称";
......@@ -1214,42 +1213,44 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
return "第" + index + "行批次不存在,请先添加批次或批次名称不正确";
}
// 查询学校
MallSchool mallSchool = mallSchoolMapper.selectMallSchoolBySchoolName(schoolName);
if (ObjectUtils.isEmpty(mallSchool)){
MallSchool newSchool = new MallSchool();
newSchool.setSchoolName(schoolName);
newSchool.setSchoolNumber(schoolNumber);
newSchool.setDelFlag("0");
int i = mallSchoolMapper.insertMallSchool(newSchool);
schoolId = newSchool.getSchoolId();
List<MallSchool> collect = schoolList.stream().filter(item -> replaceOther(item.getSchoolName()).equals(schoolName)).collect(Collectors.toList());
// if (ObjectUtils.isEmpty(collect)){
// sb.append("第【").append(index).append("】行学校【").append(schoolName).append("】不存在或学校名称错误").append(System.lineSeparator());
// continue;
// }
if (ObjectUtils.isNotEmpty(collect)){
// 已有学校
schoolId = collect.get(0).getSchoolId();
// 查询是否有专科批次
MallSchoolBatchLink schoolBatchLink = mallSchoolBatchLinkMapper.selectSchoolBatchLinkBySchoolIdAndBatchId(schoolId, 4L);
if (ObjectUtils.isEmpty(schoolBatchLink)){
// 批次关联
MallSchoolBatchLink batchLink = new MallSchoolBatchLink();
batchLink.setSchoolId(schoolId);
batchLink.setBatchId(4L);
batchLink.setBatchName("专科");
batchLink.setBatchName(batchName);
batchLink.setCreateAt(DateUtils.getTime());
batchLink.setDelFlag("0");
mallSchoolBatchLinkMapper.insertMallSchoolBatchLink(batchLink);
}else{
// 已有学校
schoolId = mallSchool.getSchoolId();
// 查询是否有专科批次
MallSchoolBatchLink schoolBatchLink = mallSchoolBatchLinkMapper.selectSchoolBatchLinkBySchoolIdAndBatchId(schoolId, 4L);
if (ObjectUtils.isEmpty(schoolBatchLink)){
// 批次关联
MallSchoolBatchLink batchLink = new MallSchoolBatchLink();
batchLink.setSchoolId(schoolId);
batchLink.setBatchId(4L);
batchLink.setBatchName("专科");
batchLink.setCreateAt(DateUtils.getTime());
batchLink.setDelFlag("0");
mallSchoolBatchLinkMapper.insertMallSchoolBatchLink(batchLink);
}
}
}else {
MallSchool newSchool = new MallSchool();
newSchool.setSchoolName(schoolName);
newSchool.setSchoolNumber(schoolNumber);
newSchool.setDelFlag("0");
int i = mallSchoolMapper.insertMallSchool(newSchool);
schoolId = newSchool.getSchoolId();
schoolList.add(newSchool);
// 批次关联
MallSchoolBatchLink batchLink = new MallSchoolBatchLink();
batchLink.setSchoolId(schoolId);
batchLink.setBatchId(4L);
batchLink.setBatchName(batchName);
batchLink.setCreateAt(DateUtils.getTime());
batchLink.setDelFlag("0");
mallSchoolBatchLinkMapper.insertMallSchoolBatchLink(batchLink);
}
BigDecimal acceptLowest = zhuankeBO.getAcceptLowest(); // 最低分
......@@ -1260,7 +1261,6 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
Long linkId = 0L;
if (ObjectUtils.isEmpty(linkMajorSchool)){
// 专业不存在新增
MallLinkMajorSchool newLink = new MallLinkMajorSchool();
newLink.setSchoolId(schoolId);
......@@ -1277,7 +1277,6 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
// 查询录取原则
MallAcceptRule acceptRule = mallAcceptRuleMapper.selectRuleStr(ruleStr);
// 查询是否已导入数据
List<MallSchoolAccept> schoolAcceptList = mallSchoolAcceptMapper.selectBySchoolIdAndLinkId(schoolId, 4L, linkId, acceptYear, subjectType);
if (schoolAcceptList.isEmpty()){
......@@ -1544,6 +1543,7 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
List<MallLinkMajorSchool> updateLinkList = new ArrayList<>();
List<MallLinkMajorSchool> insertLinkList = new ArrayList<>();
List<MallSchool> schoolList = mallSchoolMapper.selectMallSchoolList(null);
// 学校批次关联
List<MallSchoolBatchLink> insertSchoolBatchList = new ArrayList<>();
......@@ -1556,7 +1556,7 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
message = "数据不全,对应行数:" + (list.indexOf(bo) + 1);
return message;
}
bo.setBatchName("本科");
// bo.setBatchName("本科");
String schoolName = bo.getSchoolName().replaceAll("\\s*","");
String batchName = bo.getBatchName().replaceAll("\\s*","");
String majorName = bo.getMajorName().replaceAll("\\s*","");
......@@ -1564,10 +1564,10 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
String majorClass = bo.getMajorClass().replaceAll("\\s*","").replaceAll(",", ",").replaceAll("、", ",");
// 查询学校
MallSchool mallSchool = mallSchoolMapper.selectMallSchoolBySchoolName(schoolName);
if (ObjectUtils.isEmpty(mallSchool)){
return "学校信息不存在,行数: " + (list.indexOf(bo) + 1);
List<MallSchool> mallSchoolList = schoolList.stream().filter(item -> replaceOther(item.getSchoolName()).equals(schoolName)).collect(Collectors.toList());
if (ObjectUtils.isEmpty(mallSchoolList)){
// return "学校信息不存在【"+schoolName+"】,行数: " + (list.indexOf(bo) + 1);
continue;
}
// 对应批次
List<BatchVO> batchCollect = batchList.stream().filter(item -> item.getBatchName().equals(batchName)).collect(Collectors.toList());
......@@ -1580,72 +1580,86 @@ public class MallSchoolAcceptServiceImpl implements IMallSchoolAcceptService {
String[] split = majorClass.split(",");
StringBuilder twoClassIds = new StringBuilder();
for (String s : split) {
List<MallMajorClass> collect2 = classList.stream().filter(item -> item.getMajorName().equals(s) && !item.getParentId().equals(0L)).collect(Collectors.toList());
if (collect2.isEmpty()){
message = "未查询到二级专业分类:" + s + ",对应行数: " + (list.indexOf(bo) + 1);
return message;
}
twoClassIds.append(collect2.get(0).getMajorId()).append(",");
}
if (ObjectUtils.isNotEmpty(bo.getLinkId())){
// 已有专业关联
List<MallLinkMajorSchool> collect = oldList.stream().filter(item -> item.getLinkId().equals(bo.getLinkId())).collect(Collectors.toList());
MallLinkMajorSchool oldLink = collect.get(0);
oldLink.setMajorName(majorName); // 专业名称(可能更新)
//oldLink.setParentMajorId(collect1.get(0).getMajorId());// 一级分类id
oldLink.setMajorId(twoClassIds.toString()); // 二级分类id
oldLink.setUpdateAt(DateUtils.getTime());
oldLink.setTwoClassName(majorClass);
updateLinkList.add(oldLink);
}else{
// for (String s : split) {
// List<MallMajorClass> collect2 = classList.stream().filter(item -> item.getMajorName().equals(s) && !item.getParentId().equals(0L)).collect(Collectors.toList());
// if (collect2.isEmpty()){
// message = "未查询到二级专业分类:" + s + ",对应行数: " + (list.indexOf(bo) + 1);
// return message;
// }
// twoClassIds.append(collect2.get(0).getMajorId()).append(",");
// }
if (oldList.stream().noneMatch(item -> item.getSchoolName().equals(schoolName) && item.getMajorName().equals(majorName))) {
// 新增专业
MallLinkMajorSchool newLink = new MallLinkMajorSchool();
// 查询学校id
newLink.setSchoolId(mallSchool.getSchoolId());
newLink.setSchoolId(mallSchoolList.get(0).getSchoolId());
newLink.setSchoolName(schoolName);
newLink.setMajorName(majorName);
//newLink.setParentMajorId(collect1.get(0).getMajorId()); // 一级分类
newLink.setMajorId(twoClassIds.toString()); //二级分类
// newLink.setMajorId(twoClassIds.toString()); //二级分类
newLink.setType("2");
newLink.setCreateAt(DateUtils.getTime());
newLink.setTwoClassName(majorClass);
insertLinkList.add(newLink);
mallLinkMajorSchoolMapper.insertMallLinkMajorSchool(newLink);
oldList.add(newLink);
}
// if (ObjectUtils.isNotEmpty(bo.getLinkId())){
//
// // 已有专业关联
// List<MallLinkMajorSchool> collect = oldList.stream().filter(item -> item.getLinkId().equals(bo.getLinkId())).collect(Collectors.toList());
//
// MallLinkMajorSchool oldLink = collect.get(0);
// oldLink.setMajorName(majorName); // 专业名称(可能更新)
// //oldLink.setParentMajorId(collect1.get(0).getMajorId());// 一级分类id
//// oldLink.setMajorId(twoClassIds.toString()); // 二级分类id
// oldLink.setUpdateAt(DateUtils.getTime());
// oldLink.setTwoClassName(majorClass);
// updateLinkList.add(oldLink);
// }else{
// // 新增专业
// MallLinkMajorSchool newLink = new MallLinkMajorSchool();
// // 查询学校id
//
// newLink.setSchoolId(mallSchoolList.get(0).getSchoolId());
// newLink.setSchoolName(schoolName);
// newLink.setMajorName(majorName);
// //newLink.setParentMajorId(collect1.get(0).getMajorId()); // 一级分类
//// newLink.setMajorId(twoClassIds.toString()); //二级分类
// newLink.setType("2");
// newLink.setCreateAt(DateUtils.getTime());
// newLink.setTwoClassName(majorClass);
// insertLinkList.add(newLink);
// }
// 学校批次关联
MallSchoolBatchLink schoolBatchLink = mallSchoolBatchLinkMapper.selectSchoolBatchLinkBySchoolIdAndBatchId(mallSchool.getSchoolId(), batchCollect.get(0).getBatchId());
MallSchoolBatchLink schoolBatchLink = mallSchoolBatchLinkMapper.selectSchoolBatchLinkBySchoolIdAndBatchId(mallSchoolList.get(0).getSchoolId(), batchCollect.get(0).getBatchId());
if (ObjectUtils.isEmpty(schoolBatchLink)){
List<MallSchoolBatchLink> collect = insertSchoolBatchList.stream().filter(item -> item.getSchoolId().equals(mallSchool.getSchoolId()) && item.getBatchId().equals(batchCollect.get(0).getBatchId())).collect(Collectors.toList());
List<MallSchoolBatchLink> collect = insertSchoolBatchList.stream().filter(item -> item.getSchoolId().equals(mallSchoolList.get(0).getSchoolId()) && item.getBatchId().equals(batchCollect.get(0).getBatchId())).collect(Collectors.toList());
if (collect.isEmpty()){
// 未加入集合,新增
MallSchoolBatchLink newSchoolBatchLink = new MallSchoolBatchLink();
newSchoolBatchLink.setSchoolId(mallSchool.getSchoolId());
newSchoolBatchLink.setSchoolId(mallSchoolList.get(0).getSchoolId());
newSchoolBatchLink.setBatchId(batchCollect.get(0).getBatchId());
newSchoolBatchLink.setBatchName(batchCollect.get(0).getBatchName());
newSchoolBatchLink.setCreateAt(DateUtils.getTime());
newSchoolBatchLink.setDelFlag("0");
insertSchoolBatchList.add(newSchoolBatchLink);
mallSchoolBatchLinkMapper.insertMallSchoolBatchLink(newSchoolBatchLink);
// insertSchoolBatchList.add(newSchoolBatchLink);
}
}
}
// 批量新增或修改
if (!insertSchoolBatchList.isEmpty()){
mallSchoolBatchLinkMapper.batchInsert(insertSchoolBatchList);
}
if (!insertLinkList.isEmpty()){
mallLinkMajorSchoolMapper.batchInsert(insertLinkList);
}
if (!updateLinkList.isEmpty()){
mallLinkMajorSchoolMapper.batchUpdate(updateLinkList);
}
// if (!insertSchoolBatchList.isEmpty()){
// mallSchoolBatchLinkMapper.batchInsert(insertSchoolBatchList);
// }
//
// if (!insertLinkList.isEmpty()){
// mallLinkMajorSchoolMapper.batchInsert(insertLinkList);
// }
// if (!updateLinkList.isEmpty()){
// mallLinkMajorSchoolMapper.batchUpdate(updateLinkList);
// }
return "success";
......
......@@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ms.suggest_id, ms.accept_premise, msl.config_level_id ,msl.config_level_name, ms.doctorate_type,
ms.masters_degree_type,ms.is_new_accept, ms.has_new_link, ms.is_change, ms.no_plan,ms.qr_code, ms.sys_user_id
from mall_school ms
left join mall_school_level msl on msl.school_id = ms.school_id
left join mall_config_level msl on msl.config_level_id = ms.config_type_id
<where>
<if test="schoolName != null and schoolName != ''"> and ms.school_name like concat('%', #{schoolName}, '%')</if>
<if test="schoolIcon != null and schoolIcon != ''"> and ms.school_icon = #{schoolIcon}</if>
......@@ -127,7 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="suggestId != null "> and ms.suggest_id = #{suggestId}</if>
<if test="configLevelId != null "> and msl.config_level_id = #{configLevelId}</if>
and ms.del_flag = '0'
and msl.del_flag = '0'
# and msl.del_flag = '0'
</where>
order by ms.create_at asc, ms.school_number asc
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment