Round Half Down edit to prevent deprecated warnings

master
yixian 6 years ago
parent af2e674a2b
commit 8e78d70a7e

@ -79,6 +79,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -1012,7 +1013,7 @@ public class RetailAppServiceImp implements RetailAppService {
@Override @Override
public void sendCleanMessage(JSONObject log_clearing_detail, int client_id) { public void sendCleanMessage(JSONObject log_clearing_detail, int client_id) {
String clearing_amount = log_clearing_detail.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString(); String clearing_amount = log_clearing_detail.getBigDecimal("clearing_amount").setScale(2, RoundingMode.HALF_DOWN).toString();
String settle_date_from = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_from"), "MM/dd/yyyy"); String settle_date_from = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_from"), "MM/dd/yyyy");
String settle_date_to = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_to"), "MM/dd/yyyy"); String settle_date_to = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_to"), "MM/dd/yyyy");
logger.debug("sendCleanMessage-" + log_clearing_detail.getString("client_moniker") + "- " + PlatformEnvironment.getEnv().getForeignCurrency() + " " logger.debug("sendCleanMessage-" + log_clearing_detail.getString("client_moniker") + "- " + PlatformEnvironment.getEnv().getForeignCurrency() + " "

@ -510,9 +510,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
String transactionTime = DateFormatUtils.format(transaction.getDate("transaction_time"), "dd/MM/yyyy h:mm:ss a", Locale.ENGLISH); String transactionTime = DateFormatUtils.format(transaction.getDate("transaction_time"), "dd/MM/yyyy h:mm:ss a", Locale.ENGLISH);
int multiply = "Credit".equals(transaction.getString("transaction_type")) ? 1 : -1; int multiply = "Credit".equals(transaction.getString("transaction_type")) ? 1 : -1;
BigDecimal transactionAmount = transaction.getBigDecimal("transaction_amount").multiply(BigDecimal.valueOf(multiply)).setScale(2, BigDecimal transactionAmount = transaction.getBigDecimal("transaction_amount").multiply(BigDecimal.valueOf(multiply)).setScale(2,
BigDecimal.ROUND_HALF_DOWN); RoundingMode.HALF_DOWN);
BigDecimal clearingAmount = transaction.getBigDecimal("clearing_amount").multiply(BigDecimal.valueOf(multiply)).setScale(2, BigDecimal clearingAmount = transaction.getBigDecimal("clearing_amount").multiply(BigDecimal.valueOf(multiply)).setScale(2,
BigDecimal.ROUND_HALF_DOWN); RoundingMode.HALF_DOWN);
String[] values = {transaction.getString("system_transaction_id"), transaction.getString("order_id"), transaction.getString("client_id"), String[] values = {transaction.getString("system_transaction_id"), transaction.getString("order_id"), transaction.getString("client_id"),
transaction.getString("device_id"), transaction.getString("transaction_currency"), transactionAmount.toPlainString(), transaction.getString("device_id"), transaction.getString("transaction_currency"), transactionAmount.toPlainString(),
transaction.getString("clearing_currency"), clearingAmount.toPlainString(), transaction.getString("channel"), transactionTime, "0"}; transaction.getString("clearing_currency"), clearingAmount.toPlainString(), transaction.getString("channel"), transactionTime, "0"};

@ -129,6 +129,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
@ -3040,7 +3041,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (appClientBean.getCustomerSurchargeRate() <= 0) { if (appClientBean.getCustomerSurchargeRate() <= 0) {
throw new ForbiddenException("customerSurchargeRate is 0"); throw new ForbiddenException("customerSurchargeRate is 0");
} }
BigDecimal customerSurchargeRate = new BigDecimal(appClientBean.getCustomerSurchargeRate()).setScale(2, BigDecimal.ROUND_HALF_DOWN); BigDecimal customerSurchargeRate = new BigDecimal(appClientBean.getCustomerSurchargeRate()).setScale(2, RoundingMode.HALF_DOWN);
setCustomerSurchargeRate(account, client.getString("client_moniker"), customerSurchargeRate); setCustomerSurchargeRate(account, client.getString("client_moniker"), customerSurchargeRate);
} }
clientInfoCacheSupport.clearClientCache(client_id); clientInfoCacheSupport.clearClientCache(client_id);

Loading…
Cancel
Save