mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update 海南平台对接
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.jsowell.common.enums.thirdparty;
|
||||
|
||||
/**
|
||||
* 业务信息交换enum
|
||||
*/
|
||||
public enum BusinessInformationExchangeEnum {
|
||||
NOTIFICATION_STATION_STATUS("notification_stationStatus", "设备状态变化推送"),
|
||||
NOTIFICATION_CHARGE_ORDER_INFO("notification_charge_order_info", "推送充电订单信息"),
|
||||
NOTIFICATION_START_CHARGE_RESULT("notification_start_charge_result", "推送启动充电结果"),
|
||||
NOTIFICATION_EQUIP_CHARGE_STATUS("notification_equip_charge_status", "推送充电状态"),
|
||||
NOTIFICATION_STOP_CHARGE_RESULT("notification_stop_charge_result", "推送停止充电结果"),
|
||||
CHECK_CHARGE_ORDERS("check_charge_orders", "推送订单对账结果信息"),
|
||||
;
|
||||
private String value;
|
||||
|
||||
private String label;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
BusinessInformationExchangeEnum(String value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.security.Key;
|
||||
import java.util.Date;
|
||||
@@ -128,6 +129,11 @@ public class JWTUtils {
|
||||
return claims.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验第三方平台token
|
||||
* @param token 第三方平台token
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkThirdPartyToken(String token) {
|
||||
token = getToken(token);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
@@ -137,6 +143,15 @@ public class JWTUtils {
|
||||
return StringUtils.isNotBlank(claims.getId());
|
||||
}
|
||||
|
||||
public static boolean checkThirdPartyToken(HttpServletRequest request) {
|
||||
if (request == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR);
|
||||
}
|
||||
// 校验令牌
|
||||
String token = request.getHeader("Authorization");
|
||||
return checkThirdPartyToken(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换Bearer
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user