格式化名称时,活时间保留6位有效数字
This commit is contained in:
parent
578f909256
commit
1a897868e5
|
@ -8,6 +8,7 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -86,34 +87,19 @@ public class NameStandUtil {
|
||||||
|
|
||||||
public String GetSuffix(String dataType, String Fulltype, String LT) {
|
public String GetSuffix(String dataType, String Fulltype, String LT) {
|
||||||
String rData = "";
|
String rData = "";
|
||||||
BigDecimal bd = new BigDecimal(LT);
|
DecimalFormat df = new DecimalFormat("#.##########");
|
||||||
//AUX09_003-20151226_1855 _S_FULL_40184.8.PHD
|
//AUX09_003-20151226_1855 _S_FULL_40184.8.PHD
|
||||||
//将acquisition_live_time保留一位小数 如果保留一位小数后小数点后的值是0则四舍五入保留整数,否则按正常条件四舍五入保留小数位
|
//将acquisition_live_time保留六位有效数字 如果保留一位小数后小数点后的值是0则四舍五入保留整数,否则按正常条件四舍五入保留小数位
|
||||||
String scale = bd.setScale(1, RoundingMode.HALF_UP).toString();
|
String numberCal = NumberFormatUtil.numberCal(LT);
|
||||||
|
numberCal = df.format(Double.valueOf(numberCal));
|
||||||
if(dataType.contains(DataType.SAMPLEPHD.getType())) {
|
if(dataType.contains(DataType.SAMPLEPHD.getType())) {
|
||||||
if (scale.indexOf(".0") > 0) {
|
rData = "_S_"+Fulltype+"_"+numberCal+".PHD";
|
||||||
bd = bd.setScale(0, RoundingMode.HALF_UP);
|
|
||||||
} else {
|
|
||||||
bd = bd.setScale(1, RoundingMode.HALF_UP);
|
|
||||||
}
|
|
||||||
rData = "_S_"+Fulltype+"_"+bd+".PHD";
|
|
||||||
} else if(dataType.contains(DataType.GASBKPHD.getType())){
|
} else if(dataType.contains(DataType.GASBKPHD.getType())){
|
||||||
if (scale.indexOf(".0") > 0) {
|
rData = "_G_"+Fulltype+"_"+numberCal+".PHD";
|
||||||
bd = bd.setScale(0, RoundingMode.HALF_UP);
|
|
||||||
} else {
|
|
||||||
bd = bd.setScale(1, RoundingMode.HALF_UP);
|
|
||||||
}
|
|
||||||
rData = "_G_"+Fulltype+"_"+bd+".PHD";
|
|
||||||
}else if(dataType.contains(DataType.DETBKPHD.getType())){
|
}else if(dataType.contains(DataType.DETBKPHD.getType())){
|
||||||
bd = bd.setScale(0, RoundingMode.HALF_UP);
|
rData = "_D_"+Fulltype+"_"+numberCal+".PHD";
|
||||||
rData = "_D_"+Fulltype+"_"+bd+".PHD";
|
|
||||||
}else if(dataType.contains(DataType.QCPHD.getType())){
|
}else if(dataType.contains(DataType.QCPHD.getType())){
|
||||||
if (scale.indexOf(".0") > 0) {
|
rData = "_Q_"+Fulltype+"_"+numberCal+".PHD";
|
||||||
bd = bd.setScale(0, RoundingMode.HALF_UP);
|
|
||||||
} else {
|
|
||||||
bd = bd.setScale(2, RoundingMode.HALF_UP);
|
|
||||||
}
|
|
||||||
rData = "_Q_"+Fulltype+"_"+bd+".PHD";
|
|
||||||
}
|
}
|
||||||
return rData;
|
return rData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user