| | |
| | | |
| | | private static HttpPost httpPost; |
| | | static { |
| | | httpPost = new HttpPost("http://127.0.0.1:8001/api/sendNotification"); // 初始化 HttpPost |
| | | httpPost = new HttpPost("http://127.0.0.1:8008/api/sendNotification"); // 初始化 HttpPost |
| | | } |
| | | |
| | | @Override |
| | |
| | | stockRealTimeBean.setPc(stringObjectMap.get("Chg").toString()); |
| | | stockRealTimeBean.setPcp(stringObjectMap.get("ChgPct").toString()+"%"); |
| | | stockRealTimeBean.setTime(stringObjectMap.get("Time").toString()); |
| | | RedisKeyUtil.setCacheRealTimeStock(EStockType.IN,stockRealTimeBean); |
| | | stockRealTimeBean.setOpen(stringObjectMap.get("Open")); |
| | | stockRealTimeBean.setPrevClose(stringObjectMap.get("PrevClose")); |
| | | stockRealTimeBean.setSymbol(stringObjectMap.get("Symbol")); |
| | | |
| | | RedisKeyUtil.setCacheRealTimeStock(EStockType.US,stockRealTimeBean); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | if(!stockRealTimeBean.getPcp().contains("-")){ |
| | |
| | | String json = objectMapper.writeValueAsString(stockRealTimeBean); |
| | | sendLoca(json); |
| | | StockRealTimeBean stockDetailBean = new Gson().fromJson(s, StockRealTimeBean.class); |
| | | RedisKeyUtil.setCacheRealTimeStock(EStockType.IN,stockDetailBean); |
| | | RedisKeyUtil.setCacheRealTimeStock(EStockType.US,stockDetailBean); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | log.error("Http 请求错误", e); |
| | | } |
| | | } |
| | | } |
| | | } |