批量更新微信子商户号

master
dalong306 4 years ago
parent 356c65e168
commit 4513eee088

@ -518,8 +518,10 @@ public class TestController {
tradeSecureService.sendSecurePayInvoiceFile(firstDay, lastDay);
}
/**
*
*/
@ManagerMapping(value = "/batch_update_wxsubmerchantId", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR, ManagerRole.DEVELOPER})
// @GetMapping(value = "/batch_update_wxsubmerchantId")
public void batchUpdateWxSubmerchantId() {
List<JSONObject> findSubMerchantIdHistorys=sysWxMerchantApplyMapper.findSubMerchantIdHistorys();
if(findSubMerchantIdHistorys==null)return;
@ -536,6 +538,17 @@ public class TestController {
logger.info("=========>没有查询到mcc:"+jsonObject.getInteger("client_id"));
return;
}
// company_name short_name industry company_phone contact_person contact_phone contact_email 这些字段不能为空
if(TextUtils.isEmpty(clientJson.getString("short_name"))||
TextUtils.isEmpty(clientJson.getString("industry"))||
TextUtils.isEmpty(clientJson.getString("company_phone"))||
TextUtils.isEmpty(clientJson.getString("contact_phone"))||
TextUtils.isEmpty(clientJson.getString("contact_person"))||
TextUtils.isEmpty(clientJson.getString("contact_email"))||
TextUtils.isEmpty(wechatMcc.getString("mc_code"))){
logger.error("=======>数据不完整clientid"+jsonObject.getInteger("client_id")+"");
return;
}
NewSubMerchantIdApply newSubMerchantIdApply=new NewSubMerchantIdApply();
newSubMerchantIdApply.setMerchant_id(jsonObject.getString("merchant_id"));
@ -543,13 +556,13 @@ public class TestController {
newSubMerchantIdApply.setMerchantRemark(jsonObject.getString("merchant_remark"));
newSubMerchantIdApply.setMerchant_name(cutLength(jsonObject.getString("merchant_name"),50));
newSubMerchantIdApply.setAddress(cutLength(clientJson.getString("address"),128));
newSubMerchantIdApply.setMerchant_shortname(cutLength(clientJson.getString("short_name"),20));
newSubMerchantIdApply.setMerchant_shortname(cutLength(clientJson.getString("short_name"),64));
newSubMerchantIdApply.setBusiness_category(clientJson.getString("industry"));
newSubMerchantIdApply.setWebsite(cutLength(clientJson.getString("company_website"),128));
newSubMerchantIdApply.setWebsite(cutLength(clientJson.getString("company_website"),100));
newSubMerchantIdApply.setOffice_phone(cutLength(clientJson.getString("company_phone"),20));
newSubMerchantIdApply.setContact_phone(cutLength(clientJson.getString("contact_phone"),16));
newSubMerchantIdApply.setContact_name(cutLength(clientJson.getString("contact_person"),32));
newSubMerchantIdApply.setContact_email(cutLength(clientJson.getString("contact_email"),128));
newSubMerchantIdApply.setContact_email(cutLength(clientJson.getString("contact_email"),50));
newSubMerchantIdApply.setMcc_code(cutLength(wechatMcc.getString("mc_code"),10));
if(!TextUtils.isEmpty(clientConfig.getString("client_pay_type"))){
@ -559,7 +572,7 @@ public class TestController {
}else if(clientConfig.getString("client_pay_type").indexOf("1")>=0){
newSubMerchantIdApply.setBusiness_type("ONLINE");
}
else if(clientConfig.getString("client_pay_type").indexOf("1")>=0){
else if(clientConfig.getString("client_pay_type").indexOf("2")>=0){
newSubMerchantIdApply.setBusiness_type("OFFLINE");
}
}else{
@ -570,13 +583,33 @@ public class TestController {
}else{
newSubMerchantIdApply.setMerchant_type("INDIVIDUAL") ;
}
newSubMerchantIdApply.setCompany_register_no(cutLength(TextUtils.isEmpty(clientJson.getString("acn"))?clientJson.getString("abn"):clientJson.getString("abn"),50));
newSubMerchantIdApply.setCompany_register_no(cutLength(TextUtils.isEmpty(clientJson.getString("acn"))?clientJson.getString("abn"):clientJson.getString("acn"),50));
newSubMerchantIdApply.setCertificat_expire_date("PERMANENT");
JSONObject params = newSubMerchantIdApply.insertObject(clientJson);
params.put("merchant_app_id", jsonObject.getString("merchant_app_id"));
SubMerchantInfoInheritance subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfoInheritance.class);
params.put("operator","System");
if("ENTERPRISE".equalsIgnoreCase(newSubMerchantIdApply.getMerchant_type())&&TextUtils.isEmpty(newSubMerchantIdApply.getCompany_register_no())){
logger.error("=======>公司注册号为空clientid"+jsonObject.getInteger("client_id"));
return;
}
if("BOTH".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type())&&(TextUtils.isEmpty(newSubMerchantIdApply.getAddress()))||
TextUtils.isEmpty(newSubMerchantIdApply.getWebsite())){
logger.error("=======>公司类型为BOTH网址或地址为空clientid:"+jsonObject.getInteger("client_id"));
return;
}
else if("OFFLINE".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type())&&(TextUtils.isEmpty(newSubMerchantIdApply.getAddress()))){
logger.error("=======>公司类型为OFFLINE地址为空clientid:"+jsonObject.getInteger("client_id"));
return;
}
else if("ONLINE".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type())&&
TextUtils.isEmpty(newSubMerchantIdApply.getWebsite())){
logger.error("=======>公司类型为ONLINE网址为空clientid:"+jsonObject.getInteger("client_id"));
return;
}
WxPayMerchantRegister register = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class))
.orElseThrow(() -> new ServerErrorException("No Register found for wechat"));
@ -589,13 +622,9 @@ public class TestController {
e.printStackTrace();
}
});
// String declareResp = paymentDevHelper.devQueryCustomsReport(reportId);
// JSONObject res = new JSONObject();
// res.put("xml", declareResp);
}
public String cutLength(String str,int maxlen){
if(TextUtils.isEmpty(str))return "";

Loading…
Cancel
Save