houzhongjian
2024-12-04 a82313d17b2b5d1c02e880122efc1b701c401dcf
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson.JSONObject;
import com.iail.IAILMDK;
import com.iail.model.IAILModel;
import com.iailab.module.model.common.enums.CommonConstant;
import com.iailab.module.model.mcs.sche.entity.StScheduleModelEntity;
import com.iailab.module.model.mcs.sche.entity.StScheduleModelSettingEntity;
import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity;
@@ -16,6 +17,7 @@
import com.iailab.module.model.mdk.sample.dto.SampleData;
import com.iailab.module.model.mdk.schedule.ScheduleModelHandler;
import com.iailab.module.model.mdk.vo.ScheduleResultVO;
import com.iailab.module.model.mpk.common.utils.DllUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -88,7 +90,7 @@
            param2Values[count] = settings_predict;
            //打印参数
            log.info("##############调度模型:modelId=" + modelId + " ##########################");
            log.info("##############调度模型:scheduleScheme=" + scheduleScheme.getCode() + " ##########################");
            JSONObject jsonObjNewModelBean = new JSONObject();
            jsonObjNewModelBean.put("newModelBean", newModelBean);
            log.info(String.valueOf(jsonObjNewModelBean));
@@ -96,17 +98,21 @@
            jsonObjParam2Values.put("param2Values", param2Values);
            log.info(String.valueOf(jsonObjParam2Values));
            //IAILMDK.run
            HashMap<String, Object> result = IAILMDK.run(newModelBean, param2Values);
            //运行模型
            HashMap<String, Object> modelResult = DllUtils.run(newModelBean, param2Values, scheduleScheme.getMpkprojectid());
            if (!modelResult.containsKey(CommonConstant.MDK_STATUS_CODE) || !modelResult.containsKey(CommonConstant.MDK_RESULT) ||
                    !modelResult.get(CommonConstant.MDK_STATUS_CODE).toString().equals(CommonConstant.MDK_STATUS_100)) {
                throw new RuntimeException("模型结果异常:" + modelResult);
            }
            modelResult = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT);
            //打印结果
            JSONObject jsonObjResult = new JSONObject();
            jsonObjResult.put("result", result);
            jsonObjResult.put("result", modelResult);
            log.info(String.valueOf(jsonObjResult));
            log.info("调度模型计算完成:modelId=" + modelId + result);
            //5.返回调度结果
            scheduleResult.setResult(result);
            scheduleResult.setResult(modelResult);
            scheduleResult.setModelId(modelId);
            scheduleResult.setSchemeId(scheduleScheme.getId());
            scheduleResult.setScheduleTime(scheduleTime);