dengzedong
2024-11-28 19a4fbef86a3fc085f8e683d8db0b2f9605f52ac
模型参数 预测项改为output
已修改8个文件
86 ■■■■ 文件已修改
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/MmPredictItemServiceImpl.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/vo/MmPredictItemRespVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/common/enums/ModelParamType.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictItemDao.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java
@@ -30,6 +30,8 @@
    ItemVO getItemById(String itemId);
    ItemVO getItemByOutPutId(String outPutId);
    void clearCatch();
    MergeItemVO getMergeItemByItemId(String itemId);
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java
@@ -17,6 +17,7 @@
import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO;
import com.iailab.module.model.mdk.vo.ItemVO;
import com.iailab.module.model.mdk.vo.MergeItemVO;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -166,11 +167,17 @@
        }
        mmItemOutputService.deleteByItemId(predictItem.getId());
        List<MmItemOutputEntity> mmItemOutput = mmPredictItemDto.getMmItemOutputList();
        mmItemOutput.forEach(e -> {
            e.setId(UUID.randomUUID().toString());
            e.setItemid(predictItem.getId());
        });
        mmItemOutputService.saveMmItemOutput(mmItemOutput);
        if (!CollectionUtils.isEmpty(mmItemOutput)) {
            mmItemOutput.forEach(e -> {
                // 尽量保存原有id
                if (StringUtils.isBlank(e.getId())) {
                    e.setId(UUID.randomUUID().toString());
                }
                e.setItemid(predictItem.getId());
            });
            mmItemOutputService.saveMmItemOutput(mmItemOutput);
        }
        // 清空缓存
        clearCatch();
@@ -268,6 +275,19 @@
    }
    @Override
    public ItemVO getItemByOutPutId(String outPutId) {
        if (StringUtils.isBlank(outPutId)) {
            return null;
        }
        MmItemOutputEntity outPutById = mmItemOutputService.getOutPutById(outPutId);
        if (ObjectUtils.isEmpty(outPutById)) {
            return null;
        }
        String itemId = outPutById.getItemid();
        return getItemById(itemId);
    }
    @Override
    public MergeItemVO getMergeItemByItemId(String itemId) {
        if (StringUtils.isBlank(itemId)) {
            return null;
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/vo/MmPredictItemRespVO.java
@@ -103,5 +103,7 @@
    @ExcelProperty("运行耗时")
    private Long duration;
    private List<MmItemOutputRespVO> outPuts;
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/common/enums/ModelParamType.java
@@ -15,7 +15,8 @@
public enum ModelParamType {
    DATAPOINT("DATAPOINT", "测点值"),
    PREDICTITEM("PREDICTITEM", "预测值"),
    NORMALITEM("NormalItem", "预测值(NormalItem)"),
    MERGEITEM("MergeItem", "MergeItem"),
    IND("IND", "指标值"),
    PLAN("PLAN", "计划值");
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
@@ -123,8 +123,9 @@
                    return vo;
                }).collect(Collectors.toList());
                break;
            case PREDICTITEM:
                MmItemOutputEntity outPut = mmItemOutputService.getOutPutById(columnItem.getId());
            case NORMALITEM:
            case MERGEITEM:
                MmItemOutputEntity outPut = mmItemOutputService.getOutPutById(columnItem.getParamId());
                dataList = mmItemResultService.getPredictValue(outPut.getId(),
                        columnItem.getStartTime(), columnItem.getEndTime());
                if (dataList == null) {
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java
@@ -55,7 +55,8 @@
        long mins = 0L;
        switch (ModelParamType.getEumByCode(paramType)) {
            case PREDICTITEM:
            case NORMALITEM:
            case MERGEITEM:
                // 预测值
                Calendar calendar = Calendar.getInstance();
                calendar.setTime(startTime);
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java
@@ -85,7 +85,8 @@
                }
                dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue());
                break;
            case PREDICTITEM:
            case NORMALITEM:
            case MERGEITEM:
                dateTime = calendar.getTime();
                break;
            case IND:
@@ -120,7 +121,8 @@
                }
                dateTime = calendar.getTime();
                break;
            case PREDICTITEM:
            case NORMALITEM:
            case MERGEITEM:
                dateTime = calendar.getTime();
                break;
            case IND:
@@ -155,7 +157,10 @@
                ApiPointDTO dataPoint = dataPointApi.getInfoById(columnItem.getParamId());
                granularity = DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue();
                break;
            case PREDICTITEM:
            case NORMALITEM:
                granularity = mmPredictItemService.getItemByOutPutId(columnItem.getParamId()).getGranularity();
                break;
            case MERGEITEM:
                granularity = mmPredictItemService.getItemById(columnItem.getParamId()).getGranularity();
                break;
            case IND:
iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictItemDao.xml
@@ -66,7 +66,27 @@
        ORDER BY TMPI.CREATE_TIME DESC
    </select>
    <select id="queryList" resultType="com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO" parameterType="map">
    <resultMap id="MmPredictItemRespVO" type="com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO">
        <result property="id" column="ID"/>
        <result property="itemno" column="ITEMNO"/>
        <result property="itemname" column="ITEMNAME"/>
        <result property="itemtypeid" column="ITEMTYPEID"/>
        <result property="itemtypename" column="ITEMTYPENAME"/>
        <result property="granularity" column="GRANULARITY"/>
        <result property="isfuse" column="ISFUSE"/>
        <result property="workchecked" column="WORKCHECKED"/>
        <result property="moduleid" column="MODULEID"/>
        <result property="itemorder" column="ITEMORDER"/>
        <result property="status" column="STATUS"/>
        <result property="categoryid" column="CATEGORYID"/>
        <collection property="outPuts" ofType="com.iailab.module.model.mcs.pre.vo.MmItemOutputRespVO">
            <result property="id" column="out_put_id"/>
            <result property="outputorder" column="out_put_order"/>
            <result property="resultName" column="result_name"/>
        </collection>
    </resultMap>
    <select id="queryList" resultMap="MmPredictItemRespVO" parameterType="map">
        SELECT
        TMPI.ID,
        TMPI.ITEMNO,
@@ -79,10 +99,14 @@
        TDMI.MODULEID,
        TDMI.ITEMORDER,
        TMPI.STATUS,
        TDMI.CATEGORYID
        TDMI.CATEGORYID,
        TMIO.id out_put_id,
        TMIO.outputorder out_put_order,
        TMIO.result_name
        FROM T_MM_PREDICT_ITEM TMPI
        LEFT JOIN T_MM_ITEM_TYPE TMIT ON TMIT.ID = TMPI.ITEMTYPEID
        LEFT JOIN T_DM_MODULE_ITEM TDMI ON TDMI.ITEMID = TMPI.ID
        LEFT JOIN t_mm_item_output TMIO ON TMIO.itemid = TMPI.ID
        WHERE 1 = 1
        <if test="itemno != null and itemno != ''">
            AND TMPI.ITEMNO LIKE CONCAT('%', #{itemno},'%')
@@ -99,7 +123,7 @@
        <if test="status != null and status != ''">
            AND TMPI.STATUS = #{status}
        </if>
        ORDER BY TMPI.CREATE_TIME DESC
        ORDER BY TMPI.CREATE_TIME DESC,TMIO.outputorder
    </select>
    <select id="getByModuleId" parameterType="map" resultMap="ItemVO">