feat: 油色谱数据增加三比值计算
parent
798c2477f5
commit
e9e1f8e26b
@ -0,0 +1,113 @@
|
|||||||
|
package com.xydl.cac.model;
|
||||||
|
|
||||||
|
import com.xydl.cac.exception.BusinessException;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SanbizhiModel {
|
||||||
|
Float c2h2;
|
||||||
|
Float c2h4;
|
||||||
|
Float ch4;
|
||||||
|
Float h2;
|
||||||
|
Float c2h6;
|
||||||
|
Float c2h2_c2h4_value;
|
||||||
|
String c2h2_c2h4_code;
|
||||||
|
Float ch4_h2_value;
|
||||||
|
String ch4_h2_code;
|
||||||
|
Float c2h4_c2h6_value;
|
||||||
|
String c2h4_c2h6_code;
|
||||||
|
String status;
|
||||||
|
|
||||||
|
public void build(Map<String, Object> map) throws BusinessException {
|
||||||
|
Iterator<String> it = map.keySet().iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
String key = it.next();
|
||||||
|
String name = key.toLowerCase();
|
||||||
|
if (name.contains("c2h2")) {
|
||||||
|
c2h2 = (Float) map.get(key);
|
||||||
|
} else if (name.contains("c2h4")) {
|
||||||
|
c2h4 = (Float) map.get(key);
|
||||||
|
} else if (name.contains("ch4")) {
|
||||||
|
ch4 = (Float) map.get(key);
|
||||||
|
} else if (name.contains("h2")) {
|
||||||
|
h2 = (Float) map.get(key);
|
||||||
|
} else if (name.contains("c2h6")) {
|
||||||
|
c2h6 = (Float) map.get(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (c2h2 == null || c2h4 == null || ch4 == null || h2 == null || c2h6 == null) {
|
||||||
|
throw new BusinessException("数据不符合");
|
||||||
|
}
|
||||||
|
c2h2_c2h4_value = c2h2 / c2h4;
|
||||||
|
ch4_h2_value = ch4 / h2;
|
||||||
|
c2h4_c2h6_value = c2h4 / c2h6;
|
||||||
|
if (c2h2_c2h4_value < 0.1) {
|
||||||
|
c2h2_c2h4_code = "0";
|
||||||
|
} else if (c2h2_c2h4_value < 1) {
|
||||||
|
c2h2_c2h4_code = "1";
|
||||||
|
} else if (c2h2_c2h4_value < 3) {
|
||||||
|
c2h2_c2h4_code = "1";
|
||||||
|
} else {
|
||||||
|
c2h2_c2h4_code = "2";
|
||||||
|
}
|
||||||
|
if (ch4_h2_value < 0.1) {
|
||||||
|
ch4_h2_code = "1";
|
||||||
|
} else if (ch4_h2_value < 1) {
|
||||||
|
ch4_h2_code = "0";
|
||||||
|
} else if (ch4_h2_value < 3) {
|
||||||
|
ch4_h2_code = "2";
|
||||||
|
} else {
|
||||||
|
ch4_h2_code = "2";
|
||||||
|
}
|
||||||
|
if (c2h4_c2h6_value < 0.1) {
|
||||||
|
c2h4_c2h6_code = "0";
|
||||||
|
} else if (c2h4_c2h6_value < 1) {
|
||||||
|
c2h4_c2h6_code = "0";
|
||||||
|
} else if (c2h4_c2h6_value < 3) {
|
||||||
|
c2h4_c2h6_code = "1";
|
||||||
|
} else {
|
||||||
|
c2h4_c2h6_code = "2";
|
||||||
|
}
|
||||||
|
status = "正常";
|
||||||
|
if (c2h2_c2h4_code.equals("0")) {
|
||||||
|
if (c2h4_c2h6_code.equals("0")) {
|
||||||
|
if (ch4_h2_code.equals("0")) {
|
||||||
|
|
||||||
|
} else if (ch4_h2_code.equals("1")) {
|
||||||
|
status = "局部放电";
|
||||||
|
} else if (ch4_h2_code.equals("2")) {
|
||||||
|
status = "低温过热(150-300)C";
|
||||||
|
}
|
||||||
|
} else if (c2h4_c2h6_code.equals("1")) {
|
||||||
|
if (ch4_h2_code.equals("0")) {
|
||||||
|
status = "低温过热(低于150C)";
|
||||||
|
} else if (ch4_h2_code.equals("1")) {
|
||||||
|
|
||||||
|
} else if (ch4_h2_code.equals("2")) {
|
||||||
|
status = "中温过热(300-700)C";
|
||||||
|
}
|
||||||
|
} else if (c2h4_c2h6_code.equals("2")) {
|
||||||
|
status = "高温过热(高于700C)";
|
||||||
|
}
|
||||||
|
} else if (c2h2_c2h4_code.equals("1")) {
|
||||||
|
if (ch4_h2_code.equals("0")) {
|
||||||
|
status = "低能放电";
|
||||||
|
} else if (ch4_h2_code.equals("1")) {
|
||||||
|
status = "低能放电";
|
||||||
|
} else if (ch4_h2_code.equals("2")) {
|
||||||
|
status = "低能放电兼过热";
|
||||||
|
}
|
||||||
|
} else if (c2h2_c2h4_code.equals("2")) {
|
||||||
|
if (ch4_h2_code.equals("0")) {
|
||||||
|
status = "电弧放电";
|
||||||
|
} else if (ch4_h2_code.equals("1")) {
|
||||||
|
status = "电弧放电";
|
||||||
|
} else if (ch4_h2_code.equals("2")) {
|
||||||
|
status = "电弧放电兼过热";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue