| | |
| | | public ResultVo sendApiPost(PayReqData payReqData) throws IOException { |
| | | |
| | | Map<String, String> param = new HashMap<>(); |
| | | String appid = "A1749891493E4CDDBFE4506357B1F0AB"; |
| | | String orderUrl = "http://finpt.xjcz.gov.cn/fs-service/fs-pay/invoice.do"; |
| | | // String appid = "A1749891493E4CDDBFE4506357B1F0AB"; |
| | | // String orderUrl = "http://finpt.xjcz.gov.cn/fs-service/fs-pay/invoice.do"; |
| | | |
| | | HttpPost httpPost = new HttpPost(orderUrl); |
| | | log.info("请求地址:"+orderUrl); |
| | | //请求参数转为json格式base64编码 |
| | | String reqData = Base64.getEncoder().encodeToString(JSONObject.toJSONString(payReqData).getBytes()); |
| | | String mac = appid + "||" + reqData; |
| | | String mac = appId + "||" + reqData; |
| | | mac = DigestUtils.md5Hex(mac.getBytes()); |
| | | param.put("appid", appid); |
| | | log.info("请求appid:"+appid); |
| | | param.put("appid", appId); |
| | | log.info("请求appid:"+appId); |
| | | param.put("reqdata", reqData); |
| | | param.put("mac", mac); |
| | | |
| | |
| | | public ResultVo uploadXml(String orderId, String plain) throws IOException { |
| | | Map<String, String> params = new HashMap<>(); |
| | | |
| | | // Sign sign = new Sign(); |
| | | // SignResult sign1 = this.sign(plain); |
| | | // log.info("签名结果为:"+ Arrays.toString(sign1.getSignData())); |
| | | // VerifyResult verify = this.verify(plain, sign1.getSignData()); |
| | | // SignDto signDto = new SignDto("SM3", "Base64", new Date(), verify.getReturnData(), verify.getSerialNumber(), verify.getIssure()); |
| | | // Element signature = sign.getSignature(signDto); |
| | | |
| | | String appid = "A1749891493E4CDDBFE4506357B1F0AB"; |
| | | String orderUrl = "http://finpt.xjcz.gov.cn/fs-service/fs-pay/uploadXml.do"; |
| | | // String appid = "A1749891493E4CDDBFE4506357B1F0AB"; |
| | | // String orderUrl = "http://finpt.xjcz.gov.cn/fs-service/fs-pay/uploadXml.do"; |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("orderNo",orderId); |
| | | jsonObject.put("fileData", Base64.getEncoder().encodeToString(plain.getBytes())); |
| | | |
| | | String reqdata = Base64.getEncoder().encodeToString(jsonObject.toJSONString().getBytes()); |
| | | String mac = appid+"||" +reqdata; |
| | | String mac = appId+"||" +reqdata; |
| | | mac = DigestUtils.md5Hex(mac.getBytes()); |
| | | |
| | | params.put("appid",appid); |
| | | params.put("appid",appId); |
| | | params.put("reqdata",reqdata); |
| | | params.put("mac",mac); |
| | | |
| | | HttpPost httpPost = new HttpPost(orderUrl); |
| | | HttpPost httpPost = new HttpPost(uploadXmlUrl); |
| | | httpPost.setEntity(assemblyFormEntity(params,"utf-8")); |
| | | HttpClient httpClient = getHttpClient(orderUrl); |
| | | HttpClient httpClient = getHttpClient(uploadXmlUrl); |
| | | HttpResultVo execute = httpClient.execute(httpPost, getResponseHandler()); |
| | | String stringContent = execute.getStringContent(); |
| | | ResultVo resultVo = JSONObject.parseObject(stringContent, ResultVo.class); |