|
@@ -59,11 +59,8 @@ public class TrainFaultPredictController {
|
|
|
*/
|
|
|
private String fileName;
|
|
|
|
|
|
-
|
|
|
private static final Object locker = new Object();
|
|
|
|
|
|
-
|
|
|
-
|
|
|
private String name1;
|
|
|
private String forecastLabel1;
|
|
|
private String[] inputLabel1;
|
|
@@ -71,9 +68,6 @@ public class TrainFaultPredictController {
|
|
|
private MultipartFile file1;
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 离线文件模式训练故障预测接口
|
|
|
* @param forecastLabel
|
|
@@ -232,5 +226,56 @@ public class TrainFaultPredictController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /** 开始预测 查询 golden 所有原始数据
|
|
|
+ * flag ture: 所有数据 ;false: 前10条数据
|
|
|
+ * **/
|
|
|
+ @PostMapping("/pointfaultdata")
|
|
|
+ public JSONObject getWarningData(@RequestBody JSONObject json){
|
|
|
+ if (json == null)
|
|
|
+ return JsonResult.error(ResultCode.PARAM_IS_BLANK);
|
|
|
+
|
|
|
+
|
|
|
+ log.info("进入预测程序");
|
|
|
+ boolean flag = json.getBooleanValue("flag");
|
|
|
+ List<Diagnosepoint> points = JSONObject.parseArray(json.getJSONArray("points").toString(), Diagnosepoint.class);
|
|
|
+ List<Casefault> faults = JSONObject.parseArray(json.getJSONArray("faults").toString(), Casefault.class);
|
|
|
+
|
|
|
+ /** 组装数据 删除添加的故障类型**/
|
|
|
+ dataDiagnoseService.formatUniformcode(points.stream().filter(a -> !a.getUniformcode().equals("faulttype")).collect(Collectors.toList()));
|
|
|
+ executeInfo = new ExecuteInfo();
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ DataInfo[] dataInfos = new DataInfo[faults.size()];
|
|
|
+ for (int i = 0; i < faults.size(); i++){
|
|
|
+ DataInfo data = new DataInfo();
|
|
|
+ data.setId(Long.valueOf(faults.get(i).getId()));
|
|
|
+ data.setStationId(faults.get(i).getStationen());
|
|
|
+ data.setThingId(faults.get(i).getWindturbineid());
|
|
|
+ data.setModelId(faults.get(i).getModel());
|
|
|
+ data.setTag(faults.get(i).getFaultcode());
|
|
|
+ data.setFaultTime(faults.get(i).getStarttime());
|
|
|
+
|
|
|
+ cal.setTime(DateUtil.parseStrtoDate(faults.get(i).getStarttime(), DateUtil.YYYY_MM_DD_HH_MM_SS));
|
|
|
+ cal.add(Calendar.MINUTE, -30);
|
|
|
+ data.setStartTs(cal.getTimeInMillis() + "");
|
|
|
+ cal.add(Calendar.MINUTE, 30);
|
|
|
+ data.setEndTs(cal.getTimeInMillis() + "");
|
|
|
+ dataInfos[i] = data;
|
|
|
+ }
|
|
|
+ executeInfo.setDataInfos(dataInfos);
|
|
|
+ if (flag){
|
|
|
+ if (!cmdFaultPredictService.isComplete()) {
|
|
|
+ return JsonResult.error(4000, "已有正在预测的故障模型...");
|
|
|
+ }
|
|
|
+ synchronized (locker) {
|
|
|
+ taskExecutor.submit(this::execute);
|
|
|
+ }
|
|
|
+ return JsonResult.success(ResultCode.SUCCESS);
|
|
|
+ }else {
|
|
|
+ Map<String, Object> mp = dataDiagnoseService.getFormData(executeInfo);
|
|
|
+ return JsonResult.successData(ResultCode.SUCCESS, mp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|