feat:ExportFile
This commit is contained in:
parent
a210b75205
commit
61f328d577
|
@ -258,5 +258,25 @@
|
|||
<artifactId>commons-net</artifactId>
|
||||
<version>3.3</version>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>org.jxls</groupId>
|
||||
<artifactId>jxls</artifactId>
|
||||
<version>2.6.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jxls</groupId>
|
||||
<artifactId>jxls-poi</artifactId>
|
||||
<version>1.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jxls</groupId>
|
||||
<artifactId>jxls-jexcel</artifactId>
|
||||
<version>1.0.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jxls</groupId>
|
||||
<artifactId>jxls-reader</artifactId>
|
||||
<version>2.0.5</version>
|
||||
</dependency>-->
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,10 +1,19 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.jeecg.modules.base.dto.QCResultDto;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ExportUtil {
|
||||
|
||||
|
@ -33,4 +42,63 @@ public class ExportUtil {
|
|||
response.setHeader("Content-disposition", "attachment;filename=" + name);
|
||||
return response.getOutputStream();
|
||||
}
|
||||
|
||||
public static <T> void exportXls(HttpServletResponse response, Class<T> target,
|
||||
List<T> data, String sheetName, String fileName){
|
||||
ExportParams params = new ExportParams();
|
||||
params.setSheetName(sheetName);
|
||||
Workbook workbook = null;
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
// 设置文件名、Excel类型(xls|xlsx)
|
||||
outputStream = ExportUtil.xls(response,fileName);
|
||||
workbook = ExcelExportUtil.
|
||||
exportExcel(params, target, data);
|
||||
workbook.write(outputStream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
if (ObjectUtil.isNotNull(outputStream))
|
||||
outputStream.close();
|
||||
if (ObjectUtil.isNotNull(workbook))
|
||||
workbook.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> void exportXls(HttpServletResponse response, Class<T> target, List<T> data){
|
||||
exportXls(response, target, data, "sheet1", "file");
|
||||
}
|
||||
|
||||
public static TemplateExportParams excelTemplate(String name){
|
||||
//return new TemplateExportParams("C:/Users/a/Desktop/"+ name +".xlsx");
|
||||
return new TemplateExportParams("E:\\Code\\IDEA\\AnalysisSystemForRadionuclide\\jeecg-boot-base-core\\src\\main\\resources\\excelTemplate\\"+ name +".xlsx");
|
||||
}
|
||||
|
||||
public static void exportXls(HttpServletResponse response, String template,
|
||||
Map<String,Object> data, String fileName){
|
||||
TemplateExportParams params = excelTemplate(template);
|
||||
Workbook workbook = null;
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
// 设置文件名、Excel类型(xls|xlsx)
|
||||
outputStream = ExportUtil.xls(response,fileName);
|
||||
workbook = ExcelExportUtil.exportExcel(params, data);
|
||||
workbook.write(outputStream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
if (ObjectUtil.isNotNull(outputStream))
|
||||
outputStream.close();
|
||||
if (ObjectUtil.isNotNull(workbook))
|
||||
workbook.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.base.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
@Data
|
||||
public class QCResultDto {
|
||||
|
||||
@Excel(name = "Name",orderNum = "1",width = 30)
|
||||
private String fieldName;
|
||||
|
||||
@Excel(name = "Value",orderNum = "2",width = 10)
|
||||
private Object fieldValue;
|
||||
}
|
|
@ -1,18 +1,23 @@
|
|||
package org.jeecg.modules.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class TableQCResult implements Serializable {
|
||||
|
||||
@Excel(name = "Name",orderNum = "1",width = 20)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "Flag",orderNum = "2",width = 10)
|
||||
private String flag;
|
||||
|
||||
@Excel(name = "Value",orderNum = "3",width = 15)
|
||||
private double value;
|
||||
|
||||
@Excel(name = "Standard",orderNum = "4",width = 30)
|
||||
private String standard;
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -62,7 +62,7 @@ public class Sample_G_Analysis {
|
|||
saveNuclIded(middleData,sampleId,IdAnalysis);
|
||||
/* Gards_Qc_Check 数据表保存 */
|
||||
saveQcCheck(middleData,sampleId,IdAnalysis);
|
||||
// 收尾处理 ==> 写日志文件和报告文件
|
||||
/** 收尾处理 ==> 写日志文件和报告文件 **/
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
|
|
|
@ -75,19 +75,21 @@ public class GammaFileUtil {
|
|||
pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + pathName;
|
||||
ftpClient.changeWorkingDirectory(pathName);
|
||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
ftpFiles = ftpFiles.stream().filter(item-> item.getName().equals(fileName)).collect(Collectors.toList());
|
||||
if (ftpFiles.size() == 0){
|
||||
ftpFiles = ftpFiles.stream().filter(item -> item.getName().equals(fileName)).collect(Collectors.toList());
|
||||
if (ftpFiles.size() == 0) {
|
||||
result.error500("ftp获取文件数据失败");
|
||||
return false;
|
||||
}
|
||||
FTPFile ftpFile = ftpFiles.get(0);
|
||||
if (Objects.nonNull(ftpFile)){
|
||||
if (Objects.nonNull(ftpFile)) {
|
||||
InputStream inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
||||
//声明一个临时文件
|
||||
File file = File.createTempFile("tmp", null);
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||
//读取文件信息
|
||||
//String path = "C:\\Users\\a\\Desktop\\AUX04_005-20230601_1405_S_FULL_40186.PHD";
|
||||
//EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(path);
|
||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||
//MsgInfo
|
||||
phd.getMsgInfo().setMsg_id(struct.msg_id);
|
||||
|
@ -109,64 +111,64 @@ public class GammaFileUtil {
|
|||
//Comment
|
||||
phd.setOriTotalCmt(struct.comment);
|
||||
//Collection
|
||||
if (StringUtils.isNotBlank(struct.collection_start_date) || StringUtils.isNotBlank(struct.collection_start_time) || StringUtils.isNotBlank(struct.collection_stop_date) || StringUtils.isNotBlank(struct.collection_stop_time) || Objects.nonNull(struct.air_volume)){
|
||||
if (StringUtils.isNotBlank(struct.collection_start_date) || StringUtils.isNotBlank(struct.collection_start_time) || StringUtils.isNotBlank(struct.collection_stop_date) || StringUtils.isNotBlank(struct.collection_stop_time) || Objects.nonNull(struct.air_volume)) {
|
||||
phd.getCollect().setCollection_start_date(struct.collection_start_date);
|
||||
phd.getCollect().setCollection_start_time(struct.collection_start_time);
|
||||
phd.getCollect().setCollection_stop_date(struct.collection_stop_date);
|
||||
phd.getCollect().setCollection_stop_time(struct.collection_stop_time);
|
||||
phd.getCollect().setAir_volume(struct.air_volume);
|
||||
if(phd.getCollect().getCollection_start_time().indexOf('.')<0) {
|
||||
phd.getCollect().setCollection_start_time(phd.getCollect().getCollection_start_time()+".0");
|
||||
if (phd.getCollect().getCollection_start_time().indexOf('.') < 0) {
|
||||
phd.getCollect().setCollection_start_time(phd.getCollect().getCollection_start_time() + ".0");
|
||||
}
|
||||
if(phd.getCollect().getCollection_stop_time().indexOf('.')<0) {
|
||||
phd.getCollect().setCollection_stop_time(phd.getCollect().getCollection_stop_time()+".0");
|
||||
if (phd.getCollect().getCollection_stop_time().indexOf('.') < 0) {
|
||||
phd.getCollect().setCollection_stop_time(phd.getCollect().getCollection_stop_time() + ".0");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
phd.getCollect().setAir_volume(0.0);
|
||||
}
|
||||
//Acquisition
|
||||
if (StringUtils.isNotBlank(struct.acquisition_start_date) || StringUtils.isNotBlank(struct.acquisition_start_time) || Objects.nonNull(struct.acquisition_real_time) || Objects.nonNull(struct.acquisition_live_time)){
|
||||
if (StringUtils.isNotBlank(struct.acquisition_start_date) || StringUtils.isNotBlank(struct.acquisition_start_time) || Objects.nonNull(struct.acquisition_real_time) || Objects.nonNull(struct.acquisition_live_time)) {
|
||||
phd.getAcq().setAcquisition_start_date(struct.acquisition_start_date);
|
||||
phd.getAcq().setAcquisition_start_time(struct.acquisition_start_time);
|
||||
phd.getAcq().setAcquisition_real_time(struct.acquisition_real_time);
|
||||
phd.getAcq().setAcquisition_live_time(struct.acquisition_live_time);
|
||||
if(phd.getAcq().getAcquisition_start_time().indexOf('.')<0) {
|
||||
phd.getAcq().setAcquisition_start_time(phd.getAcq().getAcquisition_start_time()+".0");
|
||||
if (phd.getAcq().getAcquisition_start_time().indexOf('.') < 0) {
|
||||
phd.getAcq().setAcquisition_start_time(phd.getAcq().getAcquisition_start_time() + ".0");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
phd.getAcq().setAcquisition_live_time(0.0);
|
||||
phd.getAcq().setAcquisition_real_time(0.0);
|
||||
}
|
||||
//Processing
|
||||
if (Objects.nonNull(struct.sample_volume_of_Xe) || Objects.nonNull(struct.uncertainty_1) || Objects.nonNull(struct.Xe_collection_yield) || Objects.nonNull(struct.uncertainty_2) || StringUtils.isNotBlank(struct.archive_bottle_id) ){
|
||||
if (Objects.nonNull(struct.sample_volume_of_Xe) || Objects.nonNull(struct.uncertainty_1) || Objects.nonNull(struct.Xe_collection_yield) || Objects.nonNull(struct.uncertainty_2) || StringUtils.isNotBlank(struct.archive_bottle_id)) {
|
||||
phd.getProcess().setSample_volume_of_Xe(struct.sample_volume_of_Xe);
|
||||
phd.getProcess().setUncertainty_1(struct.uncertainty_1);
|
||||
phd.getProcess().setXe_collection_yield(struct.Xe_collection_yield);
|
||||
phd.getProcess().setUncertainty_2(struct.uncertainty_2);
|
||||
phd.getProcess().setArchive_bottle_id(struct.archive_bottle_id);
|
||||
}else {
|
||||
} else {
|
||||
phd.getProcess().setSample_volume_of_Xe(0.0);
|
||||
phd.getProcess().setXe_collection_yield(0.0);
|
||||
phd.getProcess().setUncertainty_1(0.0);
|
||||
phd.getProcess().setUncertainty_2(0.0);
|
||||
}
|
||||
//Sample
|
||||
if (Objects.nonNull(struct.dimension_1) || Objects.nonNull(struct.dimension_2)){
|
||||
if (Objects.nonNull(struct.dimension_1) || Objects.nonNull(struct.dimension_2)) {
|
||||
phd.getSampleBlock().setDimension_1(struct.dimension_1);
|
||||
phd.getSampleBlock().setDimension_2(struct.dimension_2);
|
||||
}else {
|
||||
} else {
|
||||
phd.getSampleBlock().setDimension_1(0.0);
|
||||
phd.getSampleBlock().setDimension_2(0.0);
|
||||
}
|
||||
//Calibration
|
||||
if (StringUtils.isNotBlank(struct.date_calibration) || StringUtils.isNotBlank(struct.time_calibration)){
|
||||
if (StringUtils.isNotBlank(struct.date_calibration) || StringUtils.isNotBlank(struct.time_calibration)) {
|
||||
phd.getCalibration().setDate_calibration(struct.date_calibration);
|
||||
phd.getCalibration().setTime_calibration(struct.time_calibration);
|
||||
}
|
||||
//Certificate
|
||||
if (Objects.nonNull(struct.total_source_activity) || StringUtils.isNotBlank(struct.assay_date) || StringUtils.isNotBlank(struct.assay_time) || StringUtils.isNotBlank(struct.units_activity) || CollectionUtils.isNotEmpty(struct.nuclide_name)
|
||||
if (Objects.nonNull(struct.total_source_activity) || StringUtils.isNotBlank(struct.assay_date) || StringUtils.isNotBlank(struct.assay_time) || StringUtils.isNotBlank(struct.units_activity) || CollectionUtils.isNotEmpty(struct.nuclide_name)
|
||||
|| CollectionUtils.isNotEmpty(struct.half_life_time) || CollectionUtils.isNotEmpty(struct.time_unit) || CollectionUtils.isNotEmpty(struct.activity_nuclide_time_assay) || CollectionUtils.isNotEmpty(struct.uncertainty)
|
||||
|| CollectionUtils.isNotEmpty(struct.cer_g_energy) || CollectionUtils.isNotEmpty(struct.g_intensity) || CollectionUtils.isNotEmpty(struct.electron_decay_mode) || CollectionUtils.isNotEmpty(struct.maximum_energy) || CollectionUtils.isNotEmpty(struct.intensity_b_particle) || Objects.nonNull(struct.record_count)){
|
||||
|| CollectionUtils.isNotEmpty(struct.cer_g_energy) || CollectionUtils.isNotEmpty(struct.g_intensity) || CollectionUtils.isNotEmpty(struct.electron_decay_mode) || CollectionUtils.isNotEmpty(struct.maximum_energy) || CollectionUtils.isNotEmpty(struct.intensity_b_particle) || Objects.nonNull(struct.record_count)) {
|
||||
phd.getCertificate().setTotal_source_activity(struct.total_source_activity);
|
||||
phd.getCertificate().setAssay_date(struct.assay_date);
|
||||
phd.getCertificate().setAssay_time(struct.assay_time);
|
||||
|
@ -184,23 +186,23 @@ public class GammaFileUtil {
|
|||
phd.getCertificate().setRecord_count(struct.record_count);
|
||||
}
|
||||
//g_Spectrum
|
||||
if (Objects.nonNull(struct.num_g_channel) || Objects.nonNull(struct.g_energy_span) || Objects.nonNull(struct.g_begin_channel) || CollectionUtils.isNotEmpty(struct.g_counts)){
|
||||
if (Objects.nonNull(struct.num_g_channel) || Objects.nonNull(struct.g_energy_span) || Objects.nonNull(struct.g_begin_channel) || CollectionUtils.isNotEmpty(struct.g_counts)) {
|
||||
phd.getSpec().setNum_g_channel(struct.num_g_channel);
|
||||
phd.getSpec().setG_energy_span(struct.g_energy_span);
|
||||
phd.getSpec().setBegin_channel(struct.g_begin_channel);
|
||||
phd.getSpec().setCounts(struct.g_counts);
|
||||
int i=0;
|
||||
for (;i<phd.getSpec().getNum_g_channel();++i){
|
||||
if(phd.getSpec().getCounts().get(i) > 0){
|
||||
int i = 0;
|
||||
for (; i < phd.getSpec().getNum_g_channel(); ++i) {
|
||||
if (phd.getSpec().getCounts().get(i) > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i == phd.getSpec().getNum_g_channel()){
|
||||
if (i == phd.getSpec().getNum_g_channel()) {
|
||||
phd.setValid(false);
|
||||
}
|
||||
}
|
||||
//g_Energy
|
||||
if (CollectionUtils.isNotEmpty(struct.g_energy) || CollectionUtils.isNotEmpty(struct.g_centroid_channel) || CollectionUtils.isNotEmpty(struct.g_uncertainty) || Objects.nonNull(struct.g_record_count)){
|
||||
if (CollectionUtils.isNotEmpty(struct.g_energy) || CollectionUtils.isNotEmpty(struct.g_centroid_channel) || CollectionUtils.isNotEmpty(struct.g_uncertainty) || Objects.nonNull(struct.g_record_count)) {
|
||||
GEnergyBlock gEnergyBlock = new GEnergyBlock();
|
||||
gEnergyBlock.setG_energy(struct.g_energy);
|
||||
gEnergyBlock.setCentroid_channel(struct.g_centroid_channel);
|
||||
|
@ -209,7 +211,7 @@ public class GammaFileUtil {
|
|||
phd.getMapEnerKD().put(CalName.CalPHD.getType(), gEnergyBlock);
|
||||
}
|
||||
//g_Resolution
|
||||
if (CollectionUtils.isNotEmpty(struct.g_r_energy) || CollectionUtils.isNotEmpty(struct.g_r_FWHM) || CollectionUtils.isNotEmpty(struct.g_r_uncertainty) || Objects.nonNull(struct.g_r_record_count)){
|
||||
if (CollectionUtils.isNotEmpty(struct.g_r_energy) || CollectionUtils.isNotEmpty(struct.g_r_FWHM) || CollectionUtils.isNotEmpty(struct.g_r_uncertainty) || Objects.nonNull(struct.g_r_record_count)) {
|
||||
GResolutionBlock gResolutionBlock = new GResolutionBlock();
|
||||
gResolutionBlock.setG_energy(struct.g_r_energy);
|
||||
gResolutionBlock.setFWHM(struct.g_r_FWHM);
|
||||
|
@ -218,7 +220,7 @@ public class GammaFileUtil {
|
|||
phd.getMapResoKD().put(CalName.CalPHD.getType(), gResolutionBlock);
|
||||
}
|
||||
//g_Efficiency
|
||||
if (CollectionUtils.isNotEmpty(struct.g_e_energy) || CollectionUtils.isNotEmpty(struct.g_e_efficiency) || CollectionUtils.isNotEmpty(struct.g_e_uncertainty) || Objects.nonNull(struct.g_e_record_count)){
|
||||
if (CollectionUtils.isNotEmpty(struct.g_e_energy) || CollectionUtils.isNotEmpty(struct.g_e_efficiency) || CollectionUtils.isNotEmpty(struct.g_e_uncertainty) || Objects.nonNull(struct.g_e_record_count)) {
|
||||
GEfficiencyBlock gEfficiencyBlock = new GEfficiencyBlock();
|
||||
gEfficiencyBlock.setG_energy(struct.g_e_energy);
|
||||
gEfficiencyBlock.setEfficiency(struct.g_e_efficiency);
|
||||
|
@ -227,7 +229,7 @@ public class GammaFileUtil {
|
|||
phd.getMapEffiKD().put(CalName.CalPHD.getType(), gEfficiencyBlock);
|
||||
}
|
||||
//TotalEff
|
||||
if (CollectionUtils.isNotEmpty(struct.t_g_energy) || CollectionUtils.isNotEmpty(struct.total_efficiency) || CollectionUtils.isNotEmpty(struct.t_uncertainty) || Objects.nonNull(struct.t_record_count)){
|
||||
if (CollectionUtils.isNotEmpty(struct.t_g_energy) || CollectionUtils.isNotEmpty(struct.total_efficiency) || CollectionUtils.isNotEmpty(struct.t_uncertainty) || Objects.nonNull(struct.t_record_count)) {
|
||||
TotaleffBlock totaleffBlock = new TotaleffBlock();
|
||||
totaleffBlock.setG_energy(struct.t_g_energy);
|
||||
totaleffBlock.setTotal_efficiency(struct.total_efficiency);
|
||||
|
@ -237,18 +239,19 @@ public class GammaFileUtil {
|
|||
}
|
||||
|
||||
// 初始化默认分析设置
|
||||
if(phd.getHeader().getSystem_type().equals("P")) {
|
||||
if (phd.getHeader().getSystem_type().equals("P")) {
|
||||
phd.getSetting().setECutAnalysis_Low(35.0);
|
||||
phd.getSetting().setBUpdateCal(true);
|
||||
}
|
||||
phd.getSetting().setRefTime_conc(DateUtils.parseDate(phd.getCollect().getCollection_start_date() + " " + phd.getCollect().getCollection_start_time().substring(0, phd.getCollect().getCollection_start_time().indexOf(StringPool.DOT)),"yyyy/MM/dd HH:mm:ss"));
|
||||
phd.getSetting().setRefTime_act(DateUtils.parseDate(phd.getAcq().getAcquisition_start_date() + " " + phd.getAcq().getAcquisition_start_time().substring(0, phd.getAcq().getAcquisition_start_time().indexOf(StringPool.DOT)),"yyyy/MM/dd HH:mm:ss"));
|
||||
phd.getSetting().setRefTime_conc(DateUtils.parseDate(phd.getCollect().getCollection_start_date() + " " + phd.getCollect().getCollection_start_time().substring(0, phd.getCollect().getCollection_start_time().indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss"));
|
||||
phd.getSetting().setRefTime_act(DateUtils.parseDate(phd.getAcq().getAcquisition_start_date() + " " + phd.getAcq().getAcquisition_start_time().substring(0, phd.getAcq().getAcquisition_start_time().indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss"));
|
||||
phd.setUsedSetting(phd.getSetting());
|
||||
|
||||
phd.setBAnalyed(false);
|
||||
phd.setAnaly_start_time(DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss"));
|
||||
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.vo.ChangeData;
|
||||
import org.jeecg.modules.entity.vo.CoeffData;
|
||||
import org.jeecg.modules.entity.vo.ConfigureData;
|
||||
import org.jeecg.modules.entity.vo.InputData;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.service.IGammaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -189,11 +187,25 @@ public class GammaController {
|
|||
return gammaService.sampleInformation(sampleId, fileName);
|
||||
}
|
||||
|
||||
@GetMapping("exportSampleInformation")
|
||||
public void exportSampleInformation(Integer sampleId, String fileName,
|
||||
HttpServletResponse response){
|
||||
gammaService.exportSampleInformation(sampleId, fileName, response);
|
||||
}
|
||||
|
||||
@GetMapping("viewQCResult")
|
||||
public Result viewQCResult(Integer sampleId, String fileName){
|
||||
public Result<List<TableQCResult>> viewQCResult(Integer sampleId, String fileName){
|
||||
return gammaService.viewQCResult(sampleId, fileName);
|
||||
}
|
||||
|
||||
@GetMapping("exportQCResult")
|
||||
public void exportQCResult(Integer sampleId, String fileName,HttpServletResponse response){
|
||||
Result<List<TableQCResult>> result = gammaService.viewQCResult(sampleId, fileName);
|
||||
List<TableQCResult> tableQCResults = result.getResult();
|
||||
if (CollUtil.isEmpty(tableQCResults))return;
|
||||
gammaService.exportQCResult(tableQCResults,response);
|
||||
}
|
||||
|
||||
@GetMapping("viewRLR")
|
||||
public Result viewRLR(Integer sampleId, String fileName){
|
||||
return gammaService.viewRLR(sampleId, fileName);
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
|
||||
import org.jeecg.modules.entity.vo.AnalyseData;
|
||||
import org.jeecg.modules.entity.vo.BgDataAnlyseResultIn;
|
||||
import org.jeecg.modules.entity.vo.FittingBody;
|
||||
import org.jeecg.modules.entity.vo.StatisticsQueryData;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.service.ISpectrumAnalysisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
@ -103,6 +102,16 @@ public class SpectrumAnalysesController {
|
|||
return spectrumAnalysisService.viewQCResult(sampleId);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("exportQCResult")
|
||||
@ApiOperation(value = "导出QC Result数据", notes = "导出QC Result数据")
|
||||
public void exportQCResult(Integer sampleId,HttpServletResponse response){
|
||||
Result<QCResult> result = spectrumAnalysisService.viewQCResult(sampleId);
|
||||
QCResult qcResult = result.getResult();
|
||||
if (ObjectUtil.isNull(qcResult))return;
|
||||
spectrumAnalysisService.exportQCResult(qcResult,response);
|
||||
}
|
||||
|
||||
@GetMapping("viewRLR")
|
||||
@ApiOperation(value = "查看RLR数据", notes = "查看RLR数据")
|
||||
public Result viewRLR(Integer sampleId){
|
||||
|
@ -183,4 +192,12 @@ public class SpectrumAnalysesController {
|
|||
return spectrumAnalysisService.saveToDB(anlyseResultIn);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String str = "\n#FILE INFORMATION\n SampleMeasID: AUX04_005-2023/06/18-14:05\n GASBKMeasID: AUX04_005-2023/06/18-02:05\n DETBKMeasID: AUX04_005-2022/04/22-13:27\n SRID: 04202306171811X\n\n#COLLECTION INFORMATION\n Station CODE: AUX04\n Detector CODE: AUX04_005\n Sample ID: 426132\n Collection Start: 2023/06/17 18:54:10\n Collection Stop: 2023/06/18 06:54:08\n Collection TIME: 43198.00\n Sample Volume[m3]: 14.410883\n Xe Volume[cm3]: 1.00978\n\n#ACQUISITION INFORMATION\n Acquisition Start: 2023/06/18 14:05:09\n Acq Real Time: 40200.803\n Acq Live Time: 40187.202\n\n";
|
||||
String[] parts = str.split("\\n");
|
||||
|
||||
for (String part : parts) {
|
||||
System.out.println(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.jeecg.modules.entity.vo.*;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IGammaService{
|
||||
|
||||
|
@ -72,9 +73,14 @@ public interface IGammaService{
|
|||
|
||||
Result Spectrum(Integer sampleId, String fileName);
|
||||
|
||||
Result sampleInformation(Integer sampleId, String fileName);
|
||||
Result<Map<String, String>> sampleInformation(Integer sampleId, String fileName);
|
||||
|
||||
Result viewQCResult(Integer sampleId, String fileName);
|
||||
void exportSampleInformation(Integer sampleId, String fileName,
|
||||
HttpServletResponse response);
|
||||
|
||||
Result<List<TableQCResult>> viewQCResult(Integer sampleId, String fileName);
|
||||
|
||||
void exportQCResult(List<TableQCResult> data,HttpServletResponse response);
|
||||
|
||||
Result viewRLR(Integer sampleId, String fileName);
|
||||
|
||||
|
|
|
@ -37,7 +37,9 @@ public interface ISpectrumAnalysisService {
|
|||
|
||||
Result viewSampleInformation(Integer sampleId);
|
||||
|
||||
Result viewQCResult(Integer sampleId);
|
||||
Result<QCResult> viewQCResult(Integer sampleId);
|
||||
|
||||
void exportQCResult(QCResult qcResult,HttpServletResponse response);
|
||||
|
||||
Result viewRLR(Integer sampleId);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
|
@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|||
import com.google.common.cache.Cache;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.jeecg.common.Excel.ExportExcel;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.cache.LocalCache;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
|
@ -20,15 +22,17 @@ import org.jeecg.modules.entity.*;
|
|||
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
|
||||
import org.jeecg.modules.native_jni.CalValuesHandler;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -1432,8 +1436,8 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result sampleInformation(Integer sampleId, String fileName) {
|
||||
Result result = new Result();
|
||||
public Result<Map<String, String>> sampleInformation(Integer sampleId, String fileName) {
|
||||
Result<Map<String, String>> result = new Result();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
if (Objects.isNull(phd)){
|
||||
|
@ -1478,8 +1482,23 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result viewQCResult(Integer sampleId, String fileName) {
|
||||
Result result = new Result();
|
||||
public void exportSampleInformation(Integer sampleId, String fileName,
|
||||
HttpServletResponse response) {
|
||||
/*Result<Map<String, String>> result = sampleInformation(sampleId, fileName);
|
||||
Map<String, String> sampleInfo = result.getResult();
|
||||
if (MapUtil.isEmpty(sampleInfo)) return;*/
|
||||
/*Map<String, Object> data = sampleInfo.entrySet().stream()
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));*/
|
||||
/*String exportFileName = "SampleInfo-Gamma.xls";
|
||||
ExportUtil.exportXls(response,"SampleInfo-G",data,exportFileName);*/
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("name","123");
|
||||
data.put("sex",1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<TableQCResult>> viewQCResult(Integer sampleId, String fileName) {
|
||||
Result<List<TableQCResult>> result = new Result();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
if (Objects.isNull(phd)){
|
||||
|
@ -1546,6 +1565,13 @@ public class GammaServiceImpl implements IGammaService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportQCResult(List<TableQCResult> data, HttpServletResponse response) {
|
||||
String sheetName = "QCResult-Gamma";
|
||||
String fileName = "QCResult-Gamma.xls";
|
||||
ExportUtil.exportXls(response,TableQCResult.class,data,sheetName,fileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result viewRLR(Integer sampleId, String fileName) {
|
||||
Result result = new Result();
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
|
@ -10,11 +13,13 @@ import org.apache.commons.io.FileUtils;
|
|||
import org.apache.commons.net.ftp.FTP;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.util.*;
|
||||
import org.jeecg.modules.base.dto.QCResultDto;
|
||||
import org.jeecg.modules.base.entity.original.*;
|
||||
import org.jeecg.modules.base.enums.*;
|
||||
import org.jeecg.modules.entity.*;
|
||||
|
@ -25,6 +30,8 @@ import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
|
|||
import org.jeecg.modules.native_jni.struct.BgBoundary;
|
||||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -1049,8 +1056,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result viewQCResult(Integer sampleId) {
|
||||
Result result = new Result();
|
||||
public Result<QCResult> viewQCResult(Integer sampleId) {
|
||||
Result<QCResult> result = new Result();
|
||||
QCResult qcResult = new QCResult();
|
||||
Sections sections = new Sections();
|
||||
List<Double> collectionTimeSections = sections.getCollectionTimeSections();
|
||||
|
@ -1276,6 +1283,21 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportQCResult(QCResult qcResult, HttpServletResponse response) {
|
||||
Map<String, Object> qcMap = BeanUtil.beanToMap(qcResult);
|
||||
List<QCResultDto> qcResultDtos = new ArrayList<>();
|
||||
for (Map.Entry<String, Object> entry : qcMap.entrySet()) {
|
||||
QCResultDto qcResultDto = new QCResultDto();
|
||||
qcResultDto.setFieldName(entry.getKey());
|
||||
qcResultDto.setFieldValue(entry.getValue());
|
||||
qcResultDtos.add(qcResultDto);
|
||||
}
|
||||
String sheetName = "QCResult-Beta";
|
||||
String fileName = "QCResult-Beta.xls";
|
||||
ExportUtil.exportXls(response,QCResultDto.class,qcResultDtos,sheetName,fileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result viewRLR(Integer sampleId) {
|
||||
Result result = new Result();
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user