下拉框查询台站编码,探测器编码接口修改
分页查询样品数据接口修改
This commit is contained in:
parent
c1a9a43f91
commit
81592abac1
|
@ -166,7 +166,7 @@ public class PHDFileUtil {
|
||||||
List<List<Double>> gammaEnergyList = new LinkedList<>();
|
List<List<Double>> gammaEnergyList = new LinkedList<>();
|
||||||
List<Double> gCentroidChannel = struct.g_centroid_channel;
|
List<Double> gCentroidChannel = struct.g_centroid_channel;
|
||||||
List<Double> gEnergy = struct.g_energy;
|
List<Double> gEnergy = struct.g_energy;
|
||||||
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
|
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
|
||||||
List<Double> gchannels = new ArrayList<>();
|
List<Double> gchannels = new ArrayList<>();
|
||||||
for (int i=0; i<numGChannel; i++){
|
for (int i=0; i<numGChannel; i++){
|
||||||
gchannels.clear();
|
gchannels.clear();
|
||||||
|
@ -209,9 +209,9 @@ public class PHDFileUtil {
|
||||||
List<List<Double>> betaEnergyList = new LinkedList<>();
|
List<List<Double>> betaEnergyList = new LinkedList<>();
|
||||||
List<Double> bChannel = struct.b_channel;
|
List<Double> bChannel = struct.b_channel;
|
||||||
List<Double> bElectronEnergy = struct.b_electron_energy;
|
List<Double> bElectronEnergy = struct.b_electron_energy;
|
||||||
List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(bElectronEnergy, bChannel);
|
List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
|
||||||
List<Double> bchannels = new ArrayList<>();
|
List<Double> bchannels = new ArrayList<>();
|
||||||
for (int i=0; i<numGChannel; i++){
|
for (int i=0; i<numBChannel; i++){
|
||||||
bchannels.clear();
|
bchannels.clear();
|
||||||
bchannels.add(Double.valueOf(i));
|
bchannels.add(Double.valueOf(i));
|
||||||
List<Double> betaEnergy = EnergySpectrumHandler.GetFileFittingData(bchannels, betaParam);
|
List<Double> betaEnergy = EnergySpectrumHandler.GetFileFittingData(bchannels, betaParam);
|
||||||
|
@ -222,8 +222,8 @@ public class PHDFileUtil {
|
||||||
map.put("XeData", xeDataList);
|
map.put("XeData", xeDataList);
|
||||||
//计算边界值
|
//计算边界值
|
||||||
CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam();
|
CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam();
|
||||||
calcBgBoundaryParam.g_e_cal = gammaParam;
|
calcBgBoundaryParam.g_e_cal = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
|
||||||
calcBgBoundaryParam.b_e_cal = betaParam;
|
calcBgBoundaryParam.b_e_cal = EnergySpectrumHandler.GetFileFittingPara(bElectronEnergy, bChannel);
|
||||||
calcBgBoundaryParam.b_energy = struct.b_electron_energy;
|
calcBgBoundaryParam.b_energy = struct.b_electron_energy;
|
||||||
calcBgBoundaryParam.b_channel = struct.b_channel;
|
calcBgBoundaryParam.b_channel = struct.b_channel;
|
||||||
calcBgBoundaryParam.g_channel = struct.g_centroid_channel;
|
calcBgBoundaryParam.g_channel = struct.g_centroid_channel;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.springframework.stereotype.Component;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class UserTaskUtil {
|
public class UserTaskUtil {
|
||||||
|
@ -37,5 +38,16 @@ public class UserTaskUtil {
|
||||||
return flag;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,15 +24,15 @@ public class SpectrumAnalysesController {
|
||||||
|
|
||||||
@GetMapping("getDBSearchList")
|
@GetMapping("getDBSearchList")
|
||||||
@ApiOperation(value = "查询查询条件数据接口", notes = "查询查询条件数据接口")
|
@ApiOperation(value = "查询查询条件数据接口", notes = "查询查询条件数据接口")
|
||||||
public Result getDBSearchList(String[] menuTypes){
|
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String dbName, String[] menuTypes){
|
||||||
return spectrumAnalysisService.getDBSearchList(menuTypes);
|
return spectrumAnalysisService.getDBSearchList(request, AllUsers, dbName, menuTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("getDBSpectrumList")
|
@GetMapping("getDBSpectrumList")
|
||||||
@ApiOperation(value = "获取数据库中交互分析基础数据", notes = "获取数据库中交互分析基础数据")
|
@ApiOperation(value = "获取数据库中交互分析基础数据", notes = "获取数据库中交互分析基础数据")
|
||||||
public Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleData gardsSampleData, String dbName, String[] menuTypes,boolean CollectStop, boolean AcqStart,
|
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) {
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate, HttpServletRequest request) {
|
||||||
return spectrumAnalysisService.getDBSpectrumList(queryRequest, gardsSampleData, dbName, menuTypes, CollectStop, AcqStart, startDate, endDate);
|
return spectrumAnalysisService.getDBSpectrumList(queryRequest, gardsSampleData, dbName, menuTypes, AllUsers, CollectStop, AcqStart, startDate, endDate, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("getDBSpectrumChart")
|
@GetMapping("getDBSpectrumChart")
|
||||||
|
@ -95,4 +95,21 @@ public class SpectrumAnalysesController {
|
||||||
return spectrumAnalysisService.viewRLR(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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import java.io.Serializable;
|
||||||
@Data
|
@Data
|
||||||
public class SeriseData implements Serializable {
|
public class SeriseData implements Serializable {
|
||||||
|
|
||||||
private int x;
|
private double x;
|
||||||
|
|
||||||
private long y;
|
private double y;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,9 @@ import java.util.List;
|
||||||
|
|
||||||
public interface SpectrumAnalysisMapper {
|
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);
|
SpectrumFileRecord getDBSpectrumFilePath(String dbName, Integer sampleId);
|
||||||
|
|
||||||
|
@ -32,4 +34,6 @@ public interface SpectrumAnalysisMapper {
|
||||||
|
|
||||||
String viewRRR(@Param(value = "sampleId") Integer sampleId);
|
String viewRRR(@Param(value = "sampleId") Integer sampleId);
|
||||||
|
|
||||||
|
GardsSampleData getSampleData(@Param(value = "sampleId") Integer sampleId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,38 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!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">
|
<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 id="getDBSpectrumList" resultType="org.jeecg.modules.base.entity.GardsSampleData">
|
||||||
select c.sample_id,
|
select c.sample_id,
|
||||||
b.station_code stationName,
|
b.station_code stationName,
|
||||||
|
@ -58,9 +90,17 @@
|
||||||
<if test=" AcqStart == true ">
|
<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')
|
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>
|
||||||
<!--<if test=" ">
|
<if test="AllUsers == false">
|
||||||
and b.station_code in (%1)
|
<if test=" userStations.size == 0 and userStations != null ">
|
||||||
</if>-->
|
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>
|
</where>
|
||||||
ORDER BY c.collect_stop DESC
|
ORDER BY c.collect_stop DESC
|
||||||
</select>
|
</select>
|
||||||
|
@ -120,4 +160,33 @@
|
||||||
SELECT REPORT_PAHT FROM RNMAN.GARDS_ANALYSES where SAMPLE_ID = #{sampleId}
|
SELECT REPORT_PAHT FROM RNMAN.GARDS_ANALYSES where SAMPLE_ID = #{sampleId}
|
||||||
</select>
|
</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>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -10,9 +10,9 @@ import java.util.Date;
|
||||||
|
|
||||||
public interface ISpectrumAnalysisService {
|
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 getDBSpectrumChart(String dbName, Integer sampleId);
|
||||||
|
|
||||||
|
@ -34,4 +34,10 @@ public interface ISpectrumAnalysisService {
|
||||||
|
|
||||||
Result viewRLR(Integer sampleId);
|
Result viewRLR(Integer sampleId);
|
||||||
|
|
||||||
|
Result viewGammaDetectorCalibration(Integer sampleId);
|
||||||
|
|
||||||
|
Result viewBetaDetectorCalibration(Integer sampleId);
|
||||||
|
|
||||||
|
Result viewExtrapolation(Integer sampleId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,4 +18,7 @@ public interface IUserTaskService {
|
||||||
@RequestMapping("/sysTask/findUserTaskStations")
|
@RequestMapping("/sysTask/findUserTaskStations")
|
||||||
List<String> findUserTaskStations(@RequestParam String userId, @RequestParam String nowDate);
|
List<String> findUserTaskStations(@RequestParam String userId, @RequestParam String nowDate);
|
||||||
|
|
||||||
|
@RequestMapping("/sysTask/findUserStations")
|
||||||
|
List<String> findUserStations(@RequestParam String userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.net.ftp.FTPClient;
|
import org.apache.commons.net.ftp.FTPClient;
|
||||||
import org.apache.commons.net.ftp.FTPFile;
|
import org.apache.commons.net.ftp.FTPFile;
|
||||||
|
import org.apache.xmlbeans.impl.xb.xsdschema.All;
|
||||||
import org.jeecg.common.api.QueryRequest;
|
import org.jeecg.common.api.QueryRequest;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||||
|
@ -65,7 +66,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
private PHDFileUtil phdFileUtil;
|
private PHDFileUtil phdFileUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result getDBSearchList(String[] menuTypes) {
|
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String dbName, String[] menuTypes) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
Map<String, List<String>> map = new HashMap<>();
|
Map<String, List<String>> map = new HashMap<>();
|
||||||
List<String> menuTypeList = Arrays.asList(menuTypes);
|
List<String> menuTypeList = Arrays.asList(menuTypes);
|
||||||
|
@ -79,31 +80,41 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
result.error500("请先补充数据字典中当前系统类型对应的台站类型信息");
|
result.error500("请先补充数据字典中当前系统类型对应的台站类型信息");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
//查询全部台站信息
|
List<String> userStations = new LinkedList<>();
|
||||||
HashMap<String, GardsStations> stationInfoMap = (HashMap<String, GardsStations>) redisUtil.get("stationInfoMap");
|
//如果没有勾选AllUsers
|
||||||
//根据台站类型获取台站信息
|
if (Objects.nonNull(AllUsers) && !AllUsers){
|
||||||
List<GardsStations> gardsStations = stationInfoMap.values().stream().filter(item -> stationTypes.contains(item.getType())).sorted(Comparator.comparing(GardsStations::getStationId)).collect(Collectors.toList());
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
if (CollectionUtils.isNotEmpty(gardsStations)){
|
if (StringUtils.isBlank(userName)){
|
||||||
|
result.error500("当前登录用户信息获取失败!");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
userStations = userTaskUtil.findUserStation(userName);
|
||||||
|
}
|
||||||
|
if (dbName.equalsIgnoreCase("auto")){
|
||||||
|
dbName = "RNAUTO.GARDS_ANALYSES";
|
||||||
|
}else if (dbName.equalsIgnoreCase("man")){
|
||||||
|
dbName = "RNMAN.GARDS_ANALYSES";
|
||||||
|
}else {
|
||||||
|
result.error500("数据库类型不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
List<GardsSampleData> sampleData = spectrumAnalysisMapper.getDBSearchList(dbName, stationTypes, userStations, AllUsers);
|
||||||
//获取台站编码
|
//获取台站编码
|
||||||
List<String> stationCodes = gardsStations.stream().map(GardsStations::getStationCode).collect(Collectors.toList());
|
List<String> stationCodes = new LinkedList<>();
|
||||||
//获取台站id
|
List<String> detectorCodes = new LinkedList<>();
|
||||||
List<Integer> stationIds = gardsStations.stream().map(GardsStations::getStationId).collect(Collectors.toList());
|
if (CollectionUtils.isNotEmpty(sampleData)){
|
||||||
//根据台站id查询对应的探测器
|
stationCodes = sampleData.stream().map(GardsSampleData::getStationName).distinct().collect(Collectors.toList());
|
||||||
LambdaQueryWrapper<GardsDetectors> queryWrapper = new LambdaQueryWrapper<>();
|
detectorCodes = sampleData.stream().map(GardsSampleData::getDetectorsName).distinct().collect(Collectors.toList());
|
||||||
queryWrapper.in(GardsDetectors::getStationId, stationIds);
|
}
|
||||||
queryWrapper.orderByAsc(GardsDetectors::getDetectorId);
|
|
||||||
List<GardsDetectors> gardsDetectors = gardsDetectorsSpectrumMapper.selectList(queryWrapper);
|
|
||||||
List<String> detectorCodes = gardsDetectors.stream().map(GardsDetectors::getDetectorCode).collect(Collectors.toList());
|
|
||||||
map.put("stationCode", stationCodes);
|
map.put("stationCode", stationCodes);
|
||||||
map.put("detectorCode", detectorCodes);
|
map.put("detectorCode", detectorCodes);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(map);
|
result.setResult(map);
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleData gardsSampleData, String dbName, String[] menuTypes, boolean CollectStop, boolean AcqStart, Date startDate, Date endDate) {
|
public Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleData gardsSampleData, String dbName, String[] menuTypes, boolean AllUsers, boolean CollectStop, boolean AcqStart, Date startDate, Date endDate, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
if (Objects.isNull(startDate)){
|
if (Objects.isNull(startDate)){
|
||||||
result.error500("开始时间不能为空");
|
result.error500("开始时间不能为空");
|
||||||
|
@ -138,12 +149,19 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
result.error500("数据库类型不存在");
|
result.error500("数据库类型不存在");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
List<String> userStations = new LinkedList<>();
|
||||||
|
if (Objects.nonNull(AllUsers) && !AllUsers){
|
||||||
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
|
if (StringUtils.isBlank(userName)){
|
||||||
|
result.error500("当前登录用户信息获取失败!");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
userStations = userTaskUtil.findUserStation(userName);
|
||||||
|
}
|
||||||
//声明分页page
|
//声明分页page
|
||||||
Page<GardsSampleData> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
|
Page<GardsSampleData> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
|
||||||
Page<GardsSampleData> sampleDataPage = spectrumAnalysisMapper.getDBSpectrumList(page, gardsSampleData, dbName, stationTypes, CollectStop, AcqStart, startTime, endTime);
|
Page<GardsSampleData> sampleDataPage = spectrumAnalysisMapper.getDBSpectrumList(page, gardsSampleData, dbName, stationTypes, CollectStop, AcqStart, startTime, endTime, userStations, AllUsers);
|
||||||
sampleDataPage.getRecords().stream().forEach(item->{
|
sampleDataPage.getRecords().stream().forEach(item->{item.setDbName(tempDBName);});
|
||||||
item.setDbName(tempDBName);
|
|
||||||
});
|
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(sampleDataPage);
|
result.setResult(sampleDataPage);
|
||||||
return result;
|
return result;
|
||||||
|
@ -278,7 +296,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
if (Objects.isNull(ftpClient)){
|
if (Objects.isNull(ftpClient)){
|
||||||
throw new RuntimeException("ftp连接失败");
|
result.error500("ftp连接失败");
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
//切换被动模式
|
//切换被动模式
|
||||||
|
@ -291,6 +310,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
ftpClient.changeWorkingDirectory(pathName);
|
ftpClient.changeWorkingDirectory(pathName);
|
||||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(ftpFiles)){
|
||||||
|
result.error500("ftp下对应文件不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
FTPFile ftpFile = ftpFiles.get(0);
|
FTPFile ftpFile = ftpFiles.get(0);
|
||||||
if (Objects.nonNull(ftpFile)){
|
if (Objects.nonNull(ftpFile)){
|
||||||
InputStream inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
InputStream inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
||||||
|
@ -411,6 +434,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
ftpClient.changeWorkingDirectory(pathName);
|
ftpClient.changeWorkingDirectory(pathName);
|
||||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(ftpFiles)){
|
||||||
|
throw new RuntimeException("ftp下对应的报告文件不存在");
|
||||||
|
}
|
||||||
FTPFile ftpFile = ftpFiles.get(0);
|
FTPFile ftpFile = ftpFiles.get(0);
|
||||||
if (Objects.nonNull(ftpFile)){
|
if (Objects.nonNull(ftpFile)){
|
||||||
InputStream inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
InputStream inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
||||||
|
@ -466,6 +492,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
ftpClient.changeWorkingDirectory(pathName);
|
ftpClient.changeWorkingDirectory(pathName);
|
||||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(ftpFiles)){
|
||||||
|
throw new RuntimeException("ftp下对应的报告文件不存在");
|
||||||
|
}
|
||||||
FTPFile ftpFile = ftpFiles.get(0);
|
FTPFile ftpFile = ftpFiles.get(0);
|
||||||
if (Objects.nonNull(ftpFile)){
|
if (Objects.nonNull(ftpFile)){
|
||||||
InputStream inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
InputStream inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
||||||
|
@ -539,7 +568,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
if (Objects.isNull(ftpClient)){
|
if (Objects.isNull(ftpClient)){
|
||||||
throw new RuntimeException("ftp连接失败");
|
result.error500("ftp连接失败");
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
//切换被动模式
|
//切换被动模式
|
||||||
|
@ -552,6 +582,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
ftpClient.changeWorkingDirectory(pathName);
|
ftpClient.changeWorkingDirectory(pathName);
|
||||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
ftpFiles=ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(ftpFiles)){
|
||||||
|
result.error500("ftp下对应的文件不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
FTPFile ftpFile = ftpFiles.get(0);
|
FTPFile ftpFile = ftpFiles.get(0);
|
||||||
if (Objects.nonNull(ftpFile)){
|
if (Objects.nonNull(ftpFile)){
|
||||||
InputStream inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
InputStream inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
||||||
|
@ -646,15 +680,19 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
||||||
//查询数据库中结果的Xe数据
|
//查询数据库中结果的Xe数据
|
||||||
List<GardsXeResults> xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId);
|
List<GardsXeResults> xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId);
|
||||||
|
//加载dll工具库
|
||||||
|
System.loadLibrary("ReadPHDFile");
|
||||||
if (Objects.nonNull(dbSpectrumFilePath)){
|
if (Objects.nonNull(dbSpectrumFilePath)){
|
||||||
try {
|
|
||||||
String bkgdMeasurementID = "";
|
String bkgdMeasurementID = "";
|
||||||
String gasBkgdMeasurementID = "";
|
String gasBkgdMeasurementID = "";
|
||||||
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
|
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
if (Objects.isNull(ftpClient)){
|
if (Objects.isNull(ftpClient)){
|
||||||
throw new RuntimeException("ftp连接失败");
|
result.error500("ftp连接失败");
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
//切换被动模式
|
//切换被动模式
|
||||||
ftpClient.enterLocalPassiveMode();
|
ftpClient.enterLocalPassiveMode();
|
||||||
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
||||||
|
@ -668,6 +706,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
ftpClient.changeWorkingDirectory(samplePathName);
|
ftpClient.changeWorkingDirectory(samplePathName);
|
||||||
List<FTPFile> sampleFtpFiles = Arrays.asList(ftpClient.listFiles());
|
List<FTPFile> sampleFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
sampleFtpFiles=sampleFtpFiles.stream().filter(item -> item.getName().equals(sampleFileName)).collect(Collectors.toList());
|
sampleFtpFiles=sampleFtpFiles.stream().filter(item -> item.getName().equals(sampleFileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(sampleFtpFiles)){
|
||||||
|
result.error500("ftp下对应的SAMPLE文件不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
FTPFile sampleFtpFile = sampleFtpFiles.get(0);
|
FTPFile sampleFtpFile = sampleFtpFiles.get(0);
|
||||||
if (Objects.nonNull(sampleFtpFile)){
|
if (Objects.nonNull(sampleFtpFile)){
|
||||||
InputStream inputStream = ftpClient.retrieveFileStream(sampleFtpFile.getName());
|
InputStream inputStream = ftpClient.retrieveFileStream(sampleFtpFile.getName());
|
||||||
|
@ -675,8 +717,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
File file = File.createTempFile("tmp", null);
|
File file = File.createTempFile("tmp", null);
|
||||||
//将ftp文件的输入流复制给临时文件
|
//将ftp文件的输入流复制给临时文件
|
||||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||||
//加载dll工具库
|
|
||||||
System.loadLibrary("ReadPHDFile");
|
|
||||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||||
bkgdMeasurementID = struct.detector_bk_measurement_id;
|
bkgdMeasurementID = struct.detector_bk_measurement_id;
|
||||||
gasBkgdMeasurementID = struct.gas_bk_measurement_id;
|
gasBkgdMeasurementID = struct.gas_bk_measurement_id;
|
||||||
|
@ -707,14 +747,28 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
if (Objects.nonNull(inputStream)){
|
if (Objects.nonNull(inputStream)){
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (Objects.nonNull(ftpClient)){
|
||||||
ftpClient.disconnect();
|
ftpClient.disconnect();
|
||||||
}
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())){
|
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())){
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
if (Objects.isNull(ftpClient)){
|
if (Objects.isNull(ftpClient)){
|
||||||
throw new RuntimeException("ftp连接失败");
|
result.error500("ftp连接失败");
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
//切换被动模式
|
//切换被动模式
|
||||||
ftpClient.enterLocalPassiveMode();
|
ftpClient.enterLocalPassiveMode();
|
||||||
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
||||||
|
@ -728,6 +782,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
ftpClient.changeWorkingDirectory(gasBgPathName);
|
ftpClient.changeWorkingDirectory(gasBgPathName);
|
||||||
List<FTPFile> gasBgFtpFiles = Arrays.asList(ftpClient.listFiles());
|
List<FTPFile> gasBgFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
gasBgFtpFiles=gasBgFtpFiles.stream().filter(item -> item.getName().equals(gasBgFileName)).collect(Collectors.toList());
|
gasBgFtpFiles=gasBgFtpFiles.stream().filter(item -> item.getName().equals(gasBgFileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(gasBgFtpFiles)){
|
||||||
|
result.error500("ftp下对应的GasBg文件不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
FTPFile gasBgFtpFile = gasBgFtpFiles.get(0);
|
FTPFile gasBgFtpFile = gasBgFtpFiles.get(0);
|
||||||
if (Objects.nonNull(gasBgFtpFile)){
|
if (Objects.nonNull(gasBgFtpFile)){
|
||||||
InputStream inputStream = ftpClient.retrieveFileStream(gasBgFtpFile.getName());
|
InputStream inputStream = ftpClient.retrieveFileStream(gasBgFtpFile.getName());
|
||||||
|
@ -735,8 +793,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
File file = File.createTempFile("tmp", null);
|
File file = File.createTempFile("tmp", null);
|
||||||
//将ftp文件的输入流复制给临时文件
|
//将ftp文件的输入流复制给临时文件
|
||||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||||
//加载dll工具库
|
|
||||||
System.loadLibrary("ReadPHDFile");
|
|
||||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||||
String measurementID = struct.measurement_id;
|
String measurementID = struct.measurement_id;
|
||||||
if (measurementID.equals(gasBkgdMeasurementID)){
|
if (measurementID.equals(gasBkgdMeasurementID)){
|
||||||
|
@ -747,14 +803,26 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
if (Objects.nonNull(inputStream)){
|
if (Objects.nonNull(inputStream)){
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (Objects.nonNull(ftpClient)){
|
||||||
ftpClient.disconnect();
|
ftpClient.disconnect();
|
||||||
}
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())){
|
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())){
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
if (Objects.isNull(ftpClient)){
|
if (Objects.isNull(ftpClient)){
|
||||||
throw new RuntimeException("ftp连接失败");
|
result.error500("ftp连接失败");
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
//切换被动模式
|
//切换被动模式
|
||||||
ftpClient.enterLocalPassiveMode();
|
ftpClient.enterLocalPassiveMode();
|
||||||
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
||||||
|
@ -768,6 +836,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
ftpClient.changeWorkingDirectory(detBgPathName);
|
ftpClient.changeWorkingDirectory(detBgPathName);
|
||||||
List<FTPFile> detBgFtpFiles = Arrays.asList(ftpClient.listFiles());
|
List<FTPFile> detBgFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
detBgFtpFiles=detBgFtpFiles.stream().filter(item -> item.getName().equals(detBgFileName)).collect(Collectors.toList());
|
detBgFtpFiles=detBgFtpFiles.stream().filter(item -> item.getName().equals(detBgFileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(detBgFtpFiles)){
|
||||||
|
result.error500("ftp下对应的DetBg文件不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
FTPFile detBgFtpFile = detBgFtpFiles.get(0);
|
FTPFile detBgFtpFile = detBgFtpFiles.get(0);
|
||||||
if (Objects.nonNull(detBgFtpFile)){
|
if (Objects.nonNull(detBgFtpFile)){
|
||||||
InputStream inputStream = ftpClient.retrieveFileStream(detBgFtpFile.getName());
|
InputStream inputStream = ftpClient.retrieveFileStream(detBgFtpFile.getName());
|
||||||
|
@ -775,8 +847,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
File file = File.createTempFile("tmp", null);
|
File file = File.createTempFile("tmp", null);
|
||||||
//将ftp文件的输入流复制给临时文件
|
//将ftp文件的输入流复制给临时文件
|
||||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||||
//加载dll工具库
|
|
||||||
System.loadLibrary("ReadPHDFile");
|
|
||||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||||
String measurementID = struct.measurement_id;
|
String measurementID = struct.measurement_id;
|
||||||
if (measurementID.equals(bkgdMeasurementID)){
|
if (measurementID.equals(bkgdMeasurementID)){
|
||||||
|
@ -787,8 +857,18 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
if (Objects.nonNull(inputStream)){
|
if (Objects.nonNull(inputStream)){
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (Objects.nonNull(ftpClient)){
|
||||||
ftpClient.disconnect();
|
ftpClient.disconnect();
|
||||||
}
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(xeDataList)){
|
if (CollectionUtils.isNotEmpty(xeDataList)){
|
||||||
List<GardsXeResults> xeData = xeDataList.stream().filter(item -> item.getNuclideName().equals("Xe133")).collect(Collectors.toList());
|
List<GardsXeResults> xeData = xeDataList.stream().filter(item -> item.getNuclideName().equals("Xe133")).collect(Collectors.toList());
|
||||||
|
@ -800,11 +880,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
qcResult.setXe133MDCStatus("Failed");
|
qcResult.setXe133MDCStatus("Failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(qcResult);
|
result.setResult(qcResult);
|
||||||
|
@ -818,7 +893,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
|
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
if (Objects.isNull(ftpClient)){
|
if (Objects.isNull(ftpClient)){
|
||||||
throw new RuntimeException("ftp连接失败");
|
result.error500("ftp连接失败");
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
//查询数据库中结果的Xe数据
|
//查询数据库中结果的Xe数据
|
||||||
List<GardsXeResults> xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId);
|
List<GardsXeResults> xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId);
|
||||||
|
@ -836,6 +912,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
ftpClient.changeWorkingDirectory(samplePathName);
|
ftpClient.changeWorkingDirectory(samplePathName);
|
||||||
List<FTPFile> sampleFtpFiles = Arrays.asList(ftpClient.listFiles());
|
List<FTPFile> sampleFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
sampleFtpFiles=sampleFtpFiles.stream().filter(item -> item.getName().equals(sampleFileName)).collect(Collectors.toList());
|
sampleFtpFiles=sampleFtpFiles.stream().filter(item -> item.getName().equals(sampleFileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(sampleFtpFiles)){
|
||||||
|
result.error500("ftp下对应的SAMPLE文件不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
FTPFile sampleFtpFile = sampleFtpFiles.get(0);
|
FTPFile sampleFtpFile = sampleFtpFiles.get(0);
|
||||||
if (Objects.nonNull(sampleFtpFile)){
|
if (Objects.nonNull(sampleFtpFile)){
|
||||||
InputStream inputStream = ftpClient.retrieveFileStream(sampleFtpFile.getName());
|
InputStream inputStream = ftpClient.retrieveFileStream(sampleFtpFile.getName());
|
||||||
|
@ -907,4 +987,401 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result viewGammaDetectorCalibration(Integer sampleId) {
|
||||||
|
Result result = new Result();
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
GardsSampleData sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
|
||||||
|
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
|
||||||
|
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
|
||||||
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
|
if (Objects.isNull(ftpClient)){
|
||||||
|
result.error500("ftp连接失败");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (StringUtils.isNotBlank(dbQcFilePath)){
|
||||||
|
String qcPathName = dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
|
||||||
|
String qcFileName = dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||||
|
qcPathName=StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + qcPathName;
|
||||||
|
ftpClient.changeWorkingDirectory(qcPathName);
|
||||||
|
List<FTPFile> qcFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
|
qcFtpFiles=qcFtpFiles.stream().filter(item -> item.getName().equals(qcFileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(qcFtpFiles)){
|
||||||
|
result.error500("ftp下对应的QC文件不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
FTPFile qcFtpFile = qcFtpFiles.get(0);
|
||||||
|
if (Objects.nonNull(qcFtpFile)){
|
||||||
|
InputStream inputStream = ftpClient.retrieveFileStream(qcFtpFile.getName());
|
||||||
|
//声明一个临时文件
|
||||||
|
File file = File.createTempFile("tmp", null);
|
||||||
|
//将ftp文件的输入流复制给临时文件
|
||||||
|
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||||
|
//加载dll工具库
|
||||||
|
System.loadLibrary("ReadPHDFile");
|
||||||
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||||
|
//读取Gamma Detector Calibration所需要的参数
|
||||||
|
long numGChannel = struct.num_g_channel;
|
||||||
|
List<Double> gCentroidChannel = struct.g_centroid_channel;
|
||||||
|
List<Double> gEnergy = struct.g_energy;
|
||||||
|
int gRecordCount = struct.g_record_count;
|
||||||
|
List<Long> gCounts = struct.g_counts;
|
||||||
|
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
|
||||||
|
//计算Calibration Parameter Of Gamma Detector
|
||||||
|
List<SeriseData> oldScatterSeries = new LinkedList<>();
|
||||||
|
for (int i=0; i<gRecordCount; i++) {
|
||||||
|
SeriseData temp = new SeriseData();
|
||||||
|
double p1 = gCentroidChannel.get(i);
|
||||||
|
double p2 = gEnergy.get(i);
|
||||||
|
temp.setX(p1);
|
||||||
|
temp.setY(p2);
|
||||||
|
oldScatterSeries.add(temp);
|
||||||
|
}
|
||||||
|
List<Double> xs = new LinkedList<>();
|
||||||
|
List<Double> ys = new LinkedList<>();
|
||||||
|
for (int i=0; i< oldScatterSeries.size(); i++){
|
||||||
|
xs.add(oldScatterSeries.get(i).getX());
|
||||||
|
ys.add(oldScatterSeries.get(i).getY());
|
||||||
|
}
|
||||||
|
//C to E
|
||||||
|
List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys);
|
||||||
|
List<String> fittingParaStr = new LinkedList<>();
|
||||||
|
for (Double para:fittingPara) {
|
||||||
|
fittingParaStr.add(String.valueOf(para));
|
||||||
|
}
|
||||||
|
map.put("CToE", fittingParaStr);
|
||||||
|
//E to C
|
||||||
|
List<Double> fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs);
|
||||||
|
List<String> fittingParaToUiStr = new LinkedList<>();
|
||||||
|
for (Double para:fittingParaToUi) {
|
||||||
|
fittingParaToUiStr.add(String.valueOf(para));
|
||||||
|
}
|
||||||
|
map.put("EToC", fittingParaToUiStr);
|
||||||
|
//Figure of Gamma Detector Calibration
|
||||||
|
List<Double> gchannels = new ArrayList<>();
|
||||||
|
List<List<Double>> gammaEnergyList = new LinkedList<>();
|
||||||
|
for (int i=0; i<numGChannel; i++){
|
||||||
|
gchannels.clear();
|
||||||
|
gchannels.add(Double.valueOf(i));
|
||||||
|
List<Double> gammaEnergy = EnergySpectrumHandler.GetFileFittingData(gchannels, gammaParam);
|
||||||
|
gammaEnergyList.add(gammaEnergy);
|
||||||
|
}
|
||||||
|
map.put("gammaEnergy", gammaEnergyList);
|
||||||
|
//Gamma Spectrum: QC
|
||||||
|
List<SeriseData> seriseDataList = new LinkedList<>();
|
||||||
|
long min =0;
|
||||||
|
double max =0;
|
||||||
|
for ( int i=1; i<numGChannel; i++ ) {
|
||||||
|
long count = gCounts.get(i);
|
||||||
|
SeriseData temp = new SeriseData();
|
||||||
|
temp.setX(i);
|
||||||
|
temp.setY(count);
|
||||||
|
seriseDataList.add(temp);
|
||||||
|
if (count<min){
|
||||||
|
min = count;
|
||||||
|
}
|
||||||
|
if (count>max){
|
||||||
|
max = count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (max<10) {
|
||||||
|
max += max*0.5;
|
||||||
|
} else if (max<50) {
|
||||||
|
max += max*0.2;
|
||||||
|
} else if (max<100) {
|
||||||
|
max += max*0.1;
|
||||||
|
} else {
|
||||||
|
max += max*0.05;
|
||||||
|
}
|
||||||
|
map.put("min", min);
|
||||||
|
map.put("max", max);
|
||||||
|
map.put("gammaSpectrum", seriseDataList);
|
||||||
|
if (Objects.nonNull(inputStream)){
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (Objects.nonNull(ftpClient)){
|
||||||
|
ftpClient.disconnect();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.setSuccess(true);
|
||||||
|
result.setResult(map);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result viewBetaDetectorCalibration(Integer sampleId) {
|
||||||
|
Result result = new Result();
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
GardsSampleData sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
|
||||||
|
String collectStartStr = DateUtils.formatDate(sampleData.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
|
||||||
|
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(sampleData.getSiteDetCode(), collectStartStr);
|
||||||
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
|
if (Objects.isNull(ftpClient)){
|
||||||
|
result.error500("ftp连接失败");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
//切换被动模式
|
||||||
|
ftpClient.enterLocalPassiveMode();
|
||||||
|
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
||||||
|
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
||||||
|
ftpClient.setControlEncoding("UTF-8");
|
||||||
|
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||||
|
if (StringUtils.isNotBlank(dbQcFilePath)){
|
||||||
|
String qcPathName = dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
|
||||||
|
String qcFileName = dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||||
|
qcPathName=StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + qcPathName;
|
||||||
|
ftpClient.changeWorkingDirectory(qcPathName);
|
||||||
|
List<FTPFile> qcFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
|
qcFtpFiles=qcFtpFiles.stream().filter(item -> item.getName().equals(qcFileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(qcFtpFiles)){
|
||||||
|
result.error500("ftp下对应的QC文件不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
FTPFile qcFtpFile = qcFtpFiles.get(0);
|
||||||
|
if (Objects.nonNull(qcFtpFile)){
|
||||||
|
InputStream inputStream = ftpClient.retrieveFileStream(qcFtpFile.getName());
|
||||||
|
//声明一个临时文件
|
||||||
|
File file = File.createTempFile("tmp", null);
|
||||||
|
//将ftp文件的输入流复制给临时文件
|
||||||
|
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||||
|
//加载dll工具库
|
||||||
|
System.loadLibrary("ReadPHDFile");
|
||||||
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||||
|
//Figure of Beta Detector Calibration
|
||||||
|
long numBChannel = struct.num_b_channel;
|
||||||
|
List<List<Double>> betaEnergyList = new LinkedList<>();
|
||||||
|
List<Double> bChannel = struct.b_channel;
|
||||||
|
List<Double> bElectronEnergy = struct.b_electron_energy;
|
||||||
|
List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
|
||||||
|
List<Double> bchannels = new ArrayList<>();
|
||||||
|
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("betaEnergy", betaEnergyList);
|
||||||
|
//gamma Energy
|
||||||
|
long numGChannel = struct.num_g_channel;
|
||||||
|
List<Double> gCentroidChannel = struct.g_centroid_channel;
|
||||||
|
List<Double> gEnergy = struct.g_energy;
|
||||||
|
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
|
||||||
|
List<Double> gchannels = new ArrayList<>();
|
||||||
|
List<List<Double>> gammaEnergyList = new LinkedList<>();
|
||||||
|
for (int i=0; i<numGChannel; i++){
|
||||||
|
gchannels.clear();
|
||||||
|
gchannels.add(Double.valueOf(i));
|
||||||
|
List<Double> gammaEnergy = EnergySpectrumHandler.GetFileFittingData(gchannels, gammaParam);
|
||||||
|
gammaEnergyList.add(gammaEnergy);
|
||||||
|
}
|
||||||
|
map.put("gammaEnergy", gammaEnergyList);
|
||||||
|
//Beta-Gamma Spectrum: QC
|
||||||
|
long bChannels = struct.b_channels;
|
||||||
|
long gChannels = struct.g_channels;
|
||||||
|
List<Long> hCounts = struct.h_counts;
|
||||||
|
List<HistogramData> histogramDataList = new LinkedList<>();
|
||||||
|
Map<String, List<Long>> countMap = new HashMap<>();
|
||||||
|
for (int column=0; column<bChannels; column++) {
|
||||||
|
List<Long> counts = new LinkedList<>();
|
||||||
|
for (int row=0; row<gChannels; row++) {
|
||||||
|
Long index = column * gChannels + row;
|
||||||
|
long count = hCounts.get(index.intValue());
|
||||||
|
if (count>0) {
|
||||||
|
HistogramData histogramData = new HistogramData();
|
||||||
|
histogramData.setG(row);
|
||||||
|
histogramData.setB(column);
|
||||||
|
histogramDataList.add(histogramData);
|
||||||
|
}
|
||||||
|
counts.add(count);
|
||||||
|
}
|
||||||
|
countMap.put(String.valueOf(column), counts);
|
||||||
|
}
|
||||||
|
map.put("histogramData", histogramDataList);
|
||||||
|
//Gamma-gated Beta Spectrum: QC
|
||||||
|
map.put("gammaGatedBetaSpectrum", countMap);
|
||||||
|
//计算Calibration Parameter Of Gamma Detector
|
||||||
|
List<Double> bChannelList = struct.b_channel;
|
||||||
|
List<Double> bEnergy = struct.b_electron_energy;
|
||||||
|
int bRecordCount = struct.b_record_count;
|
||||||
|
List<SeriseData> oldScatterSeries = new LinkedList<>();
|
||||||
|
for (int i=0; i<bRecordCount; i++) {
|
||||||
|
SeriseData temp = new SeriseData();
|
||||||
|
double p1 = bChannelList.get(i);
|
||||||
|
double p2 = bEnergy.get(i);
|
||||||
|
temp.setX(p1);
|
||||||
|
temp.setY(p2);
|
||||||
|
oldScatterSeries.add(temp);
|
||||||
|
}
|
||||||
|
List<Double> xs = new LinkedList<>();
|
||||||
|
List<Double> ys = new LinkedList<>();
|
||||||
|
for (int i=0; i< oldScatterSeries.size(); i++){
|
||||||
|
xs.add(oldScatterSeries.get(i).getX());
|
||||||
|
ys.add(oldScatterSeries.get(i).getY());
|
||||||
|
}
|
||||||
|
//C to E
|
||||||
|
List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys);
|
||||||
|
List<String> fittingParaStr = new LinkedList<>();
|
||||||
|
for (Double para:fittingPara) {
|
||||||
|
fittingParaStr.add(String.valueOf(para));
|
||||||
|
}
|
||||||
|
map.put("CToE", fittingParaStr);
|
||||||
|
//E to C
|
||||||
|
List<Double> fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs);
|
||||||
|
List<String> fittingParaToUiStr = new LinkedList<>();
|
||||||
|
for (Double para:fittingParaToUi) {
|
||||||
|
fittingParaToUiStr.add(String.valueOf(para));
|
||||||
|
}
|
||||||
|
map.put("EToC", fittingParaToUiStr);
|
||||||
|
if (Objects.nonNull(inputStream)){
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (Objects.nonNull(ftpClient)){
|
||||||
|
ftpClient.disconnect();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.setSuccess(true);
|
||||||
|
result.setResult(map);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result viewExtrapolation(Integer sampleId) {
|
||||||
|
Result result = new Result();
|
||||||
|
String dbName = "RNAUTO.GARDS_ANALYSES";
|
||||||
|
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId);
|
||||||
|
//加载dll工具库
|
||||||
|
System.loadLibrary("ReadPHDFile");
|
||||||
|
if (Objects.nonNull(dbSpectrumFilePath)){
|
||||||
|
String sampleFilePath = dbSpectrumFilePath.getSampleFilePath();
|
||||||
|
if (StringUtils.isNotBlank(sampleFilePath)){
|
||||||
|
String samplePathName = sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
|
||||||
|
String sampleFileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||||
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
|
if (Objects.isNull(ftpClient)){
|
||||||
|
result.error500("ftp连接失败");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ftpClient.enterLocalPassiveMode();
|
||||||
|
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
||||||
|
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
||||||
|
ftpClient.setControlEncoding("UTF-8");
|
||||||
|
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||||
|
samplePathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + samplePathName;
|
||||||
|
ftpClient.changeWorkingDirectory(samplePathName);
|
||||||
|
List<FTPFile> sampleFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
|
sampleFtpFiles = sampleFtpFiles.stream().filter(item-> item.getName().equals(sampleFileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(sampleFtpFiles)){
|
||||||
|
result.error500("ftp下对应的SAMPLE文件不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
FTPFile sampleFtpFile = sampleFtpFiles.get(0);
|
||||||
|
if (Objects.nonNull(sampleFtpFile)){
|
||||||
|
//获取ftp文件的输入流
|
||||||
|
InputStream inputStream = ftpClient.retrieveFileStream(sampleFtpFile.getName());
|
||||||
|
//声明一个临时文件
|
||||||
|
File file = File.createTempFile("tmp", null);
|
||||||
|
//ftp文件输入流复制给临时文件
|
||||||
|
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||||
|
//读取文件信息
|
||||||
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||||
|
|
||||||
|
String acquisitionStart = struct.acquisition_start_date + " " + struct.acquisition_start_time;
|
||||||
|
String acquisitionRealTime = String.valueOf(struct.acquisition_real_time);
|
||||||
|
String acquisitionLiveTime = String.valueOf(struct.acquisition_live_time);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (Objects.nonNull(inputStream)){
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (Objects.nonNull(ftpClient)){
|
||||||
|
ftpClient.disconnect();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String detBgFilePath = dbSpectrumFilePath.getDetBgFilePath();
|
||||||
|
if (StringUtils.isNotBlank(detBgFilePath)){
|
||||||
|
String detBgPathName = detBgFilePath.substring(0, detBgFilePath.lastIndexOf(StringPool.SLASH));
|
||||||
|
String detBgFileName = detBgFilePath.substring(detBgFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||||
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
|
if (Objects.isNull(ftpClient)){
|
||||||
|
result.error500("ftp连接失败");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ftpClient.enterLocalPassiveMode();
|
||||||
|
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
||||||
|
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
||||||
|
ftpClient.setControlEncoding("UTF-8");
|
||||||
|
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||||
|
detBgPathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + detBgPathName;
|
||||||
|
ftpClient.changeWorkingDirectory(detBgPathName);
|
||||||
|
List<FTPFile> detBgFtpFiles = Arrays.asList(ftpClient.listFiles());
|
||||||
|
detBgFtpFiles = detBgFtpFiles.stream().filter(item-> item.getName().equals(detBgFileName)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(detBgFtpFiles)){
|
||||||
|
result.error500("ftp下对应的SAMPLE文件不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
FTPFile detBgFtpFile = detBgFtpFiles.get(0);
|
||||||
|
if (Objects.nonNull(detBgFtpFile)){
|
||||||
|
//获取ftp文件的输入流
|
||||||
|
InputStream inputStream = ftpClient.retrieveFileStream(detBgFtpFile.getName());
|
||||||
|
//声明一个临时文件
|
||||||
|
File file = File.createTempFile("tmp", null);
|
||||||
|
//ftp文件输入流复制给临时文件
|
||||||
|
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||||
|
//读取文件信息
|
||||||
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||||
|
|
||||||
|
|
||||||
|
if (Objects.nonNull(inputStream)){
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (Objects.nonNull(ftpClient)){
|
||||||
|
ftpClient.disconnect();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,8 @@ public class SysDictSpectrumServiceImpl extends ServiceImpl<SysDictSpectrumMappe
|
||||||
List<String> menuTypes = new LinkedList<>();
|
List<String> menuTypes = new LinkedList<>();
|
||||||
if (menuTypeList.contains("B")) {
|
if (menuTypeList.contains("B")) {
|
||||||
menuTypes.add("Noble Gas Beta-Gamma");
|
menuTypes.add("Noble Gas Beta-Gamma");
|
||||||
}else if (menuTypeList.contains("G")) {
|
}
|
||||||
|
if (menuTypeList.contains("G")) {
|
||||||
menuTypes.add("Particulate");
|
menuTypes.add("Particulate");
|
||||||
menuTypes.add("Noble Gas HPGe");
|
menuTypes.add("Noble Gas HPGe");
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,4 +119,9 @@ public class SysTaskController {
|
||||||
return sysTaskService.findUserTaskStations(userId, nowDate);
|
return sysTaskService.findUserTaskStations(userId, nowDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("findUserStations")
|
||||||
|
public List<String> findUserStations(@RequestParam String userId){
|
||||||
|
return sysTaskService.findUserStations(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,4 +36,11 @@ public interface SysTaskMapper extends BaseMapper<SysTask> {
|
||||||
*/
|
*/
|
||||||
List<String> findUserTaskStations(String userId, String nowDate);
|
List<String> findUserTaskStations(String userId, String nowDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户值班任务台站信息
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> findUserStations(String userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,4 +38,13 @@
|
||||||
and st.scheduling_date = to_date(#{nowDate}, 'YYYY-MM-DD')
|
and st.scheduling_date = to_date(#{nowDate}, 'YYYY-MM-DD')
|
||||||
</select>
|
</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>
|
</mapper>
|
|
@ -90,4 +90,11 @@ public interface ISysTaskService extends IService<SysTask> {
|
||||||
*/
|
*/
|
||||||
List<String> findUserTaskStations(String userId, String nowDate);
|
List<String> findUserTaskStations(String userId, String nowDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前用户的排班任务台站信息
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> findUserStations(String userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -539,6 +539,11 @@ public class SysTaskServiceImpl extends ServiceImpl<SysTaskMapper, SysTask> impl
|
||||||
return this.baseMapper.findUserTaskStations(userId, 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){
|
private void addOrUpdate(List<SysTask> sysTaskList,List<SysTask> taskList){
|
||||||
//获取request
|
//获取request
|
||||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user