mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -190,10 +190,10 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
||||
if (plateInfo == null) {
|
||||
throw new BusinessException("", vinCode + "未查到绑定用户信息");
|
||||
}
|
||||
if (!StringUtils.equals("1", plateInfo.getVinStatus())) {
|
||||
// 1- 正常使用
|
||||
throw new BusinessException("", vinCode + "vin状态不正确");
|
||||
}
|
||||
// if (!StringUtils.equals("1", plateInfo.getVinStatus())) {
|
||||
// // 1- 正常使用
|
||||
// throw new BusinessException("", vinCode + "vin状态不正确");
|
||||
// }
|
||||
// vin码生成订单 vin启动充电
|
||||
GenerateOrderDTO dto = new GenerateOrderDTO();
|
||||
dto.setMemberPlateNumberRelation(plateInfo);
|
||||
|
||||
@@ -2468,7 +2468,8 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
if (!StringUtils.equals(OrderPayModeEnum.PAYMENT_OF_WHITELIST.getValue(), dto.getPayMode())) {
|
||||
dto.getMemberPlateNumberRelation().setVinStatus("2");
|
||||
}
|
||||
memberPlateNumberRelationService.updateMemberPlateNumberRelation(dto.getMemberPlateNumberRelation());
|
||||
// 2024.02.06 不再判断锁定状态
|
||||
// memberPlateNumberRelationService.updateMemberPlateNumberRelation(dto.getMemberPlateNumberRelation());
|
||||
}
|
||||
|
||||
// 组装结果集
|
||||
|
||||
Reference in New Issue
Block a user