feat:bugs
This commit is contained in:
parent
94ed1907d8
commit
6c2f0a5415
|
@ -1,14 +1,15 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
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.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
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){
|
||||
Class<?> sourceClass = source.getClass();
|
||||
Class<?> targetClass = target.getClass();
|
||||
|
|
|
@ -12,15 +12,15 @@ import org.springframework.core.io.Resource;
|
|||
import org.springframework.core.io.ResourceLoader;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jeecg.common.util.ClassUtil.classPathStream;
|
||||
|
||||
public class ExportUtil {
|
||||
|
||||
private static final String UTF_8 = StandardCharsets.UTF_8.name();
|
||||
|
@ -101,7 +101,9 @@ public class ExportUtil {
|
|||
public static TemplateExportParams excelTemplate(String template){
|
||||
String pathPrefix = "excelTemplate/";
|
||||
String path = pathPrefix + template;
|
||||
String templatePath = ClassUtil.classPath(path);
|
||||
InputStream inputStream = classPathStream(path);
|
||||
|
||||
String templatePath = "";
|
||||
return new TemplateExportParams(templatePath);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,4 +12,14 @@ public class ConcDto implements Serializable {
|
|||
private String conc;
|
||||
|
||||
private Date analysisBegin;
|
||||
|
||||
public ConcDto() {
|
||||
|
||||
}
|
||||
|
||||
public ConcDto(String nuclideName, String conc, Date analysisBegin) {
|
||||
this.nuclideName = nuclideName;
|
||||
this.conc = conc;
|
||||
this.analysisBegin = analysisBegin;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -12,7 +13,7 @@ import java.util.Set;
|
|||
@Mapper
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -12,7 +13,7 @@ import java.util.Set;
|
|||
@Mapper
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!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">
|
||||
|
||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDtoXe">
|
||||
SELECT
|
||||
xe.NUCLIDE_NAME,
|
||||
xe.CONC,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?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">
|
||||
<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
|
||||
xe.NUCLIDE_NAME,
|
||||
xe.CONC,
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -10,7 +11,7 @@ import java.util.Set;
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.dto.ConcDto;
|
||||
import org.jeecg.modules.base.dto.ConcDtoXe;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -10,7 +11,7 @@ import java.util.Set;
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.jeecg.common.constant.CommonConstant;
|
|||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
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.AlarmAnalysisNuclideParam;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
|
||||
|
@ -69,24 +70,25 @@ public class CalculateConcServiceImpl implements CalculateConcService {
|
|||
params.put("endDate",endDate + DateConstant.TIME_END);
|
||||
/* Auto自动处理 */
|
||||
// beta-gamma
|
||||
List<ConcDto> xeConcAuto = xeResultsAutoService.getConc(params);
|
||||
List<ConcDtoXe> xeConcAuto = xeResultsAutoService.getConc(params);
|
||||
// gamma
|
||||
List<ConcDto> nuclConcAuto = nuclIdedAutoService.getConc(params);
|
||||
|
||||
Map<String,String> autoResult = new HashMap<>();
|
||||
autoResult.putAll(calculate(xeConcAuto,index));
|
||||
autoResult.putAll(calculate(nuclConcAuto,index));
|
||||
autoResult.putAll(calculate(concDto(xeConcAuto), index));
|
||||
autoResult.putAll(calculate(nuclConcAuto, index));
|
||||
List<AlarmAnalysisNuclideAvg> autoAvgs = autoResult.entrySet().stream()
|
||||
.map(entry -> new AlarmAnalysisNuclideAvg(entry.getKey(), entry.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
autoAvgs.forEach(item -> item.setDataSourceType(CommonConstant.ARMDARR));
|
||||
/* Man人工交互 */
|
||||
// beta-gamma
|
||||
List<ConcDto> xeConcMan = xeResultsManService.getConc(params);
|
||||
List<ConcDtoXe> xeConcMan = xeResultsManService.getConc(params);
|
||||
// gamma
|
||||
List<ConcDto> nuclConcMan = nuclIdedManService.getConc(params);
|
||||
Map<String,String> manResult = new HashMap<>();
|
||||
manResult.putAll(calculate(xeConcMan,index));
|
||||
manResult.putAll(calculate(nuclConcMan,index));
|
||||
manResult.putAll(calculate(concDto(xeConcMan), index));
|
||||
manResult.putAll(calculate(nuclConcMan, index));
|
||||
List<AlarmAnalysisNuclideAvg> manAvgs = manResult.entrySet().stream()
|
||||
.map(entry -> new AlarmAnalysisNuclideAvg(entry.getKey(), entry.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
|
@ -103,7 +105,7 @@ public class CalculateConcServiceImpl implements CalculateConcService {
|
|||
|
||||
@Override
|
||||
public Map<String, String> calculate(List<ConcDto> concDtos, BigDecimal index) {
|
||||
Map<String,String> result = new HashMap<>();
|
||||
Map<String, String> result = new HashMap<>();
|
||||
// 按照核素名进行分组
|
||||
Map<String, List<ConcDto>> concDtoMap = concDtos.stream()
|
||||
.collect(Collectors.groupingBy(ConcDto::getNuclideName));
|
||||
|
@ -119,8 +121,18 @@ public class CalculateConcServiceImpl implements CalculateConcService {
|
|||
BigDecimal line = new BigDecimal(baseLine);
|
||||
int i = line.multiply(index).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||
int j = Math.max(i - 1, 0);
|
||||
result.put(nuclide,values.get(j).getConc());
|
||||
result.put(nuclide, values.get(j).getConc());
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
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.GardsXeResults;
|
||||
import org.jeecg.modules.mapper.GardsNuclIdedAutoMapper;
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
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.mapper.GardsXeResultsAutoMapper;
|
||||
import org.jeecg.modules.service.IGardsXeResultsAutoService;
|
||||
|
@ -23,7 +24,7 @@ public class GardsXeResultsAutoServiceImpl extends ServiceImpl<GardsXeResultsAut
|
|||
|
||||
|
||||
@Override
|
||||
public List<ConcDto> getConc(Map<String, Object> params) {
|
||||
public List<ConcDtoXe> getConc(Map<String, Object> params) {
|
||||
return baseMapper.getConc(params);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
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.mapper.GardsXeResultsManMapper;
|
||||
import org.jeecg.modules.service.IGardsXeResultsManService;
|
||||
|
@ -23,7 +24,7 @@ public class GardsXeResultsManServiceImpl extends ServiceImpl<GardsXeResultsManM
|
|||
|
||||
|
||||
@Override
|
||||
public List<ConcDto> getConc(Map<String, Object> params) {
|
||||
public List<ConcDtoXe> getConc(Map<String, Object> params) {
|
||||
return baseMapper.getConc(params);
|
||||
}
|
||||
|
||||
|
|
|
@ -230,4 +230,10 @@ public class SpectrumAnalysesController {
|
|||
@RequestBody BgDataAnlyseResultIn anlyseResultIn){
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,4 +81,6 @@ public interface ISpectrumAnalysisService {
|
|||
void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response);
|
||||
|
||||
void saveToTxt(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response);
|
||||
|
||||
void viewAutomaticAnalysisLog(Integer sampleId, HttpServletResponse response);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user