| | |
| | | package com.iailab.module.data.common.utils; |
| | | |
| | | import com.iailab.framework.security.core.util.SecurityFrameworkUtils; |
| | | import com.iailab.framework.tenant.core.context.TenantContextHolder; |
| | | import org.apache.http.HttpEntity; |
| | | import org.apache.http.HttpResponse; |
| | |
| | | * @return |
| | | */ |
| | | public static String doPost(String url, String json, String charset, String token) { |
| | | Long tenantId = TenantContextHolder.getTenantId(); |
| | | org.apache.http.client.HttpClient httpClient = null; |
| | | HttpPost httpPost = null; |
| | | String result = null; |
| | |
| | | httpPost.addHeader("Accept", "application/json"); |
| | | httpPost.addHeader("Content-Type", "application/json;charset=UTF-8"); |
| | | httpPost.addHeader("token", token); |
| | | //传递租户id |
| | | httpPost.addHeader("Tenant-Id", String.valueOf(TenantContextHolder.getTenantId())); |
| | | httpPost.addHeader("Tenant-Id", String.valueOf(tenantId)); |
| | | StringEntity stringEntity = new StringEntity(json); |
| | | stringEntity.setContentEncoding("UTF-8"); |
| | | stringEntity.setContentType("application/json"); |