Java微信特约商户进件

因为特约商户进件和小微商户进件接口一样,只不过提交的参数不一样,所以看这个博客前先看小微商户进件
小微商户进件教程
很多工具类代码都在小微商户进件里
官方文档:
https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_1.shtml
代码实现

@ApiOperation(value = "特约商户微信进件", notes = "特约商户微信进件")
    @PostMapping("/wx/into1")
    public Result addWxInto1(@Valid @RequestBody IntoVo intoVo) {
        try {
            ApplymentBo t = new ApplymentBo();
            String str = t.exe1(intoVo);
            return Result.success(str);
        } catch (Exception e) {
            log.error("系统出错:{}", e);
            return Result.fail("系统出错");
        }
    }
public String exe1(IntoVo intoVo) throws Exception {
        String contactName = intoVo.getTrueName(); // 超级管理员姓名
        String contactIdNum = intoVo.getCardNum(); // 身份证号码
        String contactMobile = intoVo.getContactPhone(); // 手机号码
        String contactMail = intoVo.getEmail(); // 联系邮箱
        // 获取微信平台证书 并解析方法在后面
        String certString = CertUtil.getCertStr();
        ByteArrayInputStream stringStream = new ByteArrayInputStream(certString.getBytes());
        // 下面所有加密参数需要的对象
        X509Certificate certx = PemUtil.loadCertificate(stringStream);

        // 超级管理员信息
        Map<String, Object> contact_info = new HashMap<>();
        String contact_name = RsaEncryptUtil.rsaEncryptOAEP(contactName, certx); // 超级管理员姓名
        String contact_id_number = RsaEncryptUtil.rsaEncryptOAEP(contactIdNum, certx); // 超级管理员身份证件号码
        String mobile_phone = Merchanter.rsaEncryptOAEP(contactMobile, certx);// 联系手机
        String contact_email = RsaEncryptUtil.rsaEncryptOAEP(contactMail, certx);// 联系邮箱
        contact_info.put("contact_name", contact_name);
        contact_info.put("contact_id_number", contact_id_number);
        contact_info.put("mobile_phone", mobile_phone);
        contact_info.put("contact_email", contact_email);

        // 主体资料
        //主体资料信息开始
        JSONObject subjectInfo = new JSONObject();
        //SUBJECT_TYPE_INDIVIDUAL 个体
        subjectInfo.put("subject_type", "SUBJECT_TYPE_INDIVIDUAL");
        JSONObject businessLicenseInfo = new JSONObject();
        businessLicenseInfo.put("license_number", intoVo.getLicenseNumber());
        businessLicenseInfo.put("license_copy", intoVo.getLicenseCopy());//营业执照照片
        businessLicenseInfo.put("legal_person", contact_name);//个体户经营者/法人姓名
        businessLicenseInfo.put("merchant_name", intoVo.getMerchantName());//商户名称
        subjectInfo.put("business_license_info", businessLicenseInfo);
        //经营者/法人身份证件信息
        JSONObject identity_info = new JSONObject();
        identity_info.put("id_doc_type", "IDENTIFICATION_TYPE_IDCARD");
        identity_info.put("owner", true);
        JSONObject id_card_info = new JSONObject();
        id_card_info.put("id_card_copy", intoVo.getIdCardCopy());
        id_card_info.put("id_card_national", intoVo.getIdCardCopy());
        id_card_info.put("id_card_name", RsaEncryptUtil.rsaEncryptOAEP(intoVo.getIdCardName(), certx));
        id_card_info.put("id_card_number", RsaEncryptUtil.rsaEncryptOAEP(contactIdNum, certx));
        id_card_info.put("card_period_begin", intoVo.getCardPeriodBegin());
        id_card_info.put("card_period_end", intoVo.getCardPeriodEnd());
        identity_info.put("id_card_info", id_card_info);
        subjectInfo.put("identity_info", identity_info);
        //params.put("subject_info", subjectInfo);
        //主体资料信息结束

        //经营资料 开始
        JSONObject business_info = new JSONObject();
        business_info.put("merchant_shortname", intoVo.getStoreShortName());
        business_info.put("service_phone", intoVo.getServicePhone());
        JSONObject sales_info = new JSONObject();
        JSONArray array = new JSONArray();
//        array.add("SALES_SCENES_WEB");
//        array.add("SALES_SCENES_STORE");
        array.add("SALES_SCENES_MINI_PROGRAM");//小程序
        sales_info.put("sales_scenes_type", array);//经营场景类型
        JSONObject biz_store_info = new JSONObject();
        biz_store_info.put("biz_store_name", intoVo.getStoreShortName());
        biz_store_info.put("biz_address_code", intoVo.getStoreCode());//门店省份编码
        biz_store_info.put("biz_store_address", intoVo.getStoreStreet());

        JSONArray store_entrance_pic = new JSONArray();
        store_entrance_pic.add(intoVo.getDoorMedia());//门店图片
        biz_store_info.put("store_entrance_pic", store_entrance_pic);

        JSONArray indoor_pic = new JSONArray();
        indoor_pic.add(intoVo.getPlaceMedia());
        biz_store_info.put("indoor_pic", indoor_pic);
        sales_info.put("biz_store_info", biz_store_info);
        business_info.put("sales_info", sales_info);

        //申请不同的场景会开通对应的支付权限,二维码,收款码,JSAPI等。可以多个场景一起申请。注意看官方文档
        JSONObject mini_program_info = new JSONObject();
        //经营场景类型对应枚举值SALES_SCENES_MINI_PROGRAM 服务商小程序appid
        mini_program_info.put("mini_program_appid", "wxd********");

        sales_info.put("mini_program_info", mini_program_info);
        business_info.put("sales_info", sales_info);
        //params.put("business_info", business_info);
        //经营资料 结束

        //结算规则 开始
        JSONObject settlement_info = new JSONObject();
        if ("对私".equals("对私")) {
            settlement_info.put("settlement_id", "719");
        } else {
            settlement_info.put("settlement_id", "716");
        }
        settlement_info.put("qualification_type", "餐饮");
        settlement_info.put("sales_info", sales_info);
        JSONArray qualifications = new JSONArray();
        qualifications.add(intoVo.getPlaceMedia());
        qualifications.add(intoVo.getDoorMedia());
        settlement_info.put("qualifications", qualifications);
        //params.put("settlement_info", settlement_info);
        //结算规则 结束

        //银行信息 开始
        JSONObject bank_account_info = new JSONObject();
        if (intoVo.getSettleType().equals("对私")) {
            bank_account_info.put("bank_account_type", "BANK_ACCOUNT_TYPE_PERSONAL");
        } else {
            bank_account_info.put("bank_account_type", "BANK_ACCOUNT_TYPE_CORPORATE");
        }
        bank_account_info.put("account_name", Merchanter.rsaEncryptOAEP(intoVo.getBankPeople(), certx));//开户名
        bank_account_info.put("account_bank", intoVo.getBankName());//开户银行
        bank_account_info.put("bank_address_code", intoVo.getBankProvince());//省份编码
        bank_account_info.put("bank_name", intoVo.getBankDeposit());//开户支行全称
        bank_account_info.put("account_number", Merchanter.rsaEncryptOAEP(intoVo.getBankAccount(), certx));
        //params.put("bank_account_info", bank_account_info);
        //银行信息 结束

        //补充材料信息 开始
        JSONObject addition_info = new JSONObject();
        JSONArray business_addition_pics = new JSONArray();
        business_addition_pics.add(intoVo.getDoorMedia());
        business_addition_pics.add(intoVo.getDoorMedia());
        addition_info.put("business_addition_pics", business_addition_pics);
        String address = intoVo.getStoreProvince() + intoVo.getStoreCity() + intoVo.getStoreCounty();
        addition_info.put("business_addition_msg", "店铺名称:" + intoVo.getMerchantName() + ",门店地址:" + address);
        //params.put("addition_info", addition_info);
        //补充材料信息 结束

        String business_code = OrderIdUtils.getGoodsOrderId(); // 申请单号
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("business_code", business_code);//超级管理员信息
        map.put("contact_info", contact_info);
        map.put("subject_info", subjectInfo);//主体资料信息
        map.put("business_info", business_info);//经营资料
        map.put("settlement_info", settlement_info);//结算规则
        map.put("bank_account_info", bank_account_info);//银行信息
        map.put("addition_info", addition_info);//补充材料信息
        try {
            String body = JSONObject.fromObject(map).toString();
            String str = HttpUrlUtil.sendPost(body);
            System.out.println(str);
            return str;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

IntoVo类

package com.shifen.manager.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;

@ApiModel(value = "进件信息1")
@Data
public class IntoVo {
    private static final long serialVersionUID = 1L;

    private String id;

    @ApiModelProperty(value = "开户支行全称", required = true)
    @NotNull(message = "商家姓名不能为空")
    private String trueName; //商家姓名

    @ApiModelProperty(value = "邮箱地址", required = true)
    @NotNull(message = "邮箱地址不能为空")
    private String email;

    @ApiModelProperty(value = "店铺全称", required = true)
    private String storeName;

    @ApiModelProperty(value = "店铺简称", required = true)
    private String storeShortName;

    @ApiModelProperty(value = "银行名称", required = true)
    private String bankName;

    @ApiModelProperty(value = "银行编码", required = true)
    private String bankCode;

    @ApiModelProperty(value = "银行开户名", required = true)
    private String bankPeople;

    @ApiModelProperty(value = "银行卡账号", required = true)
    private String bankAccount;

    @ApiModelProperty(value = "银行开户省份", required = true)
    private String bankProvince;

    private String bankCity; //开户城市

    private String bankCounty;  //开户区县

    @ApiModelProperty(value = "开户支行全称", required = true)
    private String bankDeposit;

    @ApiModelProperty(value = "对公还是对私")
    private String settleType;

    @ApiModelProperty(value = "注册号/统一社会信用代码", required = true)
    private String licenseNumber;

    @ApiModelProperty(value = "营业执照照片", required = true)
    @NotNull(message = "营业执照照片,不能为空")
    private String licenseCopy;

    @ApiModelProperty(value = "商户名称")
    private String merchantName;

    @ApiModelProperty(value = "银行卡或执照照片名字")
    private String idCardName;

    @ApiModelProperty(value = "身份证正面")
    private String idCardCopy;

    @ApiModelProperty(value = "身份证反面")
    private String idCardNational;


    @ApiModelProperty(value = "身份证")
    private String cardNum;

    @ApiModelProperty(value = "身份证有效期开始时间 1998-10-01")
    private String cardPeriodBegin; 

    @ApiModelProperty(value = "身份证有效期结束时间 1998-10-01")
    private String cardPeriodEnd;

    @ApiModelProperty(value = "用户手机")
    private String contactPhone;

    @ApiModelProperty(value = "客服电话")
    private String servicePhone;

    @ApiModelProperty(value = "门店省份编码")
    private String storeCode;

    @ApiModelProperty(value = "门店具体地址")
    private String storeStreet;

    @ApiModelProperty(value = "门店图片")
    private String doorMedia;

    private String placeMedia;
}


  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云上上云

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值