From e5eb03cc2e9b1b93ed9a99fd1fb44f4ca0c0fb1e Mon Sep 17 00:00:00 2001 From: dulingling Date: Fri, 22 May 2020 14:05:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B4=B9=E7=8E=87=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../core/impls/ClientManagerImpl.java | 20 +++++-------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index b23cc0bec..ab17ae172 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.7 + 2.3.8 UTF-8 2.2.0 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 b3e5ad078..4c707df9a 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 @@ -1938,6 +1938,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { return; } + List existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel); + for (JSONObject rateLog : existRate) { + rateLog.put("expiry_time", DateUtils.addDays(config.getDate("active_time"), -1)); + clientRateMapper.updateConfig(rateLog); + } if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type"))) { JSONObject extRateParams = new JSONObject() {{ put("domestic_rate_value", config.getBigDecimal("rate_value")); @@ -1945,26 +1950,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid }}; newConfig.put("ext_rates", extRateParams.toJSONString()); } - pastRate(clientId,channel); clientRateMapper.saveRate(newConfig); logger.info(clientId + "的" + channel + "费率设置成功"); } } - private void pastRate(int clientId,String rateName){ - List rates = clientRateMapper.listClientRates(clientId, rateName); - if (!rates.isEmpty()) { - Date today = DateUtils.truncate(new Date(), Calendar.DATE); - for (JSONObject rateItem : rates) { - if (rateItem.getDate("expiry_time").before(today) || rateItem.getDate("active_time").after(today)) { - continue; - } - rateItem.put("expiry_time",new Date()); - clientRateMapper.updateConfig(rateItem); - } - } - } - @Override @Transactional public void modifyRateConfig(JSONObject manager, String clientMoniker, int rateId, ClientRateConfig config) {