feat:format
This commit is contained in:
parent
561533c6c3
commit
1b16ceca8f
|
@ -8,6 +8,10 @@ public interface DateConstant {
|
||||||
|
|
||||||
String DATE_TIME = "yyyy-MM-dd HH:mm:ss";
|
String DATE_TIME = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
String DATE_BIAS = "yyyy/MM/dd";
|
||||||
|
|
||||||
|
String DATE_BIAS_TIME = "yyyy/MM/dd HH:mm:ss";
|
||||||
|
|
||||||
String TIME_START = " 00:00:00";
|
String TIME_START = " 00:00:00";
|
||||||
|
|
||||||
String TIME_END = " 23:59:59";
|
String TIME_END = " 23:59:59";
|
||||||
|
|
|
@ -24,13 +24,6 @@ public class NumUtil {
|
||||||
return decimal.setScale(scale, RoundingMode.HALF_UP).doubleValue();
|
return decimal.setScale(scale, RoundingMode.HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Double keep2(Double value){
|
|
||||||
if (ObjectUtil.isNull(value))
|
|
||||||
return null;
|
|
||||||
BigDecimal decimal = new BigDecimal(String.valueOf(value));
|
|
||||||
return decimal.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String keep2Str(Double value){
|
public static String keep2Str(Double value){
|
||||||
if (ObjectUtil.isNull(value))
|
if (ObjectUtil.isNull(value))
|
||||||
return null;
|
return null;
|
||||||
|
@ -39,13 +32,6 @@ public class NumUtil {
|
||||||
.doubleValue());
|
.doubleValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Double keep3(Double value){
|
|
||||||
if (ObjectUtil.isNull(value))
|
|
||||||
return null;
|
|
||||||
BigDecimal decimal = new BigDecimal(String.valueOf(value));
|
|
||||||
return decimal.setScale(3, RoundingMode.HALF_UP).doubleValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String keep3Str(Double value){
|
public static String keep3Str(Double value){
|
||||||
if (ObjectUtil.isNull(value))
|
if (ObjectUtil.isNull(value))
|
||||||
return null;
|
return null;
|
||||||
|
@ -63,6 +49,13 @@ public class NumUtil {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Double keep(Double value, int scale){
|
||||||
|
if (ObjectUtil.isNull(value))
|
||||||
|
return null;
|
||||||
|
BigDecimal decimal = new BigDecimal(String.valueOf(value));
|
||||||
|
return decimal.setScale(scale, RoundingMode.HALF_UP).doubleValue();
|
||||||
|
}
|
||||||
|
|
||||||
public static String keepStr(Double value, int scale){
|
public static String keepStr(Double value, int scale){
|
||||||
if (ObjectUtil.isNull(value))
|
if (ObjectUtil.isNull(value))
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -39,12 +39,10 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -1929,7 +1927,8 @@ public class GammaServiceImpl implements IGammaService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
Date curTime = new Date();
|
String dateTime = DateUtil.format(new Date(), DateConstant.DATE_BIAS_TIME);
|
||||||
|
String date = DateUtil.format(new Date(), DateConstant.DATE_BIAS);
|
||||||
String responsible_person = "wang shilian";
|
String responsible_person = "wang shilian";
|
||||||
String software = "GammaAnalyser,GammaAnalyALG";
|
String software = "GammaAnalyser,GammaAnalyALG";
|
||||||
int num = phd.getVPeak().size();
|
int num = phd.getVPeak().size();
|
||||||
|
@ -1954,29 +1953,29 @@ public class GammaServiceImpl implements IGammaService {
|
||||||
map.put("header_report_type", "FIN"); // 8: Report Type
|
map.put("header_report_type", "FIN"); // 8: Report Type
|
||||||
map.put("header_report_number", "1"); // 9: Report Number
|
map.put("header_report_number", "1"); // 9: Report Number
|
||||||
map.put("header_sample_category", "Category C"); // 10:Sample Category
|
map.put("header_sample_category", "Category C"); // 10:Sample Category
|
||||||
map.put("header_transmission", curTime); // 11:Message Transmission Time
|
map.put("header_transmission", dateTime); // 11:Message Transmission Time
|
||||||
// Init #Objective
|
// Init #Objective
|
||||||
map.put("Obj_purpose", "The purpose of this analysis is proficiency test.");
|
map.put("Obj_purpose", "The purpose of this analysis is proficiency test.");
|
||||||
map.put("Obj_authorized", "High-resolution non-destructive gamma spectroscopy.");
|
map.put("Obj_authorized", "High-resolution non-destructive gamma spectroscopy.");
|
||||||
map.put("Obj_instruction", "`0");
|
map.put("Obj_instruction", "0");
|
||||||
// Init #Collection
|
// Init #Collection
|
||||||
String col_start = phd.getCollect().getCollection_start_date() + StringPool.SPACE + phd.getCollect().getCollection_start_time();
|
String col_start = phd.getCollect().getCollection_start_date() + StringPool.SPACE + phd.getCollect().getCollection_start_time();
|
||||||
String col_stop = phd.getCollect().getCollection_stop_date() + StringPool.SPACE + phd.getCollect().getCollection_stop_time();
|
String col_stop = phd.getCollect().getCollection_stop_date() + StringPool.SPACE + phd.getCollect().getCollection_stop_time();
|
||||||
map.put("collect_start", col_start);
|
map.put("collect_start", col_start);
|
||||||
map.put("collect_stop", col_stop);
|
map.put("collect_stop", col_stop);
|
||||||
map.put("collect_airVolume", NumUtil.keep3(phd.getCollect().getAir_volume()));
|
map.put("collect_airVolume", NumUtil.keep(phd.getCollect().getAir_volume(), 4));
|
||||||
// Init #SampleReceipt
|
// Init #SampleReceipt
|
||||||
if(StringUtils.isNotBlank(phd.getHeader().getSample_ref_id())){
|
if(StringUtils.isNotBlank(phd.getHeader().getSample_ref_id())){
|
||||||
map.put("Receipt_srid", phd.getHeader().getSample_ref_id());
|
map.put("Receipt_srid", phd.getHeader().getSample_ref_id());
|
||||||
}
|
}
|
||||||
map.put("Receipt_sealNum", "0");
|
map.put("Receipt_sealNum", "0");
|
||||||
map.put("Receipt_sample_dateTime", curTime);
|
map.put("Receipt_sample_dateTime", dateTime);
|
||||||
map.put("Receipt_package", "Parcel.");
|
map.put("Receipt_package", "Parcel.");
|
||||||
map.put("Receipt_seal", "Good.");
|
map.put("Receipt_seal", "Good.");
|
||||||
map.put("Receipt_sample", "Good.");
|
map.put("Receipt_sample", "Good.");
|
||||||
// Init #Test
|
// Init #Test
|
||||||
map.put("Test_type", "Analysis of a reference sample.");
|
map.put("Test_type", "Analysis of a reference sample.");
|
||||||
map.put("Test_completion", curTime);
|
map.put("Test_completion", date);
|
||||||
map.put("Test_person", responsible_person);
|
map.put("Test_person", responsible_person);
|
||||||
map.put("Test_purpose", "The purpose of this analysis is proficiency test exercise.");
|
map.put("Test_purpose", "The purpose of this analysis is proficiency test exercise.");
|
||||||
// Init #PeaksMethod
|
// Init #PeaksMethod
|
||||||
|
@ -2036,20 +2035,28 @@ public class GammaServiceImpl implements IGammaService {
|
||||||
String coverage_factor = "2.00";
|
String coverage_factor = "2.00";
|
||||||
String level_confidence = "95.00";
|
String level_confidence = "95.00";
|
||||||
|
|
||||||
map.put("Result_act_ref", phd.getUsedSetting().getRefTime_act());
|
Date refTimeAct = phd.getUsedSetting().getRefTime_act();
|
||||||
map.put("Result_conc_ref", phd.getUsedSetting().getRefTime_conc());
|
Date refTimeConc = phd.getUsedSetting().getRefTime_conc();
|
||||||
|
String timeAct = "";
|
||||||
|
String timeConc = "";
|
||||||
|
if (ObjectUtil.isNotNull(refTimeAct))
|
||||||
|
timeAct = DateUtil.format(refTimeAct, DateConstant.DATE_BIAS_TIME);
|
||||||
|
if (ObjectUtil.isNotNull(refTimeConc))
|
||||||
|
timeConc = DateUtil.format(refTimeConc, DateConstant.DATE_BIAS_TIME);
|
||||||
|
map.put("Result_act_ref", timeAct);
|
||||||
|
map.put("Result_conc_ref", timeConc);
|
||||||
List<TableResult> tableResultList = new LinkedList<>();
|
List<TableResult> tableResultList = new LinkedList<>();
|
||||||
for(Map.Entry<String, NuclideActMda> it : phd.getMapNucActMda().entrySet()){
|
for(Map.Entry<String, NuclideActMda> it : phd.getMapNucActMda().entrySet()){
|
||||||
if(it.getValue().isBCalculateMDA()) {
|
if(it.getValue().isBCalculateMDA()) {
|
||||||
TableResult tableResult = new TableResult();
|
TableResult tableResult = new TableResult();
|
||||||
NuclideActMda nuc = it.getValue();
|
NuclideActMda nuc = it.getValue();
|
||||||
tableResult.setNuclide(it.getKey());
|
tableResult.setNuclide(it.getKey());
|
||||||
tableResult.setActivity(NumUtil.keepStr(nuc.getActivity(), 6));
|
tableResult.setActivity(NumUtil.keep4ScienceStr(nuc.getActivity()));
|
||||||
String act_err = nuc.getActivity() > 0 ? NumUtil.keepStr(nuc.getAct_err()/nuc.getActivity()*100, 4) : "0";
|
String act_err = nuc.getActivity() > 0 ? NumUtil.keepStr(nuc.getAct_err()/nuc.getActivity()*100, 2) : "0";
|
||||||
tableResult.setActErr(act_err);
|
tableResult.setActErr(act_err);
|
||||||
tableResult.setFactor1(coverage_factor);
|
tableResult.setFactor1(coverage_factor);
|
||||||
tableResult.setConfidence1(level_confidence);
|
tableResult.setConfidence1(level_confidence);
|
||||||
tableResult.setConc(NumUtil.keepStr(nuc.getConcentration()/1000, 5));
|
tableResult.setConc(NumUtil.keep4ScienceStr(nuc.getConcentration()/1000));
|
||||||
tableResult.setConcErr(act_err);
|
tableResult.setConcErr(act_err);
|
||||||
tableResult.setFactor2(coverage_factor);
|
tableResult.setFactor2(coverage_factor);
|
||||||
tableResult.setConfidence2(level_confidence);
|
tableResult.setConfidence2(level_confidence);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user