feat:RLR Export
This commit is contained in:
parent
c9ccba3a7e
commit
d98a4de4b1
|
@ -0,0 +1,50 @@
|
||||||
|
package org.jeecg.common.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ClassUtil {
|
||||||
|
|
||||||
|
public static <T> Map<String,Object> fieldValue(T obj, List<String> fields){
|
||||||
|
Map<String,Object> fieldValue = new HashMap<>();
|
||||||
|
if (CollUtil.isEmpty(fields))
|
||||||
|
return fieldValue;
|
||||||
|
for (String fieldName : fields) {
|
||||||
|
try {
|
||||||
|
Field field = obj.getClass().getDeclaredField(fieldName);
|
||||||
|
field.setAccessible(true);
|
||||||
|
Object value = field.get(obj);
|
||||||
|
fieldValue.put(fieldName,value);
|
||||||
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fieldValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> List<String> objsStr(List<T> objs){
|
||||||
|
String sapce5 = " ";
|
||||||
|
List<String> objsStr = new ArrayList<>();
|
||||||
|
if (CollUtil.isEmpty(objs)) return objsStr;
|
||||||
|
for (T obj : objs) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Field[] fields = obj.getClass().getDeclaredFields();
|
||||||
|
for (Field field : fields) {
|
||||||
|
try {
|
||||||
|
field.setAccessible(true);
|
||||||
|
sb.append(field.get(obj)).append(sapce5);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
objsStr.add(StrUtil.trim(sb));
|
||||||
|
}
|
||||||
|
return objsStr;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package org.jeecg.modules.base.bizVo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.jeecg.modules.entity.vo.TableAssociation;
|
||||||
|
import org.jeecg.modules.entity.vo.TablePeakFit;
|
||||||
|
import org.jeecg.modules.entity.vo.TableResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GammaRLR {
|
||||||
|
// #header
|
||||||
|
private String header_msg_id;
|
||||||
|
private String header_data_type;
|
||||||
|
private String header_priority_level;
|
||||||
|
private String header_station_code;
|
||||||
|
private String header_srid;
|
||||||
|
private String header_lab_code;
|
||||||
|
private String header_lab_detector;
|
||||||
|
private String header_report_type;
|
||||||
|
private String header_report_number;
|
||||||
|
private String header_sample_category;
|
||||||
|
private String header_transmission;
|
||||||
|
|
||||||
|
// #objective
|
||||||
|
private String Obj_purpose;
|
||||||
|
private String Obj_authorized;
|
||||||
|
private String Obj_instruction;
|
||||||
|
|
||||||
|
// #collection
|
||||||
|
private String collect_start;
|
||||||
|
private String collect_stop;
|
||||||
|
private Double collect_airVolume;
|
||||||
|
|
||||||
|
// #sampleReceipt
|
||||||
|
private String Receipt_srid;
|
||||||
|
private String Receipt_sealNum;
|
||||||
|
private String Receipt_sample_dateTime;
|
||||||
|
private String Receipt_package;
|
||||||
|
private String Receipt_seal;
|
||||||
|
private String Receipt_sample;
|
||||||
|
|
||||||
|
// #test
|
||||||
|
private String Test_type;
|
||||||
|
private String Test_completion;
|
||||||
|
private String Test_person;
|
||||||
|
private String Test_purpose;
|
||||||
|
|
||||||
|
// #peakMethond
|
||||||
|
private String PeakMethod_software;
|
||||||
|
private String PeakMethod_location;
|
||||||
|
|
||||||
|
// #peakFit
|
||||||
|
private List<TablePeakFit> peakFit;
|
||||||
|
|
||||||
|
// #g_AnalysisMethods
|
||||||
|
private String AnalyMethod_software;
|
||||||
|
private String AnalyMethod_nuclide;
|
||||||
|
private String AnalyMethod_baseline;
|
||||||
|
private String AnalyMethod_lc;
|
||||||
|
private String AnalyMethod_calib;
|
||||||
|
|
||||||
|
// #peakAssociation
|
||||||
|
private List<TableAssociation> Association;
|
||||||
|
|
||||||
|
// #References
|
||||||
|
private String Reference_samplePHD;
|
||||||
|
private String Reference_CalibPHD;
|
||||||
|
private String Reference_physical;
|
||||||
|
|
||||||
|
// #Results
|
||||||
|
private String Result_act_ref;
|
||||||
|
private String Result_conc_ref;
|
||||||
|
private List<TableResult> Result;
|
||||||
|
|
||||||
|
// #NuclideRatios
|
||||||
|
|
||||||
|
|
||||||
|
// #g_CoincidenceCorrection
|
||||||
|
|
||||||
|
|
||||||
|
// #MDA
|
||||||
|
|
||||||
|
|
||||||
|
// #Conclusions
|
||||||
|
private String conclusion_person;
|
||||||
|
private String Conclusion_IDC;
|
||||||
|
private String Conclusion_Lab;
|
||||||
|
private String Conclusion_Res;
|
||||||
|
|
||||||
|
// #Comment
|
||||||
|
private String Comment;
|
||||||
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class Sample_G_Analysis {
|
||||||
saveNuclIded(middleData,sampleId,IdAnalysis);
|
saveNuclIded(middleData,sampleId,IdAnalysis);
|
||||||
/* Gards_Qc_Check 数据表保存 */
|
/* Gards_Qc_Check 数据表保存 */
|
||||||
saveQcCheck(middleData,sampleId,IdAnalysis);
|
saveQcCheck(middleData,sampleId,IdAnalysis);
|
||||||
|
/* */
|
||||||
/** 收尾处理 ==> 写日志文件和报告文件 **/
|
/** 收尾处理 ==> 写日志文件和报告文件 **/
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
package org.jeecg.modules.controller;
|
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.io.FileUtil;
|
||||||
|
import cn.hutool.core.util.ReUtil;
|
||||||
|
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.modules.base.bizVo.GammaRLR;
|
||||||
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;
|
||||||
|
@ -11,7 +17,13 @@ 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.lang.reflect.Field;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("gamma")
|
@RequestMapping("gamma")
|
||||||
|
@ -304,6 +316,59 @@ public class GammaController {
|
||||||
return gammaService.viewRLR(sampleId, fileName);
|
return gammaService.viewRLR(sampleId, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("exportRLR")
|
||||||
|
@ApiOperation(value = "导出RLR页面数据", notes = "导出RLR页面数据")
|
||||||
|
public void exportRLR(Integer sampleId, String fileName, HttpServletResponse 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")
|
||||||
@ApiOperation(value = "查看Automatic Analysis Log页面数据", notes = "查看Automatic Analysis Log页面数据")
|
@ApiOperation(value = "查看Automatic Analysis Log页面数据", notes = "查看Automatic Analysis Log页面数据")
|
||||||
public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) {
|
public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) {
|
||||||
|
|
|
@ -107,6 +107,8 @@ public interface IGammaService{
|
||||||
|
|
||||||
Result viewRLR(Integer sampleId, String fileName);
|
Result viewRLR(Integer sampleId, String fileName);
|
||||||
|
|
||||||
|
void exportRLR(Integer sampleId, String fileName, HttpServletResponse response);
|
||||||
|
|
||||||
void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response);
|
void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response);
|
||||||
|
|
||||||
Result viewGammaviewerLog(Integer sampleId, String fileName);
|
Result viewGammaviewerLog(Integer sampleId, String fileName);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
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 com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
@ -2046,6 +2047,11 @@ public class GammaServiceImpl implements IGammaService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exportRLR(Integer sampleId, String fileName, HttpServletResponse response) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) {
|
public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) {
|
||||||
if (Objects.isNull(sampleId)){
|
if (Objects.isNull(sampleId)){
|
||||||
|
|
|
@ -2,6 +2,7 @@ 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.collection.ListUtil;
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
@ -115,6 +116,7 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
|
||||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
String username = user.getUsername();
|
String username = user.getUsername();
|
||||||
String slash = SymbolConstant.SINGLE_SLASH;
|
String slash = SymbolConstant.SINGLE_SLASH;
|
||||||
|
String comma = SymbolConstant.COMMA;
|
||||||
String filePath = slash + spectrumPathProperties.getUploadPath() + slash + username;
|
String filePath = slash + spectrumPathProperties.getUploadPath() + slash + username;
|
||||||
FTPClient ftpClient = null;
|
FTPClient ftpClient = null;
|
||||||
List<FileDto> fileDtos = new ArrayList<>();
|
List<FileDto> fileDtos = new ArrayList<>();
|
||||||
|
@ -129,8 +131,9 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
|
||||||
// 根据文件名进行过滤
|
// 根据文件名进行过滤
|
||||||
String name = fileVo.getName();
|
String name = fileVo.getName();
|
||||||
if (StrUtil.isNotBlank(name)){
|
if (StrUtil.isNotBlank(name)){
|
||||||
|
String[] names = name.split(comma);
|
||||||
ftpFiles = ftpFiles.stream()
|
ftpFiles = ftpFiles.stream()
|
||||||
.filter(file -> StrUtil.containsIgnoreCase(file.getName(),name))
|
.filter(file -> StrUtil.containsAnyIgnoreCase(file.getName(),names))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
for (FTPFile ftpFile : ftpFiles) {
|
for (FTPFile ftpFile : ftpFiles) {
|
||||||
|
@ -141,7 +144,7 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
|
||||||
FileDto fileDto = new FileDto();
|
FileDto fileDto = new FileDto();
|
||||||
fileDto.setName(fileName);
|
fileDto.setName(fileName);
|
||||||
fileDto.setUpdateDate(updateDate);
|
fileDto.setUpdateDate(updateDate);
|
||||||
fileDto.setSize(formatSize(size));
|
fileDto.setSize(FileUtil.readableFileSize(size));
|
||||||
fileDtos.add(fileDto);
|
fileDtos.add(fileDto);
|
||||||
}
|
}
|
||||||
String field = fileVo.getField();
|
String field = fileVo.getField();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user