新增compare,strip加载数据库加载数据接口

This commit is contained in:
qiaoqinzheng 2023-12-11 20:26:57 +08:00
parent 79d7981789
commit a74736e2eb
5 changed files with 134 additions and 0 deletions

View File

@ -2,18 +2,22 @@ package org.jeecg.modules.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.bizVo.GammaRLR;
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.feignclient.SystemClient;
import org.jeecg.modules.service.IGammaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
@RestController
@ -53,6 +57,12 @@ public class GammaController {
gammaService.delPHDCache(fileName);
}
@GetMapping("loadSampleData")
public Result loadSampleData(QueryRequest queryRequest, GardsSampleDataSpectrum gardsSampleData, String[] menuTypes, boolean AllUsers, boolean CollectStopB, boolean AcqStartB,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate, HttpServletRequest request) {
return gammaService.loadSampleData(queryRequest, gardsSampleData, menuTypes, AllUsers, CollectStopB, AcqStartB, startDate, endDate, request);
}
@GetMapping("CompareDB")
public Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request) {
return gammaService.CompareDB(fileName, sampleId, request);

View File

@ -22,6 +22,8 @@ public interface SpectrumAnalysisMapper {
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> 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);

View File

@ -106,6 +106,78 @@
</if>
</select>
<select id="loadSampleData" resultType="org.jeecg.modules.entity.GardsSampleDataSpectrum">
select
c.sample_id sampleId,
b.station_code stationName,
a.detector_code detectorsName,
c.sample_type sampleType,
c.data_type dataType,
c.spectral_qualifie spectralQualifie,
c.collect_stop collectStop,
c.acquisition_start acquisitionStart,
c.acquisition_real_sec acquisitionRealSec,
c.acquisition_live_sec acquisitionLiveSec,
c.status status,
c.input_file_name inputFileName
from
CONFIGURATION.GARDS_DETECTORS a,
CONFIGURATION.GARDS_STATIONS b,
ORIGINAL.GARDS_SAMPLE_DATA c
<where>
c.detector_id = a.detector_id
and c.station_id = b.station_id
and b.type in
<foreach collection="stationTypes" item="stationType" open="(" close=")" separator=",">
#{stationType}
</foreach>
<if test=" gardsSampleData.sampleId != null ">
and c.sample_id = #{gardsSampleData.sampleId}
</if>
<if test=" gardsSampleData.stationName != null and gardsSampleData.stationName != '' ">
and b.station_code = #{gardsSampleData.stationName}
</if>
<if test=" gardsSampleData.detectorsName != null and gardsSampleData.detectorsName != '' ">
and a.detector_code = #{gardsSampleData.detectorsName}
</if>
<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>
<if test=" gardsSampleData.status != null and gardsSampleData.status != '' ">
and c.status = #{gardsSampleData.status}
</if>
<if test=" CollectStopB == true ">
and c.collect_stop between TO_DATE(#{startTime}, 'yyyy-mm-dd hh24:mi:ss') and TO_DATE(#{endTime}, 'yyyy-mm-dd hh24:mi:ss')
</if>
<if test=" AcqStartB == 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="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>
<if test=" orderField != 'createTime' and orderField != '' and orderField != null and orderType != '' and orderType != null ">
ORDER BY ${orderField} ${orderType}
</if>
<if test=" orderField == 'createTime' or orderField == '' or orderField == null or orderType == '' or orderType == null ">
ORDER BY collectStop DESC
</if>
</select>
<select id="getXeDataList" resultType="org.jeecg.modules.entity.GardsXeResultsSpectrum">
SELECT SAMPLE_ID,NUCLIDE_NAME,CONC,CONC_ERR,MDC,LC FROM RNAUTO.GARDS_XE_RESULTS where SAMPLE_ID = #{sampleId}
</select>

View File

@ -1,13 +1,16 @@
package org.jeecg.modules.service;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.bizVo.GammaRLR;
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
import org.jeecg.modules.entity.vo.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
public interface IGammaService{
@ -22,6 +25,8 @@ public interface IGammaService{
void delPHDCache(String fileName);
Result loadSampleData(QueryRequest queryRequest, GardsSampleDataSpectrum gardsSampleData, String[] menuTypes, boolean AllUsers, boolean CollectStopB, boolean AcqStartB, Date startDate, Date endDate, HttpServletRequest request);
Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request);
Result Compare(String fileName, String compareFileName, HttpServletRequest request);

View File

@ -10,8 +10,10 @@ import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
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.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Maps;
@ -21,6 +23,7 @@ import org.apache.commons.lang3.StringUtils;
import com.google.common.cache.Cache;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.cache.LocalCache;
import org.jeecg.common.constant.DateConstant;
@ -142,6 +145,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
private IGardsAnalySettingSpectrumService analySettingSpectrumService;
@Autowired
private RedisStreamUtil redisStreamUtil;
@Autowired
private ISysDictSpectrumService sysDictService;
@Override
public Result initValue(Integer sampleId, String dbName, String analyst, String samfileName, HttpServletRequest request) {
@ -899,6 +904,46 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
localCache.deletePHDCache(key);
}
@Override
public Result loadSampleData(QueryRequest queryRequest, GardsSampleDataSpectrum gardsSampleData, String[] menuTypes, boolean AllUsers, boolean CollectStopB, boolean AcqStartB, Date startDate, Date endDate, HttpServletRequest request) {
Result result = new Result();
if (Objects.isNull(startDate)){
result.error500("The start time cannot be empty");
return result;
}
String startTime = DateUtils.formatDate(startDate, "yyyy-MM-dd") + " 00:00:00";
if (Objects.isNull(endDate)) {
result.error500("The end time cannot be empty");
return result;
}
String endTime = DateUtils.formatDate(endDate, "yyyy-MM-dd") + " 23:59:59";
List<String> menuTypeList = Arrays.asList(menuTypes);
if (CollectionUtils.isEmpty(menuTypeList)){
result.error500("The spectrum type cannot be empty");
return result;
}
List<String> stationTypes = sysDictService.findStationType(menuTypeList);
if (CollectionUtils.isEmpty(stationTypes)) {
result.error500("Please add the station type corresponding to the current system type in the data dictionary");
return result;
}
List<String> userStations = new LinkedList<>();
if (Objects.nonNull(AllUsers) && !AllUsers){
String userName = JwtUtil.getUserNameByToken(request);
if (StringUtils.isBlank(userName)){
result.error500("Description Failed to obtain the current login user information");
return result;
}
userStations = userTaskUtil.findUserStation(userName);
}
//声明分页page
Page<GardsSampleDataSpectrum> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
Page<GardsSampleDataSpectrum> sampleDataPage = spectrumAnalysisMapper.loadSampleData(page, gardsSampleData, stationTypes, CollectStopB, AcqStartB, startTime, endTime, userStations, AllUsers, queryRequest.getField(), queryRequest.getOrder());
result.setSuccess(true);
result.setResult(sampleDataPage);
return result;
}
@Override
public Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request) {
Result result = new Result();