update vin不再判断锁定状态

This commit is contained in:
Lemon
2024-02-19 09:00:57 +08:00
parent d5222812ed
commit 2c77853f45
3 changed files with 42 additions and 12 deletions

View File

@@ -3,6 +3,7 @@ package com.jsowell.web.controller.thirdparty.huawei;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.jsowell.common.annotation.Anonymous; import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.JWTUtils; import com.jsowell.common.util.JWTUtils;
import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.huawei.HuaweiServiceV2; import com.jsowell.thirdparty.huawei.HuaweiServiceV2;
@@ -61,17 +62,47 @@ public class HuaWeiControllerV2 extends BaseController {
@PostMapping("/v2/notification_stationStatus") @PostMapping("/v2/notification_stationStatus")
public CommonResult<?> receiveNotificationStationStatus(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { public CommonResult<?> receiveNotificationStationStatus(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("华为设备接口状态变化推送 params:{}", JSONObject.toJSONString(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"); String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) { if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败 // 校验失败
return CommonResult.failed("令牌校验错误"); logger.error("令牌校验错误");
return null;
} }
// 校验签名 // 校验签名
Map<String, String> resultMap = huaweiServiceV2.checkoutSign(dto); Map<String, String> resultMap = huaweiServiceV2.checkoutSign(dto);
if (resultMap == null) { if (resultMap == null) {
// 签名错误 // 签名错误
return CommonResult.failed("签名校验错误"); logger.error("令牌校验错误");
return null;
} }
String operatorSecret = resultMap.get("OperatorSecret"); String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data"); String dataString = resultMap.get("Data");
@@ -80,10 +111,8 @@ public class HuaWeiControllerV2 extends BaseController {
// 解密data // 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8); String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象 return dataStr;
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"));
} }
} }

View File

@@ -190,10 +190,10 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
if (plateInfo == null) { if (plateInfo == null) {
throw new BusinessException("", vinCode + "未查到绑定用户信息"); throw new BusinessException("", vinCode + "未查到绑定用户信息");
} }
if (!StringUtils.equals("1", plateInfo.getVinStatus())) { // if (!StringUtils.equals("1", plateInfo.getVinStatus())) {
// 1- 正常使用 // // 1- 正常使用
throw new BusinessException("", vinCode + "vin状态不正确"); // throw new BusinessException("", vinCode + "vin状态不正确");
} // }
// vin码生成订单 vin启动充电 // vin码生成订单 vin启动充电
GenerateOrderDTO dto = new GenerateOrderDTO(); GenerateOrderDTO dto = new GenerateOrderDTO();
dto.setMemberPlateNumberRelation(plateInfo); dto.setMemberPlateNumberRelation(plateInfo);

View File

@@ -2468,7 +2468,8 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
if (!StringUtils.equals(OrderPayModeEnum.PAYMENT_OF_WHITELIST.getValue(), dto.getPayMode())) { if (!StringUtils.equals(OrderPayModeEnum.PAYMENT_OF_WHITELIST.getValue(), dto.getPayMode())) {
dto.getMemberPlateNumberRelation().setVinStatus("2"); dto.getMemberPlateNumberRelation().setVinStatus("2");
} }
memberPlateNumberRelationService.updateMemberPlateNumberRelation(dto.getMemberPlateNumberRelation()); // 2024.02.06 不再判断锁定状态
// memberPlateNumberRelationService.updateMemberPlateNumberRelation(dto.getMemberPlateNumberRelation());
} }
// 组装结果集 // 组装结果集