| | |
| | | |
| | | |
| | | public static <T> ServerResponse<T> createBySuccessMsg(String msg,HttpServletRequest request) { |
| | | //return new ServerResponse(ResponseCode.SUCCESS.getCode(), new GoogleTranslateUtil().translate(msg,request.getHeader(LANG))); |
| | | return new ServerResponse(ResponseCode.SUCCESS.getCode(), msg); |
| | | return new ServerResponse(ResponseCode.SUCCESS.getCode(), new GoogleTranslateUtil().translate(msg,request.getHeader(LANG))); |
| | | } |
| | | |
| | | public static <T> ServerResponse<T> createBySuccess(T data) { |
| | |
| | | |
| | | |
| | | public static <T> ServerResponse<T> createBySuccess(String data,HttpServletRequest request) { |
| | | //return new ServerResponse(ResponseCode.SUCCESS.getCode(), new GoogleTranslateUtil().translate(data,request.getHeader(LANG))); |
| | | return new ServerResponse(ResponseCode.SUCCESS.getCode(), data); |
| | | return new ServerResponse(ResponseCode.SUCCESS.getCode(), new GoogleTranslateUtil().translate(data,request.getHeader(LANG))); |
| | | } |
| | | |
| | | public static <T> ServerResponse<T> createBySuccess(String msg, T data) { |
| | |
| | | return new ServerResponse(ResponseCode.ERROR.getCode(), errormsg); |
| | | } |
| | | public static <T> ServerResponse<T> createByErrorMsg(String errormsg, HttpServletRequest request) { |
| | | //return new ServerResponse(ResponseCode.ERROR.getCode(), new GoogleTranslateUtil().translate(errormsg,request.getHeader(LANG))); |
| | | return new ServerResponse(ResponseCode.ERROR.getCode(), errormsg); |
| | | return new ServerResponse(ResponseCode.ERROR.getCode(), new GoogleTranslateUtil().translate(errormsg,request.getHeader(LANG))); |
| | | //return new ServerResponse(ResponseCode.ERROR.getCode(), errormsg); |
| | | } |
| | | |
| | | |
| | |
| | | import com.google.common.collect.Maps; |
| | | import com.google.gson.Gson; |
| | | import com.nq.annotation.SameUrlData; |
| | | import com.nq.common.ResponseCode; |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.pojo.User; |
| | | import com.nq.utils.PropertiesUtil; |
| | |
| | | httpServletResponse.setCharacterEncoding("UTF-8"); |
| | | httpServletResponse.setContentType("application/json;charset=UTF-8"); |
| | | PrintWriter writer = httpServletResponse.getWriter(); |
| | | //writer.print( new Gson().toJson(ServerResponse.createByErrorCodeMsg(401,googleTranslateUtil.translate("请登录",lang )))); |
| | | writer.print( new Gson().toJson(ServerResponse.createByErrorCodeMsg(401,"请登录"))); |
| | | writer.print( new Gson().toJson(ServerResponse.createByErrorCodeMsg(ResponseCode.NEED_LOGIN.getCode(), googleTranslateUtil.translate("请登录",lang )))); |
| | | writer.flush(); |
| | | writer.close(); |
| | | return false; |
| | |
| | | |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.pojo.StockAI; |
| | | import com.nq.pojo.StockAIOrder; |
| | | import com.nq.pojo.StockAIOrderPosition; |
| | | import com.nq.service.IStockAiService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取ai交易产品列表 |
| | | * 获取ai交易产品订单列表 |
| | | * @return |
| | | */ |
| | | @RequestMapping("getStockAiOrderList.do") |
| | |
| | | private String img1Key; |
| | | private String img2Key; |
| | | private String img3Key; |
| | | //1.未实名 2.已实名 3.驳回 |
| | | private Integer isActive; |
| | | private String authMsg; |
| | | private String withdrawalPwd; |
| | |
| | | if (siteInfos.size() > 0) { |
| | | SiteInfo siteInfo = (SiteInfo) siteInfos.get(0); |
| | | User user = iUserService.getCurrentRefreshUser(request); |
| | | log.info("当前以后名"); |
| | | //log.info("当前以后名"); |
| | | if(user != null ){ |
| | | AgentUser agentUser = agentUserMapper.findAgentByAgentId(user.getAgentId()); |
| | | if(agentUser != null){ |
| | |
| | | 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()); |
| | |
| | | if(null == stock){ |
| | | return ServerResponse.createByErrorMsg("股票不存在,平仓失败", request); |
| | | } |
| | | UserAssets userAssets = userAssetsMapper.selectOne(new LambdaQueryWrapper<UserAssets>() |
| | | /*UserAssets userAssets = userAssetsMapper.selectOne(new LambdaQueryWrapper<UserAssets>() |
| | | .eq(UserAssets::getUserId, userPosition.getUserId()) |
| | | .eq(UserAssets::getAccectType, stock.getStockType()) |
| | | ); |
| | | );*/ |
| | | UserAssets userAssets = userAssetsServices.assetsByTypeAndUserId(stock.getStockType(), userPosition.getUserId()); |
| | | if(userAssets.getAmountToBeCovered().compareTo(BigDecimal.ZERO) > 0){ |
| | | return ServerResponse.createByErrorMsg("请先缴清待补资金", request); |
| | | } |
| | |
| | | map.put("usPositionEarnings", String.valueOf(usPositionEarnings)); //美股持仓收益 |
| | | map.put("usPositionEarningsParent", usPositionEarningsParent + "%");//美股持仓收益率 |
| | | |
| | | map.put("mxMarketValue", String.valueOf(usPositionEarnings)); //墨西哥股市值 |
| | | map.put("mxMarketValue", String.valueOf(mxMarketValue)); //墨西哥股市值 |
| | | map.put("mxPositionEarnings", String.valueOf(mxPositionEarnings)); //墨西哥持仓收益 |
| | | map.put("mxPositionEarningsParent", mxPositionEarningsParent + "%");//墨西哥持仓收益率 |
| | | return ServerResponse.createBySuccess(map); |
| | |
| | | |
| | | |
| | | try { |
| | | if (key == null) { |
| | | if (key != null) { |
| | | jedis = RedisShardedPool.getJedis(); |
| | | |
| | | result = jedis.del(key); |
| | |
| | | */ |
| | | |
| | | public String translate(String content,String lang) { |
| | | StringBuilder result = new StringBuilder(); |
| | | return content; |
| | | /*StringBuilder result = new StringBuilder(); |
| | | if (content.length() > 1000) { |
| | | int size = content.length() /1000 ; |
| | | for (int i = 0; i < size; i++) { |
| | |
| | | } |
| | | } |
| | | |
| | | return result.toString(); |
| | | return result.toString();*/ |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |