|  | @ -0,0 +1,69 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.care.util;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.RSAUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.http.HttpClientUtil;
 | 
	
		
			
				|  |  | import org.apache.commons.collections.map.HashedMap;
 | 
	
		
			
				|  |  | import org.apache.http.NameValuePair;
 | 
	
		
			
				|  |  | import org.apache.http.message.BasicNameValuePair;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Component;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.ArrayList;
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | import java.util.Map;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * 拱墅区红领巾app对接
 | 
	
		
			
				|  |  |  * Created by yeshijie on 2022/7/13.
 | 
	
		
			
				|  |  |  */
 | 
	
		
			
				|  |  | @Component
 | 
	
		
			
				|  |  | public class HongLingJinUtil {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private static final Logger logger = LoggerFactory.getLogger(HongLingJinUtil.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     //ras加密公钥
 | 
	
		
			
				|  |  |     private static final String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlOKrXjxrFo4Y2nNqzVh4ZMaxg58p83uSGuSA9Kxjsja+KHvN/72NqyKER2ucPuiYsDUBjFQI9t4LMLS8zl0GlKHKHU+gr8IQ4Cg/JqQLhjpgX4/f3Xk54A/1003TWKn9hSJSlsw3uxgLVTj/pwZoL1W1NSFKSu8jZbgzToNa2GwIDAQAB";
 | 
	
		
			
				|  |  |     //第三方平台的用户名
 | 
	
		
			
				|  |  |     private static final String username = "ddsqhd";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private HttpClientUtil httpClientUtil;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void getToken(){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             String url = "http://10.18.40.99:7680/sso/token";
 | 
	
		
			
				|  |  | //            String url = "https://zhyzh.gongshu.gov.cn/ssotoken/sso/token";
 | 
	
		
			
				|  |  |             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);
 | 
	
		
			
				|  |  |             logger.info("response:"+response);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     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);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |