| | |
| | | resultJson.setPredicttime(predictTime); |
| | | List<Double> jsonValueList = entry.getValue().stream().map(valueVO -> valueVO.getDataValue()).collect(Collectors.toList()); |
| | | resultJson.setJsonvalue(JSONArray.toJSONString(jsonValueList)); |
| | | resultJson.setCumulant(""); |
| | | resultJsonList.add(resultJson); |
| | | } |
| | | // json结果存入mysql |
| | | mmItemResultJsonService.insertBatch(resultJsonList); |
| | | mmItemResultJsonService.insert(resultJsonList); |
| | | // double结果存入influxdb |
| | | influxDBService.asyncWriteModelResults(importList); |
| | | influxDBService.asyncWriteModelResults(lastList); |
| | |
| | | result.add(dataItem); |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public void savePredictValue(Map<MmItemOutputEntity, Double> predictDoubleValues, Date predictTime) { |
| | | List<InfluxModelResultPOJO> list = new ArrayList<>(); |
| | | for (Map.Entry<MmItemOutputEntity, Double> entry : predictDoubleValues.entrySet()) { |
| | | InfluxModelResultSimPOJO pojo = new InfluxModelResultSimPOJO(); |
| | | pojo.setValue(entry.getValue()); |
| | | pojo.setTimestamp(predictTime.toInstant()); |
| | | pojo.setOutPutId(entry.getKey().getId()); |
| | | pojo.setType(DataTypeEnum.FLOAT.getCode()); |
| | | list.add(pojo); |
| | | } |
| | | influxDBService.asyncWriteModelResults(list); |
| | | } |
| | | } |