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

# Conflicts:
#	jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
This commit is contained in:
nieziyan 2023-07-28 19:33:36 +08:00
commit fb320c6888
43 changed files with 2840 additions and 317 deletions

View File

@ -2,7 +2,6 @@ package org.jeecg.common.util;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import lombok.extern.slf4j.Slf4j;
import net.sf.saxon.trans.SymbolicName;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
@ -39,6 +38,18 @@ public class FTPUtil {
@Value("${ftp.encoding}")
private String encoding;
public String getUserName(){
return this.userName;
}
public String getPassword(){
return this.password;
}
public String getEncoding(){
return this.encoding;
}
/**
* 登录ftp
* @return

View File

@ -3,26 +3,32 @@ package org.jeecg.common.util;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.vo.HistogramData;
import org.jeecg.modules.entity.vo.SeriseData;
import org.jeecg.modules.entity.vo.SpectrumData;
import org.jeecg.modules.entity.vo.XeData;
import org.apache.commons.io.FileUtils;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.jeecg.modules.entity.GardsXeResults;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.BgBoundary;
import org.jeecg.modules.native_jni.struct.CalcBgBoundaryParam;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.text.DateFormat;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@Component
public class PHDFileUtil {
public static Map<String, Object> getSourceData(String filePath){
@Autowired
private FTPUtil ftpUtil;
public Map<String, Object> getSourceData(String filePath, String fileName, List<GardsXeResults> xeDataList, Integer sampleId, String status){
//加载dll工具库
System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(filePath);
@ -37,13 +43,25 @@ public class PHDFileUtil {
//Data Type
String dataType = struct.data_type;
//Collection Start
Date CollectionStart = DateUtils.parseDate(struct.collection_start_date.replace(StringPool.SLASH,StringPool.DASH) + StringPool.SPACE + struct.collection_start_time.substring(0, struct.collection_start_time.indexOf(StringPool.DOT)), "yyyy-MM-dd HH:mm:ss");
Date CollectionStart = null;
if ( StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time) ){
CollectionStart = DateUtils.parseDate(struct.collection_start_date.replace(StringPool.SLASH,StringPool.DASH) + StringPool.SPACE + struct.collection_start_time.substring(0, struct.collection_start_time.indexOf(StringPool.DOT)), "yyyy-MM-dd HH:mm:ss");
}
//Collection Stop
Date CollectionStop = DateUtils.parseDate(struct.collection_stop_date.replace(StringPool.SLASH,StringPool.DASH) + StringPool.SPACE + struct.collection_stop_time.substring(0, struct.collection_stop_time.indexOf(StringPool.DOT)), "yyyy-MM-dd HH:mm:ss");
Date CollectionStop = null;
if ( StringUtils.isNotBlank(struct.collection_stop_date) && StringUtils.isNotBlank(struct.collection_stop_time) ){
CollectionStop = DateUtils.parseDate(struct.collection_stop_date.replace(StringPool.SLASH,StringPool.DASH) + StringPool.SPACE + struct.collection_stop_time.substring(0, struct.collection_stop_time.indexOf(StringPool.DOT)), "yyyy-MM-dd HH:mm:ss");
}
//Collection Time
String CollectionTime = String.format ("%.2f",Double.valueOf(CollectionStop.getTime()/1000 - CollectionStart.getTime()/ 1000));
String CollectionTime = "";
if ( Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop) ){
CollectionTime = String.format ("%.2f",Double.valueOf(CollectionStop.getTime()/1000 - CollectionStart.getTime()/ 1000));
}
//Acquisition Start
Date AcquisitionStart = DateUtils.parseDate(struct.acquisition_start_date.replace(StringPool.SLASH,StringPool.DASH) + StringPool.SPACE + struct.acquisition_start_time.substring(0, struct.acquisition_start_time.indexOf(StringPool.DOT)), "yyyy-MM-dd HH:mm:ss");
Date AcquisitionStart = null;
if ( StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time) ){
AcquisitionStart = DateUtils.parseDate(struct.acquisition_start_date.replace(StringPool.SLASH,StringPool.DASH) + StringPool.SPACE + struct.acquisition_start_time.substring(0, struct.acquisition_start_time.indexOf(StringPool.DOT)), "yyyy-MM-dd HH:mm:ss");
}
//Acq Real Time
double AcquisitionRealTime = struct.acquisition_real_time;
//Acq live Time
@ -52,6 +70,16 @@ public class PHDFileUtil {
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;
spectrumData.setSampleId(sampleId);
spectrumData.setStatus(status);
spectrumData.setStationCode(stationCode);
spectrumData.setDetectorCode(detectorCode);
spectrumData.setDataType(dataType);
@ -63,8 +91,11 @@ public class PHDFileUtil {
spectrumData.setAcquisitionLiveTime(AcquisitionLiveTime);
spectrumData.setAirVolume(airVolume);
spectrumData.setXeVolume(xeVolume);
spectrumData.setYield(xeCollectionYield);
spectrumData.setGasBkMeasurementId(gasBkMeasurementId);
spectrumData.setDetectorBkMeasurementId(detectorBkMeasurementId);
spectrumData.setMeasurementId(measurementId);
map.put("spectrumData", spectrumData);
//统计散点图
//横坐标 beta-gamma
long bChannels = struct.b_channels;
@ -73,30 +104,29 @@ public class PHDFileUtil {
//
List<Long> hCounts = struct.h_counts;
List<HistogramData> histogramDataList = new LinkedList<>();
List<HistogramData> histogramDataDList = new LinkedList<>();
for (int i=0; i<bChannels; i++){
//按照大小切割数组
List<Long> list = null;
if (i != bChannels-1){
list = hCounts.subList((int) (i * bChannels), (int) ((i + 1) * bChannels));
}else {
list = hCounts.subList((int) (i * bChannels), hCounts.size());
}
if (CollectionUtils.isNotEmpty(list)){
for (int j=0; j< list.size(); j++){
Long count = list.get(j);
if (count > 0){
HistogramData his = new HistogramData();
his.setB(i);
his.setG(j);
his.setC(count);
histogramDataList.add(his);
}
for (int j=0; j< gChannels; j++){
Long index = i * bChannels + j;
Long count = hCounts.get(index.intValue());
if (count > 0){
HistogramData his = new HistogramData();
his.setG(i);
his.setB(j);
his.setC(count);
histogramDataList.add(his);
histogramDataDList.add(his);
}else {
HistogramData his = new HistogramData();
his.setG(i);
his.setB(j);
his.setC(count);
histogramDataDList.add(his);
}
}
}
map.put("histogramDataList", histogramDataList);
map.put("histogramDataDList", histogramDataDList);
//Gamma Spectrum Original
long numGChannel = struct.num_g_channel;
List<Long> gCounts = struct.g_counts;
@ -109,7 +139,6 @@ public class PHDFileUtil {
gammaOriginalSeriseData.add(seriseData);
}
map.put("gammaOriginalData", gammaOriginalSeriseData);
//Gamma Spectrum Projected
List<Long> gammaProjectedData = new LinkedList<>();
for (int i=0; i<gChannels; i++) {
@ -127,7 +156,6 @@ public class PHDFileUtil {
gammaProjectedSeriseData.add(seriseData);
}
map.put("gammaProjectedData", gammaProjectedSeriseData);
//Gamma Energy
List<List<Double>> gammaEnergyList = new LinkedList<>();
List<Double> gCentroidChannel = struct.g_centroid_channel;
@ -141,8 +169,6 @@ public class PHDFileUtil {
gammaEnergyList.add(gammaEnergy);
}
map.put("gammaEnergyData", gammaEnergyList);
//Beta Spectrum Original
long numBChannel = struct.num_b_channel;
List<Long> bCounts = struct.b_counts;
@ -155,7 +181,6 @@ public class PHDFileUtil {
betaOriginalSeriseData.add(seriseData);
}
map.put("betaOriginalData", betaOriginalSeriseData);
//Beta Spectrum Projected
List<Long> betaProjectedData = new LinkedList<>();
for (int j=0; j<bChannels; ++j) {
@ -180,29 +205,42 @@ public class PHDFileUtil {
List<Double> bElectronEnergy = struct.b_electron_energy;
List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
List<Double> bchannels = new ArrayList<>();
for (int i=0; i<numGChannel; i++){
for (int i=0; i<numBChannel; i++){
bchannels.clear();
bchannels.add(Double.valueOf(i));
List<Double> betaEnergy = EnergySpectrumHandler.GetFileFittingData(bchannels, betaParam);
betaEnergyList.add(betaEnergy);
}
map.put("betaEnergyData", betaEnergyList);
//Xe
List<XeData> xeDataList = new LinkedList<>();
List<String> bgNuclideName = struct.bg_nuclide_name;
List<String> bgRoiNumber = struct.bg_ROI_number;
List<Double> bgEfficiency = struct.bg_efficiency;
List<Double> bgUncertainty = struct.bg_uncertainty;
for (int i=0; i< bgNuclideName.size(); i++){
XeData xeData = new XeData();
xeData.setIsotope(bgNuclideName.get(i));
xeData.setConcentration(bgRoiNumber.get(i));
xeData.setUncertainty(bgUncertainty.get(i));
xeData.setMDC(bgEfficiency.get(i));
xeDataList.add(xeData);
}
map.put("XeData", xeDataList);
//计算边界值
CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam();
calcBgBoundaryParam.g_e_cal = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
calcBgBoundaryParam.b_e_cal = EnergySpectrumHandler.GetFileFittingPara(bElectronEnergy, bChannel);
calcBgBoundaryParam.b_energy = struct.b_electron_energy;
calcBgBoundaryParam.b_channel = struct.b_channel;
calcBgBoundaryParam.g_channel = struct.g_centroid_channel;
calcBgBoundaryParam.g_energy = struct.g_energy;
calcBgBoundaryParam.ROI_B_start_x1 = struct.POI_B_x1;
calcBgBoundaryParam.ROI_B_stop_x2 = struct.POI_B_x2;
calcBgBoundaryParam.ROI_G_start_y1 = struct.POI_G_y1;
calcBgBoundaryParam.ROI_G_stop_y2 = struct.POI_G_y2;
BgBoundary bgBoundary = EnergySpectrumHandler.CalcBgBoundary(calcBgBoundaryParam);
List<Boundary> boundaryList = new LinkedList<>();
List<Integer> roiBBoundaryStart = bgBoundary.ROI_B_Boundary_start;
List<Integer> roiBBoundaryStop = bgBoundary.ROI_B_Boundary_stop;
List<Integer> roiGBoundaryStart = bgBoundary.ROI_G_Boundary_start;
List<Integer> roiGBoundaryStop = bgBoundary.ROI_G_Boundary_stop;
for (int i=0; i<roiBBoundaryStart.size(); i++){
Boundary boundary = new Boundary();
boundary.setMinX(roiBBoundaryStart.get(i));
boundary.setMaxX(roiBBoundaryStop.get(i));
boundary.setMinY(roiGBoundaryStart.get(i));
boundary.setMaxY(roiGBoundaryStop.get(i));
boundaryList.add(boundary);
}
map.put("Boundary", boundaryList);
} catch (ParseException e) {
throw new RuntimeException(e);
@ -210,4 +248,191 @@ public class PHDFileUtil {
return map;
}
public List<String> readLine(String filePath){
//连接ftp
FTPClient ftpClient = ftpUtil.LoginFTP();
//判断ftp是否连接成功
if (Objects.isNull(ftpClient)){
throw new RuntimeException("ftp连接失败!");
}
try {
ftpClient.enterLocalPassiveMode();
String fileName = filePath.substring(filePath.lastIndexOf(StringPool.SLASH) + 1);
String parameterFilePath = filePath.substring(0, filePath.lastIndexOf(StringPool.SLASH));
//判断文件路径是否为空
if (StringUtils.isNotBlank(parameterFilePath)){
//在当前工作路径下读取文件
ftpClient.changeWorkingDirectory(parameterFilePath);
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
// 设置编码当文件中存在中文且上传后文件乱码时可使用此配置项
ftpClient.setControlEncoding(ftpUtil.getEncoding());
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
if (CollectionUtils.isNotEmpty(ftpFiles)){
for (FTPFile ftpFile:ftpFiles) {
if (ftpFile.getName().equals(fileName)){
//读取ftp文件的输入流
InputStream iStream=ftpClient.retrieveFileStream(ftpFile.getName());
//声明一个临时文件
File file = File.createTempFile("tmp", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(iStream, file);
List<String> allLines = FileUtils.readLines(file, ftpUtil.getEncoding());
if (Objects.nonNull(iStream)){
iStream.close();
}
return allLines;
}
}
}
}
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
ftpClient.disconnect();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return Collections.emptyList();
}
public void getLightColor(Map<String, Object> sampleMap, Map<String, Object> gasBgMap, Map<String, Object> detBgMap, Map<String, Object> qcMap){
SpectrumData spectrumData = (SpectrumData)sampleMap.get("spectrumData");
SpectrumData gasBgSpectrumData = (SpectrumData)gasBgMap.get("spectrumData");
SpectrumData detBgSpectrumData = (SpectrumData)detBgMap.get("spectrumData");
//灯颜色
Sections sections = new Sections();
List<Double> airVolumeSections = sections.getAirVolumeSections();
List<Double> collectionTimeSections = sections.getCollectionTimeSections();
List<Double> acquisitionTimeSections = sections.getAcquisitionTimeSections();
List<Double> xeVolumeSections = sections.getXeVolumeSections();
double airVolume = spectrumData.getAirVolume();
if (Objects.nonNull(airVolume)){
// air volume check
if (airVolumeSections.get(0) < airVolume && airVolume <= airVolumeSections.get(1)) { // red
sampleMap.put("SampleVolumeBtn", "RedLight");
gasBgMap.put("SampleVolumeBtn", "RedLight");
detBgMap.put("SampleVolumeBtn", "RedLight");
qcMap.put("SampleVolumeBtn", "RedLight");
} else if (airVolumeSections.get(1) < airVolume && airVolume <= airVolumeSections.get(2)) { // yellow
sampleMap.put("SampleVolumeBtn", "YellowLight");
gasBgMap.put("SampleVolumeBtn", "YellowLight");
detBgMap.put("SampleVolumeBtn", "YellowLight");
qcMap.put("SampleVolumeBtn", "YellowLight");
} else if (airVolumeSections.get(2) < airVolume) { // green
sampleMap.put("SampleVolumeBtn", "GreenLight");
gasBgMap.put("SampleVolumeBtn", "GreenLight");
detBgMap.put("SampleVolumeBtn", "GreenLight");
qcMap.put("SampleVolumeBtn", "GreenLight");
}
}
String collectionTime = spectrumData.getCollectionTime();
if (StringUtils.isNotBlank(collectionTime)){
double collection_time = Double.parseDouble(collectionTime);
// collection time check
if (collectionTimeSections.get(0) < collection_time && collection_time <= collectionTimeSections.get(1)) { // red
sampleMap.put("CollectTimeBtn", "RedLight");
gasBgMap.put("CollectTimeBtn", "RedLight");
detBgMap.put("CollectTimeBtn", "RedLight");
qcMap.put("CollectTimeBtn", "RedLight");
} else if (collectionTimeSections.get(1) < collection_time && collection_time <= collectionTimeSections.get(2)) { // yellow
sampleMap.put("CollectTimeBtn", "YellowLight");
gasBgMap.put("CollectTimeBtn", "YellowLight");
detBgMap.put("CollectTimeBtn", "YellowLight");
qcMap.put("CollectTimeBtn", "YellowLight");
} else if (collectionTimeSections.get(2) < collection_time && collection_time <= collectionTimeSections.get(3)) { // green
sampleMap.put("CollectTimeBtn", "GreenLight");
gasBgMap.put("CollectTimeBtn", "GreenLight");
detBgMap.put("CollectTimeBtn", "GreenLight");
qcMap.put("CollectTimeBtn", "GreenLight");
} else if (collectionTimeSections.get(3) < collection_time && collection_time <= collectionTimeSections.get(4)) { // yellow
sampleMap.put("CollectTimeBtn", "YellowLight");
gasBgMap.put("CollectTimeBtn", "YellowLight");
detBgMap.put("CollectTimeBtn", "YellowLight");
qcMap.put("CollectTimeBtn", "YellowLight");
} else if (collectionTimeSections.get(4) < collection_time) { // red
sampleMap.put("CollectTimeBtn", "RedLight");
gasBgMap.put("CollectTimeBtn", "RedLight");
detBgMap.put("CollectTimeBtn", "RedLight");
qcMap.put("CollectTimeBtn", "RedLight");
}
}
double acquisitionLiveTime = spectrumData.getAcquisitionLiveTime();
if (Objects.nonNull(acquisitionLiveTime)){
// acquisition time check
if (acquisitionTimeSections.get(0) < acquisitionLiveTime && acquisitionLiveTime <= acquisitionTimeSections.get(1)) { // red
sampleMap.put("AcqTimeBtn", "RedLight");
gasBgMap.put("AcqTimeBtn", "RedLight");
detBgMap.put("AcqTimeBtn", "RedLight");
qcMap.put("AcqTimeBtn", "RedLight");
} else if (acquisitionTimeSections.get(1) < acquisitionLiveTime && acquisitionLiveTime <= acquisitionTimeSections.get(2)) { // yellow
sampleMap.put("AcqTimeBtn", "YellowLight");
gasBgMap.put("AcqTimeBtn", "YellowLight");
detBgMap.put("AcqTimeBtn", "YellowLight");
qcMap.put("AcqTimeBtn", "YellowLight");
} else if (acquisitionTimeSections.get(2) < acquisitionLiveTime && acquisitionLiveTime <= acquisitionTimeSections.get(3)) { // green
sampleMap.put("AcqTimeBtn", "GreenLight");
gasBgMap.put("AcqTimeBtn", "GreenLight");
detBgMap.put("AcqTimeBtn", "GreenLight");
qcMap.put("AcqTimeBtn", "GreenLight");
} else if (acquisitionTimeSections.get(3) < acquisitionLiveTime && acquisitionLiveTime <= acquisitionTimeSections.get(4)) { // yellow
sampleMap.put("AcqTimeBtn", "YellowLight");
gasBgMap.put("AcqTimeBtn", "YellowLight");
detBgMap.put("AcqTimeBtn", "YellowLight");
qcMap.put("AcqTimeBtn", "YellowLight");
} else if (acquisitionTimeSections.get(4) < acquisitionLiveTime) { // red
sampleMap.put("AcqTimeBtn", "RedLight");
gasBgMap.put("AcqTimeBtn", "RedLight");
detBgMap.put("AcqTimeBtn", "RedLight");
qcMap.put("AcqTimeBtn", "RedLight");
}
}
double yield = spectrumData.getYield();
if (Objects.nonNull(yield)) {
if (xeVolumeSections.get(0) < yield && yield <= xeVolumeSections.get(1)) { // red
sampleMap.put("XeVolumeBtn", "RedLight");
gasBgMap.put("XeVolumeBtn", "RedLight");
detBgMap.put("XeVolumeBtn", "RedLight");
qcMap.put("XeVolumeBtn", "RedLight");
} else if (xeVolumeSections.get(1) < yield && yield <= xeVolumeSections.get(2)) { // yellow
sampleMap.put("XeVolumeBtn", "YellowLight");
gasBgMap.put("XeVolumeBtn", "YellowLight");
detBgMap.put("XeVolumeBtn", "YellowLight");
qcMap.put("XeVolumeBtn", "YellowLight");
} else if (xeVolumeSections.get(2) < yield) { // green
sampleMap.put("XeVolumeBtn", "GreenLight");
gasBgMap.put("XeVolumeBtn", "GreenLight");
detBgMap.put("XeVolumeBtn", "GreenLight");
qcMap.put("XeVolumeBtn", "GreenLight");
}
}
if (gasBgSpectrumData.getMeasurementId().equals(spectrumData.getGasBkMeasurementId())){
sampleMap.put("GasBgBtn", "GreenLight");
gasBgMap.put("GasBgBtn", "GreenLight");
detBgMap.put("GasBgBtn", "GreenLight");
qcMap.put("GasBgBtn", "GreenLight");
}else {
sampleMap.put("GasBgBtn", "RedLight");
gasBgMap.put("GasBgBtn", "RedLight");
detBgMap.put("GasBgBtn", "RedLight");
qcMap.put("GasBgBtn", "RedLight");
}
if (detBgSpectrumData.getMeasurementId().equals(spectrumData.getDetectorBkMeasurementId())){
sampleMap.put("DetBgBtn", "GreenLight");
gasBgMap.put("DetBgBtn", "GreenLight");
detBgMap.put("DetBgBtn", "GreenLight");
qcMap.put("DetBgBtn", "GreenLight");
}else {
sampleMap.put("DetBgBtn", "RedLight");
gasBgMap.put("DetBgBtn", "RedLight");
detBgMap.put("DetBgBtn", "RedLight");
qcMap.put("DetBgBtn", "RedLight");
}
}
}

View File

@ -0,0 +1,53 @@
package org.jeecg.common.util;
import org.jeecg.modules.service.IUserTaskService;
import org.jeecg.modules.system.entity.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Component
public class UserTaskUtil {
@Autowired
private IUserTaskService userTaskService;
/**
* 根据用户名称查询当前用户是否有权限操作当前台站的信息
* @return
*/
public boolean checkUserStation(Integer stationId, String userName){
boolean flag = false;
//根据用户名称查询用户id
SysUser user = userTaskService.findUserByName(userName);
if (Objects.isNull(user)){
return flag;
}
String userId = user.getId();
//声明一个当前日期
Date nowDate = new Date();
String dateStr = DateUtils.formatDate(nowDate, "yyyy-MM-dd");
List<String> stationIds = userTaskService.findUserTaskStations(userId, dateStr);
if (stationIds.contains(stationId)){
flag = true;
}
return flag;
}
/**
* 根据用户名称查询当天的排班任务信息
* @return
*/
public List<String> findUserStation(String userName){
//根据用户名称查询用户id
SysUser user = userTaskService.findUserByName(userName);
String userId = user.getId();
List<String> stationIds = userTaskService.findUserStations(userId).stream().distinct().collect(Collectors.toList());
return stationIds;
}
}

View File

@ -35,9 +35,6 @@ public class GammaController {
return spectrumAnalysisService.getDBSpectrumChart(dbName, sampleId);
}
public static void main(String[] args) {
String filePath = "C:\\Users/qiaoqinzheng/Desktop/核素/AUX09_003-20151224_1855_S_FULL_40184.5.PHD";
File file = new File(filePath);
System.out.println(file.getParent());
}
}

View File

@ -8,10 +8,10 @@ import org.jeecg.modules.base.entity.GardsSampleData;
import org.jeecg.modules.service.ISpectrumAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
@RestController
@ -24,15 +24,15 @@ public class SpectrumAnalysesController {
@GetMapping("getDBSearchList")
@ApiOperation(value = "查询查询条件数据接口", notes = "查询查询条件数据接口")
public Result getDBSearchList(String[] menuTypes){
return spectrumAnalysisService.getDBSearchList(menuTypes);
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String dbName, String[] menuTypes){
return spectrumAnalysisService.getDBSearchList(request, AllUsers, dbName, menuTypes);
}
@GetMapping("getDBSpectrumList")
@ApiOperation(value = "获取数据库中交互分析基础数据", notes = "获取数据库中交互分析基础数据")
public Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleData gardsSampleData, String dbName, String[] menuTypes,boolean CollectStop, boolean AcqStart,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate) {
return spectrumAnalysisService.getDBSpectrumList(queryRequest, gardsSampleData, dbName, menuTypes, CollectStop, AcqStart, startDate, endDate);
public Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleData gardsSampleData, String dbName, String[] menuTypes,boolean AllUsers,boolean CollectStop, boolean AcqStart,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate, HttpServletRequest request) {
return spectrumAnalysisService.getDBSpectrumList(queryRequest, gardsSampleData, dbName, menuTypes, AllUsers, CollectStop, AcqStart, startDate, endDate, request);
}
@GetMapping("getDBSpectrumChart")
@ -41,4 +41,75 @@ public class SpectrumAnalysesController {
return spectrumAnalysisService.getDBSpectrumChart(dbName, sampleId);
}
@DeleteMapping("deleteDBSpectrumChartData")
@ApiOperation(value = "删除折线图缓存数据",notes = "删除折线图缓存数据")
public Result deleteDBSpectrumChartData(Integer[] sampleIds){
return spectrumAnalysisService.deleteDBSpectrumChartData(sampleIds);
}
@GetMapping("viewComment")
@ApiOperation(value = "查看comment数据", notes = "查看comment数据")
public Result viewComment(Integer sampleId, HttpServletRequest request){
return spectrumAnalysisService.viewComment(sampleId, request);
}
@PostMapping("addComment")
@ApiOperation(value = "新增comment", notes = "新增comment")
public Result addComment(Integer sampleId, HttpServletRequest request, String comment){
return spectrumAnalysisService.addComment(sampleId, request, comment);
}
@GetMapping("viewARR")
@ApiOperation(value = "查看ARR报告", notes = "查看ARR报告")
public void viewARR(Integer sampleId, HttpServletResponse response){
spectrumAnalysisService.viewARR(sampleId, response);
}
@GetMapping("viewRRR")
@ApiOperation(value = "查看RRR报告", notes = "查看RRR报告")
public void viewRRR(Integer sampleId, HttpServletResponse response){
spectrumAnalysisService.viewRRR(sampleId, response);
}
@GetMapping("viewSpectrum")
@ApiOperation(value = "查看Spectrum数据", notes = "查看Spectrum数据")
public Result viewSpectrum(Integer sampleId){
return spectrumAnalysisService.viewSpectrum(sampleId);
}
@GetMapping("viewSampleInformation")
@ApiOperation(value = "查看SampleInformation数据", notes = "查看SampleInformation数据")
public Result viewSampleInformation(Integer sampleId){
return spectrumAnalysisService.viewSampleInformation(sampleId);
}
@GetMapping("viewQCResult")
@ApiOperation(value = "查看QC Result数据", notes = "查看QC Result数据")
public Result viewQCResult(Integer sampleId){
return spectrumAnalysisService.viewQCResult(sampleId);
}
@GetMapping("viewRLR")
@ApiOperation(value = "查看RLR数据", notes = "查看RLR数据")
public Result viewRLR(Integer sampleId){
return spectrumAnalysisService.viewRLR(sampleId);
}
@GetMapping("viewGammaDetectorCalibration")
@ApiOperation(value = "查询GammaDetectorCalibration数据", notes = "查询GammaDetectorCalibration数据")
public Result viewGammaDetectorCalibration(Integer sampleId){
return spectrumAnalysisService.viewGammaDetectorCalibration(sampleId);
}
@GetMapping("viewBetaDetectorCalibration")
@ApiOperation(value = "查询BetaDetectorCalibration数据", notes = "查询BetaDetectorCalibration数据")
public Result viewBetaDetectorCalibration(Integer sampleId){
return spectrumAnalysisService.viewBetaDetectorCalibration(sampleId);
}
@GetMapping("viewExtrapolation")
public Result viewExtrapolation(Integer sampleId){
return null;
}
}

