RestTemplate与Get/POST请求

public <T extends BaseBLXResponse> T execute(BaseBLXRequest<T> request) {
        String uri = request.getRequestUri();
        String url = baseUrl + uri;

        SerializeConfig config = new SerializeConfig();
        config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
        Map<String, Object> map = JSON.parseObject(JSON.toJSONString(request, config));

        String method = request.getMethod();
        String resultJson = "";
        if (method.equals(METHOD_GET)) {
            MultiValueMap<String, String> param= new LinkedMultiValueMap<>();
            for (String key : map.keySet()) {
                param.add(key, map.get(key).toString());
            }
            UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url);
            URI urlGet = builder.queryParams(param).build().encode().toUri();
            logger.info("=========>uri: {}, urlGet: {}", uri, urlGet);

            ResponseEntity<String> responseEntity = restTemplate.getForEntity(urlGet, String.class);
            resultJson = responseEntity.getBody();
        } else if (method.equals(METHOD_POST)) {
            HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.MULTIPART_FORM_DATA);

            MultiValueMap<String, Object> reqBean= new LinkedMultiValueMap<>();
            for (String key : map.keySet()) {
                reqBean.add(key, map.get(key));
            }
            logger.info("=========>uri: {}, reqBean: {}", uri, reqBean);

            HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<>(reqBean, headers);
            ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, entity, String.class);
            resultJson = responseEntity.getBody();
        }
        logger.info("=========>uri: {}, resultJson: {}", uri, resultJson);

        JSONObject result = JSON.parseObject(resultJson);
        String code = result.getString("code");
        String msg = result.getString("msg");
        JSONObject respData = new JSONObject();
        if (SUCCESS_CODE.equals(code)) {
            respData = result.getJSONObject("data");
        }
        respData.put("code", code);
        respData.put("msg", msg);
        return respData.toJavaObject(request.getResponseClass());
    }