| | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.dao.StockSubscribeMapper; |
| | | import com.nq.dao.UserAssetsMapper; |
| | | import com.nq.dao.UserMapper; |
| | | import com.nq.dao.UserStockSubscribeMapper; |
| | | import com.nq.dao.*; |
| | | import com.nq.enums.EStockType; |
| | | import com.nq.enums.EUserAssets; |
| | | import com.nq.pojo.*; |
| | |
| | | |
| | | @Autowired |
| | | UserAssetsMapper userAssetsMapper; |
| | | |
| | | @Resource |
| | | MoneyLogMapper moneyLogMapper; |
| | | /** |
| | | * 用户新股申购 |
| | | * @param model |
| | |
| | | if(null == userAssets){ |
| | | return ServerResponse.createByErrorMsg("客户资金账户不存在"); |
| | | } |
| | | String after = userAssets.getAvailableBalance().toString(); |
| | | BigDecimal decimal = userStockSubscribe.getBuyPrice().multiply(new BigDecimal(model.getApplyNumber()));//中签总价 |
| | | BigDecimal availableBalance = userAssets.getAvailableBalance().subtract(decimal);//剩余可用余额 |
| | | if(decimal.compareTo(userAssets.getAvailableBalance()) <= 0){ |
| | |
| | | userAssets.setAvailableBalance(BigDecimal.ZERO); |
| | | userAssets.setAmountToBeCovered(userAssets.getAmountToBeCovered().add(amountToBeCovered)); |
| | | } |
| | | MoneyLog moneyLog = new MoneyLog(); |
| | | moneyLog.setDescs("中签扣除"); |
| | | moneyLog.setBeFore(userAssets.getAvailableBalance().toString()); |
| | | moneyLog.setAfter(after); |
| | | moneyLog.setAmount(decimal.toString()); |
| | | moneyLog.setAccectType("IN"); |
| | | moneyLog.setType("中签扣除"); |
| | | moneyLog.setUserId(userAssets.getUserId().toString()); |
| | | moneyLog.setSymbol(EStockType.getEStockTypeByCode("IN").getSymbol()); |
| | | moneyLog.setCreateTime(new Date()); |
| | | moneyLogMapper.insert(moneyLog); |
| | | userAssetsMapper.updateById(userAssets); |
| | | ret = userStockSubscribeMapper.update1(model); |
| | | }else{ |