MultiValueMap

public String callPhpInterface(AuditRequest request, List 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 form = new LinkedMultiValueMap();
form.add("param", base64Param);
form.add(phpValidParam, "1");
MultiValueMap headers = new LinkedMultiValueMap();
headers.add("sign", getSign(base64Param));
HttpEntity> req = new HttpEntity>(form, headers);
String result = restTemplate.postForObject(url, req, String.class);
logger.info("result===" + result);
return result;
}

你可能感兴趣的:(Java,json,java,c/c++)