|
|
|
@ -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<JSONObject> 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<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",new Date());
|
|
|
|
|
clientRateMapper.updateConfig(rateItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public void modifyRateConfig(JSONObject manager, String clientMoniker, int rateId, ClientRateConfig config) {
|
|
|
|
|