|
@@ -1,16 +1,21 @@
|
|
|
package com.gyee.impala.controller.sample.cases;
|
|
|
|
|
|
-
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.gyee.impala.common.result.JsonResult;
|
|
|
import com.gyee.impala.common.result.ResultCode;
|
|
|
import com.gyee.impala.model.master.Casewarningcustom;
|
|
|
import com.gyee.impala.model.master.Casewarningscada;
|
|
|
+import com.gyee.impala.model.master.Powercurvebasic;
|
|
|
import com.gyee.impala.service.master.CasewarningcustomService;
|
|
|
import com.gyee.impala.service.master.CasewarningscadaService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.TreeMap;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 故障样本库操作
|
|
@@ -33,7 +38,31 @@ public class CaseWarningController {
|
|
|
@GetMapping("/warning/custom/list")
|
|
|
public JSONObject warnCustomAll(String station, String wtId, String code, String st, String et) {
|
|
|
List<Casewarningcustom> list = customService.getAll(station, wtId, code, st, et);
|
|
|
- return JsonResult.successData(ResultCode.SUCCESS, list);
|
|
|
+ /**过滤 同类风机 次数、时长相加**/
|
|
|
+ TreeMap<String, Map<String, List<Casewarningcustom>>> collect = list.stream()
|
|
|
+ .collect(Collectors.groupingBy(Casewarningcustom::getWindturbineid, TreeMap::new,
|
|
|
+ Collectors.groupingBy(Casewarningcustom::getWarntype)));
|
|
|
+
|
|
|
+ /** 通过类型风机次数、时长相加 **/
|
|
|
+ List<Casewarningcustom> ls = new ArrayList<>();
|
|
|
+ collect.forEach((k, v) -> v.forEach((k1, v1) -> {
|
|
|
+ Casewarningcustom cs = new Casewarningcustom();
|
|
|
+ int count = 0;
|
|
|
+ double duration = 0;
|
|
|
+ for (Casewarningcustom o : v1) {
|
|
|
+ count += o.getCount();
|
|
|
+ duration += o.getDuration();
|
|
|
+ cs.setWarndes(o.getWarndes());
|
|
|
+ }
|
|
|
+ if (count != 0 && duration != 0){
|
|
|
+ cs.setWindturbineid(k);
|
|
|
+ cs.setWarntype(k1);
|
|
|
+ cs.setCount(count);
|
|
|
+ cs.setDuration(duration);
|
|
|
+ ls.add(cs);
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ return JsonResult.successData(ResultCode.SUCCESS, ls);
|
|
|
}
|
|
|
|
|
|
|