delete
This commit is contained in:
parent
6d64193002
commit
e32e1085f1
|
@ -1,196 +0,0 @@
|
|||
package org.jeecg.common;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.base.enums.DataType;
|
||||
import org.jeecg.modules.base.enums.SystemType;
|
||||
import org.jeecg.modules.entity.vo.PHDFile;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
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(StringPool.SLASH+"Xenon");
|
||||
path.append(StringPool.SLASH+"Sauna");
|
||||
} else if(systemType.contains(SystemType.GAMMA.getType())) {
|
||||
path.append(StringPool.SLASH+"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(StringPool.SLASH+"Particulates");
|
||||
}
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
public String GetDateTypeSubdir(String dataType){
|
||||
StringBuffer path = new StringBuffer();
|
||||
if(dataType.contains(DataType.SAMPLEPHD.getType()))
|
||||
{
|
||||
path.append(StringPool.SLASH+"Samplephd");
|
||||
}
|
||||
else if(dataType.contains(DataType.QCPHD.getType()))
|
||||
{
|
||||
path.append(StringPool.SLASH+"Qcphd");
|
||||
}
|
||||
else if(dataType.contains(DataType.DETBKPHD.getType()))
|
||||
{
|
||||
path.append(StringPool.SLASH+"Detbkphd");
|
||||
}
|
||||
else if(dataType.contains(DataType.GASBKPHD.getType()))
|
||||
{
|
||||
path.append(StringPool.SLASH+"Gasbkphd");
|
||||
}
|
||||
else if(dataType.contains(DataType.SOH.getType()))
|
||||
{
|
||||
path.append(StringPool.SLASH+"Soh");
|
||||
}
|
||||
else if(dataType.contains(DataType.MET.getType()))
|
||||
{
|
||||
path.append(StringPool.SLASH+"Met");
|
||||
}
|
||||
else if(dataType.contains(DataType.ALERT_FLOW.getType())||
|
||||
dataType.contains(DataType.ALERT_SYSTEM.getType())||
|
||||
dataType.contains(DataType.ALERT_TEMP.getType())||
|
||||
dataType.contains(DataType.ALERT_UPS.getType()))
|
||||
{
|
||||
path.append(StringPool.SLASH+"Alert");
|
||||
}
|
||||
else if(dataType.contains(DataType.ERROR.getType()))
|
||||
{
|
||||
path.append(StringPool.SLASH+"Error");
|
||||
}
|
||||
else
|
||||
{
|
||||
path.append(StringPool.SLASH+"Other");
|
||||
}
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
public Map<String, String> NameStandard(String path, 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);
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
public String GetSuffix(String dataType,String sysType,String Fulltype,String LT) {
|
||||
String rData = "";
|
||||
BigDecimal bd = new BigDecimal(LT);
|
||||
if(dataType.contains(DataType.SAMPLEPHD.getType())) {
|
||||
bd = bd.setScale(1, RoundingMode.HALF_UP);
|
||||
rData = "_S_"+Fulltype+"_"+bd+".PHD";
|
||||
} else if(dataType.contains(DataType.GASBKPHD.getType())){
|
||||
bd = bd.setScale(1, RoundingMode.HALF_UP);
|
||||
rData = "_G_"+Fulltype+"_"+bd+".PHD";
|
||||
}else if(dataType.contains(DataType.DETBKPHD.getType())){
|
||||
bd = bd.setScale(0, RoundingMode.HALF_UP);
|
||||
rData = "_D_"+Fulltype+"_"+bd+".PHD";
|
||||
}else if(dataType.contains(DataType.QCPHD.getType())){
|
||||
bd = bd.setScale(2, RoundingMode.HALF_UP);
|
||||
rData = "_Q_"+Fulltype+"_"+bd+".PHD";
|
||||
}
|
||||
return rData;
|
||||
}
|
||||
|
||||
public Map<String, String> NameStandardByName(String path, 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;
|
||||
}
|
||||
String fileSuffix = "PHD";
|
||||
|
||||
String m_lcFileName = StandardFileName;
|
||||
String m_baseLineFileName = StandardFileName;
|
||||
String m_scacFileName = StandardFileName;
|
||||
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");
|
||||
|
||||
String m_saveFileName = StandardFileName;
|
||||
|
||||
map.put("lc", m_lcFileName);
|
||||
map.put("baseline", m_baseLineFileName);
|
||||
map.put("scac", m_scacFileName);
|
||||
map.put("log", m_logfileName);
|
||||
map.put("rpt", m_reportFileName);
|
||||
map.put("saveFile", m_saveFileName);
|
||||
return map;
|
||||
}
|
||||
|
||||
public String GetFileNameFromDateTime(String dateTimeFormat, String suffix){
|
||||
String rData = "";
|
||||
int pos = dateTimeFormat.indexOf("-");
|
||||
if(-1 != pos) {
|
||||
String dateTime = dateTimeFormat;
|
||||
if (pos+17>dateTime.length()){
|
||||
dateTime = dateTime.substring(pos+1);
|
||||
}else {
|
||||
dateTime = dateTime.substring(pos+1, pos+17);
|
||||
}
|
||||
dateTime = dateTime.replace(" ","-");
|
||||
String fileHeader = dateTimeFormat.substring(0, pos+1);
|
||||
String temp = DateTimeStandardToFileFormat(dateTime);
|
||||
rData = fileHeader+ temp + suffix;
|
||||
}
|
||||
return rData;
|
||||
}
|
||||
|
||||
public String DateTimeStandardToFileFormat(String data) {
|
||||
String dateTime = "";
|
||||
try {
|
||||
if ( data.indexOf("-") > 0 ){
|
||||
dateTime = DateUtils.formatDate(DateUtils.parseDate(data,"yyyy/MM/dd-HH:mm"), "yyyyMMdd_HHmm");
|
||||
} else if( data.indexOf(" ") > 0 ) {
|
||||
dateTime = DateUtils.formatDate(DateUtils.parseDate(data,"yyyy/MM/dd HH:mm"), "yyyyMMdd_HHmm");
|
||||
} else if( data.indexOf("-")<0 && data.indexOf(" ") < 0) {
|
||||
dateTime = DateUtils.formatDate(DateUtils.parseDate(data,"yyyy/MM/dd"), "yyyyMMdd");
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public String SetFileDir(String path, String saveFileName) {
|
||||
String input_file_name = path;
|
||||
//添加文件名日期
|
||||
List<String> dateSub = GetSubDirByFileName(saveFileName);
|
||||
for(int pos=0;pos<dateSub.size();pos++) {
|
||||
input_file_name=input_file_name+dateSub.get(pos)+StringPool.SLASH;
|
||||
}
|
||||
return input_file_name;
|
||||
}
|
||||
|
||||
public List<String> GetSubDirByFileName(String fileName) {
|
||||
List<String> rData = new LinkedList<>();
|
||||
int pos = fileName.indexOf('-');
|
||||
if(-1 == pos) {
|
||||
//
|
||||
} else if(fileName.length()>=pos+7) {
|
||||
rData.add(fileName.substring(pos+1, pos+5));
|
||||
rData.add(fileName.substring(pos+5, pos+7));
|
||||
}
|
||||
return rData;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user