feat:bugs

This commit is contained in:
nieziyan 2023-10-27 19:19:39 +08:00
parent 94ed1907d8
commit 6c2f0a5415
20 changed files with 1929 additions and 1827 deletions

View File

@ -1,14 +1,15 @@
package org.jeecg.common.util; package org.jeecg.common.util;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import org.jeecgframework.poi.excel.entity.TemplateExportParams; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -71,6 +72,17 @@ public class ClassUtil {
} }
} }
public static InputStream classPathStream(String classPath){
try {
ClassPathResource resource = new ClassPathResource(classPath);
return resource.getInputStream();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public static <T1,T2> void copyProperties(T1 source, T2 target){ public static <T1,T2> void copyProperties(T1 source, T2 target){
Class<?> sourceClass = source.getClass(); Class<?> sourceClass = source.getClass();
Class<?> targetClass = target.getClass(); Class<?> targetClass = target.getClass();

View File

@ -12,15 +12,15 @@ import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.*;
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;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static org.jeecg.common.util.ClassUtil.classPathStream;
public class ExportUtil { public class ExportUtil {
private static final String UTF_8 = StandardCharsets.UTF_8.name(); private static final String UTF_8 = StandardCharsets.UTF_8.name();
@ -101,7 +101,9 @@ public class ExportUtil {
public static TemplateExportParams excelTemplate(String template){ public static TemplateExportParams excelTemplate(String template){
String pathPrefix = "excelTemplate/"; String pathPrefix = "excelTemplate/";
String path = pathPrefix + template; String path = pathPrefix + template;
String templatePath = ClassUtil.classPath(path); InputStream inputStream = classPathStream(path);
String templatePath = "";
return new TemplateExportParams(templatePath); return new TemplateExportParams(templatePath);
} }

View File

@ -12,4 +12,14 @@ public class ConcDto implements Serializable {
private String conc; private String conc;
private Date analysisBegin; private Date analysisBegin;
public ConcDto() {
}
public ConcDto(String nuclideName, String conc, Date analysisBegin) {
this.nuclideName = nuclideName;
this.conc = conc;
this.analysisBegin = analysisBegin;
}
} }

View File

@ -0,0 +1,16 @@
package org.jeecg.modules.base.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class ConcDtoXe implements Serializable {
private String nuclideName;
private Double conc;
private Date analysisBegin;
}

View File

@ -3,6 +3,7 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.dto.ConcDto; import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded; import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
import java.util.List; import java.util.List;

View File

@ -3,6 +3,7 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.dto.ConcDto; import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults; import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import java.util.List; import java.util.List;
@ -12,7 +13,7 @@ import java.util.Set;
@Mapper @Mapper
public interface GardsXeResultsAutoMapper extends BaseMapper<GardsXeResults> { public interface GardsXeResultsAutoMapper extends BaseMapper<GardsXeResults> {
List<ConcDto> getConc(Map<String,Object> params); List<ConcDtoXe> getConc(Map<String,Object> params);
List<String> nuclideNames(Set<String> nuclideNames); List<String> nuclideNames(Set<String> nuclideNames);
} }

View File

@ -3,6 +3,7 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.dto.ConcDto; import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnman.GardsXeResults; import org.jeecg.modules.base.entity.rnman.GardsXeResults;
import java.util.List; import java.util.List;
@ -12,7 +13,7 @@ import java.util.Set;
@Mapper @Mapper
public interface GardsXeResultsManMapper extends BaseMapper<GardsXeResults> { public interface GardsXeResultsManMapper extends BaseMapper<GardsXeResults> {
List<ConcDto> getConc(Map<String,Object> params); List<ConcDtoXe> getConc(Map<String,Object> params);
List<String> nuclideNames(Set<String> nuclideNames); List<String> nuclideNames(Set<String> nuclideNames);
} }

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsAutoMapper"> <mapper namespace="org.jeecg.modules.mapper.GardsXeResultsAutoMapper">
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto"> <select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDtoXe">
SELECT SELECT
xe.NUCLIDE_NAME, xe.NUCLIDE_NAME,
xe.CONC, xe.CONC,

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsManMapper"> <mapper namespace="org.jeecg.modules.mapper.GardsXeResultsManMapper">
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto"> <select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDtoXe">
SELECT SELECT
xe.NUCLIDE_NAME, xe.NUCLIDE_NAME,
xe.CONC, xe.CONC,

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.dto.ConcDto; import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded; import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
import java.util.List; import java.util.List;

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.dto.ConcDto; import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults; import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import java.util.List; import java.util.List;
@ -10,7 +11,7 @@ import java.util.Set;
public interface IGardsXeResultsAutoService extends IService<GardsXeResults> { public interface IGardsXeResultsAutoService extends IService<GardsXeResults> {
List<ConcDto> getConc(Map<String,Object> params); List<ConcDtoXe> getConc(Map<String,Object> params);
List<String> nuclideNames(Set<String> nuclideNames); List<String> nuclideNames(Set<String> nuclideNames);
} }

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.dto.ConcDto; import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnman.GardsXeResults; import org.jeecg.modules.base.entity.rnman.GardsXeResults;
import java.util.List; import java.util.List;
@ -10,7 +11,7 @@ import java.util.Set;
public interface IGardsXeResultsManService extends IService<GardsXeResults> { public interface IGardsXeResultsManService extends IService<GardsXeResults> {
List<ConcDto> getConc(Map<String,Object> params); List<ConcDtoXe> getConc(Map<String,Object> params);
List<String> nuclideNames(Set<String> nuclideNames); List<String> nuclideNames(Set<String> nuclideNames);
} }

View File

@ -7,6 +7,7 @@ import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.DateConstant; import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.SymbolConstant; import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.modules.base.dto.ConcDto; import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg; import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam; import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule; import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
@ -69,11 +70,12 @@ public class CalculateConcServiceImpl implements CalculateConcService {
params.put("endDate",endDate + DateConstant.TIME_END); params.put("endDate",endDate + DateConstant.TIME_END);
/* Auto自动处理 */ /* Auto自动处理 */
// beta-gamma // beta-gamma
List<ConcDto> xeConcAuto = xeResultsAutoService.getConc(params); List<ConcDtoXe> xeConcAuto = xeResultsAutoService.getConc(params);
// gamma // gamma
List<ConcDto> nuclConcAuto = nuclIdedAutoService.getConc(params); List<ConcDto> nuclConcAuto = nuclIdedAutoService.getConc(params);
Map<String,String> autoResult = new HashMap<>(); Map<String,String> autoResult = new HashMap<>();
autoResult.putAll(calculate(xeConcAuto,index)); autoResult.putAll(calculate(concDto(xeConcAuto), index));
autoResult.putAll(calculate(nuclConcAuto, index)); autoResult.putAll(calculate(nuclConcAuto, index));
List<AlarmAnalysisNuclideAvg> autoAvgs = autoResult.entrySet().stream() List<AlarmAnalysisNuclideAvg> autoAvgs = autoResult.entrySet().stream()
.map(entry -> new AlarmAnalysisNuclideAvg(entry.getKey(), entry.getValue())) .map(entry -> new AlarmAnalysisNuclideAvg(entry.getKey(), entry.getValue()))
@ -81,11 +83,11 @@ public class CalculateConcServiceImpl implements CalculateConcService {
autoAvgs.forEach(item -> item.setDataSourceType(CommonConstant.ARMDARR)); autoAvgs.forEach(item -> item.setDataSourceType(CommonConstant.ARMDARR));
/* Man人工交互 */ /* Man人工交互 */
// beta-gamma // beta-gamma
List<ConcDto> xeConcMan = xeResultsManService.getConc(params); List<ConcDtoXe> xeConcMan = xeResultsManService.getConc(params);
// gamma // gamma
List<ConcDto> nuclConcMan = nuclIdedManService.getConc(params); List<ConcDto> nuclConcMan = nuclIdedManService.getConc(params);
Map<String,String> manResult = new HashMap<>(); Map<String,String> manResult = new HashMap<>();
manResult.putAll(calculate(xeConcMan,index)); manResult.putAll(calculate(concDto(xeConcMan), index));
manResult.putAll(calculate(nuclConcMan, index)); manResult.putAll(calculate(nuclConcMan, index));
List<AlarmAnalysisNuclideAvg> manAvgs = manResult.entrySet().stream() List<AlarmAnalysisNuclideAvg> manAvgs = manResult.entrySet().stream()
.map(entry -> new AlarmAnalysisNuclideAvg(entry.getKey(), entry.getValue())) .map(entry -> new AlarmAnalysisNuclideAvg(entry.getKey(), entry.getValue()))
@ -123,4 +125,14 @@ public class CalculateConcServiceImpl implements CalculateConcService {
} }
return result; return result;
} }
private List<ConcDto> concDto(List<ConcDtoXe> concDtoXes){
List<ConcDto> concDtos = new ArrayList<>();
if (CollUtil.isEmpty(concDtoXes)) return concDtos;
concDtos = concDtoXes.stream()
.map(xe -> new ConcDto(xe.getNuclideName(), String.valueOf(xe.getConc()), xe.getAnalysisBegin()))
.collect(Collectors.toList());
return concDtos;
}
} }

View File

@ -4,6 +4,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.constant.DateConstant; import org.jeecg.common.constant.DateConstant;
import org.jeecg.modules.base.dto.ConcDto; import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded; import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults; import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import org.jeecg.modules.mapper.GardsNuclIdedAutoMapper; import org.jeecg.modules.mapper.GardsNuclIdedAutoMapper;

View File

@ -4,6 +4,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.constant.DateConstant; import org.jeecg.common.constant.DateConstant;
import org.jeecg.modules.base.dto.ConcDto; import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults; import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import org.jeecg.modules.mapper.GardsXeResultsAutoMapper; import org.jeecg.modules.mapper.GardsXeResultsAutoMapper;
import org.jeecg.modules.service.IGardsXeResultsAutoService; import org.jeecg.modules.service.IGardsXeResultsAutoService;
@ -23,7 +24,7 @@ public class GardsXeResultsAutoServiceImpl extends ServiceImpl<GardsXeResultsAut
@Override @Override
public List<ConcDto> getConc(Map<String, Object> params) { public List<ConcDtoXe> getConc(Map<String, Object> params) {
return baseMapper.getConc(params); return baseMapper.getConc(params);
} }

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.DateConstant; import org.jeecg.common.constant.DateConstant;
import org.jeecg.modules.base.dto.ConcDto; import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnman.GardsXeResults; import org.jeecg.modules.base.entity.rnman.GardsXeResults;
import org.jeecg.modules.mapper.GardsXeResultsManMapper; import org.jeecg.modules.mapper.GardsXeResultsManMapper;
import org.jeecg.modules.service.IGardsXeResultsManService; import org.jeecg.modules.service.IGardsXeResultsManService;
@ -23,7 +24,7 @@ public class GardsXeResultsManServiceImpl extends ServiceImpl<GardsXeResultsManM
@Override @Override
public List<ConcDto> getConc(Map<String, Object> params) { public List<ConcDtoXe> getConc(Map<String, Object> params) {
return baseMapper.getConc(params); return baseMapper.getConc(params);
} }

View File

@ -230,4 +230,10 @@ public class SpectrumAnalysesController {
@RequestBody BgDataAnlyseResultIn anlyseResultIn){ @RequestBody BgDataAnlyseResultIn anlyseResultIn){
spectrumAnalysisService.saveToTxt(anlyseResultIn, response); spectrumAnalysisService.saveToTxt(anlyseResultIn, response);
} }
@GetMapping("viewAutomaticAnalysisLog")
@ApiOperation(value = "查看Automatic Analysis Log页面数据", notes = "查看Automatic Analysis Log页面数据")
public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) {
spectrumAnalysisService.viewAutomaticAnalysisLog(sampleId, response);
}
} }

View File

@ -81,4 +81,6 @@ public interface ISpectrumAnalysisService {
void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response); void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response);
void saveToTxt(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response); void saveToTxt(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response);
void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response);
} }

View File

@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPClient;
@ -1186,8 +1187,10 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
} }
PeakInfo peak = new PeakInfo(); PeakInfo peak = new PeakInfo();
peak.index = a + 1; peak.index = a + 1;
peak.left = structInsertOutput.vLeft.get(j).intValue();; peak.left = structInsertOutput.vLeft.get(j).intValue();
peak.right = structInsertOutput.vRight.get(j).intValue();; ;
peak.right = structInsertOutput.vRight.get(j).intValue();
;
peak.peakCentroid = structInsertOutput.peakCentroid.get(j); peak.peakCentroid = structInsertOutput.peakCentroid.get(j);
peak.energy = structInsertOutput.energy.get(j); peak.energy = structInsertOutput.energy.get(j);
peak.area = structInsertOutput.area.get(j); peak.area = structInsertOutput.area.get(j);
@ -2060,10 +2063,14 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
annlyse.put("date", date); annlyse.put("date", date);
annlyse.put("time", time); annlyse.put("time", time);
PrintWriter writer = null;
try {
String pathPrefix = "excelTemplate/"; String pathPrefix = "excelTemplate/";
String path = pathPrefix + ZEROTIME_G.getName(); String path = pathPrefix + ZEROTIME_G.getName();
String template = ClassUtil.classPath(path); /*String template = ClassUtil.classPath(path);
List<String> lines = FileUtil.readUtf8Lines(template); List<String> lines = FileUtil.readUtf8Lines(template);*/
InputStream inputStream = ClassUtil.classPathStream(path);
List<String> lines = IOUtils.readLines(inputStream, "UTF-8");
// 正则表达式匹配${}中的内容 // 正则表达式匹配${}中的内容
String regex = "\\$\\{([^}]+)}"; String regex = "\\$\\{([^}]+)}";
List<String> newLines = new ArrayList<>(); List<String> newLines = new ArrayList<>();
@ -2084,8 +2091,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
} }
newLines.add(line); newLines.add(line);
} }
PrintWriter writer = null;
try {
String export = "ZeroTime-G.txt"; String export = "ZeroTime-G.txt";
writer = ExportUtil.streamWriter(response, export); writer = ExportUtil.streamWriter(response, export);
for (String newLine : newLines) { for (String newLine : newLines) {
@ -3812,17 +3818,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
} }
} else if (str.contains("(")) { } else if (str.contains("(")) {
standard += str.replace("(", "") + " < " + iter.getKey(); standard += str.replace("(", "") + " < " + iter.getKey();
} } else if (str.contains(")")) {
else if(str.contains(")"))
{
standard += " < " + str.replace(")", ""); standard += " < " + str.replace(")", "");
} } else if (str.contains("[")) {
else if(str.contains("["))
{
standard += str.replace("[", "") + " <= " + iter.getKey(); standard += str.replace("[", "") + " <= " + iter.getKey();
} } else if (str.contains("]")) {
else if(str.contains("]"))
{
standard += " <= " + str.replace("]", ""); standard += " <= " + str.replace("]", "");
} }
} }
@ -4020,10 +4020,14 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
@Override @Override
public void exportRLR(GammaRLR gammaRLR, HttpServletResponse response) { public void exportRLR(GammaRLR gammaRLR, HttpServletResponse response) {
if (ObjectUtil.isNull(gammaRLR)) return; if (ObjectUtil.isNull(gammaRLR)) return;
PrintWriter writer = null;
try {
String pathPrefix = "excelTemplate/"; String pathPrefix = "excelTemplate/";
String path = pathPrefix + RLR_G.getName(); String path = pathPrefix + RLR_G.getName();
String template = ClassUtil.classPath(path); /*String template = ClassUtil.classPath(path);
List<String> lines = FileUtil.readUtf8Lines(template); List<String> lines = FileUtil.readUtf8Lines(template);*/
InputStream inputStream = ClassUtil.classPathStream(path);
List<String> lines = IOUtils.readLines(inputStream, "UTF-8");
// 正则表达式匹配${}中的内容 // 正则表达式匹配${}中的内容
String regex = "\\$\\{([^}]+)}"; String regex = "\\$\\{([^}]+)}";
List<String> newLines = new ArrayList<>(); List<String> newLines = new ArrayList<>();
@ -4078,8 +4082,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (!CollUtil.contains(skip, newLine)) if (!CollUtil.contains(skip, newLine))
newLines.add(newLine); newLines.add(newLine);
} }
PrintWriter writer = null;
try {
String export = "Gamma.RLR"; String export = "Gamma.RLR";
writer = ExportUtil.streamWriter(response, export); writer = ExportUtil.streamWriter(response, export);
for (String newLine : newLines) { for (String newLine : newLines) {
@ -4559,14 +4562,16 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
data.put("nuclides", nuclideStr); data.put("nuclides", nuclideStr);
/* Nuclide's Activity and Concentration */ /* Nuclide's Activity and Concentration */
// 时间部分 // 时间部分
String actTime = ""; String concTime = ""; String actTime = "";
String concTime = "";
Date refTimeAct = phd.getUsedSetting().getRefTime_act(); Date refTimeAct = phd.getUsedSetting().getRefTime_act();
Date refTimeConc = phd.getUsedSetting().getRefTime_conc(); Date refTimeConc = phd.getUsedSetting().getRefTime_conc();
if (ObjectUtil.isNotNull(refTimeAct)) if (ObjectUtil.isNotNull(refTimeAct))
actTime = DateUtil.format(refTimeAct, DateConstant.DATE_BIAS_TIME); actTime = DateUtil.format(refTimeAct, DateConstant.DATE_BIAS_TIME);
if (ObjectUtil.isNotNull(refTimeConc)) if (ObjectUtil.isNotNull(refTimeConc))
concTime = DateUtil.format(refTimeConc, DateConstant.DATE_BIAS_TIME); concTime = DateUtil.format(refTimeConc, DateConstant.DATE_BIAS_TIME);
data.put("actTime", actTime); data.put("concTime", concTime); data.put("actTime", actTime);
data.put("concTime", concTime);
// 数据部分 // 数据部分
Map<String, NuclideActMda> mapNucActMda = phd.getMapNucActMda(); Map<String, NuclideActMda> mapNucActMda = phd.getMapNucActMda();
List<NuclideActMdaDto> nuclideActs = new ArrayList<>(); List<NuclideActMdaDto> nuclideActs = new ArrayList<>();
@ -4612,9 +4617,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (calculateIdx >= 0 && calculateIdx < vEnergy.size()) { if (calculateIdx >= 0 && calculateIdx < vEnergy.size()) {
String yield = NumberFormatUtil.numberFormat(String.valueOf(vYield.get(calculateIdx) * 100)); String yield = NumberFormatUtil.numberFormat(String.valueOf(vYield.get(calculateIdx) * 100));
String energy = NumberFormatUtil.numberFormat(String.valueOf(vEnergy.get(calculateIdx))); String energy = NumberFormatUtil.numberFormat(String.valueOf(vEnergy.get(calculateIdx)));
nuclideActMdaDto.setYield(yield); nuclideActMdaDto.setEnergy(energy); nuclideActMdaDto.setYield(yield);
nuclideActMdaDto.setEnergy(energy);
} else { } else {
nuclideActMdaDto.setYield("NULL"); nuclideActMdaDto.setEnergy("NULL"); nuclideActMdaDto.setYield("NULL");
nuclideActMdaDto.setEnergy("NULL");
} }
nuclideActs.add(nuclideActMdaDto); nuclideActs.add(nuclideActMdaDto);
} }

View File

@ -13,7 +13,9 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import org.apache.commons.io.Charsets;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPClient;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
@ -205,7 +207,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
// 声明分页page // 声明分页page
Page<GardsSampleDataSpectrum> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); Page<GardsSampleDataSpectrum> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
Page<GardsSampleDataSpectrum> sampleDataPage = spectrumAnalysisMapper.getDBSpectrumList(page, gardsSampleData, dbName, stationTypes, CollectStopB, AcqStartB, startTime, endTime, userStations, AllUsers); Page<GardsSampleDataSpectrum> sampleDataPage = spectrumAnalysisMapper.getDBSpectrumList(page, gardsSampleData, dbName, stationTypes, CollectStopB, AcqStartB, startTime, endTime, userStations, AllUsers);
sampleDataPage.getRecords().stream().forEach(item->{item.setDbName(tempDBName);}); sampleDataPage.getRecords().stream().forEach(item -> {
item.setDbName(tempDBName);
});
result.setSuccess(true); result.setSuccess(true);
result.setResult(sampleDataPage); result.setResult(sampleDataPage);
return result; return result;
@ -4339,11 +4343,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
analyze.put("gasRoi", roiChannels(roiChannelsDtosG)); analyze.put("gasRoi", roiChannels(roiChannelsDtosG));
analyze.putAll(roiResults(roiResultsDtos)); analyze.putAll(roiResults(roiResultsDtos));
analyze.put("resultSummary", xeResults(xeResultsDtos)); analyze.put("resultSummary", xeResults(xeResultsDtos));
PrintWriter writer = null;
try {
// 使数据适配导出模板 // 使数据适配导出模板
String pathPrefix = "excelTemplate/"; String pathPrefix = "excelTemplate/";
String path = pathPrefix + SAVETOTXT.getName(); String path = pathPrefix + SAVETOTXT.getName();
String template = ClassUtil.classPath(path); InputStream inputStream = ClassUtil.classPathStream(path);
List<String> lines = FileUtil.readUtf8Lines(template); List<String> lines = IOUtils.readLines(inputStream, "UTF-8");
// 正则表达式匹配${}中的内容 // 正则表达式匹配${}中的内容
String regex = "\\$\\{([^}]+)}"; String regex = "\\$\\{([^}]+)}";
List<String> newLines = new ArrayList<>(); List<String> newLines = new ArrayList<>();
@ -4371,8 +4378,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (!CollUtil.contains(skip, line)) if (!CollUtil.contains(skip, line))
newLines.add(line); newLines.add(line);
} }
PrintWriter writer = null;
try {
String export = "SaveToTxt.txt"; String export = "SaveToTxt.txt";
writer = ExportUtil.streamWriter(response, export); writer = ExportUtil.streamWriter(response, export);
for (String newLine : newLines) { for (String newLine : newLines) {
@ -4386,6 +4392,26 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
} }
} }
@Override
public void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response) {
try {
String path = "C:\\Users\\a\\Desktop\\demo.log";
InputStream inputStream = new FileInputStream(new File(path));
OutputStream outputStream = ExportUtil.stream(response, "demo.log");
// 缓冲区大小
byte[] buffer = new byte[4096];
int bytesRead;
// 将文件输出流写入到输出流中
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
} catch (IOException e) {
e.printStackTrace();
}
}
private List<String> calibrations(GardsCalibrationSpectrum gammaCalibrationCE, GardsCalibrationSpectrum gammaCalibrationEC, GardsCalibrationSpectrum betaCalibrationCE, GardsCalibrationSpectrum betaCalibrationEC) { private List<String> calibrations(GardsCalibrationSpectrum gammaCalibrationCE, GardsCalibrationSpectrum gammaCalibrationEC, GardsCalibrationSpectrum betaCalibrationCE, GardsCalibrationSpectrum betaCalibrationEC) {
int min = 79; int min = 79;
String space = StrUtil.SPACE; String space = StrUtil.SPACE;