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

@@ -5,12 +5,14 @@ import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.response.RestApiResponse;
import com.jsowell.pile.dto.QueryEquipmentDTO; import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO; 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.EquipmentAuthVO; import com.jsowell.thirdparty.vo.EquipmentAuthVO;
import com.jsowell.thirdparty.vo.LianLianPageResponse; import com.jsowell.thirdparty.vo.LianLianPageResponse;
import com.jsowell.thirdparty.vo.QueryChargingStatusVO; import com.jsowell.thirdparty.vo.QueryChargingStatusVO;
import com.jsowell.thirdparty.vo.QueryStopChargeVO;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -136,4 +138,26 @@ public class LianLianController extends BaseController {
logger.info("联联平台查询充电状态 result :{}", response); logger.info("联联平台查询充电状态 result :{}", response);
return response; return response;
} }
/**
* 请求停止充电
* @param dto
* @return
*/
@PostMapping("/query_stop_charge")
public RestApiResponse<?> query_stop_charge(@RequestBody QueryStartChargeDTO dto) {
logger.info("联联平台请求停止充电 params :{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response;
try {
QueryStopChargeVO queryStopChargeVO = lianLianService.query_stop_charge(dto);
response = new RestApiResponse<>(queryStopChargeVO);
} catch (Exception e) {
logger.error("联联平台请求停止充电 error", e);
response = new RestApiResponse<>(e);
}
logger.info("联联平台请求停止充电 result :{}", response);
return response;
}
} }

View File

@@ -1,5 +1,6 @@
package com.jsowell.pile.dto; package com.jsowell.pile.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
/** /**
@@ -13,25 +14,30 @@ public class QueryStartChargeDTO {
/** /**
* 充电订单号 * 充电订单号
*/ */
@JsonProperty(value = "StartChargeSeq")
private String StartChargeSeq; private String StartChargeSeq;
/** /**
* 充电设备接口编码 * 充电设备接口编码
*/ */
@JsonProperty(value = "ConnectorID")
private String ConnectorID; private String ConnectorID;
/** /**
* 二维码 * 二维码
*/ */
@JsonProperty(value = "QRCode")
private String QRCode; private String QRCode;
/** /**
* 用户手机号 * 用户手机号
*/ */
@JsonProperty(value = "PhoneNum")
private String PhoneNum; private String PhoneNum;
/** /**
* 车牌号 * 车牌号
*/ */
@JsonProperty(value = "PlateNum")
private String PlateNum; private String PlateNum;
} }

View File

@@ -22,6 +22,10 @@
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.jsowell</groupId>
<artifactId>jsowell-netty</artifactId>
</dependency>
</dependencies> </dependencies>

View File

@@ -1,11 +1,13 @@
package com.jsowell.thirdparty.service; package com.jsowell.thirdparty.service;
import com.jsowell.pile.dto.QueryEquipmentDTO; import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO;
import com.jsowell.thirdparty.domain.StationStatsInfo; import com.jsowell.thirdparty.domain.StationStatsInfo;
import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.vo.EquipmentAuthVO; import com.jsowell.thirdparty.vo.EquipmentAuthVO;
import com.jsowell.thirdparty.vo.LianLianPageResponse; import com.jsowell.thirdparty.vo.LianLianPageResponse;
import com.jsowell.thirdparty.vo.QueryChargingStatusVO; import com.jsowell.thirdparty.vo.QueryChargingStatusVO;
import com.jsowell.thirdparty.vo.QueryStopChargeVO;
import java.util.List; import java.util.List;
@@ -54,4 +56,11 @@ public interface LianLianService {
* @param startChargeSeq * @param startChargeSeq
*/ */
QueryChargingStatusVO query_equip_charge_status(String 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.DateUtils;
import com.jsowell.common.util.PageUtils; import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.StringUtils; 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.domain.*;
import com.jsowell.pile.dto.QueryEquipmentDTO; import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO; 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.EquipmentAuthVO;
import com.jsowell.thirdparty.vo.LianLianPageResponse; import com.jsowell.thirdparty.vo.LianLianPageResponse;
import com.jsowell.thirdparty.vo.QueryChargingStatusVO; import com.jsowell.thirdparty.vo.QueryChargingStatusVO;
import com.jsowell.thirdparty.vo.QueryStopChargeVO;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -72,7 +75,7 @@ public class LianLianServiceImpl implements LianLianService {
private IOrderBasicInfoService orderBasicInfoService; private IOrderBasicInfoService orderBasicInfoService;
@Autowired @Autowired
private RedisCache redisCache; private YKCPushCommandService ykcPushCommandService;
@Override @Override
public void pushMerchantInfo(Long merchantId) { 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 * @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;
}