|
|
|
@ -43,11 +43,17 @@ import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.ApproveEmailAuditModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.GreenChannelAuditModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.MerchantIdAuditModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.ApproveEmailModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.BDUserModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.ClearDaysModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.CustomerSurchargeRateModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.GreenChannelModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.MaxOrderAmountModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.MerchantIdModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.RefundAuditModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.SwitchPermissionAuditModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.SettleHourModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.SwitchPermissionModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.entity.impls.TimeZoneModify;
|
|
|
|
|
import au.com.royalpay.payment.manage.notice.core.MailService;
|
|
|
|
|
import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
|
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
|
|
|
|
@ -589,13 +595,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
String subMerchantId = subMerchantInfo.getString("sub_merchant_id");
|
|
|
|
|
WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(subMerchantId);
|
|
|
|
|
clientModifySupport.processClientModify(
|
|
|
|
|
new MerchantIdAuditModify(manager, clientMoniker, subMerchantId, availableMerchant == null ? null : availableMerchant.getMerchantId()));
|
|
|
|
|
new MerchantIdModify(manager, clientMoniker, subMerchantId, availableMerchant == null ? null : availableMerchant.getMerchantId()));
|
|
|
|
|
List<JSONObject> children = clientMapper.listChildClients(clientId);
|
|
|
|
|
for (JSONObject child : children) {
|
|
|
|
|
if (Objects.equals(child.getString("sub_merchant_id"), originSubMerchantId)) {
|
|
|
|
|
update.put("client_id", child.getIntValue("client_id"));
|
|
|
|
|
clientModifySupport.processClientModify(
|
|
|
|
|
new MerchantIdAuditModify(manager, clientMoniker, subMerchantId, availableMerchant == null ? null : availableMerchant.getMerchantId()));
|
|
|
|
|
new MerchantIdModify(manager, clientMoniker, subMerchantId, availableMerchant == null ? null : availableMerchant.getMerchantId()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -653,7 +659,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (client.getString("sub_merchant_id") == null || client.getString("sub_merchant_id").equals("")) {
|
|
|
|
|
throw new BadRequestException("该商户未设置微信 Sub Merchant ID!");
|
|
|
|
|
}
|
|
|
|
|
clientModifySupport.processClientModify(new GreenChannelAuditModify(manager, clientMoniker, manager.getString("manager_id")));
|
|
|
|
|
clientModifySupport.processClientModify(new GreenChannelModify(manager, clientMoniker, manager.getString("manager_id")));
|
|
|
|
|
saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager);
|
|
|
|
|
sendCommissionWechatMessage(client);
|
|
|
|
|
initAdminUserAndSendEmail(manager, clientMoniker, client);
|
|
|
|
@ -837,7 +843,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateClientApproveEmailStatus(int status, JSONObject account, String client_moniker) {
|
|
|
|
|
clientModifySupport.processClientModify(new ApproveEmailAuditModify(account, client_moniker, status));
|
|
|
|
|
clientModifySupport.processClientModify(new ApproveEmailModify(account, client_moniker, status));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -878,7 +884,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionAuditModify(manager,clientMoniker,permissionKey,allow));
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, permissionKey, allow));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -889,7 +895,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new NotFoundException("Client Not Exists");
|
|
|
|
|
}
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionAuditModify(manager,clientMoniker,"enable_" + channel.toLowerCase(),allow));
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow));
|
|
|
|
|
logger.info(manager.getString("display_name") + "(" + manager.getString("manager_id") + ") switched client " + clientMoniker + " channel "
|
|
|
|
|
+ channel + " to " + allow);
|
|
|
|
|
return;
|
|
|
|
@ -1057,12 +1063,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void togglePayNotice(JSONObject account,String clientMoniker, boolean enable) {
|
|
|
|
|
public void togglePayNotice(JSONObject account, String clientMoniker, boolean enable) {
|
|
|
|
|
JSONObject partner = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
Assert.notNull(partner);
|
|
|
|
|
partner.put("enable_pay_notice", enable);
|
|
|
|
|
clientMapper.update(partner);
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionAuditModify(account,clientMoniker,"enable_pay_notice", enable));
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "enable_pay_notice", enable));
|
|
|
|
|
clientInfoCacheSupport.clearClientCache(partner.getIntValue("client_id"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1201,12 +1207,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
logger.info(manager.getString("username") + " changed settle hour to " + hour);
|
|
|
|
|
JSONObject update = new JSONObject();
|
|
|
|
|
update.put("client_id", client.getIntValue("client_id"));
|
|
|
|
|
update.put("settle_hour", hour);
|
|
|
|
|
clientMapper.update(update);
|
|
|
|
|
clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
|
|
|
|
|
clientModifySupport.processClientModify(new SettleHourModify(manager, clientMoniker, hour));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -1308,7 +1309,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
JSONObject changeRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "Wechat");
|
|
|
|
|
int cleanDays = changeRate.getIntValue("clean_days");
|
|
|
|
|
if (cleanDays != client.getIntValue("clean_days")) {
|
|
|
|
|
clientMapper.updateCleanDays(clientId, cleanDays);
|
|
|
|
|
clientModifySupport.processClientConfigModify(new ClearDaysModify(manager, clientMoniker, cleanDays));
|
|
|
|
|
}
|
|
|
|
|
// clientMapper.updateCleanDays(clientId, config.getCleanDays());
|
|
|
|
|
}
|
|
|
|
@ -1494,17 +1495,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
bd_id = bd_id + user.getString("manager_id") + ",";
|
|
|
|
|
bd_name = bd_name + user.getString("display_name") + ",";
|
|
|
|
|
}
|
|
|
|
|
JSONObject clientUpdate = new JSONObject();
|
|
|
|
|
clientUpdate.put("client_id", client.getIntValue("client_id"));
|
|
|
|
|
clientUpdate.put("bd_user", bd_id.substring(0, bd_id.length() - 1));
|
|
|
|
|
clientUpdate.put("bd_user_name", bd_name.substring(0, bd_name.length() - 1));
|
|
|
|
|
BDUserModify bdUserModify = new BDUserModify(managerMapper.findById(manager_id), client.getString("client_moniker"),
|
|
|
|
|
bd_id.substring(0, bd_id.length() - 1), bd_name.substring(0, bd_name.length() - 1));
|
|
|
|
|
if (users.size() > 0) {
|
|
|
|
|
String bd_manager_id = users.get(0).getString("manager_id");
|
|
|
|
|
JSONObject manager = managerMapper.findById(bd_manager_id);
|
|
|
|
|
clientUpdate.put("org_id", manager.getIntValue("org_id"));
|
|
|
|
|
bdUserModify.setOrg_id(manager.getIntValue("org_id"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clientMapper.update(clientUpdate);
|
|
|
|
|
clientModifySupport.processClientModify(bdUserModify);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1668,17 +1666,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateTimeZone(String clientMoniker, String timezone) {
|
|
|
|
|
public void updateTimeZone(JSONObject account,String clientMoniker, String timezone) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
JSONObject partner = new JSONObject();
|
|
|
|
|
int clientId = client.getIntValue("client_id");
|
|
|
|
|
partner.put("client_id", clientId);
|
|
|
|
|
partner.put("timezone", timezone);
|
|
|
|
|
clientMapper.update(partner);
|
|
|
|
|
clientInfoCacheSupport.clearClientCache(clientId);
|
|
|
|
|
clientModifySupport.processClientModify(new TimeZoneModify(account,clientMoniker,timezone));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -1771,37 +1764,32 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setMaxOrderAmount(String clientMoniker, BigDecimal limit) {
|
|
|
|
|
public void setMaxOrderAmount(JSONObject account,String clientMoniker, BigDecimal limit) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
JSONObject update = new JSONObject();
|
|
|
|
|
update.put("client_id", client.getIntValue("client_id"));
|
|
|
|
|
update.put("max_order_amount", limit == null ? null : limit.toPlainString());
|
|
|
|
|
clientMapper.update(update);
|
|
|
|
|
clientModifySupport.processClientConfigModify(new MaxOrderAmountModify(account,clientMoniker,limit));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setCustomerSurchargeRate(String clientMoniker, BigDecimal customer_surcharge_rate) {
|
|
|
|
|
public void setCustomerSurchargeRate(JSONObject account,String clientMoniker, BigDecimal customer_surcharge_rate) {
|
|
|
|
|
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
JSONObject update = new JSONObject();
|
|
|
|
|
update.put("client_id", client.getIntValue("client_id"));
|
|
|
|
|
if (customer_surcharge_rate == null) {
|
|
|
|
|
update.put("customer_surcharge_rate", null);
|
|
|
|
|
clientModifySupport.processClientConfigModify(new CustomerSurchargeRateModify(account,clientMoniker,null));
|
|
|
|
|
} else {
|
|
|
|
|
BigDecimal rate_value = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat").getBigDecimal("rate_value");
|
|
|
|
|
if (customer_surcharge_rate.compareTo(PlatformEnvironment.getEnv().getMaxCustomerSurchargeRate()) > 0
|
|
|
|
|
|| customer_surcharge_rate.compareTo(rate_value) < 0) {
|
|
|
|
|
throw new ForbiddenException("Invalid Range");
|
|
|
|
|
}
|
|
|
|
|
update.put("customer_surcharge_rate", customer_surcharge_rate);
|
|
|
|
|
clientModifySupport.processClientConfigModify(new CustomerSurchargeRateModify(account,clientMoniker,customer_surcharge_rate));
|
|
|
|
|
}
|
|
|
|
|
clientConfigService.update(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -2810,7 +2798,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateAppClient(int client_id, AppClientBean appClientBean) {
|
|
|
|
|
public void updateAppClient(JSONObject account,int client_id, AppClientBean appClientBean) {
|
|
|
|
|
JSONObject client = getClientInfo(client_id);
|
|
|
|
|
Assert.notNull(client);
|
|
|
|
|
JSONObject updateObj = appClientBean.updateObject();
|
|
|
|
@ -2823,13 +2811,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
throw new ForbiddenException("customerSurchargeRate is 0");
|
|
|
|
|
}
|
|
|
|
|
BigDecimal customerSurchargeRate = new BigDecimal(appClientBean.getCustomerSurchargeRate()).setScale(2, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
|
setCustomerSurchargeRate(client.getString("client_moniker"), customerSurchargeRate);
|
|
|
|
|
setCustomerSurchargeRate(account,client.getString("client_moniker"), customerSurchargeRate);
|
|
|
|
|
}
|
|
|
|
|
clientInfoCacheSupport.clearClientCache(client_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setSkipClearing(String clientMoniker, Boolean skip_clearing) {
|
|
|
|
|
public void setSkipClearing(JSONObject account,String clientMoniker, Boolean skip_clearing) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
@ -2838,6 +2825,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
int clientId = client.getIntValue("client_id");
|
|
|
|
|
update.put("client_id", clientId);
|
|
|
|
|
update.put("skip_clearing", skip_clearing);
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionModify());
|
|
|
|
|
clientMapper.update(update);
|
|
|
|
|
clientInfoCacheSupport.clearClientCache(clientId);
|
|
|
|
|
}
|
|
|
|
|