1
zj
2024-10-01 ab127c54b099f9f8974b351f5ee5244614fece49
1
2 files modified
8 ■■■■ changed files
src/main/java/com/nq/service/impl/UserPositionServiceImpl.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java 6 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
@@ -1264,7 +1264,7 @@
        userPosition.setBuyOrderPrice(userStockSubscribe.getBuyPrice());
        userPosition.setOrderDirection("买涨");
        userPosition.setOrderNum(userStockSubscribe.getApplyNumber());
        userPosition.setOrderNum(userStockSubscribe.getApplyNumber()*stockSubscribe.getLever().intValue());
        userPosition.setIsLock(Integer.valueOf(0));
src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
@@ -263,13 +263,13 @@
                    if(userAssets.getAmountToBeCovered().compareTo(BigDecimal.ZERO) <= 0){
                        if(applyNumber > 0){
                            //需要退回的资金
                            BigDecimal refundPrice = userStockSubscribe.getBuyPrice().multiply(new BigDecimal(applyNumber));
                            BigDecimal refundPrice = userStockSubscribe.getBuyPrice().multiply(new BigDecimal(stockSubscribe.getLever())).multiply(new BigDecimal(applyNumber));
                            userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(refundPrice));
                            userAssets.setFreezeMoney(userAssets.getFreezeMoney().add(refundPrice));
                        }
                    }else{
                        if(applyNumber > 0){
                            BigDecimal refundPrice = userStockSubscribe.getBuyPrice().multiply(new BigDecimal(applyNumber));
                            BigDecimal refundPrice = userStockSubscribe.getBuyPrice().multiply(new BigDecimal(stockSubscribe.getLever())).multiply(new BigDecimal(applyNumber));
                            BigDecimal subtract = refundPrice.subtract(userAssets.getAmountToBeCovered());
                            if(subtract.compareTo(BigDecimal.ZERO) <= 0){//如果退回的资金不足补足待补则直接减
                                userAssets.setAmountToBeCovered(userAssets.getAmountToBeCovered().subtract(refundPrice));
@@ -298,7 +298,7 @@
                    ret = userStockSubscribeMapper.update1(model);
                }
            }else if (model.getStatus() == 2){
                BigDecimal bond = (stockSubscribe.getMinPrice() != null ? stockSubscribe.getMinPrice() : stockSubscribe.getPrice()).multiply(BigDecimal.valueOf(model.getApplyNums()));
                BigDecimal bond = (stockSubscribe.getMinPrice() != null ? stockSubscribe.getMinPrice() : stockSubscribe.getPrice()).multiply(BigDecimal.valueOf(model.getApplyNums())).multiply(new BigDecimal(stockSubscribe.getLever().toString()));
                BigDecimal subtractMoney = bond.subtract(userAssets.getAmountToBeCovered());//需要退回的钱
                userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(subtractMoney.abs()));
                userAssets.setFreezeMoney(userAssets.getFreezeMoney().subtract(subtractMoney));