Commit c9b35289 authored by licc's avatar licc

方案查询接口逻辑实现2

parent 7ff7d522
......@@ -82,6 +82,9 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
if (null == scoreInfo) {
return R.error("无考生成绩!");
}
double culture = Double.parseDouble(queryVo.getCultureGrade());
double major = Double.parseDouble(queryVo.getMajorGrade());
//3、根据筛选方案算法,筛选方案
//副科名称
......@@ -113,7 +116,6 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//1).判断文化课的分数是否大于等于最大文化分
double culture = Double.parseDouble(queryVo.getCultureGrade());
double cultureMax = Double.parseDouble(firstRule.getCultureMax().toString());
if (culture >= cultureMax) {
volunteerVo.setUserId(userInfo.getId());
......@@ -132,19 +134,68 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//(2)美术考生
if (StudentType.ART_STUDENT.getCode().equals(userInfo.getExamType())) {
//获取美术本科一批录取规则
AdmissionRule firstRule = admissionRuleMapper.getByType(SchemeTypeEnums.UNDERGRADUATE_ARTS.getCode());
if (null == firstRule) {
return R.error("无美术本科录取规则!");
}
//(3)体育考生
if (StudentType.SPORTS_STUDENT.getCode().equals(userInfo.getExamType())) {
//获取美术专科一批录取规则
AdmissionRule secondRule = admissionRuleMapper.getByType(SchemeTypeEnums.JUNIOR_COLLEGE_ARTS.getCode());
if (null == secondRule) {
return R.error("无美术专科录取规则!");
}
//判断考生是否有报取资格
if (major < secondRule.getProfessionMin()) {
return R.error("很抱歉,您的专业成绩不满足报考条件,无法查询!");
}
list = getArtsList(scoreInfo, firstRule, secondRule, className, professionName);
}
//文学编导考生
//(3)文学编导考生
if (StudentType.LITERATURE_STUDENT.getCode().equals(userInfo.getExamType())) {
//获取文学编导本科一批录取规则
AdmissionRule firstRule = admissionRuleMapper.getByType(SchemeTypeEnums.UNDERGRADUATE_LITERATURE.getCode());
if (null == firstRule) {
return R.error("无文学编导本科录取规则!");
}
//获取文学编导专科一批录取规则
AdmissionRule secondRule = admissionRuleMapper.getByType(SchemeTypeEnums.JUNIOR_COLLEGE_LITERATURE.getCode());
if (null == secondRule) {
return R.error("无文学编导专科录取规则!");
}
//判断考生是否有报取资格
if (major < secondRule.getProfessionMin()) {
return R.error("很抱歉,您的专业成绩不满足报考条件,无法查询!");
}
list = getLiteratureList(scoreInfo, firstRule, secondRule, className, professionName);
}
//(4)体育考生
if (StudentType.SPORTS_STUDENT.getCode().equals(userInfo.getExamType())) {
//获取体育本科一批录取规则
AdmissionRule firstRule = admissionRuleMapper.getByType(SchemeTypeEnums.UNDERGRADUATE_SPORTS.getCode());
if (null == firstRule) {
return R.error("无体育本科录取规则!");
}
//获取体育专科一批录取规则
AdmissionRule secondRule = admissionRuleMapper.getByType(SchemeTypeEnums.JUNIOR_COLLEGE_SPORTS.getCode());
if (null == secondRule) {
return R.error("无体育专科录取规则!");
}
//判断考生是否有报取资格
//计算综合成绩
double total = major * 750 / 100 * 0.7 + culture * 0.3;
if (total < secondRule.getProfessionMin()) {
return R.error("很抱歉,您的成绩不满足报考条件,无法查询!");
}
list = getSportsList(total, firstRule, secondRule, className, professionName);
}
//4保存用户方案记录、志愿之间的关联关系
boolean bool = saveUserVolunteer(userInfo, list, scoreInfo);
......@@ -265,6 +316,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
double upMark = firstRule.getUpMark();
double upGrade = culture + upMark;
map.put("upGrade", upGrade);
map.put("type", SchemeTypeEnums.UNDERGRADUATE_CULTURE.getCode());
double downGrade;
if (culture < cultureMin + downMark) {
......@@ -291,6 +343,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
}
map.put("upGrade", upGrade);
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_MAJOR.getCode());
double downGrade;
if (culture < cultureMin + downMark) {
......@@ -311,6 +364,149 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
return list;
}
/**
* 获取美术生志愿方案
*
* @param scoreInfo 考生成绩
* @param firstRule 本科规则
* @param secondRule 专科规则
* @param classNames 副科名称
* @param professionNames 专业名称
* @return 志愿方案列表
*/
private List<Volunteer> getArtsList(ScoreInfo scoreInfo, AdmissionRule firstRule, AdmissionRule secondRule,
List<String> classNames, List<String> professionNames) {
double culture = scoreInfo.getCultureGrade();
double major = scoreInfo.getMajorGrade();
//计算综合成绩
double total = major * 750 / 300 * 0.7 + culture * 0.3;
Map<String, Object> map = new HashMap<>(16);
map.put("number", firstRule.getNumber());
map.put("classNames", classNames);
map.put("professionNames", professionNames);
//1、考生是否能报取美术本科
List<Volunteer> list = new ArrayList<>();
if (culture >= firstRule.getCultureMin() && major >= firstRule.getProfessionMin()) {
//浮动分数
double upGrade = total + firstRule.getUpMark();
double downGrade = total + firstRule.getDownMark();
map.put("upGrade", upGrade);
map.put("downGrade", downGrade);
map.put("type", SchemeTypeEnums.UNDERGRADUATE_ARTS.getCode());
list = volunteerMapper.getVolunteerList(map);
}
//2、考生是否能报取美术专科
if (culture >= secondRule.getCultureMin() && major >= secondRule.getProfessionMin()) {
//浮动分数
double upGrade = total + secondRule.getUpMark();
double downGrade = total + secondRule.getDownMark();
map.put("upGrade", upGrade);
map.put("downGrade", downGrade);
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_ARTS.getCode());
list = volunteerMapper.getVolunteerList(map);
}
return list;
}
/**
* 获取文学编导生志愿方案
*
* @param scoreInfo 考生成绩
* @param firstRule 本科规则
* @param secondRule 专科规则
* @param classNames 副科名称
* @param professionNames 专业名称
* @return 志愿方案列表
*/
private List<Volunteer> getLiteratureList(ScoreInfo scoreInfo, AdmissionRule firstRule, AdmissionRule secondRule,
List<String> classNames, List<String> professionNames) {
double culture = scoreInfo.getCultureGrade();
double major = scoreInfo.getMajorGrade();
//计算综合成绩
double total = major * 750 / 300 * 0.7 + culture * 0.3;
Map<String, Object> map = new HashMap<>(16);
map.put("number", firstRule.getNumber());
map.put("classNames", classNames);
map.put("professionNames", professionNames);
//1、考生是否能报取美术本科
List<Volunteer> list = new ArrayList<>();
if (culture >= firstRule.getCultureMin() && major >= firstRule.getProfessionMin()) {
//浮动分数
double upGrade = total + firstRule.getUpMark();
double downGrade = total + firstRule.getDownMark();
map.put("upGrade", upGrade);
map.put("downGrade", downGrade);
map.put("type", SchemeTypeEnums.UNDERGRADUATE_LITERATURE.getCode());
list = volunteerMapper.getVolunteerList(map);
}
//2、考生是否能报取美术专科
if (culture >= secondRule.getCultureMin() && major >= secondRule.getProfessionMin()) {
//浮动分数
double upGrade = total + secondRule.getUpMark();
double downGrade = total + secondRule.getDownMark();
map.put("upGrade", upGrade);
map.put("downGrade", downGrade);
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_LITERATURE.getCode());
list = volunteerMapper.getVolunteerList(map);
}
return list;
}
/**
* 获取体育生生志愿方案
*
* @param total 考生综合成绩
* @param firstRule 本科规则
* @param secondRule 专科规则
* @param classNames 副科名称
* @param professionNames 专业名称
* @return 志愿方案列表
*/
private List<Volunteer> getSportsList(double total, AdmissionRule firstRule, AdmissionRule secondRule,
List<String> classNames, List<String> professionNames) {
Map<String, Object> map = new HashMap<>(16);
map.put("number", firstRule.getNumber());
map.put("classNames", classNames);
map.put("professionNames", professionNames);
//1、考生是否能报取体育本科
List<Volunteer> list = new ArrayList<>();
if (total >= firstRule.getCultureMin()) {
//浮动分数
double upGrade = total + firstRule.getUpMark();
double downGrade = total + firstRule.getDownMark();
map.put("upGrade", upGrade);
map.put("downGrade", downGrade);
map.put("type", SchemeTypeEnums.UNDERGRADUATE_SPORTS.getCode());
list = volunteerMapper.getVolunteerList(map);
}
//2、考生是否能报取体育专科
if (total >= secondRule.getCultureMin()) {
//浮动分数
double upGrade = total + secondRule.getUpMark();
double downGrade = total + secondRule.getDownMark();
map.put("upGrade", upGrade);
map.put("downGrade", downGrade);
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_SPORTS.getCode());
list = volunteerMapper.getVolunteerList(map);
}
return list;
}
/**
* 获取副科的名称
*
......
......@@ -79,8 +79,8 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, UserInfo> implemen
//将消息进行同步
BeanUtils.copyProperties(userInfo,userInfoDto);
userInfoDto.setUserId(userInfo.getId());
userInfoDto.setCultureGrade(scoreInfo.getCultureGrade());
userInfoDto.setMajorGrade(scoreInfo.getMajorGrade());
userInfoDto.setCultureGrade(scoreInfo.getCultureGrade().toString());
userInfoDto.setMajorGrade(scoreInfo.getMajorGrade().toString());
userInfoDto.setRegisterTime(userInfo.getCreateTime());
userInfoDto.setLastLoginTime(loginRecord.getUpdateTime());
userInfoDto.setQueryLimit(userLimit.getUsableLimit());
......
......@@ -3,9 +3,9 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/exam?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
url: jdbc:mysql://172.18.1.55:3306/volunteer?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
username: root
password:
password: adm4HYservice$
initial-size: 10
max-active: 100
min-idle: 10
......
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