add 联联平台请求停止充电接口

This commit is contained in:
Lemon
2023-04-25 14:03:09 +08:00
parent c584ff91f4
commit ea34f51849
6 changed files with 130 additions and 2 deletions

View File

@@ -1,11 +1,13 @@
package com.jsowell.thirdparty.service;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO;
import com.jsowell.thirdparty.domain.StationStatsInfo;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.vo.EquipmentAuthVO;
import com.jsowell.thirdparty.vo.LianLianPageResponse;
import com.jsowell.thirdparty.vo.QueryChargingStatusVO;
import com.jsowell.thirdparty.vo.QueryStopChargeVO;
import java.util.List;
@@ -54,4 +56,11 @@ public interface LianLianService {
* @param startChargeSeq
*/
QueryChargingStatusVO query_equip_charge_status(String startChargeSeq);
/**
* 请求停止充电
* @param dto
* @return
*/
QueryStopChargeVO query_stop_charge(QueryStartChargeDTO dto);
}

View File

@@ -11,6 +11,8 @@ import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.netty.command.ykc.StopChargingCommand;
import com.jsowell.netty.service.yunkuaichong.YKCPushCommandService;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO;
@@ -40,6 +42,7 @@ import com.jsowell.thirdparty.service.LianLianService;
import com.jsowell.thirdparty.vo.EquipmentAuthVO;
import com.jsowell.thirdparty.vo.LianLianPageResponse;
import com.jsowell.thirdparty.vo.QueryChargingStatusVO;
import com.jsowell.thirdparty.vo.QueryStopChargeVO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -72,7 +75,7 @@ public class LianLianServiceImpl implements LianLianService {
private IOrderBasicInfoService orderBasicInfoService;
@Autowired
private RedisCache redisCache;
private YKCPushCommandService ykcPushCommandService;
@Override
public void pushMerchantInfo(Long merchantId) {
@@ -421,11 +424,55 @@ public class LianLianServiceImpl implements LianLianService {
}
/**
* 请求停止充电
* @param dto
* @return
*/
public QueryStopChargeVO query_stop_charge(QueryStartChargeDTO dto) {
QueryStopChargeVO vo = new QueryStopChargeVO();
public void query_stop_charge(QueryStartChargeDTO dto) {
String orderCode = dto.getStartChargeSeq();
// 根据订单号查询订单信息
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
if (orderInfo == null) {
throw new BusinessException("", "");
}
// 若状态为充电中,则发送停机指令
if (StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderInfo.getOrderStatus())) {
// 充电中
StopChargingCommand command = StopChargingCommand.builder()
.pileSn(orderInfo.getPileSn())
.connectorCode(orderInfo.getConnectorCode())
.build();
ykcPushCommandService.pushStopChargingCommand(command);
vo.setStartChargeSeq(orderCode);
vo.setStartChargeSeqStat(3); // 停止中
}
return vo;
}
// TODO 推送停止充电结果 notification_stop_charge_result
// TODO 推送充电订单信息 notification_charge_order_info
// TODO 推送订单对账结果信息 check_charge_orders
/**
* TODO 请求打印充电小票
*/
public void query_print_parking_ticket() {
}
// TODO 推送订单结算信息 notification_order_settlement_info
// TODO 查询订单结算信息 query_order_settlement_info
/**
* 获取桩列表信息
* @param pileStationInfo

View File

@@ -0,0 +1,38 @@
package com.jsowell.thirdparty.vo;
import lombok.Data;
/**
* 请求停止充电
*
* @author JS-ZZA
* @date 2023/4/25 11:21
*/
@Data
public class QueryStopChargeVO {
/**
* 充电订单号
*/
private String StartChargeSeq;
/**
* 充电订单状态 1、启动中 2、充电中3、停止中4、已结束5、未知
*/
private int StartChargeSeqStat;
/**
* 成功状态 0:成功; 1:失败
*/
private int SuccStat;
/**
* 失败原因
* 0:无;
* 1:此设备不存在;
* 2:此设备离线:
* 3:设备已停止充电;
* 499:自定义
*/
private int FailReason;
}