Commit d57c59e6 authored by fangxinjiang's avatar fangxinjiang

init

parent 40e4487d
package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import cn.hutool.json.JSONUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.extern.log4j.Log4j2;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
......@@ -67,8 +69,13 @@ public class HttpDaprUtil {
// 初始化请求URL
initUrl(appUrl, appId, method, "");
ResponseEntity<T> res;
HttpHeaders headers = new HttpHeaders();
headers.add(SecurityConstants.FROM, from);
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("Authorization", null);
HttpEntity<String> entity = new HttpEntity(param, headers);
try {
res = restTemplate.postForEntity(URI.create(stringBuffer.toString()),param, cs);
res = restTemplate.postForEntity(URI.create(stringBuffer.toString()),entity, cs);
} catch (Exception e) {
return R.failed("获取信息失败:" + e.getMessage());
}
......
......@@ -65,16 +65,16 @@ public class PermitAllUrlProperties implements InitializingBean, ApplicationCont
// 获取方法上边的注解 替代path variable 为 *
Inner method = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Inner.class);
if (null != method && null != info.getPatternsCondition()){
Optional.ofNullable(method).ifPresent(inner -> info.getPatternsCondition().getPatterns()
.forEach(url -> urls.add(ReUtil.replaceAll(url, PATTERN, "*"))));
if (null != method && null != info.getPathPatternsCondition()){
Optional.ofNullable(method).ifPresent(inner -> info.getPathPatternsCondition().getPatterns()
.forEach(url -> urls.add(ReUtil.replaceAll( url.toString(), PATTERN, "*"))));
}
// 获取类上边的注解, 替代path variable 为 *
Inner controller = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), Inner.class);
if (null != controller && null != info.getPatternsCondition())
Optional.ofNullable(controller).ifPresent(inner -> info.getPatternsCondition().getPatterns()
.forEach(url -> urls.add(ReUtil.replaceAll(url, PATTERN, "*"))));
if (null != controller && null != info.getPathPatternsCondition())
Optional.ofNullable(controller).ifPresent(inner -> info.getPathPatternsCondition().getPatterns()
.forEach(url -> urls.add(ReUtil.replaceAll(url.toString(), PATTERN, "*"))));
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment