Revert "fix:解决Gamma default params表有空的value报错问题"
This reverts commit f41a8dad0c
.
This commit is contained in:
parent
f41a8dad0c
commit
7d0fddfc81
|
@ -8,7 +8,6 @@ import org.jeecg.modules.service.IGardsGammaDefaultParamsService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -20,7 +19,7 @@ public class GardsGammaDefaultParamsServiceImpl extends ServiceImpl<GardsGammaDe
|
||||||
public Map<String, String> mapSetting() {
|
public Map<String, String> mapSetting() {
|
||||||
Map<String, String> paramsMap = list().stream()
|
Map<String, String> paramsMap = list().stream()
|
||||||
.collect(Collectors.toMap(GardsGammaDefaultParams::getName,
|
.collect(Collectors.toMap(GardsGammaDefaultParams::getName,
|
||||||
v->v.getValue() == null ? "" : v.getValue()));
|
GardsGammaDefaultParams::getValue));
|
||||||
return paramsMap;
|
return paramsMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1515,14 +1515,10 @@ public class GammaFileUtil {
|
||||||
try {
|
try {
|
||||||
String phdStr = mapper.writeValueAsString(phd);
|
String phdStr = mapper.writeValueAsString(phd);
|
||||||
String mapLinesStr = mapper.writeValueAsString(mapLines);
|
String mapLinesStr = mapper.writeValueAsString(mapLines);
|
||||||
|
|
||||||
//解析获取临时文件信息
|
|
||||||
File tmpFile = this.analyzeFile(phd.getFilepath());
|
|
||||||
String analyseSpectrum = CalValuesHandler.analyseSpectrum(phdStr, mapLinesStr, "");
|
String analyseSpectrum = CalValuesHandler.analyseSpectrum(phdStr, mapLinesStr, "");
|
||||||
JSONObject jsonObject = JSONObject.parseObject(analyseSpectrum);
|
JSONObject jsonObject = JSONObject.parseObject(analyseSpectrum);
|
||||||
String jsonString = jsonObject.toJSONString();
|
String jsonString = jsonObject.toJSONString();
|
||||||
|
|
||||||
|
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -4210,40 +4206,5 @@ public class GammaFileUtil {
|
||||||
}
|
}
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
public File analyzeFile(String path) {
|
|
||||||
//连接ftp
|
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
|
||||||
InputStream inputStream = null;
|
|
||||||
File file = null;
|
|
||||||
try {
|
|
||||||
//被动模式
|
|
||||||
ftpClient.enterLocalPassiveMode();
|
|
||||||
//设置文件类型--二进制文件
|
|
||||||
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
|
|
||||||
//
|
|
||||||
ftpClient.setControlEncoding("UTF-8");
|
|
||||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
|
||||||
inputStream = ftpClient.retrieveFileStream(path);
|
|
||||||
if (Objects.nonNull(inputStream)){
|
|
||||||
file = File.createTempFile("tmp", null);
|
|
||||||
//将ftp文件的输入流复制给临时文件
|
|
||||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (Objects.nonNull(ftpClient)){
|
|
||||||
ftpClient.disconnect();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(inputStream)){
|
|
||||||
inputStream.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.jeecg.modules.controller;
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.poi.hdgf.pointers.Pointer;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.base.BaseMap;
|
import org.jeecg.common.base.BaseMap;
|
||||||
import org.jeecg.common.constant.GlobalConstants;
|
import org.jeecg.common.constant.GlobalConstants;
|
||||||
|
@ -20,7 +19,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("gamma")
|
@RequestMapping("gamma")
|
||||||
|
|
|
@ -213,7 +213,6 @@ public class GammaServiceImpl implements IGammaService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result gammaByDB(String dbName, Integer sampleId, HttpServletRequest request) {
|
public Result gammaByDB(String dbName, Integer sampleId, HttpServletRequest request) {
|
||||||
long l = System.currentTimeMillis();
|
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
@ -228,22 +227,14 @@ public class GammaServiceImpl implements IGammaService {
|
||||||
}
|
}
|
||||||
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
|
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
|
||||||
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||||
System.out.println("loadFile之前>>>>"+(System.currentTimeMillis() - l));
|
|
||||||
l = System.currentTimeMillis();
|
|
||||||
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phd, result);
|
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phd, result);
|
||||||
System.out.println("loadFile>>>>"+(System.currentTimeMillis() - l));
|
|
||||||
if (!flag){
|
if (!flag){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
l = System.currentTimeMillis();
|
|
||||||
//声明基础数组信息
|
//声明基础数组信息
|
||||||
gammaFileUtil.SetBaseInfo(phd);
|
gammaFileUtil.SetBaseInfo(phd);
|
||||||
System.out.println("SetBaseInfo>>>>"+(System.currentTimeMillis() - l));
|
|
||||||
l = System.currentTimeMillis();
|
|
||||||
//从数据库中读取相关信息
|
//从数据库中读取相关信息
|
||||||
boolean bRet = gammaFileUtil.getResultFromDB(dbName, userName, sampleId, phd, result);
|
boolean bRet = gammaFileUtil.getResultFromDB(dbName, userName, sampleId, phd, result);
|
||||||
System.out.println("getResultFromDB>>>>"+(System.currentTimeMillis() - l));
|
|
||||||
l = System.currentTimeMillis();
|
|
||||||
if (!bRet){
|
if (!bRet){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ public class CalculateStationData {
|
||||||
try {
|
try {
|
||||||
//文件路径
|
//文件路径
|
||||||
String filePath = parameterFilePath+ File.separator +"parameter.xml";
|
String filePath = parameterFilePath+ File.separator +"parameter.xml";
|
||||||
filePath = "F:\\RunSoftware\\ARMD1.0.4\\SystemManager.xml";
|
|
||||||
//声明一个实体类存储参数信息
|
//声明一个实体类存储参数信息
|
||||||
RateParam mRateParam = new RateParam();
|
RateParam mRateParam = new RateParam();
|
||||||
//创建一个文档解析器工厂
|
//创建一个文档解析器工厂
|
||||||
|
|
Loading…
Reference in New Issue
Block a user