df99e46312fdd5ee830f1451e478f6658e09f9ed..5bf42aa9950058f391805e6fb8d7376f4378924b
2024-12-23 潘志宝
cumulateHandle.getCurrent
5bf42a 对比 | 目录
2024-12-23 潘志宝
Merge remote-tracking branch 'origin/master'
b651cb 对比 | 目录
2024-12-23 潘志宝
计算点查询问题修复
d64649 对比 | 目录
2024-12-23 dengzedong
sampleInfo.setPlanMap 统一获取计划数据的信息,避免重复查询
8bf553 对比 | 目录
2024-12-23 dengzedong
getInfoByIds(Set<String> pointIds) 模型输入计划数据获取、补全 模型输入mergeitem存默认生成的outputi...
50084d 对比 | 目录
2024-12-23 潘志宝
Merge branch 'master' of http://dlindusit.com:53929/r/iailab-plat
0cbbe2 对比 | 目录
2024-12-23 潘志宝
local
2fe27e 对比 | 目录
2024-12-20 dengzedong
Merge remote-tracking branch 'origin/master'
ff8b62 对比 | 目录
2024-12-20 dengzedong
计算预测项
fde993 对比 | 目录
2024-12-20 houzhongjian
1、部分接口关闭数据权限,避免只查看自己时,查询不到部门 2、外链二级菜单跳转的bug解决,当是外链菜单时,path前不额外增加“/”处理
355ca8 对比 | 目录
2024-12-20 dengzedong
修改预测项setting时清空缓存
9ca51b 对比 | 目录
2024-12-20 dengzedong
mergeItem结果存入output
de1b3b 对比 | 目录
2024-12-20 dengzedong
predictItem MODELRESULTERROR
1178da 对比 | 目录
2024-12-20 dengzedong
Merge remote-tracking branch 'origin/master'
0b5c7a 对比 | 目录
2024-12-20 dengzedong
mergeItem添加pointId,生成默认outPut信息
b40862 对比 | 目录
2024-12-20 liriming
调度建议
19f359 对比 | 目录
2024-12-19 dengzedong
预测项状态添加模型结果异常
7f0bcd 对比 | 目录
2024-12-19 dengzedong
item-chart 查询item不走缓存
864b61 对比 | 目录
2024-12-19 dengzedong
item-chart 空point校验
85b200 对比 | 目录
2024-12-19 dengzedong
模型运行测点数据获取方式修改 merge预测模型数据获取方式修改
07890e 对比 | 目录
2024-12-17 dengzedong
模型运行log
6957a3 对比 | 目录
2024-12-16 dengzedong
模型输出类型添加double类型
a6e46f 对比 | 目录
2024-12-16 houzhongjian
1、data和model模块修改logback-spring.xml日志配置 2、gateway增加server.servlet.context-pa...
961a64 对比 | 目录
2024-12-16 dengzedong
预测项数据图表查询bug,不能从缓存中查item,要最新的运行时间
b82ba2 对比 | 目录
已删除7个文件
已添加1个文件
已修改48个文件
1877 ■■■■■ 文件已修改
iailab-cloud/iailab-gateway/src/main/resources/application.yaml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/plan/PlanItemApi.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/point/DataPointApi.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/point/dto/ApiPointDTO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/plan/PlanItemApiImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/point/DataPointApiImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/plan/item/service/PlanItemService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/plan/item/service/impl/PlanItemServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/CumulateHandle.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/resources/application-local.yml 154 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/resources/application-test.yaml 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/resources/application-test_rec.yml 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/resources/logback-spring.xml 140 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-local.yaml 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestRespDTO.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkScheduleReqDTO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/common/enums/OutResultType.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/common/exception/ModelResultErrorException.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dto/MmPredictItemDTO.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/enums/ItemRunStatusEnum.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmItemResultService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSuggestSaveReqVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/factory/ItemEntityFactory.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictItemHandler.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictModelHandler.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictModuleHandler.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java 121 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemNormalHandlerImpl.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleInfoConstructor.java 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/ScheduleSampleInfoConstructor.java 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/dto/SampleInfo.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/vo/PredictResultVO.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/application-dev_rec.yaml 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/application-test_bak.yml 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/logback-spring.xml 154 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/api/user/AdminUserApiImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/auth/AuthController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml 205 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-cloud/iailab-gateway/src/main/resources/application.yaml
@@ -142,6 +142,7 @@
server:
  port: 48080
  servlet:
    context-path: /
    session:
      timeout: 120s
iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/plan/PlanItemApi.java
@@ -2,19 +2,18 @@
import com.iailab.module.data.api.plan.dto.ApiPlanDataDTO;
import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO;
import com.iailab.module.data.api.point.dto.ApiPointDTO;
import com.iailab.module.data.common.ApiDataQueryDTO;
import com.iailab.module.data.common.ApiDataValueDTO;
import com.iailab.module.data.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.*;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
/**
 * @author PanZhibao
@@ -36,10 +35,14 @@
    LinkedHashMap<String, List<ApiPlanDataDTO>> queryPlanItemRecordValue(@RequestBody ApiDataQueryDTO dto);
    @GetMapping(PREFIX + "/info/no/{itemNo}")
    @Operation(summary = "根据测点编号查询测点信息")
    @Operation(summary = "根据编号查询计划数据信息")
    ApiPlanItemDTO getInfoByNo(@PathVariable("itemNo") String itemNo);
    @GetMapping(PREFIX + "/info/id/{id}")
    @Operation(summary = "根据测点编号查询测点信息")
    @Operation(summary = "根据id查询计划数据信息")
    ApiPlanItemDTO getInfoById(@PathVariable("id") String id);
    @PostMapping(PREFIX + "/info/ids")
    @Operation(summary = "根据多个id查询计划数据信息")
    List<ApiPlanItemDTO> getInfoByIds(@RequestParam("planIds") Set<String> planIds);
}
iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/point/DataPointApi.java
@@ -7,9 +7,9 @@
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import javax.annotation.security.PermitAll;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * @author PanZhibao
@@ -30,6 +30,10 @@
    @Operation(summary = "根据测点ID查询测点信息")
    ApiPointDTO getInfoById(@PathVariable("pointId") String pointId);
    @PostMapping(PREFIX + "/info/ids")
    @Operation(summary = "根据多个测点ID查询测点信息")
    List<ApiPointDTO> getInfoByIds(@RequestParam("pointNos") Set<String> pointIds);
    @PostMapping(PREFIX + "/query-points/real-value")
    @Operation(summary = "查询多个测点当前值")
    Map<String, Object> queryPointsRealValue(@RequestParam("pointNos") List<String> pointNos);
iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/point/dto/ApiPointDTO.java
@@ -15,6 +15,9 @@
public class ApiPointDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    @Schema(description = "id", required = true)
    private String id;
    @Schema(description = "测点编码", required = true)
    private String pointNo;
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/plan/PlanItemApiImpl.java
@@ -3,6 +3,7 @@
import com.iailab.framework.common.util.object.ConvertUtils;
import com.iailab.module.data.api.plan.dto.ApiPlanDataDTO;
import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO;
import com.iailab.module.data.api.point.dto.ApiPointDTO;
import com.iailab.module.data.common.ApiDataQueryDTO;
import com.iailab.module.data.common.ApiDataValueDTO;
import com.iailab.module.data.plan.item.collection.PlanItemCollector;
@@ -16,8 +17,10 @@
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
/**
 * @author PanZhibao
@@ -65,4 +68,10 @@
        return ConvertUtils.sourceToTarget(entity, ApiPlanItemDTO.class);
    }
    @Override
    public List<ApiPlanItemDTO> getInfoByIds(Set<String> planIds) {
        List<PlanItemEntity> plans = planItemService.getInfoByIds(planIds);
        return ConvertUtils.sourceToTarget(plans,ApiPlanItemDTO.class);
    }
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/point/DataPointApiImpl.java
@@ -38,7 +38,16 @@
    @Override
    public ApiPointDTO getInfoById(String pointId) {
        return ConvertUtils.sourceToTarget(daPointService.getSimpleInfoById(pointId), ApiPointDTO.class);
        return daPointService.getSimpleInfoById(pointId);
    }
    @Override
    public List<ApiPointDTO> getInfoByIds(Set<String> pointIds) {
        List<ApiPointDTO> result = new ArrayList<>(pointIds.size());
        for (String pointId : pointIds) {
            result.add(daPointService.getSimpleInfoById(pointId));
        }
        return result;
    }
    @Override
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/plan/item/service/PlanItemService.java
@@ -2,6 +2,7 @@
import com.iailab.framework.common.pojo.PageResult;
import com.iailab.framework.common.service.BaseService;
import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO;
import com.iailab.module.data.plan.item.entity.PlanItemEntity;
import com.iailab.module.data.plan.item.vo.PlanItemDataVO;
import com.iailab.module.data.plan.item.vo.PlanItemPageReqVO;
@@ -9,6 +10,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * @author PanZhibao
@@ -32,4 +34,6 @@
    void delete(String id);
    List<PlanItemDataVO> getSourceValue(Map<String, Object> params);
    List<PlanItemEntity> getInfoByIds(Set<String> planIds);
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/plan/item/service/impl/PlanItemServiceImpl.java
@@ -4,6 +4,7 @@
import com.iailab.framework.common.pojo.PageResult;
import com.iailab.framework.common.service.impl.BaseServiceImpl;
import com.iailab.framework.common.util.object.BeanUtils;
import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO;
import com.iailab.module.data.plan.item.dao.PlanItemDao;
import com.iailab.module.data.plan.item.entity.PlanItemEntity;
import com.iailab.module.data.plan.item.service.PlanItemService;
@@ -78,4 +79,9 @@
    public List<PlanItemDataVO> getSourceValue(Map<String, Object> params) {
        return baseDao.getSourceValue(params);
    }
    @Override
    public List<PlanItemEntity> getInfoByIds(Set<String> planIds) {
        return baseDao.selectBatchIds(planIds);
    }
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java
@@ -116,6 +116,7 @@
            data.putAll(constantHandle.getCurrent(pointNos));
            data.putAll(measureHandle.getCurrent(pointNos));
            data.putAll(calculateHandle.getCurrent(pointNos));
            data.putAll(cumulateHandle.getCurrent(pointNos));
            return data;
        } catch (Exception ex) {
            return R.error(ex.getMessage());
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/CumulateHandle.java
@@ -9,12 +9,14 @@
import com.iailab.module.data.influxdb.pojo.InfluxPointValuePOJO;
import com.iailab.module.data.point.collection.utils.GenInfluxPointValueUtils;
import com.iailab.module.data.point.dto.DaPointDTO;
import com.iailab.module.data.point.service.DaPointService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
@@ -28,6 +30,9 @@
@Slf4j
@Component
public class CumulateHandle {
    @Resource
    private DaPointService daPointService;
    @Autowired
    @Lazy
@@ -59,6 +64,20 @@
        return result;
    }
    public Map<String, Object> getCurrent(List<String> pointNos) {
        Map<String, Object> data = new HashMap<>();
        List<DaPointDTO> pointMathList = daPointService.getCumulatePoint(pointNos);
        if (CollectionUtils.isEmpty(pointMathList)) {
            return data;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.MILLISECOND, 0);
        pointMathList.forEach(item -> {
            data.put(item.getPointNo(), singleCompute(item, calendar.getTime()));
        });
        return data;
    }
    private Object singleCompute(DaPointDTO dto, Date collectTime) {
        ApiPointDTO pointDTO = dataPointApi.getInfoByNo(dto.getMomentPoint());
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java
@@ -1,6 +1,7 @@
package com.iailab.module.data.point.service;
import com.iailab.framework.common.pojo.PageResult;
import com.iailab.module.data.api.point.dto.ApiPointDTO;
import com.iailab.module.data.point.dto.DaPointDTO;
import com.iailab.module.data.point.vo.*;
@@ -17,7 +18,7 @@
    DaPointDTO info(String id);
    DaPointDTO getSimpleInfoById(String id);
    ApiPointDTO getSimpleInfoById(String id);
    DaPointDTO getSimpleInfoByNo(String no);
@@ -45,6 +46,8 @@
    List<DaPointDTO> getCumulatePoint(String freq);
    List<DaPointDTO> getCumulatePoint(List<String> pointNos);
    List<DaPointDTO> getCumulatePoint(DaPointPageReqVO reqVO);
    DaPointDTO getByNo(String pointNo);
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
@@ -9,6 +9,7 @@
import com.iailab.framework.common.pojo.PageResult;
import com.iailab.framework.common.util.object.BeanUtils;
import com.iailab.framework.common.util.object.ConvertUtils;
import com.iailab.module.data.api.point.dto.ApiPointDTO;
import com.iailab.module.data.channel.common.service.ChannelSourceService;
import com.iailab.module.data.common.enums.CommonConstant;
import com.iailab.module.data.common.enums.IsEnableEnum;
@@ -67,7 +68,7 @@
    @Resource
    private DaPointCollectStatusService daPointCollectStatusService;
    private static Map<String, DaPointDTO> pointIdMap = new ConcurrentHashMap<>();
    private static Map<String, ApiPointDTO> pointIdMap = new ConcurrentHashMap<>();
    private static Map<String, DaPointDTO> pointNoMap = new ConcurrentHashMap<>();
@@ -112,16 +113,16 @@
    }
    @Override
    public DaPointDTO getSimpleInfoById(String id) {
    public ApiPointDTO getSimpleInfoById(String id) {
        if (pointIdMap.containsKey(id)) {
            return pointIdMap.get(id);
        }
        DaPointDTO dto = ConvertUtils.sourceToTarget(daPointDao.selectById(id), DaPointDTO.class);
        ApiPointDTO dto = ConvertUtils.sourceToTarget(daPointDao.selectById(id), ApiPointDTO.class);
        if (dto == null) {
            return null;
        }
        pointIdMap.put(id, dto);
        return pointIdMap.get(id);
        return dto;
    }
    @Override
@@ -332,6 +333,15 @@
    }
    @Override
    public List<DaPointDTO> getCumulatePoint(List<String> pointNos) {
        Map<String, Object> params = new HashMap<>(3);
        params.put("pointType", PointTypeEnum.CUMULATE.getCode());
        params.put("isEnable", CommonConstant.IS_ENABLE);
        params.put("pointNos", pointNos);
        return daPointDao.getCumulatePoint(params);
    }
    @Override
    public List<DaPointDTO> getCumulatePoint(DaPointPageReqVO reqVO) {
        Map<String, Object> params = new HashMap<>(3);
        params.put("pointType", PointTypeEnum.CUMULATE.getCode());
iailab-module-data/iailab-module-data-biz/src/main/resources/application-local.yml
文件已删除
iailab-module-data/iailab-module-data-biz/src/main/resources/application-test.yaml
文件已删除
iailab-module-data/iailab-module-data-biz/src/main/resources/application-test_rec.yml
文件已删除
iailab-module-data/iailab-module-data-biz/src/main/resources/logback-spring.xml
@@ -1,86 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
    <property name="LOG_TEMP" value="./logs"/>
<configuration>
    <!-- 引用 Spring Boot 的 logback 基础配置 -->
    <include resource="org/springframework/boot/logging/logback/defaults.xml" />
    <!-- <include resource="org/springframework/boot/logging/logback/base.xml" /> -->
    <logger name="org.springframework.web" level="INFO"/>
    <logger name="org.springboot.sample" level="TRACE" />
    <!-- 变量 iailab.info.base-package,基础业务包 -->
    <springProperty scope="context" name="iailab.info.base-package" source="iailab.info.base-package"/>
    <!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
    <property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
    <!-- 开发、测试环境 -->
    <springProfile name="dev,test,prod">
        <logger name="org.springframework.web" level="INFO"/>
        <logger name="org.springboot.sample" level="INFO" />
        <logger name="com.iailab" level="DEBUG" />
    </springProfile>
    <!-- 生产环境 -->
    <!--<springProfile name="prod">-->
    <!--<logger name="org.springframework.web" level="ERROR"/>-->
    <!--<logger name="org.springboot.sample" level="ERROR" />-->
    <!--<logger name="io.renren" level="ERROR" />-->
    <!--</springProfile>-->
    <!-- 日志文件存放路径 -->
    <property name="log_home" value="./logs" />
    <!-- 日志输出格式 -->
    <!--生产用-->
    <property name="log.pattern" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] | [%thread][%-5level] | [%logger{20}.%method,line : %line] %msg%n" />
    <!--本地测试使用-->
    <!--<property name="log.pattern" value="[%boldGreen(%d{yyyy-MM-dd HH:mm:ss.SSS})] | [%highlight(%thread][%-5level)] | [%boldYellow(%logger{20}.%method,%line)] %msg%n" />-->
    <!-- 日志输出格式【控制台】 -->
    <!--<property name="log.pattern" value="%date{yyyy-MM-dd HH:mm:ss} | [ line: %line ] | %boldGreen(%thread) | %highlight(%-5level) | %boldYellow(%logger).%method | %msg%n"/>-->
    <!-- 控制台输出 -->
    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <!--<pattern>${logPatternConsoleLog}</pattern>-->
            <pattern>${log.pattern}</pattern>
    <!-- 控制台 Appender -->
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">     
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
                <pattern>${PATTERN_DEFAULT}</pattern>
            </layout>
        </encoder>
    </appender>
    <logger name="m-shop-mybatis-sql" level="debug"></logger>
    <!-- debug级别设置 -->
    <appender name="file_debug"  class="ch.qos.logback.core.rolling.RollingFileAppender">
        <prudent>true</prudent>
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <!--过滤 DEBUG-->
            <level>DEBUG</level>
            <!--匹配到就禁止-->
            <!--<onMatch>ACCEPT</onMatch>-->
            <!--没有匹配到就允许-->
            <!--<onMismatch>DENY</onMismatch>-->
        </filter>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!--<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">-->
            <!--日志文件输出的文件名-->
            <!--<FileNamePattern>${log_home}/log-info.%d{yyyy-MM-dd}.%i.log</FileNamePattern>-->
            <FileNamePattern>${log_home}/log-debug.%d{yyyy-MM-dd}.log</FileNamePattern>
            <!--<maxFileSize>100MB</maxFileSize>-->
            <!-- 日志最大的历史 7天 -->
            <maxHistory>7</maxHistory>
            <totalSizeCap>2GB</totalSizeCap>
            <cleanHistoryOnStart>true</cleanHistoryOnStart>
    <!-- 文件 Appender -->
    <!-- 参考 Spring Boot 的 file-appender.xml 编写 -->
    <appender name="FILE"  class="ch.qos.logback.core.rolling.RollingFileAppender">
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
                <pattern>${PATTERN_DEFAULT}</pattern>
            </layout>
        </encoder>
        <!-- 日志文件名 -->
        <file>${LOG_FILE}</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <!-- 滚动后的日志文件名 -->
            <fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern>
            <!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
            <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
            <!-- 日志文件,到达多少容量,进行滚动 -->
            <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
            <!-- 日志文件的总大小,0 表示不限制 -->
            <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
            <!-- 日志文件的保留天数 -->
            <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory>
        </rollingPolicy>
        <!--<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">-->
        <!--&lt;!&ndash; 单文件最大50MB &ndash;&gt;-->
        <!--<maxFileSize>50MB</maxFileSize>-->
        <!--</triggeringPolicy>-->
        <encoder>
            <pattern>${log.pattern}</pattern>
    </appender>
    <!-- 异步写入日志,提升性能 -->
    <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
        <!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 -->
        <discardingThreshold>0</discardingThreshold>
        <!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 -->
        <queueSize>256</queueSize>
        <appender-ref ref="FILE"/>
    </appender>
    <!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 -->
    <appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
                <pattern>${PATTERN_DEFAULT}</pattern>
            </layout>
        </encoder>
    </appender>
    <!-- 系统模块日志级别控制  -->
    <!--<logger name="com.btrh" level="info" />-->
    <!-- Spring日志级别控制  -->
    <!--<logger name="org.springframework" level="info" />-->
    <!--系统操作日志-->
    <root level="INFO">
        <appender-ref ref="console" />
        <appender-ref ref="file_debug" />
    </root>
    <!-- 本地环境 -->
    <springProfile name="local">
        <root level="INFO">
            <appender-ref ref="STDOUT"/>
            <appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 -->
            <appender-ref ref="ASYNC"/>  <!-- 本地环境下,如果不想打印日志,可以注释掉本行 -->
        </root>
    </springProfile>
    <!-- 其它环境 -->
    <springProfile name="dev,test,stage,prod,default">
        <root level="INFO">
            <appender-ref ref="STDOUT"/>
            <appender-ref ref="ASYNC"/>
            <appender-ref ref="GRPC"/>
        </root>
    </springProfile>
</configuration>
iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml
@@ -247,6 +247,12 @@
            <if test="minfreqid != null and minfreqid != ''">
                AND t1.minfreqid = #{minfreqid}
            </if>
            <if test="pointNos != null">
                AND t1.point_no in
                <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
                    #{item}
                </foreach>
            </if>
        </where>
    </select>
@@ -272,6 +278,12 @@
            <if test="minfreqid != null and minfreqid != ''">
                AND t1.minfreqid = #{minfreqid}
            </if>
            <if test="pointNos != null">
                AND t1.point_no in
                <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
                    #{item}
                </foreach>
            </if>
        </where>
    </select>
iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-local.yaml
文件已删除
iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestRespDTO.java
@@ -4,6 +4,7 @@
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@@ -23,13 +24,19 @@
    private String id;
    @Schema(description = "标题")
    @NotNull(message = "应用编号不能为空")
    private String title;
    @Schema(description = "内容")
    @NotNull(message = "应用编号不能为空")
    private String content;
    @Schema(description = "排序")
    @NotNull(message = "应用编号不能为空")
    private Integer sort;
    @Schema(description = "方案ID")
    private String schemeId;
    @Schema(description = "预警ID")
    private String alarmId;
@@ -41,13 +48,14 @@
    private String modelId;
    @Schema(description = "调整对象")
    private String adjustObj;
    @NotNull(message = "应用编号不能为空")
    private String scheduleObj;
    @Schema(description = "调整介质")
    private String adjustMedium;
    @Schema(description = "调整类型")
    private String scheduleType;
    @Schema(description = "调整策略")
    private String adjustStrategy;
    private String scheduleStrategy;
    @Schema(description = "调整方式")
    private String adjustMode;
@@ -69,9 +77,18 @@
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date adjustEnd;
    @Schema(description = "建议时间")
    private Date suggestTime;
    @Schema(description = "调度时间")
    private Date scheduleTime;
    @Schema(description = "状态(0未处理 1已采纳 2已忽略)")
    private Integer status;
    @Schema(description = "处理人")
    private String handler;
    @Schema(description = "处理时间")
    private Date handleTime;
    @Schema(description = "创建时间")
    private Date createTime;
}
iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkScheduleReqDTO.java
@@ -1,5 +1,6 @@
package com.iailab.module.model.api.mdk.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -22,5 +23,6 @@
    @Schema(description = "调度方案时间")
    @NotNull(message="调度方案时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date scheduleTime;
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
@@ -21,6 +21,7 @@
import com.iailab.module.model.mcs.sche.entity.StScheduleSuggestEntity;
import com.iailab.module.model.mcs.sche.service.StScheduleSchemeService;
import com.iailab.module.model.mcs.sche.service.StScheduleSuggestService;
import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestSaveReqVO;
import com.iailab.module.model.mdk.vo.ItemVO;
import com.iailab.module.model.mpk.service.ChartService;
import lombok.extern.slf4j.Slf4j;
@@ -134,7 +135,7 @@
        Date predictTime = reqVO.getPredictTime();
        if (predictTime == null) {
            MmItemOutputEntity output = mmItemOutputService.getOutPutById(reqVO.getOutIds().get(0));
            ItemVO predictItem = mmPredictItemService.getItemById(output.getItemid());
            ItemVO predictItem = mmPredictItemService.getItemByIdFromCache(output.getItemid());
            if (predictItem.getLastTime() != null) {
                predictTime = predictItem.getLastTime();
            } else {
@@ -274,7 +275,9 @@
        for (MmItemOutputEntity out : outs) {
            legend.add(out.getResultName());
            PreDataSampleViewRespDTO viewDto = new PreDataSampleViewRespDTO();
            viewDto.setRealData(getHisData(out.getPointid(), startTime, endTime));
            if (StringUtils.isNotBlank(out.getPointid())) {
                viewDto.setRealData(getHisData(out.getPointid(), startTime, endTime));
            }
            viewDto.setPreDataN(mmItemResultService.getData(out.getId(), startTime, endTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
            viewMap.put(out.getResultName(), viewDto);
        }
@@ -517,6 +520,7 @@
    @Override
    public Boolean createScheduleSuggest(ScheduleSuggestRespDTO dto) {
        stScheduleSuggestService.create(ConvertUtils.sourceToTarget(dto, StScheduleSuggestSaveReqVO.class));
        return true;
    }
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java
@@ -97,7 +97,16 @@
                    intervalTime = (int) (reqDTO.getPredictTime().getTime() - module.getPredicttime().getTime()) / (1000 * 60);
                }
                List<ItemVO> predictItemList = mmPredictItemService.getByModuleId(module.getId());
                Map<String, PredictResultVO> predictResultMap = predictModuleHandler.predict(predictItemList, reqDTO.getPredictTime(), intervalTime);
                Map<String, PredictResultVO> predictResultMap = new HashMap<>(predictItemList.size());
                // 分组,先运行normal预测项,再将结果传递给merge预测项
                List<ItemVO> normalItems = predictItemList.stream().filter(e -> e.getItemType().equals("NormalItem")).collect(Collectors.toList());
                if (!CollectionUtils.isEmpty(normalItems)) {
                    predictModuleHandler.predict(normalItems, reqDTO.getPredictTime(), intervalTime,predictResultMap);
                    List<ItemVO> mergeItems = predictItemList.stream().filter(e -> e.getItemType().equals("MergeItem")).collect(Collectors.toList());
                    if (!CollectionUtils.isEmpty(mergeItems)) {
                        predictModuleHandler.predict(mergeItems, reqDTO.getPredictTime(), intervalTime,predictResultMap);
                    }
                }
                // 更新Module时间
                dmModuleService.updatePredictTime(module.getId(), reqDTO.getPredictTime());
                if (reqDTO.getIsResult() == null || !reqDTO.getIsResult()) {
@@ -141,27 +150,31 @@
    @Override
    public MdkPredictItemRespDTO predictItem(MdkPredictReqDTO reqDTO) {
        MdkPredictItemRespDTO resp = new MdkPredictItemRespDTO();
        try {
            log.info("预测计算开始: " + System.currentTimeMillis());
            Map<String, List<MdkPredictDataDTO>> predictData = new HashMap<>();
            ItemVO predictItem = itemEntityFactory.getItemByItemNo(reqDTO.getItemNo());
            PredictItemHandler predictItemHandler = predictItemFactory.create(predictItem.getId());
            PredictResultVO predictResult = predictItemHandler.predict(reqDTO.getPredictTime(), predictItem);
            Map<String, List<DataValueVO>> resultMap = predictResultHandler.convertToPredictData(predictResult);
            if (!CollectionUtils.isEmpty(resultMap)) {
                for (Map.Entry<String, List<DataValueVO>> entry : resultMap.entrySet()) {
                    List<MdkPredictDataDTO>  data = ConvertUtils.sourceToTarget(entry.getValue(), MdkPredictDataDTO.class);
                    predictData.put(entry.getKey(), data);
                }
            ItemVO itemByItemNo = mmPredictItemService.getItemByItemNo(reqDTO.getItemNo());
            List<ItemVO> predictItemList = new ArrayList<>();
            predictItemList.add(itemByItemNo);
            Map<String, PredictResultVO> predictResultMap = new HashMap<>(predictItemList.size());
            predictModuleHandler.predict(predictItemList, reqDTO.getPredictTime(), 0,predictResultMap);
            Map<String, List<MdkPredictDataDTO>> itemPredictData = new HashMap<>();
            Map<String, List<DataValueVO>> predictLists = predictResultHandler.convertToPredictData2(predictResultMap.get(reqDTO.getItemNo()));
            for (Map.Entry<String, List<DataValueVO>> dataListEntry : predictLists.entrySet()) {
                List<MdkPredictDataDTO> predictData = dataListEntry.getValue().stream().map(t -> {
                    MdkPredictDataDTO dto1 = new MdkPredictDataDTO();
                    dto1.setDataTime(t.getDataTime());
                    dto1.setDataValue(t.getDataValue());
                    return dto1;
                }).collect(Collectors.toList());
                itemPredictData.put(dataListEntry.getKey(), predictData);
            }
            resp.setPredictData(predictData);
            resp.setItemId(predictItem.getId());
            resp.setItemId(reqDTO.getItemNo());
            resp.setPredictTime(reqDTO.getPredictTime());
            log.info("预测计算结束: " + System.currentTimeMillis());
        } catch (Exception ex) {
            log.info("预测计算异常: " + System.currentTimeMillis(), ex);
            return resp;
            resp.setPredictData(itemPredictData);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return resp;
@@ -198,7 +211,7 @@
            log.info("预测计算结束: " + System.currentTimeMillis());
        } catch (Exception ex) {
            log.info("调度计算异常: " + System.currentTimeMillis());
            ex.printStackTrace();
//            ex.printStackTrace();
            return resp;
        }
        return resp;
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/common/enums/OutResultType.java
@@ -12,7 +12,8 @@
@AllArgsConstructor
public enum OutResultType {
    D1(1, "一维数组"),
    D2(2, "二维数组");
    D2(2, "二维数组"),
    D(3, "二维数组");
    private Integer code;
    private String desc;
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/common/exception/ModelResultErrorException.java
对比新文件
@@ -0,0 +1,51 @@
package com.iailab.module.model.common.exception;
/**
 * 模型结果错误异常
 */
