mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update联联平台
This commit is contained in:
@@ -47,6 +47,7 @@ import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.util.*;
|
||||
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -64,6 +65,7 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* 上海联联平台
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
@@ -867,6 +869,28 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String pushOrderInfo(QueryOrderDTO dto) {
|
||||
ThirdPartySecretInfoVO wangKuaiDianPlatformSecretInfo = getLianLianPlatformSecretInfo();
|
||||
|
||||
// 根据站点id, 开始时间,结束时间查询出所有的订单信息
|
||||
// List<OrderListVO> orderListVOS = orderBasicInfoService.selectOrderBasicInfoList(dto);
|
||||
List<String> orderCodes = orderBasicInfoService.tempGetOrderCodes(dto);
|
||||
if (CollectionUtils.isEmpty(orderCodes)) {
|
||||
return "订单信息为空";
|
||||
}
|
||||
// List<String> orderCodeList = orderListVOS.stream().map(OrderListVO::getOrderCode).collect(Collectors.toList());
|
||||
for (String orderCode : orderCodes) {
|
||||
try {
|
||||
String result = notificationChargeOrderInfo(orderCode, wangKuaiDianPlatformSecretInfo);
|
||||
log.info("订单:{} 推送结果:{}", orderCode, result);
|
||||
}catch (Exception e) {
|
||||
log.error("订单:{} 推送error, ", orderCode, e);
|
||||
}
|
||||
}
|
||||
return "Success";
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单信息推送 notification_orderInfo
|
||||
*
|
||||
@@ -1175,6 +1199,12 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param stationId
|
||||
* @param secretInfoVO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String notificationStationFee(String stationId, ThirdPartySecretInfoVO secretInfoVO) {
|
||||
PushStationFeeVO vo = new PushStationFeeVO();
|
||||
@@ -1233,7 +1263,7 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 推送订单结算信息 notification_order_settlement_info
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> notificationOrderSettlementInfo(PushOrderSettlementDTO dto) {
|
||||
@@ -1443,6 +1473,46 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送启动充电结果 notification_start_charge_result
|
||||
* @param orderCode 订单编号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String notificationStartChargeResult(String orderCode) {
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
if (orderInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getLianLianPlatformSecretInfo();
|
||||
String operatorId = Constants.OPERATORID_JIANG_SU;
|
||||
String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = ningBoSecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = ningBoSecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = ningBoSecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = ningBoSecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
// 推送启动充电结果(调用接口 notification_start_charge_result)
|
||||
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_START_CHARGE_RESULT.getValue();
|
||||
// 拼装参数
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("StartChargeSeq", orderCode);
|
||||
json.put("ConnectorID", orderInfo.getPileConnectorCode());
|
||||
json.put("StartChargeSeqStat", 2); // 一定要给 2-充电中
|
||||
json.put("StartTime", DateUtils.getDateTime());
|
||||
|
||||
String jsonString = JSON.toJSONString(json);
|
||||
log.info("请求参数:{}", jsonString);
|
||||
|
||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电状态
|
||||
*
|
||||
@@ -1516,6 +1586,48 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送停止充电结果 notification_stop_charge_result
|
||||
* @param orderCode 订单编号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String notificationStopChargeResult(String orderCode) {
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
if (orderInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO wangKuaiDianPlatformSecretInfo = getLianLianPlatformSecretInfo();
|
||||
String operatorId = Constants.OPERATORID_JIANG_SU;
|
||||
String operatorSecret = wangKuaiDianPlatformSecretInfo.getTheirOperatorSecret();
|
||||
String signSecret = wangKuaiDianPlatformSecretInfo.getTheirSigSecret();
|
||||
String dataSecret = wangKuaiDianPlatformSecretInfo.getTheirDataSecret();
|
||||
String dataSecretIv = wangKuaiDianPlatformSecretInfo.getTheirDataSecretIv();
|
||||
String urlAddress = wangKuaiDianPlatformSecretInfo.getTheirUrlPrefix();
|
||||
|
||||
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_STOP_CHARGE_RESULT.getValue();
|
||||
|
||||
// 拼装联联平台参数
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("StartChargeSeq", orderCode);
|
||||
json.put("StartChargeSeqStat", 4); // 只能给 4-已结束
|
||||
json.put("ConnectorID", orderInfo.getPileConnectorCode());
|
||||
json.put("SuccStat", 0);
|
||||
json.put("FailReason", 0);
|
||||
|
||||
String jsonString = JSON.toJSONString(json);
|
||||
|
||||
log.info("请求参数:{}", jsonString);
|
||||
|
||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取联联平台配置密钥信息
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user