add 推送开票邮寄数据到会员系统
This commit is contained in:
+21
@@ -100,4 +100,25 @@ public class AuthenticationUtils {
|
||||
throw new JeroBootException("数据同步失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用会员系统post接口
|
||||
* @param methodName
|
||||
* @param requestParam
|
||||
* @param requestBody
|
||||
*/
|
||||
public static void postStandards(String methodName,String requestParam,Object requestBody) {
|
||||
Map<String, String> stringStringMap = encryptByRsaPriKey();
|
||||
String publicKey = stringStringMap.get("publicKey");
|
||||
String token = stringStringMap.get("token");
|
||||
String jsonString = JSONObject.toJSONString(requestBody);
|
||||
//拼接url路径
|
||||
StringBuilder urlBuilder = new StringBuilder(AuthenticationUtils.URL);
|
||||
urlBuilder.append(methodName).append("?publicKey=").append(publicKey).append("&pushToken=").append(token);
|
||||
if (StrUtil.isNotBlank(requestParam)){
|
||||
urlBuilder.append(requestParam);
|
||||
}
|
||||
String post = HttpUtil.post(urlBuilder.toString(), jsonString);
|
||||
checkResult(post);
|
||||
}
|
||||
}
|
||||
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
package com.jero.common.util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Spring 上下文工具类
|
||||
* @author liJiaRao
|
||||
* @date 2021-09-16 15:05
|
||||
*/
|
||||
@Component
|
||||
public class SpringContextUtil implements ApplicationContextAware {
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(@NotNull ApplicationContext applicationContext) throws BeansException {
|
||||
SpringContextUtil.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上下文
|
||||
*/
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 bena 名称获取上下文中的 bean
|
||||
*/
|
||||
public static Object getBean(String name) {
|
||||
return applicationContext.getBean(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过类型获取上下文中的bean
|
||||
*/
|
||||
public static Object getBean(Class<?> requiredType) {
|
||||
return applicationContext.getBean(requiredType);
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
package com.jero.config.shiro.filters;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.jero.common.system.util.JwtUtil;
|
||||
import com.jero.common.util.AuthenticationUtils;
|
||||
import com.jero.common.util.SpringContextUtil;
|
||||
import com.jero.common.util.SpringContextUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
|
||||
@@ -69,7 +68,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
|
||||
if (StrUtil.isNotBlank(pushToken)){
|
||||
String publicKey = httpServletRequest.getParameter("publicKey");
|
||||
if (authenticationUtils ==null ){
|
||||
authenticationUtils = (AuthenticationUtils) SpringContextUtil.getBean("authenticationUtils");
|
||||
authenticationUtils = (AuthenticationUtils) SpringContextUtils.getBean("authenticationUtils");
|
||||
}
|
||||
authenticationUtils.check(pushToken,publicKey);
|
||||
}else {
|
||||
|
||||
Reference in New Issue
Block a user