public class ModelResultErrorException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    private String msg;
    private int code = 200;
    public ModelResultErrorException(String msg) {
        super(msg);
        this.msg = msg;
    }
    public ModelResultErrorException(String msg, Throwable e) {
        super(msg, e);
        this.msg = msg;
    }
    public ModelResultErrorException(String msg, int code) {
        super(msg);
        this.msg = msg;
        this.code = code;
    }
    public ModelResultErrorException(String msg, int code, Throwable e) {
        super(msg, e);
        this.msg = msg;
        this.code = code;
    }
    public String getMsg() {
        return msg;
    }
    public void setMsg(String msg) {
        this.msg = msg;
    }
    public int getCode() {
        return code;
    }
    public void setCode(int code) {
        this.code = code;
    }
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dto/MmPredictItemDTO.java
@@ -32,4 +32,9 @@
    private List<MmModelParamEntity> mmModelParamList;
    private List<MmItemResultEntity> mmItemResultList;
    /**
     * 计算预测项真实数据点
     */
    private String pointId;
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/enums/ItemRunStatusEnum.java
@@ -13,7 +13,9 @@
public enum ItemRunStatusEnum {
    PROCESSING(1, "处理中"),
    SUCCESS(2, "成功"),
    FAIL(3, "失败");
    FAIL(3, "失败"),
    MODELRESULTERROR(4, "模型结果异常"),
    MODELRESULTSAVEERROR(5, "模型结果保存异常");
    private Integer code;
    private String desc;
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmItemResultService.java
@@ -1,5 +1,6 @@
package com.iailab.module.model.mcs.pre.service;
import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
import com.iailab.module.model.mdk.vo.DataValueVO;
import java.util.Date;
@@ -17,4 +18,6 @@
    List<DataValueVO> getPredictValue(String outputid, Date startTime, Date endTime);
    List<Object[]> getData(String outputid, Date startTime, Date endTime, String timeFormat);
    void savePredictValue(Map<MmItemOutputEntity, Double> predictDoubleValues, Date predictTime);
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java
@@ -8,7 +8,6 @@
import com.iailab.module.model.mdk.vo.ItemVO;
import com.iailab.module.model.mdk.vo.MergeItemVO;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -28,6 +27,7 @@
    ItemVO getItemByItemNo(String itemNo);
    ItemVO getItemByIdFromCache(String itemId);
    ItemVO getItemById(String itemId);
    ItemVO getItemByOutPutId(String outPutId);
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iailab.framework.common.util.date.DateUtils;
import com.iailab.module.model.mcs.pre.dao.MmItemResultDao;
import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
import com.iailab.module.model.mcs.pre.entity.MmItemResultEntity;
import com.iailab.module.model.mcs.pre.entity.MmItemResultJsonEntity;
import com.iailab.module.model.mcs.pre.service.MmItemResultService;
@@ -138,4 +139,19 @@
        });
        return result;
    }
    @Override
    public void savePredictValue(Map<MmItemOutputEntity, Double> predictDoubleValues, Date predictTime) {
        for (Map.Entry<MmItemOutputEntity, Double> entry : predictDoubleValues.entrySet()) {
            MmItemResultJsonEntity resultJson = new MmItemResultJsonEntity();
            resultJson.setId(UUID.randomUUID().toString());
            resultJson.setOutputid(entry.getKey().getId());
            resultJson.setPredicttime(predictTime);
            resultJson.setCumulant(String.valueOf(entry.getValue()));
            Map<String, Object> map4 = new HashMap(2);
            map4.put("TABLENAME", "T_MM_ITEM_RESULT_JSON");
            map4.put("entity", resultJson);
            mmItemResultDao.savePredictJsonValue(map4);
        }
    }
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java
@@ -57,5 +57,7 @@
    @Override
    public void updatePyFile(String pyModule, String fileName) {
        baseMapper.updatePyFile(pyModule + "." + fileName.substring(0,fileName.lastIndexOf("_")+1),pyModule + "." + fileName);
        // 清空缓存
        modelIdMap.clear();
    }
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java
@@ -118,6 +118,14 @@
            MmPredictMergeItemEntity mMmPredictMergeItem = mmPredictItemDto.getMmPredictMergeItem();
            mMmPredictMergeItem.setItemid(predictItem.getId());
            mmPredictMergeItemService.savePredictMergeItem(mMmPredictMergeItem);
            // 添加一条默认output
            List<MmItemOutputEntity> mergeItemOutput = new ArrayList<>(1);
            MmItemOutputEntity entity = new MmItemOutputEntity();
            entity.setPointid(mmPredictItemDto.getPointId());
            entity.setResultName(mmPredictItemDto.getMmPredictItem().getItemname());
            entity.setResultstr("result");
            mergeItemOutput.add(entity);
            mmPredictItemDto.setMmItemOutputList(mergeItemOutput);
        }
        mmPredictItemDao.insert(predictItem);
        DmModuleItemEntity dmModuleItem = mmPredictItemDto.getDmModuleItem();
@@ -160,6 +168,19 @@
        } else if (itemType != null && ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) {
            MmPredictMergeItemEntity mMmPredictMergeItem = mmPredictItemDto.getMmPredictMergeItem();
            mmPredictMergeItemService.update(mMmPredictMergeItem);
            // 修改默认output
            List<MmItemOutputEntity> mmItemOutputList = mmPredictItemDto.getMmItemOutputList();
            if (CollectionUtils.isEmpty(mmItemOutputList)) {
                mmItemOutputList = new ArrayList<>(1);
                MmItemOutputEntity entity = new MmItemOutputEntity();
                entity.setPointid(mmPredictItemDto.getPointId());
                entity.setResultName(mmPredictItemDto.getMmPredictItem().getItemname());
                entity.setResultstr("result");
                mmItemOutputList.add(entity);
                mmPredictItemDto.setMmItemOutputList(mmItemOutputList);
            } else {
                mmPredictItemDto.getMmItemOutputList().forEach(e -> e.setPointid(mmPredictItemDto.getPointId()));
            }
        }
        DmModuleItemEntity dmModuleItem = mmPredictItemDto.getDmModuleItem();
        if (!"".equals(dmModuleItem.getId()) && dmModuleItem.getId() != null) {
@@ -215,6 +236,9 @@
            mmPredictItemDto.setMmModelParamList(new ArrayList<>());
            mmPredictItemDto.setMmPredictMergeItem(new MmPredictMergeItemEntity());
            mmPredictItemDto.setMmPredictMergeItem(mmPredictMergeItemService.getByItemid(id));
            if (!CollectionUtils.isEmpty(mmPredictItemDto.getMmItemOutputList())) {
                mmPredictItemDto.setPointId(mmPredictItemDto.getMmItemOutputList().get(0).getPointid());
            }
        }
        return mmPredictItemDto;
    }
