Merge remote-tracking branch 'origin/SelfStation' into SelfStation

This commit is contained in:
nieziyan 2024-08-01 14:44:05 +08:00
commit 0aeb76d959
2 changed files with 93 additions and 20 deletions

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.cache.SelfCache; import org.jeecg.common.cache.SelfCache;
import org.jeecg.modules.base.abstracts.AbstractLogOrReport; import org.jeecg.modules.base.abstracts.AbstractLogOrReport;
@ -1025,4 +1026,82 @@ public class SelfStationUtil extends AbstractLogOrReport {
} }
return phd; return phd;
} }
public HashMap<String, Object> DetailedInfo(Integer sampleId, String status, EnergySpectrumStruct struct) {
try {
HashMap<String, Object> detailedMap = Maps.newHashMap();
//Data Type
String dataType = struct.data_type;
//Collection Start
Date CollectionStart = null;
if ( StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time) ){
CollectionStart = DateUtils.parseDate(struct.collection_start_date + StringPool.SPACE + struct.collection_start_time);
}
//Collection Stop
Date CollectionStop = null;
if ( StringUtils.isNotBlank(struct.collection_stop_date) && StringUtils.isNotBlank(struct.collection_stop_time) ){
CollectionStop = DateUtils.parseDate(struct.collection_stop_date + StringPool.SPACE + struct.collection_stop_time);
}
//Collection Time
String CollectionTime = "";
if ( Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop) ){
CollectionTime = String.format ("%.2f",Double.valueOf((CollectionStop.getTime() - CollectionStart.getTime())/ 1000));
}
//Acquisition Start
Date AcquisitionStart = null;
if ( StringUtils.isNotBlank(struct.acquisition_start_date) && StringUtils.isNotBlank(struct.acquisition_start_time) ){
AcquisitionStart = DateUtils.parseDate(struct.acquisition_start_date + StringPool.SPACE + struct.acquisition_start_time);
}
//Acq Real Time
double AcquisitionRealTime = struct.acquisition_real_time;
//Acq live Time
double AcquisitionLiveTime = struct.acquisition_live_time;
//Air Volume[m3]
double airVolume = struct.air_volume;
//Xe Volume[m3]
double xeVolume = struct.sample_volume_of_Xe;
//xeCollectionYield
double xeCollectionYield = struct.Xe_collection_yield;
//gasBkMeasurementId
String gasBkMeasurementId = struct.gas_bk_measurement_id;
//detectorBkMeasurementId
String detectorBkMeasurementId = struct.detector_bk_measurement_id;
//measurementId
String measurementId = struct.measurement_id;
detailedMap.put("sampleId", sampleId);
detailedMap.put("stationCode",struct.site_code);
detailedMap.put("detectorCode", struct.detector_code);
detailedMap.put("systemType", struct.system_type);
detailedMap.put("dataType", dataType);
detailedMap.put("spectralQualifier", struct.spectrum_quantity);
detailedMap.put("SRID", struct.sample_ref_id);
detailedMap.put("status", status);
detailedMap.put("collectionStart", CollectionStart);
detailedMap.put("collectionStop", CollectionStop);
detailedMap.put("collectionTime", CollectionTime);
double timeSpan = 0.0;
if (Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop)) {
timeSpan = (CollectionStop.getTime()/1000 - CollectionStart.getTime()/1000) / 3600.0;
}
detailedMap.put("samplingTime", String.format("%.2f", timeSpan));
detailedMap.put("airVolume", String.format("%.5f", airVolume));
detailedMap.put("xeVolume", String.format("%.5f", xeVolume));
detailedMap.put("yeild", xeCollectionYield);
detailedMap.put("detectorBkMeasurementId", detectorBkMeasurementId);
detailedMap.put("measurementId", measurementId);
detailedMap.put("acquisitionStart", AcquisitionStart);
detailedMap.put("acquisitionRealTime", String.format("%.2f", AcquisitionRealTime));
detailedMap.put("acquisitionLiveTime", String.format("%.2f", AcquisitionLiveTime));
double timespan = 0.0;
if (Objects.nonNull(AcquisitionStart) && Objects.nonNull(CollectionStop)) {
timespan = (AcquisitionStart.getTime()/1000 - CollectionStop.getTime()/1000);
}
detailedMap.put("acquisitionDecayTime", String.format("%.2f", timespan / 3600.0));
// todo 分级暂时定为1
detailedMap.put("category", "1");
return detailedMap;
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
} }