View File

@ -10,8 +10,8 @@ import java.io.Serializable;
import java.util.Date;
@Data
@TableName("GARDS_ANALYSES")
public class GardsAnalyses implements Serializable {
@TableName("RNMAN.GARDS_ANALYSES")
public class GardsAnalysesMan implements Serializable {
@TableField(value = "IDANALYSIS")
private Integer IDANALYSIS;

View File

@ -0,0 +1,45 @@
package org.jeecg.modules.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@TableName(value = "GARDS_XE_RESULTS")
public class GardsXeResults {
@TableField(value = "SAMPLE_ID")
private Integer sampleId;
@TableField(value = "IDANALYSIS")
private Integer idanalysis;
@TableField(value = "NUCLIDE_NAME")
private String nuclideName;
@TableField(value = "CONC")
private Double conc;
@TableField(value = "CONC_ERR")
private Double concErr;
@TableField(value = "MDC")
private Double mdc;
@TableField(value = "LC")
private Double lc;
@TableField(value = "NID_FLAG")
private Integer nidFlag;
@TableField(value = "MODDATE")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
}

View File

@ -0,0 +1,18 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class Boundary implements Serializable {
private Integer minX;
private Integer maxX;
private Integer minY;
private Integer maxY;
}

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CommentData implements Serializable {
private String analyst;
private String comment;
}

View File

@ -0,0 +1,16 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CommentInfo implements Serializable {
private String spectrumCommentInfo;
private String spectrumOtherCommentInfo;
private String spectrumAnalysisCommentInfo;
}

View File

@ -0,0 +1,38 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class QCResult implements Serializable {
private String collectTimeEvaluationMetrics;
private String acquisitionTimeEvaluationMetrics;
private String xenonVolumeEvaluationMetrics;
private String xe133MDCEvaluationMetrics;
private String collectTimeValue;
private String collectTimeStatus;
private String acquisitionTimeValue;
private String acquisitionTimeStatus;
private String xenonVolumeValue;
private String xenonVolumeStatus;
private String xe133MDCValue;
private String xe133MDCStatus;
private boolean gasBgValueAndStatus;
private boolean detBgValueAndStatus;
}

View File

@ -0,0 +1,58 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class RlrDataValues implements Serializable {
private String srid;
private String colloct_start_date;
private String colloct_start_time;
private String colloct_stop_date;
private String colloct_stop_time;
private String acq_start_date;
private String acq_start_time;
private String acq_live_time;
private String xe131m_conc;
private String xe131m_uncert_conc;
private String xe131m_MDC;
private String xe131m_LC;
private String xe133m_conc;
private String xe133m_uncert_conc;
private String xe133m_MDC;
private String xe133m_LC;
private String xe133_conc;
private String xe133_uncert_conc;
private String xe133_MDC;
private String xe133_LC;
private String xe135_conc;
private String xe135_uncert_conc;
private String xe135_MDC;
private String xe135_LC;
}

View File

@ -0,0 +1,46 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
@Data
public class Sections implements Serializable {
private List<Double> collectionTimeSections;
private List<Double> acquisitionTimeSections;
private List<Double> xeVolumeSections;
private List<Double> airVolumeSections;
public Sections(){
collectionTimeSections = new LinkedList<>();
collectionTimeSections.add(0.0);
collectionTimeSections.add(6.0);
collectionTimeSections.add(10.8);
collectionTimeSections.add(13.2);
collectionTimeSections.add(24.0);
acquisitionTimeSections = new LinkedList<>();
acquisitionTimeSections.add(0.0);
acquisitionTimeSections.add(6.0);
acquisitionTimeSections.add(10.8);
acquisitionTimeSections.add(13.2);
acquisitionTimeSections.add(24.0);
xeVolumeSections = new LinkedList<>();
xeVolumeSections.add(0.0);
xeVolumeSections.add(0.2);
xeVolumeSections.add(0.87);
airVolumeSections = new LinkedList<>();
airVolumeSections.add(0.0);
airVolumeSections.add(2.3);
airVolumeSections.add(10.0);
}
}

View File

@ -7,8 +7,8 @@ import java.io.Serializable;
@Data
public class SeriseData implements Serializable {
private int x;
private double x;
private long y;
private double y;
}

View File

@ -38,4 +38,16 @@ public class SpectrumData implements Serializable {
private double xeVolume;
private double yield;
private String measurementId;
private String gasBkMeasurementId;
private String detectorBkMeasurementId;
private Integer sampleId;
private String status;
}

View File

@ -0,0 +1,7 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.GardsAnalysesMan;
public interface GardsAnalysesManMapper extends BaseMapper<GardsAnalysesMan> {
}

View File

@ -3,5 +3,5 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.system.entity.GardsDetectors;
public interface GardsDetectorsMapper extends BaseMapper<GardsDetectors> {
public interface GardsDetectorsSpectrumMapper extends BaseMapper<GardsDetectors> {
}

View File

@ -2,7 +2,10 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.base.entity.GardsSampleData;
import org.jeecg.modules.entity.GardsXeResults;
import org.jeecg.modules.entity.vo.CommentData;
import org.jeecg.modules.entity.vo.SpectrumFileRecord;
import org.springframework.format.annotation.DateTimeFormat;
@ -11,10 +14,28 @@ import java.util.List;
public interface SpectrumAnalysisMapper {
Page<GardsSampleData> getDBSpectrumList(IPage<GardsSampleData> page, GardsSampleData gardsSampleData, String dbName, List<String> stationTypes, boolean CollectStop, boolean AcqStart, String startTime, String endTime);
List<GardsSampleData> getDBSearchList(String dbName, List<String> stationTypes, List<String> userStations, boolean AllUsers);
Page<GardsSampleData> getDBSpectrumList(IPage<GardsSampleData> page, GardsSampleData gardsSampleData, String dbName, List<String> stationTypes, boolean CollectStop, boolean AcqStart, String startTime, String endTime, List<String> userStations, boolean AllUsers);
SpectrumFileRecord getDBSpectrumFilePath(String dbName, Integer sampleId);
List<GardsXeResults> getXeDataList(Integer sampleId);
String getQCFilePath(String siteDetCode, String collectStartStr);
CommentData viewComment(@Param(value = "sampleId") Integer sampleId);
String getSampleFilePath(@Param(value = "sampleId") Integer sampleId);
Integer findStationIdBySampleId(@Param(value = "sampleId") Integer sampleId);
String viewARR(@Param(value = "sampleId") Integer sampleId);
String viewRRR(@Param(value = "sampleId") Integer sampleId);
GardsSampleData getSampleData(@Param(value = "sampleId") Integer sampleId);
GardsSampleData findSampleByFilePath(@Param(value = "filePath") String filePath);
}

View File

@ -1,7 +0,0 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.SysDictItem;
public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
}

View File

@ -3,5 +3,5 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.SysDictItem;
public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
public interface SysDictItemSpectrumMapper extends BaseMapper<SysDictItem> {
}

View File

@ -1,7 +0,0 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.SysDict;
public interface SysDictMapper extends BaseMapper<SysDict> {
}

View File

@ -3,5 +3,5 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.SysDict;
public interface SysDictMapper extends BaseMapper<SysDict> {
public interface SysDictSpectrumMapper extends BaseMapper<SysDict> {
}

View File

@ -2,6 +2,38 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.SpectrumAnalysisMapper">
<select id="getDBSearchList" resultType="org.jeecg.modules.base.entity.GardsSampleData">
SELECT
DISTINCT
cfg_stations.station_code stationName,
cfg_detectors.detector_code detectorsName
FROM
CONFIGURATION.GARDS_STATIONS cfg_stations,
CONFIGURATION.GARDS_DETECTORS cfg_detectors,
ORIGINAL.GARDS_SAMPLE_DATA org_samples,
(SELECT analyses.sample_id FROM ${dbName} analyses) analyses_sample_ids
<where>
org_samples.sample_id=analyses_sample_ids.sample_id
AND org_samples.station_id=cfg_stations.station_id
AND org_samples.detector_id=cfg_detectors.detector_id
AND cfg_stations.type in
<foreach collection="stationTypes" item="stationType" open="(" close=")" separator=",">
#{stationType}
</foreach>
<if test="AllUsers == false">
<if test=" userStations.size == 0 and userStations != null ">
and org_samples.station_id in ('')
</if>
<if test=" userStations.size > 0 and userStations != null ">
and org_samples.station_id in
<foreach collection="userStations" item="userStation" open="(" close=")" separator=",">
#{userStation}
</foreach>
</if>
</if>
</where>
</select>
<select id="getDBSpectrumList" resultType="org.jeecg.modules.base.entity.GardsSampleData">
select c.sample_id,
b.station_code stationName,
@ -58,13 +90,25 @@
<if test=" AcqStart == true ">
and c.acquisition_start between TO_DATE(#{startTime}, 'yyyy-mm-dd hh24:mi:ss') and TO_DATE(#{endTime}, 'yyyy-mm-dd hh24:mi:ss')
</if>
<!--<if test=" ">
and b.station_code in (%1)
</if>-->
<if test="AllUsers == false">
<if test=" userStations.size == 0 and userStations != null ">
and c.station_id in ('')
</if>
<if test=" userStations.size > 0 and userStations != null ">
and c.station_id in
<foreach collection="userStations" item="userStation" open="(" close=")" separator=",">
#{userStation}
</foreach>
</if>
</if>
</where>
ORDER BY c.collect_stop DESC
</select>
<select id="getXeDataList" resultType="org.jeecg.modules.entity.GardsXeResults">
SELECT SAMPLE_ID,NUCLIDE_NAME,CONC,CONC_ERR,MDC,LC FROM RNAUTO.GARDS_XE_RESULTS where SAMPLE_ID = #{sampleId}
</select>
<select id="getDBSpectrumFilePath" resultType="org.jeecg.modules.entity.vo.SpectrumFileRecord">
SELECT
org_sample.SAMPLE_ID sampleId,
@ -96,4 +140,82 @@
</where>
</select>
<select id="viewComment" resultType="org.jeecg.modules.entity.vo.CommentData">
SELECT A.ANALYST, A.COMMENTS FROM RNMAN.GARDS_ANALYSES A WHERE A.SAMPLE_ID= #{sampleId}
</select>
<select id="getSampleFilePath" resultType="java.lang.String">
SELECT INPUT_FILE_NAME FROM ORIGINAL.GARDS_SAMPLE_DATA where SAMPLE_ID = #{sampleId}
</select>
<select id="findStationIdBySampleId" resultType="java.lang.Integer">
SELECT STATION_ID FROM ORIGINAL.GARDS_SAMPLE_DATA where SAMPLE_ID = #{sampleId}
</select>
<select id="viewARR" resultType="java.lang.String">
SELECT REPORT_PAHT FROM RNAUTO.GARDS_ANALYSES where SAMPLE_ID = #{sampleId}
</select>
<select id="viewRRR" resultType="java.lang.String">
SELECT REPORT_PAHT FROM RNMAN.GARDS_ANALYSES where SAMPLE_ID = #{sampleId}
</select>
<select id="getSampleData" resultType="org.jeecg.modules.base.entity.GardsSampleData">
SELECT
SITE_DET_CODE,
SAMPLE_ID,
STATION_ID,
DETECTOR_ID,
INPUT_FILE_NAME,
SAMPLE_TYPE,
DATA_TYPE,
GEOMETRY,
SPECTRAL_QUALIFIE,
TRANSMIT_DTG,
COLLECT_START,
COLLECT_STOP,
ACQUISITION_START,
ACQUISITION_STOP,
ACQUISITION_REAL_SEC,
ACQUISITION_LIVE_SEC,
QUANTITY,
STATUS,
MODDATE
FROM
ORIGINAL.GARDS_SAMPLE_DATA
<where>
SAMPLE_ID = #{sampleId}
</where>
</select>
<select id="findSampleByFilePath" resultType="org.jeecg.modules.base.entity.GardsSampleData">
SELECT
SITE_DET_CODE,
SAMPLE_ID,
STATION_ID,
DETECTOR_ID,
INPUT_FILE_NAME,
SAMPLE_TYPE,
DATA_TYPE,
GEOMETRY,
SPECTRAL_QUALIFIE,
TRANSMIT_DTG,
COLLECT_START,
COLLECT_STOP,
ACQUISITION_START,
ACQUISITION_STOP,
ACQUISITION_REAL_SEC,
ACQUISITION_LIVE_SEC,
QUANTITY,
STATUS,
MODDATE
FROM
ORIGINAL.GARDS_SAMPLE_DATA
<where>
INPUT_FILE_NAME = #{filePath}
</where>
</select>
</mapper>

View File

@ -32,7 +32,7 @@ public class EnergySpectrumHandler {
* @param g_energy
* @return
*/
public static native List<Double> GetFileFittingPara(List<Double> centroid_channel, List<Double> g_energy);
public static native List<Double> GetFileFittingPara(List<Double> g_energy, List<Double> centroid_channel);
/**
* 根据channel 获取 Energy

View File

@ -0,0 +1,89 @@
package org.jeecg.modules.native_jni.struct;
import java.util.List;
public class AllGenerate {
//BgGasGenerate BgGas;
private List<Integer> g_ROI_B_Boundary_start;
private List<Integer> g_ROI_B_Boundary_stop;
private List<Integer> g_ROI_G_Boundary_start;
private List<Integer> g_ROI_G_Boundary_stop;
private List<Double> g_roi_cts; //气体本底谱感兴趣区计数
private List<Double> g_deduct_d_cts; //气体本底谱扣除探测器本底谱数据
private int g_b_fitting_type;
private int g_g_fitting_type;
private List<Double> g_b_fitting_e_c;
private List<Double> g_g_fitting_e_c;
private List<Double> g_b_fitting_c_e;
private List<Double> g_g_fitting_c_e;
//BgSampleGenerate BgSample;
// private BgBoundary s_boungdary;
private List<Integer> s_ROI_B_Boundary_start;
private List<Integer> s_ROI_B_Boundary_stop;
private List<Integer> s_ROI_G_Boundary_start;
private List<Integer> s_ROI_G_Boundary_stop;
private List<Double> s_roi_cts; //样品普感兴趣区计数
private List<Double> s_deduct_d_cts; //样品谱扣除探测器本底谱数据
private int s_b_fitting_type;
private int s_g_fitting_type;
private List<Double> s_b_fitting_e_c;
private List<Double> s_g_fitting_e_c;
private List<Double> s_b_fitting_c_e;
private List<Double> s_g_fitting_c_e;
private String s_collection_time; //采集时间
//BgOtherGenerate BgOther;
private List<Double> ROI_net_coutns; //感兴趣区净计数
private List<Double> ROI_net_err;
private List<Double> ROI_con_uncer; //感兴趣区浓度和不确定度 [n..0]浓度 [n..1]不确定度
private List<Double> ROI_con_counts_factor; //感兴趣区浓度计数系数 [n..0]系数
//enum XeType{both,_131m,_133m,none};
private int XeType;
private double LC_Xe135; //LC XE135
private double LC_Xe131m; //LC XE131m
private double LC_Xe133m; //LC XE133m
private double LC_Xe133; //LC XE133
private List<Double> LC;
private List<Double> LC_CTS;
private double MDC_Xe135; //MDC XE135
private double MDC_Xe131m; //MDC XE131m
private double MDC_Xe133m; //MDC XE133m
private double MDC_Xe133; //MDC XE133
private List<Double> MDC;
private List<Double> MDC_CTS;
private double Xe135_con; //135不浓度
private double Xe135_uncer; //135不确定度
private double Xe131m_con;
private double Xe131m_uncer;
private double Xe133m_con;
private double Xe133m_uncer;
private double Xe133_con;
private double Xe133_uncer;
private List<Integer> ROI_B_Boundary_start;
private List<Integer> ROI_B_Boundary_stop;
private List<Integer> ROI_G_Boundary_start;
private List<Integer> ROI_G_Boundary_stop;
private List<Double> d_roi_cts; //探测器本底谱感兴趣区计数
// 拟合后值
private int b_fitting_type;
private int g_fitting_type;
private List<Double> b_fitting_e_c;
private List<Double> g_fitting_e_c;
private List<Double> b_fitting_c_e;
private List<Double> g_fitting_c_e;
//BgDetbgrGenerate BgDetbgr;
private List<Integer> d_ROI_B_Boundary_start;
private List<Integer> d_ROI_B_Boundary_stop;
private List<Integer> d_ROI_G_Boundary_start;
private List<Integer> d_ROI_G_Boundary_stop;
private List<Double> d_d_roi_cts; //探测器本底谱感兴趣区计数
private int d_b_fitting_type;
private int d_g_fitting_type;
private List<Double> d_b_fitting_e_c;
private List<Double> d_g_fitting_e_c;
private List<Double> d_b_fitting_c_e;
private List<Double> d_g_fitting_c_e;
}

View File

@ -4,14 +4,40 @@ import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.entity.GardsSampleData;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
public interface ISpectrumAnalysisService {
Result getDBSearchList(String[] menuTypes);
Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String dbName, String[] menuTypes);
Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleData gardsSampleData, String dbName, String[] menuTypes, boolean CollectStop, boolean AcqStart, Date startDate, Date endDate);
Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleData gardsSampleData, String dbName, String[] menuTypes, boolean AllUsers, boolean CollectStop, boolean AcqStart, Date startDate, Date endDate, HttpServletRequest request);
Result getDBSpectrumChart(String dbName, Integer sampleId);
Result deleteDBSpectrumChartData(Integer[] sampleIds);
Result viewComment(Integer sampleId, HttpServletRequest request);
Result addComment(Integer sampleId, HttpServletRequest request, String comment);
void viewARR(Integer sampleId, HttpServletResponse response);
void viewRRR(Integer sampleId, HttpServletResponse response);
Result viewSpectrum(Integer sampleId);
Result viewSampleInformation(Integer sampleId);
Result viewQCResult(Integer sampleId);
Result viewRLR(Integer sampleId);
Result viewGammaDetectorCalibration(Integer sampleId);
Result viewBetaDetectorCalibration(Integer sampleId);
Result viewExtrapolation(Integer sampleId);
}

View File

@ -5,7 +5,7 @@ import org.jeecg.modules.entity.SysDict;
import java.util.List;
public interface ISysDictService extends IService<SysDict> {
public interface ISysDictSpectrumService extends IService<SysDict> {
List<String> findStationType(List<String> menuTypeList);

View File

@ -0,0 +1,24 @@
package org.jeecg.modules.service;
import org.jeecg.modules.system.entity.SysUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@Component
@FeignClient("jeecg-system")
public interface IUserTaskService {
@RequestMapping("/sys/user/findUserByName")
SysUser findUserByName(@RequestParam String userName);
@RequestMapping("/sysTask/findUserTaskStations")
List<String> findUserTaskStations(@RequestParam String userId, @RequestParam String nowDate);
@RequestMapping("/sysTask/findUserStations")
List<String> findUserStations(@RequestParam String userId);
}

View File

@ -3,13 +3,12 @@ package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.entity.SysDict;
import org.jeecg.modules.entity.SysDictItem;
import org.jeecg.modules.mapper.SysDictItemMapper;
import org.jeecg.modules.mapper.SysDictMapper;
import org.jeecg.modules.service.ISysDictService;
import org.jeecg.modules.mapper.SysDictItemSpectrumMapper;
import org.jeecg.modules.mapper.SysDictSpectrumMapper;
import org.jeecg.modules.service.ISysDictSpectrumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@ -18,15 +17,14 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Service("sysDictService")
@Service("sysDictSpectrumService")
@DS("master")
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements ISysDictService {
public class SysDictSpectrumServiceImpl extends ServiceImpl<SysDictSpectrumMapper, SysDict> implements ISysDictSpectrumService {
@Autowired
private SysDictItemMapper sysDictItemMapper;
private SysDictItemSpectrumMapper sysDictItemSpectrumMapper;
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
@ -34,7 +32,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
List<String> menuTypes = new LinkedList<>();
if (menuTypeList.contains("B")) {
menuTypes.add("Noble Gas Beta-Gamma");
}else if (menuTypeList.contains("G")) {
}
if (menuTypeList.contains("G")) {
menuTypes.add("Particulate");
menuTypes.add("Noble Gas HPGe");
}
@ -45,7 +44,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
List<String> dictIds = sysDicts.stream().map(SysDict::getId).distinct().collect(Collectors.toList());
LambdaQueryWrapper<SysDictItem> dictItemQueryWrapper = new LambdaQueryWrapper<>();
dictItemQueryWrapper.in(SysDictItem::getDictId, dictIds);
List<SysDictItem> sysDictItems = sysDictItemMapper.selectList(dictItemQueryWrapper);
List<SysDictItem> sysDictItems = sysDictItemSpectrumMapper.selectList(dictItemQueryWrapper);
if (CollectionUtils.isNotEmpty(sysDictItems)){
List<String> result = sysDictItems.stream().map(SysDictItem::getItemValue).distinct().collect(Collectors.toList());
return result;

View File

@ -0,0 +1,205 @@
package org.jeecg.modules.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* <p>
* 用户表
* </p>
*
* @Author scott
* @since 2018-12-20
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysUser implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 登录账号
*/
@Excel(name = "登录账号", width = 15)
private String username;
/**
* 真实姓名
*/
@Excel(name = "真实姓名", width = 15)
private String realname;
/**
* 密码
*/
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private String password;
/**
* md5密码盐
*/
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private String salt;
/**
* 头像
*/
@Excel(name = "头像", width = 15,type = 2)
private String avatar;
/**
* 生日
*/
@Excel(name = "生日", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date birthday;
/**
* 性别1 2
*/
@Excel(name = "性别", width = 15,dicCode="sex")
@Dict(dicCode = "sex")
private Integer sex;
/**
* 电子邮件
*/
@Excel(name = "电子邮件", width = 15)
private String email;
/**
* 电话
*/
@Excel(name = "电话", width = 15)
private String phone;
/**
* 登录选择部门编码
*/
private String orgCode;
/**
* 登录选择租户ID
*/
private Integer loginTenantId;
/**部门名称*/
private transient String orgCodeTxt;
/**
* 状态(1正常 2冻结
*/
@Excel(name = "状态", width = 15,dicCode="user_status")
@Dict(dicCode = "user_status")
private Integer status;
/**
* 删除状态0正常1已删除
*/
@Excel(name = "删除状态", width = 15,dicCode="del_flag")
@TableLogic
private Integer delFlag;
/**
* 工号唯一键
*/
@Excel(name = "工号", width = 15)
private String workNo;
/**
* 职务关联职务表
*/
@Excel(name = "职务", width = 15)
@Dict(dictTable ="sys_position",dicText = "name",dicCode = "code")
private String post;
/**
* 座机号
*/
@Excel(name = "座机号", width = 15)
private String telephone;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 同步工作流引擎1同步0不同步
*/
private Integer activitiSync;
/**
* 身份0 普通成员 1 上级
*/
@Excel(name="1普通成员 2上级",width = 15)
private Integer userIdentity;
/**
* 负责部门
*/
@Excel(name="负责部门",width = 15,dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
private String departIds;
/**
* 多租户ids临时用不持久化数据库(数据库字段不存在)
*/
@TableField(exist = false)
private String relTenantIds;
/**设备id uniapp推送用*/
private String clientId;
/**
* 登录首页地址
*/
@TableField(exist = false)
private String homePath;
/**
* 职位名称
*/
@TableField(exist = false)
private String postText;
/**
* 流程状态
*/
private String bpmStatus;
}

View File

@ -34,6 +34,7 @@ import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
@Slf4j
@ -113,4 +114,14 @@ public class SysTaskController {
}
}
@RequestMapping("findUserTaskStations")
public List<String> findUserTaskStations(@RequestParam String userId, @RequestParam String nowDate){
return sysTaskService.findUserTaskStations(userId, nowDate);
}
@RequestMapping("findUserStations")
public List<String> findUserStations(@RequestParam String userId){
return sysTaskService.findUserStations(userId);
}
}

View File

@ -27,4 +27,20 @@ public interface SysTaskMapper extends BaseMapper<SysTask> {
List<SysTask> selectTaskByDate(String firstDay, String lastDay);
List<SysTaskStation> selectList(LambdaQueryWrapper<SysTaskStation> sysTaskStationQueryWrapper);
/**
* 查询用户当前日期下值班任务台站信息
* @param userId
* @param nowDate
* @return
*/
List<String> findUserTaskStations(String userId, String nowDate);
/**
* 查询用户值班任务台站信息
* @param userId
* @return
*/
List<String> findUserStations(String userId);
}

View File

@ -28,4 +28,23 @@
where t.scheduling_date BETWEEN to_date(#{firstDay}, 'YYYY-MM-DD') and to_date(#{lastDay}, 'YYYY-MM-DD')
</select>
<select id="findUserTaskStations" resultType="java.lang.String">
SELECT
stt.station_id
FROM
sys_task st
LEFT JOIN sys_task_station stt on st.id = stt.task_id
where st.user_id = #{userId}
and st.scheduling_date = to_date(#{nowDate}, 'YYYY-MM-DD')
</select>
<select id="findUserStations" resultType="java.lang.String">
SELECT
stt.station_id
FROM
sys_task st
LEFT JOIN sys_task_station stt on st.id = stt.task_id
where st.user_id = #{userId}
</select>
</mapper>

View File

@ -11,6 +11,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -81,4 +82,19 @@ public interface ISysTaskService extends IService<SysTask> {
*/
ImportViewVo importExcel(List<SysTaskExportVo> dataList, int headerRow);
/**
* 查询当前用户的排班任务台站信息
* @param userId
* @param nowDate
* @return
*/
List<String> findUserTaskStations(String userId, String nowDate);
/**
* 查询当前用户的排班任务台站信息
* @param userId
* @return
*/
List<String> findUserStations(String userId);
}

View File

@ -39,6 +39,7 @@ import java.io.IOException;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
@ -533,6 +534,16 @@ public class SysTaskServiceImpl extends ServiceImpl<SysTaskMapper, SysTask> impl
return importViewVo;
}
@Override
public List<String> findUserTaskStations(String userId, String nowDate) {
return this.baseMapper.findUserTaskStations(userId, nowDate);
}
@Override
public List<String> findUserStations(String userId) {
return this.baseMapper.findUserStations(userId);
}
private void addOrUpdate(List<SysTask> sysTaskList,List<SysTask> taskList){
//获取request
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();

View File

@ -5,6 +5,7 @@ import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.net.ftp.FTP;
@ -14,6 +15,7 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.Prompt;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.enums.SampleFileHeader;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.modules.entity.data.HistogramData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -32,6 +34,8 @@ public class ReadLineUtil {
@Autowired
private FTPUtil ftpUtil;
@Autowired
private SpectrumPathProperties spectrumPathProperties;
@Value("${ftp.encoding}")
private String encoding;
@ -44,19 +48,13 @@ public class ReadLineUtil {
throw new RuntimeException("ftp连接失败!");
}
try {
ftpClient.enterLocalPassiveMode();
String fileName = filePath.substring(filePath.lastIndexOf(StringPool.SLASH) + 1);
String parameterFilePath = filePath.substring(0, filePath.lastIndexOf(StringPool.SLASH));
//根据字符切割文件路径
List<String> paths = Arrays.asList(parameterFilePath.split(StringPool.SLASH));
String parameterFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + filePath.substring(0, filePath.lastIndexOf(StringPool.SLASH));
//判断文件路径是否为空
if (CollectionUtils.isNotEmpty(paths)){
//遍历文件路径
for (String path:paths) {
//切换工作路径
ftpClient.changeWorkingDirectory(path);
}
if (StringUtils.isNotBlank(parameterFilePath)){
//在当前工作路径下读取文件
ftpClient.enterLocalPassiveMode();
ftpClient.changeWorkingDirectory(parameterFilePath);
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
// 设置编码当文件中存在中文且上传后文件乱码时可使用此配置项
ftpClient.setControlEncoding(encoding);
@ -92,7 +90,6 @@ public class ReadLineUtil {
throw new RuntimeException(e);
} finally {
try {
ftpClient.disconnect();
} catch (IOException e) {
throw new RuntimeException(e);
@ -129,8 +126,8 @@ public class ReadLineUtil {
for (int j=0;j< values.size(); j++) {
if (!"0".equals(values.get(j))){
HistogramData histogramData = new HistogramData();
histogramData.setB(i);
histogramData.setG(j);
histogramData.setG(i);
histogramData.setB(j);
histogramData.setC(Integer.valueOf(values.get(j)));
result.add(histogramData);
}
@ -188,6 +185,7 @@ public class ReadLineUtil {
OutputStream outputStream = null;
InputStream inputStream = null;
try {
filePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + filePath;
// 切换工作目录为 /
ftpClient.changeWorkingDirectory(SymbolConstant.SINGLE_SLASH);

View File

@ -1,7 +1,16 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.base.entity.GardsSampleData;
import java.util.Date;
import java.util.List;
public interface GardsSampleDataWebMapper extends BaseMapper<GardsSampleData> {
Page<GardsSampleData> findAutoPage(String startDate, String endDate, List<Integer> stationIdList, Page<GardsSampleData> page);
Page<GardsSampleData> findReviewedPage(String startDate, String endDate, List<Integer> stationIdList, Page<GardsSampleData> page);
}

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.GardsSampleDataWebMapper">
<select id="findAutoPage" resultType="org.jeecg.modules.base.entity.GardsSampleData">
SELECT
sam.SITE_DET_CODE,
sam.SAMPLE_ID,
sam.STATION_ID,
sam.DETECTOR_ID,
sam.INPUT_FILE_NAME,
sam.SAMPLE_TYPE,
sam.DATA_TYPE,
sam.GEOMETRY,
sam.SPECTRAL_QUALIFIE,
sam.TRANSMIT_DTG,
sam.COLLECT_START,
sam.COLLECT_STOP,
sam.ACQUISITION_START,
sam.ACQUISITION_STOP,
sam.ACQUISITION_REAL_SEC,
sam.ACQUISITION_LIVE_SEC,
sam.QUANTITY,
sam.STATUS,
sam.MODDATE
FROM
ORIGINAL.GARDS_SAMPLE_DATA sam
INNER JOIN RNAUTO.GARDS_ANALYSES ana on ana.SAMPLE_ID = sam.SAMPLE_ID
<where>
sam.COLLECT_START >= TO_DATE(#{startDate}, 'yyyy-mm-dd hh24:mi:ss')
and sam.COLLECT_STOP &lt;= TO_DATE(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
<if test="stationIdList.size==0 and stationIdList != null">
and sam.STATION_ID in ('')
</if>
<if test="stationIdList.size>0 and stationIdList != null">
and sam.STATION_ID in
<foreach collection="stationIdList" item="stationId" open="(" close=")" separator=",">
#{stationId}
</foreach>
</if>
</where>
</select>
<select id="findReviewedPage" resultType="org.jeecg.modules.base.entity.GardsSampleData">
SELECT
sam.SITE_DET_CODE,
sam.SAMPLE_ID,
sam.STATION_ID,
sam.DETECTOR_ID,
sam.INPUT_FILE_NAME,
sam.SAMPLE_TYPE,
sam.DATA_TYPE,
sam.GEOMETRY,
sam.SPECTRAL_QUALIFIE,
sam.TRANSMIT_DTG,
sam.COLLECT_START,
sam.COLLECT_STOP,
sam.ACQUISITION_START,
sam.ACQUISITION_STOP,
sam.ACQUISITION_REAL_SEC,
sam.ACQUISITION_LIVE_SEC,
sam.QUANTITY,
sam.STATUS,
sam.MODDATE
FROM
ORIGINAL.GARDS_SAMPLE_DATA sam
INNER JOIN RNMAN.GARDS_ANALYSES ana on ana.SAMPLE_ID = sam.SAMPLE_ID
<where>
sam.COLLECT_START >= TO_DATE(#{startDate}, 'yyyy-mm-dd hh24:mi:ss')
and sam.COLLECT_STOP &lt;= TO_DATE(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
<if test="stationIdList.size ==0 and stationIdList != null">
and sam.STATION_ID in ('')
</if>
<if test="stationIdList.size>0 and stationIdList != null">
and sam.STATION_ID in
<foreach collection="stationIdList" item="stationId" open="(" close=")" separator=",">
#{stationId}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -31,12 +31,6 @@ public interface IGardsSampleDataWebService extends IService<GardsSampleData> {
*/
Result findGeneratedReport(Integer sampleId);
/**
* 查询全部基础数据
* @return
*/
Result findPageBySampleIds(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime, List<Integer> sampleIds);
GardsSampleData getOneSample(Integer sampleId);
void radionuclideExport(Integer[] stationIds,

View File

@ -7,16 +7,21 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.ExportUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.dto.SampleDataDto;
import org.jeecg.modules.base.entity.GardsMetData;
import org.jeecg.modules.base.entity.GardsSampleData;
import org.jeecg.modules.entity.GardsAnalysesAuto;
import org.jeecg.modules.mapper.GardsAnalysesAutoMapper;
import org.jeecg.modules.mapper.GardsSampleDataWebMapper;
import org.jeecg.modules.service.IAutoService;
import org.jeecg.modules.service.IGardsSampleDataWebService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
@ -27,9 +32,8 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
@Service("autoService")
@ -38,21 +42,44 @@ public class AutoServiceImpl extends ServiceImpl<GardsAnalysesAutoMapper, GardsA
@Autowired
private IGardsSampleDataWebService gardsSampleDataService;
@Autowired
private GardsSampleDataWebMapper gardsSampleDataWebMapper;
@Autowired
private RedisUtil redisUtil;
@Override
public Result findAutoPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime) {
//查询自动处理后的
LambdaQueryWrapper<GardsAnalysesAuto> analysesQueryWrapper = new LambdaQueryWrapper<>();
List<GardsAnalysesAuto> gardsAnalyses = this.baseMapper.selectList(analysesQueryWrapper);
if (CollectionUtils.isNotEmpty(gardsAnalyses)){
//获取全部样品id
List<Integer> sampleIds = gardsAnalyses.stream().map(GardsAnalysesAuto::getSampleId).collect(Collectors.toList());
//查询全部样品基础数据
Result result = gardsSampleDataService.findPageBySampleIds(queryRequest, stationIds, startTime, endTime, sampleIds);
Result result = new Result();
//获取redis中缓存的台站信息
Map<Integer, String> stationMap = (Map<Integer, String>)redisUtil.get("stationMap");
if (Objects.isNull(startTime)){
result.error500("开始时间不能为空");
return result;
}else {
return null;
}
String startDate = DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00";
if (Objects.isNull(endTime)){
result.error500("结束时间不能为空");
return result;
}
String endDate = DateUtils.formatDate(endTime, "yyyy-MM-dd") + " 23:59:59";
List<Integer> stationIdList;
if (Objects.isNull(stationIds)){
stationIdList = new LinkedList<>();
}else {
stationIdList = Arrays.asList(stationIds);
}
Page<GardsSampleData> page = new Page(queryRequest.getPageNo(), queryRequest.getPageSize());
Page<GardsSampleData> sampleDataPage = gardsSampleDataWebMapper.findAutoPage(startDate, endDate, stationIdList, page);
sampleDataPage.getRecords().forEach(item->{
item.setSiteDetCode(StringUtils.trim(item.getSiteDetCode()));
if (stationMap.containsKey(item.getStationId().toString()) && CollectionUtils.isNotEmpty(stationMap)){
String stationName = stationMap.get(item.getStationId().toString());
item.setStationName(stationName);
}
});
result.setSuccess(true);
result.setResult(sampleDataPage);
return result;
}
@Override

View File

@ -195,27 +195,57 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
if (Objects.nonNull(gardsSampleData)){
acquisition = new Acquisition();
//封装数据内容
generalInformation.setSiteCode(gardsSampleData.getStationName());
generalInformation.setDetectorCode(gardsSampleData.getSiteDetCode());
generalInformation.setSystemType(gardsSampleData.getSampleType());
generalInformation.setSampleGeometry(gardsSampleData.getGeometry());
generalInformation.setSpectrumQualifier(gardsSampleData.getSpectralQualifie());
generalInformation.setTransmitDate(DateUtils.formatDate(gardsSampleData.getTransmitDtg(), "yyyy-MM-dd HH:mm:ss"));
acquisition.setAcquisitionStartDate(DateUtils.formatDate(gardsSampleData.getAcquisitionStart(), "yyyy-MM-dd HH:mm:ss"));
acquisition.setAcquisitionRealTime(gardsSampleData.getAcquisitionRealSec());
acquisition.setAcquisitionLiveTime(gardsSampleData.getAcquisitionLiveSec());
if (StringUtils.isNotBlank(gardsSampleData.getStationName())){
generalInformation.setSiteCode(gardsSampleData.getStationName());
}
if (StringUtils.isNotBlank(gardsSampleData.getSiteDetCode())){
generalInformation.setDetectorCode(gardsSampleData.getSiteDetCode());
}
if (StringUtils.isNotBlank(gardsSampleData.getSampleType())){
generalInformation.setSystemType(gardsSampleData.getSampleType());
}
if (StringUtils.isNotBlank(gardsSampleData.getGeometry())){
generalInformation.setSampleGeometry(gardsSampleData.getGeometry());
}
if (StringUtils.isNotBlank(gardsSampleData.getSpectralQualifie())){
generalInformation.setSpectrumQualifier(gardsSampleData.getSpectralQualifie());
}
if (Objects.nonNull(gardsSampleData.getTransmitDtg())){
generalInformation.setTransmitDate(DateUtils.formatDate(gardsSampleData.getTransmitDtg(), "yyyy-MM-dd HH:mm:ss"));
}
if (Objects.nonNull(gardsSampleData.getAcquisitionStart())){
acquisition.setAcquisitionStartDate(DateUtils.formatDate(gardsSampleData.getAcquisitionStart(), "yyyy-MM-dd HH:mm:ss"));
}
if (Objects.nonNull(gardsSampleData.getAcquisitionRealSec())){
acquisition.setAcquisitionRealTime(gardsSampleData.getAcquisitionRealSec());
}
if (Objects.nonNull(gardsSampleData.getAcquisitionLiveSec())){
acquisition.setAcquisitionLiveTime(gardsSampleData.getAcquisitionLiveSec());
}
}
if (Objects.nonNull(gardsSampleAux)){
calibration = new Calibration();
generalInformation.setSampleReferenceIdentification(gardsSampleAux.getSampleRefId());
generalInformation.setMeasurementIdentification(gardsSampleAux.getMeasurementId());
generalInformation.setDetectorBackgroundMeasurementId(gardsSampleAux.getBkgdMeasurementId());
generalInformation.setGasBackgroundMeasurementId(gardsSampleAux.getGasBkgdMeasurementId());
calibration.setDateOfLastCalibration(DateUtils.formatDate(gardsSampleAux.getCalibrationDtg(), "yyyy-MM-dd HH:mm:ss"));
if (StringUtils.isNotBlank(gardsSampleAux.getSampleRefId())){
generalInformation.setSampleReferenceIdentification(gardsSampleAux.getSampleRefId());
}
if (StringUtils.isNotBlank(gardsSampleAux.getMeasurementId())){
generalInformation.setMeasurementIdentification(gardsSampleAux.getMeasurementId());
}
if (StringUtils.isNotBlank(gardsSampleAux.getBkgdMeasurementId())){
generalInformation.setDetectorBackgroundMeasurementId(gardsSampleAux.getBkgdMeasurementId());
}
if (StringUtils.isNotBlank(gardsSampleAux.getGasBkgdMeasurementId())){
generalInformation.setGasBackgroundMeasurementId(gardsSampleAux.getGasBkgdMeasurementId());
}
if (Objects.nonNull(gardsSampleAux.getCalibrationDtg())){
calibration.setDateOfLastCalibration(DateUtils.formatDate(gardsSampleAux.getCalibrationDtg(), "yyyy-MM-dd HH:mm:ss"));
}
}
if (Objects.nonNull(gardsSampleDescription)){
comment = new Comment();
comment.setText(gardsSampleDescription.getDescription());
if (StringUtils.isNotBlank(gardsSampleDescription.getDescription())){
comment.setText(gardsSampleDescription.getDescription());
}
}
report.setHeaderBlock(generalInformation);
report.setCommentBlock(comment);
@ -231,14 +261,16 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdcalpoint);
List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
gEnergySubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
GEnergy gEnergy = new GEnergy();
gEnergy.setEnergy(orig.getYvalue());
gEnergy.setCentroid(orig.getXvalue());
gEnergy.setUncertainty(orig.getUncyvalue());
gEnergySubBlock.add(gEnergy);
if (Objects.nonNull(orig.getYvalue()) && Objects.nonNull(orig.getXvalue()) && Objects.nonNull(orig.getUncyvalue())){
gEnergy.setEnergy(orig.getYvalue());
gEnergy.setCentroid(orig.getXvalue());
gEnergy.setUncertainty(orig.getUncyvalue());
gEnergySubBlock.add(gEnergy);
}
}
}
report.setGEnergyBlock(gEnergySubBlock);
@ -256,11 +288,13 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
bEnergySubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
BEnergy bEnergy = new BEnergy();
bEnergy.setElectronEnergy(orig.getYvalue());
bEnergy.setMaximumChannel(orig.getXvalue());
bEnergy.setUncertainty(orig.getUncyvalue());
bEnergy.setDecayModeDescriptor(orig.getDecayMode());
bEnergySubBlock.add(bEnergy);
if (Objects.nonNull(orig.getYvalue()) && Objects.nonNull(orig.getXvalue()) && Objects.nonNull(orig.getUncyvalue()) && Objects.nonNull(orig.getDecayMode())){
bEnergy.setElectronEnergy(orig.getYvalue());
bEnergy.setMaximumChannel(orig.getXvalue());
bEnergy.setUncertainty(orig.getUncyvalue());
bEnergy.setDecayModeDescriptor(orig.getDecayMode());
bEnergySubBlock.add(bEnergy);
}
}
}
report.setBEnergyBlock(bEnergySubBlock);
@ -278,10 +312,12 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
gResolutionSubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
GResolution gResolution = new GResolution();
gResolution.setEnergy(orig.getXvalue());
gResolution.setFWHM(orig.getYvalue());
gResolution.setUncertainty(orig.getUncyvalue());
gResolutionSubBlock.add(gResolution);
if (Objects.nonNull(orig.getYvalue()) && Objects.nonNull(orig.getXvalue()) && Objects.nonNull(orig.getUncyvalue())){
gResolution.setEnergy(orig.getXvalue());
gResolution.setFWHM(orig.getYvalue());
gResolution.setUncertainty(orig.getUncyvalue());
gResolutionSubBlock.add(gResolution);
}
}
}
report.setGResolutionBlock(gResolutionSubBlock);
@ -299,10 +335,12 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
bResolutionSubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
BResolution bResolution = new BResolution();
bResolution.setElectronEnergy(orig.getXvalue());
bResolution.setFWHM(orig.getYvalue());
bResolution.setUncertainty(orig.getUncyvalue());
bResolutionSubBlock.add(bResolution);
if (Objects.nonNull(orig.getYvalue()) && Objects.nonNull(orig.getXvalue()) && Objects.nonNull(orig.getUncyvalue())){
bResolution.setElectronEnergy(orig.getXvalue());
bResolution.setFWHM(orig.getYvalue());
bResolution.setUncertainty(orig.getUncyvalue());
bResolutionSubBlock.add(bResolution);
}
}
}
report.setBResolutionBlock(bResolutionSubBlock);
@ -320,10 +358,12 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
gEfficiencySubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
GEfficiency gEfficiency = new GEfficiency();
gEfficiency.setEnergy(orig.getXvalue());
gEfficiency.setEfficiency(orig.getYvalue());
gEfficiency.setUncertainty(orig.getUncyvalue());
gEfficiencySubBlock.add(gEfficiency);
if (Objects.nonNull(orig.getYvalue()) && Objects.nonNull(orig.getXvalue()) && Objects.nonNull(orig.getUncyvalue())){
gEfficiency.setEnergy(orig.getXvalue());
gEfficiency.setEfficiency(orig.getYvalue());
gEfficiency.setUncertainty(orig.getUncyvalue());
gEfficiencySubBlock.add(gEfficiency);
}
}
}
report.setGEfficiencyBlock(gEfficiencySubBlock);
@ -338,11 +378,13 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
bgEfficiencySubBlock = new LinkedList<>();
for (GardsBgEfficiencyPairs pairs:gardsBgEfficiencyPairs) {
BEfficiency bEfficiency = new BEfficiency();
bEfficiency.setRoiNumber(pairs.getRoi());
bEfficiency.setNuclideName(pairs.getNuclideName());
bEfficiency.setCoincidenceEfficiency(pairs.getBgEfficiency());
bEfficiency.setUncertainty(pairs.getBgEfficError());
bgEfficiencySubBlock.add(bEfficiency);
if (Objects.nonNull(pairs.getRoi()) && Objects.nonNull(pairs.getNuclideName()) && Objects.nonNull(pairs.getBgEfficiency()) && Objects.nonNull(pairs.getBgEfficError())){
bEfficiency.setRoiNumber(pairs.getRoi());
bEfficiency.setNuclideName(pairs.getNuclideName());
bEfficiency.setCoincidenceEfficiency(pairs.getBgEfficiency());
bEfficiency.setUncertainty(pairs.getBgEfficError());
bgEfficiencySubBlock.add(bEfficiency);
}
}
}
report.setBgEfficiencyBlock(bgEfficiencySubBlock);
@ -358,12 +400,15 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
roiLimitsSubBlock = new LinkedList<>();
for (GardsRoiLimits roiLimits:gardsRoiLimitsList) {
Roi roi = new Roi();
roi.setRoiNumber(roiLimits.getRoi());
roi.setRoiGRangeStart(roiLimits.getGEnergyStart());
roi.setRoiGRangeStop(roiLimits.getGEnergyStop());
roi.setRoiBRangeStart(roiLimits.getBEnergyStart());
roi.setRoiBRangeStop(roiLimits.getBEnergyStop());
roiLimitsSubBlock.add(roi);
if (Objects.nonNull(roiLimits.getRoi()) && Objects.nonNull(roiLimits.getGEnergyStart()) && Objects.nonNull(roiLimits.getGEnergyStop())
&& Objects.nonNull(roiLimits.getBEnergyStart()) && Objects.nonNull(roiLimits.getBEnergyStop()) ){
roi.setRoiNumber(roiLimits.getRoi());
roi.setRoiGRangeStart(roiLimits.getGEnergyStart());
roi.setRoiGRangeStop(roiLimits.getGEnergyStop());
roi.setRoiBRangeStart(roiLimits.getBEnergyStart());
roi.setRoiBRangeStop(roiLimits.getBEnergyStop());
roiLimitsSubBlock.add(roi);
}
}
}
report.setRoiLimitsBlock(roiLimitsSubBlock);
@ -379,12 +424,15 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
ratiosSubBlock = new LinkedList<>();
for (GardsSampleRatios sampleRatios:sampleRatiosList) {
Ratios ratios = new Ratios();
ratios.setCountRatio(sampleRatios.getCountRatio());
ratios.setRatioId(sampleRatios.getRatioId());
ratios.setCountRatioUncertainty(sampleRatios.getCountRatioErr());
ratios.setRoiNumberLowerEnergy(sampleRatios.getLowerRoiNumber());
ratios.setRoiNumberHigherEnergy(sampleRatios.getUpperRoiNumber());
ratiosSubBlock.add(ratios);
if (Objects.nonNull(sampleRatios.getCountRatio()) && StringUtils.isNotBlank(sampleRatios.getRatioId()) && Objects.nonNull(sampleRatios.getCountRatioErr())
&& Objects.nonNull(sampleRatios.getLowerRoiNumber()) && Objects.nonNull(sampleRatios.getUpperRoiNumber()) ){
ratios.setCountRatio(sampleRatios.getCountRatio());
ratios.setRatioId(sampleRatios.getRatioId());
ratios.setCountRatioUncertainty(sampleRatios.getCountRatioErr());
ratios.setRoiNumberLowerEnergy(sampleRatios.getLowerRoiNumber());
ratios.setRoiNumberHigherEnergy(sampleRatios.getUpperRoiNumber());
ratiosSubBlock.add(ratios);
}
}
}
report.setRatiosBlock(ratiosSubBlock);
@ -404,8 +452,12 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
gSpectrumSubBlock = (List<Integer>)map.get(SampleFileHeader.GSPECTRUM.getMessage());
}
gSpectrumBlock.setGSpectrumSubBlock(gSpectrumSubBlock);
gSpectrumBlock.setEnergySpan(gardsSpectrum.getEnergySpan());
gSpectrumBlock.setNumberGChannels(gardsSpectrum.getChannels());
if (Objects.nonNull(gardsSpectrum.getEnergySpan())){
gSpectrumBlock.setEnergySpan(gardsSpectrum.getEnergySpan());
}
if (Objects.nonNull(gardsSpectrum.getChannels())){
gSpectrumBlock.setNumberGChannels(gardsSpectrum.getChannels());
}
}
report.setGSpectrumBlock(gSpectrumBlock);
}
@ -424,8 +476,12 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
bSpectrumSubBlock = (List<Integer>)map.get(SampleFileHeader.BSPECTRUM.getMessage());
}
bSpectrumBlock.setBSpectrumSubBlock(bSpectrumSubBlock);
bSpectrumBlock.setEnergySpan(gardsSpectrum.getEnergySpan());
bSpectrumBlock.setNumberBChannels(gardsSpectrum.getChannels());
if (Objects.nonNull(gardsSpectrum.getEnergySpan())){
bSpectrumBlock.setEnergySpan(gardsSpectrum.getEnergySpan());
}
if (Objects.nonNull(gardsSpectrum.getChannels())){
bSpectrumBlock.setNumberBChannels(gardsSpectrum.getChannels());
}
}
report.setBSpectrumBlock(bSpectrumBlock);
}
@ -443,10 +499,18 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
histogramSubBlock = (List<HistogramData>)map.get(SampleFileHeader.HISTOGRAM.getMessage());
}
histogramBlock.setHistogramSubBlock(histogramSubBlock);
histogramBlock.setBChannels(gardsHistogram.getBChannels());
histogramBlock.setBEnergySpan(gardsHistogram.getBEnergySpan());
histogramBlock.setGChannels(gardsHistogram.getGChannels());
histogramBlock.setGEnergySpan(gardsHistogram.getGEnergySpan());
if (Objects.nonNull(gardsHistogram.getBChannels())){
histogramBlock.setBChannels(gardsHistogram.getBChannels());
}
if (Objects.nonNull(gardsHistogram.getBEnergySpan())){
histogramBlock.setBEnergySpan(gardsHistogram.getBEnergySpan());
}
if (Objects.nonNull(gardsHistogram.getGChannels())){
histogramBlock.setGChannels(gardsHistogram.getGChannels());
}
if (Objects.nonNull(gardsHistogram.getGEnergySpan())){
histogramBlock.setGEnergySpan(gardsHistogram.getGEnergySpan());
}
}
report.setHistogramBlock(histogramBlock);
}
@ -458,9 +522,16 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
GardsSampleCert gardsSampleCert = gardsSampleCertMapper.selectOne(sampleCertQueryWrapper);
if (Objects.nonNull(gardsSampleCert)) {
certificateBlock = new Certificate();
certificateBlock.setTotalSourceActivity(gardsSampleCert.getQuantity());
certificateBlock.setAssayDate(DateUtils.formatDate(gardsSampleCert.getAssayDate(), "yyyy-MM-dd HH:mm:ss"));
certificateBlock.setUnitsOfActivity(gardsSampleCert.getUnit());
if (Objects.nonNull(gardsSampleCert.getQuantity())){
certificateBlock.setTotalSourceActivity(gardsSampleCert.getQuantity());
}
if (Objects.nonNull(gardsSampleCert.getAssayDate())){
certificateBlock.setAssayDate(DateUtils.formatDate(gardsSampleCert.getAssayDate(), "yyyy-MM-dd HH:mm:ss"));
}
if (StringUtils.isNotBlank(gardsSampleCert.getUnit())){
certificateBlock.setUnitsOfActivity(gardsSampleCert.getUnit());
}
}
LambdaQueryWrapper<GardsSampleCertLine> sampleCertLineQueryWrapper = new LambdaQueryWrapper<>();
sampleCertLineQueryWrapper.eq(GardsSampleCertLine::getSampleId, sampleId);
@ -472,15 +543,33 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
List<CertificateLine> certificateSubBlock = new LinkedList<>();
for (GardsSampleCertLine sampleCertLine:gardsSampleCertLines) {
CertificateLine certificateLine = new CertificateLine();
certificateLine.setNuclideName(sampleCertLine.getNuclName());
certificateLine.setHalfLife(sampleCertLine.getHalflife());
certificateLine.setNuclideActivity(sampleCertLine.getActivity());
certificateLine.setUncertainty(sampleCertLine.getError());
certificateLine.setGenergy(sampleCertLine.getEnergy());
certificateLine.setIntensity(sampleCertLine.getAbundance());
certificateLine.setElectronDecayModeDescriptor(sampleCertLine.getDecayMode());
certificateLine.setMaxBParticleEnergy(sampleCertLine.getBEnergy());
certificateLine.setParticleBIntensity(sampleCertLine.getBAbundance());
if (StringUtils.isNotBlank(sampleCertLine.getNuclName())){
certificateLine.setNuclideName(sampleCertLine.getNuclName());
}
if (StringUtils.isNotBlank(sampleCertLine.getHalflife())){
certificateLine.setHalfLife(sampleCertLine.getHalflife());
}
if (Objects.nonNull(sampleCertLine.getActivity())){
certificateLine.setNuclideActivity(sampleCertLine.getActivity());
}
if (Objects.nonNull(sampleCertLine.getError())){
certificateLine.setUncertainty(sampleCertLine.getError());
}
if (Objects.nonNull(sampleCertLine.getEnergy())){
certificateLine.setGenergy(sampleCertLine.getEnergy());
}
if (Objects.nonNull(sampleCertLine.getAbundance())){
certificateLine.setIntensity(sampleCertLine.getAbundance());
}
if (StringUtils.isNotBlank(sampleCertLine.getDecayMode())){
certificateLine.setElectronDecayModeDescriptor(sampleCertLine.getDecayMode());
}
if (Objects.nonNull(sampleCertLine.getBEnergy())){
certificateLine.setMaxBParticleEnergy(sampleCertLine.getBEnergy());
}
if (Objects.nonNull(sampleCertLine.getBAbundance())){
certificateLine.setParticleBIntensity(sampleCertLine.getBAbundance());
}
certificateSubBlock.add(certificateLine);
}
certificateBlock.setCertificateSubBlock(certificateSubBlock);
@ -488,36 +577,6 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
report.setCertificateBlock(certificateBlock);
}
@Transactional(propagation = Propagation.REQUIRES_NEW,rollbackFor = Exception.class)
public Result findPageBySampleIds(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime, List<Integer> sampleIds){
Result result = new Result();
try {
//获取redis中缓存的台站信息
Map<Integer, String> stationMap = (Map<Integer, String>)redisUtil.get("stationMap");
Page<GardsSampleData> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
Date startDate = DateUtils.parseDate(DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
Date endDate = DateUtils.parseDate(DateUtils.formatDate(endTime, "yyyy-MM-dd") + " 23:59:59", "yyyy-MM-dd HH:mm:ss");
LambdaQueryWrapper<GardsSampleData> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(GardsSampleData::getStationId, stationIds);
queryWrapper.in(GardsSampleData::getSampleId, sampleIds);
queryWrapper.ge(GardsSampleData::getCollectStart, startDate);
queryWrapper.le(GardsSampleData::getCollectStop, endDate);
Page<GardsSampleData> sampleDataPage = this.baseMapper.selectPage(page, queryWrapper);
sampleDataPage.getRecords().forEach(item->{
item.setSiteDetCode(StringUtils.trim(item.getSiteDetCode()));
if (stationMap.containsKey(item.getStationId().toString()) && CollectionUtils.isNotEmpty(stationMap)){
String stationName = stationMap.get(item.getStationId().toString());
item.setStationName(stationName);
}
});
result.setSuccess(true);
result.setResult(sampleDataPage);
return result;
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
@Override
public GardsSampleData getOneSample(Integer sampleId) {
LambdaQueryWrapper<GardsSampleData> wrapper = new LambdaQueryWrapper<>();

View File

@ -5,16 +5,21 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.ExportUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.dto.SampleDataDto;
import org.jeecg.modules.base.entity.GardsSampleData;
import org.jeecg.modules.entity.GardsAnalysesAuto;
import org.jeecg.modules.entity.GardsAnalysesMan;
import org.jeecg.modules.mapper.GardsAnalysesManMapper;
import org.jeecg.modules.mapper.GardsSampleDataWebMapper;
import org.jeecg.modules.service.IGardsSampleDataWebService;
import org.jeecg.modules.service.IReviewedService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
@ -25,9 +30,8 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
@Service("reviewedService")
@ -36,21 +40,44 @@ public class ReviewedServiceImpl extends ServiceImpl<GardsAnalysesManMapper, Gar
@Autowired
private IGardsSampleDataWebService gardsSampleDataService;
@Autowired
private GardsSampleDataWebMapper gardsSampleDataWebMapper;
@Autowired
private RedisUtil redisUtil;
@Override
public Result findReviewedPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime) {
//查询自动处理后的
LambdaQueryWrapper<GardsAnalysesMan> analysesQueryWrapper = new LambdaQueryWrapper<>();
List<GardsAnalysesMan> gardsAnalyses = this.baseMapper.selectList(analysesQueryWrapper);
if (CollectionUtils.isNotEmpty(gardsAnalyses)){
//获取全部样品id
List<Integer> sampleIds = gardsAnalyses.stream().map(GardsAnalysesMan::getSampleId).collect(Collectors.toList());
//查询全部样品基础数据
Result result = gardsSampleDataService.findPageBySampleIds(queryRequest, stationIds, startTime, endTime, sampleIds);
Result result = new Result();
//获取redis中缓存的台站信息
Map<Integer, String> stationMap = (Map<Integer, String>)redisUtil.get("stationMap");
if (Objects.isNull(startTime)){
result.error500("开始时间不能为空");
return result;
}else {
return null;
}
String startDate = DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00";
if (Objects.isNull(endTime)){
result.error500("结束时间不能为空");
return result;
}
String endDate = DateUtils.formatDate(endTime, "yyyy-MM-dd") + " 23:59:59";
List<Integer> stationIdList;
if (Objects.isNull(stationIds)){
stationIdList = new LinkedList<>();
}else {
stationIdList = Arrays.asList(stationIds);
}
Page<GardsSampleData> page = new Page(queryRequest.getPageNo(), queryRequest.getPageSize());
Page<GardsSampleData> sampleDataPage = gardsSampleDataWebMapper.findReviewedPage(startDate, endDate, stationIdList, page);
sampleDataPage.getRecords().forEach(item->{
item.setSiteDetCode(StringUtils.trim(item.getSiteDetCode()));
if (stationMap.containsKey(item.getStationId().toString()) && CollectionUtils.isNotEmpty(stationMap)){
String stationName = stationMap.get(item.getStationId().toString());
item.setStationName(stationName);
}
});
result.setSuccess(true);
result.setResult(sampleDataPage);
return result;
}
@Override