|
|
|
|
|
|
|
|
import com.tuoheng.admin.mapper.AirDataMapper; |
|
|
import com.tuoheng.admin.mapper.AirDataMapper; |
|
|
import com.tuoheng.admin.mapper.InspectionMapper; |
|
|
import com.tuoheng.admin.mapper.InspectionMapper; |
|
|
import com.tuoheng.common.core.exception.ServiceException; |
|
|
import com.tuoheng.common.core.exception.ServiceException; |
|
|
|
|
|
import com.tuoheng.common.core.utils.DateUtils; |
|
|
import com.tuoheng.common.core.utils.JsonResult; |
|
|
import com.tuoheng.common.core.utils.JsonResult; |
|
|
import com.tuoheng.common.core.utils.StringUtils; |
|
|
import com.tuoheng.common.core.utils.StringUtils; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
|
airData.setCUtcTime(response.getUtcTime()); // UTC时间 |
|
|
airData.setCUtcTime(response.getUtcTime()); // UTC时间 |
|
|
|
|
|
|
|
|
Map<String, Object> airDataMap = response.getAirData(); |
|
|
Map<String, Object> airDataMap = response.getAirData(); |
|
|
|
|
|
|
|
|
String cl2 = String.valueOf(airDataMap.get("CL2(ppm)")); // 氯气(单位ppm) |
|
|
|
|
|
String co = String.valueOf(airDataMap.get("CO(ppm)")); // 一氧化碳(单位ppm) |
|
|
|
|
|
String co2 = String.valueOf(airDataMap.get("CO2(ppm)")); // 二氧化碳(单位ppm) |
|
|
|
|
|
String cxhy = String.valueOf(airDataMap.get("CxHy(%)")); // 碳氢化合物(单位%) |
|
|
|
|
|
String h2 = String.valueOf(airDataMap.get("H2(ppm)")); // 氢气(单位ppm) |
|
|
|
|
|
String h2s = String.valueOf(airDataMap.get("H2S(ppm)")); // 硫化氢(单位ppm) |
|
|
|
|
|
String hcl = String.valueOf(airDataMap.get("HCL(ppm)")); // 氯化氢(单位ppm) |
|
|
|
|
|
String hcn = String.valueOf(airDataMap.get("HCN(ppm)")); // 氰化氢(单位ppm) |
|
|
|
|
|
String nh3 = String.valueOf(airDataMap.get("NH3(ppm)")); // 氨气(单位ppm) |
|
|
|
|
|
String ox = String.valueOf(airDataMap.get("Ox(ppm)")); // 邻二甲苯(单位ppm) |
|
|
|
|
|
String ph3 = String.valueOf(airDataMap.get("PH3(ppm)")); // 磷化氢(单位ppm) |
|
|
|
|
|
String pm_1_0 = String.valueOf(airDataMap.get("PM1.0(ug/m3)")); // PM1.0(单位ug/m3) |
|
|
|
|
|
String pm_10 = String.valueOf(airDataMap.get("PM10(ug/m3)")); // PM10(单位ug/m3) |
|
|
|
|
|
String pm_2_5 = String.valueOf(airDataMap.get("PM2.5(ug/m3)")); // PM2.5(单位ug/m3) |
|
|
|
|
|
String so2 = String.valueOf(airDataMap.get("SO2(ppm)")); // 二氧化硫(单位ppm) |
|
|
|
|
|
String tsp = String.valueOf(airDataMap.get("TSP(mgm3)")); // 磷酸三钠(单位mg/m3) |
|
|
|
|
|
String vocs = String.valueOf(airDataMap.get("VOCs(ppm)")); // 挥发性有机物(单位ppm) |
|
|
|
|
|
String wrSo2 = String.valueOf(airDataMap.get("[WR]SO2(ppm)")); // WR二氧化硫(单位ppm) |
|
|
|
|
|
String no2 = String.valueOf(airDataMap.get("NO2(ppm)")); // 二氧化氮(单位ppm) |
|
|
|
|
|
String o2 = String.valueOf(airDataMap.get("O2(%)")); // 氧气(单位%) |
|
|
|
|
|
String ionizingRadiation = String.valueOf(airDataMap.get("Ionizing Radiation(uSv/h)")); // 电离辐射(uSv/h) |
|
|
|
|
|
String no = String.valueOf(airDataMap.get("NO(ppm)")); // 一氧化氮(ppm) |
|
|
|
|
|
String odorOu = String.valueOf(airDataMap.get("Odor OU")); // 恶臭气体 |
|
|
|
|
|
String hrch4 = String.valueOf(airDataMap.get("[HR]CH4(ppm)")); // [HR]甲烷(ppm) |
|
|
|
|
|
|
|
|
String cl2 = this.getValue(airDataMap,"CL2(ppm)"); // 氯气(单位ppm) |
|
|
|
|
|
String co = this.getValue(airDataMap,"CO(ppm)"); // 一氧化碳(单位ppm) |
|
|
|
|
|
String co2 = this.getValue(airDataMap, "CO2(ppm)"); // 二氧化碳(单位ppm) |
|
|
|
|
|
String cxhy = this.getValue(airDataMap, "CxHy(%)"); // 碳氢化合物(单位%) |
|
|
|
|
|
String h2 = this.getValue(airDataMap, "H2(ppm)"); // 氢气(单位ppm) |
|
|
|
|
|
String h2s = this.getValue(airDataMap, "H2S(ppm)"); // 硫化氢(单位ppm) |
|
|
|
|
|
String hcl = this.getValue(airDataMap, "HCL(ppm)"); // 氯化氢(单位ppm) |
|
|
|
|
|
String hcn = this.getValue(airDataMap, "HCN(ppm)"); // 氰化氢(单位ppm) |
|
|
|
|
|
String nh3 = this.getValue(airDataMap, "NH3(ppm)"); // 氨气(单位ppm) |
|
|
|
|
|
String ox = this.getValue(airDataMap, "Ox(ppm)"); // 邻二甲苯(单位ppm) |
|
|
|
|
|
String ph3 = this.getValue(airDataMap, "PH3(ppm)"); // 磷化氢(单位ppm) |
|
|
|
|
|
String pm_1_0 = this.getValue(airDataMap, "PM1.0(ug/m3)"); // PM1.0(单位ug/m3) |
|
|
|
|
|
String pm_10 = this.getValue(airDataMap, "PM10(ug/m3)"); // PM10(单位ug/m3) |
|
|
|
|
|
String pm_2_5 = this.getValue(airDataMap, "PM2.5(ug/m3)"); // PM2.5(单位ug/m3) |
|
|
|
|
|
String so2 = this.getValue(airDataMap, "SO2(ppm)"); // 二氧化硫(单位ppm) |
|
|
|
|
|
String tsp = this.getValue(airDataMap, "TSP(mgm3)"); // 磷酸三钠(单位mg/m3) |
|
|
|
|
|
String vocs = this.getValue(airDataMap, "VOCs(ppm)"); // 挥发性有机物(单位ppm) |
|
|
|
|
|
String wrSo2 = this.getValue(airDataMap, "[WR]SO2(ppm)"); // WR二氧化硫(单位ppm) |
|
|
|
|
|
String no2 = this.getValue(airDataMap, "NO2(ppm)"); // 二氧化氮(单位ppm) |
|
|
|
|
|
String o2 = this.getValue(airDataMap, "O2(%)"); // 氧气(单位%) |
|
|
|
|
|
String ionizingRadiation = this.getValue(airDataMap, "Ionizing Radiation(uSv/h)"); // 电离辐射(uSv/h) |
|
|
|
|
|
String no = this.getValue(airDataMap, "NO(ppm)"); // 一氧化氮(ppm) |
|
|
|
|
|
String odorOu = this.getValue(airDataMap, "Odor OU"); // 恶臭气体 |
|
|
|
|
|
String hrch4 = this.getValue(airDataMap, "[HR]CH4(ppm)"); // [HR]甲烷(ppm) |
|
|
|
|
|
|
|
|
airData.setCl2(cl2); |
|
|
airData.setCl2(cl2); |
|
|
airData.setCo(co); |
|
|
airData.setCo(co); |
|
|
|
|
|
|
|
|
airData.setNo(no); |
|
|
airData.setNo(no); |
|
|
airData.setOdorOu(odorOu); |
|
|
airData.setOdorOu(odorOu); |
|
|
airData.setHrch4(hrch4); |
|
|
airData.setHrch4(hrch4); |
|
|
|
|
|
|
|
|
|
|
|
airData.setCreateTime(DateUtils.now()); |
|
|
|
|
|
airData.setCreateUser("0"); |
|
|
Integer count = airDataMapper.insert(airData); |
|
|
Integer count = airDataMapper.insert(airData); |
|
|
if (count <= 0) { |
|
|
if (count <= 0) { |
|
|
log.info("拉取灵嗅设备推送数据,插入失败"); |
|
|
log.info("拉取灵嗅设备推送数据,插入失败"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
Inspection inspection = this.getInspection(response.getSerial()); |
|
|
Inspection inspection = this.getInspection(response.getSerial()); |
|
|
if (ObjectUtil.isNull(inspection)) { |
|
|
if (ObjectUtil.isNull(inspection)) { |
|
|
log.info("没有正在飞行的任务,serial={}", response.getSerial()); |
|
|
|
|
|
|
|
|
log.info("没有正在飞行的任务,无法关联推送的灵嗅数据,serial={}", response.getSerial()); |
|
|
return JsonResult.error("没有正在飞行的任务"); |
|
|
return JsonResult.error("没有正在飞行的任务"); |
|
|
} |
|
|
} |
|
|
return JsonResult.success(); |
|
|
return JsonResult.success(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Inspection getInspection(String serial) { |
|
|
private Inspection getInspection(String serial) { |
|
|
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>() |
|
|
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>() |
|
|
.eq(Inspection::getEquipmentMountCode, serial) |
|
|
|
|
|
|
|
|
// .eq(Inspection::getEquipmentMountCode, serial) |
|
|
.eq(Inspection::getStatus, InspectionStatusEnum.IN_FLIGHT.getCode()) |
|
|
.eq(Inspection::getStatus, InspectionStatusEnum.IN_FLIGHT.getCode()) |
|
|
.eq(Inspection::getMark, MarkEnum.VALID.getCode()) |
|
|
.eq(Inspection::getMark, MarkEnum.VALID.getCode()) |
|
|
.orderByDesc(Inspection::getCreateTime) |
|
|
.orderByDesc(Inspection::getCreateTime) |
|
|
|
|
|
|
|
|
return inspection; |
|
|
return inspection; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String getValue(Map<String, Object> airDataMap, String key) { |
|
|
|
|
|
return airDataMap.get(key) == null ? "" : (String) airDataMap.get(key); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |