Update: 根据 id 获取基金

This commit is contained in:
2025-10-16 21:43:15 +08:00
parent 644af33c20
commit 733ea32b5d
2 changed files with 29 additions and 0 deletions
@@ -0,0 +1,14 @@
package cn.hezhaohui.fund.util;
import org.springframework.stereotype.Component;
@Component
public class FundUtil {
final private static String PREFIX = "https://fund.eastmoney.com/";
final private static String SUFFIX = ".html";
// example: https://fund.eastmoney.com/001068.html
public static String getUrlByFundId(String id) {
return PREFIX + id + SUFFIX;
}
}
@@ -0,0 +1,15 @@
package cn.hezhaohui.fund.util;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class FundUtilTest {
@Test
void getUrlByFundId() {
String url = FundUtil.getUrlByFundId("001068");
System.out.println(url);
assertNotNull(url);
}
}