This commit is contained in:
zhouwentao 2024-03-20 14:15:50 +08:00
parent dfd1990d0f
commit 54e4792ad0
5 changed files with 145 additions and 30 deletions

View File

@ -112,7 +112,7 @@ public class MiniUserController {
String token = JwtUtil.sign(sysUser.getUsername(), syspassword);
// 设置token缓存有效时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, 3600 * 2);
JSONObject obj = new JSONObject();
LoginUser loginUser = new LoginUser();
BeanUtils.copyProperties(sysUser, loginUser);
@ -174,7 +174,7 @@ public class MiniUserController {
String token = JwtUtil.sign(username, syspassword);
// 设置token缓存有效时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, 3600 * 2);
JSONObject obj = new JSONObject();
LoginUser loginUser = new LoginUser();
BeanUtils.copyProperties(user, loginUser);

View File

@ -17,6 +17,7 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.modules.yx.constant.YxConstant;
import org.jeecg.modules.yx.dto.LiNianShuJuBenDTO;
import org.jeecg.modules.yx.dto.LiNianShuJuDTO;
import org.jeecg.modules.yx.dto.LiNianShuJuZhuanDTO;
@ -32,6 +33,7 @@ import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.yx.service.IYxHistoryScoreControlLineService;
import org.jeecg.modules.yx.service.IYxMajorService;
import org.jeecg.modules.yx.service.IYxSchoolService;
import org.jeecg.modules.yx.util.ScoreUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.beans.factory.annotation.Autowired;
@ -245,11 +247,14 @@ public class YxHistoryMajorEnrollController extends JeecgController<YxHistoryMaj
long start = System.currentTimeMillis();
int index = 0;
try {
//加载省控线
Map<String, YxHistoryScoreControlLine> historyScoreControlLineMap = yxHistoryScoreControlLineService.allMaps();
Map<String, YxMajor> majorMap = yxMajorService.mapsForMajorName();
//Map<String, YxSchool> schoolNameMap = yxSchoolService.mapsForSchoolName();
//Collection<YxSchool> schoolCodeList = schoolNameMap.values();
String schoolCode = null;
String schoolName = null;
String majorName = null;
String majorName = null, mn = null, key = null;
String majorType = null;
String batch = null;
String enrollmentCode = null;
@ -258,9 +263,18 @@ public class YxHistoryMajorEnrollController extends JeecgController<YxHistoryMaj
String rulesEnrollProbability = null;
String probabilityOperator = null;
BigDecimal admissionLine = null;
BigDecimal culturalScore = null;
BigDecimal specialScore = null;
BigDecimal wenhuaBili = null;
BigDecimal zhuanyeBili = null;
Integer enrollNum = null;
Integer admissionNum = null;
String detail = null;
YxMajor major = null;
YxHistoryScoreControlLine historyScoreControlLine = null;
YxHistoryMajorEnroll oldYxHistoryMajorEnroll = null;
LambdaQueryWrapper<YxHistoryMajorEnroll> yxHistoryMajorEnrollLambdaQueryWrapper = new LambdaQueryWrapper<>();
List<YxHistoryMajorEnroll> updateList = new ArrayList<>();
List<YxHistoryMajorEnroll> list = ExcelImportUtil.importExcel(file.getInputStream(), YxHistoryMajorEnroll.class, params);
for (YxHistoryMajorEnroll yxHistoryMajorEnroll : list) {
index++;
@ -268,6 +282,7 @@ public class YxHistoryMajorEnrollController extends JeecgController<YxHistoryMaj
schoolName = yxHistoryMajorEnroll.getSchoolName();//学校名称
majorName = yxHistoryMajorEnroll.getMajorName();//专业名称
batch = yxHistoryMajorEnroll.getBatch();//批次
year = yxHistoryMajorEnroll.getYear();
enrollmentCode = yxHistoryMajorEnroll.getEnrollmentCode();//招生代码
majorType = yxHistoryMajorEnroll.getMajorType();//专业类型
category = yxHistoryMajorEnroll.getCategory();//科类
@ -280,17 +295,87 @@ public class YxHistoryMajorEnrollController extends JeecgController<YxHistoryMaj
AssertUtils.notEmpty(schoolCode, String.format("行[%s],请输入学校代码", index));
AssertUtils.notEmpty(schoolName, String.format("行[%s],请输入学校名称", index));
AssertUtils.notEmpty(batch, String.format("行[%s],请输入批次", index));
AssertUtils.notEmpty(enrollmentCode, String.format("行[%s],请输入招生代码", index));
AssertUtils.notEmpty(enrollmentCode, String.format("行[%s],请输入专业代码", index));
AssertUtils.notEmpty(majorName, String.format("行[%s],请输入专业名称", index));
AssertUtils.notEmpty(majorType, String.format("行[%s],请输入专业类型", index));
//=========================================================================
AssertUtils.notEmpty(year, String.format("行[%s],请输入年份", index));
AssertUtils.notEmpty(category, String.format("行[%s],请输入科类", index));
AssertUtils.notEmpty(rulesEnrollProbability, String.format("行[%s],请输入录取方式", index));
//AssertUtils.notEmpty(rulesEnrollProbability, String.format("行[%s],请输入录取方式", index));
AssertUtils.notEmpty(probabilityOperator, String.format("行[%s],请输入录取方式运算符", index));
AssertUtils.notNull(admissionLine, String.format("行[%s],请输入录取线", index));
AssertUtils.notNull(enrollNum, String.format("行[%s],请输入招生人数", index));
AssertUtils.notNull(admissionNum, String.format("行[%s],请输入录取人数", index));
// AssertUtils.notNull(enrollNum, String.format("行[%s],请输入招生人数", index));
// AssertUtils.notNull(admissionNum, String.format("行[%s],请输入录取人数", index));
//=========================================================================
majorName = majorName.replace("(", "").replace(")", "");
int i = majorName.indexOf("");
mn = majorName;
if (i != -1) {
mn = majorName.substring(0, i);
}
major = majorMap.get(mn);
AssertUtils.notNull(major, String.format("行[%s],专业未在系统中找到", index));
yxHistoryMajorEnroll.setMajorCode(major.getMajorCode());
//省控线
//文科_本科A段_美术与设计_2023
key = category + "_" + batch + "_" + majorType + "_" + year;
historyScoreControlLine = historyScoreControlLineMap.get(key);
AssertUtils.notNull(historyScoreControlLine, String.format("行[%s],未在系统中找到省控线", index));
culturalScore = historyScoreControlLine.getCulturalScore();
specialScore = historyScoreControlLine.getSpecialScore();
//换算分数
String[] operators = probabilityOperator.split("\\+");
for (String operator : operators) {
if (operator.contains("")) {
wenhuaBili = new BigDecimal(operator.split("\\*")[1]);
}
if (operator.contains("")) {
zhuanyeBili = new BigDecimal(operator.split("\\*")[1]);
}
}
if ("文过专排".equals(rulesEnrollProbability)) {
BigDecimal multiply = specialScore.multiply(zhuanyeBili);
yxHistoryMajorEnroll.setControlLine(multiply);
} else if ("专过文排".equals(rulesEnrollProbability)) {
BigDecimal multiply = specialScore.multiply(wenhuaBili);
yxHistoryMajorEnroll.setControlLine(multiply);
} else if ("其他计算办法".equals(rulesEnrollProbability)) {
} else {
if (wenhuaBili == null || zhuanyeBili == null) {
wenhuaBili = YxConstant.bigDecimal100;
zhuanyeBili = YxConstant.bigDecimal100;
}
yxHistoryMajorEnroll.setControlLine((culturalScore.multiply(wenhuaBili)).add((specialScore.multiply(zhuanyeBili))));
}
yxHistoryMajorEnroll.setRulesEnrollProbability(probabilityOperator);
//查询库中是否有该条数据
yxHistoryMajorEnrollLambdaQueryWrapper.clear();
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getYear, year);
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getMajorName, majorName);
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getEnrollmentCode, enrollmentCode);
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getSchoolCode,schoolCode);
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getBatch,batch);
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getCategory,category);
yxHistoryMajorEnrollLambdaQueryWrapper.eq(YxHistoryMajorEnroll::getMajorType, majorType);
oldYxHistoryMajorEnroll = yxHistoryMajorEnrollService.getOne(yxHistoryMajorEnrollLambdaQueryWrapper);
if (oldYxHistoryMajorEnroll == null) {
updateList.add(yxHistoryMajorEnroll);
}else{
oldYxHistoryMajorEnroll.setRulesEnrollProbability(yxHistoryMajorEnroll.getRulesEnrollProbability());
oldYxHistoryMajorEnroll.setSchoolName(schoolName);
if (StringUtils.isNotBlank(detail)) {
oldYxHistoryMajorEnroll.setDetail(yxHistoryMajorEnroll.getDetail());
}
oldYxHistoryMajorEnroll.setProbabilityOperator(probabilityOperator);
oldYxHistoryMajorEnroll.setAdmissionLine(admissionLine);
oldYxHistoryMajorEnroll.setEnrollNum(enrollNum);
oldYxHistoryMajorEnroll.setControlLine(yxHistoryMajorEnroll.getControlLine());
updateList.add(oldYxHistoryMajorEnroll);
}
}
if (CollectionUtils.isNotEmpty(updateList)) {
yxHistoryMajorEnrollService.saveOrUpdateBatch(updateList);
}
log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
return Result.ok("文件导入成功!数据行数:" + list.size());

