| | |
| | | SiteSetting siteSetting = iSiteSettingService.getSiteSetting(); |
| | | StockRealTimeBean stockRealTimeBean = RedisKeyUtil.getCacheRealTimeStock(stock); |
| | | BigDecimal pcp = new BigDecimal(stockRealTimeBean.getPcp()); |
| | | SiteVipRob siteVipRob = iSiteVipRobService.getByStockCode(stock.getStockCode()); |
| | | // 检查VIP抢筹功能是否开启且用户符合条件 |
| | | if (null != siteVipRob && siteVipRob.getStatus() == 1 && pcp.compareTo(siteVipRob.getStockChg()) >= 0) { |
| | | // 检查密码是否为空 |
| | | if (StringUtils.isBlank(password)) { |
| | | return ServerResponse.createByErrorMsg("VIP抢筹秘钥错误", request); |
| | | } |
| | | // 检查交易数量是否达到最低要求 |
| | | if (buyNum < siteVipRob.getLowestTrade()) { |
| | | return ServerResponse.createByErrorMsg("VIP抢筹秘最低交易数量为" + siteVipRob.getLowestTrade(), request); |
| | | } |
| | | // 检查VIP密码是否正确 |
| | | if (!siteSetting.getVipPassword().equals(password)) { |
| | | return ServerResponse.createByErrorMsg("VIP抢筹秘钥错误", request); |
| | | } |
| | | } |
| | | // SiteVipRob siteVipRob = iSiteVipRobService.getByStockCode(stock.getStockCode()); |
| | | // // 检查VIP抢筹功能是否开启且用户符合条件 |
| | | // if (null != siteVipRob && siteVipRob.getStatus() == 1 && pcp.compareTo(siteVipRob.getStockChg()) >= 0) { |
| | | // // 检查密码是否为空 |
| | | // if (StringUtils.isBlank(password)) { |
| | | // return ServerResponse.createByErrorMsg("VIP抢筹秘钥错误", request); |
| | | // } |
| | | // // 检查交易数量是否达到最低要求 |
| | | // if (buyNum < siteVipRob.getLowestTrade()) { |
| | | // return ServerResponse.createByErrorMsg("VIP抢筹秘最低交易数量为" + siteVipRob.getLowestTrade(), request); |
| | | // } |
| | | // // 检查VIP密码是否正确 |
| | | // if (!siteSetting.getVipPassword().equals(password)) { |
| | | // return ServerResponse.createByErrorMsg("VIP抢筹秘钥错误", request); |
| | | // } |
| | | // } |
| | | BigDecimal buyAmt = nowPrice.multiply(new BigDecimal(buyNum)).divide(new BigDecimal(lever)); |
| | | BigDecimal orderFree = siteSettingBuyFee.multiply(buyAmt); |
| | | |
| | |
| | | |
| | | UserAssets userAssets = userAssetsMapper.selectOne(new LambdaQueryWrapper<UserAssets>() |
| | | .eq(UserAssets::getUserId, userPosition.getUserId()) |
| | | .eq(UserAssets::getAccectType, "IN") |
| | | .eq(UserAssets::getAccectType, "MAS") |
| | | ); |
| | | if(userAssets.getAmountToBeCovered().compareTo(BigDecimal.ZERO) > 0){ |
| | | return ServerResponse.createByErrorMsg("请先缴清待补资金", request); |
| | |
| | | userPosition.setStockCode(stock.getStockCode()); |
| | | userPosition.setStockSpell(stock.getStockSpell()); |
| | | userPosition.setStockName(userStockSubscribe.getNewName()); |
| | | StringBuffer gid = new StringBuffer(); |
| | | gid.append(stockSubscribe.getStockType()!=null?stockSubscribe.getStockType():""); |
| | | gid.append(userStockSubscribe.getNewCode()!=null?userStockSubscribe.getNewCode():"stock code invaild"); |
| | | userPosition.setStockGid(gid.toString()); |
| | | userPosition.setStockGid(stock.getStockType()); |
| | | userPosition.setBuyOrderId(GeneratePosition.getPositionId()); |
| | | userPosition.setBuyOrderTime(new Date()); |
| | | userPosition.setBuyOrderPrice(userStockSubscribe.getBuyPrice()); |
| | |
| | | if (siteProduct.getRealNameDisplay() && user.getIsLock().intValue() == 1) { |
| | | return ServerResponse.createByErrorMsg("Order failed, account has been locked"); |
| | | } |
| | | UserAssets userAssets = userAssetsServices.assetsByTypeAndUserId("IN", user.getId()); |
| | | UserAssets userAssets = userAssetsServices.assetsByTypeAndUserId("MAS", user.getId()); |
| | | if(userAssets.getAmountToBeCovered().compareTo(BigDecimal.ZERO) > 0){ |
| | | return ServerResponse.createByErrorMsg("请先缴清待补资金", request); |
| | | } |
| | |
| | | for (UserPosition position : list) { |
| | | UserAssets userAssets = userAssetsMapper.selectOne(new LambdaQueryWrapper<UserAssets>() |
| | | .eq(UserAssets::getUserId, position.getUserId()) |
| | | .eq(UserAssets::getAccectType, "IN") |
| | | .eq(UserAssets::getAccectType, "MAS") |
| | | ); |
| | | if(userAssets.getAmountToBeCovered().compareTo(BigDecimal.ZERO) > 0){ |
| | | continue; |