|
|
@ -1,6 +1,7 @@
|
|
|
|
package au.com.royalpay.payment.manage.merchants.core.impls;
|
|
|
|
package au.com.royalpay.payment.manage.merchants.core.impls;
|
|
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
|
|
|
|
import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment;
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient;
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient;
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo;
|
|
|
|
import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo;
|
|
|
@ -2938,25 +2939,36 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
if (client == null) {
|
|
|
|
if (client == null) {
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<JSONObject> applices = sysWxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"));
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
|
|
|
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"));
|
|
|
|
String applicesXml = XmlFormatUtils.formatXml(elem);
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
if(applicesXml != null){
|
|
|
|
object.put("sub_merchant_id",elem.elementText("sub_mch_id_0"));
|
|
|
|
return null;
|
|
|
|
object.put("client_id",client.getInteger("client_id"));
|
|
|
|
}
|
|
|
|
object.put("merchant_name",elem.elementText("merchant_name_0"));
|
|
|
|
|
|
|
|
object.put("merchant_shortname",elem.elementText("merchant_shortname_0"));
|
|
|
|
|
|
|
|
object.put("office_phone",elem.elementText("office_phone_0"));
|
|
|
|
|
|
|
|
object.put("contact_name",elem.elementText("contact_name_0"));
|
|
|
|
|
|
|
|
object.put("contact_email",elem.elementText("contact_email_0"));
|
|
|
|
|
|
|
|
object.put("contact_phone",elem.elementText("contact_phone_0"));
|
|
|
|
|
|
|
|
object.put("business_category",elem.elementText("business_category_0"));
|
|
|
|
|
|
|
|
object.put("merchant_remark",elem.elementText("merchant_remark_0"));
|
|
|
|
|
|
|
|
object.put("website",elem.elementText("website_0"));
|
|
|
|
|
|
|
|
object.put("merchant_introduction",elem.elementText("merchant_introduction_0"));
|
|
|
|
|
|
|
|
object.put("merchant_id",client.getString("merchant_id"));
|
|
|
|
|
|
|
|
object.put("create_time",new Date());
|
|
|
|
|
|
|
|
object.put("operator",manager.getString("display_name"));
|
|
|
|
|
|
|
|
sysWxMerchantApplyMapper.insertWxMerchantApply(object);
|
|
|
|
|
|
|
|
List<JSONObject> applyQuery = sysWxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc")));
|
|
|
|
|
|
|
|
return applyQuery;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
|
|
|
|
|
|
|
|
public void clearCacheSubMerchantIdApplices(String clientMoniker) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
|
|
|
|
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
|
|
|
|
public void subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply,JSONObject manager) {
|
|
|
|
public void subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply,JSONObject manager) {
|
|
|
@ -2964,19 +2976,42 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
if (client == null) {
|
|
|
|
if (client == null) {
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!StringUtils.isNotEmpty(client.getString("merchant_id"))){
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
throw new BadRequestException("无Merchant_id");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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",client.getString("merchant_id"));
|
|
|
|
params.put("merchant_id",client.getString("merchant_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("manager_id"));
|
|
|
|
params.put("operator",manager.getString("display_name"));
|
|
|
|
Element elem = wxPayClient.subMerchantApplication(client.getString("merchant_id"),subMerchantInfo);
|
|
|
|
Element elem = wxPayClient.subMerchantApplication(subMerchantApply.getMerchant_id(),subMerchantInfo);
|
|
|
|
String applicesXml = XmlFormatUtils.formatXml(elem);
|
|
|
|
String sub_merchant_id = elem.elementText("sub_mch_id");
|
|
|
|
params.put("sub_merchant_id",applicesXml);
|
|
|
|
if(StringUtils.isNotEmpty(sub_merchant_id)){
|
|
|
|
|
|
|
|
params.put("sub_merchant_id",sub_merchant_id);
|
|
|
|
sysWxMerchantApplyMapper.insertWxMerchantApply(params);
|
|
|
|
sysWxMerchantApplyMapper.insertWxMerchantApply(params);
|
|
|
|
clearCacheSubMerchantIdApplices(clientMoniker);
|
|
|
|
clearCacheSubMerchantIdApplices(clientMoniker);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
throw new BadRequestException();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<JSONObject> listMerchantIds(String clientMoniker,JSONObject manager) {
|
|
|
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
|
|
|
if (client == null) {
|
|
|
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
|
|
|
List<JSONObject> list = new ArrayList<>();
|
|
|
|
|
|
|
|
for (WeChatPayConfig.Merchant mch : WechatPayEnvironment.getEnv().getWechatMerchantConfigs()){
|
|
|
|
|
|
|
|
JSONObject merchantIds = new JSONObject();
|
|
|
|
|
|
|
|
merchantIds.put("merchant_id",mch.getMerchantId());
|
|
|
|
|
|
|
|
list.add(merchantIds);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
|
|
|
|
|
|
|
|
public void clearCacheSubMerchantIdApplices(String clientMoniker) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|