updates
This commit is contained in:
parent
e867ef29fc
commit
e3803cd6b2
|
|
@ -204,9 +204,7 @@ public class YxHistoryMajorEnrollController extends JeecgController<YxHistoryMaj
|
|||
@RequiresPermissions("yx:yx_history_major_enroll:edit")
|
||||
public Result<?> renewControlLine(@RequestBody YxHistoryMajorEnroll yxHistoryMajorEnroll) {
|
||||
String id = yxHistoryMajorEnroll.getId();
|
||||
LambdaQueryWrapper<YxHistoryMajorEnroll> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
}
|
||||
yxHistoryMajorEnrollService.renewControlLine(id);
|
||||
return Result.OK("操作成功");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,4 +35,9 @@ public interface IYxHistoryMajorEnrollService extends IService<YxHistoryMajorEnr
|
|||
* 给志愿单中的专业写入历年分数信息
|
||||
*/
|
||||
void volunteerRecordDTOListSetHistoryInfo(List<VolunteerRecordDTO> recordDtoList);
|
||||
|
||||
/**
|
||||
* 更新省控线
|
||||
*/
|
||||
void renewControlLine(String id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,17 @@ import org.jeecg.modules.art.dto.RecommendMajorDTO;
|
|||
import org.jeecg.modules.yx.constant.YxConstant;
|
||||
import org.jeecg.modules.yx.dto.VolunteerRecordDTO;
|
||||
import org.jeecg.modules.yx.entity.YxHistoryMajorEnroll;
|
||||
import org.jeecg.modules.yx.entity.YxHistoryScoreControlLine;
|
||||
import org.jeecg.modules.yx.mapper.YxHistoryMajorEnrollMapper;
|
||||
import org.jeecg.modules.yx.service.IYxHistoryMajorEnrollService;
|
||||
import org.jeecg.modules.yx.service.IYxHistoryScoreControlLineService;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -25,7 +30,8 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
@Service
|
||||
public class YxHistoryMajorEnrollServiceImpl extends ServiceImpl<YxHistoryMajorEnrollMapper, YxHistoryMajorEnroll> implements IYxHistoryMajorEnrollService {
|
||||
|
||||
@Resource
|
||||
private IYxHistoryScoreControlLineService yxHistoryScoreControlLineService;
|
||||
@Override
|
||||
public boolean exist(YxHistoryMajorEnroll yxHistoryMajorEnroll) {
|
||||
String id = yxHistoryMajorEnroll.getId();
|
||||
|
|
@ -156,4 +162,108 @@ public class YxHistoryMajorEnrollServiceImpl extends ServiceImpl<YxHistoryMajorE
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void renewControlLine(String id) {
|
||||
LambdaQueryWrapper<YxHistoryMajorEnroll> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
lambdaQueryWrapper.in(YxHistoryMajorEnroll::getId, Arrays.asList(id.split(",")));
|
||||
}
|
||||
List<YxHistoryMajorEnroll> list = list(lambdaQueryWrapper);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
Map<String, YxHistoryScoreControlLine> historyScoreControlLineMap = yxHistoryScoreControlLineService.allMaps();
|
||||
String majorType = null;
|
||||
String key = null;
|
||||
String mainSubjects = null;
|
||||
String batch = null;
|
||||
String category = null;
|
||||
String year = null;
|
||||
String probabilityOperator = null;
|
||||
String rulesEnrollProbability = null;
|
||||
int index = 0;
|
||||
YxHistoryScoreControlLine historyScoreControlLine = null;
|
||||
BigDecimal culturalScore = null, wenhuaBili = null;
|
||||
BigDecimal specialScore = null, zhuanyeBili = null;
|
||||
|
||||
for (YxHistoryMajorEnroll record : list) {
|
||||
index++;
|
||||
majorType = record.getMajorType();
|
||||
mainSubjects = record.getMainSubjects();
|
||||
batch = record.getBatch();
|
||||
category = record.getCategory();
|
||||
year = record.getYear();
|
||||
probabilityOperator = record.getProbabilityOperator();
|
||||
rulesEnrollProbability = record.getRulesEnrollProbability();
|
||||
if (StringUtils.isBlank(rulesEnrollProbability)) {
|
||||
continue;
|
||||
}
|
||||
//省控线
|
||||
//文科_本科A段_美术与设计_2023
|
||||
if ("舞蹈类".equals(majorType)) {
|
||||
//AssertUtils.notEmpty(mainSubjects, String.format("行[%s],未识别到舞蹈类型", index));
|
||||
if (StringUtils.isBlank(mainSubjects)) {
|
||||
continue;
|
||||
}
|
||||
if (mainSubjects.contains("艺术舞蹈")) {
|
||||
key = category + "_" + batch + "_" + "艺术舞蹈类" + "_" + year;
|
||||
} else if (mainSubjects.contains("国际标准")) {
|
||||
key = category + "_" + batch + "_" + "国际标准舞类" + "_" + year;
|
||||
} else {
|
||||
//throw new JeecgBootException(String.format("行[%s],未识别到舞蹈类型", index));
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
key = category + "_" + batch + "_" + majorType + "_" + year;
|
||||
}
|
||||
|
||||
historyScoreControlLine = historyScoreControlLineMap.get(key);
|
||||
if (historyScoreControlLine== null) {
|
||||
continue;
|
||||
}
|
||||
culturalScore = historyScoreControlLine.getCulturalScore();
|
||||
specialScore = historyScoreControlLine.getSpecialScore();
|
||||
if (("文过专排".equals(rulesEnrollProbability)|| "文过专排主科".equals(rulesEnrollProbability)) && StringUtils.isBlank(probabilityOperator)) {
|
||||
probabilityOperator = "专*1";
|
||||
}else if ("专过文排".equals(rulesEnrollProbability) && StringUtils.isBlank(probabilityOperator)) {
|
||||
probabilityOperator = "文*1";
|
||||
}else if ("文+专".equals(rulesEnrollProbability) && StringUtils.isBlank(probabilityOperator)) {
|
||||
probabilityOperator = "文*1+专*1";
|
||||
}
|
||||
if (StringUtils.isBlank(probabilityOperator)) {
|
||||
System.out.println("111");
|
||||
}
|
||||
//换算分数
|
||||
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) || "文过专排主科".equals(rulesEnrollProbability)) {
|
||||
BigDecimal multiply = specialScore.multiply(zhuanyeBili);
|
||||
record.setControlLine(multiply);
|
||||
record.setRulesEnrollProbability("文过专排");
|
||||
} else if ("专过文排".equals(rulesEnrollProbability)) {
|
||||
BigDecimal multiply = specialScore.multiply(wenhuaBili);
|
||||
record.setControlLine(multiply);
|
||||
record.setRulesEnrollProbability("专过文排");
|
||||
} else if ("其他计算办法".equals(rulesEnrollProbability)) {
|
||||
record.setRulesEnrollProbability("其他计算办法");
|
||||
} else {
|
||||
if (wenhuaBili == null || zhuanyeBili == null) {
|
||||
wenhuaBili = YxConstant.bigDecimal100;
|
||||
zhuanyeBili = YxConstant.bigDecimal100;
|
||||
}
|
||||
record.setControlLine((culturalScore.multiply(wenhuaBili)).add((specialScore.multiply(zhuanyeBili))));
|
||||
record.setRulesEnrollProbability(probabilityOperator);
|
||||
}
|
||||
}
|
||||
updateBatchById(list,500);
|
||||
log.debug("已刷新省控线");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,8 +145,8 @@ spring:
|
|||
redis:
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: ''
|
||||
port: 56379
|
||||
password: 'Wang5322570'
|
||||
#mybatis plus 设置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
|
||||
|
|
@ -223,8 +223,8 @@ jeecg:
|
|||
logRetentionDays: 30
|
||||
#分布式锁配置
|
||||
redisson:
|
||||
address: 127.0.0.1:6379
|
||||
password:
|
||||
address: 127.0.0.1:56379
|
||||
password: Wang5322570
|
||||
type: STANDALONE
|
||||
enabled: true
|
||||
#cas单点登录
|
||||
|
|
|
|||
Loading…
Reference in New Issue