| | |
| | | package com.nq.service.impl; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | |
| | | import com.nq.pojo.reponse.RUserAssets; |
| | | import com.nq.service.*; |
| | | import com.nq.utils.UserPointUtil; |
| | | import com.nq.utils.redis.RedisKeyUtil; |
| | | import com.nq.utils.timeutil.DateTimeUtil; |
| | | import com.nq.utils.PropertiesUtil; |
| | | import com.nq.utils.SymmetricCryptoUtil; |
| | |
| | | @Autowired |
| | | StockPoll stockPoll; |
| | | |
| | | @Autowired |
| | | StockSubscribeMapper stockSubscribeMapper; |
| | | |
| | | @Resource |
| | | MoneyLogMapper mapper; |
| | |
| | | rUserAssets.setHandlingCharge(hMoney.toString()); |
| | | rUserAssets.setProfitAndLoss(profitAndLose.toString()); |
| | | rUserAssets.setIsZf(userAssets.getIsZf()); |
| | | rUserAssets.setAmountToBeCovered(userAssets.getAmountToBeCovered().toString()); |
| | | rUserAssets.setAmountToBeCovered((userAssets.getAmountToBeCovered().add(userAssets.getHandlingChargeWritten()).toString())); |
| | | BigDecimal rate = rateServices.currencyRate( |
| | | EStockType.getEStockTypeByCode(userAssets.getAccectType()),EStockType.US); |
| | | |
| | |
| | | |
| | | BigDecimal totleMoneyUSD = totalAssets; |
| | | if(totalAssets.compareTo(BigDecimal.ZERO)>0){ |
| | | totleMoneyUSD = totleMoneyUSD.multiply(rate); |
| | | totleMoneyUSD = totleMoneyUSD.multiply(rate).subtract(new BigDecimal(rUserAssets.getHandlingCharge())); |
| | | } |
| | | |
| | | BigDecimal cumulativeProfitAndLossUSD = hProfitAndLose; |
| | |
| | | AllHProfitAndLose = AllHProfitAndLose.add(handlingChargeUSD); |
| | | allFreeMoney = allFreeMoney.add(freezeMoneyUSD); |
| | | allHMoney = allHMoney.add(handlingChargeUSD); |
| | | |
| | | |
| | | |
| | | |
| | |
| | | List<UserPositionVO> userPositionVOS = Lists.newArrayList(); |
| | | if (userPositions.size() > 0) { |
| | | for (UserPosition position : userPositions) { |
| | | UserPositionVO userPositionVO = UserPointUtil.assembleUserPositionVO(position, priceServices.getNowPrice(position.getStockCode())); |
| | | 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); |
| | | |
| | | StockSubscribe stockSubscribe = stockSubscribeMapper.selectOne(new LambdaQueryWrapper<StockSubscribe>() |
| | | .eq(StockSubscribe::getCode, userPositionVO.getStockCode())); |
| | | if(position.getSellOrderId() == null){ |
| | | if (null != stockSubscribe && DateUtil.date().before(stockSubscribe.getListDate())) { |
| | | userPositionVO.setProfitAndLose(BigDecimal.ZERO); |
| | | }else{ |
| | | userPositionVO.setProfitAndLose(userPositionVO.getProfitAndLose().multiply(new BigDecimal(userPositionVO.getOrderLever()))); |
| | | } |
| | | }else{ |
| | | userPositionVO.setProfitAndLose(userPositionVO.getProfitAndLose().multiply(new BigDecimal(userPositionVO.getOrderLever()))); |
| | | } |
| | | |
| | | userPositionVOS.add(userPositionVO); |
| | | |
| | | } |
| | | } |
| | | BigDecimal profitAndLose = BigDecimal.ZERO; |
| | |
| | | List<User> users = this.userMapper.listByAgent(realName, phone, searchId, accountType); |
| | | |
| | | List<AgentUserListVO> agentUserListVOS = Lists.newArrayList(); |
| | | |
| | | for (User user : users) { |
| | | |
| | | ServerResponse money = iUserService.getMoney(user.getId()); |
| | | List<RUserAssets> rUserAssetsList = (List<RUserAssets>) money.getData(); |
| | | RUserAssets rUserAssets = rUserAssetsList.stream() |
| | | .filter(stock -> "IN".equals(stock.getAccectType())) |
| | | .findFirst() |
| | | .orElse(null); |
| | | |
| | | AgentUserListVO agentUserListVO = assembleAgentUserListVO(user, siteSetting |
| | | .getForceStopPercent(), siteIndexSetting |
| | | .getForceSellPercent(), siteFuturesSetting.getForceSellPercent()); |
| | | if (rUserAssets != null) { |
| | | agentUserListVO.setUserAmt(rUserAssets.getTotalMoney().equals("0E-8") ? new BigDecimal("0") : new BigDecimal(rUserAssets.getTotalMoney())); |
| | | agentUserListVO.setFreezeMoney(rUserAssets.getFreezeMoney().equals("0E-8") ? "0" : rUserAssets.getFreezeMoney()); |
| | | agentUserListVO.setAvailableBalance(rUserAssets.getAvailableBalance().equals("0E-8") ? "0" : rUserAssets.getAvailableBalance()); |
| | | } |
| | | agentUserListVOS.add(agentUserListVO); |
| | | } |
| | | |
| | |
| | | userOut.setTotalMoney(rUserAssets.getTotalMoney().equals("0E-8") ? "0" : rUserAssets.getTotalMoney()); |
| | | userOut.setFreezeMoney(rUserAssets.getFreezeMoney().equals("0E-8") ? "0" : rUserAssets.getFreezeMoney()); |
| | | userOut.setAvailableBalance(rUserAssets.getAvailableBalance().equals("0E-8") ? "0" : rUserAssets.getAvailableBalance()); |
| | | userOut.setAmountToBeCovered(rUserAssets.getAmountToBeCovered()); |
| | | } |
| | | |
| | | userOutMap.put(user.getId(), userOut); |
| | |
| | | agentUserListVO.setIsLogin(user.getIsLogin()); |
| | | agentUserListVO.setRegAddress(user.getRegAddress()); |
| | | agentUserListVO.setIsActive(user.getIsActive()); |
| | | |
| | | agentUserListVO.setImg1Key(user.getImg1Key()); |
| | | agentUserListVO.setImg2Key(user.getImg2Key()); |
| | | agentUserListVO.setImg3Key(user.getImg3Key()); |
| | | |
| | | |
| | | |