Commit 83a431b4 authored by licc's avatar licc

查询方案优化

parent feeb6b69
......@@ -25,4 +25,11 @@ public interface VolunteerMapper extends BaseMapper<Volunteer> {
List<Volunteer> getVolunteerByType(@Param("type") Integer type);
List<Volunteer> getVolunteerListVip(Map<String,Object> map);
/**
* 获取某类型 最大录取分
* @param type 志愿类型
* @return 分数
*/
double getMaxLowestMark(@Param("type") Integer type);
}
......@@ -224,4 +224,14 @@
</where>
</select>
<select id="getMaxLowestMark" resultType="java.lang.Double">
select MAX(lowest_mark)
from
<include refid="table"/>
<where>
is_delete =0
and type =#{type}
</where>
</select>
</mapper>
package cn.wisenergy.model.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
......
......@@ -70,7 +70,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
/**
* 错误码
*/
private static final int ERROR_CODE = 1;
private static final int ERROR_CODE = 500;
@Override
public R<VolunteerVo> getList(SchemeVo queryVo) {
......@@ -277,19 +277,11 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
}
//6保存用户方案记录、志愿之间的关联关系,扣减查询次数
R<Integer> bool = volunteerManager.saveUserVolunteer(user, list, scoreInfo, queryVo.getBigMajorNames(),userLimit);
if (null != bool && bool.getCode() == 500) {
R<Integer> bool = volunteerManager.saveUserVolunteer(user, list, scoreInfo, queryVo.getBigMajorNames(), userLimit);
if (null != bool && bool.getCode() == ERROR_CODE) {
return R.error(bool.getMessage());
}
/* //调用扣减查询次数接口
R<Boolean> result = userLimitService.minusLimit(user.getId());
if (null != result && result.getCode() == ERROR_CODE) {
return R.error("扣减查询次数失败!");
}*/
volunteerVo.setUserId(user.getId());
assert bool != null;
volunteerVo.setRecordId(bool.getData());
......@@ -781,12 +773,8 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//计算综合成绩
double secondRuleTotal = secondMajor * 750 / 300 * 0.7 + secondCulture * 0.3;
//判断文化成绩大于本科文化成绩最低分但专业成绩小于本科文化成绩最低分时进行文化成绩降分处理查询
if (secondCulture > firstRule.getCultureMin() && secondMajor < firstRule.getProfessionMin()) {
List<Volunteer> volunteers = new ArrayList<>();
volunteers = volunteerMapper.getVolunteerByType(SchemeTypeEnums.JUNIOR_COLLEGE_LITERATURE.getCode());
secondRuleTotal = Double.valueOf(volunteers.get(0).getLowestMark()) - secondRule.getUpMark() + 1;
}
//获取该类型录取最高分数
double high = volunteerMapper.getMaxLowestMark(SchemeTypeEnums.JUNIOR_COLLEGE_ARTS.getCode());
//2、考生是否能报取美术专科
if (secondCulture >= secondRule.getCultureMin() && secondMajor >= secondRule.getProfessionMin()) {
......@@ -794,8 +782,10 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//浮动分数
double upGrade = secondRuleTotal + secondRule.getUpMark();
double downGrade = secondRuleTotal - secondRule.getDownMark();
map.put("upGrade", upGrade);
map.put("downGrade", downGrade);
if (secondRuleTotal < high) {
map.put("upGrade", upGrade);
map.put("downGrade", downGrade);
}
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_ARTS.getCode());
list = volunteerMapper.getVolunteerList(map);
......
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