|  |  |  | 
|---|
|  |  |  | import cc.mrbird.febs.common.annotation.ControllerEndpoint; | 
|---|
|  |  |  | import cc.mrbird.febs.common.entity.FebsResponse; | 
|---|
|  |  |  | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; | 
|---|
|  |  |  | import cc.mrbird.febs.common.utils.AppContants; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.dto.*; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.entity.DataDictionaryCustom; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.security.KeyPair; | 
|---|
|  |  |  | import java.security.NoSuchAlgorithmException; | 
|---|
|  |  |  | import java.security.PrivateKey; | 
|---|
|  |  |  | import java.util.Arrays; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | 
|---|
|  |  |  | DataDictionaryEnum.FP_CALLBACK_URL.getCode(), | 
|---|
|  |  |  | faPiaoDto.getCallbackUrl() | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | KeyPair privateKey = wxFaPiaoService.getPrivateKey(); | 
|---|
|  |  |  | HeaderDto headerDto = new HeaderDto(); | 
|---|
|  |  |  | headerDto.setCallback_url(faPiaoDto.getCallbackUrl()); | 
|---|
|  |  |  | headerDto.setCallback_url("https://api.blnka.cn/api/xcxPay/fapiaoCallBack"); | 
|---|
|  |  |  | headerDto.setShow_fapiao_cell(false); | 
|---|
|  |  |  | String parseObj = JSONUtil.parseObj(headerDto).toString(); | 
|---|
|  |  |  | String baseUrl = "https://api.mch.weixin.qq.com"; | 
|---|
|  |  |  | String canonicalUrl = "/v3/new-tax-control-fapiao/merchant/development-config"; | 
|---|
|  |  |  | String postStr = wxFaPiaoService.createAuthorization( | 
|---|
|  |  |  | "POST", | 
|---|
|  |  |  | canonicalUrl, | 
|---|
|  |  |  | parseObj, | 
|---|
|  |  |  | privateKey | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | // 创建httppost | 
|---|
|  |  |  | String postStr = null; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | HttpClient httpClient = new HttpClient(); | 
|---|
|  |  |  | PostMethod post = new PostMethod(baseUrl+canonicalUrl); | 
|---|
|  |  |  | post.setRequestHeader("Accept", "application/json"); | 
|---|
|  |  |  | post.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36"); | 
|---|
|  |  |  | post.setRequestHeader("Content-Type", "application/json"); | 
|---|
|  |  |  | post.setRequestHeader("Connection", "keep-alive"); | 
|---|
|  |  |  | post.setRequestHeader("Authorization",  "WECHATPAY2-SHA256-RSA2048 "+postStr); | 
|---|
|  |  |  | RequestEntity entity = new StringRequestEntity(parseObj, "text/html", "utf-8"); | 
|---|
|  |  |  | post.setRequestEntity(entity); | 
|---|
|  |  |  | httpClient.executeMethod(post); | 
|---|
|  |  |  | String responseBodyAsString = post.getResponseBodyAsString(); | 
|---|
|  |  |  | cn.hutool.json.JSONObject maps = JSONUtil.parseObj(responseBodyAsString); | 
|---|
|  |  |  | System.out.println(maps); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PrivateKey privateKey = wxFaPiaoService.getPrivateKeyV3(); | 
|---|
|  |  |  | postStr = wxFaPiaoService.createAuthorization( | 
|---|
|  |  |  | "PATCH", | 
|---|
|  |  |  | baseUrl+canonicalUrl, | 
|---|
|  |  |  | parseObj, | 
|---|
|  |  |  | privateKey | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } catch (NoSuchAlgorithmException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return new FebsResponse().success().message("操作成功"); | 
|---|
|  |  |  | String token = AppContants.FP_TOKEN_HEADER_TYPE+postStr; | 
|---|
|  |  |  | System.out.println("WECHATPAY2-SHA256-RSA2048 "+postStr); | 
|---|
|  |  |  | String s = wxFaPiaoService.sendPatch(baseUrl + canonicalUrl, parseObj, token); | 
|---|
|  |  |  | log.info("配置开发选项:"+s); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return new FebsResponse().success().message(s); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/agentDetail") | 
|---|