录取率计算时,过滤不是同一种录取方式

This commit is contained in:
zhouwentao 2024-02-06 15:46:07 +08:00
parent b90ce993ae
commit f0548cb551
15 changed files with 292 additions and 198 deletions

View File

@ -51,6 +51,9 @@ public class QueryRecommendMajorVO extends ArtBaseDTO {
@ApiModelProperty(value = "录取方式")
private String rulesEnrollProbability;
@ApiModelProperty(value = "成绩id")
private String scoreId;
/*public void setBatch(String batch) {
if (StringUtils.isNotBlank(batch)) {
if ("本科".equals(batch)) {

View File

@ -24,6 +24,12 @@ public class SaveVolunteerVO implements Serializable {
@Excel(name = "学校编码", width = 15)
@ApiModelProperty(value = "学校编码")
private java.lang.String schoolCode;
/**招生代码*/
@Excel(name = "招生代码", width = 15)
@ApiModelProperty(value = "招生代码")
private String enrollmentCode;
/**志愿顺序*/
@Excel(name = "志愿顺序", width = 15)
@ApiModelProperty(value = "志愿顺序")
@ -34,6 +40,11 @@ public class SaveVolunteerVO implements Serializable {
@ApiModelProperty(value = "志愿批次")
private java.lang.String batch;
/**文理分科*/
@Excel(name = "文理分科", width = 15)
@ApiModelProperty(value = "文理分科")
private java.lang.String category;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;

View File

@ -1,6 +1,5 @@
package org.jeecg.modules.system.controller;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xkcoding.justauth.AuthRequestFactory;
@ -66,6 +65,13 @@ public class ThirdLoginController {
@Autowired
private ThirdAppDingtalkServiceImpl thirdAppDingtalkService;
@RequestMapping("/wechat/login")
public void wechatLogin(){
}
@RequestMapping("/render/{source}")
public void render(@PathVariable("source") String source, HttpServletResponse response) throws IOException {
log.info("第三方登录进入render" + source);
@ -238,7 +244,7 @@ public class ThirdLoginController {
//update-end-author:wangshuai date:20201118 for:如果真实姓名和头像不存在就取第三方登录的
JSONObject obj = new JSONObject();
//TODO 第三方登确定登录租户和部门逻辑
//用户登录信息
obj.put("userInfo", sysUser);
//获取字典缓存解决 #jeecg-boot/issues/3998
@ -424,4 +430,4 @@ public class ThirdLoginController {
}
}
}
}

View File

@ -50,7 +50,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
public class YxHistoryScoreControlLineController extends JeecgController<YxHistoryScoreControlLine, IYxHistoryScoreControlLineService> {
@Autowired
private IYxHistoryScoreControlLineService yxHistoryScoreControlLineService;
/**
* 分页列表查询
*
@ -67,12 +67,11 @@ public class YxHistoryScoreControlLineController extends JeecgController<YxHisto
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<YxHistoryScoreControlLine> queryWrapper = QueryGenerator.initQueryWrapper(yxHistoryScoreControlLine, req.getParameterMap());
Page<YxHistoryScoreControlLine> page = new Page<YxHistoryScoreControlLine>(pageNo, pageSize);
IPage<YxHistoryScoreControlLine> pageList = yxHistoryScoreControlLineService.page(page, queryWrapper);
IPage<YxHistoryScoreControlLine> pageList = yxHistoryScoreControlLineService.pageList(page,yxHistoryScoreControlLine);
return Result.OK(pageList);
}
/**
* 添加
*
@ -87,7 +86,7 @@ public class YxHistoryScoreControlLineController extends JeecgController<YxHisto
yxHistoryScoreControlLineService.save(yxHistoryScoreControlLine);
return Result.OK("添加成功!");
}
/**
* 编辑
*
@ -102,7 +101,7 @@ public class YxHistoryScoreControlLineController extends JeecgController<YxHisto
yxHistoryScoreControlLineService.updateById(yxHistoryScoreControlLine);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
@ -117,7 +116,7 @@ public class YxHistoryScoreControlLineController extends JeecgController<YxHisto
yxHistoryScoreControlLineService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
@ -132,7 +131,7 @@ public class YxHistoryScoreControlLineController extends JeecgController<YxHisto
this.yxHistoryScoreControlLineService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*

View File

@ -37,14 +37,18 @@ public class YxVolunteerRecord implements Serializable {
/**志愿id*/
@ApiModelProperty(value = "志愿id")
private java.lang.String volunteerId;
/**专业编码*/
@Excel(name = "专业编码", width = 15)
@ApiModelProperty(value = "专业编码")
private java.lang.String majorCode;
/**学校编码*/
@Excel(name = "学校编码", width = 15)
@ApiModelProperty(value = "学校编码")
private java.lang.String schoolCode;
/**专业编码*/
@Excel(name = "专业编码", width = 15)
@ApiModelProperty(value = "专业编码")
private java.lang.String majorCode;
/**招生代码*/
@Excel(name = "招生代码", width = 15)
@ApiModelProperty(value = "招生代码")
private java.lang.String enrollmentCode;
/**志愿顺序*/
@Excel(name = "志愿顺序", width = 15)
@ApiModelProperty(value = "志愿顺序")

View File

@ -2,6 +2,8 @@ package org.jeecg.modules.yx.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.yx.entity.YxHistoryScoreControlLine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -14,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface YxHistoryScoreControlLineMapper extends BaseMapper<YxHistoryScoreControlLine> {
IPage<YxHistoryScoreControlLine> pageList(@Param("page") Page<YxHistoryScoreControlLine> page,@Param("queryvo") YxHistoryScoreControlLine yxHistoryScoreControlLine);
}

View File

@ -2,4 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.yx.mapper.YxHistoryScoreControlLineMapper">
</mapper>
<select id="pageList" resultType="org.jeecg.modules.yx.entity.YxHistoryScoreControlLine">
select * from yx_history_score_control_line
WHERE 1=1
<if test="queryvo.year!=null and queryvo.year!=''">
AND `year` = #{queryvo.year}
</if>
<if test="queryvo.professionalCategory!=null and queryvo.professionalCategory!=''">
AND professional_category = #{queryvo.professionalCategory}
</if>
<if test="queryvo.educationalLevel!=null and queryvo.educationalLevel!=''">
AND educationa_lLevel = #{queryvo.educationalLevel}
</if>
<if test="queryvo.batch!=null and queryvo.batch!=''">
AND batch = #{queryvo.batch}
</if>
<if test="queryvo.category!=null and queryvo.category!=''">
AND category = #{queryvo.category}
</if>
ORDER BY FIELD(batch, '本科A段', '本科B段','本科', '专科')
</select>
</mapper>

View File

@ -1,5 +1,7 @@
package org.jeecg.modules.yx.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.yx.entity.YxHistoryScoreControlLine;
import com.baomidou.mybatisplus.extension.service.IService;
@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IYxHistoryScoreControlLineService extends IService<YxHistoryScoreControlLine> {
IPage<YxHistoryScoreControlLine> pageList(Page<YxHistoryScoreControlLine> page, YxHistoryScoreControlLine yxHistoryScoreControlLine);
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.yx.service;
import org.jeecg.modules.art.vo.SaveVolunteerVO;
import org.jeecg.modules.yx.dto.VolunteerRecordDTO;
import org.jeecg.modules.yx.entity.YxVolunteerRecord;
import com.baomidou.mybatisplus.extension.service.IService;
@ -22,7 +23,7 @@ public interface IYxVolunteerRecordService extends IService<YxVolunteerRecord> {
List<VolunteerRecordDTO> listDTOByVolunteerId(String volunteerId,String cognitioPolyclinic);
boolean artVolunteerSave(YxVolunteerRecord yxVolunteerRecord);
boolean artVolunteerSave(SaveVolunteerVO saveVolunteerVO);
List<YxVolunteerRecord> getListByCreateBy(YxVolunteerRecord yxVolunteerRecord);

View File

@ -1,5 +1,7 @@
package org.jeecg.modules.yx.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.yx.entity.YxHistoryScoreControlLine;
import org.jeecg.modules.yx.mapper.YxHistoryScoreControlLineMapper;
import org.jeecg.modules.yx.service.IYxHistoryScoreControlLineService;
@ -16,4 +18,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class YxHistoryScoreControlLineServiceImpl extends ServiceImpl<YxHistoryScoreControlLineMapper, YxHistoryScoreControlLine> implements IYxHistoryScoreControlLineService {
@Override
public IPage<YxHistoryScoreControlLine> pageList(Page<YxHistoryScoreControlLine> page, YxHistoryScoreControlLine yxHistoryScoreControlLine) {
return baseMapper.pageList(page,yxHistoryScoreControlLine);
}
}

View File

@ -49,6 +49,8 @@ public class YxSchoolMajorServiceImpl extends ServiceImpl<YxSchoolMajorMapper, Y
//100倍率
static BigDecimal bigDecimal100 = new BigDecimal(100);
static BigDecimal bigDecimal075 = new BigDecimal("0.75");
@Override
public boolean exist(YxSchoolMajor yxSchoolMajor) {
String id = yxSchoolMajor.getId();
@ -184,7 +186,13 @@ public class YxSchoolMajorServiceImpl extends ServiceImpl<YxSchoolMajorMapper, Y
if (pageSize == null) {
pageSize = 10;
}
YxUserScore activeCurrentUserScore = yxUserScoreService.getActiveCurrentUserScore();
YxUserScore activeCurrentUserScore = null;
if (StringUtils.isNotBlank(queryRecommendMajorVO.getScoreId())) {
activeCurrentUserScore = yxUserScoreService.findById(queryRecommendMajorVO.getScoreId());
}else{
activeCurrentUserScore = yxUserScoreService.getActiveCurrentUserScore();
}
String cognitioPolyclinic = activeCurrentUserScore.getCognitioPolyclinic();
String professionalCategory = activeCurrentUserScore.getProfessionalCategory();//专业类别
queryRecommendMajorVO.setProfessionalCategory(professionalCategory);
@ -234,6 +242,9 @@ public class YxSchoolMajorServiceImpl extends ServiceImpl<YxSchoolMajorMapper, Y
case "可冲击":
recommendMajorList = recommendMajorList.stream().filter(r->r.getEnrollProbability().compareTo(bigDecimal50)<0 && r.getEnrollProbability().compareTo(bigDecimal30)>=0).collect(Collectors.toList());
break;
case "难录取":
recommendMajorList = recommendMajorList.stream().filter(r->r.getEnrollProbability().compareTo(bigDecimal50)<0 && r.getEnrollProbability().compareTo(bigDecimal30)<=0).collect(Collectors.toList());
break;
}
}
int total = recommendMajorList.size();
@ -318,9 +329,6 @@ public class YxSchoolMajorServiceImpl extends ServiceImpl<YxSchoolMajorMapper, Y
BigDecimal bigDecimal99x = new BigDecimal("95");
for (RecommendMajorDTO recommendMajorDTO : recommendMajorList) {
if (recommendMajorDTO.getMajorName().contains("数字媒体艺术")) {
System.out.println("111");
}
String rulesEnrollProbability = recommendMajorDTO.getRulesEnrollProbability();
//取出往年的分数信息, 算出 三年平均差值
List<YxHistoryMajorEnroll> historyMajorEnrollList = recommendMajorDTO.getHistoryMajorEnrollList();
@ -348,9 +356,9 @@ public class YxSchoolMajorServiceImpl extends ServiceImpl<YxSchoolMajorMapper, Y
//获取今年的分差
nowYearProvincialControlLine = recommendMajorDTO.getCulturalControlLine();
}
size = historyMajorEnrollList.size();
sum = ScoreUtil.computeHistoryMajorEnrollScoreLineDifference(historyMajorEnrollList);
historyThreeYearDiff = sum.divide(new BigDecimal(size), 4, RoundingMode.HALF_UP);
sum = ScoreUtil.computeHistoryMajorEnrollScoreLineDifferenceWithRulesEnrollProbability(rulesEnrollProbability,historyMajorEnrollList);
//historyThreeYearDiff = sum.divide(new BigDecimal(size), 4, RoundingMode.HALF_UP);
historyThreeYearDiff = sum;//
if (nowYearProvincialControlLine == null) {
continue;
}
@ -361,11 +369,11 @@ public class YxSchoolMajorServiceImpl extends ServiceImpl<YxSchoolMajorMapper, Y
//获取录取率
enrollProbability = nowYearDiff.divide(historyThreeYearDiff, 4, RoundingMode.HALF_UP).multiply(bigDecimal100);
if (enrollProbability.compareTo(bigDecimal100) > 0) {
enrollProbability = bigDecimal99x;
//enrollProbability = bigDecimal99x;
}else if(enrollProbability.compareTo(bigDecimal0)<=0){
enrollProbability = bigDecimal0;
}
recommendMajorDTO.setEnrollProbability(enrollProbability);
recommendMajorDTO.setEnrollProbability(enrollProbability.multiply(bigDecimal075));
}
@ -418,9 +426,9 @@ public class YxSchoolMajorServiceImpl extends ServiceImpl<YxSchoolMajorMapper, Y
//获取今年的分差
nowYearProvincialControlLine = recommendMajorDTO.getCulturalControlLine();
}
size = historyMajorEnrollList.size();
sum = ScoreUtil.computeHistoryMajorEnrollScoreLineDifference(historyMajorEnrollList);
historyThreeYearDiff = sum.divide(new BigDecimal(size), 4, RoundingMode.HALF_UP);
sum = ScoreUtil.computeHistoryMajorEnrollScoreLineDifferenceWithRulesEnrollProbability(rulesEnrollProbability,historyMajorEnrollList);
//historyThreeYearDiff = sum.divide(new BigDecimal(size), 4, RoundingMode.HALF_UP);
historyThreeYearDiff = sum;
if (nowYearProvincialControlLine == null) {
continue;
}

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.yx.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.modules.art.vo.SaveVolunteerVO;
import org.jeecg.modules.yx.dto.VolunteerRecordDTO;
import org.jeecg.modules.yx.entity.YxSchoolMajor;
import org.jeecg.modules.yx.entity.YxVolunteerRecord;
@ -9,6 +10,7 @@ import org.jeecg.modules.yx.mapper.YxVolunteerRecordMapper;
import org.jeecg.modules.yx.service.IYxMajorService;
import org.jeecg.modules.yx.service.IYxSchoolMajorService;
import org.jeecg.modules.yx.service.IYxVolunteerRecordService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -44,15 +46,19 @@ public class YxVolunteerRecordServiceImpl extends ServiceImpl<YxVolunteerRecordM
}
@Override
public boolean artVolunteerSave(YxVolunteerRecord yxVolunteerRecord) {
public boolean artVolunteerSave(SaveVolunteerVO saveVolunteerVO) {
YxVolunteerRecord yxVolunteerRecord=new YxVolunteerRecord();
BeanUtils.copyProperties(saveVolunteerVO,yxVolunteerRecord);
String volunteerId = yxVolunteerRecord.getVolunteerId();
String createBy = yxVolunteerRecord.getCreateBy();
String majorCode = yxVolunteerRecord.getMajorCode();
String schoolCode = yxVolunteerRecord.getSchoolCode();
String majorCode = yxVolunteerRecord.getMajorCode();//院校代码
String schoolCode = yxVolunteerRecord.getSchoolCode();//专业代码
String enrollmentCode = yxVolunteerRecord.getEnrollmentCode();//招生代码
Integer indexs = yxVolunteerRecord.getIndexs();
//获取专业的批次 (根据学校代码+专业代码)
//获取专业的批次 (根据学校代码+专业代码+招生代码)
LambdaQueryWrapper<YxSchoolMajor> smQueryWrapper = new LambdaQueryWrapper<YxSchoolMajor>();
smQueryWrapper.eq(YxSchoolMajor::getSchoolCode, schoolCode).eq(YxSchoolMajor::getMajorCode, majorCode);
smQueryWrapper.eq(YxSchoolMajor::getSchoolCode, schoolCode);
smQueryWrapper.eq(YxSchoolMajor::getMajorCode, majorCode);
smQueryWrapper.eq(YxSchoolMajor::getEnrollmentCode,enrollmentCode);
smQueryWrapper.eq(YxSchoolMajor::getCategory,yxVolunteerRecord.getCategory());
YxSchoolMajor schoolMajor = yxSchoolMajorService.getOne(smQueryWrapper);
String batch = schoolMajor.getBatch();
@ -66,9 +72,9 @@ public class YxVolunteerRecordServiceImpl extends ServiceImpl<YxVolunteerRecordM
.gt(YxVolunteerRecord::getIndexs,0)
.orderByAsc(YxVolunteerRecord::getIndexs));
String majorCode_schoolCode = majorCode+schoolCode;
String key = majorCode+schoolCode+enrollmentCode;
//判断这个批次段的是否已填满
long count = list.stream().filter(l -> !(l.getMajorCode()+l.getSchoolCode()).equals(majorCode_schoolCode)).count();
long count = list.stream().filter(l -> !(l.getMajorCode()+l.getSchoolCode()+l.getEnrollmentCode()).equals(key)).count();
if ("提前批".equals(batch)) {
AssertUtils.notTrue(count>=2,"提前批仅可以填报两个志愿");
}else{
@ -77,7 +83,10 @@ public class YxVolunteerRecordServiceImpl extends ServiceImpl<YxVolunteerRecordM
//循环已填报专业与当前专业对比是否一致
for (YxVolunteerRecord volunteer : list) {
if (volunteer.getMajorCode().equals(majorCode)&& volunteer.getSchoolCode().equals(schoolCode)) {
//如果 院校编码专业编码招生代码 都一致说明该专业直接已经填报过则移除该填报明细
if (volunteer.getSchoolCode().equals(schoolCode) &&
volunteer.getMajorCode().equals(majorCode) &&
volunteer.getEnrollmentCode().equals(enrollmentCode)) {
//一致代表本次是移除填报
this.removeById(volunteer.getId());
return true;
@ -88,8 +97,9 @@ public class YxVolunteerRecordServiceImpl extends ServiceImpl<YxVolunteerRecordM
//先看看 这个专业之前有没有填报过如果有填报过就删除以前的
LambdaQueryWrapper<YxVolunteerRecord> removeWrapper = new LambdaQueryWrapper<>();
removeWrapper.eq(YxVolunteerRecord::getVolunteerId,volunteerId);
removeWrapper.eq(YxVolunteerRecord::getMajorCode,majorCode);
removeWrapper.eq(YxVolunteerRecord::getSchoolCode,schoolCode);
removeWrapper.eq(YxVolunteerRecord::getMajorCode,majorCode);
removeWrapper.eq(YxVolunteerRecord::getEnrollmentCode,enrollmentCode);
this.remove(removeWrapper);
if (indexs!=null && indexs>=0) {
//如果入参里有志愿顺序则覆盖原志愿顺序

View File

@ -43,107 +43,90 @@ public class YxVolunteerServiceImpl extends ServiceImpl<YxVolunteerMapper, YxVol
private IYxVolunteerRecordService yxVolunteerRecordService;
@Resource
private IYxHistoryMajorEnrollService yxHistoryMajorEnrollService;
@Resource
private IYxSchoolMajorService yxSchoolMajorService;
final static BigDecimal bigDecimal100 = new BigDecimal("100");//100倍率
@Override
public VolunteerDTO getActiveByCreate(String createBy) {
LambdaQueryWrapper<YxVolunteer> queryWrapper= new LambdaQueryWrapper<YxVolunteer>();
VolunteerDTO volunteerDTO=new VolunteerDTO();
LambdaQueryWrapper<YxVolunteer> queryWrapper= new LambdaQueryWrapper<>();
queryWrapper.eq(YxVolunteer::getCreateBy,createBy);
queryWrapper.eq(YxVolunteer::getState,"1");
queryWrapper.last("limit 1");
YxVolunteer yxVolunteer = this.getOne(queryWrapper);
if (yxVolunteer==null) {
return null;
YxVolunteer volunteer = this.getOne(queryWrapper);
YxUserScore userScore = yxUserScoreService.getActiveCurrentUserScore();
if (userScore==null) {
return volunteerDTO;
}
YxUserScore activeCurrentUserScore = yxUserScoreService.getActiveCurrentUserScore();
String batch = activeCurrentUserScore.getBatch();
String cognitioPolyclinic = activeCurrentUserScore.getCognitioPolyclinic();
VolunteerDTO volunteerDTO=new VolunteerDTO();
BeanUtils.copyProperties(yxVolunteer,volunteerDTO);
LambdaQueryWrapper<YxVolunteerRecord> recordQueryWrapper=new LambdaQueryWrapper<>();
recordQueryWrapper.eq(YxVolunteerRecord::getVolunteerId,volunteerDTO.getId());
recordQueryWrapper.orderByAsc(YxVolunteerRecord::getIndexs);
List<VolunteerRecordDTO> recordDTOList = yxVolunteerRecordService.listDTOByVolunteerId(volunteerDTO.getId(),cognitioPolyclinic);
//获取上一年的招生人数
List<YxHistoryMajorEnroll> historyMajorEnrollList=null;
LambdaQueryWrapper<YxHistoryMajorEnroll> hmeWrapper=new LambdaQueryWrapper<>();
YxHistoryMajorEnroll yxHistoryMajorEnroll=null;
//文化成绩
BigDecimal culturalScore = activeCurrentUserScore.getCulturalScore();
//专业成绩
BigDecimal professionalScore = activeCurrentUserScore.getProfessionalScore();
//100倍率
BigDecimal bigDecimal100 = new BigDecimal(100);
//计算录取概率
if (volunteer==null) {
volunteerDTO.setUserScoreInfo(userScore);
return volunteerDTO;
}
BeanUtils.copyProperties(volunteer,volunteerDTO);
volunteerDTO.setUserScoreInfo(userScore);
String cognitioPolyclinic = userScore.getCognitioPolyclinic();
BigDecimal culturalScore = userScore.getCulturalScore();//文化成绩
BigDecimal professionalScore = userScore.getProfessionalScore();//专业成绩
BigDecimal studentScore = culturalScore.add(professionalScore);//学员的总分数成绩
//获取已填报的志愿单
List<VolunteerRecordDTO> recordDTOList = yxVolunteerRecordService.listDTOByVolunteerId(volunteer.getId(), cognitioPolyclinic);
//临时变量
int size = 0;
BigDecimal sum = new BigDecimal("0");
BigDecimal historyThreeYearDiff = null;//三年平均差值
BigDecimal nowYearProvincialControlLine = null;
BigDecimal enrollProbability = null;
int i =0;
Map<String,YxHistoryMajorEnroll> yearMajorEnrollMap;
for (VolunteerRecordDTO volunteerRecordDTO : recordDTOList) {
hmeWrapper.clear();
hmeWrapper.eq(YxHistoryMajorEnroll::getSchoolCode,volunteerRecordDTO.getSchoolCode());//学校编码
hmeWrapper.eq(YxHistoryMajorEnroll::getMajorCode,volunteerRecordDTO.getMajorCode());//专业编码
String schoolCode;
String majorName;
String sm;
//获取上一年的招生人数
List<YxHistoryMajorEnroll> historyMajorEnrollList=null;
//获取历年的招生计划
LambdaQueryWrapper<YxHistoryMajorEnroll> hmeWrapper = new LambdaQueryWrapper<>();
List<String> majorNameList = recordDTOList.stream().map(VolunteerRecordDTO::getMajorName).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(majorNameList)) {
hmeWrapper.in(YxHistoryMajorEnroll::getYear,"2022","2021","2020");
hmeWrapper.eq(YxHistoryMajorEnroll::getCategory,cognitioPolyclinic);//文科/理科
hmeWrapper.in(YxHistoryMajorEnroll::getMajorName,majorNameList);
hmeWrapper.orderByDesc(YxHistoryMajorEnroll::getYear);
hmeWrapper.lt(YxHistoryMajorEnroll::getYear,"2023");
hmeWrapper.last("limit 3");
historyMajorEnrollList = yxHistoryMajorEnrollService.list(hmeWrapper);
yearMajorEnrollMap = new LinkedHashMap<>();
if (CollectionUtils.isNotEmpty(historyMajorEnrollList)) {
for (YxHistoryMajorEnroll historyMajorEnroll : historyMajorEnrollList) {
yearMajorEnrollMap.put(historyMajorEnroll.getYear(),historyMajorEnroll);
}
List<YxHistoryMajorEnroll> yxHistoryMajorEnrollList = yxHistoryMajorEnrollService.list(hmeWrapper);
//将历年计划 组合成map对象
String a_="_";
Map<String,YxHistoryMajorEnroll> majorEnrollMap = new LinkedHashMap<>();
for (YxHistoryMajorEnroll h : yxHistoryMajorEnrollList) {
majorEnrollMap.put(h.getSchoolCode() + a_ + h.getMajorName() + a_ + h.getYear(),h);
}
volunteerRecordDTO.setHistoryMajorEnrollMap(yearMajorEnrollMap);
//遍历获取历年数据 添加到专业 的历年信息中
Map<String,YxHistoryMajorEnroll> yearMajorEnrollMap;
YxHistoryMajorEnroll yxHistoryMajorEnroll;
for (RecommendMajorDTO recommendMajorDTO : recordDTOList) {
historyMajorEnrollList = new ArrayList<>();
schoolCode = recommendMajorDTO.getSchoolCode();
majorName = recommendMajorDTO.getMajorName();
yearMajorEnrollMap = new LinkedHashMap<>();
sm = schoolCode+a_+majorName;
//2022年
yxHistoryMajorEnroll = majorEnrollMap.get(sm + a_ + "2022");
if (yxHistoryMajorEnroll != null) {
yearMajorEnrollMap.put(yxHistoryMajorEnroll.getYear(),yxHistoryMajorEnroll);
historyMajorEnrollList.add(yxHistoryMajorEnroll);
}
//2021年
yxHistoryMajorEnroll = majorEnrollMap.get(sm + a_ + "2021");
if (yxHistoryMajorEnroll != null) {
yearMajorEnrollMap.put(yxHistoryMajorEnroll.getYear(),yxHistoryMajorEnroll);
historyMajorEnrollList.add(yxHistoryMajorEnroll);
}
volunteerRecordDTO.setHistoryMajorEnrollList(historyMajorEnrollList);
//获取 录取概率
String rulesEnrollProbability = volunteerRecordDTO.getRulesEnrollProbability();
//取出往年的分数信息, 算出 三年平均差值
if (CollectionUtils.isNotEmpty(historyMajorEnrollList)) {
//折合分数
if (rulesEnrollProbability != null) {
studentScore = ScoreUtil.convertIntoScore(rulesEnrollProbability, culturalScore, professionalScore,volunteerRecordDTO.getFirstLevelDiscipline(),volunteerRecordDTO.getProbabilityOperator());
//文过专排/专过文排
if ("文过专排".equals(rulesEnrollProbability)) {
if (culturalScore.compareTo(volunteerRecordDTO.getCulturalControlLine())==-1) {
//学生 文化分小于 专业 文化省控分
continue;
}
}else if ("专过文排".equals(rulesEnrollProbability)) {
if (professionalScore.compareTo(volunteerRecordDTO.getSpecialControlLine())==-1) {
//学生 专业分小于 专业省控分
continue;
}
}
nowYearProvincialControlLine = ScoreUtil.covertIntoControlLine(rulesEnrollProbability,volunteerRecordDTO.getCulturalControlLine(),volunteerRecordDTO.getSpecialControlLine(),volunteerRecordDTO.getFirstLevelDiscipline(),volunteerRecordDTO.getProbabilityOperator());
}else{
//获取今年的分差
nowYearProvincialControlLine = volunteerRecordDTO.getCulturalControlLine();
//2020年
yxHistoryMajorEnroll = majorEnrollMap.get(sm + a_ + "2020");
if (yxHistoryMajorEnroll != null) {
yearMajorEnrollMap.put(yxHistoryMajorEnroll.getYear(),yxHistoryMajorEnroll);
historyMajorEnrollList.add(yxHistoryMajorEnroll);
}
size = historyMajorEnrollList.size();
sum = ScoreUtil.computeHistoryMajorEnrollScoreLineDifference(historyMajorEnrollList);
historyThreeYearDiff = sum.divide(new BigDecimal(size), 4, RoundingMode.HALF_UP);
if (nowYearProvincialControlLine == null) {
continue;
}
BigDecimal nowYearDiff = studentScore.subtract(nowYearProvincialControlLine);
if (historyThreeYearDiff == null || historyThreeYearDiff.doubleValue() == 0) {
continue;
}
//获取录取率
enrollProbability = nowYearDiff.divide(historyThreeYearDiff, 4, RoundingMode.HALF_UP);
volunteerRecordDTO.setEnrollProbability(enrollProbability.multiply(bigDecimal100));
recommendMajorDTO.setHistoryMajorEnrollMap(yearMajorEnrollMap);
recommendMajorDTO.setHistoryMajorEnrollList(historyMajorEnrollList);
}
}
//计算录取概率
YxSchoolMajorServiceImpl.volunteerRecordListSetEnrollProbability(recordDTOList,userScore);
//填报志愿明细信息-提前批
List<VolunteerRecordDTO> volunteerRecordEarlyAdmissionList = recordDTOList.stream().filter(r -> r.getBatch().equals("提前批")).collect(Collectors.toList());
//填报志愿明细信息-本科A段
@ -177,70 +160,62 @@ public class YxVolunteerServiceImpl extends ServiceImpl<YxVolunteerMapper, YxVol
BeanUtils.copyProperties(volunteer,volunteerDTO);
volunteerDTO.setUserScoreInfo(userScore);
String cognitioPolyclinic = userScore.getCognitioPolyclinic();
BigDecimal culturalScore = userScore.getCulturalScore();//文化成绩
BigDecimal professionalScore = userScore.getProfessionalScore();//专业成绩
BigDecimal bigDecimal100 = new BigDecimal("100");//100倍率
BigDecimal studentScore = culturalScore.add(professionalScore);//学员的总分数成绩
//获取已填报的志愿单
List<VolunteerRecordDTO> recordDTOList = yxVolunteerRecordService.listDTOByVolunteerId(volunteer.getId(), cognitioPolyclinic);
//临时变量
int size = 0;
BigDecimal sum =null;
BigDecimal historyThreeYearDiff = null;//三年平均差值
BigDecimal nowYearProvincialControlLine = null;
BigDecimal enrollProbability = null;
String schoolCode=null;
String majorName=null;
String sm=null;
int i =0;
//获取上一年的招生人数
List<YxHistoryMajorEnroll> historyMajorEnrollList=null;
//获取历年的招生计划
LambdaQueryWrapper<YxHistoryMajorEnroll> hmeWrapper = new LambdaQueryWrapper<>();
List<String> majorNameList = recordDTOList.stream().map(VolunteerRecordDTO::getMajorName).collect(Collectors.toList());
hmeWrapper.in(YxHistoryMajorEnroll::getYear,"2022","2021","2020");
hmeWrapper.eq(YxHistoryMajorEnroll::getCategory,cognitioPolyclinic);//文科/理科
hmeWrapper.in(YxHistoryMajorEnroll::getMajorName,majorNameList);
hmeWrapper.orderByDesc(YxHistoryMajorEnroll::getYear);
List<YxHistoryMajorEnroll> yxHistoryMajorEnrollList = yxHistoryMajorEnrollService.list(hmeWrapper);
//将历年计划 组合成map对象
String a_="_";
Map<String,YxHistoryMajorEnroll> majorEnrollMap = new LinkedHashMap<>();
for (YxHistoryMajorEnroll h : yxHistoryMajorEnrollList) {
majorEnrollMap.put(h.getSchoolCode() + a_ + h.getMajorName() + a_ + h.getYear(),h);
}
//遍历获取历年数据 添加到专业 的历年信息中
Map<String,YxHistoryMajorEnroll> yearMajorEnrollMap;
YxHistoryMajorEnroll yxHistoryMajorEnroll;
for (RecommendMajorDTO recommendMajorDTO : recordDTOList) {
historyMajorEnrollList = new ArrayList<>();
schoolCode = recommendMajorDTO.getSchoolCode();
majorName = recommendMajorDTO.getMajorName();
yearMajorEnrollMap = new LinkedHashMap<>();
sm = schoolCode+a_+majorName;
//2022年
yxHistoryMajorEnroll = majorEnrollMap.get(sm + a_ + "2022");
if (yxHistoryMajorEnroll != null) {
yearMajorEnrollMap.put(yxHistoryMajorEnroll.getYear(),yxHistoryMajorEnroll);
historyMajorEnrollList.add(yxHistoryMajorEnroll);
}
//2021年
yxHistoryMajorEnroll = majorEnrollMap.get(sm + a_ + "2021");
if (yxHistoryMajorEnroll != null) {
yearMajorEnrollMap.put(yxHistoryMajorEnroll.getYear(),yxHistoryMajorEnroll);
historyMajorEnrollList.add(yxHistoryMajorEnroll);
if (CollectionUtils.isNotEmpty(majorNameList)) {
hmeWrapper.in(YxHistoryMajorEnroll::getYear,"2022","2021","2020");
hmeWrapper.eq(YxHistoryMajorEnroll::getCategory,cognitioPolyclinic);//文科/理科
hmeWrapper.in(YxHistoryMajorEnroll::getMajorName,majorNameList);
hmeWrapper.orderByDesc(YxHistoryMajorEnroll::getYear);
List<YxHistoryMajorEnroll> yxHistoryMajorEnrollList = yxHistoryMajorEnrollService.list(hmeWrapper);
//将历年计划 组合成map对象
String a_="_";
Map<String,YxHistoryMajorEnroll> majorEnrollMap = new LinkedHashMap<>();
for (YxHistoryMajorEnroll h : yxHistoryMajorEnrollList) {
majorEnrollMap.put(h.getSchoolCode() + a_ + h.getMajorName() + a_ + h.getYear(),h);
}
//遍历获取历年数据 添加到专业 的历年信息中
Map<String,YxHistoryMajorEnroll> yearMajorEnrollMap;
YxHistoryMajorEnroll yxHistoryMajorEnroll;
for (RecommendMajorDTO recommendMajorDTO : recordDTOList) {
historyMajorEnrollList = new ArrayList<>();
schoolCode = recommendMajorDTO.getSchoolCode();
majorName = recommendMajorDTO.getMajorName();
yearMajorEnrollMap = new LinkedHashMap<>();
sm = schoolCode+a_+majorName;
//2022年
yxHistoryMajorEnroll = majorEnrollMap.get(sm + a_ + "2022");
if (yxHistoryMajorEnroll != null) {
yearMajorEnrollMap.put(yxHistoryMajorEnroll.getYear(),yxHistoryMajorEnroll);
historyMajorEnrollList.add(yxHistoryMajorEnroll);
}
//2021年
yxHistoryMajorEnroll = majorEnrollMap.get(sm + a_ + "2021");
if (yxHistoryMajorEnroll != null) {
yearMajorEnrollMap.put(yxHistoryMajorEnroll.getYear(),yxHistoryMajorEnroll);
historyMajorEnrollList.add(yxHistoryMajorEnroll);
}
//2020年
yxHistoryMajorEnroll = majorEnrollMap.get(sm + a_ + "2020");
if (yxHistoryMajorEnroll != null) {
yearMajorEnrollMap.put(yxHistoryMajorEnroll.getYear(),yxHistoryMajorEnroll);
historyMajorEnrollList.add(yxHistoryMajorEnroll);
}
//2020年
yxHistoryMajorEnroll = majorEnrollMap.get(sm + a_ + "2020");
if (yxHistoryMajorEnroll != null) {
yearMajorEnrollMap.put(yxHistoryMajorEnroll.getYear(),yxHistoryMajorEnroll);
historyMajorEnrollList.add(yxHistoryMajorEnroll);
}
recommendMajorDTO.setHistoryMajorEnrollMap(yearMajorEnrollMap);
recommendMajorDTO.setHistoryMajorEnrollList(historyMajorEnrollList);
recommendMajorDTO.setHistoryMajorEnrollMap(yearMajorEnrollMap);
recommendMajorDTO.setHistoryMajorEnrollList(historyMajorEnrollList);
}
}
//计算录取概率
@ -266,31 +241,36 @@ public class YxVolunteerServiceImpl extends ServiceImpl<YxVolunteerMapper, YxVol
@Override
public boolean artVolunteerSave(SaveVolunteerVO saveVolunteerVO) {
String createBy = saveVolunteerVO.getCreateBy();
//用于增加志愿明细对象
YxVolunteerRecord yxVolunteerRecord=new YxVolunteerRecord();
BeanUtils.copyProperties(saveVolunteerVO,yxVolunteerRecord);
VolunteerDTO volunteerDTO = getActiveByCreate(createBy);
YxUserScore userScore = yxUserScoreService.getActiveUserScore(saveVolunteerVO.getCreateBy());
yxVolunteerRecord.setCategory(userScore.getCognitioPolyclinic());//文理分科
if (volunteerDTO==null) {
YxVolunteer yxVolunteer=new YxVolunteer();
//如果这个人跨越了分数直接来填报
AssertUtils.notNull(userScore,"请先创建分数信息!");
// 目前没有选择的新建一个
yxVolunteer.setScoreId(userScore.getId());
SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmss");
Date date = new Date();
yxVolunteer.setVolunteerName(sdf.format(date)+"_填报单");
yxVolunteer.setCreateBy(createBy);
yxVolunteer.setState("1");//使用中
this.save(yxVolunteer);
//插入明细信息
yxVolunteerRecord.setVolunteerId(yxVolunteer.getId());
VolunteerDTO volunteerDTO = null;
YxUserScore userScore = null;
if (StringUtils.isNotBlank(saveVolunteerVO.getVolunteerId())) {
// 如果传了一个 volunteerId
volunteerDTO = findById(saveVolunteerVO.getVolunteerId());
userScore = volunteerDTO.getUserScoreInfo();
}else{
yxVolunteerRecord.setVolunteerId(volunteerDTO.getId());
//没传
volunteerDTO = getActiveByCreate(createBy);
if (volunteerDTO!=null && StringUtils.isNotBlank(volunteerDTO.getId())) {
userScore = volunteerDTO.getUserScoreInfo();
}else{
//新建一个
userScore = yxUserScoreService.getActiveUserScore(createBy);//获取现在使用的分数信息
YxVolunteer yxVolunteer=new YxVolunteer();
//如果这个人跨越了分数直接来填报
AssertUtils.notNull(userScore,"请先创建分数信息!");
// 目前没有选择的新建一个
yxVolunteer.setScoreId(userScore.getId());
SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmss");
Date date = new Date();
yxVolunteer.setVolunteerName(sdf.format(date)+" 方案");
yxVolunteer.setCreateBy(createBy);
yxVolunteer.setState("1");//使用中
this.save(yxVolunteer);
saveVolunteerVO.setVolunteerId(yxVolunteer.getId());
}
}
return yxVolunteerRecordService.artVolunteerSave(yxVolunteerRecord);
saveVolunteerVO.setCategory(userScore.getCognitioPolyclinic());//文理分科
return yxVolunteerRecordService.artVolunteerSave(saveVolunteerVO);
}
@Override
@ -298,7 +278,7 @@ public class YxVolunteerServiceImpl extends ServiceImpl<YxVolunteerMapper, YxVol
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
LambdaQueryWrapper<YxVolunteer> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(YxVolunteer::getCreateBy,sysUser.getId());
queryWrapper.orderByDesc(YxVolunteer::getCreateTime,YxVolunteer::getUpdateTime);
queryWrapper.orderByDesc(YxVolunteer::getCreateTime);
List<YxVolunteer> volunteerList = this.list(queryWrapper);
List<VolunteerDTO> list=new ArrayList<>();
VolunteerDTO volunteerDTO=null;
@ -328,7 +308,7 @@ public class YxVolunteerServiceImpl extends ServiceImpl<YxVolunteerMapper, YxVol
//删除 成绩信息
yxUserScoreService.removeById(volunteer.getScoreId());
//删除成绩明细
boolean b1 = yxVolunteerRecordService.deleteByVolunteerId(id);
yxVolunteerRecordService.deleteByVolunteerId(id);
}
return true;
}

View File

@ -52,6 +52,42 @@ public class ScoreUtil {
return sum;
}
/**
* 根据 当前年一致的录取方式计算 往年分数差之和 (往年的录取线-省控线)
*/
public static BigDecimal computeHistoryMajorEnrollScoreLineDifferenceWithRulesEnrollProbability(String rulesEnrollProbability,List<YxHistoryMajorEnroll> historyMajorEnrollList){
BigDecimal sum=new BigDecimal("0");
if (CollectionUtils.isEmpty(historyMajorEnrollList)) {
return sum;
}
int yearNum=0;
BigDecimal controlLine = null;//文科-省控线
BigDecimal admissionLine = null;//文科-录取线
for (YxHistoryMajorEnroll yxHistoryMajorEnroll : historyMajorEnrollList) {
if (yxHistoryMajorEnroll.getRulesEnrollProbability().equals(rulesEnrollProbability)) {
controlLine = yxHistoryMajorEnroll.getControlLine();
admissionLine = yxHistoryMajorEnroll.getAdmissionLine();
sum=sum.add(admissionLine.subtract(controlLine));//录取线-省控线
yearNum++;
}
}
return sum.divide(new BigDecimal(yearNum),4,RoundingMode.HALF_UP);
/*if (wenFlag) {
//文科生
}else{
//理科生
BigDecimal scienceControlLine=null;//理科-省控线
BigDecimal scienceAdmissionLine=null;//理科-录取线
for (YxHistoryMajorEnroll yxHistoryMajorEnroll : historyMajorEnrollList) {
scienceControlLine = yxHistoryMajorEnroll.getScienceControlLine();
scienceAdmissionLine = yxHistoryMajorEnroll.getScienceAdmissionLine();
sum=sum.add(scienceAdmissionLine.subtract(scienceControlLine));//录取线-省控线
yearNum++;
}
}*/
//return sum;
}
public static BigDecimal decimal004=new BigDecimal("0.04");
public static BigDecimal decimal0067=new BigDecimal("0.067");
public static BigDecimal decimal0093=new BigDecimal("0.093");

View File

@ -2,4 +2,8 @@ spring:
application:
name: jeecg-system
profiles:
active: '@profile.name@'
active: '@profile.name@'
wx:
appId: wxb9cf28f42ffa35e5
appSecret: ed3fd9089dcfbd1d886eddeca69c07bd