update吉林省地锁控制

This commit is contained in:
YAS\29473
2025-07-16 13:12:08 +08:00
parent 827070f75d
commit be80579377
4 changed files with 127 additions and 0 deletions

View File

@@ -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<String, String> 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("控制地锁发生异常");
}

View File

@@ -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;
}

View File

@@ -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<String, String> queryParkingLock(QueryParkingLockDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
// =================================================================================== //
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由对方平台实现此接口,我方平台调用的通知接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ //
// =================================================================================== //

View File

@@ -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<String, String> 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);
}
}