Commit f1359fdd authored by cy's avatar cy

修改方案查询专业限制

parent c7a63eb8
......@@ -214,7 +214,6 @@
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=")">
......@@ -222,6 +221,13 @@
</foreach>
</if>
<if test="classNames != null">
and
<foreach collection="classNames" index="index" item="id" separator="or" open="(" close=")">
course_demand LIKE CONCAT('%',#{id},'%')
</foreach>
</if>
<if test="professionNames != null and (professionNames.size)>0">
and
<foreach collection="professionNames" index="index" item="id" separator="or" open="(" close=")">
......
......@@ -17,7 +17,7 @@ public enum StudentClassEnum {
HISTORY_GRADE(4, "历史"),
GEOGRAPHY_GRADE(5, "地理"),
POLITICS_GRADE(6, "政治"),
POLITICS_GRADE(6, "思想政治"),
UNLIMITED(7, "不限");
private Integer code;
......
......@@ -63,4 +63,10 @@ public class SchemeVipVo implements Serializable {
*/
@ApiModelProperty(value = "是否展示全部 0:否 1:是", name = "isShowAll")
private Integer isShowAll;
/**
* 类型(专科、本科)
*/
@ApiModelProperty(value = "类型(专科、本科)",name = "gradeType")
private String gradeType;
}
......@@ -32,7 +32,7 @@ public interface SchemeRecordService {
* @param recordId 方案记录id
* @return 方案志愿列表
*/
R<List<Volunteer>> getVolunteerList(Integer userId,Integer recordId);
R<List<Volunteer>> getVolunteerList(Integer userId,Integer recordId,String searchSource);
/**
* 方案pdf导出
......@@ -40,7 +40,7 @@ public interface SchemeRecordService {
* @param recordId 方案查询记录id
* @return 0:导出成功,1:导出失败
*/
R<Boolean> export(Integer userId, Integer recordId, HttpServletResponse response);
R<Boolean> export(Integer userId, Integer recordId, HttpServletResponse response,String searchSource);
/**
* 方案excel导出
......@@ -48,5 +48,5 @@ public interface SchemeRecordService {
* @param recordId 方案查询记录id
* @return 0:导出成功,1:导出失败
*/
R<Boolean> createExcel(Integer userId, Integer recordId, HttpServletResponse response);
R<Boolean> createExcel(Integer userId, Integer recordId, HttpServletResponse response,String searchSource);
}
package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.dto.PayPageDto;
import cn.wisenergy.model.dto.PayQueryDto;
import javax.crypto.IllegalBlockSizeException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
/**
* @author 86187
*/
public interface WxPayService1 {
/**
* 微行支付接口
* @param payPageDto 入参
* @return
*/
R<String> wxPay(PayPageDto payPageDto) throws UnsupportedEncodingException, NoSuchAlgorithmException, SignatureException, InvalidKeySpecException, InvalidKeyException;
/**
* 微信支付-交易查询
* @param payQueryDto 入参
* @return
*/
R<String> queryWx(PayQueryDto payQueryDto) throws UnsupportedEncodingException, NoSuchAlgorithmException, SignatureException, InvalidKeySpecException, InvalidKeyException;
R<String> wx_Pay(PayPageDto payPageDto) throws IOException, NoSuchAlgorithmException, SignatureException, InvalidKeySpecException, InvalidKeyException, IllegalBlockSizeException;
}
......@@ -23,10 +23,10 @@ import com.itextpdf.text.Document;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.pdf.PdfWriter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletResponse;
......@@ -97,7 +97,7 @@ public class SchemeRecordServiceImpl extends ServiceImpl<SchemeRecordMapper, Sch
}
@Override
public R<List<Volunteer>> getVolunteerList(Integer userId, Integer recordId) {
public R<List<Volunteer>> getVolunteerList(Integer userId, Integer recordId,String searchSource) {
log.info("volunteer-service[]SchemeRecordServiceImpl[]getVolunteerList[]input.param.userId,recordId:" + userId);
if (null == userId || null == recordId) {
return R.error("入参为空!");
......@@ -123,7 +123,10 @@ public class SchemeRecordServiceImpl extends ServiceImpl<SchemeRecordMapper, Sch
for (Volunteer volunteer : result) {
volunteer.setQueryTime(schemeQueryRecord.getCreateTime());
}
//result.sort(Comparator.comparing(Volunteer::getLowestMark).reversed());
//判断是否是私人订制,不是就按照录取分数排序
if(StringUtils.isBlank(searchSource)){
result.sort(Comparator.comparing(Volunteer::getLowestMark).reversed());
}
//最低位次为空,则用--代替
for(Volunteer info : result){
if(info.getLowestRank() == null){
......@@ -141,7 +144,7 @@ public class SchemeRecordServiceImpl extends ServiceImpl<SchemeRecordMapper, Sch
* @return
*/
@Override
public R<Boolean> export(Integer userId, Integer recordId, HttpServletResponse response) {
public R<Boolean> export(Integer userId, Integer recordId, HttpServletResponse response,String searchSource) {
log.info("volunteer-service[]SchemeRecordServiceImpl[]export[]input.param.userId,recordId:" + userId);
//查询时间
......@@ -180,7 +183,10 @@ public class SchemeRecordServiceImpl extends ServiceImpl<SchemeRecordMapper, Sch
info.setLowestRank("0");
}
}
//判断是否是私人订制,不是就按照录取分数排序
if(StringUtils.isBlank(searchSource)){
result.sort(Comparator.comparing(Volunteer::getLowestMark).reversed());
}
//调用工具生成PDF
try {
// 1.新建document对象
......@@ -226,7 +232,7 @@ public class SchemeRecordServiceImpl extends ServiceImpl<SchemeRecordMapper, Sch
}
@Override
public R<Boolean> createExcel(Integer userId, Integer recordId, HttpServletResponse response) {
public R<Boolean> createExcel(Integer userId, Integer recordId, HttpServletResponse response,String searchSource) {
log.info("SchemeRecordServiceImpl[].createExcel[].input.param:userId,recordId" + userId, recordId);
//查询时间
......@@ -262,7 +268,10 @@ public class SchemeRecordServiceImpl extends ServiceImpl<SchemeRecordMapper, Sch
}
List<Integer> ids = list.stream().map(UserVolunteer::getVolunteerId).collect(Collectors.toList());
List<Volunteer> result = volunteerMapper.getListByIds(ids);
//判断是否是私人订制,不是就按照录取分数排序
if(StringUtils.isBlank(searchSource)){
result.sort(Comparator.comparing(Volunteer::getLowestMark).reversed());
}
//生成Excel
try {
......
......@@ -254,7 +254,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
List<Volunteer> volunteers = volunteerVo.getVolunteers();
//为空的最低位次用--代替
for (Volunteer info : volunteers) {
if (null == info.getLowestRank()) {
if (StringUtils.isBlank(info.getLowestRank())) {
info.setLowestRank("--");
}
}
......@@ -288,7 +288,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//为空的最低位次用--代替
List<Volunteer> volunteers = volunteerVo.getVolunteers();
for (Volunteer info : volunteers) {
if (null == info.getLowestRank()) {
if (StringUtils.isBlank(info.getLowestRank())) {
info.setLowestRank("--");
}
}
......@@ -403,6 +403,14 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
if (null == scoreInfo) {
return R.error("无vip客户成绩!");
}
//3、副科名称
List<String> className = getClassName(scoreInfo);
if (CollectionUtils.isEmpty(className)) {
return R.error("考生无副科成绩!");
}
//本科or专科
String gradeType = schemeVo.getGradeType() == null ? null : schemeVo.getGradeType();
//文化分
Double majorGrade = scoreInfo.getMajorGrade();
//专业分
......@@ -435,7 +443,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
if (cultureGrade < secondRule.getCultureMin()) {
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getCultureVipList(firstRule, cultureGrade, totalMax, totalMin, locals, nameByIds);
list = getCultureVipList(firstRule, cultureGrade, totalMax, totalMin, locals, nameByIds, className, gradeType);
}
//(2)美术考生
......@@ -455,7 +463,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
if (majorGrade < secondRule.getProfessionMin()) {
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getArtsVipList(firstRule, cultureGrade, majorGrade, totalMax, totalMin, locals, nameByIds);
list = getArtsVipList(firstRule, cultureGrade, majorGrade, totalMax, totalMin, locals, nameByIds, className, gradeType);
}
//(3)文学编导考生
......@@ -475,7 +483,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
if (majorGrade < secondRule.getProfessionMin()) {
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getLiteratureVipList(firstRule, cultureGrade, majorGrade, totalMax, totalMin, locals, nameByIds);
list = getLiteratureVipList(firstRule, cultureGrade, majorGrade, totalMax, totalMin, locals, nameByIds, className, gradeType);
}
//(4)体育考生
......@@ -496,7 +504,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getSportsVipList(firstRule, cultureGrade, majorGrade, totalMax, totalMin, locals, nameByIds);
list = getSportsVipList(firstRule, cultureGrade, majorGrade, totalMax, totalMin, locals, nameByIds, className, gradeType);
}
//4判断是否展示全部方案
......@@ -507,6 +515,21 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
} else {
result = list.subList(0, 10);
}
//筛选出带和的字符串的限专业学校
Iterator<Volunteer> iterator = list.iterator();
while(iterator.hasNext()){
Volunteer info = iterator.next();
if (info.getCourseDemand().contains("和")) {
String[] course = info.getCourseDemand().split("和");
String classStr = className.stream().map(String::valueOf).collect(Collectors.joining(","));
for (String co : course) {
if (!classStr.contains(co)) {
iterator.remove();
break;
}
}
}
}
//设置查询时间
SetQueryTime(result);
volunteerVo.setUserId(user.getId());
......@@ -517,6 +540,21 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//排序
list.sort(Comparator.comparing(Volunteer::getLowestMark).reversed());
volunteerVo.setUserId(user.getId());
//筛选出带和的字符串的限专业学校
Iterator<Volunteer> iterator = list.iterator();
while(iterator.hasNext()){
Volunteer info = iterator.next();
if (info.getCourseDemand().contains("和")) {
String[] course = info.getCourseDemand().split("和");
String classStr = className.stream().map(String::valueOf).collect(Collectors.joining(","));
for (String co : course) {
if (!classStr.contains(co)) {
iterator.remove();
break;
}
}
}
}
//设置查询时间
SetQueryTime(list);
......@@ -532,7 +570,8 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
* @param professionNames 专业名称
* @return vip文化生志愿列表
*/
private List<Volunteer> getCultureVipList(AdmissionRule firstRule, double cultureGrade, Integer totalMax, Integer totalMin, List<String> locals, List<String> professionNames) {
private List<Volunteer> getCultureVipList(AdmissionRule firstRule, double cultureGrade, Integer totalMax, Integer totalMin,
List<String> locals, List<String> professionNames, List<String> classNames, String gradeType) {
double cultureMax = firstRule.getCultureMax();
double cultureMin = firstRule.getCultureMin();
......@@ -541,7 +580,10 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
Map<String, Object> map = new HashMap<>(16);
map.put("professionNames", professionNames);
map.put("locals", locals);
if (cultureGrade <= cultureMax && cultureGrade >= cultureMin) {
map.put("classNames", classNames);
boolean type = !StringUtils.isBlank(gradeType) && GradeType.UNDERGRADUATE.getDescription().equals(gradeType);
boolean grade = StringUtils.isBlank(gradeType) && cultureGrade <= cultureMax && cultureGrade >= cultureMin;
if (type || grade) {
map.put("type", SchemeTypeEnums.UNDERGRADUATE_CULTURE.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
......@@ -564,13 +606,16 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
* @return 志愿方案列表
*/
private List<Volunteer> getArtsVipList(AdmissionRule firstRule, double cultureGrade, double majorGrade, Integer totalMax, Integer totalMin, List<String> locals,
List<String> professionNames) {
List<String> professionNames, List<String> classNames, String gradeType) {
Map<String, Object> map = new HashMap<>(16);
map.put("professionNames", professionNames);
map.put("locals", locals);
map.put("classNames", classNames);
//1、考生是否能报取美术本科
List<Volunteer> list;
if (cultureGrade >= firstRule.getCultureMin() && majorGrade >= firstRule.getProfessionMin()) {
boolean type = !StringUtils.isBlank(gradeType) && GradeType.UNDERGRADUATE.getDescription().equals(gradeType);
boolean grade = StringUtils.isBlank(gradeType) && cultureGrade >= firstRule.getCultureMin() && majorGrade >= firstRule.getProfessionMin();
if (type || grade) {
map.put("type", SchemeTypeEnums.UNDERGRADUATE_ARTS.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
......@@ -593,14 +638,16 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
* @return 志愿方案列表
*/
private List<Volunteer> getLiteratureVipList(AdmissionRule firstRule, double cultureGrade, double majorGrade, Integer totalMax, Integer totalMin, List<String> locals,
List<String> professionNames) {
List<String> professionNames, List<String> classNames, String gradeType) {
Map<String, Object> map = new HashMap<>(16);
map.put("professionNames", professionNames);
map.put("locals", locals);
map.put("classNames", classNames);
//1、考生是否能报取美术本科
List<Volunteer> list;
if (cultureGrade >= firstRule.getCultureMin() && majorGrade >= firstRule.getProfessionMin()) {
boolean type = !StringUtils.isBlank(gradeType) && GradeType.UNDERGRADUATE.getDescription().equals(gradeType);
boolean grade = StringUtils.isBlank(gradeType) && cultureGrade >= firstRule.getCultureMin() && majorGrade >= firstRule.getProfessionMin();
if (type || grade) {
map.put("type", SchemeTypeEnums.UNDERGRADUATE_LITERATURE.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
......@@ -626,13 +673,16 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
* @return 志愿方案列表
*/
private List<Volunteer> getSportsVipList(AdmissionRule firstRule, double cultureGrade, double majorGrade, Integer totalMax, Integer totalMin, List<String> locals,
List<String> professionNames) {
List<String> professionNames, List<String> classNames, String gradeType) {
Map<String, Object> map = new HashMap<>(16);
map.put("professionNames", professionNames);
map.put("locals", locals);
map.put("classNames", classNames);
//1、考生是否能报取体育本科
List<Volunteer> list;
if (cultureGrade >= firstRule.getCultureMin() && majorGrade > firstRule.getProfessionMin()) {
boolean type = !StringUtils.isBlank(gradeType) && GradeType.UNDERGRADUATE.getDescription().equals(gradeType);
boolean grade = StringUtils.isBlank(gradeType) && cultureGrade >= firstRule.getCultureMin() && majorGrade > firstRule.getProfessionMin();
if (type || grade) {
map.put("type", SchemeTypeEnums.UNDERGRADUATE_SPORTS.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
......@@ -730,7 +780,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//1、考生是否能报取美术本科
List<Volunteer> list = new ArrayList<>();
boolean type = !StringUtils.isBlank(gradeType) && GradeType.UNDERGRADUATE.getDescription().equals(gradeType);
boolean grade=StringUtils.isBlank(gradeType) && culture >= firstRule.getCultureMin() && major >= firstRule.getProfessionMin();
boolean grade = StringUtils.isBlank(gradeType) && culture >= firstRule.getCultureMin() && major >= firstRule.getProfessionMin();
if (type || grade) {
//浮动分数
double upGrade = total + firstRule.getUpMark();
......@@ -945,6 +995,21 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
*/
private List<Volunteer> fillUpVolunteer(List<Volunteer> list, Integer number, double max, double min, Integer type, List<String> classNames) {
String classStr = classNames.stream().map(String::valueOf).collect(Collectors.joining(","));
//筛选出带和的字符串的限专业学校进行判断
Iterator<Volunteer> iterator = list.iterator();
while(iterator.hasNext()){
Volunteer info = iterator.next();
if (info.getCourseDemand().contains("和")) {
String[] course = info.getCourseDemand().split("和");
for (String co : course) {
if (!classStr.contains(co)) {
iterator.remove();
break;
}
}
}
}
//已存在的志愿ids
List<Integer> volunteerIds = list.stream().map(Volunteer::getId).collect(Collectors.toList());
......@@ -969,9 +1034,22 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
if (volunteers.size() > 1) {
Random mRandom = new Random();
int count = mRandom.nextInt(volunteers.size());
//判断限制专业
String courseDemand = volunteers.get(count).getCourseDemand();
if(courseDemand.contains("和")){
String[] course = courseDemand.split("和");
for (String co : course) {
if (!classStr.contains(co)) {
volunteers.remove(count);
break;
}
}
}else{
resultList.add(volunteers.get(count));
volunteers.remove(count);
otherList.addAll(volunteers);
}
} else {
resultList.addAll(volunteers);
}
......@@ -994,6 +1072,18 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
otherList.remove(count);
continue;
}
//判断限制专业
String courseDemand = otherList.get(count).getCourseDemand();
if(courseDemand.contains("和")){
String[] course = courseDemand.split("和");
for (String co : course) {
if (!classStr.contains(co)) {
otherList.remove(count);
break;
}
}
continue;
}
volunteers.add(otherList.get(count));
otherList.remove(count);
} else {
......
......@@ -59,41 +59,44 @@ public class SchemeRecordController {
@ApiOperation(value = "获取充值记录志愿列表", notes = "获取充值记录志愿列表", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "int", required = true),
@ApiImplicitParam(name = "recordId", value = "记录id", dataType = "int", required = true)
@ApiImplicitParam(name = "recordId", value = "记录id", dataType = "int", required = true),
@ApiImplicitParam(name = "searchSource", value = "查询来源(私人订制需要传值,其他端不用传)", dataType = "String")
})
@GetMapping("/getVolunteerList")
public R<List<Volunteer>> getVolunteerList(Integer userId, Integer recordId) {
public R<List<Volunteer>> getVolunteerList(Integer userId, Integer recordId,String searchSource) {
log.info("volunteer-service[]SchemeRecordController[]getVolunteerList[]input.param.userId:{},recordId:" + userId, recordId);
if (null == userId || null == recordId) {
return R.error("入参为空!");
}
return schemeRecordService.getVolunteerList(userId, recordId);
return schemeRecordService.getVolunteerList(userId, recordId,searchSource);
}
@ApiOperation(value = "方案导出", notes = "方案导出", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "int", required = true),
@ApiImplicitParam(name = "recordId", value = "记录id", dataType = "int", required = true)
@ApiImplicitParam(name = "recordId", value = "记录id", dataType = "int", required = true),
@ApiImplicitParam(name = "searchSource", value = "查询来源(私人订制需要传值,其他端不用传)", dataType = "String")
})
@GetMapping("/export")
public R<Boolean> export(Integer userId, Integer recordId, HttpServletResponse response) {
public R<Boolean> export(Integer userId, Integer recordId, HttpServletResponse response,String searchSource) {
log.info("volunteer-service[]SchemeRecordController[]getVolunteerList[]input.param.userId,recordId:" + userId, recordId);
if (null == userId || null == recordId) {
return R.error("入参为空!");
}
return schemeRecordService.export(userId, recordId,response);
return schemeRecordService.export(userId, recordId,response,searchSource);
}
@ApiOperation(value = "方案Excel导出",notes = "方案Excel导出",httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "int", required = true),
@ApiImplicitParam(name = "recordId", value = "记录id", dataType = "int", required = true)
@ApiImplicitParam(name = "recordId", value = "记录id", dataType = "int", required = true),
@ApiImplicitParam(name = "searchSource", value = "查询来源(私人订制需要传值,其他端不用传)", dataType = "String")
})
@GetMapping(value = "/createExcel")
public R<Boolean> createExcel(Integer userId, Integer recordId, HttpServletResponse response){
public R<Boolean> createExcel(Integer userId, Integer recordId, HttpServletResponse response,String searchSource){
log.info("volunteer-service[]SchemeRecordController[]createExcel[]input.param.userId,recordId:" + userId, recordId);
return schemeRecordService.createExcel(userId,recordId,response);
return schemeRecordService.createExcel(userId,recordId,response,searchSource);
}
}
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