From 41ec087b723a5745421eb242a0046c759137d76a Mon Sep 17 00:00:00 2001
From: yuan <1551130722@qq.com>
Date: Fri, 12 Jan 2018 17:54:37 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=88=E4=BC=99=E4=BA=BA?=
=?UTF-8?q?=E6=8F=90=E6=88=90=E6=96=B9=E5=BC=8F=E7=AD=9B=E9=80=89=EF=BC=8C?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=95=86=E6=88=B7=E6=9C=80=E4=BD=8E=E8=B4=B9?=
=?UTF-8?q?=E7=8E=87=E6=A3=80=E6=B5=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../core/impls/ClientManagerImpl.java | 44 ++-
.../manage/organizations/beans/OrgInfo.java | 54 ++++
src/main/ui/manage.html | 2 +
.../config/organizations/organizations.js | 24 +-
.../organizations/templates/new_org.html | 139 +++++++---
.../organizations/templates/org_detail.html | 169 ++++++++---
.../templates/org_detail_parent.html | 262 +++++++++++++++++-
7 files changed, 603 insertions(+), 91 deletions(-)
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 dacf64869..1b1b54812 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
@@ -1164,6 +1164,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
checkOrgPermission(manager, client);
int clientId = client.getIntValue("client_id");
+ JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
if (config == null) {
throw new ForbiddenException(clientId + "费率参数配置不完整,请重新输入===>");
}
@@ -1174,15 +1175,22 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
config.put("update_time", new Date());
config.put("active_time", DateFormatUtils.format(config.getDate("active_time"), "yyyy-MM-dd"));
config.put("expiry_time", DateFormatUtils.format(config.getDate("expiry_time"), "yyyy-MM-dd"));
- configNewClientRate(config, clientId, "Alipay", "alipay_rate_value");
- configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value");
- configNewClientRate(config, clientId, "Wechat", "wechat_rate_value");
- configNewClientRate(config, clientId, "jd", "jd_rate_value");
- configNewClientRate(config, clientId, "Bestpay", "bestpay_rate_value");
+
+ checkAddRate(config,"Wechat", "wechat_rate_value",org,"min_wechat_rate");
+ checkAddRate(config,"Alipay", "alipay_rate_value",org,"min_alipay_rate");
+ checkAddRate(config,"AlipayOnline", "alipayonline_rate_value",org,"min_alipayonline_rate");
+ checkAddRate(config,"Bestpay", "bestpay_rate_value",org,"min_bestpay_rate");
+ checkAddRate(config,"jd", "jd_rate_value",org,"min_jd_rate");
+
+ configNewClientRate(config, clientId, "Wechat", "wechat_rate_value",org,"min_wechat_rate");
+ configNewClientRate(config, clientId, "Alipay", "alipay_rate_value",org,"min_alipay_rate");
+ configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value",org,"min_alipayonline_rate");
+ configNewClientRate(config, clientId, "Bestpay", "bestpay_rate_value",org,"min_bestpay_rate");
+ configNewClientRate(config, clientId, "jd", "jd_rate_value",org,"min_jd_rate");
}
- private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey) {
+ private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey,JSONObject org,String rateValueKey) {
if (config.containsKey(rateKey)) {
JSONObject newConfig = new JSONObject();
newConfig.putAll(config);
@@ -1210,6 +1218,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
checkOrgPermission(manager, client);
JSONObject configJson = config.toJSON();
+ JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
+ checkModifyRate(org,configJson,"Wechat","min_wechat_rate");
+ checkModifyRate(org,configJson,"Alipay","min_alipay_rate");
+ checkModifyRate(org,configJson,"AlipayOnline","min_alipayonline_rate");
+ checkModifyRate(org,configJson,"jd","min_jd_rate");
+ checkModifyRate(org,configJson,"Bestpay","min_bestpay_rate");
configJson.put("client_rate_id", rateId);
configJson.put("manager_id", manager.getString("manager_id"));
configJson.put("manager_name", manager.getString("username"));
@@ -1223,6 +1237,24 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
// clientMapper.updateCleanDays(clientId, config.getCleanDays());
}
+ private void checkModifyRate(JSONObject org,JSONObject configJson,String rateName,String rateValueKey){
+ if(configJson.getString("rate_name").equals(rateName)){
+ if(org.containsKey(rateValueKey)){
+ if(configJson.getDouble("rate_value").compareTo(org.getDouble(rateValueKey)) > 0){
+ throw new ForbiddenException("费率参数大于旗下商户最低"+rateName+"费率,请重新输入===>");
+ };
+ }
+ }
+ }
+ private void checkAddRate(JSONObject config,String channel, String rateKey,JSONObject org,String rateValueKey){
+ if(config.containsKey(rateKey)){
+ if(org.containsKey(rateValueKey)){
+ if(config.getBigDecimal(rateKey).compareTo(org.getBigDecimal(rateValueKey)) > 0){
+ throw new ForbiddenException("费率参数大于旗下商户最低"+channel+"费率,请重新输入===>");
+ };
+ }
+ }
+ }
@Override
public List