From e3803cd6b2507671be79724095b9b110aa23ce96 Mon Sep 17 00:00:00 2001 From: zhouwentao <1577701412@qq.com> Date: Thu, 21 Mar 2024 19:36:41 +0800 Subject: [PATCH] updates --- .../YxHistoryMajorEnrollController.java | 28 ++--- .../service/IYxHistoryMajorEnrollService.java | 5 + .../impl/YxHistoryMajorEnrollServiceImpl.java | 112 +++++++++++++++++- .../src/main/resources/application-test.yml | 8 +- 4 files changed, 133 insertions(+), 20 deletions(-) diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/controller/YxHistoryMajorEnrollController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/controller/YxHistoryMajorEnrollController.java index 6db9fa9..7b35afd 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/controller/YxHistoryMajorEnrollController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/controller/YxHistoryMajorEnrollController.java @@ -84,7 +84,7 @@ public class YxHistoryMajorEnrollController extends JeecgController queryWrapper = QueryGenerator.initQueryWrapper(yxHistoryMajorEnroll, req.getParameterMap()); Page page = new Page(pageNo, pageSize); - queryWrapper.orderByDesc("create_time","update_time"); + queryWrapper.orderByDesc("create_time", "update_time"); IPage pageList = yxHistoryMajorEnrollService.page(page, queryWrapper); return Result.OK(pageList); } @@ -202,11 +202,9 @@ public class YxHistoryMajorEnrollController extends JeecgController renewControlLine(@RequestBody YxHistoryMajorEnroll yxHistoryMajorEnroll){ + public Result renewControlLine(@RequestBody YxHistoryMajorEnroll yxHistoryMajorEnroll) { String id = yxHistoryMajorEnroll.getId(); - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - if (StringUtils.isNotBlank(id)) { - } + yxHistoryMajorEnrollService.renewControlLine(id); return Result.OK("操作成功"); } @@ -337,15 +335,15 @@ public class YxHistoryMajorEnrollController extends JeecgController= 0) { return Result.error("文件导入失败:有重复数据!"); } else { - return Result.error("文件导入失败:" + e.getMessage()+",行:"+index); + return Result.error("文件导入失败:" + e.getMessage() + ",行:" + index); } } finally { try { diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/IYxHistoryMajorEnrollService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/IYxHistoryMajorEnrollService.java index 5a19d96..6feac6c 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/IYxHistoryMajorEnrollService.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/IYxHistoryMajorEnrollService.java @@ -35,4 +35,9 @@ public interface IYxHistoryMajorEnrollService extends IService recordDtoList); + + /** + * 更新省控线 + */ + void renewControlLine(String id); } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/impl/YxHistoryMajorEnrollServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/impl/YxHistoryMajorEnrollServiceImpl.java index 52cdb3d..f7b746a 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/impl/YxHistoryMajorEnrollServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/yx/service/impl/YxHistoryMajorEnrollServiceImpl.java @@ -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 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 lambdaQueryWrapper = new LambdaQueryWrapper<>(); + if (StringUtils.isNotBlank(id)) { + lambdaQueryWrapper.in(YxHistoryMajorEnroll::getId, Arrays.asList(id.split(","))); + } + List list = list(lambdaQueryWrapper); + if (CollectionUtils.isNotEmpty(list)) { + Map 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("已刷新省控线"); + } + } } diff --git a/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml b/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml index bb4c866..91477e4 100644 --- a/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml +++ b/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml @@ -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单点登录