From 48a03b6d6f800cd3b606602f147a52233d23569e Mon Sep 17 00:00:00 2001 From: xiaoguangbin Date: Wed, 24 Jul 2024 16:46:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9updateROI?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0;2=20=E5=A2=9E=E5=8A=A0/sel?= =?UTF-8?q?fStation/getGammaGated=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/controller/SelfStationController.java | 14 ++++++++++++-- .../jeecg/modules/service/ISelfStationService.java | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java index f34fffec..e072f946 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java @@ -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 roiParams, @RequestParam String sampleFileName, HttpServletRequest request) { - return selfStationService.updateROI(roiParams, sampleFileName, request); + public Result updateROI(@RequestParam String roiParams, @RequestParam String sampleFileName, HttpServletRequest request) { + ArrayList roiParamList = (ArrayList) 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) { diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISelfStationService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISelfStationService.java index dbecb3b0..39b0d5d9 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISelfStationService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISelfStationService.java @@ -95,6 +95,8 @@ public interface ISelfStationService { Result fitting(Double paramA, Double paramB, Double paramC, List 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); From 1f94e14a704322645e7aa9c6cc14fe6ba296426d Mon Sep 17 00:00:00 2001 From: xiaoguangbin Date: Wed, 24 Jul 2024 16:46:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9updateROI?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0;2=20=E5=A2=9E=E5=8A=A0/sel?= =?UTF-8?q?fStation/getGammaGated=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SelfStationServiceImpl.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java index 6cd40c25..2c817d55 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java @@ -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 map = new HashMap<>(); + //获取用户名称 + String userName = JwtUtil.getUserNameByToken(request); + //获取自建台站缓存信息 + Cache selfCache = selfStationCache.getSelfCache(); + SelfStationData betaDataFile = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName); +// Cache 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 hCounts = struct.h_counts; + List serise_data = new LinkedList<>(); + for ( int i=0; i