From 4513eee088d73940d2ba9da5271bd269a45c86d9 Mon Sep 17 00:00:00 2001 From: dalong306 <304592994@qq.com> Date: Thu, 8 Apr 2021 16:47:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=9B=B4=E6=96=B0=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=AD=90=E5=95=86=E6=88=B7=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/dev/web/TestController.java | 49 +++++++++++++++---- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java index 6c864666a..448dbf857 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java @@ -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 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 "";