From be80579377dca624c282cdf9a88bddda9fb2b0ed Mon Sep 17 00:00:00 2001 From: "YAS\\29473" <2947326429@qq.com> Date: Wed, 16 Jul 2025 13:12:08 +0800 Subject: [PATCH] =?UTF-8?q?update=E5=90=89=E6=9E=97=E7=9C=81=E5=9C=B0?= =?UTF-8?q?=E9=94=81=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thirdparty/JiLinPlatformController.java | 39 ++++++++++++++++++ .../platform/dto/QueryParkingLockDTO.java | 40 +++++++++++++++++++ .../service/ThirdPartyPlatformService.java | 10 +++++ .../impl/JiLinPlatformServiceImpl.java | 38 ++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/dto/QueryParkingLockDTO.java diff --git a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/JiLinPlatformController.java b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/JiLinPlatformController.java index e8f64430b..dfa7629ff 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/JiLinPlatformController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/JiLinPlatformController.java @@ -9,6 +9,7 @@ import com.jsowell.common.response.RestApiResponse; import com.jsowell.pile.dto.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; +import com.jsowell.thirdparty.platform.dto.QueryParkingLockDTO; import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -383,6 +384,44 @@ public class JiLinPlatformController extends ThirdPartyBaseController{ } + /** + * 控制地锁 + * @param request + * @param dto + * @return + */ + @PostMapping("/v1/query_parking_lock") + public CommonResult query_parking_lock(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + logger.info("{}-控制地锁 params:{}" , platformName , JSON.toJSONString(dto)); + try { + // 校验令牌 + if (!verifyToken(request.getHeader("Authorization"))) { + // 校验失败 + return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR); + } + + // 校验签名 + if (!verifySignature(dto)) { + // 签名错误 + return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR); + } + + // 解析入参 + QueryParkingLockDTO queryParkingLockDTO = parseParamsDTO(dto, QueryParkingLockDTO.class); + // 执行逻辑 + Map map = platformLogic.queryParkingLock(queryParkingLockDTO); // 控制地锁 + logger.info("{}-控制地锁 result:{}" , platformName , map); + return CommonResult.success(0 , "控制地锁成功!" , map.get("Data") , map.get("Sig")); + } catch (Exception e) { + logger.info("{}-控制地锁 error:" , platformName , e); + } + return CommonResult.failed("控制地锁发生异常"); + } + + + + + diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/dto/QueryParkingLockDTO.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/dto/QueryParkingLockDTO.java new file mode 100644 index 000000000..f3e75a4a4 --- /dev/null +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/dto/QueryParkingLockDTO.java @@ -0,0 +1,40 @@ +package com.jsowell.thirdparty.platform.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class QueryParkingLockDTO { + + /** + * 运营商Id + */ + @JsonProperty(value = "OperatorID") + private String operatorID; + + /** + * 充电接口编码 + */ + @JsonProperty(value = "ConnectorID") + private String connectorID; + + /** + * 用户id + */ + @JsonProperty(value = "UserID") + private String userID; + + /** + * 控制地锁code + * 0降1升 + */ + @JsonProperty(value = "LockCode") + private String lockCode; + +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java index 5007c4980..3812d5d8d 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java @@ -22,6 +22,7 @@ import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO; import com.jsowell.thirdparty.lianlian.vo.LianLianResultVO; import com.jsowell.thirdparty.platform.domain.SupOperatorInfo; import com.jsowell.thirdparty.platform.dto.QueryOrderDTO; +import com.jsowell.thirdparty.platform.dto.QueryParkingLockDTO; import com.jsowell.thirdparty.platform.util.Cryptos; import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.platform.util.GBSignUtils; @@ -280,6 +281,15 @@ public interface ThirdPartyPlatformService extends InitializingBean { } + /** + * 地锁控制 + * query_parking_lock + */ + default Map queryParkingLock(QueryParkingLockDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + // =================================================================================== // // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由对方平台实现此接口,我方平台调用的通知接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ // // =================================================================================== // diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/JiLinPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/JiLinPlatformServiceImpl.java index 939db52a5..eec697330 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/JiLinPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/JiLinPlatformServiceImpl.java @@ -14,6 +14,7 @@ import com.jsowell.common.enums.ykc.*; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.*; import com.jsowell.pile.domain.*; +import com.jsowell.pile.domain.ykcCommond.RemoteControlGroundLockCommand; import com.jsowell.pile.domain.ykcCommond.StartChargingCommand; import com.jsowell.pile.dto.*; import com.jsowell.pile.mapper.PileBasicInfoMapper; @@ -37,6 +38,7 @@ import com.jsowell.thirdparty.lianlian.domain.*; import com.jsowell.thirdparty.lianlian.vo.*; import com.jsowell.thirdparty.platform.domain.*; import com.jsowell.thirdparty.platform.dto.ChargeOrderInfoDTO; +import com.jsowell.thirdparty.platform.dto.QueryParkingLockDTO; import com.jsowell.thirdparty.platform.dto.SupStationInfoDTO; import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory; import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService; @@ -1580,7 +1582,43 @@ public class JiLinPlatformServiceImpl implements ThirdPartyPlatformService { } + /** + * 控制地锁 + * @param dto + * @return + */ + @Override + public Map queryParkingLock(QueryParkingLockDTO dto) { + JSONObject result = new JSONObject(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getJiLinSecretInfo(); + try { + if (dto.getConnectorID() == null || dto.getConnectorID().isEmpty()) { + throw new BusinessException(ReturnCodeEnum.valueOf("枪口信息错误")); + } + // 获取桩号 + String pileSn = dto.getConnectorID().substring(0, dto.getConnectorID().length() - 2); + // 获取枪口号 + String connectorCode = dto.getConnectorID().substring(dto.getConnectorID().length() - 2); + RemoteControlGroundLockCommand remoteControlGroundLockCommand = new RemoteControlGroundLockCommand(); + + remoteControlGroundLockCommand.setPileSn(pileSn); + remoteControlGroundLockCommand.setConnectorCode(connectorCode); + remoteControlGroundLockCommand.setOperate(dto.getLockCode()); // 0降1升 + + pileRemoteService.remoteControlGroundLock(remoteControlGroundLockCommand); + + result.put("SuccStat", 0); + result.put("FailReason", 0); + + } catch (Exception e) { + result.put("SuccStat", 1); + result.put("FailReason", e.getMessage()); // 使用异常信息作为失败原因 + log.error("Error occurred during remote control ground lock operation", e); + } finally { + return ThirdPartyPlatformUtils.generateResultMap(result, thirdPartySecretInfoVO); + } + }