From c83aff08bde39e6a0fb3f9c24ae0f368603ca3f2 Mon Sep 17 00:00:00 2001 From: xiaoguangbin Date: Thu, 25 Jul 2024 17:06:23 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9AselfStationController=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20replotBaseLine=E3=80=81acceptBaseLine=20=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SelfStationServiceImpl.java | 96 +++++++++++++++++++ 1 file changed, 96 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 fe473acf..1c579bd5 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 @@ -2789,6 +2789,102 @@ public class SelfStationServiceImpl implements ISelfStationService { return Result.ok(); } + @Override + public Result replotBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request) { + Result result = new Result(); + HashMap map = new HashMap<>(); + // 获取用户名 + String userName = JwtUtil.getUserNameByToken(request); + // 获取文件名称 + String fileName = baseLineCtrls.getFileName(); + //获取自建台站缓存信息 + PHDFile phd = selfStationUtil.getGammaPHD(fileName, userName, baseLineCtrls.getGammaROINum(), selfStationCache); +// Cache phdCache = localCache.getPHDCache(); +// PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName); + if (Objects.isNull(phd)) { + result.error500("Please select the parse file first!"); + return result; + } + List m_vCount = new LinkedList<>(); + long m_nCount = phd.getSpec().getNum_g_channel(); + long m_nSChan = phd.getSpec().getBegin_channel(); + // 获取当前角色的颜色配置 + Map colorMap = sysUserColorService.initColor(userName); + // 确保绘制曲线时所有谱都是从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); + } + if (baseLineCtrls.isReplotNeeded()) { + baseLineCtrls.setReplotNeeded(false); + BaseControls m_baseCtrl = new BaseLineCtrls(); + BeanUtils.copyProperties(baseLineCtrls, m_baseCtrl); + List peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), m_baseCtrl.getBaseline(), colorMap.get("Color_Peak"), m_nCount, null, false); + map.put("peakSet", peakSet); + ChartData chartData = gammaFileUtil.CreateTempBaseLine(colorMap.get("Color_Base"), "BaseLine", m_baseCtrl); + map.put("chartData", chartData); + List shapeData = gammaFileUtil.CreateShapeCP(m_baseCtrl); + map.put("shapeData", shapeData); + if (m_baseCtrl.getBaseStack().size() > 2) { + for (int j = 1; j < m_baseCtrl.getBaseStack().size() - 1; j++) { + m_baseCtrl.getBaseStack().remove(j); + } + } + } + result.setSuccess(true); + result.setResult(map); + return result; + } + + @Override + public Result acceptBaseLine(BaseLineCtrls baseLineCtrls, HttpServletRequest request) { + Result result = new Result(); + HashMap map = new HashMap<>(); + // 获取用户名 + String userName = JwtUtil.getUserNameByToken(request); + // 获取文件名称 + String fileName = baseLineCtrls.getFileName(); + //获取自建台站缓存信息 + PHDFile phd = selfStationUtil.getGammaPHD(fileName, userName, baseLineCtrls.getGammaROINum(), selfStationCache); +// Cache phdCache = localCache.getPHDCache(); +// PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName); + if (Objects.isNull(phd)) { + result.error500("Please select the parse file first!"); + return result; + } +// if(baseLineCtrls.getBaseStack().size() > 1) { +// for (int i=0; i colorMap = sysUserColorService.initColor(userName); + List differance = gammaFileUtil.Differance(phd, phd.getVPeak()); + map.put("barChart", differance); + ChartData channelBaseLine = gammaFileUtil.Channel_BaseLine(phd, colorMap.get("Color_Base")); + map.put("channelBaseLineChart", channelBaseLine); + List peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), phd.getVBase(), colorMap.get("Color_Peak"), phd.getSpec().getNum_g_channel(), null, false); + map.put("peakSet", peakSet); + List shapeData = gammaFileUtil.CreateShapeCP(phd.getBaseCtrls()); + map.put("shapeData", shapeData); + map.put("peak", phd.getVPeak()); + // 更新主界面的 Chart + gammaFileUtil.UpdateChart(phd, map, colorMap); + result.setSuccess(true); + result.setResult(map); + return result; + } + @Override public Result fitting(Double paramA, Double paramB, Double paramC, List tempPoints, Integer count, String sampleFileName, String tabName, boolean fittingBtn, HttpServletRequest request) {