|
|
@ -746,6 +746,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
checkOrgPermission(manager, superClient);
|
|
|
|
checkOrgPermission(manager, superClient);
|
|
|
|
partner.put("parent_client_id", superClient.getIntValue("client_id"));
|
|
|
|
partner.put("parent_client_id", superClient.getIntValue("client_id"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//如果level3商户,为一级商户增加level3_mch_config=true
|
|
|
|
|
|
|
|
checkLevel3MchStatus(superClient);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
partner.put("create_time", new Date());
|
|
|
|
partner.put("create_time", new Date());
|
|
|
|
partner.put("ali_sub_merchant_id", registery.getClientMoniker());
|
|
|
|
partner.put("ali_sub_merchant_id", registery.getClientMoniker());
|
|
|
@ -2097,7 +2099,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
if(mchConfig.getBooleanValue("hide_sub_mch")){
|
|
|
|
if(mchConfig.getBooleanValue("hide_sub_mch")){
|
|
|
|
return new ArrayList<>();
|
|
|
|
return new ArrayList<>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!mchConfig.getBooleanValue("disable_level3_mch") && listChildClients.size()<100) {
|
|
|
|
if (mchConfig.getBooleanValue("level3_mch_config")) {
|
|
|
|
for (JSONObject partner : listChildClients) {
|
|
|
|
for (JSONObject partner : listChildClients) {
|
|
|
|
List<JSONObject> clients = clientMapper.listChildClients(partner.getIntValue("client_id"));
|
|
|
|
List<JSONObject> clients = clientMapper.listChildClients(partner.getIntValue("client_id"));
|
|
|
|
if (clients.size() > 0) {
|
|
|
|
if (clients.size() > 0) {
|
|
|
@ -2128,6 +2130,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
params.put("search_text", searchText);
|
|
|
|
params.put("search_text", searchText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PageList<JSONObject> childClients = clientMapper.listChildClientsByPage(params, pageBounds);
|
|
|
|
PageList<JSONObject> childClients = clientMapper.listChildClientsByPage(params, pageBounds);
|
|
|
|
|
|
|
|
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(client.getIntValue("client_id"));
|
|
|
|
|
|
|
|
if (mchConfig.getBooleanValue("level3_mch_config")) {
|
|
|
|
for (JSONObject partner : childClients) {
|
|
|
|
for (JSONObject partner : childClients) {
|
|
|
|
List<JSONObject> clients = clientMapper.listChildClients(partner.getIntValue("client_id"));
|
|
|
|
List<JSONObject> clients = clientMapper.listChildClients(partner.getIntValue("client_id"));
|
|
|
|
if (clients.size() > 0) {
|
|
|
|
if (clients.size() > 0) {
|
|
|
@ -2137,6 +2141,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return PageListUtils.buildPageListResult(childClients);
|
|
|
|
return PageListUtils.buildPageListResult(childClients);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2679,6 +2684,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
params.put("client_id", client.getIntValue("client_id"));
|
|
|
|
params.put("client_id", client.getIntValue("client_id"));
|
|
|
|
|
|
|
|
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(client.getIntValue("client_id"));
|
|
|
|
|
|
|
|
if (mchConfig.getBooleanValue("hide_mch_device")) {
|
|
|
|
|
|
|
|
return new JSONObject();
|
|
|
|
|
|
|
|
}
|
|
|
|
if (remark != null) {
|
|
|
|
if (remark != null) {
|
|
|
|
params.put("remark", remark);
|
|
|
|
params.put("remark", remark);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2702,6 +2711,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
checkOrgPermission(null, client);
|
|
|
|
checkOrgPermission(null, client);
|
|
|
|
|
|
|
|
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(client.getIntValue("client_id"));
|
|
|
|
|
|
|
|
if (mchConfig.getBooleanValue("hide_mch_device")) {
|
|
|
|
|
|
|
|
return new JSONObject();
|
|
|
|
|
|
|
|
}
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
sdf.setTimeZone(TimeZone.getTimeZone(client.getString("timezone") != null ? client.getString("timezone") : "Australia/Melbourne"));
|
|
|
|
sdf.setTimeZone(TimeZone.getTimeZone(client.getString("timezone") != null ? client.getString("timezone") : "Australia/Melbourne"));
|
|
|
@ -6650,11 +6663,20 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String[] getChildClientIds(int clientId) {
|
|
|
|
private String[] getChildClientIds(int clientId) {
|
|
|
|
|
|
|
|
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(clientId);
|
|
|
|
List<String> clientIds = new ArrayList<>();
|
|
|
|
List<String> clientIds = new ArrayList<>();
|
|
|
|
List<JSONObject> childs = clientMapper.listChildClients(clientId);
|
|
|
|
List<JSONObject> childs = clientMapper.listChildClients(clientId);
|
|
|
|
clientIds.add(String.valueOf(clientId));
|
|
|
|
clientIds.add(String.valueOf(clientId));
|
|
|
|
childs.forEach(p -> {
|
|
|
|
childs.forEach(p -> {
|
|
|
|
clientIds.add(p.getString("client_id"));
|
|
|
|
clientIds.add(p.getString("client_id"));
|
|
|
|
|
|
|
|
if (mchConfig.getBooleanValue("level3_mch_config")) {
|
|
|
|
|
|
|
|
List<JSONObject> clients = clientMapper.listChildClients(p.getIntValue("client_id"));
|
|
|
|
|
|
|
|
if (clients.size() > 0) {
|
|
|
|
|
|
|
|
clients.forEach(e -> {
|
|
|
|
|
|
|
|
clientIds.add(e.getString("client_id"));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return clientIds.toArray(new String[]{});
|
|
|
|
return clientIds.toArray(new String[]{});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -6689,4 +6711,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void checkLevel3MchStatus(JSONObject superClient) {
|
|
|
|
|
|
|
|
if (superClient.containsKey("parent_client_id") && superClient.getIntValue("parent_client_id") != 0) {
|
|
|
|
|
|
|
|
JSONObject superParentClient = getClientInfo(superClient.getIntValue("parent_client_id"));
|
|
|
|
|
|
|
|
if (superParentClient == null) {
|
|
|
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(superParentClient.getIntValue("client_id"));
|
|
|
|
|
|
|
|
if (!mchConfig.getBooleanValue("level3_mch_config")) {
|
|
|
|
|
|
|
|
mchConfig.put("level3_mch_config", true);
|
|
|
|
|
|
|
|
superParentClient.put("ext_params", mchConfig.toJSONString());
|
|
|
|
|
|
|
|
clientMapper.update(superParentClient);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|