| | |
| | | @AllArgsConstructor |
| | | public enum OutResultType { |
| | | D1(1, "一维数组"), |
| | | D2(2, "二维数组"); |
| | | D2(2, "二维数组"), |
| | | D(3, "二维数组"); |
| | | |
| | | private Integer code; |
| | | private String desc; |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | |
| | | }); |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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) { |
| | |
| | | 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; |
| | |
| | | } |
| | | 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) { |
| | |
| | | * 统一预测入口的预测类型(循环调用、手动调用) Map<MmItemOutputEntity,double[]> |
| | | */ |
| | | private Map<MmItemOutputEntity, double[]> predictMatrixs; |
| | | private Map<MmItemOutputEntity, Double> predictDoubleValues; |
| | | |
| | | /** |
| | | * 时间间隔 (当前预测时间 与 上一次预测时间 相差的分钟数;系统计算得出) |