GammaFileUtil修改文件内容获取错误问题
NameStandUtil修改文件路径错误问题 修改Gamma模块saveToDB接口
This commit is contained in:
parent
5e5474eb2f
commit
bec2a892a1
|
@ -56,7 +56,7 @@ public class GammaFileUtil {
|
|||
@Autowired
|
||||
private NameStandUtil nameStandUtil;
|
||||
|
||||
public boolean loadFile(String pathName, String fileName, PHDFile phd, Result result){
|
||||
public boolean loadFile(String pathName, String fileName, PHDFile phd, Result result) {
|
||||
phd.setFilepath(pathName);
|
||||
phd.setFilename(fileName);
|
||||
//连接ftp
|
||||
|
@ -2804,7 +2804,7 @@ public class GammaFileUtil {
|
|||
String subDirSavePath = "";
|
||||
subDirSavePath+=nameStandUtil.GetSysTemSubdir(fileAnlyse.getHeader().getSystem_type());
|
||||
subDirSavePath+=nameStandUtil.GetDateTypeSubdir(dataType);
|
||||
Map<String, String> fileNames = nameStandUtil.NameStandard(subDirSavePath, fileAnlyse);
|
||||
Map<String, String> fileNames = nameStandUtil.NameStandard(fileAnlyse);
|
||||
String lcName = fileNames.get("lc");
|
||||
String scacName = fileNames.get("scac");
|
||||
String baselineName = fileNames.get("baseline");
|
||||
|
|
|
@ -20,15 +20,15 @@ public class NameStandUtil {
|
|||
public String GetSysTemSubdir(String systemType) {
|
||||
StringBuffer path = new StringBuffer();
|
||||
if(systemType.contains(SystemType.BETA.getType())) {
|
||||
path.append(StringPool.SLASH+"Spectrum");
|
||||
path.append("Spectrum");
|
||||
path.append(StringPool.SLASH+"Xenon");
|
||||
path.append(StringPool.SLASH+"Sauna");
|
||||
} else if(systemType.contains(SystemType.GAMMA.getType())) {
|
||||
path.append(StringPool.SLASH+"Spectrum");
|
||||
path.append("Spectrum");
|
||||
path.append(StringPool.SLASH+"Xenon");
|
||||
path.append(StringPool.SLASH+"Spalax");
|
||||
} else if(systemType.contains(SystemType.PARTICULATE.getType())) {
|
||||
path.append(StringPool.SLASH+"Spectrum");
|
||||
path.append("Spectrum");
|
||||
path.append(StringPool.SLASH+"Particulates");
|
||||
}
|
||||
return path.toString();
|
||||
|
@ -78,9 +78,9 @@ public class NameStandUtil {
|
|||
return path.toString();
|
||||
}
|
||||
|
||||
public Map<String, String> NameStandard(String path, PHDFile fileAnlyse) {
|
||||
public Map<String, String> NameStandard(PHDFile fileAnlyse) {
|
||||
String suffix = GetSuffix(fileAnlyse.getMsgInfo().getData_type(),fileAnlyse.getHeader().getSystem_type(),fileAnlyse.getHeader().getSpectrum_quantity(),String.valueOf(fileAnlyse.getAcq().getAcquisition_live_time()));
|
||||
Map<String, String> fileNames = NameStandardByName(path, fileAnlyse.getFilename(), fileAnlyse.getHeader().getMeasurement_id(),suffix);
|
||||
Map<String, String> fileNames = NameStandardByName(fileAnlyse.getFilename(), fileAnlyse.getHeader().getMeasurement_id(),suffix);
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
|
@ -117,13 +117,12 @@ public class NameStandUtil {
|
|||
return rData;
|
||||
}
|
||||
|
||||
public Map<String, String> NameStandardByName(String path, String fileName, String dateTimeFormat, String suffix) {
|
||||
public Map<String, String> NameStandardByName(String fileName, String dateTimeFormat, String suffix) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
String StandardFileName="";
|
||||
String measurementName = GetFileNameFromDateTime(dateTimeFormat, suffix);
|
||||
String fileDir = path + StringPool.SLASH;
|
||||
if(measurementName != fileName) {
|
||||
StandardFileName = fileDir+measurementName;
|
||||
StandardFileName = measurementName;
|
||||
}
|
||||
String fileSuffix = "PHD";
|
||||
|
||||
|
@ -133,11 +132,11 @@ public class NameStandUtil {
|
|||
String m_logfileName = StandardFileName;
|
||||
String m_reportFileName = StandardFileName;
|
||||
|
||||
m_lcFileName.replace(fileSuffix,"lc");
|
||||
m_baseLineFileName.replace(fileSuffix,"baseline");
|
||||
m_scacFileName.replace(fileSuffix,"scac");
|
||||
m_logfileName.replace(fileSuffix,"log");
|
||||
m_reportFileName.replace("."+fileSuffix,"_rpt");
|
||||
m_lcFileName = m_lcFileName.replace(fileSuffix,"lc");
|
||||
m_baseLineFileName = m_baseLineFileName.replace(fileSuffix,"baseline");
|
||||
m_scacFileName = m_scacFileName.replace(fileSuffix,"scac");
|
||||
m_logfileName = m_logfileName.replace(fileSuffix,"log");
|
||||
m_reportFileName = m_reportFileName.replace("."+fileSuffix,"_rpt");
|
||||
|
||||
String m_saveFileName = StandardFileName;
|
||||
|
||||
|
@ -189,7 +188,7 @@ public class NameStandUtil {
|
|||
//添加文件名日期
|
||||
List<String> dateSub = GetSubDirByFileName(saveFileName);
|
||||
for(int pos=0;pos<dateSub.size();pos++) {
|
||||
input_file_name=input_file_name+dateSub.get(pos)+StringPool.SLASH;
|
||||
input_file_name=input_file_name+StringPool.SLASH+dateSub.get(pos);
|
||||
}
|
||||
return input_file_name;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.jeecg.modules.service.*;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
|
@ -2799,13 +2800,17 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result saveToDB(String fileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
boolean bRet = true;
|
||||
boolean needUploadSpec = false;
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
if (Objects.isNull(phd)) {
|
||||
result.error500("请先解析文件!");
|
||||
return result;
|
||||
}
|
||||
//查看分析员是否有权限操作当前台站信息
|
||||
//判断当前分析员是否有过排班任务
|
||||
Integer stationId = spectrumAnalysisMapper.getStationId(phd.getHeader().getSite_code());
|
||||
|
@ -2837,8 +2842,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
phd.setStatus(sampleData.getStatus());
|
||||
} else {
|
||||
//如果sampleData为空 存储数据
|
||||
needUploadSpec = SaveSampleToDB(phd, middleData.analyses_save_filePath);
|
||||
bRet = needUploadSpec;
|
||||
bRet = SaveSampleToDB(phd, middleData.analyses_save_filePath);
|
||||
}
|
||||
if(!bRet) {
|
||||
result.error500("The Database hasn't this Spectrum("+phd.getFilename()+") and Insert it to Database failed.");
|
||||
|
@ -2931,6 +2935,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
|
||||
boolean bRet = true;
|
||||
String sit_det_code = phd.getHeader().getSite_code();
|
||||
|
|
|
@ -113,7 +113,7 @@ public class GardsSampleDataSpectrumServiceImpl extends ServiceImpl<GardsSampleD
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
String acq_stop = DateUtils.formatDate(new Date(acq_stop_dt), "yyyy/MM/dd HH:mm:ss");
|
||||
String data_type = (StringUtils.isBlank(phd.getMsgInfo().getData_type())? "":phd.getMsgInfo().getData_type());
|
||||
String data_type = phd.getMsgInfo().getData_type().substring(0, 1);
|
||||
GardsSampleData sampleData = new GardsSampleData();
|
||||
try {
|
||||
sampleData.setSiteDetCode(phd.getHeader().getDetector_code());
|
||||
|
|
|
@ -33,18 +33,16 @@ public class GardsSampleDescriptionSpectrumServiceImpl extends ServiceImpl<Gards
|
|||
@Transactional
|
||||
public boolean saveSampleDescriptionGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
if(StringUtils.isNotBlank(phd.getOriTotalCmt())) {
|
||||
String t_cmt = phd.getOriTotalCmt();
|
||||
if(t_cmt.length() > 1024){
|
||||
t_cmt = t_cmt.substring(0, 1024);
|
||||
}
|
||||
GardsSampleDescription sampleDescription = new GardsSampleDescription();
|
||||
sampleDescription.setSampleId(sampleId);
|
||||
sampleDescription.setDescription(t_cmt);
|
||||
int insert = this.baseMapper.insert(sampleDescription);
|
||||
if (insert>0) {
|
||||
bRet = true;
|
||||
}
|
||||
String t_cmt = StringUtils.isNotBlank(phd.getOriTotalCmt())?phd.getOriTotalCmt():"";
|
||||
if(t_cmt.length() > 1024){
|
||||
t_cmt = t_cmt.substring(0, 1024);
|
||||
}
|
||||
GardsSampleDescription sampleDescription = new GardsSampleDescription();
|
||||
sampleDescription.setSampleId(sampleId);
|
||||
sampleDescription.setDescription(t_cmt);
|
||||
int insert = this.baseMapper.insert(sampleDescription);
|
||||
if (insert>0) {
|
||||
bRet = true;
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user