| | |
| | | |
| | | private String returnOfRate; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Kolkata") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Tokyo") |
| | | private Date buyTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Kolkata") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Tokyo") |
| | | private Date endTime; |
| | | |
| | | |
| | |
| | | private String withdrawalPwd; |
| | | private String vaildNumber; |
| | | private String lever; |
| | | private String fundRatio; |
| | | // private String fundRatio; |
| | | |
| | | } |
| | |
| | | private String orderDesc; |
| | | |
| | | @Excel(name = "申请时间", databaseFormat = "yyyyMMddHHmmss", format = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "Asia/Kolkata") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "Asia/Tokyo") |
| | | private Date addTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "Asia/Kolkata") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "Asia/Tokyo") |
| | | @Excel(name = "支付时间", databaseFormat = "yyyyMMddHHmmss", format = "yyyy-MM-dd HH:mm:ss") |
| | | private Date payTime; |
| | | /*支付通道主键id*/ |
| | |
| | | private Integer agentId; |
| | | @Excel(name = "出金金额") |
| | | private BigDecimal withAmt; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Kolkata") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Tokyo") |
| | | @Excel(name = "申请时间", databaseFormat = "yyyyMMddHHmmss", format = "yyyy-MM-dd HH:mm:ss") |
| | | private Date applyTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Kolkata") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Tokyo") |
| | | @Excel(name = "出金时间", databaseFormat = "yyyyMMddHHmmss", format = "yyyy-MM-dd HH:mm:ss") |
| | | private Date transTime; |
| | | |
| | |
| | | siteNews.setSourceId(newsId); |
| | | siteNews.setSourceName(""); |
| | | siteNews.setTitle(jsonObject.getString("title")); |
| | | Long showTime = jsonObject.getLong("time"); |
| | | siteNews.setShowTime(new Date(showTime * 1000)); |
| | | if (jsonObject.has("time") && jsonObject.optLong("time") != 0) { |
| | | Long showTime = jsonObject.getLong("time"); |
| | | siteNews.setShowTime(new Date(showTime * 1000)); |
| | | } |
| | | |
| | | if(jsonObject.has("img")){ |
| | | convertBase64ToImage(jsonObject.getString("img"),PropertiesUtil.getProperty("ftp.address")+newsId+".jpg"); |
| | | siteNews.setImgurl(PropertiesUtil.getProperty("ftp.server.http.prefix")+newsId+".jpg"); |
| | |
| | | import com.nq.pojo.*; |
| | | import com.nq.pojo.reponse.RPageInfo; |
| | | import com.nq.service.*; |
| | | import com.nq.utils.ConverterUtil; |
| | | import com.nq.utils.http.HttpClientRequest; |
| | | import com.nq.utils.PropertiesUtil; |
| | | import com.nq.utils.redis.RedisKeyUtil; |
| | |
| | | stockListVOS.addAll(Objects.requireNonNull(StockApi.getStockReailTimes(stockList))); |
| | | } |
| | | |
| | | // Create a list to hold Futures |
| | | List<CompletableFuture<Void>> futures = new ArrayList<>(); |
| | | |
| | | // Use CompletableFuture to perform asynchronous processing for each stockListVO |
| | | for (StockListVO stockListVO : stockListVOS) { |
| | | CompletableFuture<Void> future = CompletableFuture.runAsync(() -> { |
| | | stockListVO.setNowPrice(iPriceServices.getNowPrice(stockListVO.getCode(), stockType).toString()); |
| | | Map<String, Object> newStock = iPriceServices.getNewStock(stockListVO.getCode()); |
| | | stockListVO.setHcrateP(newStock.get("pcp").toString()); |
| | | }); |
| | | futures.add(future); |
| | | Stock stock = new Stock(); |
| | | stock.setStockType(stockListVO.getStock_type()); |
| | | stock.setStockCode(stockListVO.getCode()); |
| | | StockRealTimeBean cacheRealTimeStock = RedisKeyUtil.getCacheRealTimeStock(stock); |
| | | stockListVO.setNowPrice(cacheRealTimeStock.getLast()); |
| | | stockListVO.setHcrateP(cacheRealTimeStock.getPcp()); |
| | | } |
| | | |
| | | // Wait for all futures to complete |
| | | CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); |
| | | |
| | | RPageInfo pageInfo = new RPageInfo(); |
| | | pageInfo.setList(stockListVOS); |
| | |
| | | package com.nq.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.dao.StockMapper; |
| | |
| | | |
| | | @Override |
| | | public ServerResponse updateStockSetting(StockSetting stockSetting) { |
| | | Stock stock = stockMapper.findStockByCode(stockSetting.getStockCode()); |
| | | if(stock == null){ |
| | | return ServerResponse.createByErrorMsg("股票不存在"); |
| | | } |
| | | Long count = stockSettingMapper.selectCount(new LambdaQueryWrapper<>(StockSetting.class) |
| | | .eq(StockSetting::getStockCode, stockSetting.getStockCode()).ne(StockSetting::getId,stockSetting.getId())); |
| | | if(count > 0){ |
| | | return ServerResponse.createByErrorMsg("盘前股票已存在!"); |
| | | } |
| | | int ref = stockSettingMapper.updateById(stockSetting); |
| | | if(ref == 0){ |
| | | return ServerResponse.createByErrorMsg("修改失败"); |
| | |
| | | |
| | | @Override |
| | | public ServerResponse saveStockSetting(StockSetting stockSetting) { |
| | | |
| | | |
| | | Stock stock = stockMapper.findStockByCode(stockSetting.getStockCode()); |
| | | if(stock == null){ |
| | | return ServerResponse.createByErrorMsg("添加股票不存在"); |
| | | } |
| | | Long count = stockSettingMapper.selectCount(new LambdaQueryWrapper<>(StockSetting.class) |
| | | .eq(StockSetting::getStockCode, stockSetting.getStockCode())); |
| | | if(count > 0){ |
| | | return ServerResponse.createByErrorMsg("盘前股票已存在!"); |
| | | } |
| | | int ref = stockSettingMapper.insert(stockSetting); |
| | | if(ref == 0){ |
| | | return ServerResponse.createByErrorMsg("修改失败"); |
| | |
| | | } |
| | | UserPendingorder userPendingorder = userPendingorderMapper.selectOne(new QueryWrapper<UserPendingorder>().eq("user_id", user.getId()).eq("stock_id", stockId).eq("status", 0)); |
| | | if (userPendingorder != null) { |
| | | return ServerResponse.createByErrorMsg("Please do not repeat the order",request); |
| | | String lang = request.getHeader("lang"); |
| | | if(lang.equals("ja")){ |
| | | String msg = "繰り返しの送信はご遠慮ください"; |
| | | return ServerResponse.createByErrorMsg(msg); |
| | | }else{ |
| | | return ServerResponse.createByErrorMsg("Please do not repeat the order",request); |
| | | } |
| | | } |
| | | |
| | | userPendingorder = new UserPendingorder(); |
| | |
| | | userPendingorder.setStatus(0); |
| | | int ret = userPendingorderMapper.insert(userPendingorder); |
| | | if (ret > 0) { |
| | | return ServerResponse.createBySuccessMsg("If the pending order is successfully added, the order will be automatically placed if the order conditions are met",request); |
| | | String lang = request.getHeader("lang"); |
| | | if(lang.equals("ja")){ |
| | | String msg = "注文が成功しました。取引時間内に自動的に約定されます。"; |
| | | return ServerResponse.createBySuccessMsg(msg); |
| | | }else{ |
| | | return ServerResponse.createBySuccessMsg("If the pending order is successfully added, the order will be automatically placed if the order conditions are met",request); |
| | | } |
| | | } |
| | | return ServerResponse.createByErrorMsg("Add failure",request); |
| | | |
| | |
| | | //判断股票是否在可交易时间段 |
| | | Boolean b = tradingHourService.timeCheck(stock.getStockCode()); |
| | | if (!b) { |
| | | return ServerResponse.createByErrorMsg("订单失败,不在交易时间之内", request); |
| | | String lang = request.getHeader("lang"); |
| | | if(lang.equals("ja")){ |
| | | String msg = "注文失敗、取引時間外です。"; |
| | | return ServerResponse.createByErrorMsg(msg); |
| | | }else{ |
| | | return ServerResponse.createByErrorMsg("订单失败,不在交易时间之内", request); |
| | | } |
| | | } |
| | | |
| | | |
| | | StockConfig mainBuyConfig = iStockConfigServices.queryByKey(EConfigKey.MIN_BUY.getCode()); |
| | | |
| | |
| | | BigDecimal buyAmt = nowPrice.multiply(new BigDecimal(buyNum)).divide(new BigDecimal(lever)); |
| | | BigDecimal orderFree = siteSettingBuyFee.multiply(buyAmt); |
| | | |
| | | BigDecimal fundratio = new BigDecimal(user.getFundRatio()).divide(new BigDecimal(100)); |
| | | BigDecimal availableBalance = fundratio.multiply(userAssets.getAvailableBalance()); |
| | | if (availableBalance.compareTo(buyAmt.add(orderFree)) < 0) { |
| | | return ServerResponse.createByErrorMsg("订单失败,配资不足", request); |
| | | } |
| | | // BigDecimal fundratio = new BigDecimal(user.getFundRatio()).divide(new BigDecimal(100)); |
| | | // BigDecimal availableBalance = fundratio.multiply(userAssets.getAvailableBalance()); |
| | | // if (availableBalance.compareTo(buyAmt.add(orderFree)) < 0) { |
| | | // return ServerResponse.createByErrorMsg("订单失败,配资不足", request); |
| | | // } |
| | | UserPosition userPosition = new UserPosition(); |
| | | if (profitTarget != null && profitTarget.compareTo(new BigDecimal("0")) > 0) { |
| | | userPosition.setProfitTargetPrice(profitTarget); |
| | |
| | | return ServerResponse.createByErrorMsg("最小购买数据" + stockDz.getStockNum(), request); |
| | | } |
| | | BigDecimal buyAmt = nowPrice.multiply(new BigDecimal(num.intValue())); |
| | | BigDecimal fundratio = new BigDecimal(user.getFundRatio()).divide(new BigDecimal(100)); |
| | | BigDecimal availableBalance = fundratio.multiply(userAssets.getAvailableBalance()); |
| | | if (buyAmt.compareTo(availableBalance) > 0) { |
| | | return ServerResponse.createByErrorMsg("订单失败,配资不足", request); |
| | | } |
| | | // BigDecimal fundratio = new BigDecimal(user.getFundRatio()).divide(new BigDecimal(100)); |
| | | // BigDecimal availableBalance = fundratio.multiply(userAssets.getAvailableBalance()); |
| | | // if (buyAmt.compareTo(availableBalance) > 0) { |
| | | // return ServerResponse.createByErrorMsg("订单失败,配资不足", request); |
| | | // } |
| | | |
| | | // 创建UserPosition对象 |
| | | UserPosition userPosition = new UserPosition(); |
| | |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | spring: |
| | | jackson: |
| | | time-zone: Asia/Kolkata |
| | | time-zone: Asia/Tokyo |
| | | profiles: |
| | | active: druid |
| | | flyway: |
| | |
| | | <result column="withdrawal_Pwd" property="withdrawalPwd"/> |
| | | <result column="vaild_number" property="vaildNumber"/> |
| | | <result column="lever" property="lever"/> |
| | | <result column="fund_ratio" property="fundRatio"/> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | id, agent_id, agent_name, phone, user_pwd, with_pwd, nick_name, real_name, id_card, |
| | | account_type, is_lock, is_login, |
| | | reg_time, reg_ip, reg_address, img1_key, img2_key, img3_key, is_active, auth_msg, |
| | | withdrawal_Pwd,vaild_number,lever,fund_ratio |
| | | withdrawal_Pwd,vaild_number,lever |
| | | </sql> |
| | | |
| | | |