|
|
@ -228,7 +228,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
if (client == null) {
|
|
|
|
if (client == null) {
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (manager!=null){
|
|
|
|
if (manager != null) {
|
|
|
|
checkClientOrg(manager, client);
|
|
|
|
checkClientOrg(manager, client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
client.put("show_all_permission", true);
|
|
|
|
client.put("show_all_permission", true);
|
|
|
@ -291,10 +291,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void checkClientOrg(JSONObject manager, JSONObject client) {
|
|
|
|
private void checkClientOrg(JSONObject manager, JSONObject client) {
|
|
|
|
if (manager.getInteger("org_id")!=null){
|
|
|
|
if (manager.getInteger("org_id") != null) {
|
|
|
|
List<JSONObject> orgs = orgMapper.listOrgAndChild(manager.getIntValue("org_id"));
|
|
|
|
List<JSONObject> orgs = orgMapper.listOrgAndChild(manager.getIntValue("org_id"));
|
|
|
|
List<Integer> orgIds = orgs.stream().map(org->org.getIntValue("org_id")).collect(Collectors.toList());
|
|
|
|
List<Integer> orgIds = orgs.stream().map(org -> org.getIntValue("org_id")).collect(Collectors.toList());
|
|
|
|
if (!orgIds.contains(client.getIntValue("org_id"))){
|
|
|
|
if (!orgIds.contains(client.getIntValue("org_id"))) {
|
|
|
|
throw new ForbiddenException("The org of client is not belong to you");
|
|
|
|
throw new ForbiddenException("The org of client is not belong to you");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -313,11 +313,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public JSONObject listClients(JSONObject manager, PartnerQuery query) {
|
|
|
|
public JSONObject listClients(JSONObject manager, PartnerQuery query) {
|
|
|
|
JSONObject params = query.toJsonParam();
|
|
|
|
JSONObject params = query.toJsonParam();
|
|
|
|
if(params.getString("org_id") != null){
|
|
|
|
if (params.getString("org_id") != null) {
|
|
|
|
if(params.getString("org_ids") == null){
|
|
|
|
if (params.getString("org_ids") == null) {
|
|
|
|
orgIds(params,Integer.parseInt(params.getString("org_id")));
|
|
|
|
orgIds(params, Integer.parseInt(params.getString("org_id")));
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
params.put("org_id",params.getString("org_ids"));
|
|
|
|
params.put("org_id", params.getString("org_ids"));
|
|
|
|
params.remove("org_ids");
|
|
|
|
params.remove("org_ids");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -331,15 +331,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int orgId = manager.getIntValue("org_id");
|
|
|
|
int orgId = manager.getIntValue("org_id");
|
|
|
|
if (orgId > 0) {
|
|
|
|
if (orgId > 0) {
|
|
|
|
if(params.getString("org_ids") == null){
|
|
|
|
if (params.getString("org_ids") == null) {
|
|
|
|
JSONObject org2 = orgMapper.findOne(orgId);
|
|
|
|
JSONObject org2 = orgMapper.findOne(orgId);
|
|
|
|
if(org2.getString("parent_org_id") != null){
|
|
|
|
if (org2.getString("parent_org_id") != null) {
|
|
|
|
params.put("org_id",orgId);
|
|
|
|
params.put("org_id", orgId);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
params.put("org_id",orgId);
|
|
|
|
params.put("org_id", orgId);
|
|
|
|
orgIds(params,orgId);
|
|
|
|
orgIds(params, orgId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
params.put("org_id", params.getIntValue("org_ids"));
|
|
|
|
params.put("org_id", params.getIntValue("org_ids"));
|
|
|
|
params.remove("org_ids");
|
|
|
|
params.remove("org_ids");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -349,16 +349,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
if (bdConfig != null) {
|
|
|
|
if (bdConfig != null) {
|
|
|
|
params.put("bd_group", bdConfig.getString("bd_group"));
|
|
|
|
params.put("bd_group", bdConfig.getString("bd_group"));
|
|
|
|
List<JSONObject> listGroupBds = financialBDConfigMapper.listGroupBds(bdConfig.getString("bd_group"));
|
|
|
|
List<JSONObject> listGroupBds = financialBDConfigMapper.listGroupBds(bdConfig.getString("bd_group"));
|
|
|
|
List<String> bdUserId = listGroupBds.stream().map(groupBd->groupBd.getString("manager_id")).collect(Collectors.toList());
|
|
|
|
List<String> bdUserId = listGroupBds.stream().map(groupBd -> groupBd.getString("manager_id")).collect(Collectors.toList());
|
|
|
|
if(params.containsKey("bd_user")){
|
|
|
|
if (params.containsKey("bd_user")) {
|
|
|
|
if(!bdUserId.contains(params.getString("bd_user"))){
|
|
|
|
if (!bdUserId.contains(params.getString("bd_user"))) {
|
|
|
|
params.remove("bd_user");
|
|
|
|
params.remove("bd_user");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(params.containsKey("org_ids")){
|
|
|
|
if (params.containsKey("org_ids")) {
|
|
|
|
params.remove("org_ids");
|
|
|
|
params.remove("org_ids");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(params.containsKey("org_id")){
|
|
|
|
if (params.containsKey("org_id")) {
|
|
|
|
params.remove("org_id");
|
|
|
|
params.remove("org_id");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -390,18 +390,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PageListUtils.buildPageListResult(partners);
|
|
|
|
return PageListUtils.buildPageListResult(partners);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void orgIds(JSONObject params,int orgId){
|
|
|
|
|
|
|
|
|
|
|
|
private void orgIds(JSONObject params, int orgId) {
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
|
param.put("parent_org_id",params.getString("org_id"));
|
|
|
|
param.put("parent_org_id", params.getString("org_id"));
|
|
|
|
param.put("type",0);
|
|
|
|
param.put("type", 0);
|
|
|
|
List<Integer> orgIds = new ArrayList<>();
|
|
|
|
List<Integer> orgIds = new ArrayList<>();
|
|
|
|
List<JSONObject> childOrgs = orgMapper.listOrgsWithChid(param);
|
|
|
|
List<JSONObject> childOrgs = orgMapper.listOrgsWithChid(param);
|
|
|
|
if(childOrgs.size() > 0){
|
|
|
|
if (childOrgs.size() > 0) {
|
|
|
|
for(JSONObject object : childOrgs ){
|
|
|
|
for (JSONObject object : childOrgs) {
|
|
|
|
orgIds.add(object.getIntValue("org_id"));
|
|
|
|
orgIds.add(object.getIntValue("org_id"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
orgIds.add(orgId);
|
|
|
|
orgIds.add(orgId);
|
|
|
|
params.put("org_ids",orgIds);
|
|
|
|
params.put("org_ids", orgIds);
|
|
|
|
params.remove("org_id");
|
|
|
|
params.remove("org_id");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1206,21 +1207,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
config.put("active_time", DateFormatUtils.format(config.getDate("active_time"), "yyyy-MM-dd"));
|
|
|
|
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"));
|
|
|
|
config.put("expiry_time", DateFormatUtils.format(config.getDate("expiry_time"), "yyyy-MM-dd"));
|
|
|
|
|
|
|
|
|
|
|
|
checkAddRate(config,"Wechat", "wechat_rate_value",org,"min_wechat_rate");
|
|
|
|
checkAddRate(config, "Wechat", "wechat_rate_value", org, "min_wechat_rate");
|
|
|
|
checkAddRate(config,"Alipay", "alipay_rate_value",org,"min_alipay_rate");
|
|
|
|
checkAddRate(config, "Alipay", "alipay_rate_value", org, "min_alipay_rate");
|
|
|
|
checkAddRate(config,"AlipayOnline", "alipayonline_rate_value",org,"min_alipayonline_rate");
|
|
|
|
checkAddRate(config, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate");
|
|
|
|
checkAddRate(config,"Bestpay", "bestpay_rate_value",org,"min_bestpay_rate");
|
|
|
|
checkAddRate(config, "Bestpay", "bestpay_rate_value", org, "min_bestpay_rate");
|
|
|
|
checkAddRate(config,"jd", "jd_rate_value",org,"min_jd_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, "Wechat", "wechat_rate_value", org, "min_wechat_rate");
|
|
|
|
configNewClientRate(config, clientId, "Alipay", "alipay_rate_value",org,"min_alipay_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, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate");
|
|
|
|
configNewClientRate(config, clientId, "Bestpay", "bestpay_rate_value",org,"min_bestpay_rate");
|
|
|
|
configNewClientRate(config, clientId, "Bestpay", "bestpay_rate_value", org, "min_bestpay_rate");
|
|
|
|
configNewClientRate(config, clientId, "jd", "jd_rate_value",org,"min_jd_rate");
|
|
|
|
configNewClientRate(config, clientId, "jd", "jd_rate_value", org, "min_jd_rate");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
@ -1249,11 +1250,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
JSONObject configJson = config.toJSON();
|
|
|
|
JSONObject configJson = config.toJSON();
|
|
|
|
JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
|
|
|
|
JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
|
|
|
|
checkModifyRate(org,configJson,"Wechat","min_wechat_rate");
|
|
|
|
checkModifyRate(org, configJson, "Wechat", "min_wechat_rate");
|
|
|
|
checkModifyRate(org,configJson,"Alipay","min_alipay_rate");
|
|
|
|
checkModifyRate(org, configJson, "Alipay", "min_alipay_rate");
|
|
|
|
checkModifyRate(org,configJson,"AlipayOnline","min_alipayonline_rate");
|
|
|
|
checkModifyRate(org, configJson, "AlipayOnline", "min_alipayonline_rate");
|
|
|
|
checkModifyRate(org,configJson,"jd","min_jd_rate");
|
|
|
|
checkModifyRate(org, configJson, "jd", "min_jd_rate");
|
|
|
|
checkModifyRate(org,configJson,"Bestpay","min_bestpay_rate");
|
|
|
|
checkModifyRate(org, configJson, "Bestpay", "min_bestpay_rate");
|
|
|
|
configJson.put("client_rate_id", rateId);
|
|
|
|
configJson.put("client_rate_id", rateId);
|
|
|
|
configJson.put("manager_id", manager.getString("manager_id"));
|
|
|
|
configJson.put("manager_id", manager.getString("manager_id"));
|
|
|
|
configJson.put("manager_name", manager.getString("username"));
|
|
|
|
configJson.put("manager_name", manager.getString("username"));
|
|
|
@ -1267,23 +1268,27 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// clientMapper.updateCleanDays(clientId, config.getCleanDays());
|
|
|
|
// 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 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+"费率,请重新输入");
|
|
|
|
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 + "费率,请重新输入");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1465,7 +1470,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
if (client == null) {
|
|
|
|
if (client == null) {
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
checkClientOrg(manager,client);
|
|
|
|
checkClientOrg(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"));
|
|
|
|
params.put("is_valid", "1");
|
|
|
|
params.put("is_valid", "1");
|
|
|
@ -2081,7 +2086,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
throw new BadRequestException("Master Merchant is not valid");
|
|
|
|
throw new BadRequestException("Master Merchant is not valid");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
client.put("parent_client_id", master_client.getIntValue("client_id"));
|
|
|
|
client.put("parent_client_id", master_client.getIntValue("client_id"));
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
client.put("parent_client_id", null);
|
|
|
|
client.put("parent_client_id", null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
clientMapper.update(client);
|
|
|
|
clientMapper.update(client);
|
|
|
@ -2159,6 +2164,20 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
clearClientCache(clientId);
|
|
|
|
clearClientCache(clientId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void setClientTaxInSurcharge(String clientMoniker, boolean taxInSurcharge) {
|
|
|
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
|
|
|
if (client == null) {
|
|
|
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject update = new JSONObject();
|
|
|
|
|
|
|
|
int clientId = client.getIntValue("client_id");
|
|
|
|
|
|
|
|
update.put("client_id", clientId);
|
|
|
|
|
|
|
|
update.put("tax_in_surcharge", taxInSurcharge);
|
|
|
|
|
|
|
|
clientMapper.update(update);
|
|
|
|
|
|
|
|
clearClientCache(clientId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<JSONObject> listClientsForSettlement() {
|
|
|
|
public List<JSONObject> listClientsForSettlement() {
|
|
|
|
return clientMapper.listClientsForSettlement();
|
|
|
|
return clientMapper.listClientsForSettlement();
|
|
|
@ -2965,28 +2984,28 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
List<JSONObject> applices = sysWxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc")));
|
|
|
|
List<JSONObject> applices = sysWxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"), new PageBounds(Order.formString("create_time.desc")));
|
|
|
|
if(!applices.isEmpty()){
|
|
|
|
if (!applices.isEmpty()) {
|
|
|
|
return applices;
|
|
|
|
return applices;
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
if(StringUtils.isNotEmpty(client.getString("sub_merchant_id")) && StringUtils.isNotEmpty(client.getString("merchant_id"))){
|
|
|
|
if (StringUtils.isNotEmpty(client.getString("sub_merchant_id")) && StringUtils.isNotEmpty(client.getString("merchant_id"))) {
|
|
|
|
Element elem = wxPayClient.querySubMerchant(client.getString("merchant_id"),client.getString("sub_merchant_id"));
|
|
|
|
Element elem = wxPayClient.querySubMerchant(client.getString("merchant_id"), client.getString("sub_merchant_id"));
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
object.put("sub_merchant_id",elem.elementText("sub_mch_id_0"));
|
|
|
|
object.put("sub_merchant_id", elem.elementText("sub_mch_id_0"));
|
|
|
|
object.put("client_id",client.getInteger("client_id"));
|
|
|
|
object.put("client_id", client.getInteger("client_id"));
|
|
|
|
object.put("merchant_name",elem.elementText("merchant_name_0"));
|
|
|
|
object.put("merchant_name", elem.elementText("merchant_name_0"));
|
|
|
|
object.put("merchant_shortname",elem.elementText("merchant_shortname_0"));
|
|
|
|
object.put("merchant_shortname", elem.elementText("merchant_shortname_0"));
|
|
|
|
object.put("office_phone",elem.elementText("office_phone_0"));
|
|
|
|
object.put("office_phone", elem.elementText("office_phone_0"));
|
|
|
|
object.put("contact_name",elem.elementText("contact_name_0"));
|
|
|
|
object.put("contact_name", elem.elementText("contact_name_0"));
|
|
|
|
object.put("contact_email",elem.elementText("contact_email_0"));
|
|
|
|
object.put("contact_email", elem.elementText("contact_email_0"));
|
|
|
|
object.put("contact_phone",elem.elementText("contact_phone_0"));
|
|
|
|
object.put("contact_phone", elem.elementText("contact_phone_0"));
|
|
|
|
object.put("business_category",elem.elementText("business_category_0"));
|
|
|
|
object.put("business_category", elem.elementText("business_category_0"));
|
|
|
|
object.put("merchant_remark",elem.elementText("merchant_remark_0"));
|
|
|
|
object.put("merchant_remark", elem.elementText("merchant_remark_0"));
|
|
|
|
object.put("website",elem.elementText("website_0"));
|
|
|
|
object.put("website", elem.elementText("website_0"));
|
|
|
|
object.put("merchant_introduction",elem.elementText("merchant_introduction_0"));
|
|
|
|
object.put("merchant_introduction", elem.elementText("merchant_introduction_0"));
|
|
|
|
object.put("merchant_id",client.getString("merchant_id"));
|
|
|
|
object.put("merchant_id", client.getString("merchant_id"));
|
|
|
|
object.put("create_time",new Date());
|
|
|
|
object.put("create_time", new Date());
|
|
|
|
object.put("operator",manager.getString("display_name"));
|
|
|
|
object.put("operator", manager.getString("display_name"));
|
|
|
|
List<JSONObject> applyQuery = new ArrayList<>();
|
|
|
|
List<JSONObject> applyQuery = new ArrayList<>();
|
|
|
|
applyQuery.add(object);
|
|
|
|
applyQuery.add(object);
|
|
|
|
return applyQuery;
|
|
|
|
return applyQuery;
|
|
|
@ -2994,9 +3013,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
|
|
|
|
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
|
|
|
|
public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply,JSONObject manager) {
|
|
|
|
public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager) {
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
if (client == null) {
|
|
|
|
if (client == null) {
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
throw new InvalidShortIdException();
|
|
|
@ -3004,34 +3024,34 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject params = subMerchantApply.insertObject();
|
|
|
|
JSONObject params = subMerchantApply.insertObject();
|
|
|
|
SubMerchantInfo subMerchantInfo = JSONObject.toJavaObject(params,SubMerchantInfo.class);
|
|
|
|
SubMerchantInfo subMerchantInfo = JSONObject.toJavaObject(params, SubMerchantInfo.class);
|
|
|
|
params.put("merchant_id",subMerchantApply.getMerchant_id());
|
|
|
|
params.put("merchant_id", subMerchantApply.getMerchant_id());
|
|
|
|
params.put("client_id",client.getString("client_id"));
|
|
|
|
params.put("client_id", client.getString("client_id"));
|
|
|
|
params.put("create_time",new Date());
|
|
|
|
params.put("create_time", new Date());
|
|
|
|
params.put("operator",manager.getString("display_name"));
|
|
|
|
params.put("operator", manager.getString("display_name"));
|
|
|
|
Element elem = wxPayClient.subMerchantApplication(subMerchantApply.getMerchant_id(),subMerchantInfo);
|
|
|
|
Element elem = wxPayClient.subMerchantApplication(subMerchantApply.getMerchant_id(), subMerchantInfo);
|
|
|
|
String sub_merchant_id = elem.elementText("sub_mch_id");
|
|
|
|
String sub_merchant_id = elem.elementText("sub_mch_id");
|
|
|
|
if(StringUtils.isNotEmpty(sub_merchant_id)){
|
|
|
|
if (StringUtils.isNotEmpty(sub_merchant_id)) {
|
|
|
|
params.put("sub_merchant_id",sub_merchant_id);
|
|
|
|
params.put("sub_merchant_id", sub_merchant_id);
|
|
|
|
sysWxMerchantApplyMapper.insertWxMerchantApply(params);
|
|
|
|
sysWxMerchantApplyMapper.insertWxMerchantApply(params);
|
|
|
|
clearCacheSubMerchantIdApplices(clientMoniker);
|
|
|
|
clearCacheSubMerchantIdApplices(clientMoniker);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
throw new BadRequestException(elem.elementText("return_msg"));
|
|
|
|
throw new BadRequestException(elem.elementText("return_msg"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sub_merchant_id;
|
|
|
|
return sub_merchant_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<JSONObject> listMerchantIds(String clientMoniker,JSONObject manager) {
|
|
|
|
public List<JSONObject> listMerchantIds(String clientMoniker, JSONObject manager) {
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
if (client == null) {
|
|
|
|
if (client == null) {
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
List<JSONObject> list = new ArrayList<>();
|
|
|
|
List<JSONObject> list = new ArrayList<>();
|
|
|
|
for (WeChatPayConfig.Merchant mch : WechatPayEnvironment.getEnv().getWechatMerchantConfigs()){
|
|
|
|
for (WeChatPayConfig.Merchant mch : WechatPayEnvironment.getEnv().getWechatMerchantConfigs()) {
|
|
|
|
JSONObject merchantIds = new JSONObject();
|
|
|
|
JSONObject merchantIds = new JSONObject();
|
|
|
|
merchantIds.put("merchant_id",mch.getMerchantId());
|
|
|
|
merchantIds.put("merchant_id", mch.getMerchantId());
|
|
|
|
list.add(merchantIds);
|
|
|
|
list.add(merchantIds);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return list;
|
|
|
|
return list;
|
|
|
|