View File

@ -4849,6 +4849,8 @@ public class SelfStationServiceImpl implements ISelfStationService {
} }
//获取当前操作的台站的id //获取当前操作的台站的id
EnergySpectrumStruct sampleStruct = selfStationData.getSampleStruct(); EnergySpectrumStruct sampleStruct = selfStationData.getSampleStruct();
EnergySpectrumStruct qcStruct = selfStationData.getQcStruct();
EnergySpectrumStruct detStruct = selfStationData.getDetStruct();
String siteCode = sampleStruct.site_code; String siteCode = sampleStruct.site_code;
Integer stationId = spectrumAnalysisMapper.getStationId(siteCode); Integer stationId = spectrumAnalysisMapper.getStationId(siteCode);
//判断当前分析员当天是否有对应台站的排班任务 //判断当前分析员当天是否有对应台站的排班任务
@ -5000,26 +5002,18 @@ public class SelfStationServiceImpl implements ISelfStationService {
} }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
//更新detial Information //更新detial Information
List<String> detailedInfo = gammaFileUtil.DetailedInfo(sampleId.toString(), phd); HashMap<String, Object> detailedInfo = selfStationUtil.DetailedInfo(sampleId, phd.getStatus(), sampleStruct);
HashMap<String, String> detailedMap = Maps.newHashMap(); HashMap<String, Object> qcDetailedInfo = Maps.newHashMap();
detailedMap.put("sampleId",detailedInfo.get(0)); HashMap<String, Object> detDetailedInfo = Maps.newHashMap();
detailedMap.put("stationCode",detailedInfo.get(1)); if (null != qcStruct) {
detailedMap.put("detectorCode",detailedInfo.get(2)); qcDetailedInfo = selfStationUtil.DetailedInfo(sampleId, phd.getStatus(), qcStruct);
detailedMap.put("systemType",detailedInfo.get(3)); }
detailedMap.put("dataType",detailedInfo.get(4)); if (null != detStruct) {
detailedMap.put("spectralQualifier",detailedInfo.get(5)); detDetailedInfo = selfStationUtil.DetailedInfo(sampleId, phd.getStatus(), detStruct);
detailedMap.put("SRID",detailedInfo.get(6)); }
detailedMap.put("sampleStatus",detailedInfo.get(7)); map.put("sample", detailedInfo);
detailedMap.put("collectStart",detailedInfo.get(8)); map.put("qc", qcDetailedInfo);
detailedMap.put("samplingTime",detailedInfo.get(9)); map.put("det", detDetailedInfo);
detailedMap.put("airVolume",detailedInfo.get(10));
detailedMap.put("flowRate",detailedInfo.get(11));
detailedMap.put("acquisitionStart",detailedInfo.get(12));
detailedMap.put("acquisitionRealTime",detailedInfo.get(13));
detailedMap.put("acquisitionLiveTime",detailedInfo.get(14));
detailedMap.put("acquisitionDecayTime",detailedInfo.get(15));
detailedMap.put("category",detailedInfo.get(16));
map.put("DetailedInformation", detailedMap);
//发送数据到redis //发送数据到redis
/*middleData.setSample_stationID(String.valueOf(stationId)); /*middleData.setSample_stationID(String.valueOf(stationId));
middleData.setSample_id(String.valueOf(phd.getId_sample())); middleData.setSample_id(String.valueOf(phd.getId_sample()));