update time for response news
This commit is contained in:
@@ -20,6 +20,12 @@ import cn.stock.market.domain.basic.entity.SiteSetting;
|
|||||||
import cn.stock.market.domain.basic.repository.SiteSettingRepository;
|
import cn.stock.market.domain.basic.repository.SiteSettingRepository;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
@SpringBootApplication(exclude = {
|
@SpringBootApplication(exclude = {
|
||||||
MongoAutoConfiguration.class, MongoDataAutoConfiguration.class,
|
MongoAutoConfiguration.class, MongoDataAutoConfiguration.class,
|
||||||
RedisAutoConfiguration.class,
|
RedisAutoConfiguration.class,
|
||||||
@@ -31,6 +37,11 @@ public class StockMarketLaunch implements CommandLineRunner {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
HttpGlobalConfig.setTimeout(45000);
|
HttpGlobalConfig.setTimeout(45000);
|
||||||
|
TimeZone.setDefault(TimeZone.getTimeZone("Europe/Madrid"));
|
||||||
|
log.info("JVM ZoneId: {}", ZoneId.systemDefault());
|
||||||
|
log.info("Sample: now={}, madrid={}",
|
||||||
|
new Date(),
|
||||||
|
ZonedDateTime.now(ZoneId.of("Europe/Madrid")));
|
||||||
SpringApplication.run(StockMarketLaunch.class, args);
|
SpringApplication.run(StockMarketLaunch.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1063,7 +1063,7 @@ public class StockService {
|
|||||||
market.setRate(String.valueOf(stockIndex.getPercentChange()));
|
market.setRate(String.valueOf(stockIndex.getPercentChange()));
|
||||||
vo1.setIndexVo(market);
|
vo1.setIndexVo(market);
|
||||||
|
|
||||||
List<ChartCandle> kLines = HomeApiIndex.fetchChartData(stockIndex.getId(), 419);
|
List<ChartCandle> kLines = HomeApiIndex.fetchChartData(stockIndex.getId(), 100);
|
||||||
// List kline = HomeApiIndex.convertToJsonList(kLines);
|
// List kline = HomeApiIndex.convertToJsonList(kLines);
|
||||||
vo1.setKLine(kLines);
|
vo1.setKLine(kLines);
|
||||||
indexVoList.add(vo1);
|
indexVoList.add(vo1);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class HomeApiIndex {
|
|||||||
public static List<ChartCandle> fetchChartData(String symbol, int amount) throws Exception {
|
public static List<ChartCandle> fetchChartData(String symbol, int amount) throws Exception {
|
||||||
List<ChartCandle> result = new ArrayList<>();
|
List<ChartCandle> result = new ArrayList<>();
|
||||||
|
|
||||||
String url = BASE_URL + "?symbol=" + symbol + "&interval=D&amount=" + amount;
|
String url = BASE_URL + "?symbol=" + symbol + "&interval=H&amount=" + amount;
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import javax.persistence.GenerationType;
|
|||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import org.hibernate.annotations.DynamicInsert;
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
@@ -75,6 +76,7 @@ public class SiteNewsPO {
|
|||||||
/**
|
/**
|
||||||
* 显示时间 */
|
* 显示时间 */
|
||||||
@ApiModelProperty("显示时间")
|
@ApiModelProperty("显示时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Europe/Madrid")
|
||||||
Date showTime;
|
Date showTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ public class InvestingTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 0/3 * * ?")
|
@Scheduled(cron = "0 0 0/3 * * ?")
|
||||||
@PostConstruct
|
// @PostConstruct
|
||||||
public void getCincoDiasNews() {
|
public void getCincoDiasNews() {
|
||||||
String baseUrl = "https://cincodias.elpais.com";
|
String baseUrl = "https://cincodias.elpais.com";
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
spring:
|
spring:
|
||||||
jpa:
|
jpa:
|
||||||
show-sql: true
|
show-sql: true
|
||||||
|
|
||||||
# Redis配置
|
# Redis配置
|
||||||
redis:
|
redis:
|
||||||
host: 43.160.197.177
|
host: 167.235.39.59
|
||||||
password: redispass123
|
password: a5v8b86P4mVzFlUqJV
|
||||||
port: 6379
|
port: 47379
|
||||||
database: 1
|
database: 1
|
||||||
lettuce:
|
lettuce:
|
||||||
pool:
|
pool:
|
||||||
@@ -17,9 +18,9 @@ spring:
|
|||||||
datasource:
|
datasource:
|
||||||
stock-market:
|
stock-market:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://43.160.197.177:3306/germany_stock?useUnicode=true&characterEncoding=utf-8
|
url: jdbc:mysql://de-cdb-pj5o5m8b.sql.tencentcdb.com:24110/stock-api?useUnicode=true&characterEncoding=utf-8
|
||||||
username: root
|
username: root
|
||||||
password: mysqlpass123
|
password: 6QJXv8dA76klnqsWh6f
|
||||||
maxActive: 500
|
maxActive: 500
|
||||||
testWhileIdle: true
|
testWhileIdle: true
|
||||||
validationQuery: SELECT 1
|
validationQuery: SELECT 1
|
||||||
|
|||||||
Reference in New Issue
Block a user