mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-14 23:08:35 +08:00
update 设备状态变化推送联联平台接口
This commit is contained in:
@@ -7,10 +7,7 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
|||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.response.RestApiResponse;
|
import com.jsowell.common.response.RestApiResponse;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.pile.dto.LianLianPushStationInfoDTO;
|
import com.jsowell.pile.dto.*;
|
||||||
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
|
||||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
|
||||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
|
||||||
import com.jsowell.thirdparty.domain.StationStatsInfo;
|
import com.jsowell.thirdparty.domain.StationStatsInfo;
|
||||||
import com.jsowell.thirdparty.service.LianLianService;
|
import com.jsowell.thirdparty.service.LianLianService;
|
||||||
import com.jsowell.thirdparty.vo.*;
|
import com.jsowell.thirdparty.vo.*;
|
||||||
@@ -62,6 +59,35 @@ public class LianLianController extends BaseController {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联联平台设备状态变化推送
|
||||||
|
* http://localhost:8080/LianLian/pushStationStatus
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/pushStationStatus")
|
||||||
|
public RestApiResponse<?> pushStationStatus(@RequestBody PushInfoParamDTO dto) {
|
||||||
|
logger.info("联联平台设备状态变化推送 params:{}", JSONObject.toJSONString(dto));
|
||||||
|
RestApiResponse<?> response = null;
|
||||||
|
try {
|
||||||
|
if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) ||
|
||||||
|
StringUtils.isBlank(String.valueOf(dto.getStatus()))) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||||
|
}
|
||||||
|
String result = lianLianService.pushConnectorStatus(dto.getPileConnectorCode(), dto.getStatus());
|
||||||
|
response = new RestApiResponse<>(result);
|
||||||
|
}catch (BusinessException e) {
|
||||||
|
logger.error("联联平台设备状态变化推送 error",e);
|
||||||
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.error("联联平台设备状态变化推送 error", e);
|
||||||
|
response = new RestApiResponse<>(e);
|
||||||
|
}
|
||||||
|
logger.info("联联平台设备状态变化推送 result:{}", response);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 联联平台查询充电站信息
|
* 联联平台查询充电站信息
|
||||||
* http://localhost:8080/LianLian/query_stations_info
|
* http://localhost:8080/LianLian/query_stations_info
|
||||||
|
|||||||
@@ -227,8 +227,8 @@ public class PileStationInfoController extends BaseController {
|
|||||||
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
|
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||||
}
|
}
|
||||||
lianLianService.pushStationInfo(dto);
|
String result = lianLianService.pushStationInfo(dto);
|
||||||
response = new RestApiResponse<>();
|
response = new RestApiResponse<>(result);
|
||||||
}catch (BusinessException e) {
|
}catch (BusinessException e) {
|
||||||
logger.error("推送联联平台充电站信息 error",e);
|
logger.error("推送联联平台充电站信息 error",e);
|
||||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ public class HttpRequestUtil {
|
|||||||
Map<String, String> map = (Map<String, String>) JSON.parse(hutoolRequest);
|
Map<String, String> map = (Map<String, String>) JSON.parse(hutoolRequest);
|
||||||
|
|
||||||
String rData = map.get("Data");
|
String rData = map.get("Data");
|
||||||
|
String resultMsg = map.get("Msg");
|
||||||
|
|
||||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(rData),
|
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(rData),
|
||||||
dataSecret.getBytes(), dataSecretIV.getBytes());
|
dataSecret.getBytes(), dataSecretIV.getBytes());
|
||||||
@@ -137,6 +138,6 @@ public class HttpRequestUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("解密数据:" + plainData);
|
System.out.println("解密数据:" + plainData);
|
||||||
return plainData;
|
return resultMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,22 +19,22 @@ public class LianLianPushStationInfoDTO {
|
|||||||
/**
|
/**
|
||||||
* 运营商id
|
* 运营商id
|
||||||
*/
|
*/
|
||||||
private String OperatorID;
|
private String operatorID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 签名秘钥
|
* 签名秘钥
|
||||||
*/
|
*/
|
||||||
private String SigSecret;
|
private String signSecret;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息密钥
|
* 消息密钥
|
||||||
*/
|
*/
|
||||||
private String DataSecret;
|
private String dataSecret;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息密钥初始化向量
|
* 消息密钥初始化向量
|
||||||
*/
|
*/
|
||||||
private String DataSecretIV;
|
private String dataSecretIv;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 令牌
|
* 令牌
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jsowell.pile.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 练练平台推送信息参数DTO
|
||||||
|
*
|
||||||
|
* @author JS-ZZA
|
||||||
|
* @date 2023/5/26 9:26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PushInfoParamDTO {
|
||||||
|
private String pileConnectorCode;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@@ -649,7 +649,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
@Override
|
@Override
|
||||||
public String pushConnectorStatus(String pileConnectorCode, String status) {
|
public String pushConnectorStatus(String pileConnectorCode, String status) {
|
||||||
// 查出该桩所属哪个站点
|
// 查出该桩所属哪个站点
|
||||||
String pileSn = StringUtils.substring(pileConnectorCode, 0, 16);
|
String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||||
PileStationVO stationVO = pileStationInfoService.getStationInfoByPileSn(pileSn);
|
PileStationVO stationVO = pileStationInfoService.getStationInfoByPileSn(pileSn);
|
||||||
// 通过站点id查询相关配置信息
|
// 通过站点id查询相关配置信息
|
||||||
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(stationVO.getId()));
|
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(stationVO.getId()));
|
||||||
|
|||||||
Reference in New Issue
Block a user