潘志宝
6 天以前 b2bb7d1ff5639dd844e84b881a515eca30625411
调度模型运行状态显示
已修改9个文件
37 ■■■■ 文件已修改
iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkScheduleRespDTO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/db/mysql.sql 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/entity/DmModuleEntity.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleSchemeEntity.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleSchemeService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeRespVO.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkScheduleRespDTO.java
@@ -21,5 +21,7 @@
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date scheduleTime;
    private String statusCode;
    private Map<String, Object> result;
}
iailab-module-model/iailab-module-model-biz/db/mysql.sql
@@ -896,4 +896,6 @@
                                  `disturbance_point_no` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '无扰切换点位',
                                  PRIMARY KEY (`id`) USING BTREE,
                                  INDEX `ind_model_id`(`model_id` ASC) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='模型下发信息表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='模型下发信息表';
alter table t_st_schedule_scheme add column `run_status` varchar(4) DEFAULT NULL COMMENT '运行状态';
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java
@@ -212,9 +212,10 @@
        try {
            log.info("调度计算开始: " + System.currentTimeMillis());
            ScheduleResultVO scheduleResult = scheduleModelHandler.doSchedule(reqDTO.getScheduleCode(), reqDTO.getScheduleTime());
            resp.setStatusCode(scheduleResult.getResultCode());
            resp.setResult(scheduleResult.getResult());
            stScheduleRecordService.create(scheduleResult);
            stScheduleSchemeService.updateTime(scheduleResult.getSchemeId(), scheduleResult.getScheduleTime());
            stScheduleSchemeService.updateTime(scheduleResult.getSchemeId(), scheduleResult.getScheduleTime(), scheduleResult.getResultCode());
            log.info("预测计算结束: " + System.currentTimeMillis());
        } catch (Exception ex) {
            log.info("调度计算异常: " + System.currentTimeMillis());
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/entity/DmModuleEntity.java
@@ -53,13 +53,13 @@
    /**
     * 预测时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date predicttime;
    /**
     * 收集时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date collecttime;
    /**
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleSchemeEntity.java
@@ -83,4 +83,9 @@
     * 项目ID
     */
    private String mpkprojectid;
    /**
     * 运行状态
     */
    private String runStatus;
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleSchemeService.java
@@ -27,7 +27,7 @@
    StScheduleSchemeEntity getInfo(String id);
    void updateTime(String id, Date scheduleTime);
    void updateTime(String id, Date scheduleTime, String statusCode);
    StScheduleSchemeEntity getByCode(String code);
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java
@@ -70,9 +70,10 @@
    }
    @Override
    public void updateTime(String id, Date scheduleTime) {
    public void updateTime(String id, Date scheduleTime, String statusCode) {
        StScheduleSchemeEntity entity = new StScheduleSchemeEntity();
        entity.setId(id);
        entity.setRunStatus(statusCode);
        entity.setScheduleTime(scheduleTime);
        baseDao.updateById(entity);
    }
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeRespVO.java
@@ -1,5 +1,6 @@
package com.iailab.module.model.mcs.sche.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -42,6 +43,7 @@
    private String modelId;
    @Schema(description = "调度时间", example = "2024-09-01 00:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date scheduleTime;
    @Schema(description = "备注", example = "备注")
@@ -52,4 +54,7 @@
    @Schema(description = "项目ID")
    private String mpkprojectid;
    @Schema(description = "运行状态")
    private String runStatus;
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java
@@ -92,20 +92,19 @@
            log.info("参数: " + JSON.toJSONString(param2Values));
            //IAILMDK.run
            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)) {
            if (!modelResult.containsKey(CommonConstant.MDK_STATUS_CODE) || !modelResult.containsKey(CommonConstant.MDK_RESULT)) {
                throw new RuntimeException("模型结果异常:" + modelResult);
            }
            String statusCode = modelResult.get(CommonConstant.MDK_STATUS_CODE).toString();
            modelResult = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT);
            HashMap<String, Object> result = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT);
            //打印结果
            JSONObject jsonObjResult = new JSONObject();
            jsonObjResult.put("result", modelResult);
            jsonObjResult.put("result", result);
            log.info(String.valueOf(jsonObjResult));
            //5.返回调度结果
            scheduleResult.setResultCode(statusCode);
            scheduleResult.setResult(modelResult);
            scheduleResult.setResult(result);
            scheduleResult.setModelId(modelId);
            scheduleResult.setSchemeId(scheduleScheme.getId());
            scheduleResult.setScheduleTime(scheduleTime);