Update: 根据 id 获取基金
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user