Junjie
1 天以前 a4f07b2a0ddb6c210e05afbbb491feeb466203e7
src/main/java/com/zy/asrs/task/PlannerScheduler.java
@@ -1,7 +1,7 @@
package com.zy.asrs.task;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zy.asrs.service.PlannerService;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
@@ -21,11 +21,14 @@
    @Scheduled(fixedDelay = 3000)
    public void schedulePlanner() {
        try {
            Config crnRunMethodConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "crnRunMethod"));
            String crnRunMethod = "normal";
            Config crnRunMethodConfig = configService.getOne(new QueryWrapper<Config>().eq("code", "crnRunMethod"));
            if(crnRunMethodConfig != null) {
                if (!crnRunMethodConfig.getValue().equals("solver")) {
                    return;
                }
                crnRunMethod = crnRunMethodConfig.getValue();
            }
            if (!crnRunMethod.equals("solver")) {
                return;
            }
            JSONObject result = plannerService.calculateAndSaveSchedule();
            // 日志记录可以根据需要添加,避免过于频繁