diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java index 9d5ac067f..4b65265e5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java @@ -793,7 +793,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { newConfig.put("rate_value", config.getBigDecimal(rateKey)); newConfig.put("rate_name", channel); if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), - config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { + config.getBigDecimal("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { return; } List existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java index 7b606adc5..896a60f58 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java @@ -1,12 +1,13 @@ package au.com.royalpay.payment.manage.mappers.system; +import com.alibaba.fastjson.JSONObject; import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; import com.yixsoft.support.mybatis.autosql.annotations.SqlType; -import com.alibaba.fastjson.JSONObject; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator; +import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -38,7 +39,7 @@ public interface ClientRateMapper { @AutoSql(SqlType.SELECT) List listClientRatesForSaving(@Param("client_id") int clientId, @Param("active_time") Date activeTime, - @Param("expiry_time") Date expiryTime, @Param("rate_value") Double rateValue, + @Param("expiry_time") Date expiryTime, @Param("rate_value") BigDecimal rateValue, @Param("clean_days") Integer cleanDays, @Param("rate_name") String rateName); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java index 994dd765f..d3b6f8a97 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java @@ -7,6 +7,7 @@ import org.apache.commons.lang3.time.DateUtils; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; +import java.math.BigDecimal; import java.util.Calendar; import java.util.Date; @@ -21,11 +22,11 @@ public class ClientRateConfig { @JSONField(name = "rate_value") @NotNull(message = "error.payment.valid.param_missing") - private Double rateValue; + private BigDecimal rateValue; @JSONField(name = "transaction_fee") @NotNull(message = "error.payment.valid.param_missing") - private Double transactionFee = 0.00; + private BigDecimal transactionFee = BigDecimal.ZERO; @JSONField(name = "active_time") @NotNull(message = "error.payment.valid.param_missing") @@ -53,7 +54,7 @@ public class ClientRateConfig { this.rateName = rateName; } - public void setRateValue(Double rateValue) { + public void setRateValue(BigDecimal rateValue) { this.rateValue = rateValue; } @@ -69,7 +70,7 @@ public class ClientRateConfig { return rateName; } - public Double getRateValue() { + public BigDecimal getRateValue() { return rateValue; } @@ -97,11 +98,11 @@ public class ClientRateConfig { this.remark = remark; } - public Double getTransactionFee() { + public BigDecimal getTransactionFee() { return transactionFee; } - public void setTransactionFee(Double transactionFee) { + public void setTransactionFee(BigDecimal transactionFee) { this.transactionFee = transactionFee; } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 6ccd85567..2a93c40ef 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -1951,7 +1951,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid newConfig.putAll(config); newConfig.put("rate_value", config.getBigDecimal(rateKey)); newConfig.put("rate_name", channel); - if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { + if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getBigDecimal("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { return; } List existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel); @@ -2005,7 +2005,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getRateName())) { JSONObject extParams = configJson.getJSONObject("ext_rates"); - JSONObject domesticRate = subRateObject(new BigDecimal(config.getRateValue()), config.getCleanDays()); + JSONObject domesticRate = subRateObject(config.getRateValue(), config.getCleanDays()); extParams.put("domestic_rate_value", domesticRate); configJson.put("ext_rates", extParams.toJSONString()); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/events/listeners/NewRateEventListener.java b/src/main/java/au/com/royalpay/payment/manage/merchants/events/listeners/NewRateEventListener.java index 558840b81..dedd73d20 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/events/listeners/NewRateEventListener.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/events/listeners/NewRateEventListener.java @@ -5,16 +5,14 @@ import au.com.royalpay.payment.manage.merchants.core.ClientConfigService; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.events.ClientSignEvent; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; - import com.alibaba.fastjson.JSONObject; - import org.joda.time.DateTime; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; -import java.util.Date; - import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.Date; /** * Created by yixian on 2017-04-11. @@ -32,16 +30,16 @@ public class NewRateEventListener implements ApplicationListener