mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
update vin不再判断锁定状态
This commit is contained in:
@@ -3,6 +3,7 @@ package com.jsowell.web.controller.thirdparty.huawei;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.JWTUtils;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.thirdparty.huawei.HuaweiServiceV2;
|
||||
@@ -61,17 +62,47 @@ public class HuaWeiControllerV2 extends BaseController {
|
||||
@PostMapping("/v2/notification_stationStatus")
|
||||
public CommonResult<?> receiveNotificationStationStatus(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("华为设备接口状态变化推送 params:{}", JSONObject.toJSONString(dto));
|
||||
String dataStr = checkAuth(request, dto);
|
||||
// 转换成相应对象
|
||||
ConnectorStatusInfo connectorStatusInfo = JSONObject.parseObject(dataStr, ConnectorStatusInfo.class);
|
||||
connectorStatusInfo.setOperatorId(dto.getOperatorID());
|
||||
Map<String, String> map = huaweiServiceV2.receiveNotificationStationStatus(connectorStatusInfo);
|
||||
return CommonResult.success(0, "设备接口状态变化推送成功!", map.get("Data"), map.get("Sig"));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/v2/request_equip_business_policy")
|
||||
public CommonResult<?> requestEquipBusinessPolicy(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private String checkAuth(HttpServletRequest request, CommonParamsDTO dto) {
|
||||
// 校验令牌
|
||||
String token = request.getHeader("Authorization");
|
||||
if (!JWTUtils.checkThirdPartyToken(token)) {
|
||||
// 校验失败
|
||||
return CommonResult.failed("令牌校验错误");
|
||||
logger.error("令牌校验错误");
|
||||
return null;
|
||||
}
|
||||
// 校验签名
|
||||
Map<String, String> resultMap = huaweiServiceV2.checkoutSign(dto);
|
||||
if (resultMap == null) {
|
||||
// 签名错误
|
||||
return CommonResult.failed("签名校验错误");
|
||||
logger.error("令牌校验错误");
|
||||
return null;
|
||||
}
|
||||
String operatorSecret = resultMap.get("OperatorSecret");
|
||||
String dataString = resultMap.get("Data");
|
||||
@@ -80,10 +111,8 @@ public class HuaWeiControllerV2 extends BaseController {
|
||||
// 解密data
|
||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
|
||||
String dataStr = new String(plainText, StandardCharsets.UTF_8);
|
||||
// 转换成相应对象
|
||||
ConnectorStatusInfo connectorStatusInfo = JSONObject.parseObject(dataStr, ConnectorStatusInfo.class);
|
||||
connectorStatusInfo.setOperatorId(dto.getOperatorID());
|
||||
Map<String, String> map = huaweiServiceV2.receiveNotificationStationStatus(connectorStatusInfo);
|
||||
return CommonResult.success(0, "设备接口状态变化推送成功!", map.get("Data"), map.get("Sig"));
|
||||
return dataStr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user