| | |
| | | package com.java110.core.base.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.base.AppBase; |
| | | import com.java110.core.context.BusinessServiceDataFlow; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.core.context.PageData; |
| | | import com.java110.core.factory.DataFlowFactory; |
| | | import com.java110.dto.basePrivilege.BasePrivilegeDto; |
| | | import com.java110.utils.cache.PrivilegeCache; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.NoAuthorityException; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | |
| | | String[] value = (String[]) readOnlyMap.get(key); |
| | | // String[] value = (String[]) readOnlyMap.get(key); |
| | | if (value.length > 1) { |
| | | headers.put(key, value[0]); |
| | | for (int j = 0; j < value.length; j++) { |
| | | queryString.append(key); |
| | | queryString.append("="); |
| | | queryString.append(value[j]); |
| | | queryString.append("&"); |
| | | } |
| | | |
| | | } else { |
| | | headers.put(key, value[0]); |
| | | queryString.append(key); |
| | | queryString.append("="); |
| | | queryString.append(value[0]); |
| | | queryString.append("&"); |
| | | } |
| | | if(!hasValidHeader(key.toLowerCase())){ |
| | | continue; |
| | | } |
| | | headers.put(key, value[0]); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | private boolean hasValidHeader(String key) { |
| | | if("app-id".equals(key) || "app_id".equals(key)){ |
| | | return true; |
| | | } |
| | | if("transaction-id".equals(key) || "transaction_id".equals(key)){ |
| | | return true; |
| | | } |
| | | if("req-time".equals(key) || "req_time".equals(key)){ |
| | | return true; |
| | | } |
| | | if("sign".equals(key)){ |
| | | return true; |
| | | } |
| | | if("user-id".equals(key) || "user_id".equals(key)){ |
| | | return true; |
| | | } |
| | | if("java110-lang".equals(key)){ |
| | | return true; |
| | | } |
| | | if("store-id".equals(key)){ |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | public static Map<String, String> getParameterStringMap(HttpServletRequest request) { |
| | | Map<String, String[]> properties = request.getParameterMap();//把请求参数封装到Map<String, String[]>中 |
| | | Map<String, String> returnMap = new HashMap<String, String>(); |