mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 03:55:17 +08:00
update 联联平台查询充电状态接口
This commit is contained in:
@@ -64,9 +64,9 @@ public interface LianLianService {
|
||||
|
||||
/**
|
||||
* 查询充电状态
|
||||
* @param startChargeSeq
|
||||
* @param dto
|
||||
*/
|
||||
QueryChargingStatusVO query_equip_charge_status(String startChargeSeq);
|
||||
Map<String, String> query_equip_charge_status(QueryEquipChargeStatusDTO dto);
|
||||
|
||||
/**
|
||||
* 请求停止充电
|
||||
@@ -110,7 +110,7 @@ public interface LianLianService {
|
||||
* @param orderCode
|
||||
* @return
|
||||
*/
|
||||
String pushChargeStatus(String orderCode);
|
||||
String pushChargeStatus(String orderCode) throws UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* 推送停止充电结果(仅在 交易记录的帧类型中调用)
|
||||
|
||||
@@ -612,15 +612,19 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
/**
|
||||
* 查询充电状态
|
||||
*
|
||||
* @param startChargeSeq
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public QueryChargingStatusVO query_equip_charge_status(String startChargeSeq) {
|
||||
public Map<String, String> query_equip_charge_status(QueryEquipChargeStatusDTO dto) {
|
||||
// 通过订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(startChargeSeq);
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getStartChargeSeq());
|
||||
// 通过订单号查询实时数据
|
||||
if (orderInfo == null) {
|
||||
throw new BusinessException("", "");
|
||||
return null;
|
||||
}
|
||||
DockingPlatformConfig configInfo = dockingPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderInfo.getOrderCode());
|
||||
List<RealTimeMonitorData> realTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
|
||||
@@ -639,7 +643,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
}
|
||||
// 拼装联联平台数据
|
||||
QueryChargingStatusVO vo = QueryChargingStatusVO.builder()
|
||||
.StartChargeSeq(startChargeSeq) // 订单号
|
||||
.StartChargeSeq(dto.getStartChargeSeq()) // 订单号
|
||||
.StartChargeSeqStat(Integer.parseInt(orderStatus)) // 订单状态
|
||||
.ConnectorID(orderInfo.getPileConnectorCode()) // 枪口编码
|
||||
.ConnectorStatus(Integer.parseInt(data.getConnectorStatus())) // 枪口状态
|
||||
@@ -656,7 +660,19 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
.build();
|
||||
|
||||
|
||||
return vo;
|
||||
// 加密
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(vo).getBytes(),
|
||||
configInfo.getOperatorSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getOperatorSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -980,7 +996,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String pushChargeStatus(String orderCode) {
|
||||
public String pushChargeStatus(String orderCode) throws UnsupportedEncodingException {
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
// 通过站点id查询相关配置信息
|
||||
@@ -996,7 +1012,16 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
String urlAddress = settingInfo.getUrlAddress();
|
||||
|
||||
// 调用 查询充电状态方法
|
||||
QueryChargingStatusVO vo = query_equip_charge_status(orderCode);
|
||||
QueryEquipChargeStatusDTO dto = new QueryEquipChargeStatusDTO();
|
||||
dto.setStartChargeSeq(orderCode);
|
||||
Map<String, String> map = query_equip_charge_status(dto);
|
||||
String data = map.get("Data");
|
||||
// 解密data
|
||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data),
|
||||
operatorSecret.getBytes(), operatorSecret.getBytes());
|
||||
String dataStr = new String(plainText, "UTF-8");
|
||||
// 转成对应的对象
|
||||
QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = JSONObject.parseObject(dataStr, QueryEquipChargeStatusDTO.class);
|
||||
// 获取令牌
|
||||
String token = getToken(urlAddress, operatorId, operatorSecret);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
@@ -1004,7 +1029,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
}
|
||||
String url = urlAddress + "notification_equip_charge_status";
|
||||
// 调用联联平台接口
|
||||
String jsonString = JSONObject.toJSONString(vo);
|
||||
String jsonString = JSONObject.toJSONString(queryEquipChargeStatusDTO);
|
||||
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user