Merge remote-tracking branch 'origin/SelfStation' into SelfStation

This commit is contained in:
xiaoguangbin 2024-07-24 16:47:04 +08:00
commit 73286710e0
3 changed files with 64 additions and 2 deletions

View File

@ -1,5 +1,7 @@
package org.jeecg.modules.controller;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
@ -15,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
@RestController
@ -51,8 +54,9 @@ public class SelfStationController {
@PutMapping("updateROI")
@ApiOperation(value = "更新ROI范围", notes = "更新ROI范围")
public Result updateROI(@RequestBody List<ROIParam> roiParams, @RequestParam String sampleFileName, HttpServletRequest request) {
return selfStationService.updateROI(roiParams, sampleFileName, request);
public Result updateROI(@RequestParam String roiParams, @RequestParam String sampleFileName, HttpServletRequest request) {
ArrayList<ROIParam> roiParamList = (ArrayList<ROIParam>) new Gson().fromJson(roiParams, List.class);
return selfStationService.updateROI(roiParamList, sampleFileName, request);
}
@GetMapping("energyCalibration")
@ -281,6 +285,12 @@ public class SelfStationController {
return selfStationService.fitting(fittingBody.getParamA(), fittingBody.getParamB(), fittingBody.getParamC(), fittingBody.getTempPoints(), fittingBody.getCount(), fittingBody.getSampleFileName(), fittingBody.getTabName(), fittingBody.isFittingBtn(), request);
}
@GetMapping("getGammaGated")
@ApiOperation(value = "获取gamma对应count数据", notes = "获取gamma对应count数据")
public Result getGammaGated(Integer chartHeight, Integer channelWidth, Integer gammaChannel, Integer sampleId, String qcFileName, String sampleFileName, HttpServletRequest request) {
return selfStationService.getGammaGated(chartHeight, channelWidth, gammaChannel, sampleId, qcFileName, sampleFileName, request);
}
@GetMapping("NuclideLibrary")
@ApiOperation(value = "查看Nuclide Library页面数据", notes = "查看Nuclide Library页面数据")
public Result NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request) {

View File

@ -95,6 +95,8 @@ public interface ISelfStationService {
Result fitting(Double paramA, Double paramB, Double paramC, List<SeriseData> tempPointsArray, Integer count,
String sampleFileName, String tabName, boolean fittingBtn, HttpServletRequest request);
Result getGammaGated(Integer chartHeight, Integer channelWidth, Integer gammaChannel, Integer sampleId, String qcFileName, String sampleFileName, HttpServletRequest request);
Result NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request);
Result configUserLibrary(Integer sampleId, String fileName, HttpServletRequest request);

View File

@ -2944,6 +2944,56 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
@Override
public Result getGammaGated(Integer chartHeight, Integer channelWidth, Integer gammaChannel, Integer sampleId, String qcFileName, String sampleFileName, HttpServletRequest request) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
//获取用户名称
String userName = JwtUtil.getUserNameByToken(request);
//获取自建台站缓存信息
Cache<String, SelfStationData> selfCache = selfStationCache.getSelfCache();
SelfStationData betaDataFile = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName);
// Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
// BetaDataFile betaDataFile = cache.getIfPresent(sampleFileName + "-" + userName);
if (Objects.isNull(betaDataFile)) {
result.error500("Load basic file information first!");
return result;
}
//选择矩形框高度
Integer flagHeight = channelWidth * (chartHeight/256);
int value = Double.valueOf(flagHeight / 2).intValue();
//计算得到最高值
int up = gammaChannel - value;
if (up<0){
up = 0;
}
//计算得到最低值
int down = up + value;
EnergySpectrumStruct struct = betaDataFile.getQcStruct();
if (Objects.nonNull(struct)) {
//Beta-Gamma Spectrum: QC
long bChannels = struct.b_channels;
List<Long> hCounts = struct.h_counts;
List<SeriseData> serise_data = new LinkedList<>();
for ( int i=0; i<bChannels; ++i ) {
long count = 0;
for (int j=up; j<=down; ++j) {
Long index = j * bChannels + i;
count += hCounts.get(index.intValue());
}
SeriseData temp = new SeriseData();
temp.setX(i);
temp.setY(count);
serise_data.add(temp);
}
map.put("data", serise_data);
}
result.setSuccess(true);
result.setResult(map);
return result;
}
@Override
@DS("ora")
public Result NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request) {