21 files modified
1 files added
| New file |
| | |
| | | package com.nq.config; |
| | | |
| | | public enum StockType { |
| | | A("hs", "A股"), |
| | | HK("hk", "港股"); |
| | | private String code; |
| | | private String msg; |
| | | |
| | | StockType(String code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return this.code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return this.msg; |
| | | } |
| | | } |
| | |
| | | //通过股票代码查询股票信息 |
| | | @RequestMapping({"getSingleStock.do"}) |
| | | @ResponseBody |
| | | public ServerResponse getSingleStock(@RequestParam("code") String code, HttpServletRequest request) { |
| | | return this.iStockService.getSingleStock(code, request); |
| | | public ServerResponse getSingleStock(@RequestParam("stockType") String stockType,@RequestParam("code") String code, HttpServletRequest request) { |
| | | return this.iStockService.getSingleStock(stockType,code, request); |
| | | } |
| | | |
| | | @RequestMapping({"getMinK.do"}) |
| | |
| | | @ResponseBody |
| | | public ServerResponse getStockMarketZDFB(Integer pageNo,Integer pageSize, String sort, |
| | | Integer asc, |
| | | String node){ |
| | | String node,String stockType){ |
| | | // String key=pageNo+pageSize+sort+asc+node; |
| | | // String result = (String) CacheUtil.get(key); |
| | | // if(StringUtils.isEmpty(result)){ |
| | | ServerResponse stockSort = this.iStockService.getStockSort(pageNo, pageSize, sort, asc, node); |
| | | ServerResponse stockSort = this.iStockService.getStockSort(pageNo, pageSize, sort, asc, node,stockType); |
| | | // CacheUtil.set(key, JSON.toJSONString(stockSort.getData()),5000); |
| | | // return stockSort; |
| | | // } |
| | |
| | | @PostMapping({"getVipList.do"}) |
| | | @ResponseBody |
| | | public ServerResponse getVipList() { |
| | | ServerResponse stockSort = this.iStockService.getStockSort(1, 15, "changepercent", 0, "hs_a"); |
| | | ServerResponse stockSort = this.iStockService.getStockSort(1, 15, "changepercent", 0, "hs_a","hs"); |
| | | if(!ObjectUtils.isEmpty(stockSort.getData())){ |
| | | JSONArray data = (JSONArray)stockSort.getData(); |
| | | ArrayList<HashMap> list = new ArrayList<>(); |
| | |
| | | // serverResponse = this.iStockIndexService.queryListIndex(request); |
| | | // CacheUtil.set("queryListIndex", serverResponse, 6000); |
| | | // } |
| | | // return this.iStockIndexService.queryListIndex(request); |
| | | return ServerResponse.createByError(); |
| | | return this.iStockIndexService.queryListIndex(request); |
| | | // return ServerResponse.createByError(); |
| | | } |
| | | |
| | | @RequestMapping({"queryTransIndex.do"}) |
| | |
| | | //添加到自选股 |
| | | @RequestMapping({"addOption.do"}) |
| | | @ResponseBody |
| | | public ServerResponse addOption(@RequestParam("code") String code, HttpServletRequest request) { |
| | | return this.iUserService.addOption(code, request); |
| | | public ServerResponse addOption(@RequestParam("stockType") String stockType,@RequestParam("code") String code, HttpServletRequest request) { |
| | | return this.iUserService.addOption(stockType,code, request); |
| | | } |
| | | |
| | | //删除自选股 |
| | |
| | | List queryHomeIndex(); |
| | | |
| | | List queryListIndex(); |
| | | |
| | | List queryListIndexType(@Param("stockType") String stockType); |
| | | } |
| | |
| | | |
| | | Stock findStockByCode(String paramString); |
| | | |
| | | Stock findStockByCodeAndType(@Param("stockType") String stockType,@Param("code") String code); |
| | | |
| | | |
| | | |
| | | Stock findStockByName(String paramString); |
| | | |
| | | List listByAdmin(@Param("showState") Integer paramInteger1, @Param("lockState") Integer paramInteger2, @Param("code") String paramString1, @Param("name") String paramString2, @Param("stockPlate") String paramString3, @Param("stockType") String paramString4); |
| | |
| | | private String stockName; |
| | | private String stockGid; |
| | | private Integer isLock; |
| | | private String stockType; |
| | | |
| | | public StockOption(Integer id, Integer userId, Integer stockId, Date addTime, String stockCode, String stockName, String stockGid, Integer isLock) { |
| | | this.id = id; |
| | |
| | | public void setIsLock(Integer isLock) { |
| | | this.isLock = isLock; |
| | | } |
| | | |
| | | public String getStockType() { |
| | | return stockType; |
| | | } |
| | | |
| | | public void setStockType(String stockType) { |
| | | this.stockType = stockType; |
| | | } |
| | | } |
| | |
| | | private Integer isLock; |
| | | private String lockMsg; |
| | | private String stockPlate; |
| | | private String stockType; |
| | | /*点差费金额*/ |
| | | private BigDecimal spreadRatePrice; |
| | | /*追加保证金额*/ |
| | |
| | | public void setBuyOrderIdIndex(BigDecimal buyOrderIdIndex) { |
| | | this.buyOrderIdIndex = buyOrderIdIndex; |
| | | } |
| | | |
| | | public String getStockType() { |
| | | return stockType; |
| | | } |
| | | |
| | | public void setStockType(String stockType) { |
| | | this.stockType = stockType; |
| | | } |
| | | } |
| | | |
| | |
| | | void bj1(); |
| | | ServerResponse getDateline(HttpServletResponse paramHttpServletResponse, String paramString); |
| | | |
| | | ServerResponse getSingleStock(String paramString,HttpServletRequest request); |
| | | ServerResponse getSingleStock(String stockType,String paramString,HttpServletRequest request); |
| | | |
| | | ServerResponse getMinK(String paramString, Integer paramInteger1, Integer paramInteger2, Integer paramInteger3); |
| | | |
| | |
| | | * @param node 排序的主板类型 科创板 创业板 a股 北交所等 |
| | | * @return |
| | | */ |
| | | ServerResponse getStockSort(Integer pageNo, Integer pageSize, String sort, Integer asc, String node); |
| | | ServerResponse getStockSort(Integer pageNo, Integer pageSize, String sort, Integer asc, String node,String stockType); |
| | | |
| | | /** |
| | | * 涨停板 |
| | |
| | | |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.pojo.User; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.math.BigDecimal; |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | |
| | | User getCurrentRefreshUser(HttpServletRequest paramHttpServletRequest); |
| | | |
| | | ServerResponse addOption(String paramString, HttpServletRequest paramHttpServletRequest); |
| | | ServerResponse addOption(String stockType, String paramString, HttpServletRequest paramHttpServletRequest); |
| | | |
| | | ServerResponse delOption(String paramString, HttpServletRequest paramHttpServletRequest); |
| | | |
| | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.google.common.collect.Lists; |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.config.StockType; |
| | | import com.nq.dao.StockIndexMapper; |
| | | import com.nq.pojo.StockIndex; |
| | | import com.nq.pojo.User; |
| | |
| | | List<StockIndex> stockIndexList = this.stockIndexMapper.listByAdmin(homeShow, listShow, transState, indexCode, indexName); |
| | | List<StockIndexVO> stockIndexVOS = Lists.newArrayList(); |
| | | for (StockIndex stockIndex : stockIndexList) { |
| | | StockIndexVO stockIndexVO = assembleStockIndexVO(stockIndex); |
| | | StockIndexVO stockIndexVO = assembleStockIndexVO(stockIndex,null); |
| | | stockIndexVOS.add(stockIndexVO); |
| | | } |
| | | PageInfo pageInfo = new PageInfo(stockIndexList); |
| | |
| | | return ServerResponse.createBySuccess(pageInfo); |
| | | } |
| | | |
| | | private StockIndexVO assembleStockIndexVO(StockIndex stockIndex) { |
| | | private StockIndexVO assembleStockIndexVO(StockIndex stockIndex,String stockType) { |
| | | StockIndexVO stockIndexVO = new StockIndexVO(); |
| | | |
| | | stockIndexVO.setId(stockIndex.getId()); |
| | |
| | | stockIndexVO.setAddTime(stockIndex.getAddTime()); |
| | | stockIndexVO.setTDesc(stockIndex.getTDesc()); |
| | | |
| | | MarketVO marketVO = querySingleIndex(stockIndex.getIndexGid()); |
| | | MarketVO marketVO = null; |
| | | if(StockType.A.getCode().equals(stockType)){ |
| | | marketVO = querySingleIndex(stockIndex.getIndexGid()); |
| | | }else { |
| | | marketVO = querySingleIndexHk(stockIndex.getIndexGid()); |
| | | } |
| | | |
| | | stockIndexVO.setCurrentPoint(marketVO.getNowPrice()); |
| | | stockIndexVO.setFloatPoint(marketVO.getIncrease()); |
| | | stockIndexVO.setFloatRate(marketVO.getIncreaseRate()); |
| | | stockIndexVO.setType(marketVO.getType()); |
| | | return stockIndexVO; |
| | | } |
| | | |
| | | public MarketVO querySingleIndexHk(String indexCode) { |
| | | MarketVO marketVO = null; |
| | | |
| | | String market_url = PropertiesUtil.getProperty("sina.single.market.hkurl"); |
| | | |
| | | String result = null; |
| | | try { |
| | | market_url = market_url + indexCode; |
| | | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | //System.out.print("指数请求开始,时间:"+sdf.format(new Date())+",market_url:"+market_url + "\n"); |
| | | |
| | | result = HttpClientRequest.doGet(market_url); |
| | | //System.out.print("指数请求结束,时间:"+sdf.format(new Date())+",result:"+result + "\n"); |
| | | } catch (Exception e) { |
| | | log.error("获取 大盘指数 出错 e = {}", e); |
| | | } |
| | | try { |
| | | if (StringUtils.isNotBlank(result)) { |
| | | result = result.substring(result.indexOf("\"") + 1, result.lastIndexOf("\"")); |
| | | |
| | | marketVO = new MarketVO(); |
| | | if (result.contains(",")) { |
| | | String[] sh01_arr = result.split(","); |
| | | marketVO.setName(sh01_arr[0]); |
| | | marketVO.setNowPrice(sh01_arr[6]); |
| | | marketVO.setIncrease(sh01_arr[7]); |
| | | marketVO.setIncreaseRate(sh01_arr[8]); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("转换大盘指数出错 str = {} , e = {}", result, e); |
| | | } |
| | | |
| | | return marketVO; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | public ServerResponse queryListIndex(HttpServletRequest request) { |
| | | List<StockIndex> list = this.stockIndexMapper.queryListIndex(); |
| | | List<StockIndexVO> stockIndexVOS = Lists.newArrayList(); |
| | | String stockType = request.getParameter("stockType"); |
| | | List<StockIndex> list = this.stockIndexMapper.queryListIndexType(stockType); |
| | | User user = iUserService.getCurrentUser(request); |
| | | for (StockIndex stockIndex : list) { |
| | | StockIndexVO stockIndexVO = assembleStockIndexVO(stockIndex); |
| | | StockIndexVO stockIndexVO = assembleStockIndexVO(stockIndex,stockType); |
| | | //是否添加自選 |
| | | if (user == null) { |
| | | stockIndexVO.setIsOption("0"); |
| | |
| | | |
| | | import com.nq.common.ServerResponse; |
| | | |
| | | import com.nq.config.StockType; |
| | | import com.nq.dao.StockMapper; |
| | | |
| | | import com.nq.dao.StockOptionMapper; |
| | |
| | | |
| | | List<StockOptionListVO> stockOptionListVOS = Lists.newArrayList(); |
| | | for (StockOption option : stockOptions) { |
| | | StockOptionListVO stockOptionListVO = assembleStockOptionListVO(option); |
| | | StockOptionListVO stockOptionListVO = assembleStockOptionListVO(option,option.getStockType()); |
| | | stockOptionListVO.setIsOption("1"); |
| | | stockOptionListVOS.add(stockOptionListVO); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | private StockOptionListVO assembleStockOptionListVO(StockOption option) { |
| | | private StockOptionListVO assembleStockOptionListVO(StockOption option,String stockType) { |
| | | |
| | | StockOptionListVO stockOptionListVO = new StockOptionListVO(); |
| | | |
| | |
| | | } else { |
| | | stockVO= SinaStockApi.assembleLideStockVO(LiDeDataUtils.getStock(option.getStockCode())); |
| | | if(ObjectUtils.isEmpty(stockVO)){ |
| | | stockVO = SinaStockApi.assembleStockVO(SinaStockApi.getSinaStock(option.getStockGid())); |
| | | if(StockType.HK.getCode().equals(stockType)){ |
| | | stockVO = SinaStockApi.otherStockVO(SinaStockApi.getSinaStock(StockType.HK.getCode()+option.getStockGid())); |
| | | }else { |
| | | stockVO = SinaStockApi.assembleStockVO(SinaStockApi.getSinaStock(option.getStockGid())); |
| | | } |
| | | } |
| | | } |
| | | stockOptionListVO.setNowPrice(stockVO.getNowPrice()); |
| | |
| | | import com.google.common.collect.Maps; |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.config.StockPoll; |
| | | import com.nq.config.StockType; |
| | | import com.nq.dao.RealTimeMapper; |
| | | import com.nq.dao.StockFuturesMapper; |
| | | import com.nq.dao.StockIndexMapper; |
| | |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | return ServerResponse.createBySuccess(echartsDataVO); |
| | | } |
| | | |
| | | public ServerResponse getSingleStock(String code,HttpServletRequest request) { |
| | | public ServerResponse getSingleStock(String stockType,String code,HttpServletRequest request) { |
| | | if (StringUtils.isBlank(code)) |
| | | return ServerResponse.createByErrorMsg(""); |
| | | Stock stock = new Stock(); |
| | |
| | | |
| | | // |
| | | } else {//股票 |
| | | |
| | | stock = this.stockMapper.findStockByCode(code); |
| | | if(StockType.HK.getCode().equals(stockType)){ |
| | | stock = this.stockMapper.findStockByCodeAndType(stockType,code); |
| | | }else { |
| | | stock = this.stockMapper.findStockByCode(code); |
| | | } |
| | | if (stock == null) |
| | | return ServerResponse.createByErrorMsg(""); |
| | | if (request.getHeader("lang") != null && !request.getHeader("lang").equals("zh-CN") && !request.getHeader("lang").equals("tww") && !request.getHeader("lang").equals("")) { |
| | |
| | | //股票数据 |
| | | StockVO stockVO = new StockVO(); |
| | | |
| | | String sinaResult = SinaStockApi.getSinaStock(gid); |
| | | // String sinaResult = SinaStockApi.getSinaStock(gid); |
| | | |
| | | stockVO= SinaStockApi.assembleLideStockVO(LiDeDataUtils.getStock(stock.getStockCode())); |
| | | if(ObjectUtils.isEmpty(stockVO)){ |
| | | stockVO = SinaStockApi.assembleStockVO(SinaStockApi.getSinaStock(stock.getStockGid())); |
| | | if (code.contains("hf")) { |
| | | stockVO = SinaStockApi.assembleStockFuturesVO(sinaResult); |
| | | if(StockType.HK.getCode().equals(stockType)){ |
| | | stockVO = SinaStockApi.otherStockVO(SinaStockApi.getSinaStock(StockType.HK.getCode()+stock.getStockGid())); |
| | | }else { |
| | | stockVO = SinaStockApi.assembleStockVO(SinaStockApi.getSinaStock(stock.getStockGid())); |
| | | } |
| | | |
| | | // if (code.contains("hf")) { |
| | | // stockVO = SinaStockApi.assembleStockFuturesVO(sinaResult); |
| | | // } |
| | | } |
| | | |
| | | // if (code.contains("hf")) { |
| | |
| | | |
| | | public ServerResponse selectRateByDaysAndStockCode(String stockCode, int days) { |
| | | Stock stock = this.stockMapper.findStockByCode(stockCode); |
| | | if (stock == null) |
| | | return ServerResponse.createByErrorMsg("没有该股票"); |
| | | if (stock == null) { |
| | | //再查港股 |
| | | stock = this.stockMapper.findStockByCodeAndType(StockType.HK.getCode(),stockCode); |
| | | if (stock == null) |
| | | return ServerResponse.createByErrorMsg("没有该股票"); |
| | | } |
| | | BigDecimal daysRate = this.iStockMarketsDayService.selectRateByDaysAndStockCode(stock.getId(), days); |
| | | return ServerResponse.createBySuccess(daysRate); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ServerResponse getStockSort(Integer pageNo, Integer pageSize, String sort, Integer asc, String node) { |
| | | // String market_url = PropertiesUtil.getProperty("sina.market.zdf.url"); |
| | | String result = null; |
| | | String param="page="+pageNo+"&num="+pageSize+"&sort="+sort+"&asc="+asc+"&node="+node+"&symbol=&_s_r_a=sort"; |
| | | // String url=market_url+param; |
| | | // result = HttpClientRequest.doGet(url); |
| | | // |
| | | result = HttpClientRequest.doGet("http://111.170.140.248:7001/crypto/getStockSort.do?" + param); |
| | | com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(result); |
| | | return ServerResponse.createBySuccess(jsonArray); |
| | | public ServerResponse getStockSort(Integer pageNo, Integer pageSize, String sort, Integer asc, String node,String stockType) { |
| | | String market_url = ""; |
| | | String param = ""; |
| | | if(StockType.A.getCode().equals(stockType)){ |
| | | market_url = PropertiesUtil.getProperty("sina.market.zdf.url"); |
| | | param="page="+pageNo+"&num="+pageSize+"&sort="+sort+"&asc="+asc+"&node="+node+"&symbol=&_s_r_a=sort"; |
| | | String result = null; |
| | | String url=market_url+param; |
| | | result = HttpClientRequest.doGet(url); |
| | | com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(result); |
| | | return ServerResponse.createBySuccess(jsonArray); |
| | | }else { |
| | | market_url = PropertiesUtil.getProperty("sina.market.zdf.urlhk"); |
| | | param="page="+pageNo+"&num="+pageSize+"&sort="+sort+"&asc="+asc+"&node="+node+"&symbol=&_s_r_a=sort"; |
| | | String result = null; |
| | | String url=market_url+param; |
| | | result = HttpClientRequest.doGet(url); |
| | | com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(result); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | com.alibaba.fastjson.JSONObject obj = jsonArray.getJSONObject(i); |
| | | obj.put("buy",obj.get("lasttrade")); |
| | | obj.put("stock_type","hk"); |
| | | for (String key : obj.keySet()) { |
| | | if(key.equals("symbol")){ |
| | | continue; |
| | | } |
| | | Object value = obj.get(key); |
| | | if (value instanceof String) { |
| | | try { |
| | | BigDecimal bd = new BigDecimal((String) value); |
| | | obj.put(key, bd.setScale(3, RoundingMode.HALF_UP).stripTrailingZeros().toPlainString()); |
| | | } catch (NumberFormatException e) { |
| | | // 非数字值保持原样 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return ServerResponse.createBySuccess(jsonArray); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.google.gson.Gson; |
| | | import com.nq.config.StockType; |
| | | import com.nq.dao.*; |
| | | import com.nq.pojo.*; |
| | | import com.nq.service.*; |
| | |
| | | boolean am_flag = BuyAndSellUtils.isTransTime(am_begin, am_end); |
| | | boolean pm_flag = BuyAndSellUtils.isTransTime(pm_begin, pm_end); |
| | | log.info("是否在上午交易时间 = {} 是否在下午交易时间 = {}", Boolean.valueOf(am_flag), Boolean.valueOf(pm_flag)); |
| | | |
| | | //TODO |
| | | if (!am_flag && !pm_flag) { |
| | | return ServerResponse.createByErrorMsg("下单失败,不在港股股交易时段内"); |
| | | } |
| | |
| | | //股票类型 现价 数据源的处理 |
| | | stockListVO = SinaStockApi.assembleLideStockListVO(LiDeDataUtils.getStock(stock.getStockCode())); |
| | | if (ObjectUtils.isEmpty(stockListVO)) { |
| | | stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(stock.getStockGid())); |
| | | if(StockType.HK.getCode().equals(stock.getStockType())){ |
| | | stockListVO = SinaStockApi.assembleStockListVOHk(SinaStockApi.getSinaStock(StockType.HK.getCode()+stock.getStockGid())); |
| | | }else { |
| | | stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(stock.getStockGid())); |
| | | } |
| | | } |
| | | now_price = new BigDecimal(stockListVO.getNowPrice()); |
| | | // if (stock.getDataBase()!=0){ |
| | | // String date = getCurrentTimeMiaoZero(); |
| | | // String result = HttpClientRequest.doGet(PropertiesUtil.getProperty("changePrice.url")+"?cat_time="+date+"&stock_gid="+stock.getStockGid()+"&price="+stockListVO.getNowPrice()); |
| | | // JSONObject jsonObject = JSONObject.fromObject(result); |
| | | // String nowPrice = jsonObject.getJSONObject("data").getString("new_price"); |
| | | // if (nowPrice!=null){ |
| | | // if ("us".equals(stock.getStockType())){ |
| | | // ExchangeVO exchangeVO = this.iStockFuturesService.queryExchangeVO("USD").getData(); |
| | | // now_price =new BigDecimal(nowPrice).multiply(new BigDecimal(exchangeVO.getNowPrice())); |
| | | // } else if ("hk".equals(stock.getStockType())){ |
| | | // ExchangeVO exchangeVO = this.iStockFuturesService.queryExchangeVO("HKD").getData(); |
| | | // now_price =new BigDecimal(nowPrice).multiply(new BigDecimal(exchangeVO.getNowPrice())); |
| | | // } else { |
| | | // now_price = new BigDecimal(nowPrice); |
| | | // } |
| | | // |
| | | // }else { |
| | | // stockListVO.setNowPrice(stockListVO.getNowPrice()); |
| | | // if ("us".equals(stock.getStockType())){ |
| | | // ExchangeVO exchangeVO = this.iStockFuturesService.queryExchangeVO("USD").getData(); |
| | | // now_price =new BigDecimal(nowPrice).multiply(new BigDecimal(exchangeVO.getNowPrice())); |
| | | // } else if ("hk".equals(stock.getStockType())){ |
| | | // ExchangeVO exchangeVO = this.iStockFuturesService.queryExchangeVO("HKD").getData(); |
| | | // now_price =new BigDecimal(nowPrice).multiply(new BigDecimal(exchangeVO.getNowPrice())); |
| | | // } else { |
| | | // now_price = new BigDecimal(nowPrice); |
| | | // } |
| | | // } |
| | | // } |
| | | // String stockOther = RedisShardedPoolUtils.get(stock.getStockName(), 8); |
| | | |
| | | |
| | | if (now_price.compareTo(new BigDecimal("0")) == 0) { |
| | | return ServerResponse.createByErrorMsg("报价0,请稍后再试"); |
| | |
| | | } |
| | | |
| | | |
| | | ServerResponse serverResponse = this.iStockService.selectRateByDaysAndStockCode(stock |
| | | .getStockCode(), siteSetting.getStockDays().intValue()); |
| | | ServerResponse serverResponse = null; |
| | | if(StockType.HK.getCode().equals(stock.getStockType())){ |
| | | serverResponse = this.iStockService.selectRateByDaysAndStockCode(stock |
| | | .getStockGid(), siteSetting.getStockDays().intValue()); |
| | | }else { |
| | | serverResponse = this.iStockService.selectRateByDaysAndStockCode(stock |
| | | .getStockCode(), siteSetting.getStockDays().intValue()); |
| | | } |
| | | if (!serverResponse.isSuccess()) { |
| | | return serverResponse; |
| | | } |
| | |
| | | userPosition.setBuyOrderTime(new Date()); |
| | | userPosition.setBuyOrderPrice(now_price); |
| | | userPosition.setOrderDirection((buyType.intValue() == 0) ? "买涨" : "买跌"); |
| | | |
| | | userPosition.setStockType(stock.getStockType()); |
| | | userPosition.setOrderNum(buyNum); |
| | | |
| | | |
| | |
| | | //股票賣出的 價格 數據源 |
| | | stockListVO = SinaStockApi.assembleLideStockListVO(LiDeDataUtils.getStock(userPosition.getStockCode())); |
| | | if (ObjectUtils.isEmpty(stockListVO)) { |
| | | stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(userPosition.getStockGid())); |
| | | if(StockType.HK.getCode().equals(userPosition.getStockType())){ |
| | | stockListVO = SinaStockApi.assembleStockListVOHk(SinaStockApi.getSinaStock(StockType.HK.getCode()+userPosition.getStockGid())); |
| | | }else { |
| | | stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(userPosition.getStockGid())); |
| | | } |
| | | // stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(userPosition.getStockGid())); |
| | | } |
| | | //stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(userPosition.getStockGid())); |
| | | // if (stock.getDataBase() != 0) { |
| | | // String date = getCurrentTimeMiaoZero(); |
| | | // String result = HttpClientRequest.doGet(PropertiesUtil.getProperty("changePrice.url")+"?cat_time="+date+"&stock_gid="+stock.getStockGid()+"&price="+stockListVO.getNowPrice()); |
| | | // JSONObject jsonObject = JSONObject.fromObject(result); |
| | | // String nowPrice1 = jsonObject.getJSONObject("data").getString("new_price"); |
| | | // if (nowPrice1!=null){ |
| | | // if ("us".equals(stock.getStockType())){ |
| | | // ExchangeVO exchangeVO = this.iStockFuturesService.queryExchangeVO("USD").getData(); |
| | | // now_price = new BigDecimal(nowPrice1).multiply(new BigDecimal(exchangeVO.getNowPrice())); |
| | | // } else if ("hk".equals(stock.getStockType())){ |
| | | // ExchangeVO exchangeVO = this.iStockFuturesService.queryExchangeVO("HKD").getData(); |
| | | // now_price = new BigDecimal(nowPrice1).multiply(new BigDecimal(exchangeVO.getNowPrice())); |
| | | // } else { |
| | | // now_price = new BigDecimal(nowPrice1); |
| | | // } |
| | | // |
| | | // }else { |
| | | // stockListVO.setNowPrice(stockListVO.getNowPrice()); |
| | | // if ("us".equals(stock.getStockType())){ |
| | | // ExchangeVO exchangeVO = this.iStockFuturesService.queryExchangeVO("USD").getData(); |
| | | // now_price = new BigDecimal(stockListVO.getNowPrice()).multiply(new BigDecimal(exchangeVO.getNowPrice())); |
| | | // } else if ("hk".equals(stock.getStockType())){ |
| | | // ExchangeVO exchangeVO = this.iStockFuturesService.queryExchangeVO("HKD").getData(); |
| | | // now_price = new BigDecimal(stockListVO.getNowPrice()).multiply(new BigDecimal(exchangeVO.getNowPrice())); |
| | | // } else { |
| | | // now_price = new BigDecimal(stockListVO.getNowPrice()); |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | if (stockListVO.getNowPrice() == null) { |
| | | return ServerResponse.createByErrorMsg("平仓失败,获取股票信息失败"); |
| | |
| | | |
| | | StockListVO stockListVO = SinaStockApi.assembleLideStockListVO(LiDeDataUtils.getStock(position.getStockCode())); |
| | | if (ObjectUtils.isEmpty(stockListVO)) { |
| | | stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(position.getStockGid())); |
| | | if(StockType.HK.getCode().equals(position.getStockType())){ |
| | | stockListVO = SinaStockApi.assembleStockListVOHk(SinaStockApi.getSinaStock(position.getStockType()+position.getStockGid())); |
| | | }else { |
| | | stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(position.getStockGid())); |
| | | } |
| | | } |
| | | |
| | | if (stockListVO.getNowPrice() == null || new BigDecimal(stockListVO.getNowPrice()).compareTo(BigDecimal.ZERO) <= 0) { |
| | | // stockListVO.setNowPrice("0"); |
| | | stockListVO.setNowPrice(String.valueOf(position.getBuyOrderIdIndex())); |
| | | } |
| | | |
| | |
| | | BigDecimal subPrice = nowPrice.subtract(buyPrice); |
| | | |
| | | BigDecimal profit_and_lose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue())); |
| | | //BigDecimal profit_and_lose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue())).divide(new BigDecimal(position.getOrderLever())).setScale(2,4); |
| | | if ("买跌".equals(position.getOrderDirection())) { |
| | | profit_and_lose = profit_and_lose.negate(); |
| | | } |
| | |
| | | |
| | | |
| | | BigDecimal position_freez = position.getOrderTotalPrice().divide(new BigDecimal(position.getOrderLever().intValue()), 2, 4); |
| | | //BigDecimal position_freez = position.getOrderTotalPrice(); |
| | | allFreezAmt = allFreezAmt.add(position_freez).add(position.getMarginAdd()); |
| | | continue; |
| | | } |
| | |
| | | allProfitAndLose = profitAndLose.subtract(position.getOrderFee()).subtract(position.getOrderSpread()).subtract(position.getOrderStayFee()).subtract(position.getSpreadRatePrice()); |
| | | } else { |
| | | StockListVO stockListVO = new StockListVO(); |
| | | StockCoin stockCoin = new StockCoin(); |
| | | stockListVO = SinaStockApi.assembleLideStockListVO(LiDeDataUtils.getStock(position.getStockCode())); |
| | | if (ObjectUtils.isEmpty(stockListVO)) { |
| | | stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(position.getStockGid())); |
| | | if(StockType.HK.getCode().equals(position.getStockType())){ |
| | | stockListVO = SinaStockApi.assembleStockListVOHk(SinaStockApi.getSinaStock(StockType.HK.getCode()+position.getStockGid())); |
| | | }else { |
| | | stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(position.getStockGid())); |
| | | } |
| | | } |
| | | // stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(position.getStockGid())); |
| | | nowPrice = stockListVO.getNowPrice(); |
| | | if (nowPrice == null || new BigDecimal(stockListVO.getNowPrice()).compareTo(BigDecimal.ZERO) <= 0) { |
| | | if(null != position.getBuyOrderIdIndex() && position.getBuyOrderIdIndex().compareTo(BigDecimal.ZERO) > 0){ |
| | |
| | | import com.google.common.collect.Lists; |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.config.StockPoll; |
| | | import com.nq.config.StockType; |
| | | import com.nq.dao.*; |
| | | import com.nq.pojo.*; |
| | | import com.nq.service.*; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | @Service("iUserService") |
| | | public class UserServiceImpl implements IUserService { |
| | |
| | | } |
| | | } |
| | | |
| | | public ServerResponse addOption(String code, HttpServletRequest request) { |
| | | public ServerResponse addOption(String stockType, String code, HttpServletRequest request) { |
| | | User user = getCurrentUser(request); |
| | | if (user == null) { |
| | | return ServerResponse.createBySuccessMsg("請先登錄"); |
| | | } |
| | | |
| | | String stockcode = code; |
| | | if(code.contains("hf")){ |
| | | stockcode = code.split("_")[1]; |
| | | } |
| | | stockcode = stockcode.replace("sh","").replace("sz","").replace("bj",""); |
| | | StockOption dboption = this.stockOptionMapper.findMyOptionIsExistByCode(user.getId(), stockcode); |
| | | |
| | |
| | | // stock.setIsLock(0); |
| | | // } |
| | | } else { |
| | | stock = this.stockMapper.findStockByCode(code); |
| | | if(StockType.HK.getCode().equals(stockType)) { |
| | | stock = stockMapper.findStockByCodeAndType(stockType,code); |
| | | }else { |
| | | stock = this.stockMapper.findStockByCode(code); |
| | | } |
| | | } |
| | | if (stock == null) { |
| | | return ServerResponse.createByErrorMsg("添加失败,股票不存在"); |
| | |
| | | stockOption.setUserId(user.getId()); |
| | | stockOption.setStockId(stock.getId()); |
| | | stockOption.setAddTime(new Date()); |
| | | stockOption.setStockCode(stock.getStockCode()); |
| | | |
| | | if(StockType.HK.getCode().equals(stockType)) { |
| | | stockOption.setStockCode(stock.getStockGid()); |
| | | stockOption.setStockType(StockType.HK.getCode()); |
| | | }else { |
| | | stockOption.setStockCode(stock.getStockCode()); |
| | | stockOption.setStockType(StockType.A.getCode()); |
| | | } |
| | | stockOption.setStockName(stock.getStockName()); |
| | | stockOption.setStockGid(stock.getStockGid()); |
| | | stockOption.setIsLock(stock.getIsLock()); |
| | |
| | | } |
| | | } |
| | | userInfoVO.setHistoryProfitLoss(historyProfitLoss); |
| | | |
| | | // IndexPositionVO indexPositionVO = this.iUserIndexPositionService.findUserIndexPositionAllProfitAndLose(user.getId()); |
| | | // BigDecimal allIndexProfitAndLose = indexPositionVO.getAllIndexProfitAndLose(); |
| | | // userInfoVO.setAllIndexProfitAndLose(allIndexProfitAndLose); |
| | | // userInfoVO.setAllIndexFreezAmt(indexPositionVO.getAllIndexFreezAmt()); |
| | | // |
| | | // BigDecimal userAllIndexAmt = user.getUserIndexAmt(); |
| | | // userAllIndexAmt = userAllIndexAmt.add(allIndexProfitAndLose); |
| | | // userInfoVO.setUserIndexAmt(userAllIndexAmt); |
| | | // |
| | | // userInfoVO.setEnableFuturesAmt(user.getEnableFutAmt()); |
| | | // |
| | | // |
| | | // FuturesPositionVO futuresPositionVO = this.iUserFuturesPositionService.findUserFuturesPositionAllProfitAndLose(user.getId()); |
| | | // |
| | | // userInfoVO.setAllFuturesFreezAmt(futuresPositionVO.getAllFuturesDepositAmt()); |
| | | // |
| | | // |
| | | // BigDecimal allFuturesProfitAndLose = futuresPositionVO.getAllFuturesProfitAndLose(); |
| | | // userInfoVO.setAllFuturesProfitAndLose(allFuturesProfitAndLose); |
| | | |
| | | |
| | | // BigDecimal userAllFuturesAmt = user.getUserFutAmt(); |
| | | // userAllFuturesAmt = userAllFuturesAmt.add(allFuturesProfitAndLose); |
| | | // userInfoVO.setUserFuturesAmt(userAllFuturesAmt); |
| | | userInfoVO.setDjzj(user.getDjzj()); |
| | | return userInfoVO; |
| | | } |
| | |
| | | StockCoin stockCoin = new StockCoin(); |
| | | stockListVO = SinaStockApi.assembleLideStockListVO(LiDeDataUtils.getStock(position.getStockCode())); |
| | | if (org.springframework.util.ObjectUtils.isEmpty(stockListVO)) { |
| | | stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(position.getStockGid())); |
| | | if(StockType.HK.getCode().equals(position.getStockType())){ |
| | | stockListVO = SinaStockApi.assembleStockListVOHk(SinaStockApi.getSinaStock(position.getStockType()+position.getStockGid())); |
| | | }else { |
| | | stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(position.getStockGid())); |
| | | } |
| | | |
| | | } |
| | | // stockListVO = SinaStockApi.assembleStockListVO(SinaStockApi.getSinaStock(position.getStockGid())); |
| | | nowPrice = stockListVO.getNowPrice(); |
| | | if (nowPrice == null) { |
| | | nowPrice = String.valueOf(0); |
| | | } |
| | | |
| | | BigDecimal subPrice = (new BigDecimal(nowPrice)).subtract(position.getBuyOrderPrice()); |
| | | // profitAndLose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue())).multiply(new BigDecimal(position.getOrderLever())).setScale(2,4); |
| | | profitAndLose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue())).setScale(2,4); |
| | | if ("买跌".equals(position.getOrderDirection())) { |
| | | profitAndLose = profitAndLose.negate(); |
| | |
| | | // System.out.println(sina_url + stockGid); |
| | | // sina_result = HttpClientRequest.doGet(sina_url + stockGid); |
| | | // System.out.println("请求返回:"+sina_result); |
| | | System.out.println("http://111.170.140.248:7001/crypto/getSinaStock?stockGid=" + stockGid); |
| | | sina_result = HttpClientRequest.doGet("http://111.170.140.248:7001/crypto/getSinaStock?stockGid=" + stockGid); |
| | | |
| | | System.out.println(PropertiesUtil.getProperty("sina.data.proxy.list.url") + stockGid); |
| | | sina_result = HttpClientRequest.doGet(PropertiesUtil.getProperty("sina.data.proxy.list.url") + stockGid); |
| | | System.out.println("请求返回:"+sina_result); |
| | | // sina_result = "var hq_str_sz300270=\"中威电子,0.000,11.710,0.000,0.000,0.000,0.000,0.000,0,0.000,0,0.000,0,0.000,0,0.000,0,0.000,0,0.000,0,0.000,0,0.000,0,0.000,0,0.000,0,0.000,2025-12-03,09:10:06,00\";"; |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | return sina_result.substring(sina_result.indexOf("=") + 2); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | stockListVO.setPreclose_px(hqarr[2]); |
| | | |
| | | stockListVO.setOpen_px(hqarr[1]); |
| | | } |
| | | |
| | | return stockListVO; |
| | | } |
| | | public static StockListVO assembleStockListVOHk(String sinaResult) { |
| | | StockListVO stockListVO = new StockListVO(); |
| | | |
| | | String[] hqarr = sinaResult.split(","); |
| | | |
| | | if (hqarr.length > 1) { |
| | | |
| | | stockListVO.setName(hqarr[1]); |
| | | |
| | | stockListVO.setNowPrice(hqarr[6]); |
| | | |
| | | stockListVO.setHcrate(new BigDecimal(hqarr[8])); |
| | | |
| | | stockListVO.setToday_max(hqarr[4]); |
| | | |
| | | stockListVO.setToday_min(hqarr[5]); |
| | | |
| | | stockListVO.setBusiness_amount(hqarr[11]); |
| | | |
| | | stockListVO.setBusiness_balance(hqarr[12]); |
| | | |
| | | stockListVO.setPreclose_px(hqarr[3]); |
| | | |
| | | stockListVO.setOpen_px(hqarr[2]); |
| | | } |
| | | |
| | | return stockListVO; |
| | |
| | | } |
| | | //hk 数据转换 |
| | | public static StockVO otherStockVO(String Result) { |
| | | StockVO stockVO = new StockVO(); |
| | | //判断是否是 |
| | | JSONObject jsonObject = JSONObject.parseObject(Result); |
| | | stockVO.setName(jsonObject.getString("f14")); |
| | | String[] fields = Result.split(","); |
| | | StockVO stock = new StockVO(); |
| | | stock.setName(fields[1]); // 中文名称 |
| | | stock.setCode(""); // 需要从其他地方获取 |
| | | stock.setSpell(fields[0]); // 英文名称 |
| | | stock.setGid(""); // 需要从其他地方获取 |
| | | stock.setNowPrice(fields[6]); // 当前价 |
| | | stock.setHcrate(new BigDecimal(fields[8])); // 涨跌幅 |
| | | stock.setToday_max(fields[4]); // 最高价 |
| | | stock.setToday_min(fields[5]); // 最低价 |
| | | stock.setBusiness_balance(fields[11]); // 成交量 |
| | | stock.setBusiness_amount(fields[12]); // 成交额 |
| | | stock.setPreclose_px(fields[3]); // 昨收价 |
| | | stock.setOpen_px(fields[2]); // 开盘价 |
| | | stock.setType("hk"); // 港股标识 |
| | | |
| | | stockVO.setNowPrice(!Objects.equals(jsonObject.getString("f2"), "-") ? jsonObject.getString("f2") : "0"); |
| | | // 买卖盘数据(港股只有1档买卖盘数据) |
| | | stock.setBuy1(fields[9]); // 买一价 |
| | | stock.setSell1(fields[10]); // 卖一价 |
| | | // 其他买卖盘数据在港股中不可用,保持默认值 |
| | | |
| | | stockVO.setHcrate(new BigDecimal(!Objects.equals(jsonObject.getString("f3"), "-") ? jsonObject.getString("f3"): "0")); |
| | | |
| | | stockVO.setToday_max(!Objects.equals(jsonObject.getString("f15"), "-") ? jsonObject.getString("f15") : "0"); |
| | | |
| | | stockVO.setToday_min(!Objects.equals(jsonObject.getString("f16"), "-") ? jsonObject.getString("f16") : "0"); |
| | | |
| | | stockVO.setBusiness_amount(!Objects.equals(jsonObject.getString("f6"), "-") ? jsonObject.getString("f6") : "0"); |
| | | |
| | | stockVO.setBusiness_balance(!Objects.equals(jsonObject.getString("f5"), "-") ? jsonObject.getString("f5") : "0"); |
| | | |
| | | stockVO.setPreclose_px(!Objects.equals(jsonObject.getString("f18"), "-") ? jsonObject.getString("f18") : "0"); |
| | | |
| | | stockVO.setOpen_px(!Objects.equals(jsonObject.getString("f17"), "-") ? jsonObject.getString("f17") : "0"); |
| | | stockVO.setType(jsonObject.getString("f13")); |
| | | String buy = "0"; |
| | | stockVO.setBuy1(buy); |
| | | stockVO.setBuy2(buy); |
| | | stockVO.setBuy3(buy); |
| | | stockVO.setBuy4(buy); |
| | | stockVO.setBuy5(buy); |
| | | |
| | | stockVO.setSell1(buy); |
| | | stockVO.setSell2(buy); |
| | | stockVO.setSell3(buy); |
| | | stockVO.setSell4(buy); |
| | | stockVO.setSell5(buy); |
| | | |
| | | stockVO.setBuy1_num(buy); |
| | | stockVO.setBuy2_num(buy); |
| | | stockVO.setBuy3_num(buy); |
| | | stockVO.setBuy4_num(buy); |
| | | stockVO.setBuy5_num(buy); |
| | | |
| | | stockVO.setSell1_num(buy); |
| | | stockVO.setSell2_num(buy); |
| | | stockVO.setSell3_num(buy); |
| | | stockVO.setSell4_num(buy); |
| | | stockVO.setSell5_num(buy); |
| | | |
| | | return stockVO; |
| | | return stock; |
| | | } |
| | | //us 数据转换 |
| | | public static StockUsVO otherUsStockVO(String Result) { |
| | |
| | | #sina.market.url=https://hq.sinajs.cn/rn=1520407404627&list=s_sh000001,s_sz399001,s_sz399006,s_sz399300,s_sz399005,s_sz399673 |
| | | sina.market.url=https://hq.sinajs.cn/rn=1520407404627&list=s_sh000001,s_sz399001,s_sz399006,s_sz399300,s_sz399005,s_sz399673,s_sz399106,s_sz399004,s_sz399100 |
| | | sina.single.market.url=https://hq.sinajs.cn/rn=1520407404627&list=s_ |
| | | sina.single.market.hkurl=https://hq.sinajs.cn/rn=1520407404627&list=rt_ |
| | | |
| | | sina.index.market.url=https://ws.api.cnyes.com/ws/api/v4/universal/quote?type=LITQ&column=L |
| | | |
| | |
| | | dfcf.new.stock.url=https://datacenter-web.eastmoney.com/api/data/v1/get?sortColumns=APPLY_DATE,SECURITY_CODE&sortTypes=-1,-1&pageSize=35&pageNumber=1&reportName=RPTA_APP_IPOAPPLY&columns=SECURITY_CODE,SECURITY_NAME,TRADE_MARKET_CODE,APPLY_CODE,TRADE_MARKET,MARKET_TYPE,ORG_TYPE,ISSUE_NUM,ONLINE_ISSUE_NUM,OFFLINE_PLACING_NUM,TOP_APPLY_MARKETCAP,PREDICT_ONFUND_UPPER,ONLINE_APPLY_UPPER,PREDICT_ONAPPLY_UPPER,ISSUE_PRICE,LATELY_PRICE,CLOSE_PRICE,APPLY_DATE,BALLOT_NUM_DATE,BALLOT_PAY_DATE,LISTING_DATE,AFTER_ISSUE_PE"eColumns=f2~01~SECURITY_CODE~NEWEST_PRICE"eType=0&filter=(APPLY_DATE%3E%272022-06-20%27)&source=WEB&client=WEB |
| | | #æ°æµªè´¢ç»æ¶¨è·å¹
æ¥è¯¢æ¥å£ |
| | | sina.market.zdf.url=https://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData? |
| | | sina.market.zdf.urlhk=https://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHKStockData? |
| | | |
| | | |
| | | #???? |
| | |
| | | sina.TwMarket.list.url=http://b.workingman.icu/stock/api/stock/getStockType?exchange=TAI |
| | | sina.StockType.list.url=http://b.workingman.icu/stock/api/stock/getStockType?exchange= |
| | | sina.StockCategory.list.url=http://b.workingman.icu/stock/api/stock/getWapStocks |
| | | sina.data.proxy.list.url=http://localhost:7001/crypto/getSinaStock?stockGid= |
| | | |
| | | http.proxyHost = |
| | | http.proxyPort = |
| | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8090 |
| | | port: 8091 |
| | | port: 8092 |
| | | tomcat: |
| | | # tomcat的URI编码 |
| | | uri-encoding: UTF-8 |
| | |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://127.0.0.1:3306/mix?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: mix |
| | | password: PsRwRm5nGbtS22Xp |
| | | # url: jdbc:mysql://127.0.0.1:3306/stock_hongta?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | # url: jdbc:mysql://127.0.0.1:3306/stock_hongta_1226?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | # username: root |
| | | # password: 123456 |
| | | # password: PsRwRm5nGbtS22Xp |
| | | url: jdbc:mysql://127.0.0.1:3306/stock_hongta_1226?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | druid: |
| | | # 初始连接数 |
| | | initialSize: 5 |
| | |
| | | order by id asc |
| | | </select> |
| | | |
| | | <select id="queryListIndexType" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM stock_index |
| | | WHERE list_show = 1 AND stock_type=#{stockType} |
| | | order by id asc |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |
| | |
| | | from stock |
| | | WHERE stock_code = #{code} |
| | | </select> |
| | | <select id="findStockByCodeAndType" resultMap="BaseResultMap" parameterType="string"> |
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | | from stock |
| | | WHERE stock_gid = #{code} AND stock_type=#{stockType} |
| | | </select> |
| | | <select id="findStockByName" resultMap="BaseResultMap" parameterType="string"> |
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | |
| | | </constructor> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | id, user_id, stock_id, add_time, stock_code, stock_name, stock_gid, is_lock |
| | | id, user_id, stock_id, add_time, stock_code, stock_name, stock_gid, is_lock,stock_type |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > |
| | | select |
| | |
| | | <insert id="insert" parameterType="com.nq.pojo.StockOption" > |
| | | insert into stock_option (id, user_id, stock_id, |
| | | add_time, stock_code, stock_name, |
| | | stock_gid, is_lock) |
| | | stock_gid, is_lock,stock_type) |
| | | values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{stockId,jdbcType=INTEGER}, |
| | | #{addTime,jdbcType=TIMESTAMP}, #{stockCode,jdbcType=VARCHAR}, #{stockName,jdbcType=VARCHAR}, |
| | | #{stockGid,jdbcType=VARCHAR}, #{isLock,jdbcType=INTEGER}) |
| | | #{stockGid,jdbcType=VARCHAR}, #{isLock,jdbcType=INTEGER},#{stockType,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.nq.pojo.StockOption" > |
| | | insert into stock_option |
| | |
| | | stock_code = #{stockCode,jdbcType=VARCHAR}, |
| | | stock_name = #{stockName,jdbcType=VARCHAR}, |
| | | stock_gid = #{stockGid,jdbcType=VARCHAR}, |
| | | is_lock = #{isLock,jdbcType=INTEGER} |
| | | is_lock = #{isLock,jdbcType=INTEGER}, |
| | | stock_type = #{stockType,jdbcType=INTEGER} |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | | |
| | |
| | | stock_gid, stock_spell, buy_order_id, buy_order_time, buy_order_price, sell_order_id, |
| | | sell_order_time, sell_order_price, profit_target_price, stop_target_price, order_direction, |
| | | order_num, order_lever, order_total_price, order_fee, order_spread, order_stay_fee, |
| | | order_stay_days, profit_and_lose, all_profit_and_lose,is_lock,lock_msg,stock_plate,spread_rate_price,margin_add,buy_order_id_index |
| | | order_stay_days, profit_and_lose, all_profit_and_lose,is_lock,lock_msg,stock_plate,spread_rate_price,margin_add,buy_order_id_index,stock_type |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > |
| | | select |
| | |
| | | order_direction, order_num, order_lever, |
| | | order_total_price, order_fee, order_spread, |
| | | order_stay_fee, order_stay_days, profit_and_lose, |
| | | all_profit_and_lose, is_lock, lock_msg,stock_plate,spread_rate_price) |
| | | all_profit_and_lose, is_lock, lock_msg,stock_plate,spread_rate_price,stock_type) |
| | | values (#{id,jdbcType=INTEGER}, #{positionType,jdbcType=INTEGER}, #{positionSn,jdbcType=VARCHAR}, |
| | | #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR}, #{agentId,jdbcType=INTEGER}, |
| | | #{stockName,jdbcType=VARCHAR}, #{stockCode,jdbcType=VARCHAR}, #{stockGid,jdbcType=VARCHAR}, |
| | |
| | | #{orderTotalPrice,jdbcType=DECIMAL}, #{orderFee,jdbcType=DECIMAL}, #{orderSpread,jdbcType=DECIMAL}, |
| | | #{orderStayFee,jdbcType=DECIMAL}, #{orderStayDays,jdbcType=INTEGER}, #{profitAndLose,jdbcType=DECIMAL}, |
| | | #{allProfitAndLose,jdbcType=DECIMAL}, #{isLock,jdbcType=INTEGER}, #{lockMsg,jdbcType=VARCHAR}, |
| | | #{stockPlate,jdbcType=VARCHAR},#{spreadRatePrice,jdbcType=DECIMAL} |
| | | #{stockPlate,jdbcType=VARCHAR},#{spreadRatePrice,jdbcType=DECIMAL},#{stockType,jdbcType=VARCHAR} |
| | | ) |
| | | </insert> |
| | | |