Commit 65d0c74a authored by licc's avatar licc

优化查询方案2

parent a27a15bc
...@@ -220,7 +220,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp ...@@ -220,7 +220,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//计算综合成绩 //计算综合成绩
double total = major * 750 / 100 * 0.7 + culture * 0.3 - value; double total = major * 750 / 100 * 0.7 + culture * 0.3 - value;
if (total < secondRule.getProfessionMin()) { if (total < secondRule.getCultureMin()) {
return R.error("很抱歉,您的成绩不满足报考条件,无法查询!"); return R.error("很抱歉,您的成绩不满足报考条件,无法查询!");
} }
...@@ -230,7 +230,12 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp ...@@ -230,7 +230,12 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//4判断是否展示全部方案 //4判断是否展示全部方案
if (queryVo.getIsShowAll() == 0) { if (queryVo.getIsShowAll() == 0) {
List<Volunteer> result = list.subList(0, 10); List<Volunteer> result;
if (list.size() < 10) {
result = list.subList(0, list.size());
} else {
result = list.subList(0, 10);
}
volunteerVo.setUserId(user.getId()); volunteerVo.setUserId(user.getId());
volunteerVo.setVolunteers(result); volunteerVo.setVolunteers(result);
return R.ok(volunteerVo); return R.ok(volunteerVo);
...@@ -241,17 +246,17 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp ...@@ -241,17 +246,17 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
list = getVolunteerList(list, totalResult); list = getVolunteerList(list, totalResult);
} }
// //6保存用户方案记录、志愿之间的关联关系,扣减查询次数 //6保存用户方案记录、志愿之间的关联关系,扣减查询次数
// R<Integer> bool = volunteerManager.saveUserVolunteer(user, list, scoreInfo, queryVo.getBigMajorNames()); R<Integer> bool = volunteerManager.saveUserVolunteer(user, list, scoreInfo, queryVo.getBigMajorNames());
// if (null != bool && bool.getCode() == 500) { if (null != bool && bool.getCode() == 500) {
// return R.error("保存方案查询记录失败!"); return R.error("保存方案查询记录失败!");
// } }
//排序 //排序
list.sort(Comparator.comparing(Volunteer::getLowestMark).reversed()); list.sort(Comparator.comparing(Volunteer::getLowestMark).reversed());
volunteerVo.setUserId(user.getId()); volunteerVo.setUserId(user.getId());
// assert bool != null; assert bool != null;
// volunteerVo.setRecordId(bool.getData()); volunteerVo.setRecordId(bool.getData());
volunteerVo.setVolunteers(list); volunteerVo.setVolunteers(list);
volunteerVo.setTotal(list.size()); volunteerVo.setTotal(list.size());
return R.ok(volunteerVo); return R.ok(volunteerVo);
......
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