diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverIdDocType.java b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverIdDocType.java index b460c084d..5994b45db 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverIdDocType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverIdDocType.java @@ -1,5 +1,7 @@ package com.iformall.enums; +import com.github.binarywang.wxpay.bean.applyment.enums.IdTypeEnum; + import java.util.ArrayList; import java.util.List; @@ -16,14 +18,14 @@ import java.util.List; */ public enum EnumSharingReceiverIdDocType { - IDENTIFICATION_TYPE_IDCARD(1, "IDENTIFICATION_TYPE_IDCARD", "中国大陆居民-身份证"), - IDENTIFICATION_TYPE_OVERSEA_PASSPORT(2, "IDENTIFICATION_TYPE_OVERSEA_PASSPORT", "其他国家或地区居民-护照"), - IDENTIFICATION_TYPE_HONGKONG_PASSPORT(3, "IDENTIFICATION_TYPE_HONGKONG_PASSPORT", "中国香港居民--来往内地通行证"), - IDENTIFICATION_TYPE_MACAO_PASSPORT(4, "IDENTIFICATION_TYPE_MACAO_PASSPORT", "中国澳门居民--来往内地通行证"), - IDENTIFICATION_TYPE_TAIWAN_PASSPORT(5, "IDENTIFICATION_TYPE_TAIWAN_PASSPORT", "中国台湾居民--来往大陆通行证"), - IDENTIFICATION_TYPE_FOREIGN_RESIDENT(6, "IDENTIFICATION_TYPE_FOREIGN_RESIDENT", "外国人居留证"), - IDENTIFICATION_TYPE_HONGKONG_MACAO_RESIDENT(7, "IDENTIFICATION_TYPE_HONGKONG_MACAO_RESIDENT", "港澳居民证"), - IDENTIFICATION_TYPE_TAIWAN_RESIDENT(8, "IDENTIFICATION_TYPE_TAIWAN_RESIDENT", "台湾居民证"), + IDENTIFICATION_TYPE_IDCARD(1, IdTypeEnum.IDENTIFICATION_TYPE_IDCARD, "中国大陆居民-身份证"), + IDENTIFICATION_TYPE_OVERSEA_PASSPORT(2, IdTypeEnum.IDENTIFICATION_TYPE_OVERSEA_PASSPORT, "其他国家或地区居民-护照"), + IDENTIFICATION_TYPE_HONGKONG_PASSPORT(3, IdTypeEnum.IDENTIFICATION_TYPE_HONGKONG_PASSPORT, "中国香港居民--来往内地通行证"), + IDENTIFICATION_TYPE_MACAO_PASSPORT(4, IdTypeEnum.IDENTIFICATION_TYPE_MACAO_PASSPORT, "中国澳门居民--来往内地通行证"), + IDENTIFICATION_TYPE_TAIWAN_PASSPORT(5, IdTypeEnum.IDENTIFICATION_TYPE_TAIWAN_PASSPORT, "中国台湾居民--来往大陆通行证"), + IDENTIFICATION_TYPE_FOREIGN_RESIDENT(6, IdTypeEnum.IDENTIFICATION_TYPE_FOREIGN_RESIDENT, "外国人居留证"), + IDENTIFICATION_TYPE_HONGKONG_MACAO_RESIDENT(7, IdTypeEnum.IDENTIFICATION_TYPE_HONGKONG_MACAO_RESIDENT, "港澳居民证"), + IDENTIFICATION_TYPE_TAIWAN_RESIDENT(8, IdTypeEnum.IDENTIFICATION_TYPE_TAIWAN_RESIDENT, "台湾居民证"), ; public static EnumSharingReceiverIdDocType getEnum(Integer code) { @@ -35,9 +37,9 @@ public enum EnumSharingReceiverIdDocType { return null; } - public static EnumSharingReceiverIdDocType getEnum(String codeStr) { + public static EnumSharingReceiverIdDocType getEnum(IdTypeEnum idTypeEnum) { for (EnumSharingReceiverIdDocType value : values()) { - if (value.getCodeStr().equals(codeStr)) { + if (value.getIdTypeEnum().equals(idTypeEnum)) { return value; } } @@ -45,12 +47,12 @@ public enum EnumSharingReceiverIdDocType { } private Integer code; - private String codeStr; + private IdTypeEnum idTypeEnum; private String message; - EnumSharingReceiverIdDocType(Integer code, String codeStr, String message) { + EnumSharingReceiverIdDocType(Integer code, IdTypeEnum idTypeEnum, String message) { this.code = code; - this.codeStr = codeStr; + this.idTypeEnum = idTypeEnum; this.message = message; } @@ -58,22 +60,12 @@ public enum EnumSharingReceiverIdDocType { return code; } - public String getCodeStr() { - return codeStr; + public IdTypeEnum getIdTypeEnum() { + return idTypeEnum; } public String getMessage() { return message; } - public static List getOtherNeddBack(){ - List list = new ArrayList<>(); - list.add(IDENTIFICATION_TYPE_HONGKONG_PASSPORT.getCode()); - list.add(IDENTIFICATION_TYPE_MACAO_PASSPORT.getCode()); - list.add(IDENTIFICATION_TYPE_TAIWAN_PASSPORT.getCode()); - list.add(IDENTIFICATION_TYPE_FOREIGN_RESIDENT.getCode()); - list.add(IDENTIFICATION_TYPE_HONGKONG_MACAO_RESIDENT.getCode()); - list.add(IDENTIFICATION_TYPE_TAIWAN_RESIDENT.getCode()); - return list; - } } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverOrganizationType.java b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverOrganizationType.java index 5e7e076e2..142346d79 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverOrganizationType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverOrganizationType.java @@ -1,5 +1,7 @@ package com.iformall.enums; +import com.github.binarywang.wxpay.bean.applyment.enums.SubjectTypeEnum; + /** * 进件特约商户 主体类型 * SUBJECT_TYPE_INDIVIDUAL(个体户):营业执照上的主体类型一般为个体户、个体工商户、个体经营; @@ -12,11 +14,11 @@ public enum EnumSharingReceiverOrganizationType { // XIAOWEI(2401, "2401", "小微商户"), // GEREN(2500, "2500", "个人卖家"), - GETI(4, "SUBJECT_TYPE_INDIVIDUAL", "个体工商户"), - QIYE(2, "SUBJECT_TYPE_ENTERPRISE", "企业"), - SHIYE(3, "SUBJECT_TYPE_INSTITUTIONS", "事业单位"), - ZHENGFU(2502, "SUBJECT_TYPE_GOVERNMENT", "政府机关"), - SHEHUI(1708, "SUBJECT_TYPE_OTHERS", "社会组织"), + GETI(4, SubjectTypeEnum.SUBJECT_TYPE_INDIVIDUAL,"个体工商户"), + QIYE(2, SubjectTypeEnum.SUBJECT_TYPE_ENTERPRISE,"企业"), +// SHIYE(3, "SUBJECT_TYPE_INSTITUTIONS", ,"事业单位"), +// ZHENGFU(2502, "SUBJECT_TYPE_GOVERNMENT", "政府机关"), +// SHEHUI(1708, "SUBJECT_TYPE_OTHERS", "社会组织"), ; public static EnumSharingReceiverOrganizationType getEnum(Integer code) { @@ -28,9 +30,9 @@ public enum EnumSharingReceiverOrganizationType { return null; } - public static EnumSharingReceiverOrganizationType getEnum(String codeStr) { + public static EnumSharingReceiverOrganizationType getEnum(SubjectTypeEnum subjectTypeEnum) { for (EnumSharingReceiverOrganizationType value : values()) { - if (value.getCodeStr().equals(codeStr)) { + if (value.getSubjectTypeEnum().equals(subjectTypeEnum)) { return value; } } @@ -38,12 +40,12 @@ public enum EnumSharingReceiverOrganizationType { } private Integer code; - private String codeStr; + private SubjectTypeEnum subjectTypeEnum; private String message; - EnumSharingReceiverOrganizationType(Integer code, String codeStr, String message) { + EnumSharingReceiverOrganizationType(Integer code, SubjectTypeEnum subjectTypeEnum, String message) { this.code = code; - this.codeStr = codeStr; + this.subjectTypeEnum = subjectTypeEnum; this.message = message; } @@ -51,8 +53,8 @@ public enum EnumSharingReceiverOrganizationType { return code; } - public String getCodeStr() { - return codeStr; + public SubjectTypeEnum getSubjectTypeEnum() { + return subjectTypeEnum; } public String getMessage() { diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverSalesScenesType.java b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverSalesScenesType.java index 1c2f43257..d8bde5a40 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverSalesScenesType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumSharingReceiverSalesScenesType.java @@ -1,5 +1,7 @@ package com.iformall.enums; +import com.github.binarywang.wxpay.bean.applyment.enums.SalesScenesTypeEnum; + import java.util.ArrayList; import java.util.List; @@ -14,12 +16,12 @@ import java.util.List; */ public enum EnumSharingReceiverSalesScenesType { - SALES_SCENES_STORE(1, "SALES_SCENES_STORE", "线下场所"), - SALES_SCENES_MP(2, "SALES_SCENES_MP", "公众号"), - SALES_SCENES_MINI_PROGRAM(3, "SALES_SCENES_MINI_PROGRAM", "小程序"), - SALES_SCENES_WEB(4, "SALES_SCENES_WEB", "互联网网站"), - SALES_SCENES_APP(5, "SALES_SCENES_APP", "APP"), - SALES_SCENES_WEWORK(6, "SALES_SCENES_WEWORK", "企业微信"), + SALES_SCENES_STORE(1, SalesScenesTypeEnum.SALES_SCENES_STORE, "线下场所"), + SALES_SCENES_MP(2, SalesScenesTypeEnum.SALES_SCENES_MP,"公众号"), + SALES_SCENES_MINI_PROGRAM(3, SalesScenesTypeEnum.SALES_SCENES_MINI_PROGRAM, "小程序"), + SALES_SCENES_WEB(4, SalesScenesTypeEnum.SALES_SCENES_WEB,"互联网网站"), + SALES_SCENES_APP(5, SalesScenesTypeEnum.SALES_SCENES_APP,"APP"), + SALES_SCENES_WEWORK(6, SalesScenesTypeEnum.SALES_SCENES_WEWORK,"企业微信"), ; public static EnumSharingReceiverSalesScenesType getEnum(Integer code) { @@ -31,9 +33,9 @@ public enum EnumSharingReceiverSalesScenesType { return null; } - public static EnumSharingReceiverSalesScenesType getEnum(String codeStr) { + public static EnumSharingReceiverSalesScenesType getEnum(SalesScenesTypeEnum salesScenesTypeEnum) { for (EnumSharingReceiverSalesScenesType value : values()) { - if (value.getCodeStr().equals(codeStr)) { + if (value.getSalesScenesTypeEnum().equals(salesScenesTypeEnum)) { return value; } } @@ -41,12 +43,12 @@ public enum EnumSharingReceiverSalesScenesType { } private Integer code; - private String codeStr; + private SalesScenesTypeEnum salesScenesTypeEnum; private String message; - EnumSharingReceiverSalesScenesType(Integer code, String codeStr, String message) { + EnumSharingReceiverSalesScenesType(Integer code, SalesScenesTypeEnum salesScenesTypeEnum, String message) { this.code = code; - this.codeStr = codeStr; + this.salesScenesTypeEnum = salesScenesTypeEnum; this.message = message; } @@ -54,14 +56,25 @@ public enum EnumSharingReceiverSalesScenesType { return code; } - public String getCodeStr() { - return codeStr; + public SalesScenesTypeEnum getSalesScenesTypeEnum() { + return salesScenesTypeEnum; } public String getMessage() { return message; } + public static List getSalesScenesTypeEnumList(List codes) { + List list = new ArrayList<>(); + for (Integer code : codes) { + EnumSharingReceiverSalesScenesType anEnum = getEnum(code); + if(anEnum != null){ + list.add(anEnum.getSalesScenesTypeEnum()); + } + } + return list; + } + public static List getAllCode() { List list = new ArrayList<>(); for (EnumSharingReceiverSalesScenesType value : values()) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java index 51a7602e0..dba16c85d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.binarywang.wxpay.bean.applyment.WxPayApplyment4SubCreateRequest; import com.github.binarywang.wxpay.bean.applyment.WxPayApplymentCreateResult; +import com.github.binarywang.wxpay.bean.applyment.enums.SalesScenesTypeEnum; import com.github.binarywang.wxpay.bean.bank.BankingResult; import com.github.binarywang.wxpay.exception.WxPayException; import com.github.binarywang.wxpay.service.WxPayService; @@ -355,7 +356,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR logger.info("未上传证件正面照片"); return false; } - if(EnumSharingReceiverIdDocType.getOtherNeddBack().contains(enumIdDocType.getCode())){ + if(!EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_OVERSEA_PASSPORT.equals(enumIdDocType)){ JSONObject id_doc_copy_back_info = idDocInfoObject.getJSONObject("id_doc_copy_back_info"); if(StringUtils.isBlank(this.getMerchantMediaId(id_doc_copy_back_info))){ logger.info("未上传证件反面照片"); @@ -521,16 +522,17 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR return false; } JSONArray store_entrance_pic = biz_store_info.getJSONArray("store_entrance_pic"); - if(store_entrance_pic == null || store_entrance_pic.isEmpty()){ + List mediaIds = this.getMerchantMediaIds(store_entrance_pic); + if(mediaIds.isEmpty()){ logger.info("未上传线下场所门头照片"); return false; } JSONArray indoor_pic = biz_store_info.getJSONArray("indoor_pic"); - if(indoor_pic == null || indoor_pic.isEmpty()){ + List mediaIds1 = this.getMerchantMediaIds(indoor_pic); + if(mediaIds1.isEmpty()){ logger.info("未上传线下场所内部照片"); return false; } - } if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_MP.getCode())){ JSONObject mp_info = salesInfoObject.getJSONObject("mp_info"); @@ -545,10 +547,15 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR return false; } JSONArray mp_pics = mp_info.getJSONArray("mp_pics"); - if(mp_pics == null || mp_pics.isEmpty()){ + List mediaIds = this.getMerchantMediaIds(mp_pics); + if(mediaIds.isEmpty()){ logger.info("未上传公众号页面截图"); return false; } + if(mediaIds.size() > 5){ + logger.info("上传公众号页面截图超限"); + return false; + } } if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_MINI_PROGRAM.getCode())){ @@ -563,6 +570,12 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR logger.info("未填写对应小程序APPID"); return false; } + JSONArray mini_program_pics = mini_program_info.getJSONArray("mini_program_pics"); + List mediaIds = this.getMerchantMediaIds(mini_program_pics); + if(mediaIds.size() > 5){ + logger.info("上传小程序页面截图超限"); + return false; + } } if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_WEB.getCode())){ @@ -590,10 +603,15 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR return false; } JSONArray app_pics = app_info.getJSONArray("app_pics"); - if(app_pics == null || app_pics.isEmpty()){ + List mediaIds = this.getMerchantMediaIds(app_pics); + if(mediaIds.isEmpty()){ logger.info("未上传APP页面截图"); return false; } + if(mediaIds.size() > 5){ + logger.info("上传APP页面截图超限"); + return false; + } } if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_WEWORK.getCode())){ JSONObject wework_info = salesInfoObject.getJSONObject("wework_info"); @@ -607,10 +625,15 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR return false; } JSONArray wework_pics = wework_info.getJSONArray("wework_pics"); - if(wework_pics == null || wework_pics.isEmpty()){ + List mediaIds = this.getMerchantMediaIds(wework_pics); + if(mediaIds.isEmpty()){ logger.info("未上传企业微信页面截图"); return false; } + if(mediaIds.size() > 5){ + logger.info("上传企业微信页面截图超限"); + return false; + } } return true; @@ -681,7 +704,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR return false; } if(mediaIds.size() > 5){ - logger.info("上传资质数量过多"); + logger.info("上传资质数量超限"); return false; } } @@ -699,7 +722,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR return false; } if(mediaIds.size() > 5){ - logger.info("上传资质数量过多"); + logger.info("上传资质数量超限"); return false; } } @@ -928,10 +951,141 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR WxPayApplyment4SubCreateRequest request = new WxPayApplyment4SubCreateRequest(); request.setBusinessCode(receiverApply.getOutRequestNo()); WxPayApplyment4SubCreateRequest.SubjectInfo subjectInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo(); + EnumSharingReceiverOrganizationType enumOrganizationType = EnumSharingReceiverOrganizationType.getEnum(receiverApply.getOrganizationType()); + subjectInfo.setSubjectType(enumOrganizationType.getSubjectTypeEnum()); + if(EnumYesOrNo.YES.getCode().equals(receiverApply.getFinanceInstitution())){ + //todo 金融机构 +// subjectInfo.setFinanceInstitution(true); + } + if(EnumSharingReceiverOrganizationType.GETI.equals(enumOrganizationType) || EnumSharingReceiverOrganizationType.QIYE.equals(enumOrganizationType)){ + JSONObject businessLicenseInfoObject = JSONObject.parseObject(receiverApply.getBusinessLicenseInfo()); + WxPayApplyment4SubCreateRequest.SubjectInfo.BusinessLicenseInfo businessLicenseInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.BusinessLicenseInfo(); + JSONObject license_copy_info = businessLicenseInfoObject.getJSONObject("license_copy_info"); + businessLicenseInfo.setLicenseCopy(this.getMerchantMediaId(license_copy_info)); + businessLicenseInfo.setLicenseNumber(businessLicenseInfoObject.getString("license_number")); + businessLicenseInfo.setMerchantName(businessLicenseInfoObject.getString("merchant_name")); + businessLicenseInfo.setLegalPerson(businessLicenseInfoObject.getString("legal_person")); + businessLicenseInfo.setLicenseAddress(businessLicenseInfoObject.getString("license_address")); + businessLicenseInfo.setPeriodBegin(businessLicenseInfoObject.getString("period_begin")); + businessLicenseInfo.setPeriodEnd(businessLicenseInfoObject.getString("period_end")); + subjectInfo.setBusinessLicenseInfo(businessLicenseInfo); + WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo identityInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo(); + EnumSharingReceiverIdDocType enumIdDocType = EnumSharingReceiverIdDocType.getEnum(receiverApply.getIdDocType()); + identityInfo.setIdDocType(enumIdDocType.getIdTypeEnum()); + if(EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_IDCARD.equals(enumIdDocType)){ + JSONObject idCardInfoObject = JSONObject.parseObject(receiverApply.getIdCardInfo()); + WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdCardInfo idCardInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdCardInfo(); + JSONObject id_card_copy_info = idCardInfoObject.getJSONObject("id_card_copy_info"); + idCardInfo.setIdCardCopy(this.getMerchantMediaId(id_card_copy_info)); + JSONObject id_card_national_info = idCardInfoObject.getJSONObject("id_card_national_info"); + idCardInfo.setIdCardNational(this.getMerchantMediaId(id_card_national_info)); + idCardInfo.setIdCardName(idCardInfoObject.getString("id_card_name")); + idCardInfo.setIdCardNumber(idCardInfoObject.getString("id_card_number")); + idCardInfo.setIdCardAddress(idCardInfoObject.getString("id_card_address")); + idCardInfo.setCardPeriodBegin(idCardInfoObject.getString("card_period_begin")); + idCardInfo.setCardPeriodEnd(idCardInfoObject.getString("card_period_end")); + identityInfo.setIdCardInfo(idCardInfo); + }else{ + JSONObject idDocInfoObject = JSONObject.parseObject(receiverApply.getIdDocInfo()); + WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdDocInfo idDocInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdDocInfo(); + JSONObject id_doc_copy_info = idDocInfoObject.getJSONObject("id_doc_copy_info"); + idDocInfo.setIdDocCopy(this.getMerchantMediaId(id_doc_copy_info)); + if(!EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_OVERSEA_PASSPORT.equals(enumIdDocType)){ + JSONObject id_doc_copy_back_info = idDocInfoObject.getJSONObject("id_doc_copy_back_info"); + idDocInfo.setIdDocCopyBack(this.getMerchantMediaId(id_doc_copy_back_info)); + } + idDocInfo.setIdDocName(idDocInfoObject.getString("id_doc_name")); + idDocInfo.setIdDocNumber(idDocInfoObject.getString("id_doc_number")); + idDocInfo.setIdDocAddress(idDocInfoObject.getString("id_doc_address")); + idDocInfo.setDocPeriodBegin(idDocInfoObject.getString("doc_period_begin")); + idDocInfo.setDocPeriodEnd(idDocInfoObject.getString("doc_period_end")); + identityInfo.setIdDocInfo(idDocInfo); + } + if(EnumSharingReceiverOrganizationType.QIYE.equals(enumOrganizationType)){ + if(EnumYesOrNo.YES.getCode().equals(receiverApply.getOwner())){ + identityInfo.setOwner(true); + }else{ + identityInfo.setOwner(false); + List uboInfoList = new ArrayList<>(); + JSONArray jsonArray = JSONArray.parseArray(receiverApply.getUboInfoList()); + for(int i = 0;i < jsonArray.size();i++){ + JSONObject uboInfoObject = jsonArray.getJSONObject(i); + WxPayApplyment4SubCreateRequest.SubjectInfo.UboInfo uboInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.UboInfo(); + Integer ubo_id_doc_type = uboInfoObject.getInteger("ubo_id_doc_type"); + EnumSharingReceiverIdDocType enumUboIdDocType = EnumSharingReceiverIdDocType.getEnum(ubo_id_doc_type); + uboInfo.setUboIdDocType(enumUboIdDocType.getIdTypeEnum()); + JSONObject ubo_id_doc_copy_info = uboInfoObject.getJSONObject("ubo_id_doc_copy_info"); + uboInfo.setUboIdDocCopy(this.getMerchantMediaId(ubo_id_doc_copy_info)); + if(!EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_OVERSEA_PASSPORT.equals(enumUboIdDocType)){ + JSONObject ubo_id_doc_copy_back_info = uboInfoObject.getJSONObject("ubo_id_doc_copy_back_info"); + uboInfo.setUboIdDocCopyBack(this.getMerchantMediaId(ubo_id_doc_copy_back_info)); + } + uboInfo.setUboIdDocName(uboInfoObject.getString("ubo_id_doc_name")); + uboInfo.setUboIdDocNumber(uboInfoObject.getString("ubo_id_doc_number")); + uboInfo.setUboIdDocAddress(uboInfoObject.getString("ubo_id_doc_address")); + uboInfo.setUboPeriodBegin(uboInfoObject.getString("ubo_period_begin")); + uboInfo.setUboPeriodEnd(uboInfoObject.getString("ubo_period_end")); + uboInfoList.add(uboInfo); + } + subjectInfo.setUboInfoList(uboInfoList); + } + } + subjectInfo.setIdentityInfo(identityInfo); + } else{ + //todo 其他主体 + } request.setSubjectInfo(subjectInfo); WxPayApplyment4SubCreateRequest.BusinessInfo businessInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo(); - + businessInfo.setMerchantShortname(receiverApply.getMerchantShortname()); + businessInfo.setServicePhone(receiverApply.getServicePhone()); + JSONObject salesInfoObject = JSONObject.parseObject(receiverApply.getSalesInfo()); + WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo salesInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo(); + JSONArray sales_scenes_type = salesInfoObject.getJSONArray("sales_scenes_type"); + List salesScenesTypes = sales_scenes_type.toJavaList(Integer.class); + List salesScenesTypeEnumList = EnumSharingReceiverSalesScenesType.getSalesScenesTypeEnumList(salesScenesTypes); + salesInfo.setSalesScenesType(salesScenesTypeEnumList); + if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_STORE.getCode())){ + WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.BizStoreInfo bizStoreInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.BizStoreInfo(); + //todo 线下场所场景 + salesInfo.setBizStoreInfo(bizStoreInfo); + } + if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_MP.getCode())){ + JSONObject mp_info = salesInfoObject.getJSONObject("mp_info"); + WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MpInfo mpInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MpInfo(); + //todo 公众号场景 + salesInfo.setMpInfo(mpInfo); + } + if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_MINI_PROGRAM.getCode())){ + JSONObject mini_program_info = salesInfoObject.getJSONObject("mini_program_info"); + WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MiniProgramInfo miniProgramInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MiniProgramInfo(); + miniProgramInfo.setMiniProgramAppid(mini_program_info.getString("mini_program_appid")); + miniProgramInfo.setMiniProgramSubAppid(mini_program_info.getString("mini_program_sub_appid")); + List mediaIds = this.getMerchantMediaIds(mini_program_info.getJSONArray("mini_program_pics")); + if(!mediaIds.isEmpty()){ + miniProgramInfo.setMiniProgramPics(mediaIds); + } + salesInfo.setMiniProgramInfo(miniProgramInfo); + } + if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_WEB.getCode())){ + JSONObject web_info = salesInfoObject.getJSONObject("web_info"); + WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WebInfo webInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WebInfo(); + //todo 互联网网站场景 + salesInfo.setWebInfo(webInfo); + } + if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_APP.getCode())){ + JSONObject app_info = salesInfoObject.getJSONObject("app_info"); + WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.AppInfo appInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.AppInfo(); + //todo APP场景 + salesInfo.setAppInfo(appInfo); + } + if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_WEWORK.getCode())){ + JSONObject wework_info = salesInfoObject.getJSONObject("wework_info"); + WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WeworkInfo weworkInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WeworkInfo(); + //todo 企业微信场景 + salesInfo.setWeworkInfo(weworkInfo); + } + businessInfo.setSalesInfo(salesInfo); request.setBusinessInfo(businessInfo); WxPayApplyment4SubCreateRequest.SettlementInfo settlementInfo = new WxPayApplyment4SubCreateRequest.SettlementInfo();