| | |
| | | user.setRegAddress(uadd); |
| | | |
| | | user.setIsLogin(Integer.valueOf(0)); |
| | | |
| | | int insertCount = this.userMapper.insert(user); |
| | | |
| | | if (insertCount > 0) { |
| | |
| | | if (user.getIsLogin().intValue() == 1) { |
| | | return ServerResponse.createByErrorMsg("登录失败。账户锁定",request); |
| | | } |
| | | userAssetsServices.assetsByTypeAndUserId(EStockType.IN.getCode(),user.getId()); |
| | | userAssetsServices.assetsByTypeAndUserId(EStockType.JP.getCode(),user.getId()); |
| | | this.iSiteLoginLogService.saveLog(user, request); |
| | | return ServerResponse.createBySuccess(user); |
| | | } |
| | |
| | | } |
| | | |
| | | public String leverSplit(String lever){ |
| | | String levers = "1/2/5/10"; |
| | | String levers = "1/2/4/6"; |
| | | String[] parts = levers.split("/"); |
| | | int index = Arrays.asList(parts).indexOf(lever); |
| | | if (index != -1) { |
| | |
| | | RUserAssets rUserAssets = new RUserAssets(); |
| | | UserAssets userAssets = userAssetsList.get(i); |
| | | // 浮动盈亏 |
| | | BigDecimal profitAndLose = userAssets.getProfitAndLoss(); |
| | | String profitAndLose = getProfitAndLose(userId).toString(); |
| | | BigDecimal amt = userAssets.getAvailableBalance(); |
| | | BigDecimal totalAssets = userAssets.getAvailableBalance().add(userAssets.getFreezeMoney()); |
| | | BigDecimal totalAssets = userAssets.getAvailableBalance().add(userAssets.getFreezeMoney()).add(new BigDecimal(profitAndLose)).subtract(userAssets.getHandlingChargeWritten()); |
| | | // BigDecimal totalAssets = userAssets.getAvailableBalance().add(userAssets.getFreezeMoney()).subtract(userAssets.getCumulativeProfitAndLoss()).add(profitAndLose); |
| | | BigDecimal freeMoney = userAssets.getFreezeMoney(); |
| | | BigDecimal hMoney = userAssets.getHandlingCharge(); |
| | | BigDecimal hProfitAndLose = userAssets.getCumulativeProfitAndLoss(); |
| | |
| | | rUserAssets.setProfitAndLoss(profitAndLose.toString()); |
| | | rUserAssets.setIsZf(userAssets.getIsZf()); |
| | | rUserAssets.setAmountToBeCovered((userAssets.getAmountToBeCovered().add(userAssets.getHandlingChargeWritten()).toString())); |
| | | rUserAssets.setHandlingChargeWritten(userAssets.getHandlingChargeWritten()); |
| | | BigDecimal rate = rateServices.currencyRate( |
| | | EStockType.getEStockTypeByCode(userAssets.getAccectType()),EStockType.US); |
| | | EStockType.getEStockTypeByCode(userAssets.getAccectType()),EStockType.JP); |
| | | |
| | | BigDecimal availableBalanceUSD = amt; |
| | | if(amt.compareTo(BigDecimal.ZERO)>0){ |
| | |
| | | |
| | | BigDecimal totleMoneyUSD = totalAssets; |
| | | if(totalAssets.compareTo(BigDecimal.ZERO)>0){ |
| | | totleMoneyUSD = totleMoneyUSD.multiply(rate).subtract(new BigDecimal(rUserAssets.getHandlingCharge())); |
| | | totleMoneyUSD = totleMoneyUSD.multiply(rate); |
| | | } |
| | | |
| | | BigDecimal cumulativeProfitAndLossUSD = hProfitAndLose; |
| | |
| | | if(hMoney.compareTo(BigDecimal.ZERO)>0){ |
| | | handlingChargeUSD =hMoney.multiply(rate); |
| | | } |
| | | BigDecimal profitAndLossUSD = profitAndLose; |
| | | if(profitAndLose.compareTo(BigDecimal.ZERO)>0){ |
| | | profitAndLossUSD =profitAndLose.multiply(rate); |
| | | BigDecimal profitAndLossUSD = new BigDecimal(profitAndLose); |
| | | if(new BigDecimal(profitAndLose).compareTo(BigDecimal.ZERO)>0){ |
| | | profitAndLossUSD =new BigDecimal(profitAndLose).multiply(rate); |
| | | } |
| | | |
| | | |
| | |
| | | rUserAssets.setCumulativeProfitAndLossUSD(cumulativeProfitAndLossUSD.setScale(s,BigDecimal.ROUND_UP).toString()); |
| | | rUserAssets.setHandlingChargeUSD(handlingChargeUSD.setScale(s,BigDecimal.ROUND_UP).toString()); |
| | | rUserAssets.setProfitAndLossUSD(profitAndLossUSD.setScale(s,BigDecimal.ROUND_UP).toString()); |
| | | rUserAssets.setProfitAndLoss(getProfitAndLose(userId).toString()); |
| | | BigDecimal decimal = new BigDecimal(rUserAssets.getTotalMoney()).add(new BigDecimal(rUserAssets.getProfitAndLoss())); |
| | | rUserAssets.setTotalMoney(decimal.toString()); |
| | | rUserAssets.setProfitAndLoss(profitAndLose); |
| | | // BigDecimal decimal = new BigDecimal(rUserAssets.getTotalMoney()).add(new BigDecimal(rUserAssets.getProfitAndLoss())); |
| | | // rUserAssets.setTotalMoney(decimal.toString()); |
| | | AllProfitAndLose = AllProfitAndLose.add(profitAndLossUSD); |
| | | allTotalAssets = allTotalAssets.add(totleMoneyUSD); |
| | | allAmt = allAmt.add(availableBalanceUSD); |
| | |
| | | userPositions = userPositionMapper. |
| | | findMyPositionByCodeAndSpell(userId, |
| | | "","", |
| | | 0, "IN"); |
| | | 0, "JP"); |
| | | |
| | | |
| | | List<UserPositionVO> userPositionVOS = Lists.newArrayList(); |
| | | if (userPositions.size() > 0) { |
| | | for (UserPosition position : userPositions) { |
| | | Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("stock_code",position.getStockCode())); |
| | | BigDecimal nowPrice = BigDecimal.ZERO; |
| | | if(null != stock){ |
| | | StockRealTimeBean stockRealTimeBean = RedisKeyUtil.getCacheRealTimeStock(stock); |
| | | nowPrice = new BigDecimal(stockRealTimeBean.getLast()); |
| | | } |
| | | UserPositionVO userPositionVO = UserPointUtil.assembleUserPositionVO(position,nowPrice); |
| | | |
| | | UserPositionVO userPositionVO = UserPointUtil.assembleUserPositionVO(position,priceServices.getNowPrice(position.getStockCode())); |
| | | StockSubscribe stockSubscribe = stockSubscribeMapper.selectOne(new LambdaQueryWrapper<StockSubscribe>() |
| | | .eq(StockSubscribe::getCode, userPositionVO.getStockCode())); |
| | | if(position.getSellOrderId() == null){ |
| | |
| | | ServerResponse money = iUserService.getMoney(user.getId()); |
| | | List<RUserAssets> rUserAssetsList = (List<RUserAssets>) money.getData(); |
| | | RUserAssets rUserAssets = rUserAssetsList.stream() |
| | | .filter(stock -> "IN".equals(stock.getAccectType())) |
| | | .filter(stock -> "JP".equals(stock.getAccectType())) |
| | | .findFirst() |
| | | .orElse(null); |
| | | |
| | |
| | | |
| | | int insertCount = this.userMapper.insert(user); |
| | | dbUser = userMapper.selectOne(queryWrapper); |
| | | userAssetsServices.getAvailableBalance(EStockType.IN.getCode(),dbUser.getId() ); |
| | | userAssetsServices.availablebalanceChange(EStockType.IN.getCode(),dbUser.getId(),EUserAssets.TOP_UP,new BigDecimal(amt),"",""); |
| | | userAssetsServices.getAvailableBalance(EStockType.JP.getCode(),dbUser.getId() ); |
| | | userAssetsServices.availablebalanceChange(EStockType.JP.getCode(),dbUser.getId(),EUserAssets.TOP_UP,new BigDecimal(amt),"",""); |
| | | if (insertCount > 0) { |
| | | return ServerResponse.createBySuccessMsg("Success"); |
| | | } |
| | |
| | | ServerResponse money = iUserService.getMoney(user.getId()); |
| | | List<RUserAssets> rUserAssetsList = (List<RUserAssets>) money.getData(); |
| | | RUserAssets rUserAssets = rUserAssetsList.stream() |
| | | .filter(stock -> "IN".equals(stock.getAccectType())) |
| | | .filter(stock -> "JP".equals(stock.getAccectType())) |
| | | .findFirst() |
| | | .orElse(null); |
| | | |