| 
					
				 | 
			
			
				@ -9,9 +9,16 @@ 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.HttpHeaders; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.http.HttpMethod; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.http.MediaType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Component; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.util.LinkedMultiValueMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.util.MultiValueMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.client.RestTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -32,38 +39,85 @@ public class HongLingJinUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HttpClientUtil httpClientUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void getToken(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取token 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getToken(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String url = "http://10.18.40.99:7680/sso/token"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            String url = "https://zhyzh.gongshu.gov.cn/ssotoken/sso/token"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            String url = "https://zhyzh.gongshu.gov.cn/ssotoken"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("client_id","client_third"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("client_secret","a2o8W3nP"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("username",username); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,Object> httpPost = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            httpPost.put("Content-Type", "application/x-www-form-urlencoded"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String code = RSAUtils.encrypt(json.toString(),publicKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<NameValuePair> params = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(new BasicNameValuePair("code", code)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String response = httpClientUtil.headerPost(url, params,"UTF-8",httpPost); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("url:"+url); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("code:"+code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject response = httpClientUtil.headerPost(url+"?code="+code, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(response.getInteger("code")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return  response.getJSONObject("data").getString("access_token"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("response:"+response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    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(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject eventAssistName = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject test1 = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        test1.put("deptName",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        test1.put("mobile",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        test1.put("realName",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        eventAssistName.put("test",test1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject eventChargeName = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject test2 = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        test2.put("deptName",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        test2.put("mobile","15659713528"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        test2.put("realName","测试账号"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/*        test1.put("mobile","15545430148"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        test1.put("realName","李康硕");*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        eventChargeName.put("test",test2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("eventAssistName",eventAssistName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("eventChargeName",eventChargeName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("eventHappenTime","2022-07-13 21:27:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("eventLocation","测试地址"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("eventName","测试事件"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("taskDescription","测试事件1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("eventState","0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("taskId",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        RestTemplate restTemplate = new RestTemplate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpHeaders headers = new HttpHeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        headers.add("Authorization", "Bearer "+"a8d1f682-9281-4d88-84ed-3643e738da09"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        headers.add("Content-Type", MediaType.APPLICATION_JSON_VALUE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        headers.add("Accept",MediaType.ALL_VALUE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String ret = restTemplate.postForObject(url, formEntity, String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        System.out.println(ret); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void zzdcommon(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String url = "http://10.18.40.99:7680/sso/token"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String url = "https://zhyzh.gongshu.gov.cn/zzdcommon/api/zzd/common"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("client_id","client_third"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("client_secret","a2o8W3nP"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("username",username); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String url = "http://10.18.40.101:7688/api/zzd/common"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            String url = "https://zhyzh.gongshu.gov.cn/zzdcommon"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |