新增费率配置修改

master
dulingling 4 years ago
parent b76545996d
commit c5b03910ec

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>2.3.7</version>
<version>2.3.8</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.2.0</jib-maven-plugin.version>

@ -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) {

Loading…
Cancel
Save