Commit 2d720f12 authored by cy's avatar cy

shrio跨域,修改vip方案查询分数区间

parent 12af6066
......@@ -193,13 +193,20 @@
<include refid="table"/>
<where>
is_delete =0
<if test="type != null">
and type =#{type}
</if>
<if test="total != null">
and lowest_mark=#{total}
<if test="totalMax != null">
and #{totalMax} >= lowest_mark
</if>
<if test="totalMin != null">
and lowest_mark >= #{totalMin}
</if>
<if test="locals != null and (locals.size)>0">
and
<foreach collection="locals" index="index" item="local" separator="or" open="(" close=")">
......
......@@ -31,15 +31,15 @@ public class SchemeVipVo implements Serializable {
/**
* 文化课成绩
*/
*//*
@ApiModelProperty(value = "文化课成绩", name = "cultureGrade")
private String cultureGrade;
/**
*//**
* 专业课成绩
*/
*//*
@ApiModelProperty(value = "专业课成绩", name = "majorGrade")
private String majorGrade;
private String majorGrade;*/
/**
* 地区
......@@ -48,10 +48,15 @@ public class SchemeVipVo implements Serializable {
private String local;
/**
* 综合成绩
* 综合成绩(最高分)
*/
@ApiModelProperty(name = "totalMax",value = "综合成绩(最高分)")
private Integer totalMax;
/**
* 综合成绩(最低分)
*/
@ApiModelProperty(name = "total",value = "综合成绩")
private Integer total;
@ApiModelProperty(name = "totalMin",value = "综合成绩(最低分)")
private Integer totalMin;
/**
* 是否展示全部 0:否 1:是
......
......@@ -370,9 +370,12 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
return R.error("入参为空!");
}
//综合成绩,地区
Integer total = null == schemeVo.getTotal() ? null : schemeVo.getTotal();
String local = null == schemeVo.getLocal() ? null : schemeVo.getLocal();
//综合成绩
Integer totalMax = null == schemeVo.getTotalMax() ? null : schemeVo.getTotalMax();
Integer totalMin = null == schemeVo.getTotalMin() ? null : schemeVo.getTotalMin();
//地区
List<String> locals = StringUtil.strToArrayStr(schemeVo.getLocal());
//1、根据userId获取用户信息
User user = usersMapper.selectById(schemeVo.getUserId());
......@@ -380,6 +383,8 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
return R.error("请先添加vip客户信息!");
}
//2、获取考生成绩
QueryWrapper<ScoreInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", schemeVo.getUserId());
......@@ -387,8 +392,11 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
if (null == scoreInfo) {
return R.error("无vip客户成绩!");
}
//地区
List<String> locals = StringUtil.strToArrayStr(schemeVo.getLocal());
//文化分
Double majorGrade = scoreInfo.getMajorGrade();
//专业分
Double cultureGrade = scoreInfo.getCultureGrade();
//选取专业名称;
List<Integer> professionIds = StringUtil.strToArray(schemeVo.getProfessionIds());
......@@ -413,7 +421,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
return R.error("无文化课专科录取规则!");
}
//本科类比文化分 = 本年录取分 -去年录取分 + 考生分数
/*//本科类比文化分 = 本年录取分 -去年录取分 + 考生分数
double firstCulture = firstRule.getCurrentYearCulture() - firstRule.getCultureMin() + Double.parseDouble(schemeVo.getCultureGrade());
double cultureMax = Double.parseDouble(firstRule.getCultureMax().toString());
......@@ -423,9 +431,11 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
double cultureMin = Double.parseDouble(secondRule.getCultureMin().toString());
if (secondCulture < cultureMin) {
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}*/
if(cultureGrade<secondRule.getCultureMin()){
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getCultureVipList(firstRule, secondRule, total, locals, nameByIds, firstCulture, secondCulture);
list = getCultureVipList(firstRule,secondRule,cultureGrade, totalMax,totalMin, locals, nameByIds);
}
//(2)美术考生
......@@ -444,14 +454,17 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//判断考生是否有报取资格
//专科类比分 = 本年录取分 -去年录取分 + 考生分数
double secondCulture = secondRule.getCurrentYearCulture() - secondRule.getCultureMin() +
/* double secondCulture = secondRule.getCurrentYearCulture() - secondRule.getCultureMin() +
Double.parseDouble(schemeVo.getCultureGrade());
double secondMajor = secondRule.getCurrentYearMajor() - secondRule.getProfessionMin() +
Double.parseDouble(schemeVo.getMajorGrade());
if (secondCulture < secondRule.getCultureMin() && secondMajor < secondRule.getProfessionMin()) {
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}*/
if(cultureGrade < secondRule.getCultureMin() || majorGrade < secondRule.getProfessionMin()){
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getArtsVipList(schemeVo, firstRule, secondRule, total, locals, nameByIds);
list = getArtsVipList( firstRule,secondRule,cultureGrade,majorGrade,totalMax,totalMin, locals, nameByIds);
}
//(3)文学编导考生
......@@ -470,14 +483,17 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//判断考生是否有报取资格
//专科类比分 = 本年录取分 -去年录取分 + 考生分数
double secondCulture = secondRule.getCurrentYearCulture() - secondRule.getCultureMin() +
/* double secondCulture = secondRule.getCurrentYearCulture() - secondRule.getCultureMin() +
Double.parseDouble(schemeVo.getCultureGrade());
double secondMajor = secondRule.getCurrentYearMajor() - secondRule.getProfessionMin() +
Double.parseDouble(schemeVo.getMajorGrade());
if (secondCulture < secondRule.getCultureMin() || secondMajor < secondRule.getProfessionMin()) {
return R.error("很抱歉,客户的专业成绩不满足报考条件,无法查询!");
}*/
if(cultureGrade < secondRule.getCultureMin() || majorGrade < secondRule.getProfessionMin()){
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getLiteratureVipList(schemeVo, firstRule, secondRule, total, locals, nameByIds);
list = getLiteratureVipList(firstRule,secondRule,cultureGrade,majorGrade,totalMax,totalMin, locals, nameByIds);
}
//(4)体育考生
......@@ -497,16 +513,16 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//判断考生是否有报取资格
//综合成绩差值
double value = secondRule.getCurrentYearCulture() - secondRule.getCultureMin();
double culture = Double.parseDouble(schemeVo.getCultureGrade());
double major = Double.parseDouble(schemeVo.getMajorGrade());
/* double culture = Double.parseDouble(schemeVo.getCultureGrade());
double major = Double.parseDouble(schemeVo.getMajorGrade());*/
//计算综合成绩
double totalv = major * 750 / 100 * 0.7 + culture * 0.3 - value;
if (totalv < secondRule.getCultureMin()) {
/* double totalv = major * 750 / 100 * 0.7 + culture * 0.3 - value;*/
if(cultureGrade < secondRule.getCultureMin() || majorGrade < secondRule.getProfessionMin()){
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getSportsVipList(totalv, firstRule, secondRule, total, locals, nameByIds);
list = getSportsVipList(firstRule,secondRule,cultureGrade,majorGrade,totalMax,totalMin, locals, nameByIds);
}
//4判断是否展示全部方案
......@@ -542,9 +558,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
* @param professionNames 专业名称
* @return vip文化生志愿列表
*/
private List<Volunteer> getCultureVipList(AdmissionRule firstRule, AdmissionRule secondRule, Integer total, List<String> locals,
List<String> professionNames,
double firstCulture, double secondCulture) {
private List<Volunteer> getCultureVipList(AdmissionRule firstRule, AdmissionRule secondRule,Double cultureGrade, Integer totalMax,Integer totalMin, List<String> locals, List<String> professionNames) {
double cultureMax = firstRule.getCultureMax();
double cultureMin = firstRule.getCultureMin();
......@@ -553,14 +567,16 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
Map<String, Object> map = new HashMap<>(16);
map.put("professionNames", professionNames);
map.put("locals", locals);
if (firstCulture < cultureMax && firstCulture >= cultureMin) {
if (cultureGrade < cultureMax && totalMin >= cultureGrade) {
map.put("type", SchemeTypeEnums.UNDERGRADUATE_CULTURE.getCode());
map.put("total", total);
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
list = volunteerMapper.getVolunteerListVip(map);
} else {
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_MAJOR.getCode());
map.put("total", total);
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
list = volunteerMapper.getVolunteerListVip(map);
}
return list;
......@@ -574,85 +590,96 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
* @param professionNames 专业名称
* @return 志愿方案列表
*/
private List<Volunteer> getArtsVipList(SchemeVipVo schemeVo, AdmissionRule firstRule, AdmissionRule secondRule, Integer total, List<String> locals,
private List<Volunteer> getArtsVipList( AdmissionRule firstRule ,AdmissionRule secondRule,Double cultureGrade,Double majorGrade, Integer totalMax,Integer totalMin, List<String> locals,
List<String> professionNames) {
//本科类比分 = 本年录取分 -去年录取分 + 考生分数
double culture = firstRule.getCurrentYearCulture() - firstRule.getCultureMin() + Double.parseDouble(schemeVo.getCultureGrade());
double major = firstRule.getCurrentYearMajor() - firstRule.getProfessionMin() + Double.parseDouble(schemeVo.getMajorGrade());
/*double culture = firstRule.getCurrentYearCulture() - firstRule.getCultureMin() + Double.parseDouble(schemeVo.getCultureGrade());
double major = firstRule.getCurrentYearMajor() - firstRule.getProfessionMin() + Double.parseDouble(schemeVo.getMajorGrade());*/
Map<String, Object> map = new HashMap<>(16);
map.put("professionNames", professionNames);
map.put("locals", locals);
//1、考生是否能报取美术本科
List<Volunteer> list = new ArrayList<>();
if (culture >= firstRule.getCultureMin() && major >= firstRule.getProfessionMin()) {
if (cultureGrade >= firstRule.getCultureMin() && majorGrade >= firstRule.getProfessionMin()) {
map.put("type", SchemeTypeEnums.UNDERGRADUATE_ARTS.getCode());
map.put("total", total);
map.put("locals", locals);
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
list = volunteerMapper.getVolunteerListVip(map);
return list;
}else{
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_ARTS.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
list = volunteerMapper.getVolunteerListVip(map);
}
//专科科类比分 = 本年录取分 -去年录取分 + 考生分数
double secondCulture = secondRule.getCurrentYearCulture() - secondRule.getCultureMin() +
/* double secondCulture = secondRule.getCurrentYearCulture() - secondRule.getCultureMin() +
Double.parseDouble(schemeVo.getCultureGrade());
double secondMajor = secondRule.getCurrentYearMajor() - secondRule.getProfessionMin() +
Double.parseDouble(schemeVo.getMajorGrade());
Double.parseDouble(schemeVo.getMajorGrade());*/
//2、考生是否能报取美术专科
if (secondCulture >= secondRule.getCultureMin() && secondMajor >= secondRule.getProfessionMin()) {
/* if (secondCulture >= secondRule.getCultureMin() && secondMajor >= secondRule.getProfessionMin()) {
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_ARTS.getCode());
map.put("total", total);
map.put("locals", locals);
list = volunteerMapper.getVolunteerListVip(map);
}
}*/
return list;
}
/**
* 获取vip文学编导生志愿方案
*
* @param queryVo 考生成绩
* @param firstRule 本科规则
* @param secondRule 专科规则
* @param professionNames 专业名称
* @return 志愿方案列表
*/
private List<Volunteer> getLiteratureVipList(SchemeVipVo queryVo, AdmissionRule firstRule, AdmissionRule secondRule, Integer total,List<String> locals,
private List<Volunteer> getLiteratureVipList(AdmissionRule firstRule ,AdmissionRule secondRule,Double cultureGrade,Double majorGrade, Integer totalMax,Integer totalMin, List<String> locals,
List<String> professionNames) {
//本科类比分 = 本年录取分 -去年录取分 + 考生分数
double culture = firstRule.getCurrentYearCulture() - firstRule.getCultureMin() + Double.parseDouble(queryVo.getCultureGrade());
double major = firstRule.getCurrentYearMajor() - firstRule.getProfessionMin() + Double.parseDouble(queryVo.getMajorGrade());
/*double culture = firstRule.getCurrentYearCulture() - firstRule.getCultureMin() + Double.parseDouble(queryVo.getCultureGrade());
double major = firstRule.getCurrentYearMajor() - firstRule.getProfessionMin() + Double.parseDouble(queryVo.getMajorGrade());*/
Map<String, Object> map = new HashMap<>(16);
map.put("professionNames", professionNames);
map.put("locals", locals);
//1、考生是否能报取美术本科
List<Volunteer> list = new ArrayList<>();
if (culture >= firstRule.getCultureMin() && major >= firstRule.getProfessionMin()) {
if (cultureGrade >= firstRule.getCultureMin() && majorGrade >= firstRule.getProfessionMin()) {
map.put("type", SchemeTypeEnums.UNDERGRADUATE_LITERATURE.getCode());
map.put("total", total);
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
map.put("locals", locals);
list = volunteerMapper.getVolunteerListVip(map);
return list;
}else{
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_LITERATURE.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
map.put("locals", locals);
list = volunteerMapper.getVolunteerListVip(map);
}
//专科类比分 = 本年录取分 -去年录取分 + 考生分数
double cultureSecond = firstRule.getCurrentYearCulture() - firstRule.getCultureMin() + Double.parseDouble(queryVo.getCultureGrade());
double majorSecond = firstRule.getCurrentYearMajor() - firstRule.getProfessionMin() + Double.parseDouble(queryVo.getMajorGrade());
/* double cultureSecond = firstRule.getCurrentYearCulture() - firstRule.getCultureMin() + Double.parseDouble(queryVo.getCultureGrade());
double majorSecond = firstRule.getCurrentYearMajor() - firstRule.getProfessionMin() + Double.parseDouble(queryVo.getMajorGrade());*/
//2、考生是否能报取美术专科
if (cultureSecond >= secondRule.getCultureMin() && majorSecond >= secondRule.getProfessionMin()) {
/* if (cultureSecond >= secondRule.getCultureMin() && majorSecond >= secondRule.getProfessionMin()) {
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_LITERATURE.getCode());
map.put("total", total);
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
map.put("locals", locals);
list = volunteerMapper.getVolunteerListVip(map);
}
}*/
return list;
}
......@@ -660,34 +687,42 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
/**
* 获取vip体育生生志愿方案
*
* @param total 考生综合成绩
* @param totalMax 考生综合成绩最高分
* @param firstRule 本科规则
* @param secondRule 专科规
* @param professionNames 专业名称
* @return 志愿方案列表
*/
private List<Volunteer> getSportsVipList(double total, AdmissionRule firstRule, AdmissionRule secondRule, Integer totalv,List<String> locals,
private List<Volunteer> getSportsVipList(AdmissionRule firstRule ,AdmissionRule secondRule,Double cultureGrade,Double majorGrade, Integer totalMax,Integer totalMin, List<String> locals,
List<String> professionNames) {
Map<String, Object> map = new HashMap<>(16);
map.put("professionNames", professionNames);
map.put("locals", locals);
//1、考生是否能报取体育本科
List<Volunteer> list = new ArrayList<>();
if (total >= firstRule.getCultureMin()) {
if (cultureGrade >= firstRule.getCultureMin()&&majorGrade>firstRule.getProfessionMin()) {
map.put("type", SchemeTypeEnums.UNDERGRADUATE_SPORTS.getCode());
map.put("total", totalv);
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
map.put("locals", locals);
list = volunteerMapper.getVolunteerListVip(map);
}else{
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_SPORTS.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
map.put("locals", locals);
list = volunteerMapper.getVolunteerListVip(map);
return list;
}
//2、考生是否能报取体育专科
if (total >= secondRule.getCultureMin()) {
/* if (total >= secondRule.getCultureMin()) {
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_SPORTS.getCode());
map.put("total", totalv);
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
map.put("locals", locals);
list = volunteerMapper.getVolunteerListVip(map);
}
}*/
return list;
}
......
......@@ -21,6 +21,7 @@ import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.AccessControlFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpStatus;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
......@@ -76,6 +77,7 @@ public class KickoutSessionControlFilter extends AccessControlFilter{
log.info("KickoutSessionControlFilter Not Login begin.......");
Subject subject = getSubject(request, response);
Map<String, Object> map = new HashMap<>();
HttpServletRequest httpServletRequest=(HttpServletRequest) request;
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
// 没有登陆或没有设置“记住我”
HttpServletRequest request1 = (HttpServletRequest) request;
......@@ -85,7 +87,7 @@ public class KickoutSessionControlFilter extends AccessControlFilter{
if (!subject.isAuthenticated() && !subject.isRemembered()) {
log.info("KickoutSessionControlFilter isAuthenticated and isRemembered Please login first .......");
// 没有登陆,抛出异常
thrLogoutException(httpServletResponse, "1001", "Please login first");
thrLogoutException(httpServletRequest,httpServletResponse, "1001", "Please login first");
return false;
}
Session session = subject.getSession();
......@@ -114,7 +116,7 @@ public class KickoutSessionControlFilter extends AccessControlFilter{
try {
//退出登录
subject.logout();
thrLogoutException(httpServletResponse, "1002", "您已经在其他地方登录,请重新登录。如有疑问请联系管理员!");
thrLogoutException(httpServletRequest,httpServletResponse, "1002", "您已经在其他地方登录,请重新登录。如有疑问请联系管理员!");
} catch (Exception e) {
e.printStackTrace();
}
......@@ -182,13 +184,16 @@ public class KickoutSessionControlFilter extends AccessControlFilter{
}
// 抛出未登录异常
private void thrLogoutException(HttpServletResponse response,String ErrorCode,String ErrorMsg){
private void thrLogoutException(HttpServletRequest request,HttpServletResponse response,String ErrorCode,String ErrorMsg){
PrintWriter writer = null;
try {
Result result = new Result();
result.setResult(Result.RESULT_FLG.FAIL.getValue());
result.setErrorCode(ErrorCode);
result.setErrorMsg(ErrorMsg);
setHeader(request, response);
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
response.setContentType("application/json; charset=UTF-8");
writer = response.getWriter();
writer.write(JSON.toJSONString(result));
......@@ -202,6 +207,16 @@ public class KickoutSessionControlFilter extends AccessControlFilter{
}
}
}
private void setHeader(HttpServletRequest request, HttpServletResponse response) {
//跨域的header设置
response.setHeader("Access-control-Allow-Origin", request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Methods", request.getMethod());
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Headers", request.getHeader("Access-Control-Request-Headers"));
//防止乱码,适用于传输JSON数据
//Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild
response.setHeader("Content-Type", "application/json;charset=UTF-8");
response.setStatus(HttpStatus.OK.value());
}
}
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