| | |
| | | private String accectType; |
| | | private String userId; |
| | | private String symbol; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Kolkata") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
| | | private Date createTime; |
| | | |
| | | |
| | |
| | | private String returnOfRate; |
| | | |
| | | //买入时间 |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Kolkata") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
| | | private Date buyTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Kolkata") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
| | | private Date endTime; |
| | | |
| | | //用户id |
| | |
| | | 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/Shanghai") |
| | | private Date addTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "Asia/Kolkata") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "Asia/Shanghai") |
| | | @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/Shanghai") |
| | | @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/Shanghai") |
| | | @Excel(name = "出金时间", databaseFormat = "yyyyMMddHHmmss", format = "yyyy-MM-dd HH:mm:ss") |
| | | private Date transTime; |
| | | |
| | |
| | | UserPosition userPosition = userPositionMapper.selectOne(new LambdaQueryWrapper<UserPosition>().gt(UserPosition::getAmountToBeCovered, BigDecimal.ZERO).eq(UserPosition::getUserId,userAssets.getUserId())); |
| | | String type = eUserAssets.getDesc(); |
| | | String before = userAssets.getAvailableBalance().toString(); |
| | | String accectType = userAssets.getAccectType(); |
| | | accetType = userAssets.getAccectType(); |
| | | BigDecimal amountLog = amount; |
| | | if(Objects.equals(eUserAssets.getCode(), EUserAssets.BUY.getCode())){ |
| | | userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(amount)); |
| | |
| | | moneyLog.setBeFore(before); |
| | | moneyLog.setAfter(after); |
| | | moneyLog.setAmount(amountLog.toString()); |
| | | moneyLog.setAccectType(accectType); |
| | | moneyLog.setAccectType(accetType); |
| | | moneyLog.setType(eUserAssets.getCode()); |
| | | moneyLog.setUserId(userId+""); |
| | | moneyLog.setSymbol(EStockType.getEStockTypeByCode(accetType).getSymbol()); |
| | |
| | | return ServerResponse.createByErrorMsg("报价0,请稍后再试", request); |
| | | } |
| | | |
| | | |
| | | BigDecimal buyAmt = nowPrice.multiply(new BigDecimal(buyNum)).divide(new BigDecimal(lever)); |
| | | BigDecimal finalBuyAmt = buyAmt; |
| | | //如果不是默认货币需要转换金额 |
| | | if (!stock.getStockType().equals(EStockType.getDefault().getCode())) { |
| | | buyAmt = userAssetsServices.exchangeAmountByRate(stock.getStockType(), buyAmt); |
| | | } |
| | | //手续费 |
| | | BigDecimal orderFree = siteSettingBuyFee.multiply(buyAmt); |
| | | |
| | | BigDecimal needBuyAmt = buyAmt.add(orderFree); |
| | | //资金校验 |
| | | if (!stock.getStockType().equals(EStockType.getDefault().getCode())) { |
| | | needBuyAmt = userAssetsServices.exchangeAmountByRate(stock.getStockType(), buyAmt); |
| | | } |
| | | BigDecimal fundratio = new BigDecimal(user.getFundRatio()).divide(new BigDecimal(100)); |
| | | BigDecimal availableBalance = fundratio.multiply(userAssets.getAvailableBalance()); |
| | | if (availableBalance.compareTo(buyAmt.add(orderFree)) < 0) { |
| | | if (availableBalance.compareTo(needBuyAmt) < 0) { |
| | | return ServerResponse.createByErrorMsg("订单失败,配资不足", request); |
| | | } |
| | | |
| | | UserPosition userPosition = new UserPosition(); |
| | | if (profitTarget != null && profitTarget.compareTo(new BigDecimal("0")) > 0) { |
| | | userPosition.setProfitTargetPrice(profitTarget); |
| | |
| | | } |
| | | userPosition.setIsLock(Integer.valueOf(0)); |
| | | userPosition.setOrderLever(lever); |
| | | userPosition.setOrderTotalPrice(finalBuyAmt); |
| | | userPosition.setOrderTotalPrice(buyAmt); |
| | | // 手续费 |
| | | |
| | | userPosition.setOrderFee(orderFree); |
| | |
| | | |
| | | package com.nq.vo.position; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | private String buyOrderId; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
| | | private Date buyOrderTime; |
| | | |
| | | private BigDecimal buyOrderPrice; |