feat: 添加AlipayPlus费率配置

master
zhangtao 4 years ago
parent 236d2c6a14
commit db21bdac44

@ -2013,14 +2013,33 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate"); configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate");
configNewClientRate(config, clientId, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate"); configNewClientRate(config, clientId, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate");
configNewClientRate(config, clientId, "CB_BankPay", "cb_bankpay_rate_value", org, "min_cb_bankpay_rate"); configNewClientRate(config, clientId, "CB_BankPay", "cb_bankpay_rate_value", org, "min_cb_bankpay_rate");
addAlipayPlusRateConfig(config,clientId,PayChannel.ALIPAY_PLUS.getChannelCode());
} }
private void addAlipayPlusRateConfig(JSONObject config,int clientId, String channel){
if (config.getString("alipay_cn_retail") != null){
config.put("pay_type","alipay_cn_retail");
configNewClientRate(config, clientId, channel, "alipay_cn_retail", null, null);
}
if (config.getString("alipay_cn_online")!= null){
config.put("pay_type","alipay_cn_online");
configNewClientRate(config, clientId, channel, "alipay_cn_online", null,null);
}
if (config.getString("alipay_other")!= null){
config.put("pay_type","alipay_other");
configNewClientRate(config, clientId, channel, "alipay_other", null,null);
}
config.remove("pay_type");
}
private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey, JSONObject org, String rateValueKey) { private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey, JSONObject org, String rateValueKey) {
if (config.containsKey(rateKey)) { if (config.containsKey(rateKey)) {
JSONObject newConfig = new JSONObject(); JSONObject newConfig = new JSONObject();
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);
newConfig.put("pay_type",config.getString("pay_type"));
if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getBigDecimal("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getBigDecimal("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) {
return; return;
} }
@ -2033,10 +2052,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
newConfig.put("ext_rates", extRateParams.toJSONString()); newConfig.put("ext_rates", extRateParams.toJSONString());
} else { } else {
List<JSONObject> existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel); List<JSONObject> existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel);
for (JSONObject rateLog : existRate) { existRate.stream().filter(existConfig->{
rateLog.put("expiry_time", DateUtils.addDays(config.getDate("active_time"), -1)); if(existConfig.getDate("active_time").equals(config.getDate("active_time")) && existConfig.getDate("expiry_time").equals(config.getDate("expiry_time")) ){
clientRateMapper.updateConfig(rateLog); return false;
} }
return true;
}
)
.forEach((rateLog)->{
rateLog.put("expiry_time", DateUtils.addDays(config.getDate("active_time"), -1));
clientRateMapper.updateConfig(rateLog);
});
} }
if ("cb_bankpay".equalsIgnoreCase(channel)) { if ("cb_bankpay".equalsIgnoreCase(channel)) {
if (newConfig.getBigDecimal("cb_bankpay_rate_value") != null) { if (newConfig.getBigDecimal("cb_bankpay_rate_value") != null) {

Loading…
Cancel
Save