feat:Gamma saveToExcel
This commit is contained in:
parent
d9ba592743
commit
af83b5b03f
|
@ -0,0 +1,27 @@
|
|||
package org.jeecg.modules.base.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PeakInfoDto {
|
||||
|
||||
private String peakId;
|
||||
|
||||
private String energy;
|
||||
|
||||
private String centroid;
|
||||
|
||||
private String multiplet;
|
||||
|
||||
private String fwhm;
|
||||
|
||||
private String netArea;
|
||||
|
||||
private String areaErr;
|
||||
|
||||
private String significant;
|
||||
|
||||
private String sensitivity;
|
||||
|
||||
private String nuclides;
|
||||
}
|
|
@ -16,7 +16,7 @@ public enum ExportTemplate {
|
|||
RLR_B("RLR-B.xls"),RLR_G("Gamma.RLR"),
|
||||
ZEROTIME_G("ZeroTime.txt"),
|
||||
SAVETOHTML("SaveHtml.html"),
|
||||
SAVETOEXCEL("SaveExcel.xls"),
|
||||
SAVETOEXCEL("SaveExcel.xls"),SAVETOEXCEL_G("SaveToExcel-G.xls"),
|
||||
SAVETOTXT("SaveTxt.txt");
|
||||
|
||||
ExportTemplate(String name) {
|
||||
|
|
|
@ -481,4 +481,8 @@ public class GammaController {
|
|||
return gammaService.saveTxt(fileName, request);
|
||||
}
|
||||
|
||||
@GetMapping("saveToExcel")
|
||||
public void saveToExcel(String fileName, HttpServletResponse response) {
|
||||
gammaService.saveToExcel(fileName, response);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,4 +162,5 @@ public interface IGammaService{
|
|||
|
||||
Result saveTxt(String fileName, HttpServletRequest request);
|
||||
|
||||
void saveToExcel(String fileName, HttpServletResponse response);
|
||||
}
|
||||
|
|
|
@ -18,14 +18,17 @@ import org.apache.commons.io.FileUtils;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.google.common.cache.Cache;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.cache.LocalCache;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.properties.ParameterProperties;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.*;
|
||||
import org.jeecg.modules.base.bizVo.GammaRLR;
|
||||
import org.jeecg.modules.base.dto.PeakInfoDto;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
import org.jeecg.modules.base.entity.postgre.SysUser;
|
||||
|
@ -3965,6 +3968,42 @@ public class GammaServiceImpl implements IGammaService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveToExcel(String fileName, HttpServletResponse response) {
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String username = loginUser.getUsername();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName + StrUtil.DASHED + username);
|
||||
if (ObjectUtil.isNull(phd)) return;
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
/* The Results of Peak Searching */
|
||||
List<PeakInfo> peakInfos = phd.getVPeak();
|
||||
List<PeakInfoDto> peakInfoDtos = new ArrayList<>();
|
||||
for (PeakInfo peakInfo : peakInfos) {
|
||||
PeakInfoDto peakInfoDto = new PeakInfoDto();
|
||||
peakInfoDto.setPeakId(String.valueOf(peakInfo.index));
|
||||
peakInfoDto.setEnergy(NumberFormatUtil.numberFormat(String.valueOf(peakInfo.energy)));
|
||||
peakInfoDto.setCentroid(NumberFormatUtil.numberFormat(String.valueOf(peakInfo.peakCentroid)));
|
||||
peakInfoDto.setMultiplet(String.valueOf(peakInfo.multiIndex));
|
||||
peakInfoDto.setFwhm(NumberFormatUtil.numberFormat(String.valueOf(peakInfo.fwhm)));
|
||||
peakInfoDto.setNetArea(NumberFormatUtil.numberFormat(String.valueOf(peakInfo.area)));
|
||||
peakInfoDto.setAreaErr(NumberFormatUtil.numberFormat(String.valueOf(peakInfo.areaErr)));
|
||||
peakInfoDto.setSignificant(NumberFormatUtil.numberFormat(String.valueOf(peakInfo.significance)));
|
||||
peakInfoDto.setSensitivity(NumberFormatUtil.numberFormat(String.valueOf(peakInfo.sensitivity)));
|
||||
String nuclide = StringUtils.join(peakInfo.nuclides, StringPool.SEMICOLON);
|
||||
peakInfoDto.setNuclides(nuclide);
|
||||
peakInfoDtos.add(peakInfoDto);
|
||||
}
|
||||
data.put("peak", peakInfoDtos);
|
||||
/* The Results of Nuclide Identify */
|
||||
|
||||
/* Nuclide's Activity and Concentration */
|
||||
|
||||
String template = SAVETOEXCEL_G.getName();
|
||||
// 导出时使用默认文件名 file.xls
|
||||
ExportUtil.exportXls(response, template, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 行日志格式化
|
||||
* @param source 需要格式化的字符串
|
||||
|
|
Loading…
Reference in New Issue
Block a user