zyy
2025-08-28 76388afc59b66335dcf630e5ed30beccbe7aeb5b
src/main/java/com/nq/service/impl/EchoServices.java
@@ -55,6 +55,19 @@
    }
    @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);
@@ -127,8 +140,7 @@
        // 创建固定大小的线程池,根据需求调整线程数量
        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();
@@ -170,11 +182,11 @@
                    } 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");