feat: 增加额外得分数据保存
This commit is contained in:
@@ -3,6 +3,8 @@ package com.lanyuanxiaoyao.leopard.server.entity;
|
||||
import com.lanyuanxiaoyao.leopard.core.entity.Stock;
|
||||
import com.lanyuanxiaoyao.leopard.core.entity.StockScore;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
@@ -16,7 +18,8 @@ public record StockScoreVo(
|
||||
Stock.Market market,
|
||||
String industry,
|
||||
LocalDate listedDate,
|
||||
Double score
|
||||
Double score,
|
||||
String extra
|
||||
) {
|
||||
public static StockScoreVo of(StockScore score) {
|
||||
return new StockScoreVo(
|
||||
@@ -27,7 +30,13 @@ public record StockScoreVo(
|
||||
score.getStock().getMarket(),
|
||||
score.getStock().getIndustry(),
|
||||
score.getStock().getListedDate(),
|
||||
score.getScore()
|
||||
score.getScore(),
|
||||
score.getExtra()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.sorted(Map.Entry.comparingByKey())
|
||||
.map(entry -> entry.getKey() + ": " + entry.getValue())
|
||||
.collect(Collectors.joining("<br>"))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user