Commit 40df76f2 by 崔彦峰

fix(eval-order): 修复价格历史记录排序逻辑

- 修改了价格历史记录排序规则,将轮次内明细从按id倒序改为按id正序
- 更新了注释说明以反映正确的排序行为
- 确保最新录入的记录在列表中的位置符合预期
2 parents ac915f43 c90227c2
...@@ -255,14 +255,14 @@ public class EvalOrderService { ...@@ -255,14 +255,14 @@ public class EvalOrderService {
Map<Integer, List<EvalPriceHistoryDTO>> groupedByRound = validRecords.stream() Map<Integer, List<EvalPriceHistoryDTO>> groupedByRound = validRecords.stream()
.collect(Collectors.groupingBy(EvalPriceHistoryDTO::getRoundNo)); .collect(Collectors.groupingBy(EvalPriceHistoryDTO::getRoundNo));
// Step 5:按轮次倒序(最新轮次排最前),每轮内的明细按 id 倒序(最新录入的排最前) // Step 5:按轮次倒序(最新轮次排最前),每轮内的明细按 id 正序(最新录入的排最后)
// 字段通过 BeanUtils.copyProperties 直接映射,额外补充万元格式化展示字段(VO 独有) // 字段通过 BeanUtils.copyProperties 直接映射,额外补充万元格式化展示字段(VO 独有)
return groupedByRound.entrySet().stream() return groupedByRound.entrySet().stream()
.sorted(Map.Entry.<Integer, List<EvalPriceHistoryDTO>>comparingByKey().reversed()) // 轮次倒序 .sorted(Map.Entry.<Integer, List<EvalPriceHistoryDTO>>comparingByKey().reversed()) // 轮次倒序
.map(entry -> { .map(entry -> {
// 轮次内明细:按 id 倒序 // 轮次内明细:按 id 正序
List<EvalPriceHistoryVO> historyVOList = entry.getValue().stream() List<EvalPriceHistoryVO> historyVOList = entry.getValue().stream()
.sorted(Comparator.comparing(EvalPriceHistoryDTO::getId, Comparator.reverseOrder())) .sorted(Comparator.comparing(EvalPriceHistoryDTO::getId))
.map(dto -> { .map(dto -> {
EvalPriceHistoryVO vo = new EvalPriceHistoryVO(); EvalPriceHistoryVO vo = new EvalPriceHistoryVO();
// 复制同名字段(roundNo、opType、evalPrice、evalOpinion、 // 复制同名字段(roundNo、opType、evalPrice、evalOpinion、
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!