Upd:新增费率,过期之前所有有效时间内费率配置

master
dulingling 4 years ago
parent 3b9bec751e
commit 47e1131c78

@ -1935,8 +1935,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
newConfig.putAll(config); newConfig.putAll(config);
newConfig.put("rate_value", config.getBigDecimal(rateKey)); newConfig.put("rate_value", config.getBigDecimal(rateKey));
newConfig.put("rate_name", channel); newConfig.put("rate_name", channel);
if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) {
config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) {
return; return;
} }
if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type"))) { if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type"))) {
@ -1946,11 +1945,26 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}}; }};
newConfig.put("ext_rates", extRateParams.toJSONString()); newConfig.put("ext_rates", extRateParams.toJSONString());
} }
pastRate(clientId,channel);
clientRateMapper.saveRate(newConfig); clientRateMapper.saveRate(newConfig);
logger.info(clientId + "的" + channel + "费率设置成功"); logger.info(clientId + "的" + channel + "费率设置成功");
} }
} }
private void pastRate(int clientId,String rateName){
List<JSONObject> 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",DateUtils.addDays(new Date(), -1));
clientRateMapper.updateConfig(rateItem);
}
}
}
@Override @Override
@Transactional @Transactional
public void modifyRateConfig(JSONObject manager, String clientMoniker, int rateId, ClientRateConfig config) { public void modifyRateConfig(JSONObject manager, String clientMoniker, int rateId, ClientRateConfig config) {

Loading…
Cancel
Save