人工交互模块测试方法删除

This commit is contained in:
qiaoqinzheng 2024-03-14 09:57:21 +08:00
parent bc2b3ca4f2
commit fb8077531d
3 changed files with 0 additions and 217 deletions

View File

@ -33,12 +33,6 @@ public class GammaController {
gammaService.initValue(sampleId, dbName, analyst, fileName, request); gammaService.initValue(sampleId, dbName, analyst, fileName, request);
} }
@GetMapping("testFun")
public Result testFun(String fileName,HttpServletRequest request){
return gammaService.testFun(fileName, request);
}
@GetMapping("gammaByDB") @GetMapping("gammaByDB")
@ApiOperation(value = "gamma页面loadFromDB加载数据", notes = "gamma页面loadFromDB加载数据") @ApiOperation(value = "gamma页面loadFromDB加载数据", notes = "gamma页面loadFromDB加载数据")
public Result gammaByDB(Integer sampleId, String dbName, String analyst, HttpServletRequest request){ public Result gammaByDB(Integer sampleId, String dbName, String analyst, HttpServletRequest request){

View File

@ -17,8 +17,6 @@ public interface IGammaService{
void initValue(Integer sampleId, String dbName, String analyst, String fileName, HttpServletRequest request); void initValue(Integer sampleId, String dbName, String analyst, String fileName, HttpServletRequest request);
Result testFun(String fileName, HttpServletRequest request);
Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request); Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request);
Result gammaByFile(String fileName, HttpServletRequest request); Result gammaByFile(String fileName, HttpServletRequest request);

View File

@ -164,215 +164,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
} }
} }
@Override
public Result testFun(String fileName, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName);
phd.setUserId("1");
phd.setXmlFilePath(parameterProperties.getFilePath());
String systemType = fileName.substring(2, 3);
if (Objects.isNull(phd)) {
result.error500("Please select the parse file first");
return result;
}
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
// 解析获取临时文件信息
File tmpFile = gammaFileUtil.analyzeFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName, fileName);
ObjectMapper mapper = new ObjectMapper();
try {
String phdStr = mapper.writeValueAsString(phd);
String mapLines = mapper.writeValueAsString(nuclideLinesMap);
String strValue = CalValuesHandler.analyseSpectrum(phdStr, mapLines, tmpFile.getAbsolutePath(), new AnalysisProcess());
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
for (Map.Entry<String, Object> entry : parseMap.entrySet()) {
if (entry.getKey().equalsIgnoreCase("bAnalyed")) {
boolean value = JSON.parseObject(JSON.toJSONString(entry.getValue()), Boolean.class);
phd.setBAnalyed(value);
}
if (entry.getKey().equalsIgnoreCase("mapEnerPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapEnerPara(value);
}
if (entry.getKey().equalsIgnoreCase("mapResoPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapResoPara(value);
}
if (entry.getKey().equalsIgnoreCase("mapEffiPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapEffiPara(value);
}
if (entry.getKey().equalsIgnoreCase("mapTotEPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapTotEPara(value);
}
if (entry.getKey().equalsIgnoreCase("para_stepRatio")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_stepRatio(value);
}
if (entry.getKey().equalsIgnoreCase("para_tail")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tail(value);
}
if (entry.getKey().equalsIgnoreCase("para_tailAlpha")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tailAlpha(value);
}
if (entry.getKey().equalsIgnoreCase("para_tailRight")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tailRight(value);
}
if (entry.getKey().equalsIgnoreCase("para_tailRightAlpha")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tailRightAlpha(value);
}
if (entry.getKey().equalsIgnoreCase("newEner")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewEner(value);
}
if (entry.getKey().equalsIgnoreCase("newReso")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewReso(value);
}
if (entry.getKey().equalsIgnoreCase("mapEnerKD")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, GEnergyBlock> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
GEnergyBlock entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), GEnergyBlock.class);
value.put(key, entryValue);
}
phd.setMapEnerKD(value);
}
if (entry.getKey().equalsIgnoreCase("mapResoKD")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, GResolutionBlock> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
GResolutionBlock entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), GResolutionBlock.class);
value.put(key, entryValue);
}
phd.setMapResoKD(value);
}
if (entry.getKey().equalsIgnoreCase("vEnergy")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVEnergy(value);
}
if (entry.getKey().equalsIgnoreCase("vBase")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVBase(value);
}
if (entry.getKey().equalsIgnoreCase("vLc")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVLc(value);
}
if (entry.getKey().equalsIgnoreCase("vScac")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVScac(value);
}
if (entry.getKey().equalsIgnoreCase("vPeak")) {
List<PeakInfo> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), PeakInfo.class);
phd.setVPeak(value);
}
if (entry.getKey().equalsIgnoreCase("baseCtrls")) {
BaseControls value = JSON.parseObject(JSON.toJSONString(entry.getValue()), BaseControls.class);
phd.setBaseCtrls(value);
}
if (entry.getKey().equalsIgnoreCase("usedEner")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedEner(value);
}
if (entry.getKey().equalsIgnoreCase("usedEnerKD")) {
GEnergyBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GEnergyBlock.class);
phd.setUsedEnerKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedEnerPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedEnerPara(value);
}
if (entry.getKey().equalsIgnoreCase("usedReso")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedReso(value);
}
if (entry.getKey().equalsIgnoreCase("usedResoKD")) {
GResolutionBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GResolutionBlock.class);
phd.setUsedResoKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedResoPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedResoPara(value);
}
if (entry.getKey().equalsIgnoreCase("usedEffi")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedEffi(value);
}
if (entry.getKey().equalsIgnoreCase("usedEffiKD")) {
GEfficiencyBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GEfficiencyBlock.class);
phd.setUsedEffiKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedEffiPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedEffiPara(value);
}
if (entry.getKey().equalsIgnoreCase("usedTotE")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedTotE(value);
}
if (entry.getKey().equalsIgnoreCase("usedTotEKD")) {
TotaleffBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), TotaleffBlock.class);
phd.setUsedTotEKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedTotEPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedTotEPara(value);
}
}
BeanUtils.copyProperties(phd.getSetting(), phd.getUsedSetting());
for (PeakInfo info:phd.getVPeak()) {
if (Objects.isNull(info.recoilBetaChan)) {
info.recoilBetaChan = "nan";
}
if (Objects.isNull(info.recoilDeltaChan)) {
info.recoilDeltaChan = "nan";
}
}
// 重新分析各峰值对应的核素信息
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
gammaFileUtil.RunQC(phd);
result.setResult(phd);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
result.setSuccess(true);
return result;
}
@Override @Override
public Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) { public Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
Result result = new Result(); Result result = new Result();