Browse Source

红领巾平台对接

LAPTOP-KB9HII50\70708 2 years ago
parent
commit
2bcee453af

+ 10 - 10
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/HongLingJinUtil.java

@ -9,6 +9,7 @@ import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
@ -66,7 +67,6 @@ public class HongLingJinUtil {
    }
/*    public static void main(String[] args) throws Exception{
//        String url = "http://10.18.40.101:7688/api/zzd/common";
        String url = "https://zhyzh.gongshu.gov.cn/zzdcommon";
        JSONObject params = new JSONObject();
@ -79,24 +79,24 @@ public class HongLingJinUtil {
        eventChargeName.put("deptName","");
        eventChargeName.put("mobile","15545430148");
        eventChargeName.put("realName","李康硕");
*//*        test1.put("mobile","15545430148");
        test1.put("realName","李康硕");*//*
        params.put("eventAssistName",eventAssistName);
        params.put("eventChargeName",eventChargeName);
        params.put("eventHappenTime","2022-07-13 21:27:00");
        params.put("eventHappenTime","2022-07-14 17:27:00");
        params.put("eventLocation","测试地址");
        params.put("eventName","测试事件");
        params.put("taskDescription","测试事件1");
        params.put("eventState","1");
        params.put("taskId","1234");
        params.put("eventSource","2");
        params.put("taskId","adsf1234as24324");
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        headers.add("Authorization", "Bearer "+"6540793f-a3a3-4e4c-8d65-76c3697e3adb");
        headers.add("Content-Type", MediaType.APPLICATION_JSON_VALUE);
        headers.add("Authorization", "Bearer "+"e38c22a7-68d6-46d2-afb3-2adb8250af7e");
        headers.add("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE);
        headers.add("Accept",MediaType.ALL_VALUE);
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
        System.out.println("params.toJSONString():"+params.toJSONString());
        HttpEntity<String> formEntity = new HttpEntity<String>(params.toJSONString(), headers);
        String ret = restTemplate.postForObject(url, formEntity, String.class);
        System.out.println(ret);
@ -133,9 +133,9 @@ public class HongLingJinUtil {
            RestTemplate restTemplate = new RestTemplate();
            HttpHeaders headers = new HttpHeaders();
            headers.add("Authorization", "Bearer "+getToken());
            headers.add("Content-Type", MediaType.APPLICATION_JSON_VALUE);
            headers.add("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE);
            headers.add("Accept",MediaType.ALL_VALUE);
            org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
            HttpEntity<String> formEntity = new HttpEntity<String>(params.toJSONString(), headers);
            String ret = restTemplate.postForObject(url, formEntity, String.class);
            logger.info("ret:"+ret);
        }catch (Exception e){