mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
add 联联平台 请求启动充电 接口
This commit is contained in:
@@ -4,10 +4,7 @@ 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 com.jsowell.thirdparty.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -51,6 +48,13 @@ public interface LianLianService {
|
||||
*/
|
||||
EquipmentAuthVO query_equip_auth(QueryEquipmentDTO dto);
|
||||
|
||||
/**
|
||||
* 请求开始充电
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
QueryStartChargeVO query_start_charge(QueryStartChargeDTO dto);
|
||||
|
||||
/**
|
||||
* 查询充电状态
|
||||
* @param startChargeSeq
|
||||
|
||||
@@ -11,6 +11,7 @@ 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.StartChargingCommand;
|
||||
import com.jsowell.netty.command.ykc.StopChargingCommand;
|
||||
import com.jsowell.netty.service.yunkuaichong.YKCPushCommandService;
|
||||
import com.jsowell.pile.domain.*;
|
||||
@@ -26,6 +27,7 @@ import com.jsowell.pile.service.IPileStationInfoService;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.SendMessageVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.thirdparty.domain.ConnectorChargeStatusInfo;
|
||||
@@ -39,10 +41,7 @@ import com.jsowell.thirdparty.domain.StationInfo;
|
||||
import com.jsowell.thirdparty.domain.StationStatsInfo;
|
||||
import com.jsowell.thirdparty.domain.StationStatusInfo;
|
||||
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 com.jsowell.thirdparty.vo.*;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -210,7 +209,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
StationStatusInfos.add(stationStatusInfo);
|
||||
}
|
||||
}
|
||||
// TODO 将 StationStatusInfos 分页
|
||||
// 将 StationStatusInfos 分页
|
||||
int pageNum = 1;
|
||||
int pageSize = 10;
|
||||
List<StationStatusInfo> collect = StationStatusInfos.stream()
|
||||
@@ -363,13 +362,42 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
* 请求启动充电
|
||||
* @param dto
|
||||
*/
|
||||
public void query_start_charge(QueryStartChargeDTO dto) {
|
||||
public QueryStartChargeVO query_start_charge(QueryStartChargeDTO dto) {
|
||||
// 通过传过来的订单号和枪口号生成订单
|
||||
String orderCode = dto.getStartChargeSeq();
|
||||
// String orderCode = dto.getStartChargeSeq();
|
||||
String pileConnectorCode = dto.getConnectorID();
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getStartChargeSeq());
|
||||
if (orderInfo != null) {
|
||||
// 平台已存在订单
|
||||
throw new BusinessException("", "平台已存在订单");
|
||||
}
|
||||
|
||||
Map<String, Object> map = orderBasicInfoService.generateOrderForLianLian(dto);
|
||||
String orderCode = (String) map.get("orderCode");
|
||||
String transactionCode = (String) map.get("transactionCode");
|
||||
OrderBasicInfo orderBasicInfo = (OrderBasicInfo) map.get("orderBasicInfo");
|
||||
|
||||
|
||||
StartChargingCommand command = StartChargingCommand.builder()
|
||||
.pileSn(orderBasicInfo.getPileSn())
|
||||
.connectorCode(orderBasicInfo.getConnectorCode())
|
||||
.transactionCode(transactionCode)
|
||||
.chargeAmount(orderBasicInfo.getPayAmount())
|
||||
.logicCardNum(null)
|
||||
.physicsCardNum(null)
|
||||
.build();
|
||||
ykcPushCommandService.pushStartChargingCommand(command);
|
||||
|
||||
// 拼装对应的数据并返回
|
||||
QueryStartChargeVO vo = QueryStartChargeVO.builder()
|
||||
.StartChargeSeq(orderCode)
|
||||
.StartChargeSeqStat(1) // 1-启动中
|
||||
.ConnectorID(pileConnectorCode)
|
||||
.SuccStat(0)
|
||||
.FailReason(0)
|
||||
|
||||
.build();
|
||||
return vo;
|
||||
|
||||
// TODO 推送启动充电结果(调用接口 notification_start_charge_result)
|
||||
}
|
||||
@@ -383,11 +411,11 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
public QueryChargingStatusVO query_equip_charge_status(String startChargeSeq) {
|
||||
// 通过订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(startChargeSeq);
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(startChargeSeq);
|
||||
// 通过订单号查询实时数据
|
||||
if (orderInfo == null || orderDetail == null) {
|
||||
if (orderInfo == null) {
|
||||
throw new BusinessException("", "");
|
||||
}
|
||||
// OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderInfo.getOrderCode());
|
||||
List<RealTimeMonitorData> realTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
|
||||
RealTimeMonitorData data = realTimeData.get(0);
|
||||
String orderStatus = orderInfo.getOrderStatus();
|
||||
|
||||
43
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/vo/QueryStartChargeVO.java
vendored
Normal file
43
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/vo/QueryStartChargeVO.java
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.jsowell.thirdparty.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 请求启动充电VO
|
||||
*
|
||||
* @author JS-ZZA
|
||||
* @date 2023/4/28 14:33
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class QueryStartChargeVO {
|
||||
/**
|
||||
* 充电订单号
|
||||
*/
|
||||
private String StartChargeSeq;
|
||||
|
||||
/**
|
||||
* 充电订单状态
|
||||
*/
|
||||
private int StartChargeSeqStat;
|
||||
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
private String ConnectorID;
|
||||
|
||||
/**
|
||||
* 成功状态
|
||||
*/
|
||||
private int SuccStat;
|
||||
|
||||
/**
|
||||
* 失败原因
|
||||
*/
|
||||
private int FailReason;
|
||||
}
|
||||
Reference in New Issue
Block a user