feat:RLR Export
This commit is contained in:
parent
d98a4de4b1
commit
46f3299f07
|
@ -2,7 +2,12 @@ package org.jeecg.common.util;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
|
||||||
|
import org.springframework.core.io.DefaultResourceLoader;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.core.io.ResourceLoader;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -47,4 +52,17 @@ public class ClassUtil {
|
||||||
}
|
}
|
||||||
return objsStr;
|
return objsStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String classPath(String path){
|
||||||
|
try {
|
||||||
|
String pathPrefix = "classpath:";
|
||||||
|
ResourceLoader loader = new DefaultResourceLoader();
|
||||||
|
String templatePath = pathPrefix + path;
|
||||||
|
Resource resource = loader.getResource(templatePath);
|
||||||
|
return resource.getFile().getAbsolutePath();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.springframework.core.io.ResourceLoader;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -47,6 +48,13 @@ public class ExportUtil {
|
||||||
response.setHeader("Content-disposition", "attachment;filename=" + name);
|
response.setHeader("Content-disposition", "attachment;filename=" + name);
|
||||||
return response.getOutputStream();
|
return response.getOutputStream();
|
||||||
}
|
}
|
||||||
|
public static PrintWriter streamWriter(HttpServletResponse response, String fileName) throws IOException {
|
||||||
|
response.setCharacterEncoding(UTF_8);
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
String name = URLEncoder.encode(fileName, UTF_8);
|
||||||
|
response.setHeader("Content-disposition", "attachment;filename=" + name);
|
||||||
|
return response.getWriter();
|
||||||
|
}
|
||||||
|
|
||||||
public static <T> void exportXls(HttpServletResponse response, Class<T> target,
|
public static <T> void exportXls(HttpServletResponse response, Class<T> target,
|
||||||
List<T> data, String fileName){
|
List<T> data, String fileName){
|
||||||
|
@ -77,18 +85,11 @@ public class ExportUtil {
|
||||||
exportXls(response, target, data, "file.xls");
|
exportXls(response, target, data, "file.xls");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TemplateExportParams excelTemplate(String name){
|
public static TemplateExportParams excelTemplate(String template){
|
||||||
try {
|
String pathPrefix = "excelTemplate/";
|
||||||
String pathPrefix = "classpath:excelTemplate/";
|
String path = pathPrefix + template;
|
||||||
ResourceLoader loader = new DefaultResourceLoader();
|
String templatePath = ClassUtil.classPath(path);
|
||||||
String templatePath = pathPrefix + name;
|
return new TemplateExportParams(templatePath);
|
||||||
Resource resource = loader.getResource(templatePath);
|
|
||||||
String path = resource.getFile().getAbsolutePath();
|
|
||||||
return new TemplateExportParams(path);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void exportXls(HttpServletResponse response, String template,
|
public static void exportXls(HttpServletResponse response, String template,
|
||||||
|
|
|
@ -12,7 +12,8 @@ public enum ExportTemplate {
|
||||||
SampleInfo_G("SampleInformation-G.xls"),
|
SampleInfo_G("SampleInformation-G.xls"),
|
||||||
RadionuclideActivity_G("RadionuclideActivity-G.xls"),
|
RadionuclideActivity_G("RadionuclideActivity-G.xls"),
|
||||||
SampleInfo_B("SampleInformation-B.xls"),
|
SampleInfo_B("SampleInformation-B.xls"),
|
||||||
QcResult_B("QcResult-B.xls");
|
QcResult_B("QcResult-B.xls"),
|
||||||
|
RLR_B("RLR-B.xls"),RLR_G("Gamma.RLR");
|
||||||
|
|
||||||
ExportTemplate(String name) {
|
ExportTemplate(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
BEGIN IMS2.0
|
||||||
|
MSG_TYPE DATA
|
||||||
|
MSG_ID ${header_msg_id} ${header_station_code}
|
||||||
|
DATA_TYPE MINIRLR
|
||||||
|
#Header
|
||||||
|
${header_priority_level}
|
||||||
|
${header_station_code} ${header_srid}
|
||||||
|
${header_lab_code} ${header_lab_detector}
|
||||||
|
${header_report_type} ${header_report_number}
|
||||||
|
${header_sample_category}
|
||||||
|
${header_transmission}
|
||||||
|
#Objective
|
||||||
|
~AnalysisPurpose
|
||||||
|
${Obj_purpose}
|
||||||
|
~TestsAuthorized
|
||||||
|
${Obj_authorized}
|
||||||
|
~SpecialInstructions
|
||||||
|
${Obj_instruction}
|
||||||
|
#Collection
|
||||||
|
${collect_start} ${collect_stop} ${collect_airVolume}
|
||||||
|
#SampleReceipt
|
||||||
|
${Receipt_srid}
|
||||||
|
${Receipt_sealNum}
|
||||||
|
${Receipt_sample_dateTime}
|
||||||
|
~PackageCondition
|
||||||
|
${Receipt_package}
|
||||||
|
~SealCondition
|
||||||
|
${Receipt_seal}
|
||||||
|
~SampleCondition
|
||||||
|
${Receipt_sample}
|
||||||
|
#Test
|
||||||
|
${Test_type}
|
||||||
|
${Test_completion}
|
||||||
|
${Test_person}
|
||||||
|
${Test_purpose}
|
||||||
|
#PeaksMethod
|
||||||
|
${PeakMethod_software}
|
||||||
|
${PeakMethod_location}
|
||||||
|
#PeakFit
|
||||||
|
${peakFit}
|
||||||
|
#g_AnalysisMethods
|
||||||
|
${AnalyMethod_software}
|
||||||
|
~NuclidesMethod
|
||||||
|
${AnalyMethod_nuclide}
|
||||||
|
~BaselineMethod
|
||||||
|
${AnalyMethod_baseline}
|
||||||
|
~LCMethod
|
||||||
|
${AnalyMethod_lc}
|
||||||
|
~CalibrationMethod
|
||||||
|
${AnalyMethod_calib}
|
||||||
|
#PeakAssociation
|
||||||
|
${Association}
|
||||||
|
#References
|
||||||
|
~SAMPLEPHD
|
||||||
|
${Reference_samplePHD}
|
||||||
|
~CALIBPHD
|
||||||
|
${Reference_CalibPHD}
|
||||||
|
~PhysicalConstants
|
||||||
|
${Reference_physical}
|
||||||
|
#Results
|
||||||
|
${Result_act_ref} ${Result_conc_ref}
|
||||||
|
${Result}
|
||||||
|
#NuclideRatios
|
||||||
|
#g_CoincidenceCorrection
|
||||||
|
#MDA
|
||||||
|
#Conclusions
|
||||||
|
${conclusion_person}
|
||||||
|
~IDCSummary
|
||||||
|
${Conclusion_IDC}
|
||||||
|
~Labsummary
|
||||||
|
${Conclusion_Lab}
|
||||||
|
~ResultComparison
|
||||||
|
${Conclusion_Res}
|
||||||
|
#Comment
|
||||||
|
${Comment}
|
||||||
|
STOP
|
BIN
jeecg-boot-base-core/src/main/resources/excelTemplate/RLR-B.xls
Normal file
BIN
jeecg-boot-base-core/src/main/resources/excelTemplate/RLR-B.xls
Normal file
Binary file not shown.
|
@ -3,13 +3,16 @@ package org.jeecg.modules.controller;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.ReUtil;
|
import cn.hutool.core.util.ReUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.util.ClassUtil;
|
import org.jeecg.common.util.ClassUtil;
|
||||||
|
import org.jeecg.common.util.ExportUtil;
|
||||||
import org.jeecg.modules.base.bizVo.GammaRLR;
|
import org.jeecg.modules.base.bizVo.GammaRLR;
|
||||||
|
import org.jeecg.modules.base.enums.ExportTemplate;
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
import org.jeecg.modules.service.IGammaService;
|
import org.jeecg.modules.service.IGammaService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -18,6 +21,9 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -25,6 +31,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.jeecg.modules.base.enums.ExportTemplate.RLR_B;
|
||||||
|
import static org.jeecg.modules.base.enums.ExportTemplate.RLR_G;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("gamma")
|
@RequestMapping("gamma")
|
||||||
@Api(value = "gamma人工分析",tags = "gamma人工分析")
|
@Api(value = "gamma人工分析",tags = "gamma人工分析")
|
||||||
|
@ -316,57 +325,10 @@ public class GammaController {
|
||||||
return gammaService.viewRLR(sampleId, fileName);
|
return gammaService.viewRLR(sampleId, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("exportRLR")
|
@PostMapping ("exportRLR")
|
||||||
@ApiOperation(value = "导出RLR页面数据", notes = "导出RLR页面数据")
|
@ApiOperation(value = "导出RLR页面数据", notes = "导出RLR页面数据")
|
||||||
public void exportRLR(Integer sampleId, String fileName, HttpServletResponse response) {
|
public void exportRLR(@RequestBody GammaRLR gammaRLR, HttpServletResponse response) {
|
||||||
|
gammaService.exportRLR(gammaRLR, response);
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String template = "D:\\Share\\Gamma\\Gamma.RLR";
|
|
||||||
GammaRLR gammaRLR = new GammaRLR();
|
|
||||||
gammaRLR.setAnalyMethod_lc("我是测试数据");
|
|
||||||
List<String> lines = FileUtil.readUtf8Lines(template);
|
|
||||||
// 正则表达式,匹配${}中的内容
|
|
||||||
String regex = "\\$\\{([^}]+)}";
|
|
||||||
List<String> newLines = new ArrayList<>();
|
|
||||||
List<String> list = ListUtil.toList("peakFit","Association","Result");
|
|
||||||
for (String line : lines) {
|
|
||||||
if (StrUtil.isBlank(line)) continue;
|
|
||||||
List<String> fieldNames = ReUtil.findAllGroup1(regex, line);
|
|
||||||
if (CollUtil.isEmpty(fieldNames)){
|
|
||||||
newLines.add(line);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Map<String, Object> fieldValue = ClassUtil.fieldValue(gammaRLR, fieldNames);
|
|
||||||
for (Map.Entry<String, Object> entry : fieldValue.entrySet()) {
|
|
||||||
String fieldName = entry.getKey();
|
|
||||||
Object value = entry.getValue();
|
|
||||||
if (list.contains(fieldName)){
|
|
||||||
List<String> lineList = new ArrayList<>();
|
|
||||||
switch (fieldName){
|
|
||||||
case "peakFit":
|
|
||||||
lineList = ClassUtil.objsStr((List<TablePeakFit>)value);
|
|
||||||
break;
|
|
||||||
case "Association":
|
|
||||||
lineList = ClassUtil.objsStr((List<TableAssociation>)value);
|
|
||||||
break;
|
|
||||||
case "Result":
|
|
||||||
lineList = ClassUtil.objsStr((List<TableResult>)value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
newLines.addAll(lineList);
|
|
||||||
}else {
|
|
||||||
String search = "${" + fieldName + "}";
|
|
||||||
String newLine = StrUtil.replace(line, search, value.toString());
|
|
||||||
newLines.add(newLine);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String output = "C:\\Users\\a\\Desktop\\";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("viewAutomaticAnalysisLog")
|
@GetMapping("viewAutomaticAnalysisLog")
|
||||||
|
|
|
@ -128,6 +128,12 @@ public class SpectrumAnalysesController {
|
||||||
return spectrumAnalysisService.viewRLR(sampleId);
|
return spectrumAnalysisService.viewRLR(sampleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("exportRLR")
|
||||||
|
@ApiOperation(value = "导出RLR数据", notes = "导出RLR数据")
|
||||||
|
public void exportRLR(Integer sampleId, HttpServletResponse response) {
|
||||||
|
spectrumAnalysisService.exportRLR(sampleId, response);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("viewGammaDetectorCalibration")
|
@GetMapping("viewGammaDetectorCalibration")
|
||||||
@ApiOperation(value = "查询GammaDetectorCalibration数据", notes = "查询GammaDetectorCalibration数据")
|
@ApiOperation(value = "查询GammaDetectorCalibration数据", notes = "查询GammaDetectorCalibration数据")
|
||||||
public Result viewGammaDetectorCalibration(Integer sampleId) {
|
public Result viewGammaDetectorCalibration(Integer sampleId) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.jeecg.modules.service;
|
package org.jeecg.modules.service;
|
||||||
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.modules.base.bizVo.GammaRLR;
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
@ -107,7 +108,7 @@ public interface IGammaService{
|
||||||
|
|
||||||
Result viewRLR(Integer sampleId, String fileName);
|
Result viewRLR(Integer sampleId, String fileName);
|
||||||
|
|
||||||
void exportRLR(Integer sampleId, String fileName, HttpServletResponse response);
|
void exportRLR(GammaRLR gammaRLR, HttpServletResponse response);
|
||||||
|
|
||||||
void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response);
|
void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response);
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,8 @@ public interface ISpectrumAnalysisService {
|
||||||
|
|
||||||
Result viewRLR(Integer sampleId);
|
Result viewRLR(Integer sampleId);
|
||||||
|
|
||||||
|
void exportRLR(Integer sampleId, HttpServletResponse response);
|
||||||
|
|
||||||
Result viewGammaDetectorCalibration(Integer sampleId);
|
Result viewGammaDetectorCalibration(Integer sampleId);
|
||||||
|
|
||||||
Result viewBetaDetectorCalibration(Integer sampleId);
|
Result viewBetaDetectorCalibration(Integer sampleId);
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package org.jeecg.modules.service.impl;
|
package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.ReUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
|
@ -19,6 +22,7 @@ import org.jeecg.common.constant.DateConstant;
|
||||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||||
import org.jeecg.common.system.util.JwtUtil;
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
import org.jeecg.common.util.*;
|
import org.jeecg.common.util.*;
|
||||||
|
import org.jeecg.modules.base.bizVo.GammaRLR;
|
||||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||||
import org.jeecg.modules.base.enums.ExportTemplate;
|
import org.jeecg.modules.base.enums.ExportTemplate;
|
||||||
import org.jeecg.modules.base.enums.RoleType;
|
import org.jeecg.modules.base.enums.RoleType;
|
||||||
|
@ -48,6 +52,7 @@ import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.jeecg.modules.base.enums.ExportTemplate.RLR_G;
|
||||||
import static org.jeecg.modules.base.enums.ExportTemplate.SampleInfo_G;
|
import static org.jeecg.modules.base.enums.ExportTemplate.SampleInfo_G;
|
||||||
|
|
||||||
@Service(value = "gammaService")
|
@Service(value = "gammaService")
|
||||||
|
@ -2046,12 +2051,69 @@ public class GammaServiceImpl implements IGammaService {
|
||||||
result.setResult(map);
|
result.setResult(map);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportRLR(Integer sampleId, String fileName, HttpServletResponse response) {
|
public void exportRLR(GammaRLR gammaRLR, HttpServletResponse response) {
|
||||||
|
String pathPrefix = "excelTemplate/";
|
||||||
|
String path = pathPrefix + RLR_G.getName();
|
||||||
|
String template = ClassUtil.classPath(path);
|
||||||
|
List<String> lines = FileUtil.readUtf8Lines(template);
|
||||||
|
// 正则表达式,匹配${}中的内容
|
||||||
|
String regex = "\\$\\{([^}]+)}";
|
||||||
|
List<String> newLines = new ArrayList<>();
|
||||||
|
List<String> list = ListUtil.toList("peakFit","Association","Result");
|
||||||
|
List<String> skip = ListUtil.toList("${peakFit}","${Association}","${Result}");
|
||||||
|
for (String line : lines) {
|
||||||
|
if (StrUtil.isBlank(line)) continue;
|
||||||
|
List<String> fieldNames = ReUtil.findAllGroup1(regex, line);
|
||||||
|
if (CollUtil.isEmpty(fieldNames)){
|
||||||
|
newLines.add(line);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Map<String, Object> fieldValue = ClassUtil.fieldValue(gammaRLR, fieldNames);
|
||||||
|
String newLine = line;
|
||||||
|
for (Map.Entry<String, Object> entry : fieldValue.entrySet()) {
|
||||||
|
String fieldName = entry.getKey();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
if (list.contains(fieldName)){
|
||||||
|
List<String> lineList = new ArrayList<>();
|
||||||
|
switch (fieldName){
|
||||||
|
case "peakFit":
|
||||||
|
lineList = ClassUtil.objsStr((List<TablePeakFit>)value);
|
||||||
|
break;
|
||||||
|
case "Association":
|
||||||
|
lineList = ClassUtil.objsStr((List<TableAssociation>)value);
|
||||||
|
break;
|
||||||
|
case "Result":
|
||||||
|
lineList = ClassUtil.objsStr((List<TableResult>)value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
newLines.addAll(lineList);
|
||||||
|
}else {
|
||||||
|
String search = "${" + fieldName + "}";
|
||||||
|
String replacement = StrUtil.toString(value);
|
||||||
|
replacement = StrUtil.isBlank(replacement) ? "null" : replacement;
|
||||||
|
newLine = StrUtil.replace(newLine, search, replacement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!CollUtil.contains(skip, newLine))
|
||||||
|
newLines.add(newLine);
|
||||||
|
}
|
||||||
|
PrintWriter writer = null;
|
||||||
|
try {
|
||||||
|
String export = "Gamma.RLR";
|
||||||
|
writer = ExportUtil.streamWriter(response, export);
|
||||||
|
for (String newLine : newLines) {
|
||||||
|
writer.println(newLine);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}finally {
|
||||||
|
if (ObjectUtil.isNotNull(writer))
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) {
|
public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) {
|
||||||
if (Objects.isNull(sampleId)){
|
if (Objects.isNull(sampleId)){
|
||||||
|
|
|
@ -45,8 +45,7 @@ import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.jeecg.modules.base.enums.ExportTemplate.QcResult_B;
|
import static org.jeecg.modules.base.enums.ExportTemplate.*;
|
||||||
import static org.jeecg.modules.base.enums.ExportTemplate.SampleInfo_B;
|
|
||||||
|
|
||||||
@Service("spectrumAnalysisService")
|
@Service("spectrumAnalysisService")
|
||||||
@DS("ora")
|
@DS("ora")
|
||||||
|
@ -1455,6 +1454,18 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exportRLR(Integer sampleId, HttpServletResponse response) {
|
||||||
|
Result<?> result = viewRLR(sampleId);
|
||||||
|
RlrDataValues rlrDataValues = (RlrDataValues)result.getResult();
|
||||||
|
Map<String,Object> dataMap = BeanUtil.beanToMap(rlrDataValues);
|
||||||
|
// 将Null值替换为"",避免空指针异常(或者在模板中进行判断)
|
||||||
|
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
||||||
|
String export = "RLR-Beta.xls";
|
||||||
|
String template = RLR_B.getName();
|
||||||
|
ExportUtil.exportXls(response, template, dataMap,export);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result viewGammaDetectorCalibration(Integer sampleId) {
|
public Result viewGammaDetectorCalibration(Integer sampleId) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user