|
|
@@ -0,0 +1,347 @@
|
|
|
+package com.jjt.lean.vo;
|
|
|
+
|
|
|
+import io.swagger.annotations.ApiModel;
|
|
|
+import io.swagger.annotations.ApiModelProperty;
|
|
|
+import lombok.Data;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 污水监测数据
|
|
|
+ *
|
|
|
+ * @author wukai
|
|
|
+ */
|
|
|
+@ApiModel("污水监测数据")
|
|
|
+@Data
|
|
|
+public class WaterVO {
|
|
|
+
|
|
|
+
|
|
|
+ private static final long serialVersionUID = 1L;
|
|
|
+ private static final String PREFIX = "root.tl.suxi.";
|
|
|
+
|
|
|
+ public WaterVO() {
|
|
|
+ // 初始化默认值为0
|
|
|
+ this.lift1 = 0.0f;
|
|
|
+ this.lift2 = 0.0f;
|
|
|
+ this.discharge = 0.0f;
|
|
|
+ this.rainOut = 0.0f;
|
|
|
+ this.rainIn = 0.0f;
|
|
|
+ this.mbr = 0.0f;
|
|
|
+ this.ro = 0.0f;
|
|
|
+ this.roConcentrate = 0.0f;
|
|
|
+ this.recovery = 0.0f;
|
|
|
+ this.cod = 0.0f;
|
|
|
+ this.nitrogen = 0.0f;
|
|
|
+ this.ammonia = 0.0f;
|
|
|
+ this.ph = 0.0f;
|
|
|
+ this.flow = 0.0f;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiModelProperty("污水站1号总提升累计量")
|
|
|
+ private Float lift1;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水站2号总提升累计量")
|
|
|
+ private Float lift2;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水站外排总累计量")
|
|
|
+ private Float discharge;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水站雨水出口总累计量")
|
|
|
+ private Float rainOut;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水站雨水进口总累计量")
|
|
|
+ private Float rainIn;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水站MBR产水总累计量")
|
|
|
+ private Float mbr;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水站RO产水量总累计量")
|
|
|
+ private Float ro;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水站RO浓水量总累计量")
|
|
|
+ private Float roConcentrate;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水站中水回收率百分比")
|
|
|
+ private Float recovery;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水排放口COD实际值")
|
|
|
+ private Float cod;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水排放口总氮实际值")
|
|
|
+ private Float nitrogen;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水排放口氨氮实际值")
|
|
|
+ private Float ammonia;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水排放口PH值实际值")
|
|
|
+ private Float ph;
|
|
|
+
|
|
|
+ @ApiModelProperty("污水排放口排放实时流量实际值")
|
|
|
+ private Float flow;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取字段映射关系
|
|
|
+ * @return 字段映射Map
|
|
|
+ */
|
|
|
+ public Map<String, String> getFieldMapping() {
|
|
|
+ Map<String, String> mapping = new HashMap<>();
|
|
|
+ mapping.put(PREFIX + "wsz1pc_PLC1.Water_Treatment_1PC_data187", "lift1");
|
|
|
+ mapping.put(PREFIX + "wsz4pc_PLC1.Water_Treatment_4PC_data377", "lift2");
|
|
|
+ mapping.put(PREFIX + "Watertestdata1_Water_test_data.Water_test_data6", "discharge");
|
|
|
+ mapping.put(PREFIX + "wszhs1pc_PLC1.Water_Treatment_HS1PS_data102", "rainOut");
|
|
|
+ mapping.put(PREFIX + "wszhs1pc_PLC1.Water_Treatment_HS1PS_data103", "rainIn");
|
|
|
+ mapping.put(PREFIX + "wszro_mbr_PLC1.InstrumentDATA_30", "mbr");
|
|
|
+ mapping.put(PREFIX + "wszro_mbr_PLC1.InstrumentDATA_31", "ro");
|
|
|
+ mapping.put(PREFIX + "wszro_mbr_PLC1.InstrumentDATA_32", "roConcentrate");
|
|
|
+ mapping.put(PREFIX + "recycledwater1_plc1.spare9", "recovery");
|
|
|
+ mapping.put(PREFIX + "Watertestdata1_Water_test_data.Water_test_data1", "cod");
|
|
|
+ mapping.put(PREFIX + "Watertestdata1_Water_test_data.Water_test_data2", "nitrogen");
|
|
|
+ mapping.put(PREFIX + "Watertestdata1_Water_test_data.Water_test_data3", "ammonia");
|
|
|
+ mapping.put(PREFIX + "Watertestdata1_Water_test_data.Water_test_data4", "ph");
|
|
|
+ mapping.put(PREFIX + "Watertestdata1_Water_test_data.Water_test_data5", "flow");
|
|
|
+ return mapping;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置字段值并保留两位小数
|
|
|
+ * @param fieldName 字段名
|
|
|
+ * @param value 值
|
|
|
+ */
|
|
|
+ public void setFieldValue(String fieldName, String value) {
|
|
|
+ try {
|
|
|
+ Float floatValue = new BigDecimal(value).setScale(2, RoundingMode.HALF_UP).floatValue();
|
|
|
+
|
|
|
+ switch (fieldName) {
|
|
|
+ case "lift1":
|
|
|
+ this.lift1 = floatValue;
|
|
|
+ break;
|
|
|
+ case "lift2":
|
|
|
+ this.lift2 = floatValue;
|
|
|
+ break;
|
|
|
+ case "discharge":
|
|
|
+ this.discharge = floatValue;
|
|
|
+ break;
|
|
|
+ case "rainOut":
|
|
|
+ this.rainOut = floatValue;
|
|
|
+ break;
|
|
|
+ case "rainIn":
|
|
|
+ this.rainIn = floatValue;
|
|
|
+ break;
|
|
|
+ case "mbr":
|
|
|
+ this.mbr = floatValue;
|
|
|
+ break;
|
|
|
+ case "ro":
|
|
|
+ this.ro = floatValue;
|
|
|
+ break;
|
|
|
+ case "roConcentrate":
|
|
|
+ this.roConcentrate = floatValue;
|
|
|
+ break;
|
|
|
+ case "recovery":
|
|
|
+ this.recovery = floatValue;
|
|
|
+ break;
|
|
|
+ case "cod":
|
|
|
+ this.cod = floatValue;
|
|
|
+ break;
|
|
|
+ case "nitrogen":
|
|
|
+ this.nitrogen = floatValue;
|
|
|
+ break;
|
|
|
+ case "ammonia":
|
|
|
+ this.ammonia = floatValue;
|
|
|
+ break;
|
|
|
+ case "ph":
|
|
|
+ this.ph = floatValue;
|
|
|
+ break;
|
|
|
+ case "flow":
|
|
|
+ this.flow = floatValue;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ // 如果转换失败,设置为0.00
|
|
|
+ switch (fieldName) {
|
|
|
+ case "lift1":
|
|
|
+ this.lift1 = 0.0f;
|
|
|
+ break;
|
|
|
+ case "lift2":
|
|
|
+ this.lift2 = 0.0f;
|
|
|
+ break;
|
|
|
+ case "discharge":
|
|
|
+ this.discharge = 0.0f;
|
|
|
+ break;
|
|
|
+ case "rainOut":
|
|
|
+ this.rainOut = 0.0f;
|
|
|
+ break;
|
|
|
+ case "rainIn":
|
|
|
+ this.rainIn = 0.0f;
|
|
|
+ break;
|
|
|
+ case "mbr":
|
|
|
+ this.mbr = 0.0f;
|
|
|
+ break;
|
|
|
+ case "ro":
|
|
|
+ this.ro = 0.0f;
|
|
|
+ break;
|
|
|
+ case "roConcentrate":
|
|
|
+ this.roConcentrate = 0.0f;
|
|
|
+ break;
|
|
|
+ case "recovery":
|
|
|
+ this.recovery = 0.0f;
|
|
|
+ break;
|
|
|
+ case "cod":
|
|
|
+ this.cod = 0.0f;
|
|
|
+ break;
|
|
|
+ case "nitrogen":
|
|
|
+ this.nitrogen = 0.0f;
|
|
|
+ break;
|
|
|
+ case "ammonia":
|
|
|
+ this.ammonia = 0.0f;
|
|
|
+ break;
|
|
|
+ case "ph":
|
|
|
+ this.ph = 0.0f;
|
|
|
+ break;
|
|
|
+ case "flow":
|
|
|
+ this.flow = 0.0f;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成前端所需的数据结构
|
|
|
+ * @return 前端所需的数据列表
|
|
|
+ */
|
|
|
+ public List<Map<String, Object>> toFrontendData() {
|
|
|
+ List<Map<String, Object>> result = new ArrayList<>();
|
|
|
+
|
|
|
+ // 添加污水站1号总提升累计量
|
|
|
+ Map<String, Object> item1 = new HashMap<>();
|
|
|
+ item1.put("name", "污水站1号总提升累计量");
|
|
|
+ item1.put("unit", "m³");
|
|
|
+ item1.put("value", this.lift1 != null ? this.lift1 : 0.0f);
|
|
|
+ item1.put("key", "lift1");
|
|
|
+ item1.put("colorClass", "blue-theme");
|
|
|
+ result.add(item1);
|
|
|
+
|
|
|
+ // 添加污水站2号总提升累计量
|
|
|
+ Map<String, Object> item2 = new HashMap<>();
|
|
|
+ item2.put("name", "污水站2号总提升累计量");
|
|
|
+ item2.put("unit", "m³");
|
|
|
+ item2.put("value", this.lift2 != null ? this.lift2 : 0.0f);
|
|
|
+ item2.put("key", "lift2");
|
|
|
+ item2.put("colorClass", "blue-theme");
|
|
|
+ result.add(item2);
|
|
|
+
|
|
|
+ // 添加污水站外排总累计量
|
|
|
+ Map<String, Object> item3 = new HashMap<>();
|
|
|
+ item3.put("name", "污水站外排总累计量");
|
|
|
+ item3.put("unit", "m³");
|
|
|
+ item3.put("value", this.discharge != null ? this.discharge : 0.0f);
|
|
|
+ item3.put("key", "discharge");
|
|
|
+ item3.put("colorClass", "blue-theme");
|
|
|
+ result.add(item3);
|
|
|
+
|
|
|
+ // 添加污水站雨水出口总累计量
|
|
|
+ Map<String, Object> item4 = new HashMap<>();
|
|
|
+ item4.put("name", "污水站雨水出口总累计量");
|
|
|
+ item4.put("unit", "m³");
|
|
|
+ item4.put("value", this.rainOut != null ? this.rainOut : 0.0f);
|
|
|
+ item4.put("key", "rainOut");
|
|
|
+ item4.put("colorClass", "cyan-theme");
|
|
|
+ result.add(item4);
|
|
|
+
|
|
|
+ // 添加污水站雨水进口总累计量
|
|
|
+ Map<String, Object> item5 = new HashMap<>();
|
|
|
+ item5.put("name", "污水站雨水进口总累计量");
|
|
|
+ item5.put("unit", "m³");
|
|
|
+ item5.put("value", this.rainIn != null ? this.rainIn : 0.0f);
|
|
|
+ item5.put("key", "rainIn");
|
|
|
+ item5.put("colorClass", "cyan-theme");
|
|
|
+ result.add(item5);
|
|
|
+
|
|
|
+ // 添加污水站MBR产水总累计量
|
|
|
+ Map<String, Object> item6 = new HashMap<>();
|
|
|
+ item6.put("name", "污水站MBR产水总累计量");
|
|
|
+ item6.put("unit", "m³");
|
|
|
+ item6.put("value", this.mbr != null ? this.mbr : 0.0f);
|
|
|
+ item6.put("key", "mbr");
|
|
|
+ item6.put("colorClass", "green-theme");
|
|
|
+ result.add(item6);
|
|
|
+
|
|
|
+ // 添加污水站RO产水量总累计量
|
|
|
+ Map<String, Object> item7 = new HashMap<>();
|
|
|
+ item7.put("name", "污水站RO产水量总累计量");
|
|
|
+ item7.put("unit", "m³");
|
|
|
+ item7.put("value", this.ro != null ? this.ro : 0.0f);
|
|
|
+ item7.put("key", "ro");
|
|
|
+ item7.put("colorClass", "green-theme");
|
|
|
+ result.add(item7);
|
|
|
+
|
|
|
+ // 添加污水站RO浓水量总累计量
|
|
|
+ Map<String, Object> item8 = new HashMap<>();
|
|
|
+ item8.put("name", "污水站RO浓水量总累计量");
|
|
|
+ item8.put("unit", "m³");
|
|
|
+ item8.put("value", this.roConcentrate != null ? this.roConcentrate : 0.0f);
|
|
|
+ item8.put("key", "roConcentrate");
|
|
|
+ item8.put("colorClass", "green-theme");
|
|
|
+ result.add(item8);
|
|
|
+
|
|
|
+ // 添加污水站中水回收率百分比
|
|
|
+ Map<String, Object> item9 = new HashMap<>();
|
|
|
+ item9.put("name", "污水站中水回收率百分比");
|
|
|
+ item9.put("unit", "%");
|
|
|
+ item9.put("value", this.recovery != null ? this.recovery : 0.0f);
|
|
|
+ item9.put("key", "recovery");
|
|
|
+ item9.put("colorClass", "purple-theme");
|
|
|
+ result.add(item9);
|
|
|
+
|
|
|
+ // 添加污水排放口COD实际值
|
|
|
+ Map<String, Object> item10 = new HashMap<>();
|
|
|
+ item10.put("name", "污水排放口COD实际值");
|
|
|
+ item10.put("unit", "mg/L");
|
|
|
+ item10.put("value", this.cod != null ? this.cod : 0.0f);
|
|
|
+ item10.put("key", "cod");
|
|
|
+ item10.put("colorClass", "orange-theme");
|
|
|
+ result.add(item10);
|
|
|
+
|
|
|
+ // 添加污水排放口总氮实际值
|
|
|
+ Map<String, Object> item11 = new HashMap<>();
|
|
|
+ item11.put("name", "污水排放口总氮实际值");
|
|
|
+ item11.put("unit", "mg/L");
|
|
|
+ item11.put("value", this.nitrogen != null ? this.nitrogen : 0.0f);
|
|
|
+ item11.put("key", "nitrogen");
|
|
|
+ item11.put("colorClass", "orange-theme");
|
|
|
+ result.add(item11);
|
|
|
+
|
|
|
+ // 添加污水排放口氨氮实际值
|
|
|
+ Map<String, Object> item12 = new HashMap<>();
|
|
|
+ item12.put("name", "污水排放口氨氮实际值");
|
|
|
+ item12.put("unit", "mg/L");
|
|
|
+ item12.put("value", this.ammonia != null ? this.ammonia : 0.0f);
|
|
|
+ item12.put("key", "ammonia");
|
|
|
+ item12.put("colorClass", "orange-theme");
|
|
|
+ result.add(item12);
|
|
|
+
|
|
|
+ // 添加污水排放口PH值实际值
|
|
|
+ Map<String, Object> item13 = new HashMap<>();
|
|
|
+ item13.put("name", "污水排放口PH值实际值");
|
|
|
+ item13.put("unit", "");
|
|
|
+ item13.put("value", this.ph != null ? this.ph : 0.0f);
|
|
|
+ item13.put("key", "ph");
|
|
|
+ item13.put("colorClass", "yellow-theme");
|
|
|
+ result.add(item13);
|
|
|
+
|
|
|
+ // 添加污水排放口排放实时流量实际值
|
|
|
+ Map<String, Object> item14 = new HashMap<>();
|
|
|
+ item14.put("name", "污水排放口排放实时流量实际值");
|
|
|
+ item14.put("unit", "m³/h");
|
|
|
+ item14.put("value", this.flow != null ? this.flow : 0.0f);
|
|
|
+ item14.put("key", "flow");
|
|
|
+ item14.put("colorClass", "red-theme");
|
|
|
+ result.add(item14);
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+}
|