mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
联联平台 查询充电状态接口
This commit is contained in:
@@ -5,6 +5,7 @@ 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 java.util.List;
|
||||
|
||||
@@ -47,4 +48,10 @@ public interface LianLianService {
|
||||
* @return
|
||||
*/
|
||||
EquipmentAuthVO query_equip_auth(QueryEquipmentDTO dto);
|
||||
|
||||
/**
|
||||
* 查询充电状态
|
||||
* @param startChargeSeq
|
||||
*/
|
||||
QueryChargingStatusVO query_equip_charge_status(String startChargeSeq);
|
||||
}
|
||||
|
||||
@@ -4,16 +4,16 @@ import cn.hutool.core.util.PageUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
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.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.PileConnectorInfo;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.service.IOrderBasicInfoService;
|
||||
import com.jsowell.pile.service.IPileBasicInfoService;
|
||||
@@ -39,6 +39,7 @@ 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 org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -70,6 +71,8 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
@Autowired
|
||||
private IOrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Override
|
||||
public void pushMerchantInfo(Long merchantId) {
|
||||
@@ -352,6 +355,77 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求启动充电
|
||||
* @param dto
|
||||
*/
|
||||
public void query_start_charge(QueryStartChargeDTO dto) {
|
||||
// 通过传过来的订单号和枪口号生成订单
|
||||
String startChargeSeq = dto.getStartChargeSeq();
|
||||
String pileConnectorCode = dto.getConnectorID();
|
||||
|
||||
|
||||
// 拼装对应的数据并返回
|
||||
|
||||
// TODO 推送启动充电结果(调用接口 notification_start_charge_result)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电状态
|
||||
* @param startChargeSeq
|
||||
* @return
|
||||
*/
|
||||
public QueryChargingStatusVO query_equip_charge_status(String startChargeSeq) {
|
||||
// 通过订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(startChargeSeq);
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(startChargeSeq);
|
||||
// 通过订单号查询实时数据
|
||||
if (orderInfo == null || orderDetail == null) {
|
||||
throw new BusinessException("", "");
|
||||
}
|
||||
List<RealTimeMonitorData> realTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
|
||||
RealTimeMonitorData data = realTimeData.get(0);
|
||||
String orderStatus = orderInfo.getOrderStatus();
|
||||
if (StringUtils.equals(orderStatus, OrderStatusEnum.IN_THE_CHARGING.getValue())) {
|
||||
// 充电中
|
||||
orderStatus = "2";
|
||||
}if (StringUtils.equals(orderStatus, OrderStatusEnum.ORDER_COMPLETE.getValue())) {
|
||||
// 充电完成
|
||||
orderStatus = "4";
|
||||
}else {
|
||||
// 直接给 5-未知
|
||||
orderStatus = "5";
|
||||
}
|
||||
// 拼装联联平台数据
|
||||
QueryChargingStatusVO vo = QueryChargingStatusVO.builder()
|
||||
.StartChargeSeq(startChargeSeq) // 订单号
|
||||
.StartChargeSeqStat(Integer.parseInt(orderStatus)) // 订单状态
|
||||
.ConnectorID(orderInfo.getPileConnectorCode()) // 枪口编码
|
||||
.ConnectorStatus(Integer.parseInt(data.getConnectorStatus())) // 枪口状态
|
||||
.CurrentA(new BigDecimal(data.getOutputCurrent())) // 电流
|
||||
.VoltageA(new BigDecimal(data.getOutputVoltage())) // 电压
|
||||
.Soc(new BigDecimal(data.getSOC()))
|
||||
.StartTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime())) // 开始时间
|
||||
.EndTime(DateUtils.getTime()) // 本次采样时间
|
||||
.TotalPower(new BigDecimal(data.getChargingDegree())) // 累计充电量
|
||||
// .ElecMoney(new BigDecimal()) // 累计电费
|
||||
// .SeviceMoney(new BigDecimal()) // 累计服务费
|
||||
.TotalMoney(new BigDecimal(data.getChargingAmount())) // 已充金额
|
||||
|
||||
.build();
|
||||
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void query_stop_charge(QueryStartChargeDTO dto) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取桩列表信息
|
||||
* @param pileStationInfo
|
||||
|
||||
168
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/vo/QueryChargingStatusVO.java
vendored
Normal file
168
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/vo/QueryChargingStatusVO.java
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
package com.jsowell.thirdparty.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询充电状态VO
|
||||
*
|
||||
* @author JS-ZZA
|
||||
* @date 2023/4/24 14:33
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class QueryChargingStatusVO {
|
||||
|
||||
/**
|
||||
* 充电订单号
|
||||
*/
|
||||
private String StartChargeSeq;
|
||||
|
||||
/**
|
||||
* 充电订单状态
|
||||
*/
|
||||
private int StartChargeSeqStat;
|
||||
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
private String ConnectorID;
|
||||
|
||||
/**
|
||||
* 充电设备接口状态
|
||||
*/
|
||||
private int ConnectorStatus;
|
||||
|
||||
/**
|
||||
* 车辆识别码
|
||||
*/
|
||||
private String Vin;
|
||||
|
||||
/**
|
||||
* A 相电流
|
||||
*/
|
||||
private BigDecimal CurrentA;
|
||||
|
||||
/**
|
||||
* B 相电流
|
||||
*/
|
||||
private BigDecimal CurrentB;
|
||||
|
||||
/**
|
||||
* C 相电流
|
||||
*/
|
||||
private BigDecimal CurrentC;
|
||||
|
||||
/**
|
||||
* A 相电压
|
||||
*/
|
||||
private BigDecimal VoltageA;
|
||||
|
||||
/**
|
||||
* B 相电压
|
||||
*/
|
||||
private BigDecimal VoltageB;
|
||||
|
||||
/**
|
||||
* C 相电压
|
||||
*/
|
||||
private BigDecimal VoltageC;
|
||||
|
||||
/**
|
||||
* 电池剩余电量
|
||||
*/
|
||||
private BigDecimal Soc;
|
||||
|
||||
/**
|
||||
* 开始充电时间
|
||||
*/
|
||||
private String StartTime;
|
||||
|
||||
/**
|
||||
* 本次采样时间
|
||||
*/
|
||||
private String EndTime;
|
||||
|
||||
/**
|
||||
* 累计充电量
|
||||
*/
|
||||
private BigDecimal TotalPower;
|
||||
|
||||
/**
|
||||
* 累计电费
|
||||
*/
|
||||
private BigDecimal ElecMoney;
|
||||
|
||||
/**
|
||||
* 累计服务费
|
||||
*/
|
||||
private BigDecimal SeviceMoney;
|
||||
|
||||
/**
|
||||
* 累计总金额
|
||||
*/
|
||||
private BigDecimal TotalMoney;
|
||||
|
||||
/**
|
||||
* 是否可申请停车费减免
|
||||
*/
|
||||
private int ParkingFeeDiscount;
|
||||
|
||||
/**
|
||||
* 时段数 N 范围:0~32
|
||||
*/
|
||||
private int SumPeriod;
|
||||
|
||||
/**
|
||||
* 充电明细信息
|
||||
*/
|
||||
private List<ChargeDetail> ChargeDetails;
|
||||
|
||||
/**
|
||||
* 充电明细信息体
|
||||
*/
|
||||
@Data
|
||||
public static class ChargeDetail {
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private String DetailStartTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private String DetailEndTime;
|
||||
|
||||
/**
|
||||
* 时段电价
|
||||
*/
|
||||
private BigDecimal ElecPrice;
|
||||
|
||||
/**
|
||||
* 时段服务费价格
|
||||
*/
|
||||
private BigDecimal SevicePrice;
|
||||
|
||||
/**
|
||||
* 时段充电量
|
||||
*/
|
||||
private BigDecimal DetailPower;
|
||||
|
||||
/**
|
||||
* 时段电费
|
||||
*/
|
||||
private BigDecimal DetailElecMoney;
|
||||
|
||||
/**
|
||||
* 时段服务费
|
||||
*/
|
||||
private BigDecimal DetailSeviceMoney;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user