View File

@ -4,10 +4,8 @@ import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -52,8 +50,8 @@ public class YxHistoryMajorEnroll implements Serializable {
@Excel(name = "批次", width = 15)
@ApiModelProperty(value = "批次")
private java.lang.String batch;
/**招生代码*/
@Excel(name = "招生代码", width = 15)
/**专业代码*/
@Excel(name = "专业代码", width = 15)
@ApiModelProperty(value = "招生代码")
private java.lang.String enrollmentCode;
/**专业代码*/
@ -67,6 +65,14 @@ public class YxHistoryMajorEnroll implements Serializable {
@Excel(name = "专业类型", width = 15)
@ApiModelProperty(value = "专业类型")
private String majorType;
@Excel(name = "主考科目", width = 15)
@TableField(exist = false)
@ApiModelProperty(value = "主考科目")
private String mainSubjects;
/**专业类型子级*/
@Excel(name = "专业子级类别", width = 15)
@ApiModelProperty(value = "专业类型子级")
private String majorTypeChild;
/**年份*/
@Excel(name = "年份", width = 15)
@ApiModelProperty(value = "年份")
@ -88,11 +94,11 @@ public class YxHistoryMajorEnroll implements Serializable {
@ApiModelProperty(value = "省控线")
private java.math.BigDecimal controlLine;
/**录取线*/
@Excel(name = "录取线", width = 15)
@Excel(name = "最低录取分", width = 15)
@ApiModelProperty(value = "录取线")
private java.math.BigDecimal admissionLine;
/**招生人数*/
@Excel(name = "招生人", width = 15)
@Excel(name = "计划", width = 15)
@ApiModelProperty(value = "招生人数")
private java.lang.Integer enrollNum;
@ -108,6 +114,11 @@ public class YxHistoryMajorEnroll implements Serializable {
//@Excel(name = "最低分数差", width = 15)
@ApiModelProperty(value = "最低分数差")
private java.math.BigDecimal scoreLineDifference;
/**学费*/
@Excel(name = "学费", width = 15)
@ApiModelProperty(value = "学费")
@TableField(exist = false)
private java.math.BigDecimal tuition;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
@ -134,8 +145,4 @@ public class YxHistoryMajorEnroll implements Serializable {
/**实际投递人数*/
@ApiModelProperty(value = "实际投递人数")
private Integer actualPitcherNum;
/**专业类型子级*/
@ApiModelProperty(value = "专业类型子级")
private String majorTypeChild;
}

View File

@ -34,4 +34,9 @@ public interface IYxHistoryScoreControlLineService extends IService<YxHistorySco
* @return Map<批次,省控线对象>
*/
Map<String,YxHistoryScoreControlLine> mapsBatchByProfessionalCategoryOfYear(int year,String professionalCategory,String category);
/**
* 全部省控线
*/
Map<String,YxHistoryScoreControlLine> allMaps();
}

View File

@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -21,7 +22,7 @@ import java.util.stream.Collectors;
/**
* @Description: 历年各专业省控分数线
* @Author: jeecg-boot
* @Date: 2023-12-02
* @Date: 2023-12-02
* @Version: V1.0
*/
@Service
@ -32,11 +33,11 @@ public class YxHistoryScoreControlLineServiceImpl extends ServiceImpl<YxHistoryS
IPage<YxHistoryScoreControlLine> yxHistoryScoreControlLineIPage = baseMapper.pageList(page, yxHistoryScoreControlLine);
List<YxHistoryScoreControlLine> newRecords = new ArrayList<>();
List<YxHistoryScoreControlLine> records = yxHistoryScoreControlLineIPage.getRecords();
YxHistoryScoreControlLine historyScoreControlLine=null;
YxHistoryScoreControlLine historyScoreControlLine = null;
for (YxHistoryScoreControlLine record : records) {
if ("本科A段".equals(record.getBatch())) {
historyScoreControlLine = new YxHistoryScoreControlLine();
BeanUtils.copyProperties(record,historyScoreControlLine);
BeanUtils.copyProperties(record, historyScoreControlLine);
historyScoreControlLine.setBatch("提前批");
newRecords.add(historyScoreControlLine);
}
@ -49,10 +50,10 @@ public class YxHistoryScoreControlLineServiceImpl extends ServiceImpl<YxHistoryS
@Override
public YxHistoryScoreControlLine getByProfessionalCategoryOfYear(int year, String professionalCategory, String category, String batch) {
LambdaQueryWrapper<YxHistoryScoreControlLine> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getYear,year);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory,professionalCategory);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory,category);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getBatch,batch);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getYear, year);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, professionalCategory);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory, category);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getBatch, batch);
lambdaQueryWrapper.last("limit 1");
return this.getOne(lambdaQueryWrapper);
}
@ -60,9 +61,9 @@ public class YxHistoryScoreControlLineServiceImpl extends ServiceImpl<YxHistoryS
@Override
public List<YxHistoryScoreControlLine> listByProfessionalCategoryOfYear(int year, String professionalCategory, String category) {
LambdaQueryWrapper<YxHistoryScoreControlLine> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getYear,year);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory,professionalCategory);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory,category);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getYear, year);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getProfessionalCategory, professionalCategory);
lambdaQueryWrapper.eq(YxHistoryScoreControlLine::getCategory, category);
lambdaQueryWrapper.orderByDesc(YxHistoryScoreControlLine::getBatch);
List<YxHistoryScoreControlLine> newList = new ArrayList<>();
List<YxHistoryScoreControlLine> list = this.list(lambdaQueryWrapper);
@ -70,7 +71,7 @@ public class YxHistoryScoreControlLineServiceImpl extends ServiceImpl<YxHistoryS
for (YxHistoryScoreControlLine yxHistoryScoreControlLine : list) {
if (yxHistoryScoreControlLine.getBatch().equals("本科A段")) {
yxHistoryScoreControlLine1 = new YxHistoryScoreControlLine();
BeanUtils.copyProperties(yxHistoryScoreControlLine,yxHistoryScoreControlLine1);
BeanUtils.copyProperties(yxHistoryScoreControlLine, yxHistoryScoreControlLine1);
yxHistoryScoreControlLine1.setBatch("提前批");
newList.add(yxHistoryScoreControlLine1);
}
@ -84,4 +85,21 @@ public class YxHistoryScoreControlLineServiceImpl extends ServiceImpl<YxHistoryS
List<YxHistoryScoreControlLine> yxHistoryScoreControlLines = this.listByProfessionalCategoryOfYear(year, professionalCategory, category);
return yxHistoryScoreControlLines.stream().collect(Collectors.toMap(y -> y.getBatch(), y -> y));
}
@Override
public Map<String, YxHistoryScoreControlLine> allMaps() {
List<YxHistoryScoreControlLine> list = this.list();
Map<String, YxHistoryScoreControlLine> maps = new LinkedHashMap<>();
String key = null;
for (YxHistoryScoreControlLine record : list) {
//文科_本科A段_美术与设计_2023
key = record.getCategory() + "_" + record.getBatch() + "_" + record.getProfessionalCategory() + "_" + record.getYear();
maps.put(key,record);
if (record.getBatch().equals("本科A段")) {
key = record.getCategory() + "_提前批_" + record.getProfessionalCategory() + "_" + record.getYear();
maps.put(key,record);
}
}
return maps;
}
}