瀏覽代碼

Merge branch 'develop' of gitadmin/tuoheng_air_monitor into release

tags/v1.0.3
wanjing 11 月之前
父節點
當前提交
9d2821608c
共有 2 個檔案被更改,包括 27 行新增23 行删除
  1. +0
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/query/QueryAirDataListService.java
  2. +27
    -22
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/syncdata/SyncAirDataService.java

+ 0
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/query/QueryAirDataListService.java 查看文件

import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.InputStream; import java.io.InputStream;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;


/** /**
* @Author ChengWang * @Author ChengWang

+ 27
- 22
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/syncdata/SyncAirDataService.java 查看文件



import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.domain.AirData; import com.tuoheng.admin.entity.domain.AirData;
import com.tuoheng.admin.entity.domain.Inspection; import com.tuoheng.admin.entity.domain.Inspection;
import com.tuoheng.admin.entity.request.inspection.AirportLineRequest;
import com.tuoheng.admin.entity.third.LingXiuDataResponse; import com.tuoheng.admin.entity.third.LingXiuDataResponse;
import com.tuoheng.admin.enums.AirportLineEnum;
import com.tuoheng.admin.enums.InspectionStatusEnum; import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.InspectionTypeEnum;
import com.tuoheng.admin.enums.MarkEnum;
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.utils.DateUtils; 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 org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;


log.info("收到灵嗅设备推送数据"); log.info("收到灵嗅设备推送数据");
//校验参数值 //校验参数值
JsonResult jsonResult = this.check(response); JsonResult jsonResult = this.check(response);
if(jsonResult.getCode() != 0){
log.info("校验失败:{}",jsonResult.getMsg());
if (jsonResult.getCode() != 0) {
log.info("校验失败:{}", jsonResult.getMsg());
return jsonResult; return jsonResult;
} }
Inspection inspection = (Inspection) jsonResult.getData(); Inspection inspection = (Inspection) jsonResult.getData();
airData.setHumidity(response.getHumidity()); // 湿度 airData.setHumidity(response.getHumidity()); // 湿度
airData.setHdop(response.getHdop()); // 水平精度因子 airData.setHdop(response.getHdop()); // 水平精度因子
airData.setPressure(response.getPressure()); // 大气压 airData.setPressure(response.getPressure()); // 大气压
if (StringUtils.isNotEmpty(response.getUtcTime())) {
String utcTime = DateUtils.convert(DateUtils.YYYY_MM_DD_HH_MM_SS_2, DateUtils.YYYY_MM_DD_HH_MM_SS, response.getUtcTime()); // UTC时间
Date dateTimeStr = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, utcTime);
Date dateTime = DateUtils.addDateTimeToDate(dateTimeStr, 0, 8, 0, 0);
String result = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, dateTime);
airData.setCUtcTime(result);
}
airData.setCUtcTime(DateUtils.convert(DateUtils.YYYY_MM_DD_HH_MM_SS_2, DateUtils.YYYY_MM_DD_HH_MM_SS, response.getUtcTime())); // UTC时间
// if (StringUtils.isNotEmpty(response.getUtcTime())) {
// String utcTime = DateUtils.convert(DateUtils.YYYY_MM_DD_HH_MM_SS_2, DateUtils.YYYY_MM_DD_HH_MM_SS, response.getUtcTime()); // UTC时间
// Date dateTimeStr = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, utcTime);
// Date dateTime = DateUtils.addDateTimeToDate(dateTimeStr, 0, 8, 0, 0);
// String result = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, dateTime);
// airData.setCUtcTime(result);
// }

Map<String, Object> airDataMap = response.getAirData(); Map<String, Object> airDataMap = response.getAirData();
String cl2 = this.getValue(airDataMap,"CL2(ppm)"); // 氯气(单位ppm)
String co = this.getValue(airDataMap,"CO(ppm)"); // 一氧化碳(单位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 co2 = this.getValue(airDataMap, "CO2(ppm)"); // 二氧化碳(单位ppm)
String cxhy = this.getValue(airDataMap, "CxHy(%)"); // 碳氢化合物(单位%) String cxhy = this.getValue(airDataMap, "CxHy(%)"); // 碳氢化合物(单位%)
String h2 = this.getValue(airDataMap, "H2(ppm)"); // 氢气(单位ppm) String h2 = this.getValue(airDataMap, "H2(ppm)"); // 氢气(单位ppm)
airData.setPm1(pm_1_0); airData.setPm1(pm_1_0);
airData.setPm10(pm_10); airData.setPm10(pm_10);
airData.setPm25(pm_2_5); airData.setPm25(pm_2_5);
airData.setSo2(so2);
airData.setSo2(this.getSo2(so2));
airData.setTsp(tsp); airData.setTsp(tsp);
airData.setVocs(vocs); airData.setVocs(vocs);
airData.setWrSo2(wrSo2); airData.setWrSo2(wrSo2);
} }


/** /**
*
* @param response * @param response
* @return * @return
*/ */
if (CollectionUtil.isNotEmpty(inspectionList) || inspectionList.size() != 0) { if (CollectionUtil.isNotEmpty(inspectionList) || inspectionList.size() != 0) {
inspection = inspectionList.get(0); inspection = inspectionList.get(0);
log.info("正在飞行的巡检任务,inspection={}", inspection); log.info("正在飞行的巡检任务,inspection={}", inspection);
} else if(inspection == null){
} else if (inspection == null) {
log.info("没有正在飞行的任务,无法关联推送的灵嗅数据,serial={}", response.getSerial()); log.info("没有正在飞行的任务,无法关联推送的灵嗅数据,serial={}", response.getSerial());
return JsonResult.error("没有正在飞行的任务"); return JsonResult.error("没有正在飞行的任务");
}else {
} else {
log.info("查询出的任务数据不存在"); log.info("查询出的任务数据不存在");
} }


} }
return o3; return o3;
} }

private String getSo2(String so2) {
if (StringUtils.isEmpty(so2)) {
return "0.0";
} else {
Double value = Double.valueOf(so2);
value = value * 1000 * 64.07 / 22.4;
return String.valueOf(value);
}
}

} }

Loading…
取消
儲存