|
|
@@ -0,0 +1,127 @@
|
|
|
+package com.coffee.bus.stats.entity;
|
|
|
+
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+
|
|
|
+import java.util.LinkedHashMap;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.function.Function;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author lifang
|
|
|
+ * @version 1.0.0
|
|
|
+ * @ClassName AlarmScatter.java
|
|
|
+ * @Description <报警名称,<时间,报警次数>>
|
|
|
+ * @createTime 2022年06月11日 17:10:00
|
|
|
+ */
|
|
|
+public class AlarmScatter extends LinkedHashMap<String, Map<String, AlarmScatter.AlarmStatsByTime>> {
|
|
|
+ public Map<String, AlarmScatter.AlarmStatsByTime> getJam(String time) {
|
|
|
+ return this.computeIfAbsent("jam", initValue(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void incrementJam(String time) {
|
|
|
+ incrementValue(this.getJam(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, AlarmScatter.AlarmStatsByTime> getLimit(String time) {
|
|
|
+ return this.computeIfAbsent("limit", initValue(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void incrementLimit(String time) {
|
|
|
+ incrementValue(this.getLimit(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, AlarmScatter.AlarmStatsByTime> getNoBox(String time) {
|
|
|
+ return this.computeIfAbsent("noBox", initValue(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void incrementNoBox(String time) {
|
|
|
+ incrementValue(this.getNoBox(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, AlarmScatter.AlarmStatsByTime> getOutOfControl(String time) {
|
|
|
+ return this.computeIfAbsent("outOfControl", initValue(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void incrementOutOfControl(String time) {
|
|
|
+ incrementValue(this.getOutOfControl(time));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Map<String, AlarmScatter.AlarmStatsByTime> getAnalgesicPoor(String time) {
|
|
|
+ return this.computeIfAbsent("analgesicPoor", initValue(time));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void incrementAnalgesicPoor(String time) {
|
|
|
+ incrementValue(this.getAnalgesicPoor(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, AlarmScatter.AlarmStatsByTime> getNoSignal(String time) {
|
|
|
+ return this.computeIfAbsent("noSignal", initValue(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void incrementNoSignal(String time) {
|
|
|
+ incrementValue(this.getNoSignal(time));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Map<String, AlarmScatter.AlarmStatsByTime> getMachine(String time) {
|
|
|
+ return this.computeIfAbsent("machine", initValue(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void incrementMachine(String time) {
|
|
|
+ incrementValue(this.getMachine(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, AlarmScatter.AlarmStatsByTime> getLowBattery(String time) {
|
|
|
+ return this.computeIfAbsent("lowBattery", initValue(time));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void incrementLowBattery(String time) {
|
|
|
+ incrementValue(this.getLowBattery(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, AlarmScatter.AlarmStatsByTime> getBubble(String time) {
|
|
|
+ return this.computeIfAbsent("bubble", initValue(time));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void incrementBubble(String time) {
|
|
|
+ incrementValue(this.getBubble(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, AlarmScatter.AlarmStatsByTime> getLowInfusion(String time) {
|
|
|
+ return this.computeIfAbsent("lowInfusion", initValue(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void incrementLowInfusion(String time) {
|
|
|
+ incrementValue(this.getLowInfusion(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, AlarmScatter.AlarmStatsByTime> getInfusionMax(String time) {
|
|
|
+ return this.computeIfAbsent("infusionMax", initValue(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void incrementInfusionMax(String time) {
|
|
|
+ incrementValue(this.getInfusionMax(time));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void incrementValue(Map<String, AlarmScatter.AlarmStatsByTime> map){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private Function<String, Map<String, AlarmScatter.AlarmStatsByTime>> initValue(String time){
|
|
|
+ return k->{
|
|
|
+ Map<String, AlarmScatter.AlarmStatsByTime> map = new LinkedHashMap<>();
|
|
|
+ map.computeIfAbsent(time,t->AlarmStatsByTime.of(time,0L));
|
|
|
+ return map;
|
|
|
+ };
|
|
|
+ }
|
|
|
+ @AllArgsConstructor(staticName = "of")
|
|
|
+ public static class AlarmStatsByTime{
|
|
|
+ private String time;
|
|
|
+ private Long count;
|
|
|
+ }
|
|
|
+}
|