教育训练处考试制证系统后端
heheng
2025-02-19 152d72020690625c269f27861d6e5a0923a71eb7
测试
已修改1个文件
50 ■■■■■ 文件已修改
exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java
@@ -582,31 +582,43 @@
        String appid = "A1749891493E4CDDBFE4506357B1F0AB";
        String orderUrl = "http://finpt.xjcz.gov.cn/fs-service/fs-pay/uploadXml.do";
        String uploadUrl = "http://finpt.xjcz.gov.cn/fs-service/fs-pay/uploadXml.do";
        SignatureFileVo signatureFile = new SignatureFileVo();
        signatureFile.setFileData(plain);
        signatureFile.setOrderNo(orderId);
        String reqdatastr = JSONObject.toJSONString(signatureFile);
        String reqdata = getBase64(signatureFile.toString());
        String mac = appid + "||" + reqdata;
        mac = DigestUtils.md5Hex(mac.getBytes());
        String mac = this.getMD5("A1749891493E4CDDBFE4506357B1F0AB||" + this.getBase64(reqdatastr));
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("appid", "A1749891493E4CDDBFE4506357B1F0AB");
        jsonObject.put("mac", mac);
        jsonObject.put("reqdata", this.getBase64(reqdatastr));
        Map<String, String> header = new HashMap();
        header.put("Accept", "application/json;charset=utf-8");
        header.put("Content-Type", "application/json;charset=utf-8");
        String resultStr = HttpUtil.post(uploadUrl, jsonObject);
        JSONObject result = JSONObject.parseObject(resultStr);
        params.put("appid", appid);
        params.put("reqdata", reqdata);
        params.put("mac", mac);
        HttpPost httpPost = new HttpPost(orderUrl);
        httpPost.setEntity(assemblyFormEntity(params, "utf-8"));
        HttpClient httpClient = getHttpClient(orderUrl);
        HttpResultVo execute = null;
        try {
            execute = httpClient.execute(httpPost, getResponseHandler());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        String stringContent = execute.getStringContent();
        ResultVo resultVo = JSONObject.parseObject(stringContent, ResultVo.class);
//        String reqdata = getBase64(signatureFile.toString());
//        String mac = appid + "||" + reqdata;
//        mac = DigestUtils.md5Hex(mac.getBytes());
//
//        params.put("appid", appid);
//        params.put("reqdata", reqdata);
//        params.put("mac", mac);
//
//        HttpPost httpPost = new HttpPost(orderUrl);
//        httpPost.setEntity(assemblyFormEntity(params, "utf-8"));
//        HttpClient httpClient = getHttpClient(orderUrl);
//        HttpResultVo execute = null;
//        try {
//            execute = httpClient.execute(httpPost, getResponseHandler());
//        } catch (IOException e) {
//            throw new RuntimeException(e);
//        }
//        String stringContent = execute.getStringContent();
        ResultVo resultVo = JSONObject.parseObject(resultStr, ResultVo.class);
        log.info("请求结果转为:" + resultVo);
        return resultVo;
    }