xxxx
This commit is contained in:
parent
1fb6e66f5b
commit
365eb2476c
@ -2,6 +2,7 @@ package jj.tech.finance.biz.webadmin.controller;
|
|||||||
|
|
||||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@ -15,6 +16,7 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.http.client.ClientProtocolException;
|
||||||
import org.apache.http.client.fluent.Request;
|
import org.apache.http.client.fluent.Request;
|
||||||
import org.apache.http.entity.ContentType;
|
import org.apache.http.entity.ContentType;
|
||||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||||
@ -29,6 +31,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
@ -59,9 +62,9 @@ public class GetFutDailyController {
|
|||||||
@Autowired DailyService dailyService;
|
@Autowired DailyService dailyService;
|
||||||
|
|
||||||
|
|
||||||
// @Operation(summary = "获取日线信息", description = "")
|
// @Operation(summary = "获取所有日线信息", description = "")
|
||||||
// @GetMapping("/getDate")
|
// @GetMapping("/getAll")
|
||||||
// public Object getDate() {
|
// public Object getAll() {
|
||||||
//
|
//
|
||||||
// var ts_codes = select(FutDailyDynamicSqlSupport.ts_code)
|
// var ts_codes = select(FutDailyDynamicSqlSupport.ts_code)
|
||||||
// .from(FutDailyDynamicSqlSupport.futDaily)
|
// .from(FutDailyDynamicSqlSupport.futDaily)
|
||||||
@ -159,19 +162,6 @@ public class GetFutDailyController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DeleteStatementProvider delete = deleteFrom(FutDailyDynamicSqlSupport.futDaily)
|
|
||||||
.where(FutDailyDynamicSqlSupport.ts_code, isIn(
|
|
||||||
select(ContractInfoDynamicSqlSupport.ts_code)
|
|
||||||
.from(ContractInfoDynamicSqlSupport.contractInfo)
|
|
||||||
.where(ContractInfoDynamicSqlSupport.contractInfo.delist_date, isGreaterThan(d)))
|
|
||||||
)
|
|
||||||
.build()
|
|
||||||
.render(RenderingStrategies.MYBATIS3);
|
|
||||||
futDailyMapper.delete(delete);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<ContractInfo> contractInfos = contractInfoMapper.selectMany(from);
|
List<ContractInfo> contractInfos = contractInfoMapper.selectMany(from);
|
||||||
|
|
||||||
contractInfos.forEach(i->{
|
contractInfos.forEach(i->{
|
||||||
@ -463,5 +453,127 @@ public class GetFutDailyController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @GetMapping("/test")
|
||||||
|
// public Object test() throws Exception{
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// HashMap<Object,Object> h = new HashMap<Object,Object>();
|
||||||
|
// h.put("api_name", "fut_daily");
|
||||||
|
// h.put("token", TushareConfig.TOKEN);
|
||||||
|
// HashMap<Object,Object> params = new HashMap<Object,Object>();
|
||||||
|
// params.put("ts_code", "HC2405.SHF");
|
||||||
|
// params.put("limit", 10000);
|
||||||
|
// h.put("params", params);
|
||||||
|
// logger.debug("tushare:" + objectMapper.writeValueAsString(h));
|
||||||
|
//
|
||||||
|
// InputStream stean =
|
||||||
|
// Request.Post(TushareConfig.URL)
|
||||||
|
// .connectTimeout(15000)
|
||||||
|
// .socketTimeout(15000)
|
||||||
|
// .bodyString(objectMapper.writeValueAsString(h), ContentType.APPLICATION_JSON)
|
||||||
|
// .execute()
|
||||||
|
// .returnContent()
|
||||||
|
// .asStream();
|
||||||
|
// JsonNode root = objectMapper.readTree(stean);
|
||||||
|
// JsonNode items = root.get("data").get("items");
|
||||||
|
//
|
||||||
|
// ArrayList<FutDaily> list = new ArrayList<FutDaily>();
|
||||||
|
//
|
||||||
|
// if(items!=null) {
|
||||||
|
// for(JsonNode jsonNode : items) {
|
||||||
|
// FutDaily bean = new FutDaily();
|
||||||
|
// bean.setTs_code(jsonNode.get(0).asText());
|
||||||
|
//
|
||||||
|
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||||
|
// LocalDate localDate = LocalDate.parse(jsonNode.get(1).asText(), formatter);
|
||||||
|
//
|
||||||
|
// bean.setTrade_date(localDate);
|
||||||
|
// bean.setPre_close(jsonNode.get(2).asDouble());
|
||||||
|
// bean.setPre_settle(jsonNode.get(3).asDouble());
|
||||||
|
// bean.setOpen(jsonNode.get(4).asDouble());
|
||||||
|
// bean.setHigh(jsonNode.get(5).asDouble());
|
||||||
|
//
|
||||||
|
// bean.setLow(jsonNode.get(6).asDouble());
|
||||||
|
// bean.setClose(jsonNode.get(7).asDouble());
|
||||||
|
// bean.setSettle(jsonNode.get(8).asDouble());
|
||||||
|
// bean.setChange1(jsonNode.get(9).asDouble());
|
||||||
|
// bean.setChange2(jsonNode.get(10).asDouble());
|
||||||
|
//
|
||||||
|
// bean.setVol(jsonNode.get(11).asDouble());
|
||||||
|
// bean.setAmount(jsonNode.get(12).asDouble());
|
||||||
|
// bean.setOi(jsonNode.get(13).asDouble());
|
||||||
|
// bean.setOi_chg(jsonNode.get(14).asDouble());
|
||||||
|
// list.add(bean);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if(!list.isEmpty()) {
|
||||||
|
// dailyService.getCurr("HC2405.SHF", list);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// return R.SUCCESS("getDate is ok");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// public static void main(String[] args) throws Exception {
|
||||||
|
//
|
||||||
|
// ObjectMapper objectMapper =new ObjectMapper();
|
||||||
|
// HashMap<Object,Object> h = new HashMap<Object,Object>();
|
||||||
|
// h.put("api_name", "fut_daily");
|
||||||
|
// h.put("token", TushareConfig.TOKEN);
|
||||||
|
// HashMap<Object,Object> params = new HashMap<Object,Object>();
|
||||||
|
// params.put("ts_code", "HC2405.SHF");
|
||||||
|
// params.put("limit", 10000);
|
||||||
|
// h.put("params", params);
|
||||||
|
// logger.debug("tushare:" + objectMapper.writeValueAsString(h));
|
||||||
|
//
|
||||||
|
// InputStream stean =
|
||||||
|
// Request.Post(TushareConfig.URL)
|
||||||
|
// .connectTimeout(15000)
|
||||||
|
// .socketTimeout(15000)
|
||||||
|
// .bodyString(objectMapper.writeValueAsString(h), ContentType.APPLICATION_JSON)
|
||||||
|
// .execute()
|
||||||
|
// .returnContent()
|
||||||
|
// .asStream();
|
||||||
|
// JsonNode root = objectMapper.readTree(stean);
|
||||||
|
// JsonNode items = root.get("data").get("items");
|
||||||
|
// //System.out.println(items);
|
||||||
|
// ArrayList<FutDaily> list = new ArrayList<FutDaily>();
|
||||||
|
//
|
||||||
|
// if(items!=null) {
|
||||||
|
// for(JsonNode jsonNode : items) {
|
||||||
|
// FutDaily bean = new FutDaily();
|
||||||
|
// bean.setTs_code(jsonNode.get(0).asText());
|
||||||
|
//
|
||||||
|
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||||
|
// LocalDate localDate = LocalDate.parse(jsonNode.get(1).asText(), formatter);
|
||||||
|
//
|
||||||
|
// bean.setTrade_date(localDate);
|
||||||
|
// bean.setPre_close(jsonNode.get(2).asDouble());
|
||||||
|
// bean.setPre_settle(jsonNode.get(3).asDouble());
|
||||||
|
// bean.setOpen(jsonNode.get(4).asDouble());
|
||||||
|
// bean.setHigh(jsonNode.get(5).asDouble());
|
||||||
|
//
|
||||||
|
// bean.setLow(jsonNode.get(6).asDouble());
|
||||||
|
// bean.setClose(jsonNode.get(7).asDouble());
|
||||||
|
// bean.setSettle(jsonNode.get(8).asDouble());
|
||||||
|
// bean.setChange1(jsonNode.get(9).asDouble());
|
||||||
|
// bean.setChange2(jsonNode.get(10).asDouble());
|
||||||
|
//
|
||||||
|
// bean.setVol(jsonNode.get(11).asDouble());
|
||||||
|
// bean.setAmount(jsonNode.get(12).asDouble());
|
||||||
|
// bean.setOi(jsonNode.get(13).asDouble());
|
||||||
|
// bean.setOi_chg(jsonNode.get(14).asDouble());
|
||||||
|
// list.add(bean);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// System.out.println(list.size());
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user