| | |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmMessageEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; |
| | | import com.iailab.module.model.mcs.pre.enums.PredGranularityEnum; |
| | | import com.iailab.module.model.mcs.pre.service.*; |
| | | import com.iailab.module.model.mcs.pre.vo.MmItemOutputRespVO; |
| | |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleModelEntity; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSuggestEntity; |
| | | import com.iailab.module.model.mcs.sche.service.*; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleRecordRespVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestSaveReqVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StSuggestOperationRecordReqVO; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mpk.service.ChartParamService; |
| | | import com.iailab.module.model.mpk.service.ChartService; |
| | |
| | | |
| | | @Autowired |
| | | private StScheduleModelSettingService stScheduleModelSettingService; |
| | | |
| | | @Autowired |
| | | private MmPredictModelService mmPredictModelService; |
| | | |
| | | @Autowired |
| | | private MmModelArithSettingsService mmModelArithSettingsService; |
| | | |
| | | @Autowired |
| | | private StSuggestOperationRecordService stSuggestOperationRecordService; |
| | | |
| | | private int HOUR_MINS = 60; |
| | | |
| | | @Override |
| | |
| | | PredictItemTreeDTO chd = new PredictItemTreeDTO(); |
| | | chd.setLabel(item1.getItemName()); |
| | | chd.setId(item1.getId()); |
| | | chd.setDisabled(true); |
| | | List<PredictItemTreeDTO> chd1 = new ArrayList<>(); |
| | | List<MmItemOutputEntity> outList = mmItemOutputService.getByItemid(item1.getId()); |
| | | if (!CollectionUtils.isEmpty(outList)) { |
| | |
| | | |
| | | if (!CollectionUtils.isEmpty(dataView.getCurData())) { |
| | | List<Double> curList = dataView.getCurData().stream().map(t -> { |
| | | return new Double(t[1].toString()); |
| | | }).collect(Collectors.toList()); |
| | | dataView.setPreMax(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).max().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | dataView.setPreMin(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).min().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | dataView.setPreLast(new BigDecimal(curList.get(curList.size() - 1)).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | dataView.setPreCumulant(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).sum()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | try { |
| | | return new Double(t[1].toString()); |
| | | } catch (NumberFormatException e) { |
| | | return null; |
| | | } |
| | | }).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | if (!curList.isEmpty()) { |
| | | dataView.setPreMax(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).max().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | dataView.setPreMin(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).min().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | dataView.setPreLast(new BigDecimal(curList.get(curList.size() - 1)).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | dataView.setPreCumulant(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).sum()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | } else { |
| | | dataView.setPreMax(null); |
| | | dataView.setPreMin(null); |
| | | dataView.setPreLast(null); |
| | | dataView.setPreCumulant(null); |
| | | } |
| | | } |
| | | |
| | | String alarmObj = chartParams.get(CommonConstant.ALARM_OBJ); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean ignoreSuggest(StAlarmAndSuggestReqVO reqVO) { |
| | | return stScheduleSuggestService.ignoreSuggest(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<ScheduleSuggestRespDTO> getLastSuggest(Map<String, Object> params) { |
| | | return stScheduleSuggestService.getLastSuggest(params); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updatePredictModelSetting(String modelCode, String key, String value) { |
| | | MmPredictModelEntity model = mmPredictModelService.getByModelCode(modelCode); |
| | | mmModelArithSettingsService.updateByModelIdAndKey(model.getId(), key, value); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean saveSuggestOperationRecord(SuggestOperationRecordReqVO reqVO) { |
| | | StSuggestOperationRecordReqVO operationRecordVo = new StSuggestOperationRecordReqVO(); |
| | | operationRecordVo.setSuggestId(reqVO.getId()); |
| | | operationRecordVo.setOperate(reqVO.getOperate()); |
| | | operationRecordVo.setReason(reqVO.getReason()); |
| | | operationRecordVo.setHandler(reqVO.getHandler()); |
| | | operationRecordVo.setHandlerId(reqVO.getHandlerId()); |
| | | //获取建议信息 |
| | | StScheduleSuggestEntity entity = stScheduleSuggestService.getInfo(reqVO.getId()); |
| | | if (entity != null){ |
| | | operationRecordVo.setTitle(entity.getTitle()); |
| | | operationRecordVo.setContent(entity.getContent()); |
| | | operationRecordVo.setScheduleObj(entity.getScheduleObj()); |
| | | if (StringUtils.isNotBlank(entity.getModelId())){ |
| | | //获取模型记录信息 |
| | | StScheduleRecordRespVO scheduleRecordVO = stScheduleRecordService.getInfoByModelIdAndScheduleTime(entity.getModelId(), entity.getScheduleTime()); |
| | | operationRecordVo.setSchemeId(scheduleRecordVO.getSchemeId()); |
| | | operationRecordVo.setModelId(entity.getModelId()); |
| | | operationRecordVo.setModelName(scheduleRecordVO.getModelName()); |
| | | operationRecordVo.setScheduleTime(entity.getScheduleTime()); |
| | | operationRecordVo.setResultCode(scheduleRecordVO.getResultCode()); |
| | | operationRecordVo.setResultData(scheduleRecordVO.getResultData()); |
| | | } |
| | | } |
| | | stSuggestOperationRecordService.create(operationRecordVo); |
| | | return true; |
| | | } |
| | | private Date[] calResultTime(ItemVO predictItem, Date startTimeReq, Date endTimeReq, int lengthLeft, int lengthRight) { |
| | | Date[] result = new Date[3]; |
| | | Date predictTime = predictItem.getLastTime(); |