|
@@ -3,6 +3,7 @@ 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.common.spring.InitialRunner;
|
|
|
import com.gyee.impala.model.master.Casewarningcustom;
|
|
|
import com.gyee.impala.model.master.Casewarningscada;
|
|
|
import com.gyee.impala.model.master.Powercurvebasic;
|
|
@@ -36,31 +37,36 @@ public class CaseWarningController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/warning/custom/list")
|
|
|
- public JSONObject warnCustomAll(String station, String wtId, String code, String st, String et) {
|
|
|
+ public JSONObject warnCustomAll(String station, String wtId, String[] code, String st, String et) {
|
|
|
List<Casewarningcustom> list = customService.getAll(station, wtId, code, st, et);
|
|
|
/**过滤 同类风机 次数、时长相加**/
|
|
|
TreeMap<String, Map<String, List<Casewarningcustom>>> collect = list.stream()
|
|
|
.collect(Collectors.groupingBy(Casewarningcustom::getWindturbineid, TreeMap::new,
|
|
|
- Collectors.groupingBy(Casewarningcustom::getWarntype)));
|
|
|
+ Collectors.groupingBy(Casewarningcustom::getWarncode)));
|
|
|
|
|
|
/** 通过类型风机次数、时长相加 **/
|
|
|
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);
|
|
|
- }
|
|
|
+ Map<String, List<Casewarningcustom>> mpType = v1.stream().collect(Collectors.groupingBy(Casewarningcustom::getWarndes));
|
|
|
+ mpType.forEach((k2, v2) -> {
|
|
|
+ Casewarningcustom cs = new Casewarningcustom();
|
|
|
+ int count = 0;
|
|
|
+ double duration = 0;
|
|
|
+ for (Casewarningcustom o : v2) {
|
|
|
+ count += o.getCount();
|
|
|
+ duration += o.getDuration();
|
|
|
+ cs.setWarndes(o.getWarndes());
|
|
|
+ }
|
|
|
+ if (count != 0 && duration != 0){
|
|
|
+ cs.setWindturbineid(k);
|
|
|
+ cs.setWarncode(k1);
|
|
|
+ cs.setWarntype(InitialRunner.customWarnMap.get(k1));
|
|
|
+ cs.setWarndes(k2);
|
|
|
+ cs.setCount(count);
|
|
|
+ cs.setDuration(duration);
|
|
|
+ ls.add(cs);
|
|
|
+ }
|
|
|
+ });
|
|
|
}));
|
|
|
return JsonResult.successData(ResultCode.SUCCESS, ls);
|
|
|
}
|