| | |
| | | package com.nq.controller; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.pojo.SiteSetting; |
| | | import com.nq.service.IStockService; |
| | |
| | | @RequestMapping("getGoldCrudeOil.do") |
| | | @ResponseBody |
| | | public ServerResponse getGoldCrudeOil(HttpServletRequest request) { |
| | | String gold = RedisShardedPoolUtils.get(RedisKeyConstant.gold); |
| | | String crudeOil = RedisShardedPoolUtils.get(RedisKeyConstant.crude_oil); |
| | | HashMap<String,String> map = new HashMap<>(); |
| | | map.put(new GoogleTranslateUtil().translate("GOLD",request.getHeader("lang")),gold); |
| | | map.put(new GoogleTranslateUtil().translate("CRUDE OIL",request.getHeader("lang")),crudeOil); |
| | | return ServerResponse.createBySuccess(map); |
| | | |
| | | String gold = RedisShardedPoolUtils.get(RedisKeyConstant.XAUUSD); |
| | | String crudeOil = RedisShardedPoolUtils.get(RedisKeyConstant.USOIL); |
| | | |
| | | HashMap<String,HashMap> hashMap = new HashMap<>(); |
| | | |
| | | HashMap<String,String> goldMap = new HashMap<>(); |
| | | goldMap.put("XAUUSD",gold); |
| | | goldMap.put("hcrate",RedisShardedPoolUtils.get("XAUUSD"+"_H")); |
| | | goldMap.put("hcrateP",RedisShardedPoolUtils.get("XAUUSD"+"_H")+"%"); |
| | | hashMap.put("XAUUSD",goldMap); |
| | | |
| | | HashMap<String,String> crudOilMap = new HashMap<>(); |
| | | crudOilMap.put("USOIL",crudeOil); |
| | | crudOilMap.put("hcrate",RedisShardedPoolUtils.get("USOIL"+"_H")); |
| | | crudOilMap.put("hcrateP",RedisShardedPoolUtils.get("USOIL"+"_H")+"%"); |
| | | hashMap.put("USOIL",crudOilMap); |
| | | |
| | | return ServerResponse.createBySuccess(hashMap); |
| | | } |
| | | |
| | | |
| | |
| | | //通过股票代码查询股票信息 |
| | | @RequestMapping({"getSingleStock.do"}) |
| | | @ResponseBody |
| | | public ServerResponse getSingleStock(@RequestParam("code") String code, HttpServletRequest request) { |
| | | public ServerResponse getSingleStock(@RequestParam("code") String code, HttpServletRequest request) throws JsonProcessingException { |
| | | return this.iStockService.getSingleStock(code, request); |
| | | } |
| | | |
| | |
| | | public Object getKData( |
| | | @RequestParam("pid") String pid, |
| | | @RequestParam("interval") String interval, |
| | | @RequestParam("stockType") String stockType |
| | | @RequestParam("stockType") String stockType, |
| | | HttpServletRequest request |
| | | ) { |
| | | return this.iStockService.getKData(pid,interval,stockType); |
| | | try { |
| | | return this.iStockService.getKData(pid,interval,stockType); |
| | | }catch (Exception e){ |
| | | log.error("获取k线失败",e.getMessage()); |
| | | } |
| | | return ServerResponse.createByErrorMsg("获取k线失败",request); |
| | | } |
| | | |
| | | |