|
@@ -5,11 +5,14 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.gyee.impala.common.feign.RemoteServiceBuilder;
|
|
|
import com.gyee.impala.common.result.JsonResult;
|
|
|
import com.gyee.impala.common.result.ResultCode;
|
|
|
+import com.gyee.impala.common.spring.InitialRunner;
|
|
|
import com.gyee.impala.common.util.DateUtil;
|
|
|
import com.gyee.impala.model.custom.diagnose.DataInfo;
|
|
|
import com.gyee.impala.model.custom.diagnose.FaultInfo;
|
|
|
import com.gyee.impala.model.custom.diagnose.PointData;
|
|
|
+import com.gyee.impala.model.master.diagnose.Diagnosepoint;
|
|
|
import com.gyee.impala.model.master.diagnose.Diagnosereport;
|
|
|
+import com.gyee.impala.service.custom.diagnose.DataPointService;
|
|
|
import com.gyee.impala.service.custom.diagnose.DataService;
|
|
|
import com.gyee.impala.service.master.diagnose.DiagnosereportService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -30,6 +33,8 @@ public class AutoFaultController {
|
|
|
@Resource
|
|
|
private DataService dataService;
|
|
|
@Resource
|
|
|
+ private DataPointService dataPointService;
|
|
|
+ @Resource
|
|
|
private DiagnosereportService reportService;
|
|
|
@Resource
|
|
|
private RemoteServiceBuilder shardingBuilder;
|
|
@@ -46,7 +51,7 @@ public class AutoFaultController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取故障原始数据
|
|
|
+ * 获取故障原始数据(is页面)
|
|
|
* @param faultid
|
|
|
* @return
|
|
|
*/
|
|
@@ -86,6 +91,39 @@ public class AutoFaultController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取故障原始数据(集成在报警配置系统里的)
|
|
|
+ * @param faultid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/faultdata/{faultid}")
|
|
|
+ public JSONObject getFaultData(@PathVariable long faultid) {
|
|
|
+ List<FaultInfo> fis = shardingBuilder.sharding().getFaultHistoryById(faultid + "");
|
|
|
+ if (fis == null || fis.size() <= 0) {
|
|
|
+ return JsonResult.error(ResultCode.ERROR_DATA);
|
|
|
+ }
|
|
|
+
|
|
|
+ FaultInfo fi = fis.get(0);
|
|
|
+ String faultTime = fi.getFaultTime();
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(DateUtil.parseStrtoDate(faultTime));
|
|
|
+ DataInfo dataInfo = new DataInfo();
|
|
|
+ dataInfo.setId(fi.getId());
|
|
|
+ dataInfo.setFaultTime(String.valueOf(calendar.getTime().getTime()));
|
|
|
+ dataInfo.setEndTs(String.valueOf(calendar.getTime().getTime()));
|
|
|
+ calendar.add(Calendar.MINUTE, -2);
|
|
|
+ dataInfo.setStartTs(String.valueOf(calendar.getTime().getTime()));
|
|
|
+ dataInfo.setThingId(fi.getWindturbineId());
|
|
|
+ dataInfo.setModelId(fi.getModelId());
|
|
|
+ dataInfo.setStationId(fi.getStationId());
|
|
|
+
|
|
|
+ List<Diagnosepoint> uniforms = InitialRunner.mapPoint.get(fi.getStationId()).get(fi.getModelId());
|
|
|
+ dataPointService.formatUniformcode(uniforms);
|
|
|
+ Map<String, List<PointData>> data = dataPointService.getData(dataInfo);
|
|
|
+ return JsonResult.successData(ResultCode.SUCCESS, data);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@PostMapping("/report/add")
|
|
|
public JSONObject getHistory(@RequestBody Diagnosereport obj) {
|
|
|
reportService.insertItem(obj);
|