This commit is contained in:
zhouwentao 2024-03-21 19:36:41 +08:00
parent e867ef29fc
commit e3803cd6b2
4 changed files with 133 additions and 20 deletions

View File

@ -204,9 +204,7 @@ public class YxHistoryMajorEnrollController extends JeecgController<YxHistoryMaj
@RequiresPermissions("yx:yx_history_major_enroll:edit") @RequiresPermissions("yx:yx_history_major_enroll:edit")
public Result<?> renewControlLine(@RequestBody YxHistoryMajorEnroll yxHistoryMajorEnroll) { public Result<?> renewControlLine(@RequestBody YxHistoryMajorEnroll yxHistoryMajorEnroll) {
String id = yxHistoryMajorEnroll.getId(); String id = yxHistoryMajorEnroll.getId();
LambdaQueryWrapper<YxHistoryMajorEnroll> lambdaQueryWrapper = new LambdaQueryWrapper<>(); yxHistoryMajorEnrollService.renewControlLine(id);
if (StringUtils.isNotBlank(id)) {
}
return Result.OK("操作成功"); return Result.OK("操作成功");
} }

View File

@ -35,4 +35,9 @@ public interface IYxHistoryMajorEnrollService extends IService<YxHistoryMajorEnr
* 给志愿单中的专业写入历年分数信息 * 给志愿单中的专业写入历年分数信息
*/ */
void volunteerRecordDTOListSetHistoryInfo(List<VolunteerRecordDTO> recordDtoList); void volunteerRecordDTOListSetHistoryInfo(List<VolunteerRecordDTO> recordDtoList);
/**
* 更新省控线
*/
void renewControlLine(String id);
} }

View File

@ -8,12 +8,17 @@ import org.jeecg.modules.art.dto.RecommendMajorDTO;
import org.jeecg.modules.yx.constant.YxConstant; import org.jeecg.modules.yx.constant.YxConstant;
import org.jeecg.modules.yx.dto.VolunteerRecordDTO; import org.jeecg.modules.yx.dto.VolunteerRecordDTO;
import org.jeecg.modules.yx.entity.YxHistoryMajorEnroll; 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.mapper.YxHistoryMajorEnrollMapper;
import org.jeecg.modules.yx.service.IYxHistoryMajorEnrollService; 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 org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -25,7 +30,8 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
public class YxHistoryMajorEnrollServiceImpl extends ServiceImpl<YxHistoryMajorEnrollMapper, YxHistoryMajorEnroll> implements IYxHistoryMajorEnrollService { public class YxHistoryMajorEnrollServiceImpl extends ServiceImpl<YxHistoryMajorEnrollMapper, YxHistoryMajorEnroll> implements IYxHistoryMajorEnrollService {
@Resource
private IYxHistoryScoreControlLineService yxHistoryScoreControlLineService;
@Override @Override
public boolean exist(YxHistoryMajorEnroll yxHistoryMajorEnroll) { public boolean exist(YxHistoryMajorEnroll yxHistoryMajorEnroll) {
String id = yxHistoryMajorEnroll.getId(); 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("已刷新省控线");
}
}
} }

View File

@ -145,8 +145,8 @@ spring:
redis: redis:
database: 0 database: 0
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 56379
password: '' password: 'Wang5322570'
#mybatis plus 设置 #mybatis plus 设置
mybatis-plus: mybatis-plus:
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
@ -223,8 +223,8 @@ jeecg:
logRetentionDays: 30 logRetentionDays: 30
#分布式锁配置 #分布式锁配置
redisson: redisson:
address: 127.0.0.1:6379 address: 127.0.0.1:56379
password: password: Wang5322570
type: STANDALONE type: STANDALONE
enabled: true enabled: true
#cas单点登录 #cas单点登录