diff --git a/pom.xml b/pom.xml index 9258ce330..a559b6ef2 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) {