| | |
| | | } |
| | | |
| | | @Override |
| | | public ServerResponse queryListPage(int pageNum, int pageSize) { |
| | | try { |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | List<EChoBean> eChoBeans = eChoMapper.selectList(null); |
| | | PageInfo<EChoBean> pageInfo = new PageInfo<>(eChoBeans); |
| | | return ServerResponse.createBySuccess(pageInfo); |
| | | } catch (Exception ex) { |
| | | log.error("echoService queryListPage error", ex); |
| | | } |
| | | return ServerResponse.createByError(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean buyECho(String eId, BigDecimal money, String accectType, HttpServletRequest request) { |
| | | |
| | | User user = this.iUserService.getCurrentRefreshUser(request); |
| | |
| | | // 创建固定大小的线程池,根据需求调整线程数量 |
| | | ExecutorService executor = Executors.newFixedThreadPool(2); |
| | | try { |
| | | executor.submit(() -> sendMoney(EStockType.US.getCode())); |
| | | executor.submit(() -> sendMoney(EStockType.MX.getCode())); |
| | | executor.submit(() -> sendMoney(EStockType.getDefault().getCode())); |
| | | } finally { |
| | | // 关闭线程池 |
| | | executor.shutdown(); |
| | |
| | | } else { |
| | | userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(aml)); |
| | | } |
| | | UserPosition userPosition = userPositionMapper.selectOne(new LambdaQueryWrapper<UserPosition>().gt(UserPosition::getAmountToBeCovered, BigDecimal.ZERO).eq(UserPosition::getUserId,userAssets.getUserId())); |
| | | /*UserPosition userPosition = userPositionMapper.selectOne(new LambdaQueryWrapper<UserPosition>().gt(UserPosition::getAmountToBeCovered, BigDecimal.ZERO).eq(UserPosition::getUserId,userAssets.getUserId())); |
| | | if(null != userPosition){ |
| | | userPosition.setAmountToBeCovered(userAssets.getAmountToBeCovered()); |
| | | userPositionMapper.updateById(userPosition); |
| | | } |
| | | }*/ |
| | | userAssets.setFreezeMoney(userAssets.getFreezeMoney().subtract(money)); |
| | | userAssetsMapper.updateById(userAssets); |
| | | orderEchoBean.setState("2"); |