| | |
| | | public ServerResponse getIndicesList(String stockType) { |
| | | try { |
| | | String codeList; |
| | | if (stockType.equals(EStockType.US.getCode())) { |
| | | codeList = PropertiesUtil.getProperty("us_home_indices_code"); |
| | | } else { |
| | | if(stockType.equals(EStockType.MX.getCode()) || stockType.equals("MX")) { |
| | | codeList = PropertiesUtil.getProperty("mx_home_indices_code"); |
| | | } else { |
| | | codeList = PropertiesUtil.getProperty("us_home_indices_code"); |
| | | } |
| | | List<String> stockCodeList = Arrays.asList(codeList.split(",")); |
| | | |
| | |
| | | @Override |
| | | public ServerResponse getIndicesAndKData(String pid, String stockType) { |
| | | try { |
| | | Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("stock_code", pid)); |
| | | if (stock == null) { |
| | | return ServerResponse.createByErrorMsg("无股票信息"); |
| | | } |
| | | stockType = stock.getStockType(); |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | DataStockBean cacheBaseStock = RedisKeyUtil.getCacheBaseStock(stockType, pid); |
| | | if (cacheBaseStock != null) { |
| | | resultMap.put("id", cacheBaseStock.getId()); |
| | | resultMap.put("stockType", stockType); |
| | | resultMap.put("name", cacheBaseStock.getName()); |
| | | resultMap.put("last", cacheBaseStock.getLast()); |
| | | resultMap.put("chg", cacheBaseStock.getChg()); |