| | |
| | | // bound = new BigDecimal(model.getApplyNums()).multiply(stockSubscribe.getPrice()); |
| | | // } |
| | | // |
| | | BigDecimal useEnaAmount = iUserAssetsServices.getAvailableBalance(EStockType.IN.getCode(), user.getId()); |
| | | BigDecimal useEnaAmount = iUserAssetsServices.getAvailableBalance(EStockType.US.getCode(), user.getId()); |
| | | if(useEnaAmount.compareTo(bound)<0){ |
| | | return ServerResponse.createByErrorMsg("余额不足,配售失败",request); |
| | | } |
| | |
| | | UserStockSubscribe userStockSubscribe = Convert.convert(UserStockSubscribe.class, model); |
| | | userStockSubscribe.setNewStockId(stockSubscribe.getNewlistId()); |
| | | ret = userStockSubscribeMapper.insert(userStockSubscribe); |
| | | iUserAssetsServices.availablebalanceChange(EStockType.IN.getCode(), user.getId(),EUserAssets.BUY,bound.negate(),"",""); |
| | | iUserAssetsServices.availablebalanceChange(EStockType.US.getCode(), user.getId(),EUserAssets.BUY,bound.negate(),"",""); |
| | | if (ret > 0) { |
| | | return ServerResponse.createBySuccessMsg("配售成功",request); |
| | | } else { |
| | |
| | | } |
| | | BigDecimal cCount = new BigDecimal(model.getApplyNums()-model.getApplyNumber()); |
| | | BigDecimal tMoney = ((stockSubscribe.getMinPrice() != null ? stockSubscribe.getMinPrice() : stockSubscribe.getPrice())).multiply(cCount); |
| | | iUserAssetsServices.availablebalanceChange(EStockType.IN.getCode(),userStockSubscribe.getUserId(), |
| | | iUserAssetsServices.availablebalanceChange(EStockType.US.getCode(),userStockSubscribe.getUserId(), |
| | | EUserAssets.TOP_UP,tMoney,"",""); |
| | | model.setBond((stockSubscribe.getMinPrice() != null ? stockSubscribe.getMinPrice() : stockSubscribe.getPrice()).multiply(BigDecimal.valueOf(model.getApplyNumber()))); |
| | | model.setDbMoney(BigDecimal.ZERO); |
| | |
| | | userStockSubscribe.setSubmitTime(DateTimeUtil.getCurrentDate()); |
| | | userStockSubscribe.setStatus(4); |
| | | BigDecimal bigDecimal = iUserAssetsServices. |
| | | getAvailableBalance(EStockType.IN.getCode(), |
| | | getAvailableBalance(EStockType.US.getCode(), |
| | | userStockSubscribe.getUserId()); |
| | | |
| | | BigDecimal multiply = userStockSubscribe.getBuyPrice().multiply(new BigDecimal(userStockSubscribe.getApplyNumber())); |
| | | if(bigDecimal.compareTo(multiply) <= 0){ |
| | | return ServerResponse.createByErrorMsg("余额不足",request); |
| | | } |
| | | iUserAssetsServices.availablebalanceChange(EStockType.IN.getCode(),userStockSubscribe.getUserId(), |
| | | iUserAssetsServices.availablebalanceChange(EStockType.US.getCode(),userStockSubscribe.getUserId(), |
| | | EUserAssets.BUY,multiply.negate(),"",""); |
| | | userStockSubscribe.setDbMoney(BigDecimal.ZERO); |
| | | userStockSubscribeMapper.update1(userStockSubscribe); |