NameStandUtil移动到公用工具类中
修改Gamma模块下SaveToDB接口问题
This commit is contained in:
parent
bec2a892a1
commit
9bf98b819c
|
@ -4111,7 +4111,6 @@ public class GammaFileUtil {
|
|||
data1.getPointlist().add(seriseData);
|
||||
}
|
||||
datalist.add(data1);
|
||||
|
||||
if(vEnergy.size() == size) {
|
||||
ChartData data2 = new ChartData();
|
||||
data2.setName("Compare");
|
||||
|
@ -4130,4 +4129,38 @@ public class GammaFileUtil {
|
|||
return datalist;
|
||||
}
|
||||
|
||||
public List<ChartData> StripData(List<Long> m_vecCompare, List<Long> m_vCount, long m_nCount, Map<String, String> colorMap, List<Double> vEnergy, Double ratioRate) {
|
||||
List<ChartData> datalist = new LinkedList<>();
|
||||
int size = m_vecCompare.size();
|
||||
if(size == m_nCount) {
|
||||
ChartData data1 = new ChartData();
|
||||
data1.setName("Compare");
|
||||
data1.setGroup("channel");
|
||||
data1.setColor(colorMap.get("Color_Strip"));
|
||||
// type: 1 Add a Spectrum in Channel; -1 Cut a Spectrum in Channel
|
||||
for(int i=0; i<size; ++i) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(i+1);
|
||||
seriseData.setY(m_vCount.get(i) + ratioRate * m_vecCompare.get(i));
|
||||
data1.getPointlist().add(seriseData);
|
||||
}
|
||||
datalist.add(data1);
|
||||
if(vEnergy.size() == size) {
|
||||
ChartData data2 = new ChartData();
|
||||
data2.setName("Compare");
|
||||
data2.setGroup("energy");
|
||||
data2.setColor(colorMap.get("Color_Strip"));
|
||||
// type: 1 Add a Spectrum in Energy; -1 Cut a Spectrum in Energy
|
||||
for(int i=0; i<size; ++i) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(vEnergy.get(i));
|
||||
seriseData.setY(m_vCount.get(i) + ratioRate * m_vecCompare.get(i));
|
||||
data2.getPointlist().add(seriseData);
|
||||
}
|
||||
datalist.add(data2);
|
||||
}
|
||||
}
|
||||
return datalist;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,6 +43,11 @@ public class GammaController {
|
|||
return gammaService.Compare(fileName, compareFileName, request);
|
||||
}
|
||||
|
||||
@GetMapping("Strip")
|
||||
public Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request) {
|
||||
return gammaService.Strip(fileName, stripFileName, ratioRate, request);
|
||||
}
|
||||
|
||||
@GetMapping("configure")
|
||||
@ApiOperation(value = "analyze菜单下configure页面数据", notes = "analyze菜单下configure页面数据")
|
||||
public Result configure(Integer sampleId, String fileName) {
|
||||
|
|
|
@ -19,6 +19,8 @@ public interface IGammaService{
|
|||
|
||||
Result Compare(String fileName, String compareFileName, HttpServletRequest request);
|
||||
|
||||
Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request);
|
||||
|
||||
Result configure(Integer sampleId, String fileName);
|
||||
|
||||
Result Reprocessing(ConfigureData configureData, HttpServletRequest request);
|
||||
|
|
|
@ -11,6 +11,6 @@ public interface IGardsCalibrationPairsOrigSpectrumService extends IService<Gard
|
|||
|
||||
Integer saveGardsCalibrationPairsOrig(EnergySpectrumStruct sourceData, Integer sampleId, List<String> readLines);
|
||||
|
||||
boolean saveCalibrationPairsOrigGamma(PHDFile phd, Integer sampleId);
|
||||
Integer saveCalibrationPairsOrigGamma(PHDFile phd, Integer sampleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ public interface IGardsSampleAuxSpectrumService extends IService<GardsSampleAux>
|
|||
|
||||
Integer saveSampleAux(EnergySpectrumStruct sourceData, Integer sampleId, List<String> readLines);
|
||||
|
||||
boolean saveSampleAuxGamma(PHDFile phd, Integer sampleId);
|
||||
Integer saveSampleAuxGamma(PHDFile phd, Integer sampleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ public interface IGardsSampleCertLineSpectrumService extends IService<GardsSampl
|
|||
|
||||
Integer saveSampleCertLine(EnergySpectrumStruct sourceData, Integer sampleId);
|
||||
|
||||
boolean saveSampleCertLineGamma(PHDFile phd, Integer sampleId);
|
||||
Integer saveSampleCertLineGamma(PHDFile phd, Integer sampleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ public interface IGardsSampleCertSpectrumService extends IService<GardsSampleCer
|
|||
|
||||
Integer saveSampleCert(EnergySpectrumStruct sourceData, Integer sampleId);
|
||||
|
||||
boolean saveSampleCertGamma(PHDFile phd, Integer sampleId);
|
||||
Integer saveSampleCertGamma(PHDFile phd, Integer sampleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ public interface IGardsSampleDataSpectrumService extends IService<GardsSampleDat
|
|||
|
||||
Integer saveSampleData(EnergySpectrumStruct sourceData, Integer stationId, Integer detectorId, String filePathName, List<String> readLines);
|
||||
|
||||
boolean saveSampleDataGamma(PHDFile phd, String input_file_name, Integer station_id, Integer detect_id);
|
||||
Integer saveSampleDataGamma(PHDFile phd, String input_file_name, Integer station_id, Integer detect_id);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ public interface IGardsSpectrumSpectrumService extends IService<GardsSpectrum> {
|
|||
|
||||
Integer saveSpectrum(EnergySpectrumStruct sourceData, Integer sampleId, List<String> readLines, String filePathName);
|
||||
|
||||
boolean saveSpectrumGamma(PHDFile phd, Integer sampleId, String input_file_name);
|
||||
Integer saveSpectrumGamma(PHDFile phd, Integer sampleId, String input_file_name);
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ public interface IGardsTotalEfficiencyPairsSpectrumService extends IService<Gard
|
|||
|
||||
Integer saveTotalEfficiencyPairs(EnergySpectrumStruct sourceData, Integer sampleId);
|
||||
|
||||
boolean saveTotalEfficiencyPairsGamma(PHDFile phd, Integer sampleId);
|
||||
Integer saveTotalEfficiencyPairsGamma(PHDFile phd, Integer sampleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -249,6 +249,40 @@ public class GammaServiceImpl implements IGammaService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
//获取当前角色配置的颜色信息
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
//获取缓存的phd数据
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||
List<Double> vEnergy = phd.getVEnergy();
|
||||
long m_nSChan = phd.getSpec().getBegin_channel();
|
||||
List<Long> m_vCount = new LinkedList<>();
|
||||
// 确保绘制曲线时所有谱都是从1道开始
|
||||
int i = 0;
|
||||
if(m_nSChan == 0) {
|
||||
i = 1;
|
||||
}
|
||||
for(; i<m_nCount; ++i) {
|
||||
m_vCount.add(phd.getSpec().getCounts().get(i));
|
||||
}
|
||||
if(m_nSChan == 0) {
|
||||
m_vCount.add(0L);
|
||||
}
|
||||
//获取Compare数据
|
||||
List<Long> m_vecCompare = gammaFileUtil.loadCompareData(stripFileName, userName, m_nCount, result);
|
||||
if (CollectionUtils.isNotEmpty(m_vecCompare)) {
|
||||
List<ChartData> chartDataList = gammaFileUtil.StripData(m_vecCompare, m_vCount, m_nCount, colorMap, vEnergy, ratioRate);
|
||||
result.setSuccess(true);
|
||||
result.setResult(chartDataList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result configure(Integer sampleId, String fileName) {
|
||||
Result result = new Result();
|
||||
|
@ -2842,7 +2876,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
phd.setStatus(sampleData.getStatus());
|
||||
} else {
|
||||
//如果sampleData为空 存储数据
|
||||
bRet = SaveSampleToDB(phd, middleData.analyses_save_filePath);
|
||||
SaveSampleToDB(phd, middleData.analyses_save_filePath);
|
||||
}
|
||||
if(!bRet) {
|
||||
result.error500("The Database hasn't this Spectrum("+phd.getFilename()+") and Insert it to Database failed.");
|
||||
|
@ -2936,8 +2970,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
|
||||
boolean bRet = true;
|
||||
public void SaveSampleToDB(PHDFile phd, String input_file_name) {
|
||||
String sit_det_code = phd.getHeader().getSite_code();
|
||||
String detect_code = phd.getHeader().getDetector_code();
|
||||
// 查询 station_id 和 detect_id
|
||||
|
@ -2948,54 +2981,26 @@ public class GammaServiceImpl implements IGammaService {
|
|||
// 查询新增后的 sample_id 的值赋给变量 DECLARESAMPLEID
|
||||
Integer sampleId = spectrumAnalysisMapper.getSampleId(input_file_name);
|
||||
// ORIGINAL.GARDS_SAMPLE_AUX 表数据
|
||||
bRet = sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId);
|
||||
// ORIGINAL.gards_sample_description 数据表
|
||||
bRet = sampleDescriptionSpectrumService.saveSampleDescriptionGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
sampleDescriptionSpectrumService.saveSampleDescriptionGamma(phd, sampleId);
|
||||
// ORIGINAL.GARDS_SAMPLE_CERT 和 ORIGINAL.GARDS_SAMPLE_CERT_LINE 数据表
|
||||
if(phd.getCertificate().getRecord_count() > 0) {
|
||||
bRet = sampleCertSpectrumService.saveSampleCertGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
bRet = sampleCertLineSpectrumService.saveSampleCertLineGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
sampleCertSpectrumService.saveSampleCertGamma(phd, sampleId);
|
||||
sampleCertLineSpectrumService.saveSampleCertLineGamma(phd, sampleId);
|
||||
}
|
||||
//gards_ calibration_pairs_orig数据表
|
||||
bRet = calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId);
|
||||
// gards_total_efficiency _pairs数据表(IDC没有)
|
||||
bRet = totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId);
|
||||
//gards_spectrum数据表
|
||||
bRet = spectrumService.saveSpectrumGamma(phd, sampleId, input_file_name);
|
||||
if(bRet) {
|
||||
GardsSampleDataSpectrum samplData = spectrumAnalysisMapper.findSampleByFilePath(input_file_name);
|
||||
if(Objects.nonNull(samplData)) {
|
||||
phd.setId_sample(samplData.getSampleId().toString());
|
||||
phd.setStatus(samplData.getStatus());
|
||||
}
|
||||
} else {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
spectrumService.saveSpectrumGamma(phd, sampleId, input_file_name);
|
||||
//根据文件名称获取sample基础数据信息
|
||||
GardsSampleDataSpectrum samplData = spectrumAnalysisMapper.findSampleByFilePath(input_file_name);
|
||||
if(Objects.nonNull(samplData)) {
|
||||
phd.setId_sample(samplData.getSampleId().toString());
|
||||
phd.setStatus(samplData.getStatus());
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("gardsCalibrationPairsOrigSpectrumService")
|
||||
@DS("ora")
|
||||
|
@ -109,61 +110,66 @@ public class GardsCalibrationPairsOrigSpectrumServiceImpl extends ServiceImpl<Ga
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveCalibrationPairsOrigGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
public Integer saveCalibrationPairsOrigGamma(PHDFile phd, Integer sampleId) {
|
||||
List<GardsCalibrationPairsOrig> calibrationPairsOrigList = new LinkedList<>();
|
||||
int t_size = phd.getMapEnerKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GEnergyBlock g_ener = phd.getMapEnerKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++) {
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.ENERGY_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_ener.getCentroid_channel().get(i));
|
||||
calibrationPairsOrig.setYValue(g_ener.getG_energy().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_ener.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
if (Objects.nonNull(phd.getMapEnerKD().get(CalName.CalPHD.getType()).getG_energy())) {
|
||||
int t_size = phd.getMapEnerKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GEnergyBlock g_ener = phd.getMapEnerKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++) {
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.ENERGY_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_ener.getCentroid_channel().get(i));
|
||||
calibrationPairsOrig.setYValue(g_ener.getG_energy().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_ener.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
}
|
||||
}
|
||||
}
|
||||
t_size = phd.getMapResoKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GResolutionBlock g_reso = phd.getMapResoKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++) {
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.RESOLUTION_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_reso.getG_energy().get(i));
|
||||
calibrationPairsOrig.setYValue(g_reso.getFWHM().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_reso.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
if (Objects.nonNull(phd.getMapResoKD().get(CalName.CalPHD.getType()).getG_energy())) {
|
||||
int t_size = phd.getMapResoKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GResolutionBlock g_reso = phd.getMapResoKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++) {
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.RESOLUTION_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_reso.getG_energy().get(i));
|
||||
calibrationPairsOrig.setYValue(g_reso.getFWHM().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_reso.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
}
|
||||
}
|
||||
}
|
||||
t_size = phd.getMapEffiKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GEfficiencyBlock g_effi = phd.getMapEffiKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++){
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.EFFICIENCY_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_effi.getG_energy().get(i));
|
||||
calibrationPairsOrig.setYValue(g_effi.getEfficiency().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_effi.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
if (Objects.nonNull(phd.getMapEffiKD().get(CalName.CalPHD.getType()).getG_energy())) {
|
||||
int t_size = phd.getMapEffiKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GEfficiencyBlock g_effi = phd.getMapEffiKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++){
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.EFFICIENCY_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_effi.getG_energy().get(i));
|
||||
calibrationPairsOrig.setYValue(g_effi.getEfficiency().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_effi.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(calibrationPairsOrigList)) {
|
||||
bRet = this.saveBatch(calibrationPairsOrigList);
|
||||
this.saveBatch(calibrationPairsOrigList);
|
||||
}
|
||||
return bRet;
|
||||
return calibrationPairsOrigList.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,8 +88,7 @@ public class GardsSampleAuxSpectrumServiceImpl extends ServiceImpl<GardsSampleAu
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveSampleAuxGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
public Integer saveSampleAuxGamma(PHDFile phd, Integer sampleId) {
|
||||
GardsSampleAux sampleAux = new GardsSampleAux();
|
||||
String calibTime = "";
|
||||
if(StringUtils.isNotBlank(phd.getCalibration().getDate_calibration())) {
|
||||
|
@ -114,9 +113,6 @@ public class GardsSampleAuxSpectrumServiceImpl extends ServiceImpl<GardsSampleAu
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
int insert = this.baseMapper.insert(sampleAux);
|
||||
if (insert>0) {
|
||||
bRet = true;
|
||||
}
|
||||
return bRet;
|
||||
return insert;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("gardsSampleCertLineSpectrumService")
|
||||
@DS("ora")
|
||||
|
@ -45,28 +46,29 @@ public class GardsSampleCertLineSpectrumServiceImpl extends ServiceImpl<GardsSam
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveSampleCertLineGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
public Integer saveSampleCertLineGamma(PHDFile phd, Integer sampleId) {
|
||||
List<GardsSampleCertLine> sampleCertLineList = new LinkedList<>();
|
||||
for (int i=0; i<phd.getCertificate().getRecord_count(); i++) {
|
||||
GardsSampleCertLine sampleCertLine = new GardsSampleCertLine();
|
||||
sampleCertLine.setSampleId(sampleId);
|
||||
sampleCertLine.setNuclName(phd.getCertificate().getNuclide_name().get(i));
|
||||
sampleCertLine.setHalflife(phd.getCertificate().getHalf_life_time().get(i));
|
||||
sampleCertLine.setEnergy(phd.getCertificate().getG_energy().get(i));
|
||||
sampleCertLine.setActivity(phd.getCertificate().getActivity_nuclide_time_assay().get(i));
|
||||
sampleCertLine.setError(phd.getCertificate().getUncertainty().get(i));
|
||||
sampleCertLine.setAbundance(phd.getCertificate().getG_intensity().get(i));
|
||||
sampleCertLine.setBAbundance(phd.getCertificate().getIntensity_b_particle().get(i));
|
||||
sampleCertLine.setBEnergy(phd.getCertificate().getMaximum_energy().get(i));
|
||||
sampleCertLine.setDecayMode(phd.getCertificate().getElectron_decay_mode().get(i));
|
||||
sampleCertLine.setHalfliftUnit(phd.getCertificate().getTime_unit().get(i));
|
||||
sampleCertLineList.add(sampleCertLine);
|
||||
if (Objects.nonNull(phd.getCertificate())) {
|
||||
for (int i=0; i<phd.getCertificate().getRecord_count(); i++) {
|
||||
GardsSampleCertLine sampleCertLine = new GardsSampleCertLine();
|
||||
sampleCertLine.setSampleId(sampleId);
|
||||
sampleCertLine.setNuclName(phd.getCertificate().getNuclide_name().get(i));
|
||||
sampleCertLine.setHalflife(phd.getCertificate().getHalf_life_time().get(i));
|
||||
sampleCertLine.setEnergy(phd.getCertificate().getG_energy().get(i));
|
||||
sampleCertLine.setActivity(phd.getCertificate().getActivity_nuclide_time_assay().get(i));
|
||||
sampleCertLine.setError(phd.getCertificate().getUncertainty().get(i));
|
||||
sampleCertLine.setAbundance(phd.getCertificate().getG_intensity().get(i));
|
||||
sampleCertLine.setBAbundance(phd.getCertificate().getIntensity_b_particle().get(i));
|
||||
sampleCertLine.setBEnergy(phd.getCertificate().getMaximum_energy().get(i));
|
||||
sampleCertLine.setDecayMode(phd.getCertificate().getElectron_decay_mode().get(i));
|
||||
sampleCertLine.setHalfliftUnit(phd.getCertificate().getTime_unit().get(i));
|
||||
sampleCertLineList.add(sampleCertLine);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(sampleCertLineList)) {
|
||||
this.saveBatch(sampleCertLineList);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(sampleCertLineList)) {
|
||||
bRet = this.saveBatch(sampleCertLineList);
|
||||
}
|
||||
return bRet;
|
||||
return sampleCertLineList.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("gardsSampleCertSpectrumService")
|
||||
@DS("ora")
|
||||
|
@ -35,23 +36,22 @@ public class GardsSampleCertSpectrumServiceImpl extends ServiceImpl<GardsSampleC
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveSampleCertGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
String assay_date = phd.getCertificate().getAssay_date() + " " + phd.getCertificate().getAssay_time();
|
||||
try {
|
||||
GardsSampleCert sampleCert = new GardsSampleCert();
|
||||
sampleCert.setSampleId(sampleId);
|
||||
sampleCert.setQuantity(phd.getCertificate().getTotal_source_activity());
|
||||
sampleCert.setAssayDate(DateUtils.parseDate(assay_date));
|
||||
sampleCert.setUnit(phd.getCertificate().getUnits_activity());
|
||||
int insert = this.baseMapper.insert(sampleCert);
|
||||
if (insert>0) {
|
||||
bRet = true;
|
||||
public Integer saveSampleCertGamma(PHDFile phd, Integer sampleId) {
|
||||
int insert = 0;
|
||||
if (Objects.nonNull(phd.getCertificate())) {
|
||||
String assay_date = phd.getCertificate().getAssay_date() + " " + phd.getCertificate().getAssay_time();
|
||||
try {
|
||||
GardsSampleCert sampleCert = new GardsSampleCert();
|
||||
sampleCert.setSampleId(sampleId);
|
||||
sampleCert.setQuantity(phd.getCertificate().getTotal_source_activity());
|
||||
sampleCert.setAssayDate(DateUtils.parseDate(assay_date));
|
||||
sampleCert.setUnit(phd.getCertificate().getUnits_activity());
|
||||
insert = this.baseMapper.insert(sampleCert);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return bRet;
|
||||
return insert;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -96,8 +96,7 @@ public class GardsSampleDataSpectrumServiceImpl extends ServiceImpl<GardsSampleD
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveSampleDataGamma(PHDFile phd, String input_file_name, Integer station_id, Integer detect_id) {
|
||||
boolean bRet = false;
|
||||
public Integer saveSampleDataGamma(PHDFile phd, String input_file_name, Integer station_id, Integer detect_id) {
|
||||
// ORIGINAL.GARDS_SAMPLE_DATA 表数据
|
||||
String status = "U";
|
||||
String transmit_dtg = phd.getHeader().getTransmit_date()+" "+phd.getHeader().getTransmit_time();
|
||||
|
@ -137,10 +136,7 @@ public class GardsSampleDataSpectrumServiceImpl extends ServiceImpl<GardsSampleD
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
int insert = this.baseMapper.insert(sampleData);
|
||||
if (insert > 0) {
|
||||
bRet = true;
|
||||
}
|
||||
return bRet;
|
||||
return insert;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ public class GardsSpectrumSpectrumServiceImpl extends ServiceImpl<GardsSpectrumS
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveSpectrumGamma(PHDFile phd, Integer sampleId, String input_file_name) {
|
||||
boolean bRet = false;
|
||||
public Integer saveSpectrumGamma(PHDFile phd, Integer sampleId, String input_file_name) {
|
||||
int insert = 0;
|
||||
int t_size = (int) phd.getSpec().getNum_g_channel();
|
||||
if(t_size > 0) {
|
||||
GSpectrumBlock g_spec = phd.getSpec();
|
||||
|
@ -67,12 +67,9 @@ public class GardsSpectrumSpectrumServiceImpl extends ServiceImpl<GardsSpectrumS
|
|||
spectrum.setChannels((int) g_spec.getNum_g_channel());
|
||||
spectrum.setEnergySpan((int) g_spec.getG_energy_span());
|
||||
spectrum.setStartChannel((int) g_spec.getBegin_channel());
|
||||
int insert = this.baseMapper.insert(spectrum);
|
||||
if (insert>0) {
|
||||
bRet = true;
|
||||
}
|
||||
insert = this.baseMapper.insert(spectrum);
|
||||
}
|
||||
return bRet;
|
||||
return insert;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("gardsTotalEfficiencyPairsSpectrumService")
|
||||
@DS("ora")
|
||||
|
@ -40,10 +41,9 @@ public class GardsTotalEfficiencyPairsSpectrumServiceImpl extends ServiceImpl<Ga
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveTotalEfficiencyPairsGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
public Integer saveTotalEfficiencyPairsGamma(PHDFile phd, Integer sampleId) {
|
||||
List<GardsTotalEfficiencyPairs> totalEfficiencyPairsList = new LinkedList<>();
|
||||
int t_size = phd.getMapTotEKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
int t_size = Objects.nonNull(phd.getMapTotEKD().get(CalName.CalPHD.getType()).getG_energy())?phd.getMapTotEKD().get(CalName.CalPHD.getType()).getG_energy().size():0;
|
||||
if(t_size > 0) {
|
||||
TotaleffBlock g_tote = phd.getMapTotEKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++){
|
||||
|
@ -58,7 +58,7 @@ public class GardsTotalEfficiencyPairsSpectrumServiceImpl extends ServiceImpl<Ga
|
|||
if (CollectionUtils.isNotEmpty(totalEfficiencyPairsList)) {
|
||||
this.saveBatch(totalEfficiencyPairsList);
|
||||
}
|
||||
return bRet;
|
||||
return totalEfficiencyPairsList.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user