| | |
| | | duration bigint(20) DEFAULT NULL COMMENT '耗时(s)', |
| | | primary key (id), |
| | | UNIQUE INDEX uk_item_id (item_id) |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '测项状态表' ROW_FORMAT = Dynamic; |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '测项状态表' ROW_FORMAT = Dynamic; |
| | | |
| | | -- 模型输出 |
| | | ALTER TABLE t_mm_predict_model DROP COLUMN `resultstrid`; |
| | | alter table t_mm_item_output add column `resultstr` varchar(50) DEFAULT NULL; |
| | | alter table t_mm_item_output add column `result_type` smallint DEFAULT NULL COMMENT '参数类型{1:一维数组;2:二维数组}'; |
| | | alter table t_mm_item_output add column `result_index` int DEFAULT NULL; |
| | | |
| | | -- 字典 |
| | | INSERT INTO `iailab_plat_system`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (644, '模型结果数据类型', 'model_result_type', 0, '', '141', '2024-11-11 15:16:58', '141', '2024-11-11 15:16:58', b'0', '1970-01-01 00:00:00'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1628, 1, 'double[]', '1', 'model_result_type', 0, '', '', '', '141', '2024-11-11 15:21:05', '141', '2024-11-11 15:21:05', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1629, 2, 'double[][]', '2', 'model_result_type', 0, '', '', '', '141', '2024-11-11 15:21:17', '141', '2024-11-11 15:21:17', b'0'); |
| | |
| | | @Override |
| | | public MdkPredictModuleRespDTO predictModule(MdkPredictReqDTO reqDTO) { |
| | | MdkPredictModuleRespDTO resp = new MdkPredictModuleRespDTO(); |
| | | resp.setPredictTime(reqDTO.getPredictTime()); |
| | | resp.setModuleType(reqDTO.getModuleType()); |
| | | |
| | | Map<String, MdkPredictItemRespDTO> predictItemRespMap = new HashMap<>(); |
| | | try { |
| | | if (reqDTO.getPredictTime() == null) { |
| | |
| | | } |
| | | List<ItemVO> predictItemList = mmPredictItemService.getByModuleId(module.getId()); |
| | | Map<String, PredictResultVO> predictResultMap = predictModuleHandler.predict(predictItemList, reqDTO.getPredictTime(), intervalTime); |
| | | for (Map.Entry<String, PredictResultVO> entry : predictResultMap.entrySet()) { |
| | | List<MdkPredictDataDTO> predictData = entry.getValue().getPredictList().stream().map(t-> { |
| | | MdkPredictDataDTO dto1 = new MdkPredictDataDTO(); |
| | | dto1.setDataTime(t.getDataTime()); |
| | | dto1.setDataValue(t.getDataValue()); |
| | | return dto1; |
| | | }).collect(Collectors.toList()); |
| | | MdkPredictItemRespDTO itemResp = new MdkPredictItemRespDTO(); |
| | | itemResp.setItemId(entry.getValue().getPredictId()); |
| | | itemResp.setPredictData(predictData); |
| | | predictItemRespMap.put(entry.getKey(), itemResp); |
| | | } |
| | | |
| | | // for (Map.Entry<String, PredictResultVO> entry : predictResultMap.entrySet()) { |
| | | // for (Map.Entry<String, List<DataValueVO>> dataListEntry : entry.getValue().getPredictLists().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()); |
| | | // MdkPredictItemRespDTO itemResp = new MdkPredictItemRespDTO(); |
| | | // itemResp.setItemId(dataListEntry.getKey()); |
| | | // itemResp.setPredictData(predictData); |
| | | // predictItemRespMap.put(entry.getKey(), itemResp); |
| | | // } |
| | | // } |
| | | |
| | | // for (Map.Entry<String, PredictResultVO> entry : predictResultMap.entrySet()) { |
| | | // List<MdkPredictDataDTO> predictData = entry.getValue().getPredictList().stream().map(t-> { |
| | | // MdkPredictDataDTO dto1 = new MdkPredictDataDTO(); |
| | | // dto1.setDataTime(t.getDataTime()); |
| | | // dto1.setDataValue(t.getDataValue()); |
| | | // return dto1; |
| | | // }).collect(Collectors.toList()); |
| | | // MdkPredictItemRespDTO itemResp = new MdkPredictItemRespDTO(); |
| | | // itemResp.setItemId(entry.getValue().getPredictId()); |
| | | // itemResp.setPredictData(predictData); |
| | | // predictItemRespMap.put(entry.getKey(), itemResp); |
| | | // } |
| | | } |
| | | log.info("预测计算结束: " + System.currentTimeMillis()); |
| | | } catch (Exception ex) { |
| | |
| | | for (int i = 0; i < itemIdList.size(); i++) { |
| | | PreDataViewVO viewDto = new PreDataViewVO(); |
| | | String itemId = itemIdList.get(i); |
| | | MmItemOutputEntity mmItemOutput = mmItemOutputService.getByItemid(itemId); |
| | | // MmItemOutputEntity mmItemOutput = mmItemOutputService.getByItemid(itemId); |
| | | MmPredictItemEntity predictItem = mmPredictItemService.getById(itemId); |
| | | if (predictItem == null) { |
| | | log.info("itemId=" + itemId + "; is null"); |
| | |
| | | |
| | | private DmModuleItemEntity dmModuleItem; |
| | | |
| | | private MmItemOutputEntity mmItemOutput; |
| | | private List<MmItemOutputEntity> mmItemOutputList; |
| | | |
| | | private MmPredictModelEntity mmPredictModel; |
| | | |
| | |
| | | private String resulttableid; |
| | | |
| | | /** |
| | | * 结果 |
| | | */ |
| | | @NotBlank(message="结果不能为空") |
| | | private String resultstr; |
| | | |
| | | /** |
| | | * 结果类型 |
| | | */ |
| | | private Integer resultType; |
| | | |
| | | /** |
| | | * 结果索引 |
| | | */ |
| | | private Integer resultIndex; |
| | | |
| | | /** |
| | | * 数据点名称 |
| | | */ |
| | | @NotBlank(message="数据点名称不能为空") |
| | |
| | | /** |
| | | * 预测项ID |
| | | */ |
| | | private String itemid; |
| | | private String itemId; |
| | | |
| | | /** |
| | | * 最新运行时间 |
| | |
| | | private String modelparamstructure; |
| | | |
| | | /** |
| | | * 结果 |
| | | */ |
| | | @NotBlank(message="结果不能为空") |
| | | private String resultstrid; |
| | | |
| | | /** |
| | | * 模型设置 |
| | | */ |
| | | private String settingmap; |
| | |
| | | */ |
| | | public interface MmItemOutputService{ |
| | | |
| | | void saveMmItemOutput(MmItemOutputEntity mmItemOutput); |
| | | void saveMmItemOutput(List<MmItemOutputEntity> mmItemOutput); |
| | | |
| | | void update(MmItemOutputEntity mmItemOutput); |
| | | |
| | |
| | | |
| | | List<MmItemOutputVO> getOutPutByPointId(String pointid); |
| | | |
| | | MmItemOutputEntity getByItemid(String itemid); |
| | | List<MmItemOutputEntity> getByItemid(String itemid); |
| | | |
| | | void deleteByItemId(String itemId); |
| | | } |
| | |
| | | private MmItemOutputDao mmItemOutputDao; |
| | | |
| | | @Override |
| | | public void saveMmItemOutput(MmItemOutputEntity mmItemOutput) { |
| | | mmItemOutput.setId(UUID.randomUUID().toString()); |
| | | public void saveMmItemOutput(List<MmItemOutputEntity> mmItemOutput) { |
| | | mmItemOutputDao.insert(mmItemOutput); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public MmItemOutputEntity getByItemid(String itemid) { |
| | | public List<MmItemOutputEntity> getByItemid(String itemid) { |
| | | QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("itemid", itemid); |
| | | queryWrapper.orderByAsc("outputorder"); |
| | | List<MmItemOutputEntity> list = mmItemOutputDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new MmItemOutputEntity(); |
| | | } |
| | | return list.get(0); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByItemId(String itemId) { |
| | | QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("itemid", itemId); |
| | | mmItemOutputDao.delete(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public void savePredictValue(Map<String, List<DataValueVO>> predictValueMap, int t, String nIndex, Date predictTime) { |
| | | List<MmItemResultEntity> importList = new ArrayList<>(); |
| | | List<MmItemResultEntity> lastList = new ArrayList<>(); |
| | | |
| | | for (Map.Entry<String, List<DataValueVO>> entry : predictValueMap.entrySet()) { |
| | | for (DataValueVO dataVo : entry.getValue()) { |
| | | MmItemResultEntity importData = new MmItemResultEntity(); |
| | |
| | | map4.put("TABLENAME", "T_MM_ITEM_RESULT_JSON"); |
| | | map4.put("entity", resultJson); |
| | | mmItemResultDao.savePredictJsonValue(map4); |
| | | |
| | | Map<String, Object> params = new HashMap(4); |
| | | params.put("TABLENAME", T_MM_ITEM_RESULT); |
| | | params.put("OUTPUTID", entry.getKey()); |
| | | params.put("STARTTIME", importList.get(0).getDatatime()); |
| | | params.put("ENDTIME", importList.get(importList.size() - 1).getDatatime()); |
| | | mmItemResultDao.deletePredictValue(params); |
| | | |
| | | |
| | | } |
| | | |
| | | Map<String, Object> params = new HashMap(4); |
| | | params.put("TABLENAME", T_MM_ITEM_RESULT); |
| | | params.put("OUTPUTID", importList.get(0).getOutputid()); |
| | | params.put("STARTTIME", importList.get(0).getDatatime()); |
| | | params.put("ENDTIME", importList.get(importList.size() - 1).getDatatime()); |
| | | mmItemResultDao.deletePredictValue(params); |
| | | // Map<String, Object> params = new HashMap(4); |
| | | // params.put("TABLENAME", T_MM_ITEM_RESULT); |
| | | // params.put("OUTPUTID", importList.get(0).getOutputid()); |
| | | // params.put("STARTTIME", importList.get(0).getDatatime()); |
| | | // params.put("ENDTIME", importList.get(importList.size() - 1).getDatatime()); |
| | | // mmItemResultDao.deletePredictValue(params); |
| | | |
| | | int num1 = importList.size() / max_group_count; |
| | | int num2 = importList.size() % max_group_count; |
| | | if (num2 != 0) { |
| | | num1++; |
| | | } |
| | | |
| | | List<MmItemResultEntity> tempList; |
| | | //先删除已经存在的数据,再插入新数据 |
| | | for (int i = 0; i < num1; i++) { |
| | | int startIndex = max_group_count * i; |
| | | int count = max_group_count; |
| | | if (num2!=0 && i == num1 - 1) { |
| | | count = num2; |
| | | } |
| | | tempList = new ArrayList<>(); |
| | | //获取某个索引范围内的对象集合 |
| | | for (int j = startIndex; j < startIndex + count; j++) { |
| | | tempList.add(importList.get(j)); |
| | | } |
| | | Map<String, Object> map2 = new HashMap<>(2); |
| | | map2.put("TABLENAME", T_MM_ITEM_RESULT); |
| | | map2.put("list", tempList); |
| | | mmItemResultDao.savePredictValue(map2); |
| | | } |
| | | // int num1 = importList.size() / max_group_count; |
| | | // int num2 = importList.size() % max_group_count; |
| | | // if (num2 != 0) { |
| | | // num1++; |
| | | // } |
| | | // |
| | | // List<MmItemResultEntity> tempList; |
| | | // //先删除已经存在的数据,再插入新数据 |
| | | // for (int i = 0; i < num1; i++) { |
| | | // int startIndex = max_group_count * i; |
| | | // int count = max_group_count; |
| | | // if (num2!=0 && i == num1 - 1) { |
| | | // count = num2; |
| | | // } |
| | | // tempList = new ArrayList<>(); |
| | | // //获取某个索引范围内的对象集合 |
| | | // for (int j = startIndex; j < startIndex + count; j++) { |
| | | // tempList.add(importList.get(j)); |
| | | // } |
| | | // Map<String, Object> map2 = new HashMap<>(2); |
| | | // map2.put("TABLENAME", T_MM_ITEM_RESULT); |
| | | // map2.put("list", tempList); |
| | | // mmItemResultDao.savePredictValue(map2); |
| | | // } |
| | | mmItemResultDao.insertBatch(importList,max_group_count); |
| | | |
| | | Map<String, Object> map3 = new HashMap<>(2); |
| | | map3.put("TABLENAME", "T_MM_ITEM_RESULT_LAST_POINT"); |
| | |
| | | if (entity == null) { |
| | | entity = new MmItemStatusEntity(); |
| | | entity.setId(UUID.randomUUID().toString()); |
| | | entity.setItemId(itemId); |
| | | entity.setLastTime(new Date()); |
| | | entity.setStatus(status.getCode()); |
| | | entity.setDuration(duration); |
| | |
| | | dmModuleItem.setItemid(predictItem.getId()); |
| | | dmModuleItemService.saveModuleItem(dmModuleItem); |
| | | |
| | | MmItemOutputEntity mmItemOutput = mmPredictItemDto.getMmItemOutput(); |
| | | mmItemOutput.setItemid(predictItem.getId()); |
| | | List<MmItemOutputEntity> mmItemOutput = mmPredictItemDto.getMmItemOutputList(); |
| | | mmItemOutput.forEach(e -> { |
| | | e.setId(UUID.randomUUID().toString()); |
| | | e.setItemid(predictItem.getId()); |
| | | }); |
| | | mmItemOutputService.saveMmItemOutput(mmItemOutput); |
| | | } |
| | | |
| | |
| | | if (!"".equals(dmModuleItem.getId()) && dmModuleItem.getId() != null) { |
| | | dmModuleItemService.update(dmModuleItem); |
| | | } |
| | | MmItemOutputEntity mmItemOutput = mmPredictItemDto.getMmItemOutput(); |
| | | if (!"".equals(mmItemOutput.getId()) && dmModuleItem.getId() != null) { |
| | | mmItemOutputService.update(mmItemOutput); |
| | | } |
| | | mmItemOutputService.deleteByItemId(predictItem.getId()); |
| | | List<MmItemOutputEntity> mmItemOutput = mmPredictItemDto.getMmItemOutputList(); |
| | | mmItemOutput.forEach(e -> { |
| | | e.setId(UUID.randomUUID().toString()); |
| | | e.setItemid(predictItem.getId()); |
| | | }); |
| | | mmItemOutputService.saveMmItemOutput(mmItemOutput); |
| | | } |
| | | |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | |
| | | MmPredictItemDTO mmPredictItemDto = BeanUtils.toBean(predictItem, MmPredictItemDTO.class); |
| | | mmPredictItemDto.setMmPredictItem(predictItem); |
| | | mmPredictItemDto.setDmModuleItem(dmModuleItemService.getByItemid(id)); |
| | | mmPredictItemDto.setMmItemOutput(mmItemOutputService.getByItemid(id)); |
| | | mmPredictItemDto.setMmItemOutputList(mmItemOutputService.getByItemid(id)); |
| | | MmItemTypeEntity itemType = mmItemTypeImpl.getById(predictItem.getItemtypeid()); |
| | | if (itemType != null && ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | MmPredictModelEntity mmPredictModel = mmPredictModelService.getByItemid(id); |
| | |
| | | package com.iailab.module.model.mdk.predict; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| | | 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.MmItemResultService; |
| | | import com.iailab.module.model.mdk.factory.ItemEntityFactory; |
| | | import com.iailab.module.model.mdk.vo.MmItemOutputVO; |
| | | import com.iailab.module.model.mdk.vo.DataValueVO; |
| | | import com.iailab.module.model.mdk.vo.MmItemOutputVO; |
| | | import com.iailab.module.model.mdk.vo.PredictResultVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | |
| | | resultMap.put(itemOutPutList.get(0).getId(), predictResult.getPredictList()); |
| | | return resultMap; |
| | | } |
| | | ApiPointDTO point = dataPointApi.getInfoById(itemOutPutList.get(0).getPointId()); |
| | | List<Date> dateTimeList = new ArrayList<>(); |
| | | Integer rows = predictResult.getPredictMatrix().length; |
| | | Integer columns = predictResult.getPredictMatrix()[0].length; |
| | | Date tempTime = predictResult.getPredictTime(); |
| | | for (Integer i = 0; i < rows; i++) { |
| | | dateTimeList.add(tempTime); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(tempTime); |
| | | calendar.add(Calendar.SECOND, DataPointFreqEnum.getEumByCode(point.getMinfreqid()).getValue()); |
| | | tempTime = calendar.getTime(); |
| | | } |
| | | for (Integer i = 0; i < columns; i++) { |
| | | Map<MmItemOutputEntity, double[]> predictMatrixs = predictResult.getPredictMatrixs(); |
| | | HashMap<String,List<DataValueVO>> predictLists = new HashMap<>(); |
| | | for (Map.Entry<MmItemOutputEntity, double[]> entry : predictMatrixs.entrySet()) { |
| | | ApiPointDTO point = dataPointApi.getInfoById(entry.getKey().getPointid()); |
| | | Integer pointMinfreq = DataPointFreqEnum.getEumByCode(point.getMinfreqid()).getValue(); |
| | | Integer rows = entry.getValue().length; |
| | | List<DataValueVO> predictDataList = new ArrayList<>(); |
| | | for (Integer j = 0; j < rows; j++) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(predictResult.getPredictTime()); |
| | | for (Integer i = 0; i < rows; i++) { |
| | | DataValueVO predictData = new DataValueVO(); |
| | | predictData.setDataTime(dateTimeList.get(j)); |
| | | predictData.setDataValue(Double.valueOf(predictResult.getPredictMatrix()[j][i])); |
| | | predictData.setDataTime(calendar.getTime()); |
| | | predictData.setDataValue(Double.valueOf(entry.getValue()[i])); |
| | | predictDataList.add(predictData); |
| | | |
| | | calendar.add(Calendar.SECOND, pointMinfreq); |
| | | } |
| | | resultMap.put(itemOutPutList.get(i).getId(), predictDataList); |
| | | predictResult.setPredictList(predictDataList); |
| | | resultMap.put(entry.getKey().getId(), predictDataList); |
| | | } |
| | | predictResult.setPredictLists(predictLists); |
| | | return resultMap; |
| | | } |
| | | |
| | |
| | | * @param predictResult |
| | | */ |
| | | @Async |
| | | @DSTransactional |
| | | public void savePredictResult(PredictResultVO predictResult) { |
| | | Map<String, List<DataValueVO>> resultMap = convertToPredictData(predictResult); |
| | | mmItemResultService.savePredictValue(resultMap, predictResult.getLt(), "n", predictResult.getPredictTime()); |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.iail.IAILMDK; |
| | | import com.iail.model.IAILModel; |
| | | import com.iailab.module.model.mcs.pre.controller.admin.MmItemOutputController; |
| | | 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.MmModelResultstrEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
| | | import com.iailab.module.model.mcs.pre.service.MmModelArithSettingsService; |
| | | import com.iailab.module.model.mcs.pre.service.MmModelResultstrService; |
| | | import com.iailab.module.model.mdk.common.enums.TypeA; |
| | |
| | | import com.iailab.module.model.mpk.common.utils.DllUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.parameters.P; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | |
| | | @Autowired |
| | | private MmModelResultstrService mmModelResultstrService; |
| | | @Autowired |
| | | private MmItemOutputService mmItemOutputService; |
| | | |
| | | @Autowired |
| | | private SampleConstructor sampleConstructor; |
| | |
| | | jsonObjResult.put("result", modelResult); |
| | | log.info(String.valueOf(jsonObjResult)); |
| | | |
| | | MmModelResultstrEntity modelResultstr = mmModelResultstrService.getInfo(predictModel.getResultstrid()); |
| | | log.info("模型计算完成:modelId=" + modelId + result); |
| | | if (modelResult.containsKey(modelResultstr.getResultstr())) { |
| | | Double[][] temp = (Double[][]) modelResult.get(modelResultstr.getResultstr()); |
| | | double[][] temp1 = new double[temp.length][temp[0].length]; |
| | | for (int i = 0; i < temp.length; i++) { |
| | | for (int j = 0; j < temp[i].length; j++) { |
| | | temp1[i][j] = temp[i][j].doubleValue(); |
| | | List<MmItemOutputEntity> ItemOutputList = mmItemOutputService.getByItemid(predictModel.getItemid()); |
| | | log.info("模型计算完成:modelId=" + modelId + modelResult); |
| | | |
| | | Map<MmItemOutputEntity,double[]> predictMatrixs = new HashMap<>(ItemOutputList.size()); |
| | | |
| | | for (MmItemOutputEntity outputEntity : ItemOutputList) { |
| | | String resultStr = outputEntity.getResultstr(); |
| | | if (modelResult.containsKey(resultStr)) { |
| | | if (outputEntity.getResultType() == 1) { |
| | | // 一维数组 |
| | | Double[] temp = (Double[]) modelResult.get(resultStr); |
| | | double[] temp1 = new double[temp.length]; |
| | | for (int i = 0; i < temp.length; i++) { |
| | | temp1[i] = temp[i].doubleValue(); |
| | | } |
| | | predictMatrixs.put(outputEntity,temp1); |
| | | }else if (outputEntity.getResultType() == 2) { |
| | | // 二维数组 |
| | | Double[][] temp = (Double[][]) modelResult.get(resultStr); |
| | | Double[] temp2 = temp[outputEntity.getResultIndex()]; |
| | | double[] temp1 = new double[temp2.length]; |
| | | for (int i = 0; i < temp2.length; i++) { |
| | | temp1[i] = temp2[i].doubleValue(); |
| | | } |
| | | predictMatrixs.put(outputEntity,temp1); |
| | | } |
| | | } |
| | | result.setPredictMatrix(temp1); |
| | | } |
| | | |
| | | result.setPredictMatrixs(predictMatrixs); |
| | | result.setModelResult(modelResult); |
| | | result.setPredictTime(predictTime); |
| | | } catch (Exception ex) { |
| | |
| | | package com.iailab.module.model.mdk.vo; |
| | | |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | |
| | | private double[][] predictMatrix; |
| | | |
| | | /** |
| | | * 统一预测入口的预测类型(循环调用、手动调用) Map<MmItemOutputEntity,double[]> |
| | | */ |
| | | private Map<MmItemOutputEntity,double[]> predictMatrixs; |
| | | |
| | | /** |
| | | * 时间间隔 (当前预测时间 与 上一次预测时间 相差的分钟数;系统计算得出) |
| | | */ |
| | | private int t; |
| | |
| | | * 预测集合 |
| | | */ |
| | | private List<DataValueVO> predictList; |
| | | /** |
| | | * 预测集合 |
| | | */ |
| | | private HashMap<String,List<DataValueVO>> predictLists; |
| | | |
| | | /** |
| | | * 模型结果 |
| | |
| | | (id,outputid,datatime,datavalue) |
| | | VALUES |
| | | <foreach item="item" collection="list" separator=","> |
| | | (#{item.id},#{item.outputId},#{item.dataTime},#{item.dataValue}) |
| | | (#{item.id},#{item.outputid},#{item.datatime},#{item.datavalue}) |
| | | </foreach> |
| | | </insert> |
| | | |