添加pgsql数据库查询代码,删除能谱分析对比数据中的IDC数据库的连接
This commit is contained in:
parent
38f802aa66
commit
f51b1a93c8
|
|
@ -70,6 +70,16 @@ public class MybatisInterceptor implements Interceptor {
|
|||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
if ("moddate".equalsIgnoreCase(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object localCreateDate = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (localCreateDate == null || "".equals(localCreateDate)) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, new Date());
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
//注入部门编码
|
||||
if ("sysOrgCode".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
|
|
@ -51,6 +51,11 @@
|
|||
<!--<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/open-sdk-20211201132528.jar</systemPath>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<version> 0.1.55</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -3,54 +3,61 @@
|
|||
<mapper namespace="org.jeecg.modules.mapper.StatReportMapper">
|
||||
|
||||
<select id="countParsingMailRecords" resultType="org.jeecg.modules.eneity.vo.DBInfoCount">
|
||||
WITH sample_data_counts AS (
|
||||
select
|
||||
substr(t.site_det_code,1,5) as station_name,
|
||||
t.data_type,
|
||||
count(*) as original_data_number,
|
||||
count(ga.sample_id) as anlyse_data_number
|
||||
from original.GARDS_SAMPLE_DATA t
|
||||
left join rnauto.GARDS_ANALYSES ga on ga.sample_id = t.sample_id
|
||||
where t.moddate between #{beginDate} and #{endDate}
|
||||
group by substr(t.site_det_code,1,5), t.data_type
|
||||
),
|
||||
met_data_counts AS (
|
||||
select
|
||||
t.station_code as station_name,
|
||||
'MET' as data_type,
|
||||
count(*) as original_data_number,
|
||||
0 as anlyse_data_number
|
||||
from original.GARDS_MET_DATA t
|
||||
where t.moddate between #{beginDate} and #{endDate}
|
||||
group by t.station_code
|
||||
),
|
||||
soh_data_counts AS (
|
||||
select
|
||||
t.station_code as station_name,
|
||||
'SOH' as data_type,
|
||||
count(*) as original_data_number,
|
||||
0 as anlyse_data_number
|
||||
from original.GARDS_SOH_DATA t
|
||||
where t.moddate between #{beginDate} and #{endDate}
|
||||
group by t.station_code
|
||||
),
|
||||
alert_data_counts AS (
|
||||
select
|
||||
t.station_code as station_name,
|
||||
'ALERT' as data_type,
|
||||
count(*) as original_data_number,
|
||||
0 as anlyse_data_number
|
||||
from original.GARDS_ALERT_DATA t
|
||||
where t.time between #{beginDate} and #{endDate}
|
||||
group by t.station_code
|
||||
)
|
||||
select
|
||||
f.station_name as stationName,
|
||||
f.data_type as dataType,
|
||||
f.original_data_number as originalDataNumber,
|
||||
f.anlyse_data_number as anlyseDataNumber
|
||||
from(
|
||||
select
|
||||
r.station_name,
|
||||
r.data_type,
|
||||
sum(r.original_data_number) as original_data_number,
|
||||
sum(r.anlyse_data_number) as anlyse_data_number
|
||||
from(
|
||||
select
|
||||
substr(t.site_det_code,1,5) as station_name,
|
||||
t.data_type,
|
||||
1 as original_data_number,
|
||||
nvl2((select t.sample_id from rnauto.GARDS_ANALYSES ga where ga.sample_id = t.sample_id),1,0) as anlyse_data_number
|
||||
from original.GARDS_SAMPLE_DATA t
|
||||
where t.moddate between #{beginDate} and #{endDate}
|
||||
) r
|
||||
group by r.station_name,r.data_type
|
||||
union all
|
||||
select
|
||||
t.station_code as station_name,
|
||||
'MET' as data_type,
|
||||
count(*) as original_data_number,
|
||||
0 as anlyse_data_number
|
||||
from original.GARDS_MET_DATA t
|
||||
where t.moddate between #{beginDate} and #{endDate}
|
||||
group by t.station_code
|
||||
union all
|
||||
select
|
||||
t.station_code as station_name,
|
||||
'SOH' as data_type,
|
||||
count(*) as original_data_number,
|
||||
0 as anlyse_data_number
|
||||
from original.GARDS_SOH_DATA t
|
||||
where t.moddate between #{beginDate} and #{endDate}
|
||||
group by t.station_code
|
||||
union all
|
||||
select
|
||||
t.station_code as station_name,
|
||||
'ALERT' as data_type,
|
||||
count(*) as original_data_number,
|
||||
0 as anlyseDataNumber
|
||||
from original.GARDS_ALERT_DATA t
|
||||
where t.time between #{beginDate} and #{endDate}
|
||||
group by t.station_code
|
||||
) f order by f.station_name,f.data_type asc
|
||||
station_name as stationName,
|
||||
data_type as dataType,
|
||||
original_data_number as originalDataNumber,
|
||||
anlyse_data_number as anlyseDataNumber
|
||||
from (
|
||||
select * from sample_data_counts
|
||||
union all
|
||||
select * from met_data_counts
|
||||
union all
|
||||
select * from soh_data_counts
|
||||
union all
|
||||
select * from alert_data_counts
|
||||
) all_counts
|
||||
order by station_name, data_type
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,199 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||
import org.jeecg.modules.base.entity.rnman.*;
|
||||
import org.jeecg.modules.entity.*;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface SpectrumAnalysisPostgresMapper {
|
||||
List<GardsSampleDataSpectrum> getDBSearchList(String dbName, List<String> stationTypes, List<String> userStations, boolean AllUsers);
|
||||
|
||||
Page<GardsSampleDataSpectrum> getDBSpectrumList(IPage<GardsSampleDataSpectrum> page, GardsSampleDataSpectrum gardsSampleData, String dbName, List<String> stationTypes, boolean CollectStopB, boolean AcqStartB, String startTime, String endTime, List<String> userStations, boolean AllUsers, String orderField, String orderType);
|
||||
|
||||
Page<GardsSampleDataSpectrum> getDBSpectrumListByLeftJoin(IPage<GardsSampleDataSpectrum> page,
|
||||
GardsSampleDataSpectrum gardsSampleData, String dbName,
|
||||
List<String> stationTypes, boolean CollectStopB,
|
||||
boolean AcqStartB, String startTime, String endTime,
|
||||
List<String> userStations, boolean AllUsers,
|
||||
String orderField, String orderType);
|
||||
|
||||
Page<GardsSampleDataSpectrum> loadSampleData(IPage<GardsSampleDataSpectrum> page, GardsSampleDataSpectrum gardsSampleData, List<String> stationTypes, boolean CollectStopB, boolean AcqStartB, String startTime, String endTime, List<String> userStations, boolean AllUsers, String orderField, String orderType);
|
||||
|
||||
SpectrumFileRecord getDBSpectrumFilePath(String dbName, Integer sampleId, Integer analysisID);
|
||||
|
||||
List<GardsXeResultsSpectrum> 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);
|
||||
|
||||
GardsSampleDataSpectrum getSampleData(@Param(value = "sampleId") Integer sampleId);
|
||||
|
||||
GardsSampleDataSpectrum findSampleByFilePath(@Param(value = "filePath") String filePath);
|
||||
|
||||
List<GardsDetectors> getDetectorList(@Param(value = "stationId") Integer stationId);
|
||||
|
||||
List<StatisticsData> statisticsQueryNuclides(@Param(value = "statisticsQueryData")
|
||||
StatisticsQueryData statisticsQueryData);
|
||||
|
||||
List<StatisticsData> statisticsQueryCollection(String startDate, String endDate, List<Integer> detectorList);
|
||||
|
||||
List<StatisticsData> statisticsQueryAcquisition(String startDate, String endDate, List<Integer> detectorList);
|
||||
|
||||
List<StatisticsData> statisticsQueryXeVolumn(String startDate, String endDate, List<Integer> detectorList);
|
||||
|
||||
List<StatisticsData> statisticsQuerySampleVolumn(String startDate, String endDate, List<Integer> detectorList);
|
||||
|
||||
String getStatus(@Param(value = "sampleId") Integer sampleId);
|
||||
|
||||
GardsAnalysesSpectrum getAnalysis(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
|
||||
|
||||
List<GardsPeaksSpectrum> getPeaks(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsCalibrationPairsSpectrum> getCalibrationPairs(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsCalibrationSpectrum> getPara(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsNuclLinesIdedSpectrum> getNuclLinesIded(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsNuclIdedSpectrum> getNuclIded(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsQcCheckSpectrum> getQcCheck(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<CalMDCInfo> getMDC(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
GardsAnalySetting getAnalySetting(@Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<NuclideLine> getNuclideLines(@Param(value = "name") String name);
|
||||
|
||||
List<HalfData> getHalf(@Param(value = "names") List<String> names);
|
||||
|
||||
HalfData getOneHalf(@Param(value = "name") String name);
|
||||
|
||||
List<String> UserNuclide(@Param(value = "systemType") String systemType, @Param(value = "userName") String userName);
|
||||
|
||||
Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
|
||||
|
||||
List<GardsCalibrationPairsSpectrum> ReadGammaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsCalibrationSpectrum> ReadGammaCalibrationParam(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsCalibrationPairsSpectrum> ReadBetaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsCalibrationSpectrum> ReadBetaCalibrationParam(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsROIChannelsSpectrum> ReadROIChannels(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis, @Param(value = "sampleId") Integer sampleId);
|
||||
|
||||
List<GardsROIResultsSpectrum> ReadROIResults(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis, @Param(value = "sampleId") Integer sampleId);
|
||||
|
||||
List<GardsXeResultsSpectrum> ReadXeResults(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis, @Param(value = "sampleId") Integer sampleId);
|
||||
|
||||
List<String> getUserNuclideNames(@Param(value = "nuclides") List<String> nuclides, @Param(value = "min") Double min, @Param(value = "max") Double max);
|
||||
|
||||
List<String> getFULLNuclideNames(@Param(value = "min") Double min, @Param(value = "max") Double max);
|
||||
|
||||
List<String> getRelevantNuclideNames(@Param(value = "min") Double min, @Param(value = "max") Double max);
|
||||
|
||||
List<String> getNuclideNames(@Param(value = "dbName") String dbName);
|
||||
|
||||
List<GardsNuclLinesLib> getNuclideLine(@Param(value = "min") Double min, @Param(value = "max") Double max, @Param(value = "name") String name);
|
||||
|
||||
GardsNuclLib getNuclideInfo(@Param(value = "name") String name);
|
||||
|
||||
GardsNuclLib getParentAndDaughter(@Param(value = "name") String name);
|
||||
|
||||
String findAutomaticLogPath(@Param(value = "sampleId") Integer sampleId);
|
||||
|
||||
List<String> findNuclideList(@Param(value = "min") Double min, @Param(value = "max") Double max, @Param(value = "nuclides") List<String> nuclides);
|
||||
|
||||
List<GardsNuclLinesLib> getNuclideTable(@Param(value = "name") String name, @Param(value = "span") Long span);
|
||||
|
||||
List<String> getPossibleNuclide(@Param(value = "nuclides") List<String> nuclides, @Param(value = "min") double min, @Param(value = "max") double max);
|
||||
|
||||
Integer SampleIsExist(@Param(value = "filePathName") String filePathName, @Param(value = "userName") String userName);
|
||||
|
||||
GardsSampleData findSampleByFile(@Param(value = "filePathName") String filePathName);
|
||||
|
||||
void updateAnalysesStatus(String filePathName);
|
||||
|
||||
Integer getStationId(String stationName);
|
||||
|
||||
Integer getDetectorId(String detectorName);
|
||||
|
||||
Integer getSampleId(@Param(value = "filePathName") String filePathName);
|
||||
|
||||
void updateGardsAnalyses(@Param(value = "gardsAnalyses") GardsAnalysesSpectrum gardsAnalyses);
|
||||
|
||||
void insertGardsAnalyses(@Param(value = "gardsAnalyses") GardsAnalysesSpectrum gardsAnalyses);
|
||||
|
||||
void deleteCalibrationPairs(Integer idAnalysis);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void insertCalibrationPairs(@Param(value = "calibrationPairs")
|
||||
GardsCalibrationPairs calibrationPairs);
|
||||
|
||||
void deleteCalibration(Integer idAnalysis);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void insertCalibration(@Param(value = "calibration") GardsCalibration calibration);
|
||||
|
||||
void deleteROIChannels(Integer idAnalysis);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void insertROIChannels(@Param(value = "roiChannels") GardsRoiChannels roiChannels);
|
||||
|
||||
void deleteXeResult(Integer idAnalysis);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void insertXeResult(@Param(value = "xeResult") GardsXeResults xeResult);
|
||||
|
||||
void deleteROIResults(Integer idAnalysis);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void insertROIResults(@Param(value = "roiResultsSpectrum") GardsRoiResults roiResultsSpectrum);
|
||||
|
||||
String getIdAnalysisByIdAnalyst(@Param(value = "sampleId") String sampleId, @Param(value = "userName") String userName);
|
||||
|
||||
void deletePeaks(Integer idAnalysis);
|
||||
|
||||
void deleteNuclLines(Integer idAnalysis);
|
||||
|
||||
void deleteNucl(Integer idAnalysis);
|
||||
|
||||
void deleteQCCheck(Integer idAnalysis);
|
||||
|
||||
void deleteMDC(Integer idAnalysis);
|
||||
|
||||
void deleteAnalySetting(Integer idAnalysis);
|
||||
|
||||
Integer getSampleIdLikeFileName(@Param(value = "fileName") String fileName);
|
||||
|
||||
List<String> findNuclidesAnalysis();
|
||||
|
||||
List<Map<String, Object>> selectThresholdDataBySampleId(@Param("schemaName") String schemaName, @Param("sampleId") String sampleId);
|
||||
|
||||
List<ThresholdResultHistory> selectThresholdHistoryBySampleId(@Param("schemaName") String schemaName, @Param("sampleId") String sampleId);
|
||||
|
||||
List<NuclideAnalysisInfo> selectXeDataPastYear( @Param("schemaName") String schemaName, @Param("sampleId") String sampleId,@Param(value = "userName") String userName);
|
||||
|
||||
}
|
||||
|
|
@ -127,7 +127,14 @@
|
|||
left JOIN CONFIGURATION.GARDS_DETECTORS a on c.detector_id = a.detector_id
|
||||
left JOIN CONFIGURATION.GARDS_STATIONS b on c.station_id = b.station_id
|
||||
<where>
|
||||
c.data_type = 'S'
|
||||
<choose>
|
||||
<when test=" gardsSampleData.dataType != null and gardsSampleData.dataType != '' ">
|
||||
and c.data_type = #{gardsSampleData.dataType}
|
||||
</when>
|
||||
<otherwise>
|
||||
and c.data_type = 'S'
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test=" gardsSampleData.sampleId != null ">
|
||||
and c.sample_id = #{gardsSampleData.sampleId}
|
||||
</if>
|
||||
|
|
@ -140,9 +147,6 @@
|
|||
<if test=" gardsSampleData.sampleType != null and gardsSampleData.sampleType != '' ">
|
||||
and c.sample_type = #{gardsSampleData.sampleType}
|
||||
</if>
|
||||
<if test=" gardsSampleData.dataType != null and gardsSampleData.dataType != '' ">
|
||||
and c.data_type = #{gardsSampleData.dataType}
|
||||
</if>
|
||||
<if test=" gardsSampleData.spectralQualifie != null and gardsSampleData.spectralQualifie != '' ">
|
||||
and c.spectral_qualifie = #{gardsSampleData.spectralQualifie}
|
||||
</if>
|
||||
|
|
@ -512,14 +516,14 @@
|
|||
<select id="getAnalysis" resultType="org.jeecg.modules.entity.GardsAnalysesSpectrum">
|
||||
SELECT
|
||||
IDANALYSIS idAnalysis,
|
||||
COMMENTS comments,
|
||||
COMMENTS as comments,
|
||||
SEARCHSTARTCHANNEL searchStartChannel,
|
||||
SEARCHENDCHANNEL searchEndChannel,
|
||||
SEARCHTHRESHOLD searchThreshold,
|
||||
NUMBEROFPEAKS numberOfPeaks,
|
||||
BASELINE_PATH baselinePath,
|
||||
LC_PATH lcPath,
|
||||
CATEGORY category,
|
||||
CATEGORY as category,
|
||||
SCAC_PATH scacPath
|
||||
FROM
|
||||
${dbName}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -7,7 +7,9 @@ import cn.hutool.core.io.FileUtil;
|
|||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
|
|
@ -43,6 +45,7 @@ import org.jeecg.modules.entity.*;
|
|||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.entity.vo.QCFlagParmData.Rule;
|
||||
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
|
||||
import org.jeecg.modules.mapper.SpectrumAnalysisPostgresMapper;
|
||||
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
|
||||
import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
|
||||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||
|
|
@ -55,9 +58,11 @@ import org.thymeleaf.context.Context;
|
|||
import org.thymeleaf.spring5.SpringTemplateEngine;
|
||||
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.sql.DataSource;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
|
|
@ -149,7 +154,21 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
// 获取阈值信息
|
||||
@Autowired
|
||||
private IRnManGardsThresholdService gardsThresholdService;
|
||||
Integer i = 1;
|
||||
|
||||
@Autowired
|
||||
private SpectrumAnalysisPostgresMapper postgresMapper;
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
private DbType databaseType;
|
||||
|
||||
@PostConstruct
|
||||
public void initDbType() throws SQLException {
|
||||
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
|
||||
String databaseProductName =
|
||||
ds.getDataSource("ora").getConnection().getMetaData().getDatabaseProductName();
|
||||
databaseType = DbType.getDbType(databaseProductName);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName,
|
||||
|
|
@ -319,7 +338,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
//声明分页page
|
||||
Page<GardsSampleDataSpectrum> page =
|
||||
new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
|
||||
Page<GardsSampleDataSpectrum> sampleDataPage =
|
||||
Page<GardsSampleDataSpectrum> sampleDataPage = databaseType == DbType.POSTGRE_SQL ?
|
||||
postgresMapper.getDBSpectrumListByLeftJoin(page, gardsSampleData, dbName,
|
||||
stationTypes, CollectStopB, AcqStartB, startTime, endTime, userStations,
|
||||
AllUsers, queryRequest.getField(), queryRequest.getOrder()) :
|
||||
spectrumAnalysisMapper.getDBSpectrumListByLeftJoin(page, gardsSampleData, dbName,
|
||||
stationTypes, CollectStopB, AcqStartB, startTime, endTime, userStations,
|
||||
AllUsers, queryRequest.getField(), queryRequest.getOrder());
|
||||
|
|
@ -846,8 +868,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
} else {
|
||||
resultMap.clear();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Map<String, Object> sampleMap = new HashMap<>();
|
||||
Map<String, Object> gasBgMap = new HashMap<>();
|
||||
Map<String, Object> detBgMap = new HashMap<>();
|
||||
|
|
@ -862,32 +883,39 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
BetaDataFile betaDataFile = cache.getIfPresent(sampleFileName + "-" + userName);
|
||||
if (Objects.isNull(betaDataFile)) {
|
||||
betaDataFile = new BetaDataFile();
|
||||
betaDataFile.setSampleFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() +
|
||||
betaDataFile.setSampleFilePathName(spectrumPathProperties.getRootPath() +
|
||||
spectrumPathProperties.getSaveFilePath() +
|
||||
StringPool.SLASH + sampleFilePath);
|
||||
sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName());
|
||||
//获取smaple文件解析结果
|
||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
|
||||
EnergySpectrumStruct struct =
|
||||
EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
|
||||
if (Objects.nonNull(struct)) {
|
||||
betaDataFile.setSampleStruct(struct);
|
||||
betaDataFile.setSampleFilePathName(sampleFilePath);
|
||||
betaDataFile.setSampleFileName(sampleFileName);
|
||||
sampleMap = phdFileUtil.getSourceData(struct, null, null, "sample", betaDataFile);
|
||||
sampleMap = phdFileUtil.getSourceData(struct, null, null, "sample",
|
||||
betaDataFile);
|
||||
sampleMap.put("fileName", betaDataFile.getSampleFileName());
|
||||
resultMap.put("sample", sampleMap);
|
||||
}
|
||||
// 根据当前谱获取Gas、Det、QC谱
|
||||
GardsSampleAux aux = sampleAuxSpectrumService.getSampleAuxBySampleId(sampleId);
|
||||
// 查询Det谱
|
||||
GardsSampleData detSampleData = sampleDataSpectrumService.getSampleByMId(aux.getBkgdMeasurementId(),
|
||||
DataTypeAbbr.DETBKPHD.getType(), sampleData.getSampleType());
|
||||
GardsSampleData detSampleData =
|
||||
sampleDataSpectrumService.getSampleByMId(aux.getBkgdMeasurementId(),
|
||||
DataTypeAbbr.DETBKPHD.getType(), sampleData.getSampleType());
|
||||
|
||||
// 查询Gas谱
|
||||
GardsSampleData gasSampleData = sampleDataSpectrumService.getSampleByMId(aux.getGasBkgdMeasurementId(),
|
||||
DataTypeAbbr.GASBKPHD.getType(), sampleData.getSampleType());
|
||||
GardsSampleData gasSampleData =
|
||||
sampleDataSpectrumService.getSampleByMId(aux.getGasBkgdMeasurementId(),
|
||||
DataTypeAbbr.GASBKPHD.getType(), sampleData.getSampleType());
|
||||
|
||||
if (StringUtils.isEmpty(sampleFilePath)
|
||||
&& (Objects.isNull(gasSampleData) || StringUtils.isEmpty(gasSampleData.getInputFileName()))
|
||||
&& (Objects.isNull(detSampleData) || StringUtils.isEmpty(detSampleData.getInputFileName()))) {
|
||||
&& (Objects.isNull(gasSampleData) ||
|
||||
StringUtils.isEmpty(gasSampleData.getInputFileName()))
|
||||
&& (Objects.isNull(detSampleData) ||
|
||||
StringUtils.isEmpty(detSampleData.getInputFileName()))) {
|
||||
result.error500("gas and det file is no exist or is error..");
|
||||
return result;
|
||||
}
|
||||
|
|
@ -909,46 +937,58 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
String detFileName = StrUtil.subAfter(detFilePath, StringPool.SLASH, true);
|
||||
|
||||
// GAS
|
||||
betaDataFile.setGasFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath()
|
||||
betaDataFile.setGasFilePathName(spectrumPathProperties.getRootPath() +
|
||||
spectrumPathProperties.getSaveFilePath()
|
||||
+ StringPool.SLASH + gasFilePath);
|
||||
betaDataFile.setGasFileName(gasFileName);
|
||||
gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName());
|
||||
EnergySpectrumStruct gasStruct = EnergySpectrumHandler.getSourceData(gasTmp.getAbsolutePath());
|
||||
EnergySpectrumStruct gasStruct =
|
||||
EnergySpectrumHandler.getSourceData(gasTmp.getAbsolutePath());
|
||||
if (Objects.nonNull(gasStruct)) {
|
||||
betaDataFile.setGasStruct(gasStruct);
|
||||
betaDataFile.setGasFilePathName(gasFilePath);
|
||||
betaDataFile.setGasFileName(gasFileName);
|
||||
gasBgMap = phdFileUtil.getSourceData(gasStruct, null, null, "gas", betaDataFile);
|
||||
gasBgMap = phdFileUtil.getSourceData(gasStruct, null, null, "gas",
|
||||
betaDataFile);
|
||||
gasBgMap.put("fileName", betaDataFile.getGasFileName());
|
||||
resultMap.put("gasBg", gasBgMap);
|
||||
}
|
||||
|
||||
// DET
|
||||
betaDataFile.setDetFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath()
|
||||
betaDataFile.setDetFilePathName(spectrumPathProperties.getRootPath() +
|
||||
spectrumPathProperties.getSaveFilePath()
|
||||
+ StringPool.SLASH + detFilePath);
|
||||
detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName());
|
||||
EnergySpectrumStruct detStruct = EnergySpectrumHandler.getSourceData(detTmp.getAbsolutePath());
|
||||
EnergySpectrumStruct detStruct =
|
||||
EnergySpectrumHandler.getSourceData(detTmp.getAbsolutePath());
|
||||
if (Objects.nonNull(detStruct)) {
|
||||
betaDataFile.setDetStruct(detStruct);
|
||||
betaDataFile.setDetFilePathName(detFilePath);
|
||||
betaDataFile.setDetFileName(detFileName);
|
||||
detBgMap = phdFileUtil.getSourceData(detStruct, null, null, "det", betaDataFile);
|
||||
detBgMap = phdFileUtil.getSourceData(detStruct, null, null, "det",
|
||||
betaDataFile);
|
||||
detBgMap.put("fileName", betaDataFile.getDetFileName());
|
||||
resultMap.put("detBg", detBgMap);
|
||||
}
|
||||
|
||||
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
|
||||
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(),
|
||||
"yyyy/MM/dd HH:mm:ss");
|
||||
// 查询Qc谱
|
||||
String qcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
|
||||
String qcFilePath =
|
||||
spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(),
|
||||
collectStartStr);
|
||||
if (StringUtils.isNotBlank(qcFilePath)) {
|
||||
GardsSampleData qcSampleData = spectrumAnalysisMapper.findSampleByFilePath(qcFilePath);
|
||||
GardsSampleData qcSampleData =
|
||||
spectrumAnalysisMapper.findSampleByFilePath(qcFilePath);
|
||||
String qcFileName = StrUtil.subAfter(qcFilePath, StringPool.SLASH, true);
|
||||
EnergySpectrumStruct qcStruct = getSourceData(qcFilePath, "qc", betaDataFile);
|
||||
EnergySpectrumStruct qcStruct =
|
||||
getSourceData(qcFilePath, "qc", betaDataFile);
|
||||
if (Objects.nonNull(qcStruct)) {
|
||||
betaDataFile.setQcStruct(qcStruct);
|
||||
betaDataFile.setQcFilePathName(qcFilePath);
|
||||
betaDataFile.setQcFileName(qcFileName);
|
||||
qcMap = phdFileUtil.getSourceData(qcStruct, null, null, "qc", betaDataFile);
|
||||
qcMap = phdFileUtil.getSourceData(qcStruct, null, null, "qc",
|
||||
betaDataFile);
|
||||
qcMap.put("fileName", betaDataFile.getQcFileName());
|
||||
resultMap.put("qc", qcMap);
|
||||
}
|
||||
|
|
@ -4541,7 +4581,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
statisticsQueryData.setNuclidesList(new LinkedList<>());
|
||||
}
|
||||
//根据类型判断查询对应数据
|
||||
List<StatisticsData> statisticsData =
|
||||
List<StatisticsData> statisticsData = databaseType == DbType.POSTGRE_SQL ?
|
||||
postgresMapper.statisticsQueryNuclides(statisticsQueryData) :
|
||||
spectrumAnalysisMapper.statisticsQueryNuclides(statisticsQueryData);
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
List<StcGraph> stcGraphList = new LinkedList<>();
|
||||
|
|
@ -4756,7 +4797,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
}
|
||||
}
|
||||
if (statisticsType.equals("Colloc_Time")) {
|
||||
List<StatisticsData> statisticsData =
|
||||
List<StatisticsData> statisticsData = databaseType == DbType.POSTGRE_SQL ?
|
||||
postgresMapper.statisticsQueryCollection(startDate, endDate, detectorIdList) :
|
||||
spectrumAnalysisMapper.statisticsQueryCollection(startDate, endDate,
|
||||
detectorIdList);
|
||||
StcGraph stcGraph = new StcGraph();
|
||||
|
|
@ -4773,7 +4815,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
result.setSuccess(true);
|
||||
result.setResult(stcGraph);
|
||||
} else if (statisticsType.equals("Acq_Time")) {
|
||||
List<StatisticsData> statisticsData =
|
||||
List<StatisticsData> statisticsData = databaseType == DbType.POSTGRE_SQL ?
|
||||
postgresMapper.statisticsQueryAcquisition(startDate, endDate, detectorIdList) :
|
||||
spectrumAnalysisMapper.statisticsQueryAcquisition(startDate, endDate,
|
||||
detectorIdList);
|
||||
StcGraph stcGraph = new StcGraph();
|
||||
|
|
@ -4790,7 +4833,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
result.setSuccess(true);
|
||||
result.setResult(stcGraph);
|
||||
} else if (statisticsType.equals("Xe_volumn")) {
|
||||
List<StatisticsData> statisticsData =
|
||||
List<StatisticsData> statisticsData = databaseType == DbType.POSTGRE_SQL ?
|
||||
postgresMapper.statisticsQueryXeVolumn(startDate, endDate, detectorIdList) :
|
||||
spectrumAnalysisMapper.statisticsQueryXeVolumn(startDate, endDate,
|
||||
detectorIdList);
|
||||
StcGraph stcGraph = new StcGraph();
|
||||
|
|
@ -4807,7 +4851,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
result.setSuccess(true);
|
||||
result.setResult(stcGraph);
|
||||
} else if (statisticsType.equals("Sample_Volumn")) {
|
||||
List<StatisticsData> statisticsData =
|
||||
List<StatisticsData> statisticsData = databaseType == DbType.POSTGRE_SQL ?
|
||||
postgresMapper.statisticsQuerySampleVolumn(startDate, endDate, detectorIdList) :
|
||||
spectrumAnalysisMapper.statisticsQuerySampleVolumn(startDate, endDate,
|
||||
detectorIdList);
|
||||
StcGraph stcGraph = new StcGraph();
|
||||
|
|
@ -6155,10 +6200,20 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
gardsAnalyses.setAnalyst(anlyseResultIn.getUserName());
|
||||
gardsAnalyses.setLogPath(qsLogPath);
|
||||
gardsAnalyses.setReportPath(qsReportPath);
|
||||
boolean isPostgres = databaseType == DbType.POSTGRE_SQL;
|
||||
if (Objects.nonNull(isExist)) {
|
||||
spectrumAnalysisMapper.updateGardsAnalyses(gardsAnalyses);
|
||||
if (isPostgres) {
|
||||
postgresMapper.updateGardsAnalyses(gardsAnalyses);
|
||||
} else {
|
||||
spectrumAnalysisMapper.updateGardsAnalyses(gardsAnalyses);
|
||||
}
|
||||
} else {//如果没有分析过就新增--GARDS_ANALYSES
|
||||
spectrumAnalysisMapper.insertGardsAnalyses(gardsAnalyses);
|
||||
if (isPostgres) {
|
||||
postgresMapper.insertGardsAnalyses(gardsAnalyses);
|
||||
} else {
|
||||
spectrumAnalysisMapper.insertGardsAnalyses(gardsAnalyses);
|
||||
}
|
||||
|
||||
}
|
||||
//查询analysisId根据sampleId 分析员名称--GARDS_ANALYSES
|
||||
GardsAnalysesSpectrum analysis =
|
||||
|
|
@ -6321,7 +6376,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
Files.createDirectories(destinationDir);
|
||||
}
|
||||
reportByThymeleaf.generateHtmlReportToFile(rrrMap,
|
||||
targetDir + "\\"+analyses_absolute_ReportPath+".html");
|
||||
targetDir + "\\" + analyses_absolute_ReportPath + ".html");
|
||||
copyEchartsLib(targetDir);
|
||||
|
||||
} catch (IOException e) {
|
||||
|
|
@ -8205,18 +8260,13 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
stationId = idcStationMap.get(struct.site_code);
|
||||
}
|
||||
//连接本地同步的idc数据库
|
||||
conn = dataService.connectInland();
|
||||
//连接对象为空 则连接idc国际库
|
||||
if (Objects.isNull(conn)) {
|
||||
conn = dataService.connectOverSea();
|
||||
}
|
||||
//判断是否连接成功
|
||||
if (Objects.nonNull(conn)) {
|
||||
//查询获取beta分析后的xe结果表的对比数据内容
|
||||
xeResultsViewList =
|
||||
dataService.viewBetaXeResult(struct.detector_code, struct.spectrum_quantity,
|
||||
stationId, collectStart, acquisitionStop, conn);
|
||||
}
|
||||
//查询获取beta分析后的xe结果表的对比数据内容
|
||||
xeResultsViewList =
|
||||
dataService.viewBetaXeResult(struct.detector_code, struct.spectrum_quantity,
|
||||
stationId, collectStart, acquisitionStop);
|
||||
|
||||
result.setSuccess(true);
|
||||
result.setResult(xeResultsViewList);
|
||||
} catch (ParseException e) {
|
||||
|
|
@ -9329,10 +9379,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport
|
|||
|
||||
// 计算当前对象属于哪个区间索引
|
||||
int index = (int) ((conc - min) / binWidth);
|
||||
if (index < 0) {
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
}
|
||||
if (index >= numBins) {
|
||||
if (index >= numBins) {
|
||||
index = numBins - 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.entity.GardsSampleDataWeb;
|
||||
import org.jeecg.modules.entity.vo.SpectrumFileRecord;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface GardsSampleDataWebPostgresMapper {
|
||||
|
||||
Page<GardsSampleDataWeb> findAutoPage(String startDate, String endDate, List<Integer> stationIdList, String qualifie, String sampleType, Page<GardsSampleDataWeb> page);
|
||||
|
||||
Page<GardsSampleDataWeb> findReviewedPage(String startDate, String endDate, List<Integer> stationIdList, String qualifie, Page<GardsSampleDataWeb> page);
|
||||
|
||||
Page<GardsSampleDataWeb> findParticulatePage(String dataType, String spectralQualifie, String startDate, String endDate, List<Integer> stationIdList, Page<GardsSampleDataWeb> page);
|
||||
|
||||
Integer getAnalysisID(@Param(value = "sampleId") Integer sampleId);
|
||||
|
||||
SpectrumFileRecord getDBSpectrumFilePath(Integer sampleId, Integer analysisID);
|
||||
|
||||
String getQCFilePath(String siteDetCode, String collectStartStr);
|
||||
|
||||
Integer getSampleId(@Param(value = "filePathName") String filePathName);
|
||||
|
||||
List<Map<String, Object>> findNuclideStatistics(@Param(value = "stationId") String stationId, @Param(value = "startTime") String startTime, @Param(value = "endTime") String endTime, @Param(value = "nuclideSql") String nuclideSql);
|
||||
|
||||
}
|
||||
|
|
@ -209,11 +209,10 @@
|
|||
A.ACQUISITION_LIVE_SEC,
|
||||
A.SITE_DET_CODE
|
||||
FROM
|
||||
ORIGINAL.GARDS_SAMPLE_DATA A,
|
||||
ORIGINAL.GARDS_SAMPLE_AUX B
|
||||
ORIGINAL.GARDS_SAMPLE_DATA A
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX B ON A.SAMPLE_ID = B.SAMPLE_ID
|
||||
WHERE
|
||||
A.STATION_ID = #{stationId}
|
||||
AND A.SAMPLE_ID = B.SAMPLE_ID
|
||||
AND A.DATA_TYPE = 'S'
|
||||
AND A.SPECTRAL_QUALIFIE = 'FULL'
|
||||
AND A.COLLECT_START BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
|
|
|
|||
|
|
@ -0,0 +1,228 @@
|
|||
<?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.GardsSampleDataWebPostgresMapper">
|
||||
|
||||
<select id="findAutoPage" resultType="org.jeecg.modules.entity.GardsSampleDataWeb">
|
||||
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,
|
||||
ana.ANALYST
|
||||
FROM
|
||||
ORIGINAL.GARDS_SAMPLE_DATA sam
|
||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana on ana.SAMPLE_ID = sam.SAMPLE_ID
|
||||
<where>
|
||||
sam.COLLECT_START >= TO_TIMESTAMP(#{startDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
and sam.COLLECT_STOP <= TO_TIMESTAMP(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
<if test="stationIdList.size==0 and stationIdList != null">
|
||||
and 1=0 <!--<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>
|
||||
<if test = "qualifie != null and qualifie != ''">
|
||||
AND sam.SPECTRAL_QUALIFIE = #{qualifie}
|
||||
</if>
|
||||
<if test = "sampleType != null and sampleType != ''">
|
||||
AND sam.SAMPLE_TYPE = #{sampleType}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sam.ACQUISITION_START DESC
|
||||
</select>
|
||||
|
||||
<select id="findReviewedPage" resultType="org.jeecg.modules.entity.GardsSampleDataWeb">
|
||||
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,
|
||||
ana.ANALYST
|
||||
FROM
|
||||
ORIGINAL.GARDS_SAMPLE_DATA sam
|
||||
INNER JOIN RNMAN.GARDS_ANALYSES ana on ana.SAMPLE_ID = sam.SAMPLE_ID
|
||||
<where>
|
||||
sam.COLLECT_START >= TO_TIMESTAMP(#{startDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
AND sam.COLLECT_STOP <= TO_TIMESTAMP(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
AND ana.REPORT_PAHT IS NOT NULL
|
||||
<if test="stationIdList.size ==0 and stationIdList != null">
|
||||
and 1=0 <!--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>
|
||||
<if test = "qualifie != null and qualifie != ''">
|
||||
AND sam.SPECTRAL_QUALIFIE = #{qualifie}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sam.ACQUISITION_START DESC
|
||||
</select>
|
||||
|
||||
<select id="findParticulatePage" resultType="org.jeecg.modules.entity.GardsSampleDataWeb">
|
||||
SELECT
|
||||
SAMPLE_ID,
|
||||
SITE_DET_CODE,
|
||||
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>
|
||||
DATA_TYPE = '${dataType}'
|
||||
<if test=" spectralQualifie != '' and spectralQualifie != null ">
|
||||
AND SPECTRAL_QUALIFIE = '${spectralQualifie}'
|
||||
AND COLLECT_START >= TO_TIMESTAMP( '${startDate}', 'YYYY-MM-DD HH24:MI:SS' )
|
||||
AND COLLECT_STOP <= TO_TIMESTAMP( '${endDate}', 'YYYY-MM-DD HH24:MI:SS' )
|
||||
</if>
|
||||
<if test=" spectralQualifie == '' or spectralQualifie == null ">
|
||||
AND ACQUISITION_START >= TO_TIMESTAMP( '${startDate}', 'YYYY-MM-DD HH24:MI:SS' )
|
||||
AND ACQUISITION_STOP <= TO_TIMESTAMP( '${endDate}', 'YYYY-MM-DD HH24:MI:SS' )
|
||||
</if>
|
||||
<if test="stationIdList.size>0 and stationIdList != null">
|
||||
AND STATION_ID in
|
||||
<foreach collection="stationIdList" item="stationId" open="(" close=")" separator=",">
|
||||
${stationId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ACQUISITION_START DESC
|
||||
</select>
|
||||
|
||||
<select id="getAnalysisID" resultType="java.lang.Integer">
|
||||
SELECT ANALYSIS_DB.IDANALYSIS FROM RNAUTO.GARDS_ANALYSES ANALYSIS_DB WHERE ANALYSIS_DB.SAMPLE_ID = #{sampleId} and ANALYST = 'RNAUTO'
|
||||
</select>
|
||||
|
||||
<select id="getDBSpectrumFilePath" resultType="org.jeecg.modules.entity.vo.SpectrumFileRecord">
|
||||
SELECT
|
||||
org_sample.SAMPLE_ID sampleId,
|
||||
org_sample.INPUT_FILE_NAME sampleFilePath,
|
||||
analyses.USEDGASPHD gasBgFilePath,
|
||||
analyses.USEDDETPHD detBgFilePath,
|
||||
analyses.LOG_PATH logFilePath,
|
||||
analyses.REPORT_PAHT reportFilePath,
|
||||
TRIM(org_sample.SITE_DET_CODE) siteDetCode,
|
||||
org_sample.COLLECT_START collectStart
|
||||
FROM ORIGINAL.GARDS_SAMPLE_DATA org_sample,
|
||||
RNAUTO.GARDS_ANALYSES analyses
|
||||
<where>
|
||||
analyses.SAMPLE_ID = #{sampleId}
|
||||
AND analyses.IDANALYSIS = #{analysisID}
|
||||
AND org_sample.SAMPLE_ID=analyses.SAMPLE_ID
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getQCFilePath" resultType="java.lang.String">
|
||||
SELECT org_sample_data.INPUT_FILE_NAME
|
||||
FROM ORIGINAL.GARDS_SAMPLE_DATA org_sample_data
|
||||
<where>
|
||||
org_sample_data.ACQUISITION_START = (
|
||||
SELECT MAX(qc_samples.ACQUISITION_START)
|
||||
FROM ORIGINAL.GARDS_SAMPLE_DATA qc_samples
|
||||
WHERE qc_samples.SITE_DET_CODE = #{siteDetCode}
|
||||
AND qc_samples.DATA_TYPE = 'Q'
|
||||
AND qc_samples.SPECTRAL_QUALIFIE = 'FULL'
|
||||
AND qc_samples.ACQUISITION_START <= TO_TIMESTAMP(#{collectStartStr}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
)
|
||||
AND org_sample_data.SITE_DET_CODE = #{siteDetCode}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getSampleId" resultType="java.lang.Integer">
|
||||
SELECT SAMPLE_ID FROM ORIGINAL.GARDS_SAMPLE_DATA WHERE INPUT_FILE_NAME = #{filePathName}
|
||||
</select>
|
||||
|
||||
<select id="findNuclideStatistics" resultType="java.util.Map">
|
||||
SELECT
|
||||
AA.STATION_ID,
|
||||
AA.SAMPLE_ID,
|
||||
AA.SAMPLE_REF_ID,
|
||||
AA.SPECTRAL_QUALIFIE,
|
||||
AA.COLLECT_START,
|
||||
AA.COLLECT_STOP,
|
||||
AA.QUANTITY,
|
||||
AA.XE_VOLUME,
|
||||
AA.ACQUISITION_START,
|
||||
AA.ACQUISITION_STOP,
|
||||
AA.ACQUISITION_LIVE_SEC,
|
||||
AA.SITE_DET_CODE,
|
||||
${nuclideSql}
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
A.STATION_ID,
|
||||
A.SAMPLE_ID,
|
||||
B.SAMPLE_REF_ID,
|
||||
A.SPECTRAL_QUALIFIE,
|
||||
A.COLLECT_START,
|
||||
A.COLLECT_STOP,
|
||||
A.QUANTITY,
|
||||
B.XE_VOLUME,
|
||||
A.ACQUISITION_START,
|
||||
A.ACQUISITION_STOP,
|
||||
A.ACQUISITION_LIVE_SEC,
|
||||
A.SITE_DET_CODE
|
||||
FROM
|
||||
ORIGINAL.GARDS_SAMPLE_DATA A
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX B ON A.SAMPLE_ID = B.SAMPLE_ID
|
||||
WHERE
|
||||
A.STATION_ID = #{stationId}
|
||||
AND A.DATA_TYPE = 'S'
|
||||
AND A.SPECTRAL_QUALIFIE = 'FULL'
|
||||
AND A.COLLECT_START BETWEEN TO_TIMESTAMP(#{startTime}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
AND TO_TIMESTAMP(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
) AA
|
||||
ORDER BY
|
||||
AA.COLLECT_START
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -3,7 +3,9 @@ package org.jeecg.modules.service.impl;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
|
@ -20,6 +22,7 @@ import org.jeecg.modules.entity.GardsSampleDataWeb;
|
|||
import org.jeecg.modules.entity.dto.SampleDataDto;
|
||||
import org.jeecg.modules.mapper.GardsAnalysesAutoMapper;
|
||||
import org.jeecg.modules.mapper.GardsSampleDataWebMapper;
|
||||
import org.jeecg.modules.mapper.GardsSampleDataWebPostgresMapper;
|
||||
import org.jeecg.modules.service.IAutoService;
|
||||
import org.jeecg.modules.service.IGardsSampleDataWebService;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
|
|
@ -27,49 +30,82 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.sql.DataSource;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("autoService")
|
||||
@DS("ora")
|
||||
public class AutoServiceImpl extends ServiceImpl<GardsAnalysesAutoMapper, GardsAnalyses> implements IAutoService {
|
||||
public class AutoServiceImpl extends ServiceImpl<GardsAnalysesAutoMapper, GardsAnalyses>
|
||||
implements IAutoService {
|
||||
|
||||
@Autowired
|
||||
private IGardsSampleDataWebService gardsSampleDataService;
|
||||
@Autowired
|
||||
private GardsSampleDataWebMapper gardsSampleDataWebMapper;
|
||||
@Autowired
|
||||
private GardsSampleDataWebPostgresMapper gardsSampleDataWebPostgresMapper;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
private DbType databaseType;
|
||||
|
||||
@PostConstruct
|
||||
public void initDbType() throws SQLException {
|
||||
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
|
||||
String databaseProductName =
|
||||
ds.getDataSource("ora").getConnection().getMetaData().getDatabaseProductName();
|
||||
databaseType = DbType.getDbType(databaseProductName);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findAutoPage(QueryRequest queryRequest, Integer[] stationIds, String qualifie, String sampleType, Date startTime, Date endTime) {
|
||||
public Result findAutoPage(QueryRequest queryRequest, Integer[] stationIds, String qualifie,
|
||||
String sampleType, Date startTime, Date endTime) {
|
||||
Result result = new Result();
|
||||
//获取redis中缓存的台站信息
|
||||
Map<String, String> stationMap = (Map<String, String>)redisUtil.get("stationMap");
|
||||
if (Objects.isNull(startTime)){
|
||||
Map<String, String> stationMap = (Map<String, String>) redisUtil.get("stationMap");
|
||||
if (Objects.isNull(startTime)) {
|
||||
result.error500("The start time cannot be empty");
|
||||
return result;
|
||||
}
|
||||
String startDate = DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00";
|
||||
if (Objects.isNull(endTime)){
|
||||
if (Objects.isNull(endTime)) {
|
||||
result.error500("The end time cannot be empty");
|
||||
return result;
|
||||
}
|
||||
String endDate = DateUtils.formatDate(endTime, "yyyy-MM-dd") + " 23:59:59";
|
||||
List<Integer> stationIdList;
|
||||
if (Objects.isNull(stationIds)){
|
||||
if (Objects.isNull(stationIds)) {
|
||||
stationIdList = new LinkedList<>();
|
||||
}else {
|
||||
} else {
|
||||
stationIdList = Arrays.asList(stationIds);
|
||||
}
|
||||
Page<GardsSampleDataWeb> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
|
||||
Page<GardsSampleDataWeb> sampleDataPage = gardsSampleDataWebMapper.findAutoPage(startDate, endDate, stationIdList, qualifie, sampleType, page);
|
||||
sampleDataPage.getRecords().forEach(item->{
|
||||
Page<GardsSampleDataWeb> page =
|
||||
new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
|
||||
Page<GardsSampleDataWeb> sampleDataPage =
|
||||
new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
|
||||
if (databaseType == DbType.POSTGRE_SQL) {
|
||||
sampleDataPage =
|
||||
gardsSampleDataWebPostgresMapper.findAutoPage(startDate, endDate, stationIdList,
|
||||
qualifie, sampleType, page);
|
||||
} else if (databaseType == DbType.ORACLE) {
|
||||
sampleDataPage =
|
||||
gardsSampleDataWebMapper.findAutoPage(startDate, endDate, stationIdList,
|
||||
qualifie, sampleType, page);
|
||||
}
|
||||
|
||||
sampleDataPage.getRecords().forEach(item -> {
|
||||
item.setSiteDetCode(StringUtils.trim(item.getSiteDetCode()));
|
||||
if (stationMap.containsKey(item.getStationId().toString()) && CollectionUtils.isNotEmpty(stationMap)){
|
||||
if (stationMap.containsKey(item.getStationId().toString()) &&
|
||||
CollectionUtils.isNotEmpty(stationMap)) {
|
||||
String stationName = stationMap.get(item.getStationId().toString());
|
||||
item.setStationName(stationName);
|
||||
}
|
||||
|
|
@ -82,7 +118,7 @@ public class AutoServiceImpl extends ServiceImpl<GardsAnalysesAutoMapper, GardsA
|
|||
@Override
|
||||
public GardsAnalyses getOne(Integer sampleId) {
|
||||
LambdaQueryWrapper<GardsAnalyses> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(GardsAnalyses::getSampleId,sampleId);
|
||||
wrapper.eq(GardsAnalyses::getSampleId, sampleId);
|
||||
GardsAnalyses gardsAnalyses = getOne(wrapper);
|
||||
return Optional.ofNullable(gardsAnalyses)
|
||||
.orElse(new GardsAnalyses());
|
||||
|
|
@ -101,7 +137,9 @@ public class AutoServiceImpl extends ServiceImpl<GardsAnalysesAutoMapper, GardsA
|
|||
.stream()
|
||||
.map(GardsAnalyses::getSampleId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(sampleIds)) return;
|
||||
if (CollUtil.isEmpty(sampleIds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 查询全部样品基础数据
|
||||
List<GardsSampleDataWeb> sampleData = gardsSampleDataService.listBySampleIds(stationIds,
|
||||
|
|
@ -118,18 +156,20 @@ public class AutoServiceImpl extends ServiceImpl<GardsAnalysesAutoMapper, GardsA
|
|||
OutputStream outputStream = null;
|
||||
try {
|
||||
// 设置文件名、Excel类型(xls|xlsx)
|
||||
outputStream = ExportUtil.xls(response,"ARR.xls");
|
||||
outputStream = ExportUtil.xls(response, "ARR.xls");
|
||||
workbook = ExcelExportUtil.
|
||||
exportExcel(params, SampleDataDto.class, sampleDataDtos);
|
||||
workbook.write(outputStream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
} finally {
|
||||
try {
|
||||
if (ObjectUtil.isNotNull(outputStream))
|
||||
if (ObjectUtil.isNotNull(outputStream)) {
|
||||
outputStream.close();
|
||||
if (ObjectUtil.isNotNull(workbook))
|
||||
}
|
||||
if (ObjectUtil.isNotNull(workbook)) {
|
||||
workbook.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ import cn.hutool.core.map.MapUtil;
|
|||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
|
|
@ -39,9 +41,12 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.sql.DataSource;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.sql.SQLException;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -66,6 +71,21 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
|
|||
@Autowired
|
||||
private ParameterProperties parameterProperties;
|
||||
|
||||
@Autowired
|
||||
private GardsSampleDataWebPostgresMapper postgresMapper;
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
private DbType databaseType;
|
||||
|
||||
@PostConstruct
|
||||
public void initDbType() throws SQLException {
|
||||
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
|
||||
String databaseProductName =
|
||||
ds.getDataSource("ora").getConnection().getMetaData().getDatabaseProductName();
|
||||
databaseType = DbType.getDbType(databaseProductName);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findParticulatePage(QueryRequest queryRequest, Integer[] stationIds, String dataType, String spectralQualifie, Date startTime,Date endTime) {
|
||||
try {
|
||||
|
|
@ -210,7 +230,7 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
|
|||
//获取分析表中的采集开始时间
|
||||
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
|
||||
//根据探测器信息以及采集开始时间查询对应的qc文件路径
|
||||
String dbQcFilePath = this.baseMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
|
||||
String dbQcFilePath =databaseType==DbType.POSTGRE_SQL?postgresMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr): this.baseMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
|
||||
//根据各路径返回sample,gas,det,qc对应的文件sampleId
|
||||
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())) {
|
||||
sampleStream = ftpUtil.downloadFileStream(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath()+ StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath());
|
||||
|
|
@ -940,7 +960,8 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
|
|||
}
|
||||
}
|
||||
//拼接sql查询结果
|
||||
List<Map<String, Object>> nuclideStatisticsMap = this.baseMapper.findNuclideStatistics(stationId, startTime, endTime, nuclideSql);
|
||||
List<Map<String, Object>> nuclideStatisticsMap =databaseType==DbType.POSTGRE_SQL?postgresMapper.findNuclideStatistics(stationId, startTime, endTime, nuclideSql):
|
||||
this.baseMapper.findNuclideStatistics(stationId, startTime, endTime, nuclideSql);
|
||||
//处理查询结果
|
||||
handleNuclideData(nuclideStatisticsMap, systemType, nuclideNameList, allDayTime, resultMap);
|
||||
//返回台站名称
|
||||
|
|
@ -1054,7 +1075,8 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
|
|||
//返回台站名称
|
||||
String stationName = stationMap.get(stationId);
|
||||
//拼接sql查询结果
|
||||
List<Map<String, Object>> nuclideStatisticsMap = this.baseMapper.findNuclideStatistics(stationId, startTime, endTime, nuclideSql);
|
||||
List<Map<String, Object>> nuclideStatisticsMap =databaseType==DbType.POSTGRE_SQL?postgresMapper.findNuclideStatistics(stationId, startTime, endTime, nuclideSql):
|
||||
this.baseMapper.findNuclideStatistics(stationId, startTime, endTime, nuclideSql);
|
||||
resultMap.put(stationName, nuclideStatisticsMap);
|
||||
//添加台站名称到集合
|
||||
stationNameList.add(stationName);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package org.jeecg.modules.service.impl;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
|
@ -19,6 +21,7 @@ import org.jeecg.modules.entity.GardsSampleDataWeb;
|
|||
import org.jeecg.modules.entity.dto.SampleDataDto;
|
||||
import org.jeecg.modules.mapper.GardsAnalysesManMapper;
|
||||
import org.jeecg.modules.mapper.GardsSampleDataWebMapper;
|
||||
import org.jeecg.modules.mapper.GardsSampleDataWebPostgresMapper;
|
||||
import org.jeecg.modules.service.IGardsSampleDataWebService;
|
||||
import org.jeecg.modules.service.IReviewedService;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
|
|
@ -26,9 +29,12 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.sql.DataSource;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -43,6 +49,21 @@ public class ReviewedServiceImpl extends ServiceImpl<GardsAnalysesManMapper, Gar
|
|||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private GardsSampleDataWebPostgresMapper postgresMapper;
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
private DbType databaseType;
|
||||
|
||||
@PostConstruct
|
||||
public void initDbType() throws SQLException {
|
||||
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
|
||||
String databaseProductName =
|
||||
ds.getDataSource("ora").getConnection().getMetaData().getDatabaseProductName();
|
||||
databaseType = DbType.getDbType(databaseProductName);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findReviewedPage(QueryRequest queryRequest, Integer[] stationIds, String qualifie, Date startTime, Date endTime) {
|
||||
Result result = new Result();
|
||||
|
|
@ -65,7 +86,7 @@ public class ReviewedServiceImpl extends ServiceImpl<GardsAnalysesManMapper, Gar
|
|||
stationIdList = Arrays.asList(stationIds);
|
||||
}
|
||||
Page<GardsSampleDataWeb> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
|
||||
Page<GardsSampleDataWeb> sampleDataPage = gardsSampleDataWebMapper.findReviewedPage(startDate, endDate, stationIdList, qualifie, page);
|
||||
Page<GardsSampleDataWeb> sampleDataPage =databaseType==DbType.POSTGRE_SQL?postgresMapper.findReviewedPage(startDate, endDate, stationIdList, qualifie, page): gardsSampleDataWebMapper.findReviewedPage(startDate, endDate, stationIdList, qualifie, page);
|
||||
sampleDataPage.getRecords().forEach(item->{
|
||||
item.setSiteDetCode(StringUtils.trim(item.getSiteDetCode()));
|
||||
if (stationMap.containsKey(item.getStationId().toString()) && CollectionUtils.isNotEmpty(stationMap)){
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user