MultiValueMap

public String callPhpInterface(AuditRequest request, List<FieldInfo> fieldsList, int auditResult) throws Exception {
        // 判断此操作是增加操作,还是修改操作
        String opType = checkExists(request.getRequestType(), request.getUniqueId(), request.getCityId());

        JSONObject json = new JSONObject();
        String url = getPhpInterfaceUrl(request.getRequestType(), request.getSourceDomain());
        json.put("auditRequestId", request.getAuditRequestId());
        json.put("auditResult", auditResult);
        json.put("groupId", request.getUniqueId());
        json.put("cityId", request.getCityId());
        json.put("editorId", request.getEditorId());
        json.put("receiveTime", request.getCreateTime().getTime());
        json.put("opType", opType);
        json.put("auditContent", fieldsList);
        logger.info("sendContent===" + json);

        String base64Param = Base64.encodeBase64String(json.toJSONString().getBytes("utf-8"));
        logger.info("base64Param===" + base64Param);
        MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>();
        form.add("param", base64Param);
        form.add(phpValidParam, "1");
        MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>();
        headers.add("sign", getSign(base64Param));
        HttpEntity<MultiValueMap<String, String>> req = new HttpEntity<MultiValueMap<String, String>>(form, headers);
        String result = restTemplate.postForObject(url, req, String.class);
        logger.info("result===" + result);
        return result;
    }

猜你喜欢

转载自wangqiaowqo.iteye.com/blog/2048241