From 15732a55b862cdc423475f4fb6b45fb8a7b55ed3 Mon Sep 17 00:00:00 2001 From: liriming <1343021927@qq.com> Date: 星期五, 29 十一月 2024 09:02:42 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictItemDao.xml | 30 +++++++++++++- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/common/enums/ModelParamType.java | 3 + iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java | 2 + iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java | 5 +- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/vo/MmPredictItemRespVO.java | 2 + iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java | 3 + iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java | 11 ++++- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java | 30 ++++++++++++-- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java | 3 + 9 files changed, 74 insertions(+), 15 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java index 89940ad..e837bf0 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java +++ b/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); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java index a6f793e..3ab68e9 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java @@ -30,6 +30,9 @@ @Override public void saveMmItemOutput(List<MmItemOutputEntity> mmItemOutput) { + mmItemOutput.forEach(e -> { + e.setId(e.getId().replace("+","").replace("-","")); + }); mmItemOutputDao.insert(mmItemOutput); // 清空缓存 clearCache(); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java index 3a38f00..7f4dfec 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java +++ b/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; diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/vo/MmPredictItemRespVO.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/vo/MmPredictItemRespVO.java index 109e477..345af59 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/vo/MmPredictItemRespVO.java +++ b/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; + } diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/common/enums/ModelParamType.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/common/enums/ModelParamType.java index fec116a..30b7b94 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/common/enums/ModelParamType.java +++ b/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", "计划值"); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java index e9443ca..dc0ff35 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java +++ b/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) { diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java index f822f90..6b3b291 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java +++ b/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); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java index cd5f3f0..f59556b 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java +++ b/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: diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictItemDao.xml b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictItemDao.xml index 5bda3f9..3edcdce 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictItemDao.xml +++ b/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"> -- Gitblit v1.9.3