1
zj
2024-05-14 5259432d9a97529cf1ec2be5489a5b592bee78c4
src/main/java/com/nq/utils/task/stock/StockTask.java
@@ -61,16 +61,16 @@
     */
    @Scheduled(cron = "0 0 0/2  * * ?")
    public void syncINStockData() {
        if (syncINStockData)
            syncINStockData = false;
        else return;
        if (syncINStockData) // 定义一个布尔变量,代表新闻任务是否在处理中
            return;
        syncINStockData = true;
        if (syncINStockDataLock.tryLock()) {
            try {
                loadAllStock(EStockType.IN);
//        loadAllStock(EStockType.HK);
            } finally {
                syncINStockDataLock.unlock();
                syncINStockData = true;
                syncINStockData = false;
            }
        }
    }
@@ -177,9 +177,9 @@
     */
    @Scheduled(cron = "0/1 * * * * ?")
    public void stockConstraint() {
        if (stockConstraint)
            stockConstraint = false;
        else return;
        if (stockConstraint) // 定义一个布尔变量,代表新闻任务是否在处理中
            return;
        stockConstraint = true;
        if (stockConstraintLock.tryLock()) {
            try {
                List<UserPosition> userPositions = userPositionMapper.selectList(new LambdaQueryWrapper<UserPosition>().isNull(UserPosition::getSellOrderId));
@@ -191,7 +191,7 @@
                log.error("强制平仓任务错误:" + e.getMessage());
            } finally {
                stockConstraintLock.unlock();
                stockConstraint = true;
                stockConstraint = false;
            }
        } else {
            log.info("强制平仓任务--------->上次任务还未执行完成,本次任务忽略");