要求:
不要四舍五入,
如果没有小数位,将小数点后面的.0改成.00(比如2转换成2.00,而不是2.0)
不知道会有多少位小数,有多少位显示多少位
想要的结果
比如这种的
88.495000
将后面的0给去掉
要是88.495236
就不用去掉
如果是六个0就保留小数点后两位
比如
100.000000
改成
100.00
以下是源码
要求:
如何源码不变下增加代码
private Map<String,BigDecimal[]> getMaxMinPrice(List<QuotationOffer> quotbillheads, Map<String,BigDecimal[]> accptanceMap, Map<String,BigDecimal[]> paymentmap,
Map<String,BigDecimal[]> notaxPriceMap, Map<String,BigDecimal[]> notaxAccptanceMap, Map<String,BigDecimal[]> notaxPaymentmap){
Map<String,BigDecimal[]> priceMap = new HashMap<String,BigDecimal[]>();
for(QuotationOffer quot:quotbillheads){
List<QuotationOfferDetail> qutoDetails = quot.getQuotationOfferDetailArrayList();
for(QuotationOfferDetail quotDetail:qutoDetails){
if (quotDetail.getUnpdReleased() != null && quotDetail.getUnpdReleased().booleanValue()) continue;
String offerbid = quotDetail.getOfferBId().toString();
BigDecimal price = quotDetail.getPrice() == null ? BigDecimal.ZERO : quotDetail.getPrice();
BigDecimal acceptancePrice = quotDetail.getAcceptancePrice() == null ? BigDecimal.ZERO : quotDetail.getAcceptancePrice();
BigDecimal paymentPrice = quotDetail.getPaymentPrice() == null ? BigDecimal.ZERO : quotDetail.getPaymentPrice();
BigDecimal notaxPrice = quotDetail.getNoTaxPrice() == null ? BigDecimal.ZERO : quotDetail.getNoTaxPrice();
BigDecimal notaxAcceptancePrice = quotDetail.getNoTaxAcceptancePrice() == null ? BigDecimal.ZERO : quotDetail.getNoTaxAcceptancePrice();
BigDecimal notaxPaymentPrice = quotDetail.getNoTaxPaymentPrice() == null ? BigDecimal.ZERO : quotDetail.getNoTaxPaymentPrice();
BigDecimal price_exchanged = quotDetail.getPrice_exchanged() == null ? BigDecimal.ZERO : quotDetail.getPrice_exchanged();
BigDecimal acceptancePrice_exchanged = quotDetail.getAcceptancePrice_exchanged() == null ? BigDecimal.ZERO : quotDetail.getAcceptancePrice_exchanged();
BigDecimal paymentPrice_exchanged = quotDetail.getPaymentPrice_exchanged() == null ? BigDecimal.ZERO : quotDetail.getPaymentPrice_exchanged();
BigDecimal notaxPrice_exchanged = quotDetail.getNoTaxPrice_exchanged() == null ? BigDecimal.ZERO : quotDetail.getNoTaxPrice_exchanged();
BigDecimal notaxAcceptancePrice_exchanged = quotDetail.getNoTaxAcceptancePrice_exchanged() == null ? BigDecimal.ZERO : quotDetail.getNoTaxAcceptancePrice_exchanged();
BigDecimal notaxPaymentPrice_exchanged = quotDetail.getNoTaxPaymentPrice_exchanged() == null ? BigDecimal.ZERO : quotDetail.getNoTaxPaymentPrice_exchanged();
multMaxMinPrice(priceMap, offerbid, price_exchanged, notaxPrice_exchanged);
multMaxMinPrice(accptanceMap, offerbid, acceptancePrice_exchanged, notaxAcceptancePrice_exchanged);
multMaxMinPrice(paymentmap, offerbid, paymentPrice_exchanged, notaxPaymentPrice_exchanged);
multMaxMinNotaxPrice(notaxPriceMap, offerbid, notaxPrice_exchanged);
multMaxMinNotaxPrice(notaxAccptanceMap, offerbid, notaxAcceptancePrice_exchanged);
multMaxMinNotaxPrice(notaxPaymentmap, offerbid, notaxPaymentPrice_exchanged);
}
}
return priceMap;
}
如果是在改动源码的情况下是什么样的?