@@ -258,7 +282,7 @@
    }
    @Override
    public ItemVO getItemById(String itemId) {
    public ItemVO getItemByIdFromCache(String itemId) {
        if (StringUtils.isBlank(itemId)) {
            return null;
        }
@@ -275,6 +299,17 @@
    }
    @Override
    public ItemVO getItemById(String itemId) {
        Map<String, Object> params = new HashMap<>(1);
        params.put("ITEMID", itemId);
        List<ItemVO> list = mmPredictItemDao.getItem(params);
        if (CollectionUtils.isEmpty(list)) {
            return null;
        }
        return list.get(0);
    }
    @Override
    public ItemVO getItemByOutPutId(String outPutId) {
        if (StringUtils.isBlank(outPutId)) {
            return null;
@@ -284,7 +319,7 @@
            return null;
        }
        String itemId = outPutById.getItemid();
        return getItemById(itemId);
        return getItemByIdFromCache(itemId);
    }
    @Override
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java
@@ -63,7 +63,7 @@
    @Override
    public List<StScheduleSchemeDTO> list(Map<String, Object> params) {
        QueryWrapper<StScheduleSchemeEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("trigger_method", "1");
        queryWrapper.eq("trigger_method", params.get("trigger_method"));
        queryWrapper.eq("trigger_condition", params.get("trigger_condition"));
        List<StScheduleSchemeEntity> list = baseDao.selectList(queryWrapper);
        return ConvertUtils.sourceToTarget(list, StScheduleSchemeDTO.class);
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSuggestSaveReqVO.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;
@@ -66,9 +67,11 @@
    private BigDecimal adjustTimes;
    @Schema(description = "调整开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date adjustStart;
    @Schema(description = "调整结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date adjustEnd;
    @Schema(description = "调度时间")
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/factory/ItemEntityFactory.java
@@ -77,7 +77,7 @@
     * @return
     */
    public ItemVO getItemById(String itemId) {
        ItemVO ItemVO = mmPredictItemService.getItemById(itemId);
        ItemVO ItemVO = mmPredictItemService.getItemByIdFromCache(itemId);
        if (!ItemVOHashMap.containsKey(itemId)) {
            if (ItemVO != null) {
                ItemVOHashMap.put(itemId, ItemVO);
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictItemHandler.java
@@ -1,10 +1,12 @@
package com.iailab.module.model.mdk.predict;
import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum;
import com.iailab.module.model.mdk.common.exceptions.ItemInvokeException;
import com.iailab.module.model.mdk.vo.ItemVO;
import com.iailab.module.model.mdk.vo.PredictResultVO;
import java.util.Date;
import java.util.Map;
/**
 * @author PanZhibao
@@ -21,5 +23,5 @@
     * @return
     * @throws ItemInvokeException
     */
    PredictResultVO predict(Date predictTime, ItemVO predictItemDto) throws ItemInvokeException;
    PredictResultVO predict(Date predictTime, ItemVO predictItemDto, Map<String, double[]> predictValueMap) throws ItemInvokeException;
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictModelHandler.java
@@ -1,6 +1,7 @@
package com.iailab.module.model.mdk.predict;
import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity;
import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum;
import com.iailab.module.model.mdk.common.exceptions.ModelInvokeException;
import com.iailab.module.model.mdk.vo.PredictResultVO;
@@ -21,5 +22,5 @@
     * @return
     * @throws ModelInvokeException
     */
    PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel) throws ModelInvokeException;
    PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel,String itemName) throws ModelInvokeException;
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictModuleHandler.java
@@ -1,5 +1,7 @@
package com.iailab.module.model.mdk.predict;
import com.iailab.module.model.common.exception.ModelResultErrorException;
import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum;
import com.iailab.module.model.mcs.pre.enums.ItemStatus;
import com.iailab.module.model.mcs.pre.service.MmItemStatusService;
@@ -9,6 +11,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.text.MessageFormat;
import java.time.Duration;
@@ -46,54 +49,68 @@
     * @param intervalTime
     * @return
     */
    public Map<String, PredictResultVO> predict(List<ItemVO> predictItemList, Date predictTime, int intervalTime) {
        Map<String, PredictResultVO> result = new HashMap<>();
        PredictResultVO predictResult = new PredictResultVO();
    public void predict(List<ItemVO> predictItemList, Date predictTime, int intervalTime,Map<String, PredictResultVO> predictResultMap) {
        Map<String, double[]> predictValueMap = null;
        if (!CollectionUtils.isEmpty(predictResultMap)) {
            // 将predictResultMap处理成Map<outPutId, double[]>
            predictValueMap = new HashMap<>();
            for (Map.Entry<String, PredictResultVO> entry : predictResultMap.entrySet()) {
                for (Map.Entry<MmItemOutputEntity, double[]> mmItemOutputEntityEntry : entry.getValue().getPredictMatrixs().entrySet()) {
                    predictValueMap.put(mmItemOutputEntityEntry.getKey().getId(),mmItemOutputEntityEntry.getValue());
                }
            }
        }
        for (ItemVO predictItem : predictItemList) {
            PredictResultVO predictResult;
            if (!predictItem.getStatus().equals(ItemStatus.STATUS1.getCode())) {
                continue;
            }
            Long totalDur = 0L;
            ItemRunStatusEnum itemRunStatusEnum = ItemRunStatusEnum.PROCESSING;
            try {
                mmItemStatusService.recordStatus(predictItem.getId(), ItemRunStatusEnum.PROCESSING, totalDur, predictTime);
                mmItemStatusService.recordStatus(predictItem.getId(), itemRunStatusEnum, totalDur, predictTime);
                PredictItemHandler predictItemHandler = predictItemFactory.create(predictItem.getId());
                long start = System.currentTimeMillis();
                try {
                    // 预测项开始预测
                    predictResult = predictItemHandler.predict(predictTime, predictItem);
                    predictResult = predictItemHandler.predict(predictTime, predictItem, predictValueMap);
                } catch (ModelResultErrorException e) {
                    itemRunStatusEnum = ItemRunStatusEnum.MODELRESULTERROR;
                    continue;
                } catch (Exception e) {
                    e.printStackTrace();
                    log.error(String.valueOf(e));
                    mmItemStatusService.recordStatus(predictItem.getId(), ItemRunStatusEnum.FAIL, totalDur, predictTime);
                    itemRunStatusEnum = ItemRunStatusEnum.FAIL;
                    continue;
                }
                long end = System.currentTimeMillis();
                Long drtPre = end - start;
                log.info(MessageFormat.format("预测项:{0},预测时间:{1}ms", predictItem.getItemName(), drtPre));
                totalDur = totalDur + drtPre;
                predictResult.setGranularity(predictItem.getGranularity());
                predictResult.setT(intervalTime);
                predictResult.setSaveIndex(predictItem.getSaveIndex());
                predictResult.setLt(1);
                predictResultMap.put(predictItem.getItemNo(), predictResult);
                // 保存预测结果
                predictResultHandler.savePredictResult(predictResult);
                long endSave = System.currentTimeMillis();
                Long drtSave = endSave - end;
                log.info(MessageFormat.format("预测项:{0},保存时间:{1}ms", predictItem.getItemName(),
                        drtSave));
                totalDur = totalDur + drtSave;
                mmItemStatusService.recordStatus(predictItem.getId(), ItemRunStatusEnum.SUCCESS, totalDur, predictTime);
                result.put(predictItem.getItemNo(), predictResult);
                try {
                    predictResultHandler.savePredictResult(predictResult);
                } catch (Exception e) {
                    itemRunStatusEnum = ItemRunStatusEnum.MODELRESULTSAVEERROR;
                    throw new RuntimeException("模型结果保存异常,result:" + predictResult);
                }
                itemRunStatusEnum = ItemRunStatusEnum.SUCCESS;
//                long endSave = System.currentTimeMillis();
//                Long drtSave = endSave - end;
//                log.info(MessageFormat.format("预测项:{0},保存时间:{1}ms", predictItem.getItemName(),
//                        drtSave));
//                totalDur = totalDur + drtSave;
            } catch (Exception e) {
                e.printStackTrace();
                log.error(MessageFormat.format("预测项编号:{0},预测项名称:{1},预测失败:{2} 预测时刻:{3}",
                        predictItem.getId(), predictItem.getItemName(), e.getMessage(), predictTime));
                mmItemStatusService.recordStatus(predictItem.getId(), ItemRunStatusEnum.FAIL, totalDur, predictTime);
            } finally {
                mmItemStatusService.recordStatus(predictItem.getId(), itemRunStatusEnum, totalDur, predictTime);
            }
        }
        return result;
    }
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java
@@ -29,12 +29,12 @@
     */
    public Map<String, List<DataValueVO>> convertToPredictData(PredictResultVO predictResult) {
        Map<String, List<DataValueVO>> resultMap = new HashMap<>();
        List<MmItemOutputEntity> itemOutPutList = itemEntityFactory.getOutPutByItemId(predictResult.getPredictId());
        if (!CollectionUtils.isEmpty(predictResult.getPredictList())) {
            resultMap.put(itemOutPutList.get(0).getId(), predictResult.getPredictList());
            return resultMap;
        }
//        List<MmItemOutputEntity> itemOutPutList = itemEntityFactory.getOutPutByItemId(predictResult.getPredictId());
//
//        if (!CollectionUtils.isEmpty(predictResult.getPredictList())) {
//            resultMap.put(itemOutPutList.get(0).getId(), predictResult.getPredictList());
//            return resultMap;
//        }
        Map<com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity, double[]> predictMatrixs = predictResult.getPredictMatrixs();
        HashMap<String,List<DataValueVO>> predictLists = new HashMap<>();
        for (Map.Entry<com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity, double[]> entry : predictMatrixs.entrySet()) {
@@ -91,6 +91,10 @@
    public void savePredictResult(PredictResultVO predictResult) {
        Map<String, List<DataValueVO>> resultMap = convertToPredictData(predictResult);
        mmItemResultService.savePredictValue(resultMap, predictResult.getLt(), "n", predictResult.getPredictTime());
        // 存double类型输出
        if (!CollectionUtils.isEmpty(predictResult.getPredictDoubleValues())) {
            mmItemResultService.savePredictValue(predictResult.getPredictDoubleValues(), predictResult.getPredictTime());
        }
    }
    public List<DataValueVO> getPredictValueByItemNo(String itemNo, Date start, Date end) {
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java
@@ -1,25 +1,22 @@
package com.iailab.module.model.mdk.predict.impl;
import com.alibaba.fastjson.JSON;
import com.iailab.module.data.api.point.DataPointApi;
import com.iailab.module.data.api.point.dto.ApiPointDTO;
import com.iailab.module.data.enums.DataPointFreqEnum;
import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
import com.iailab.module.model.mcs.pre.service.MmItemOutputService;
import com.iailab.module.model.mcs.pre.service.MmItemResultService;
import com.iailab.module.model.mdk.common.enums.ItemPredictStatus;
import com.iailab.module.model.mdk.common.exceptions.ItemInvokeException;
import com.iailab.module.model.mdk.factory.ItemEntityFactory;
import com.iailab.module.model.mdk.factory.PredictItemFactory;
import com.iailab.module.model.mdk.predict.PredictItemHandler;
import com.iailab.module.model.mdk.predict.PredictResultHandler;
import com.iailab.module.model.mdk.vo.DataValueVO;
import com.iailab.module.model.mdk.vo.ItemVO;
import com.iailab.module.model.mdk.vo.PredictResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.sql.Timestamp;
import java.util.*;
/**
@@ -58,16 +55,14 @@
     * @throws ItemInvokeException
     */
    @Override
    public PredictResultVO predict(Date predictTime, ItemVO predictItemDto)
    public PredictResultVO predict(Date predictTime, ItemVO predictItemDto, Map<String, double[]> predictValueMap)
            throws ItemInvokeException {
        PredictResultVO predictResult = new PredictResultVO();
        ItemPredictStatus itemStatus = ItemPredictStatus.PREDICTING;
        String itemId = predictItemDto.getId();
        try {
            String expression = itemEntityFactory.getMergeItem(itemId).getExpression();
            int predictLength = itemEntityFactory.getItemById(itemId).getPredictLength();
            double[][] predictResultMat = new double[predictLength][1];
            Map<String, List<DataValueVO>> predictValueMap = new HashMap<>();
            double[] predictResultMat = new double[predictLength];
            String[] mathOutPutId = expression.split("[\\+ \\-]");
            ArrayList<Character> operator = new ArrayList<>();
            for (int i = 0; i < expression.length(); i++) {
@@ -75,75 +70,79 @@
                    operator.add(expression.charAt(i));
                }
            }
            String[] compositionItem = expression.split(String.valueOf("&".toCharArray()));
//            String[] compositionItem = expression.split(String.valueOf("&".toCharArray()));
            //是否为计算预测项
            if (mathOutPutId.length > 1) {
                for (String outPutId : mathOutPutId) {
                    if (outPutId.length() > 4) {
                        Date endTime = predictTime;
//                        ItemVO itemEntity = itemEntityFactory.getItemByItemNo(itemNo);
//                        List<MmItemOutputEntity> outPutList = itemEntityFactory.getOutPutByItemId(itemEntity.getId());
                        MmItemOutputEntity outPut = mmItemOutputService.getOutPutById(outPutId);
                        ApiPointDTO pointEntity = dataPointApi.getInfoById(outPut.getPointid());
//                Map<String, List<DataValueVO>> predictValueMap = new HashMap<>();
//                for (String outPutId : mathOutPutId) {
//                    if (outPutId.length() > 4) {
//                        Date endTime = predictTime;
////                        ItemVO itemEntity = itemEntityFactory.getItemByItemNo(itemNo);
////                        List<MmItemOutputEntity> outPutList = itemEntityFactory.getOutPutByItemId(itemEntity.getId());
//                        MmItemOutputEntity outPut = mmItemOutputService.getOutPutById(outPutId);
//                        ApiPointDTO pointEntity = dataPointApi.getInfoById(outPut.getPointid());
//
//                        Calendar calendar = Calendar.getInstance();
//                        calendar.setTime(endTime);
//                        calendar.add(Calendar.SECOND, (predictLength - 1) * DataPointFreqEnum.getEumByCode(pointEntity.getMinfreqid()).getValue());
//                        endTime = new Timestamp(calendar.getTime().getTime());
////                        List<DataValueVO> predictValueList = predictResultHandler.getPredictValueByItemNo(itemNo, predictTime, endTime);
//                        List<DataValueVO> predictValueList = mmItemResultService.getPredictValue(outPutId, predictTime, endTime);
//                        if (predictValueList.size() != predictLength) {
//                            log.debug("merge项融合失败:缺少子项预测数据,对应子项outPutId=" + outPutId);
//                            return null;
//                        }
//                        predictValueMap.put(outPutId, predictValueList);
//                    }
//                }
                        Calendar calendar = Calendar.getInstance();
                        calendar.setTime(endTime);
                        calendar.add(Calendar.SECOND, (predictLength - 1) * DataPointFreqEnum.getEumByCode(pointEntity.getMinfreqid()).getValue());
                        endTime = new Timestamp(calendar.getTime().getTime());
//                        List<DataValueVO> predictValueList = predictResultHandler.getPredictValueByItemNo(itemNo, predictTime, endTime);
                        List<DataValueVO> predictValueList = mmItemResultService.getPredictValue(outPutId, predictTime, endTime);
                        if (predictValueList.size() != predictLength) {
                            log.debug("merge项融合失败:缺少子项预测数据,对应子项outPutId=" + outPutId);
                            return null;
                        }
                        predictValueMap.put(outPutId, predictValueList);
                    }
                }
                for (Integer i = 0; i < predictLength; i++) {
                    double sum =0.0;
                    sum = predictValueMap.get(mathOutPutId[0]).get(i).getDataValue();
                    sum = predictValueMap.get(mathOutPutId[0])[i];
                    for (int j = 1; j < mathOutPutId.length; j++) {
                        if (operator.get(j-1)=='+')
                        {sum += predictValueMap.get(mathOutPutId[j]).get(i).getDataValue();}
                        {sum += predictValueMap.get(mathOutPutId[j])[i];}
                        if (operator.get(j-1)=='-')
                        {sum -= predictValueMap.get(mathOutPutId[j]).get(i).getDataValue();}
                        {sum -= predictValueMap.get(mathOutPutId[j])[i];}
                    }
                    predictResultMat[i][0] = sum;
                    predictResultMat[i] = sum;
                }
            }
            //是否为组合预测项
            if (compositionItem.length > 1) {
                Map<String, PredictResultVO> predictResultMap = new HashMap<>();
                Integer columnTotalNumber = 0;
                Integer rowNumber = 0;
                for (String itemNo : compositionItem) {
                    PredictItemHandler predictItem = (PredictItemHandler) predictItemFactory.create(itemEntityFactory.
                            getItemByItemNo(itemNo).getId());
                    predictResult = predictItem.predict(predictTime, predictItemDto);
                    columnTotalNumber += Integer.valueOf(predictResult.getPredictMatrix().length);
                    predictResultMap.put(itemNo, predictItem.predict(predictTime, predictItemDto));
                }
                double[][] matrix = new double[columnTotalNumber][1];
                for (String itemNo : compositionItem) {
                    for (Integer i = 0; i < predictResultMap.get(itemNo).getPredictMatrix().length; i++) {
                        matrix[rowNumber][0] = predictResultMap.get(itemNo).getPredictMatrix()[i][0];
                        rowNumber++;
                    }
                }
                predictResult.setPredictMatrix(matrix);
            }
//            if (compositionItem.length > 1) {
//                Map<String, PredictResultVO> predictResultMap = new HashMap<>();
//                Integer columnTotalNumber = 0;
//                Integer rowNumber = 0;
//                for (String itemNo : compositionItem) {
//                    PredictItemHandler predictItem = (PredictItemHandler) predictItemFactory.create(itemEntityFactory.
//                            getItemByItemNo(itemNo).getId());
//                    predictResult = predictItem.predict(predictTime, predictItemDto);
//                    columnTotalNumber += Integer.valueOf(predictResult.getPredictMatrix().length);
//                    predictResultMap.put(itemNo, predictItem.predict(predictTime, predictItemDto));
//                }
//                double[][] matrix = new double[columnTotalNumber][1];
//                for (String itemNo : compositionItem) {
//                    for (Integer i = 0; i < predictResultMap.get(itemNo).getPredictMatrix().length; i++) {
//                        matrix[rowNumber][0] = predictResultMap.get(itemNo).getPredictMatrix()[i][0];
//                        rowNumber++;
//                    }
//                }
//                predictResult.setPredictMatrix(matrix);
//            }
            predictResult.setPredictId(itemId);
            predictResult.setPredictMatrix(predictResultMat);
            List<MmItemOutputEntity> outputServiceByItemid = mmItemOutputService.getByItemid(itemId);
            if (!CollectionUtils.isEmpty(outputServiceByItemid)) {
                Map<MmItemOutputEntity, double[]> predictMatrixs = new HashMap<>();
                predictMatrixs.put(outputServiceByItemid.get(0),predictResultMat);
                predictResult.setPredictMatrixs(predictMatrixs);
            }
            predictResult.setPredictTime(predictTime);
            //预测项预测成功的状态
            itemStatus = ItemPredictStatus.SUCCESS;
        } catch (Exception e) {
            //预测项预测失败的状态
            itemStatus = ItemPredictStatus.FAILED;
            log.debug("merge项预测失败,itemId:" + itemId);
            log.error("merge项预测失败,itemId:" + itemId);
            e.printStackTrace();
            throw e;
        }
        log.debug("预测完成,itemId:" + itemId + ",itemStatus:" + itemStatus.getValue());
        log.info("merge项预测完成,itemId:" + itemId + ",结果:" + JSON.toJSONString(predictResult));
        return predictResult;
    }
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemNormalHandlerImpl.java
@@ -1,6 +1,8 @@
package com.iailab.module.model.mdk.predict.impl;
import com.iailab.module.model.common.exception.ModelResultErrorException;
import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity;
import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum;
import com.iailab.module.model.mcs.pre.service.MmPredictModelService;
import com.iailab.module.model.mdk.common.exceptions.ItemInvokeException;
import com.iailab.module.model.mdk.common.exceptions.ModelInvokeException;
@@ -13,6 +15,7 @@
import java.text.MessageFormat;
import java.util.Date;
import java.util.Map;
/**
 * @author PanZhibao
@@ -37,17 +40,19 @@
     * @throws ItemInvokeException
     */
    @Override
    public PredictResultVO predict(Date predictTime, ItemVO predictItemDto) throws ItemInvokeException {
    public PredictResultVO predict(Date predictTime, ItemVO predictItemDto, Map<String, double[]> predictValueMap) throws ItemInvokeException,ModelResultErrorException {
        PredictResultVO predictResult = new PredictResultVO();
        String itemId = predictItemDto.getId();
        predictResult.setPredictId(itemId);
        try {
            MmPredictModelEntity predictModel = mmPredictModelService.getActiveModelByItemId(itemId);
            if (predictModel == null) {
                throw new ModelInvokeException(MessageFormat.format("{0},itemId={1}",
                        ModelInvokeException.errorGetModelEntity, itemId));
            }
            predictResult = predictModelHandler.predictByModel(predictTime, predictModel);
            predictResult = predictModelHandler.predictByModel(predictTime, predictModel,predictItemDto.getItemName());
            predictResult.setPredictId(itemId);
        } catch (ModelResultErrorException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new ItemInvokeException(MessageFormat.format("{0},itemId={1}",
                    ItemInvokeException.errorItemFailed, itemId));
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java
@@ -1,13 +1,16 @@
package com.iailab.module.model.mdk.predict.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.iail.model.IAILModel;
import com.iailab.module.model.common.enums.CommonConstant;
import com.iailab.module.model.common.enums.OutResultType;
import com.iailab.module.model.common.exception.ModelResultErrorException;
import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
import com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity;
import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity;
import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum;
import com.iailab.module.model.mcs.pre.service.MmItemOutputService;
import com.iailab.module.model.mcs.pre.service.MmModelArithSettingsService;
import com.iailab.module.model.mdk.common.enums.TypeA;
@@ -54,14 +57,14 @@
     * @throws ModelInvokeException
     */
    @Override
    public synchronized PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel) throws ModelInvokeException {
    public synchronized PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel,String itemName) throws ModelInvokeException {
        PredictResultVO result = new PredictResultVO();
        if (predictModel == null) {
            throw new ModelInvokeException("modelEntity is null");
        }
        String modelId = predictModel.getId();
        try {
            List<SampleData> sampleDataList = sampleConstructor.constructSample(TypeA.Predict.name(), modelId, predictTime);
            List<SampleData> sampleDataList = sampleConstructor.constructSample(TypeA.Predict.name(), modelId, predictTime, itemName);
            String modelPath = predictModel.getModelpath();
            if (modelPath == null) {
                log.info("模型路径不存在,modelId=" + modelId);
@@ -86,29 +89,30 @@
            param2Values[portLength] = newModelBean.getDataMap().get("models");
            param2Values[portLength + 1] = settings;
            log.info("#######################预测模型 " + predictModel.getItemid() + " ##########################");
            JSONObject jsonObjNewModelBean = new JSONObject();
            jsonObjNewModelBean.put("newModelBean", newModelBean);
            log.info(String.valueOf(jsonObjNewModelBean));
            JSONObject jsonObjParam2Values = new JSONObject();
            jsonObjParam2Values.put("param2Values", param2Values);
            log.info(String.valueOf(jsonObjParam2Values));
            log.info("####################### 预测模型 "+ "【itemId:" + predictModel.getItemid() + ",itemName" + itemName + "】 ##########################");
//            JSONObject jsonObjNewModelBean = new JSONObject();
//            jsonObjNewModelBean.put("newModelBean", newModelBean);
//            log.info(String.valueOf(jsonObjNewModelBean));
//            JSONObject jsonObjParam2Values = new JSONObject();
//            jsonObjParam2Values.put("param2Values", param2Values);
            log.info("参数: " + JSON.toJSONString(param2Values));
            //IAILMDK.run
            HashMap<String, Object> modelResult = DllUtils.run(newModelBean, param2Values, predictModel.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);
                throw new ModelResultErrorException("模型结果异常:" + modelResult);
            }
            modelResult = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT);
            //打印结果
            log.info("预测模型计算完成:modelId=" + modelId + modelResult);
            log.info("预测模型计算完成:modelId=" + modelId + ",modelName" + predictModel.getMethodname());
            JSONObject jsonObjResult = new JSONObject();
            jsonObjResult.put("result", modelResult);
            log.info(String.valueOf(jsonObjResult));
            List<MmItemOutputEntity> itemOutputList = mmItemOutputService.getByItemid(predictModel.getItemid());
            Map<MmItemOutputEntity, double[]> predictMatrixs = new HashMap<>(itemOutputList.size());
            Map<MmItemOutputEntity, double[]> predictMatrixs = new HashMap<>();
            Map<MmItemOutputEntity, Double> predictDoubleValues = new HashMap<>();
            for (MmItemOutputEntity output : itemOutputList) {
                if (!modelResult.containsKey(output.getResultstr())) {
                    continue;
@@ -127,16 +131,24 @@
                        }
                        predictMatrixs.put(output, tempColumn);
                        break;
                    case D:
                        Double temp3 = (Double) modelResult.get(output.getResultstr());
                        predictDoubleValues.put(output, temp3);
                        break;
                    default:
                        break;
                }
            }
            result.setPredictMatrixs(predictMatrixs);
            result.setPredictDoubleValues(predictDoubleValues);
            result.setModelResult(modelResult);
            result.setPredictTime(predictTime);
        } catch (Exception ex) {
            log.error("调用发生异常,异常信息为:{}", ex);
        } catch (ModelResultErrorException ex) {
            ex.printStackTrace();
            throw ex;
        } catch (Exception ex) {
            log.error("调用发生异常,异常信息为:{1}", ex);
//            ex.printStackTrace();
            throw new ModelInvokeException(ex.getMessage());
        }
        return result;
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
@@ -1,9 +1,13 @@
package com.iailab.module.model.mdk.sample;
import com.iailab.module.data.api.plan.PlanItemApi;
import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO;
import com.iailab.module.data.api.point.DataPointApi;
import com.iailab.module.data.api.point.dto.ApiPointDTO;
import com.iailab.module.data.api.point.dto.ApiPointValueDTO;
import com.iailab.module.data.api.point.dto.ApiPointValueQueryDTO;
import com.iailab.module.data.common.ApiDataQueryDTO;
import com.iailab.module.data.common.ApiDataValueDTO;
import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
import com.iailab.module.model.mcs.pre.service.MmItemOutputService;
import com.iailab.module.model.mcs.pre.service.MmItemResultService;
@@ -14,18 +18,20 @@
import com.iailab.module.model.mdk.sample.dto.SampleData;
import com.iailab.module.model.mdk.sample.dto.SampleInfo;
import com.iailab.module.model.mdk.vo.DataValueVO;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
 * 预测样本数据构造
 */
@Slf4j
@Component
public class PredictSampleDataConstructor extends SampleDataConstructor {
@@ -33,6 +39,9 @@
    @Autowired
    private DataPointApi dataPointApi;
    @Autowired
    private PlanItemApi planItemApi;
    @Autowired
    private MmItemResultService mmItemResultService;
@@ -51,8 +60,10 @@
     * @return
     */
    @Override
    public List<SampleData> prepareSampleData(SampleInfo sampleInfo) {
    public List<SampleData>  prepareSampleData(SampleInfo sampleInfo) throws Exception {
        List<SampleData> sampleDataList = new ArrayList<>();
        Map<String, ApiPointDTO> pointMap = sampleInfo.getPointMap();
        Map<String, ApiPlanItemDTO> planMap = sampleInfo.getPlanMap();
        //对每个爪分别进行计算
        for (ColumnItemPort entry : sampleInfo.getColumnInfo()) {
            //先依据爪内数据项的modelParamOrder进行排序——重写comparator匿名函数
@@ -74,11 +85,11 @@
            //对每一项依次进行数据查询,然后将查询出的值赋给matrix对应的位置
            for (int i = 0; i < entry.getColumnItemList().size(); i++) {
                try {
                    List<DataValueVO> dataEntityList = getData(entry.getColumnItemList().get(i));
                    List<DataValueVO> dataEntityList = getData(entry.getColumnItemList().get(i),pointMap,planMap);
                    //补全数据
                    ColumnItem columnItem = entry.getColumnItemList().get(i);
                    dataEntityList = super.completionData(matrix.length, dataEntityList, columnItem.startTime, columnItem.endTime,
                            columnItem.paramId, columnItem.getParamType());
                            columnItem.paramId, columnItem.getParamType(),pointMap,planMap);
                    /** 如果数据取不满,把缺失的数据点放在后面 */
                    if (dataEntityList != null && dataEntityList.size() != 0) {
@@ -89,6 +100,7 @@
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    throw e;
                }
            }
            SampleData sampleData = new SampleData();
@@ -102,20 +114,24 @@
     * getData
     *
     * @param columnItem
     * @param pointMap
     * @param planMap
     * @return
     * @throws Exception
     */
    private List<DataValueVO> getData(ColumnItem columnItem) throws Exception {
    private List<DataValueVO> getData(ColumnItem columnItem, Map<String, ApiPointDTO> pointMap, Map<String, ApiPlanItemDTO> planMap) throws Exception {
        List<DataValueVO> dataList = new ArrayList<>();
        String paramType = columnItem.getParamType();
        switch (ModelParamType.getEumByCode(paramType)) {
            case DATAPOINT:
                ApiPointDTO point = dataPointApi.getInfoById(columnItem.getParamId());
                ApiPointValueQueryDTO queryDto = new ApiPointValueQueryDTO();
                queryDto.setPointNo(point.getPointNo());
                queryDto.setPointNo(pointMap.get(columnItem.getParamId()).getPointNo());
                queryDto.setStart(columnItem.getStartTime());
                queryDto.setEnd(columnItem.getEndTime());
                List<ApiPointValueDTO> pointValueList = dataPointApi.queryPointHistoryValue(queryDto);
                if (CollectionUtils.isEmpty(pointValueList)) {
                    break;
                }
                dataList = pointValueList.stream().map(t -> {
                    DataValueVO vo = new DataValueVO();
                    vo.setDataTime(t.getT());
@@ -126,15 +142,31 @@
            case NORMALITEM:
            case MERGEITEM:
                MmItemOutputEntity outPut = mmItemOutputService.getOutPutById(columnItem.getParamId());
                dataList = mmItemResultService.getPredictValue(outPut.getId(),
                        columnItem.getStartTime(), columnItem.getEndTime());
                if (dataList == null) {
                    throw new Exception("没有预测值");
                List<DataValueVO> predictValue = mmItemResultService.getPredictValue(outPut.getId(), columnItem.getStartTime(), columnItem.getEndTime());
                if (CollectionUtils.isEmpty(predictValue)) {
                    break;
                }
                dataList = predictValue;
                break;
            case PLAN:
                ApiDataQueryDTO queryPlanItemDto = new ApiDataQueryDTO();
                queryPlanItemDto.setItemNo(planMap.get(columnItem.getParamId()).getItemNo());
                queryPlanItemDto.setStart(columnItem.getStartTime());
                queryPlanItemDto.setEnd(columnItem.getEndTime());
                List<ApiDataValueDTO> planValueList = planItemApi.queryPlanItemHistoryValue(queryPlanItemDto);
                if (CollectionUtils.isEmpty(planValueList)) {
                    break;
                }
                dataList = planValueList.stream().map(t -> {
                    DataValueVO vo = new DataValueVO();
                    vo.setDataTime(t.getDataTime());
                    vo.setDataValue(t.getDataValue());
                    return vo;
                }).collect(Collectors.toList());
            default:
                break;
        }
        log.info("数据获取,columnItem:" + columnItem + ",dataList" + dataList);
        return dataList;
    }
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleInfoConstructor.java
@@ -1,18 +1,24 @@
package com.iailab.module.model.mdk.sample;
import com.iailab.module.data.api.plan.PlanItemApi;
import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO;
import com.iailab.module.data.api.point.DataPointApi;
import com.iailab.module.data.api.point.dto.ApiPointDTO;
import com.iailab.module.model.mcs.pre.entity.MmModelParamEntity;
import com.iailab.module.model.mcs.pre.service.MmModelParamService;
import com.iailab.module.model.mcs.pre.service.MmPredictItemService;
import com.iailab.module.model.mcs.pre.service.MmPredictModelService;
import com.iailab.module.model.mdk.common.enums.ModelParamType;
import com.iailab.module.model.mdk.sample.dto.ColumnItem;
import com.iailab.module.model.mdk.sample.dto.ColumnItemPort;
import com.iailab.module.model.mdk.sample.dto.SampleInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
 * @author PanZhibao
@@ -30,6 +36,12 @@
    @Autowired
    private MmPredictItemService mmPredictItemService;
    @Autowired
    private DataPointApi dataPointApi;
    @Autowired
    private PlanItemApi planItemApi;
    /**
     * 返回样本矩阵的列数
@@ -50,7 +62,8 @@
     * @return
     */
    @Override
    protected List<ColumnItemPort> getColumnInfo(String modelId, Date predictTime) {
    protected SampleInfo getColumnInfo(String modelId, Date predictTime) {
        SampleInfo sampleInfo = new SampleInfo();
        List<ColumnItemPort> resultList = new ArrayList<>();
        List<ColumnItem> columnItemList = new ArrayList<>();
        ColumnItem columnInfo = new ColumnItem();
@@ -63,15 +76,24 @@
        int curPortOrder = modelInputParamEntityList.get(0).getModelparamportorder();
        //设置当前查询数据长度,初始值为最小端口数据长度
        int curDataLength = modelInputParamEntityList.get(0).getDatalength();
        // 统一获取测点的信息
        Set<String> pointIds = modelInputParamEntityList.stream().filter(e -> ModelParamType.getEumByCode(e.getModelparamtype()).equals(ModelParamType.DATAPOINT)).map(MmModelParamEntity::getModelparamid).collect(Collectors.toSet());
        List<ApiPointDTO> points = dataPointApi.getInfoByIds(pointIds);
        Map<String, ApiPointDTO> pointMap = points.stream().collect(Collectors.toMap(ApiPointDTO::getId, Function.identity(), (e1,e2) -> e1));
        // 统一获取计划数据的信息
        Set<String> planIds = modelInputParamEntityList.stream().filter(e -> ModelParamType.getEumByCode(e.getModelparamtype()).equals(ModelParamType.PLAN)).map(MmModelParamEntity::getModelparamid).collect(Collectors.toSet());
        List<ApiPlanItemDTO> plans = planItemApi.getInfoByIds(planIds);
        Map<String, ApiPlanItemDTO> planMap = plans.stream().collect(Collectors.toMap(ApiPlanItemDTO::getId, Function.identity(), (e1,e2) -> e1));
        for (MmModelParamEntity entry : modelInputParamEntityList) {
            columnInfo.setParamType(entry.getModelparamtype());
            columnInfo.setParamId(entry.getModelparamid());
            columnInfo.setDataLength(entry.getDatalength());
            columnInfo.setModelParamOrder(entry.getModelparamorder());
            columnInfo.setModelParamPortOrder(entry.getModelparamportorder());
            columnInfo.setStartTime(getStartTime(columnInfo, predictTime));
            columnInfo.setEndTime(getEndTime(columnInfo, predictTime));
            columnInfo.setGranularity(super.getGranularity(columnInfo));
            columnInfo.setStartTime(getStartTime(columnInfo, predictTime,pointMap,planMap));
            columnInfo.setEndTime(getEndTime(columnInfo, predictTime,pointMap,planMap));
            columnInfo.setGranularity(super.getGranularity(columnInfo,pointMap,planMap));
            //对每一个爪进行数据项归并
            if (curPortOrder != entry.getModelparamportorder()){
@@ -94,7 +116,10 @@
        curPort.setDataLength(curDataLength);
        curPort.setPortOrder(curPortOrder);
        resultList.add(curPort);
        return resultList;
        sampleInfo.setColumnInfo(resultList);
        sampleInfo.setPointMap(pointMap);
        sampleInfo.setPlanMap(planMap);
        return sampleInfo;
    }
    /**
@@ -105,7 +130,7 @@
     */
    @Override
    protected Integer getSampleCycle(String modelId) {
        return mmPredictItemService.getItemById(mmPredictModelService.getInfoFromCatch(modelId).getItemid()).getGranularity();
        return mmPredictItemService.getItemByIdFromCache(mmPredictModelService.getInfoFromCatch(modelId).getItemid()).getGranularity();
    }
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java
@@ -1,6 +1,7 @@
package com.iailab.module.model.mdk.sample;
import com.iailab.module.model.mdk.common.exceptions.DataAccessException;
import com.iailab.module.model.mdk.common.exceptions.ModelInvokeException;
import com.iailab.module.model.mdk.sample.dto.SampleData;
import com.iailab.module.model.mdk.sample.dto.SampleInfo;
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,18 +25,15 @@
    @Autowired
    private SampleFactory sampleFactory;
    public List<SampleData> constructSample(String typeA, String modelId, Date runTime) {
    public List<SampleData> constructSample(String typeA, String modelId, Date runTime,String itemName) throws ModelInvokeException {
        try {
            SampleInfoConstructor sampleInfoConstructor = sampleFactory.createSampleInfo(typeA, modelId);
            SampleInfo sampleInfo = sampleInfoConstructor.prepareSampleInfo(modelId, runTime);
            SampleDataConstructor sampleDataConstructor = sampleFactory.createSampelData(typeA);
            return sampleDataConstructor.prepareSampleData(sampleInfo);
        } catch (Exception e) {
            DataAccessException exception = new DataAccessException(MessageFormat.format("{0},类名为{1}",
                    DataAccessException.errorDataAccess, Thread.currentThread().getStackTrace()[1].getClassName()));
            System.out.println(exception);
            e.printStackTrace();
            return null;
            throw new ModelInvokeException(MessageFormat.format("{0},Name:{1}",
                    ModelInvokeException.errorGetModelArithParam, itemName));
        }
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java
@@ -1,8 +1,11 @@
package com.iailab.module.model.mdk.sample;
import com.iailab.module.data.api.plan.PlanItemApi;
import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO;
import com.iailab.module.data.api.point.DataPointApi;
import com.iailab.module.data.api.point.dto.ApiPointDTO;
import com.iailab.module.data.enums.DataPointFreqEnum;
import com.iailab.module.data.enums.TimeGranularitySecEnum;
import com.iailab.module.model.mdk.common.enums.ModelParamType;
import com.iailab.module.model.mdk.sample.dto.SampleData;
import com.iailab.module.model.mdk.sample.dto.SampleInfo;
@@ -12,7 +15,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import java.sql.Timestamp;
import java.util.*;
abstract class SampleDataConstructor {
@@ -21,6 +23,8 @@
    @Autowired
    private DataPointApi dataPointApi;
    @Autowired
    private PlanItemApi planItemApi;
    /**
     * prepareSampleData
@@ -28,7 +32,7 @@
     * @param sampleInfo
     * @return
     */
    public abstract List<SampleData> prepareSampleData(SampleInfo sampleInfo);
    public abstract List<SampleData> prepareSampleData(SampleInfo sampleInfo) throws Exception;
    /**
     * 补全数据
@@ -37,10 +41,11 @@
     * @param dataEntityList
     * @param startTime
     * @param endTime
     * @param planMap
     * @return
     */
    public List<DataValueVO> completionData(int length, List<DataValueVO> dataEntityList, Date startTime, Date endTime,
                                            String paramId, String paramType) {
                                            String paramId, String paramType, Map<String, ApiPointDTO> pointMap, Map<String, ApiPlanItemDTO> planMap) {
        if (CollectionUtils.isEmpty(dataEntityList) || length == dataEntityList.size()) {
            return dataEntityList;
        } else if (length < dataEntityList.size()) {
@@ -74,12 +79,12 @@
                endTime = calendar.getTime();
                end = endTime.getTime();
                oneMin = 24 * 60 * 60 * 1000;
                oneMin = 60 * 1000L;
                mins = ((end - start) / oneMin);
                break;
            case DATAPOINT:
                // 测点值
                ApiPointDTO dataPoint = dataPointApi.getInfoById(paramId);
                ApiPointDTO dataPoint = pointMap.get(paramId);
                oneMin = 1000L * DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue();
                // 设置时间偏移量
                start = start - (start % oneMin) + oneMin;
@@ -103,6 +108,15 @@
                end = calendar2.getTime().getTime();
                mins = ((end - start) / oneMin);
                break;
            case PLAN:
                // 计划数据
                ApiPlanItemDTO planItem = planMap.get(paramId);
                oneMin = 1000L * TimeGranularitySecEnum.getEumByCode(planItem.getTimeGranularity()).getValue();
                // 设置时间偏移量
                start = start - (start % oneMin) + oneMin;
                end = end - (end % oneMin) + oneMin;
                mins = ((end - start) / oneMin);
                break;
            default:
                break;
        }
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java
@@ -19,6 +19,7 @@
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author PanZhibao
@@ -47,14 +48,8 @@
     * @return
     */
    protected SampleInfo prepareSampleInfo(String modelId, Date predictTime) {
        SampleInfo sampleInfo = new SampleInfo();
        //调用样本列数的方法
//        sampleInfo.setSampleColumn(getSampleColumn(modelId));
        //样本的列信息
        sampleInfo.setColumnInfo(getColumnInfo(modelId, predictTime));
        //样本的采样周期
//        sampleInfo.setSampleCycle(getSampleCycle(modelId));
        return sampleInfo;
        return getColumnInfo(modelId, predictTime);
    }
    /**
@@ -73,7 +68,7 @@
     * @param predictTime
     * @return
     */
    protected abstract List<ColumnItemPort> getColumnInfo(String modelId, Date predictTime);
    protected abstract SampleInfo getColumnInfo(String modelId, Date predictTime);
    /**
     * 样本的采样周期
@@ -91,13 +86,13 @@
     * @return
     * @throws Exception
     */
    protected Date getStartTime(ColumnItem columnItem, Date originalTime) {
    protected Date getStartTime(ColumnItem columnItem, Date originalTime, Map<String, ApiPointDTO> pointMap, Map<String, ApiPlanItemDTO> planMap) {
        Date dateTime = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(originalTime);
        switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
            case DATAPOINT:
                ApiPointDTO dataPoint = dataPointApi.getInfoById(columnItem.getParamId());
                ApiPointDTO dataPoint = pointMap.get(columnItem.getParamId());
                if (dataPoint == null) {
                    return null;
                }
@@ -111,7 +106,11 @@
                dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), 60);
                break;
            case PLAN:
                dateTime = calendar.getTime();
                ApiPlanItemDTO apiPlanItemDTO = planMap.get(columnItem.getParamId());
                if (apiPlanItemDTO == null) {
                    return null;
                }
                dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), TimeGranularitySecEnum.getEumByCode(apiPlanItemDTO.getTimeGranularity()).getValue());
                break;
            default:
                break;
@@ -127,13 +126,13 @@
     * @return
     * @throws Exception
     */
    protected Date getEndTime(ColumnItem columnItem, Date originalTime) {
    protected Date getEndTime(ColumnItem columnItem, Date originalTime,Map<String, ApiPointDTO> pointMap, Map<String, ApiPlanItemDTO> planMap) {
        Date dateTime = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(originalTime);
        switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
            case DATAPOINT:
                ApiPointDTO dataPoint = dataPointApi.getInfoById(columnItem.getParamId());
                ApiPointDTO dataPoint = pointMap.get(columnItem.getParamId());
                if (dataPoint == null) {
                    return null;
                }
@@ -147,12 +146,11 @@
                dateTime = calendar.getTime();
                break;
            case PLAN:
                ApiPlanItemDTO planItem = planItemApi.getInfoByNo(columnItem.getParamId());
                if (planItem == null) {
                ApiPlanItemDTO apiPlanItemDTO = planMap.get(columnItem.getParamId());
                if (apiPlanItemDTO == null) {
                    return null;
                }
                dateTime = calculateDate(originalTime, false, columnItem.getDataLength(),
                        TimeGranularityEnum.getEumByCode(planItem.getTimeGranularity()).getValue());
                dateTime = calculateDate(originalTime, false, columnItem.getDataLength(), TimeGranularitySecEnum.getEumByCode(apiPlanItemDTO.getTimeGranularity()).getValue());
                break;
            default:
                break;
@@ -167,26 +165,24 @@
     * @return
     * @throws Exception
     */
    protected Integer getGranularity(ColumnItem columnItem) {
    protected Integer getGranularity(ColumnItem columnItem,Map<String, ApiPointDTO> pointMap, Map<String, ApiPlanItemDTO> planMap) {
        // 默认60s
        Integer granularity = 60;
        switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
            case DATAPOINT:
                ApiPointDTO dataPoint = dataPointApi.getInfoById(columnItem.getParamId());
                ApiPointDTO dataPoint = pointMap.get(columnItem.getParamId());
                granularity = DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue();
                break;
            case NORMALITEM:
                granularity = mmPredictItemService.getItemByOutPutId(columnItem.getParamId()).getGranularity();
                break;
            case MERGEITEM:
                granularity = mmPredictItemService.getItemById(columnItem.getParamId()).getGranularity();
                granularity = mmPredictItemService.getItemByOutPutId(columnItem.getParamId()).getGranularity();
                break;
            case IND:
                ApiIndItemDTO indItemDTO = indItemApi.getInfoById(columnItem.getParamId());
                granularity = TimeGranularitySecEnum.getEumByCode(indItemDTO.getTimeGranularity()).getValue();;
                break;
            case PLAN:
                ApiPlanItemDTO apiPlanItemDTO = planItemApi.getInfoById(columnItem.getParamId());
                ApiPlanItemDTO apiPlanItemDTO = planMap.get(columnItem.getParamId());
                granularity = TimeGranularitySecEnum.getEumByCode(apiPlanItemDTO.getTimeGranularity()).getValue();
                break;
            default:
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/ScheduleSampleInfoConstructor.java
@@ -1,16 +1,22 @@
package com.iailab.module.model.mdk.sample;
import com.iailab.module.data.api.plan.PlanItemApi;
import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO;
import com.iailab.module.data.api.point.DataPointApi;
import com.iailab.module.data.api.point.dto.ApiPointDTO;
import com.iailab.module.model.mcs.sche.entity.StScheduleModelParamEntity;
import com.iailab.module.model.mcs.sche.service.StScheduleModelParamService;
import com.iailab.module.model.mdk.common.enums.ModelParamType;
import com.iailab.module.model.mdk.sample.dto.ColumnItem;
import com.iailab.module.model.mdk.sample.dto.ColumnItemPort;
import com.iailab.module.model.mdk.sample.dto.SampleInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Component
public class ScheduleSampleInfoConstructor extends SampleInfoConstructor {
@@ -18,13 +24,20 @@
    @Autowired
    private StScheduleModelParamService stScheduleModelParamService;
    @Autowired
    private DataPointApi dataPointApi;
    @Autowired
    private PlanItemApi planItemApi;
    @Override
    protected Integer getSampleColumn(String modelId) {
        return null;
    }
    @Override
    protected List<ColumnItemPort> getColumnInfo(String modelId, Date predictTime) {
    protected SampleInfo getColumnInfo(String modelId, Date predictTime) {
        SampleInfo sampleInfo = new SampleInfo();
        List<ColumnItemPort> resultList = new ArrayList<>();
        List<ColumnItem> columnItemList = new ArrayList<>();
        ColumnItem columnInfo = new ColumnItem();
@@ -37,15 +50,24 @@
        int curPortOrder = modelInputParamEntityList.get(0).getModelparamportorder();
        //设置当前查询数据长度,初始值为最小端口数据长度
        int curDataLength = modelInputParamEntityList.get(0).getDatalength();
        // 统一获取测点的信息
        Set<String> pointIds = modelInputParamEntityList.stream().filter(e -> ModelParamType.getEumByCode(e.getModelparamtype()).equals(ModelParamType.DATAPOINT)).map(StScheduleModelParamEntity::getModelparamid).collect(Collectors.toSet());
        List<ApiPointDTO> points = dataPointApi.getInfoByIds(pointIds);
        Map<String, ApiPointDTO> pointMap = points.stream().collect(Collectors.toMap(ApiPointDTO::getId, Function.identity()));
        // 统一获取计划数据的信息
        Set<String> planIds = modelInputParamEntityList.stream().filter(e -> ModelParamType.getEumByCode(e.getModelparamtype()).equals(ModelParamType.PLAN)).map(StScheduleModelParamEntity::getModelparamid).collect(Collectors.toSet());
        List<ApiPlanItemDTO> plans = planItemApi.getInfoByIds(planIds);
        Map<String, ApiPlanItemDTO> planMap = plans.stream().collect(Collectors.toMap(ApiPlanItemDTO::getId, Function.identity(), (e1,e2) -> e1));
        for (StScheduleModelParamEntity entry : modelInputParamEntityList) {
            columnInfo.setParamType(entry.getModelparamtype());
            columnInfo.setParamId(entry.getModelparamid());
            columnInfo.setDataLength(entry.getDatalength());
            columnInfo.setModelParamOrder(entry.getModelparamorder());
            columnInfo.setModelParamPortOrder(entry.getModelparamportorder());
            columnInfo.setStartTime(getStartTime(columnInfo, predictTime));
            columnInfo.setEndTime(getEndTime(columnInfo, predictTime));
            columnInfo.setGranularity(super.getGranularity(columnInfo));
            columnInfo.setStartTime(getStartTime(columnInfo, predictTime,pointMap,planMap));
            columnInfo.setEndTime(getEndTime(columnInfo, predictTime,pointMap,planMap));
            columnInfo.setGranularity(super.getGranularity(columnInfo,pointMap,planMap));
            //对每一个爪进行数据项归并
            if (curPortOrder != entry.getModelparamportorder()){
@@ -68,7 +90,10 @@
        curPort.setDataLength(curDataLength);
        curPort.setPortOrder(curPortOrder);
        resultList.add(curPort);
        return resultList;
        sampleInfo.setColumnInfo(resultList);
        sampleInfo.setPointMap(pointMap);
        sampleInfo.setPlanMap(planMap);
        return sampleInfo;
    }
    @Override
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/dto/SampleInfo.java
@@ -1,5 +1,7 @@
package com.iailab.module.model.mdk.sample.dto;
import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO;
import com.iailab.module.data.api.point.dto.ApiPointDTO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -8,6 +10,7 @@
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;
@Data
@AllArgsConstructor
@@ -30,4 +33,8 @@
    private Integer sampleCycle;
    private BigDecimal[][] deviation;
    // 所有测点信息,避免重复查询
    private Map<String, ApiPointDTO> pointMap;
    // 所有计划数据信息,避免重复查询
    private Map<String, ApiPlanItemDTO> planMap;
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java
@@ -1,5 +1,6 @@
package com.iailab.module.model.mdk.schedule.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.iail.model.IAILModel;
@@ -61,7 +62,9 @@
        String modelId = scheduleModel.getId();
        try {
            //1.根据模型id构造模型输入样本
            List<SampleData> sampleDataList = sampleConstructor.constructSample(TypeA.Schedule.name(), modelId, scheduleTime);
            long now = System.currentTimeMillis();
            List<SampleData> sampleDataList = sampleConstructor.constructSample(TypeA.Schedule.name(), modelId, scheduleTime,scheduleScheme.getName());
            log.info("构造模型输入样本消耗时长:" + (System.currentTimeMillis() - now) / 1000 + "秒");
            if (CollectionUtils.isEmpty(sampleDataList)) {
                log.info("调度模型构造样本失败,schemeCode=" + schemeCode);
                return null;
@@ -86,12 +89,12 @@
            param2Values[portLength] = settings;
            log.info("#######################调度模型 " + scheduleModel.getModelName() + " ##########################");
            JSONObject jsonObjNewModelBean = new JSONObject();
            jsonObjNewModelBean.put("newModelBean", newModelBean);
            log.info(String.valueOf(jsonObjNewModelBean));
            JSONObject jsonObjParam2Values = new JSONObject();
            jsonObjParam2Values.put("param2Values", param2Values);
            log.info(String.valueOf(jsonObjParam2Values));
//            JSONObject jsonObjNewModelBean = new JSONObject();
//            jsonObjNewModelBean.put("newModelBean", newModelBean);
//            log.info(String.valueOf(jsonObjNewModelBean));
//            JSONObject jsonObjParam2Values = new JSONObject();
//            jsonObjParam2Values.put("param2Values", param2Values);
            log.info("参数: " + JSON.toJSONString(param2Values));
            //IAILMDK.run
            HashMap<String, Object> modelResult = DllUtils.run(newModelBean, param2Values, scheduleScheme.getMpkprojectid());
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/vo/PredictResultVO.java
@@ -38,6 +38,11 @@
    private Map<MmItemOutputEntity, double[]> predictMatrixs;
    /**
     * double类型的模型输出
     */
    private Map<MmItemOutputEntity, Double> predictDoubleValues;
    /**
     * 时间间隔 (当前预测时间 与 上一次预测时间 相差的分钟数;系统计算得出)
     */
    private int t;
iailab-module-model/iailab-module-model-biz/src/main/resources/application-dev_rec.yaml
文件已删除
iailab-module-model/iailab-module-model-biz/src/main/resources/application-test_bak.yml
文件已删除
iailab-module-model/iailab-module-model-biz/src/main/resources/logback-spring.xml
@@ -1,86 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
    <property name="LOG_TEMP" value="./logs"/>
<configuration>
    <!-- 引用 Spring Boot 的 logback 基础配置 -->
    <include resource="org/springframework/boot/logging/logback/defaults.xml" />
    <!-- <include resource="org/springframework/boot/logging/logback/base.xml" /> -->
    <logger name="org.springframework.web" level="INFO"/>
    <logger name="org.springboot.sample" level="TRACE" />
    <!-- 变量 iailab.info.base-package,基础业务包 -->
    <springProperty scope="context" name="iailab.info.base-package" source="iailab.info.base-package"/>
    <!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
    <property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
    <!-- 开发、测试环境 -->
    <springProfile name="dev,test,prod">
        <logger name="org.springframework.web" level="INFO"/>
        <logger name="org.springboot.sample" level="INFO" />
        <logger name="com.iailab" level="DEBUG" />
    <!-- 控制台 Appender -->
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">     
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
                <pattern>${PATTERN_DEFAULT}</pattern>
            </layout>
        </encoder>
    </appender>
    <!-- 文件 Appender -->
    <!-- 参考 Spring Boot 的 file-appender.xml 编写 -->
    <appender name="FILE"  class="ch.qos.logback.core.rolling.RollingFileAppender">
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
                <pattern>${PATTERN_DEFAULT}</pattern>
            </layout>
        </encoder>
        <!-- 日志文件名 -->
        <file>${LOG_FILE}</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <!-- 滚动后的日志文件名 -->
            <fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern>
            <!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
            <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
            <!-- 日志文件,到达多少容量,进行滚动 -->
            <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
            <!-- 日志文件的总大小,0 表示不限制 -->
            <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
            <!-- 日志文件的保留天数 -->
            <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory>
        </rollingPolicy>
    </appender>
    <!-- 异步写入日志,提升性能 -->
    <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
        <!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 -->
        <discardingThreshold>0</discardingThreshold>
        <!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 -->
        <queueSize>256</queueSize>
        <appender-ref ref="FILE"/>
    </appender>
    <!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 -->
    <appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
                <pattern>${PATTERN_DEFAULT}</pattern>
            </layout>
        </encoder>
    </appender>
    <!-- 本地环境 -->
    <springProfile name="local">
        <root level="INFO">
            <appender-ref ref="STDOUT"/>
            <appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 -->
            <appender-ref ref="ASYNC"/>  <!-- 本地环境下,如果不想打印日志,可以注释掉本行 -->
        </root>
    </springProfile>
    <!-- 其它环境 -->
    <springProfile name="dev,test,stage,prod,default">
        <root level="INFO">
            <appender-ref ref="STDOUT"/>
            <appender-ref ref="ASYNC"/>
            <appender-ref ref="GRPC"/>
        </root>
    </springProfile>
    <!-- 生产环境 -->
    <!--<springProfile name="prod">-->
    <!--<logger name="org.springframework.web" level="ERROR"/>-->
    <!--<logger name="org.springboot.sample" level="ERROR" />-->
    <!--<logger name="io.renren" level="ERROR" />-->
    <!--</springProfile>-->
    <!-- 日志文件存放路径 -->
    <property name="log_home" value="./logs" />
    <!-- 日志输出格式 -->
    <!--生产用-->
    <property name="log.pattern" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] | [%thread][%-5level] | [%logger{20}.%method,line : %line] %msg%n" />
    <!--本地测试使用-->
    <!--<property name="log.pattern" value="[%boldGreen(%d{yyyy-MM-dd HH:mm:ss.SSS})] | [%highlight(%thread][%-5level)] | [%boldYellow(%logger{20}.%method,%line)] %msg%n" />-->
    <!-- 日志输出格式【控制台】 -->
    <!--<property name="log.pattern" value="%date{yyyy-MM-dd HH:mm:ss} | [ line: %line ] | %boldGreen(%thread) | %highlight(%-5level) | %boldYellow(%logger).%method | %msg%n"/>-->
    <!-- 控制台输出 -->
    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <!--<pattern>${logPatternConsoleLog}</pattern>-->
            <pattern>${log.pattern}</pattern>
        </encoder>
    </appender>
    <logger name="m-shop-mybatis-sql" level="debug"></logger>
    <!-- debug级别设置 -->
    <appender name="file_debug"  class="ch.qos.logback.core.rolling.RollingFileAppender">
        <prudent>true</prudent>
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <!--过滤 DEBUG-->
            <level>DEBUG</level>
            <!--匹配到就禁止-->
            <!--<onMatch>ACCEPT</onMatch>-->
            <!--没有匹配到就允许-->
            <!--<onMismatch>DENY</onMismatch>-->
        </filter>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!--<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">-->
            <!--日志文件输出的文件名-->
            <!--<FileNamePattern>${log_home}/log-info.%d{yyyy-MM-dd}.%i.log</FileNamePattern>-->
            <FileNamePattern>${log_home}/log-debug.%d{yyyy-MM-dd}.log</FileNamePattern>
            <!--<maxFileSize>100MB</maxFileSize>-->
            <!-- 日志最大的历史 7天 -->
            <maxHistory>7</maxHistory>
            <totalSizeCap>2GB</totalSizeCap>
            <cleanHistoryOnStart>true</cleanHistoryOnStart>
        </rollingPolicy>
        <!--<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">-->
        <!--&lt;!&ndash; 单文件最大50MB &ndash;&gt;-->
        <!--<maxFileSize>50MB</maxFileSize>-->
        <!--</triggeringPolicy>-->
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
    </appender>
    <!-- 系统模块日志级别控制  -->
    <!--<logger name="com.btrh" level="info" />-->
    <!-- Spring日志级别控制  -->
    <!--<logger name="org.springframework" level="info" />-->
    <!--系统操作日志-->
    <root level="INFO">
        <appender-ref ref="console" />
        <appender-ref ref="file_debug" />
    </root>
</configuration>
</configuration>
iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/api/user/AdminUserApiImpl.java
@@ -5,6 +5,7 @@
import com.iailab.framework.common.pojo.CommonResult;
import com.iailab.framework.common.util.object.BeanUtils;
import com.iailab.framework.common.util.object.ConvertUtils;
import com.iailab.framework.datapermission.core.annotation.DataPermission;
import com.iailab.module.system.api.user.dto.AdminUserRespDTO;
import com.iailab.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import com.iailab.module.system.dal.dataobject.dept.DeptDO;
@@ -34,6 +35,7 @@
    private PermissionService permissionService;
    @Override
    @DataPermission(enable = false) // 关闭数据权限,避免只查看自己时,查询不到部门。
    public CommonResult<AdminUserRespDTO> getUser(Long id) {
        AdminUserDO user = userService.getUser(id);
        return success(BeanUtils.toBean(user, AdminUserRespDTO.class));
iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/auth/AuthController.java
@@ -136,7 +136,7 @@
        Set<Long> menuIds = permissionService.getRoleMenuListByRoleId(convertSet(roles, RoleDO::getId));
        List<MenuDO> menuList = menuService.getMenuList(menuIds);
        menuList = menuService.filterDisableMenus(menuList);
//        menuList = menuService.filterMenus(menuList, "system");
        menuList = menuService.filterMenus(menuList, "system");
        // 2. 拼接结果返回
        return success(AuthConvert.INSTANCE.convert(user, roles, menuList));
@@ -239,7 +239,7 @@
        }
        children.retainAll(menuList);
        List<MenuDO> tempChildren = new LinkedList<>();
        //为每一个二级菜单增加一个隐藏父级目录
        //为每一个二级菜单(非外链菜单)增加一个隐藏父级目录
        children.stream().forEach(menu -> {
            if (menu.getParentId().equals(menuDO.getId())) {
                if(menu.getType().equals(MenuTypeEnum.MENU.getType())) {
@@ -254,7 +254,9 @@
                    tempChildren.add(parentMenu);
                } else if(menu.getType().equals(MenuTypeEnum.DIR.getType())) {
                    // 为应用菜单二级目录前增加“/”
                    menu.setPath("/" + menu.getPath());
                    if(!menu.getPath().contains("http:") && !menu.getPath().contains("https:")) {
                        menu.setPath("/" + menu.getPath());
                    }
                }
            }
            tempChildren.add(menu);
iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml
文件已删除