update 联联平台接口

This commit is contained in:
Lemon
2023-05-16 10:10:34 +08:00
parent 7cf38df2a3
commit c2cc46d668
6 changed files with 241 additions and 88 deletions

View File

@@ -0,0 +1,41 @@
package com.jsowell.common.enums;
/**
* 联联平台桩状态
*
* @author JS-ZZA
* @date 2023/5/16 9:39
*/
public enum LianLianPileStatusEnum {
UNKNOWN("0", "未知"),
CONSTRUCTION("1", "建设中"),
CLOSE_OFFLINE("5", "关闭下线"),
UNDER_MAINTENANCE("6", "维护中"),
NORMAL("50", "正常"),
;
private String code;
private String value;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
LianLianPileStatusEnum(String code, String value) {
this.code = code;
this.value = value;
}
}

View File

@@ -0,0 +1,52 @@
package com.jsowell.common.enums;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
/**
* 站点 支付方式
*
* @author JS-ZZA
* @date 2023/5/16 9:17
*/
public enum StationPaymentEnum {
CARD_PAYMENT("0", "刷卡"),
ONLINE_PAYMENT("1", "线上"),
CASH_PAYMENT("2", "现金"),
;
private String code;
private String value;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
StationPaymentEnum(String code, String value) {
this.code = code;
this.value = value;
}
StationPaymentEnum() {
}
public static String getPaymentByCode(String code) {
for (StationPaymentEnum paymentEnum : StationPaymentEnum.values()) {
if (paymentEnum.getValue().equals(code)) {
return paymentEnum.getValue();
}
}
return "";
}
}

View File

@@ -20,7 +20,8 @@ public class ConnectorInfo {
* 充电设备接口编码 Y
* 充电设备接口编码,同一对接平台内唯一
*/
private String ConnectorID;
@JSONField(name = "ConnectorID")
private String connectorID;
/**
* 充电设备接口名称 N
@@ -34,27 +35,32 @@ public class ConnectorInfo {
* 3交流接口插头带枪线模式3连接方式C
* 4直流接口枪头带枪线模式4
*/
private Integer ConnectorType;
@JSONField(name = "ConnectorType")
private Integer connectorType;
/**
* 额定电压上限(单位V) Y
*/
private Integer VoltageUpperLimits;
@JSONField(name = "VoltageUpperLimits")
private Integer voltageUpperLimits;
/**
* 额定电压下限(单位V) Y
*/
private Integer VoltageLowerLimits;
@JSONField(name = "VoltageLowerLimits")
private Integer voltageLowerLimits;
/**
* 额定电流(单位A) Y
*/
private Integer Current;
@JSONField(name = "Current")
private Integer current;
/**
* 额定功率(单位kW) Y
*/
private BigDecimal Power;
@JSONField(name = "Power")
private BigDecimal power;
/**
* 车位号 N

View File

@@ -21,12 +21,14 @@ public class EquipmentInfo {
* 设备编码 Y
* 设备唯一编码,对同一对接平台,保证唯一
*/
private String EquipmentID;
@JSONField(name = "EquipmentID")
private String equipmentID;
/**
* 设备生产商组织机构代码 Y
*/
private String ManufacturerID;
@JSONField(name = "ManufacturerID")
private String manufacturerID;
/**
* 设备型号 N
@@ -49,12 +51,14 @@ public class EquipmentInfo {
* 建设时间 Y
* YYYY-MM-DD
*/
private String ConstructionTime;
@JSONField(name = "ConstructionTime")
private String constructionTime;
/**
* 设备类型(1-直流设备2-交流设备3-交直流一体设备) Y
*/
private Integer EquipmentType;
@JSONField(name = "EquipmentType")
private Integer equipmentType;
/**
* 设备状态 Y
@@ -64,24 +68,28 @@ public class EquipmentInfo {
* 6维护中
* 50正常使用
*/
private Integer EquipmentStatus;
@JSONField(name = "EquipmentStatus")
private Integer equipmentStatus;
/**
* 额定功率(单位kW) Y
*/
private BigDecimal EquipmentPower;
@JSONField(name = "EquipmentPower")
private BigDecimal equipmentPower;
/**
* 新国标(0-否1-是) Y
* 是否新国标
*/
private Integer NewNationalStandard;
@JSONField(name = "NewNationalStandard")
private Integer newNationalStandard;
/**
* 充电设备接口列表 Y
* 该充电设备所有的充电设备接口的信息对象集合
*/
private List<ConnectorInfo> ConnectorInfos;
@JSONField(name = "ConnectorInfos")
private List<ConnectorInfo> connectorInfos;
/**
* 充电设备经度 N
@@ -98,6 +106,7 @@ public class EquipmentInfo {
/**
* 是否支持VIN码识别(0-否1-是) Y
*/
private Integer VinFlag;
@JSONField(name = "VinFlag")
private Integer vinFlag;
}

View File

@@ -23,31 +23,36 @@ public class StationInfo {
* 充电站ID Y
* 对接平台自定义的唯一编码
*/
private String StationID;
@JSONField(name = "StationID")
private String stationID;
/**
* 对接平台ID Y
* 组织机构代码
*/
private String OperatorID;
@JSONField(name = "OperatorID")
private String operatorID;
/**
* 设备所属运营商ID Y
* 设备所属运营商组织机构代码
*/
private String EquipmentOwnerID;
@JSONField(name = "EquipmentOwnerID")
private String equipmentOwnerID;
/**
* 充电站名称 Y
* 充电站名称的描述
*/
private String StationName;
@JSONField(name = "StationName")
private String stationName;
/**
* 是否独立报桩 (0-否;1-是) Y
* 如果是独立报桩需要填写户号以及容量
*/
private Integer IsAloneApply;
@JSONField(name = "IsAloneApply")
private Integer isAloneApply;
/**
* 户号 N
@@ -65,7 +70,8 @@ public class StationInfo {
* 是否是公共停车场库 (0-否;1-是) Y
* 如果是公共停车场库需要填写场库编号
*/
private Integer IsPublicParkingLot;
@JSONField(name = "IsPublicParkingLot")
private Integer isPublicParkingLot;
/**
* 停车场库编号 N
@@ -77,18 +83,21 @@ public class StationInfo {
* 充电站国家代码 Y
* 比如CN
*/
private String CountryCode;
@JSONField(name = "CountryCode")
private String countryCode;
/**
* 充电站省市辖区编码 Y
* 填写内容为参照 GB/T2260-2015
*/
private String AreaCode;
@JSONField(name = "AreaCode")
private String areaCode;
/**
* 详细地址 Y
*/
private String Address;
@JSONField(name = "Address")
private String address;
/**
* 站点电话 N
@@ -100,7 +109,8 @@ public class StationInfo {
* 服务电话 Y
* 平台服务电话例如400 的电话
*/
private String ServiceTel;
@JSONField(name = "ServiceTel")
private String serviceTel;
/**
* 站点类型 Y
@@ -115,7 +125,8 @@ public class StationInfo {
* 106-单位(专用)
* 255-其他
*/
private Integer StationType;
@JSONField(name = "StationType")
private Integer stationType;
/**
* 站点状态 Y
@@ -125,25 +136,29 @@ public class StationInfo {
* 6维护中
* 50正常使用
*/
private Integer StationStatus;
@JSONField(name = "StationStatus")
private Integer stationStatus;
/**
* 车位数量 Y
* 可停放进行充电的车位总数(默认0-未知)
*/
private Integer ParkNums;
@JSONField(name = "ParkNums")
private Integer parkNums;
/**
* 经度 Y
* GCJ-02坐标系
*/
private BigDecimal StationLng;
@JSONField(name = "StationLng")
private BigDecimal stationLng;
/**
* 纬度 Y
* GCJ-02坐标系
*/
private BigDecimal StationLat;
@JSONField(name = "StationLat")
private BigDecimal stationLat;
/**
* 站点引导 N
@@ -170,7 +185,8 @@ public class StationInfo {
* 15出租车
* 255其他
*/
private Integer Construction;
@JSONField(name = "Construction")
private Integer construction;
/**
* 站点照片 N
@@ -206,7 +222,8 @@ public class StationInfo {
* 全天开放 Y
* 是否全天开放(0-否1-是),如果为0则营业时间必填
*/
private Integer OpenAllDay;
@JSONField(name = "OpenAllDay")
private Integer openAllDay;
/**
* 营业时间 N
@@ -218,25 +235,29 @@ public class StationInfo {
* 最低单价 Y
* 最低充电电费率
*/
private BigDecimal MinElectricityPrice;
@JSONField(name = "MinElectricityPrice")
private BigDecimal minElectricityPrice;
/**
* 充电电费率 Y
* 充电费描述,推荐格式XX 元/度
*/
private String ElectricityFee;
@JSONField(name = "ElectricityFee")
private String electricityFee;
/**
* 服务费率 Y
* 服务费率描述,推荐格式XX 元/度
*/
private String ServiceFee;
@JSONField(name = "ServiceFee")
private String serviceFee;
/**
* 免费停车 Y
* 是否停车免费(0-否1-是)
*/
private Integer ParkFree;
@JSONField(name = "ParkFree")
private Integer parkFree;
/**
* 停车费 N
@@ -248,13 +269,15 @@ public class StationInfo {
* 支付方式 Y
* 支付方式:刷卡、线上、现金 其中电子钱包类卡为刷卡,身份鉴权卡、微信/ 支付宝、APP为线上
*/
private String Payment;
@JSONField(name = "Payment")
private String payment;
/**
* 是否支持预约 Y
* 充电设备是否需要提前预约后才能使用。(0-不支持预约;1-支持预约) 不填默认为0
*/
private Integer SupportOrder;
@JSONField(name = "SupportOrder")
private Integer supportOrder;
/**
* 备注 N
@@ -266,7 +289,8 @@ public class StationInfo {
* 充电设备信息列表 Y
* 该充电站所有充电设备信息对象集合
*/
private List<EquipmentInfo> EquipmentInfos;
@JSONField(name = "EquipmentInfos")
private List<EquipmentInfo> equipmentInfos;
/**
* 停车收费类型 Y
@@ -275,46 +299,55 @@ public class StationInfo {
* 2:限时免费;
* 3:充电限免
*/
private Integer ParkFeeType;
@JSONField(name = "ParkFeeType")
private Integer parkFeeType;
/**
* 是否靠近卫生间(0-否1-是) Y
*/
private Integer ToiletFlag;
@JSONField(name = "ToiletFlag")
private Integer toiletFlag;
/**
* 是否靠近便利店(0-否1-是) Y
*/
private Integer StoreFlag;
@JSONField(name = "StoreFlag")
private Integer storeFlag;
/**
* 是否靠近餐厅(0-否1-是) Y
*/
private Integer RestaurantFlag;
@JSONField(name = "RestaurantFlag")
private Integer restaurantFlag;
/**
* 是否靠近休息室(0-否1-是) Y
*/
private Integer LoungeFlag;
@JSONField(name = "LoungeFlag")
private Integer loungeFlag;
/**
* 是否有雨棚(0-否1-是) Y
*/
private Integer CanopyFlag;
@JSONField(name = "CanopyFlag")
private Integer canopyFlag;
/**
* 是否有小票机(0-否1-是) Y
*/
private Integer PrinterFlag;
@JSONField(name = "PrinterFlag")
private Integer printerFlag;
/**
* 是否有道闸(0-否1-是) Y
*/
private Integer BarrierFlag;
@JSONField(name = "BarrierFlag")
private Integer barrierFlag;
/**
* 是否有地锁(0-否1-是) Y
*/
private Integer ParkingLockFlag;
@JSONField(name = "ParkingLockFlag")
private Integer parkingLockFlag;
}

View File

@@ -1,22 +1,21 @@
package com.jsowell.thirdparty.service.impl;
import cn.hutool.core.util.PageUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.enums.LianLianPileStatusEnum;
import com.jsowell.common.enums.StationPaymentEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
import com.jsowell.common.enums.ykc.PileStatusEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.*;
import com.jsowell.common.util.http.HttpUtils;
import com.jsowell.common.util.lianlian.*;
import com.jsowell.netty.command.ykc.StartChargingCommand;
import com.jsowell.netty.command.ykc.StopChargingCommand;
@@ -109,43 +108,44 @@ public class LianLianServiceImpl implements LianLianService {
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(dto.getStationId());
// 组装联联平台所需要的数据格式
StationInfo info = StationInfo.builder()
.StationID(String.valueOf(dto.getStationId()))
.OperatorID(dto.getOperatorID())
.EquipmentOwnerID(dto.getOperatorID())
.StationName(pileStationInfo.getStationName())
.IsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
.IsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()))
.CountryCode(pileStationInfo.getCountryCode())
.AreaCode("310118")
.Address(pileStationInfo.getAddress())
.ServiceTel(pileStationInfo.getStationTel())
.StationType(Integer.valueOf(pileStationInfo.getStationType()))
.StationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
.ParkNums(Integer.valueOf(pileStationInfo.getParkNums()))
.StationLng(new BigDecimal(pileStationInfo.getStationLng()))
.StationLat(new BigDecimal(pileStationInfo.getStationLat()))
.Construction(Integer.valueOf(pileStationInfo.getConstruction()))
.OpenAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay()))
.MinElectricityPrice(new BigDecimal("2"))
.ElectricityFee("2")
.ServiceFee("2")
.ParkFree(Integer.valueOf(pileStationInfo.getParkFree()))
.stationID(String.valueOf(dto.getStationId()))
.operatorID(dto.getOperatorID())
.equipmentOwnerID(Constants.OPERATORID_LIANLIAN)
.stationName(pileStationInfo.getStationName())
.isAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
.isPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()))
.countryCode(pileStationInfo.getCountryCode())
.areaCode(pileStationInfo.getAreaCode())
.address(pileStationInfo.getAddress())
.serviceTel(pileStationInfo.getStationTel())
.stationType(Integer.valueOf(pileStationInfo.getStationType()))
.stationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
.parkNums(Integer.valueOf(pileStationInfo.getParkNums()))
.stationLng(new BigDecimal(pileStationInfo.getStationLng()))
.stationLat(new BigDecimal(pileStationInfo.getStationLat()))
.construction(Integer.valueOf(pileStationInfo.getConstruction()))
.openAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay()))
.minElectricityPrice(new BigDecimal(Constants.ZERO))
.electricityFee(Constants.ZERO)
.serviceFee(Constants.ZERO)
.parkFree(Integer.valueOf(pileStationInfo.getParkFree()))
// .ParkFee("2")
.Payment("线上")
.SupportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()))
// .payment("线上")
.supportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()))
// .equipmentInfos()
.ParkFeeType(0)
.ToiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()))
.StoreFlag(Integer.valueOf(pileStationInfo.getStoreFlag()))
.RestaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()))
.LoungeFlag(Integer.valueOf(pileStationInfo.getLoungeFlag()))
.CanopyFlag(Integer.valueOf(pileStationInfo.getCanopyFlag()))
.PrinterFlag(Integer.valueOf(pileStationInfo.getPrinterFlag()))
.BarrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag()))
.ParkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag()))
.parkFeeType(0)
.toiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()))
.storeFlag(Integer.valueOf(pileStationInfo.getStoreFlag()))
.restaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()))
.loungeFlag(Integer.valueOf(pileStationInfo.getLoungeFlag()))
.canopyFlag(Integer.valueOf(pileStationInfo.getCanopyFlag()))
.printerFlag(Integer.valueOf(pileStationInfo.getPrinterFlag()))
.barrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag()))
.parkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag()))
.build();
String payment = StationPaymentEnum.getPaymentByCode(pileStationInfo.getPayment());
info.setPayment(payment);
List<EquipmentInfo> pileList = getPileList(pileStationInfo);
if (CollectionUtils.isNotEmpty(pileList)) {
info.setEquipmentInfos(pileList); // 充电设备信息列表
@@ -154,7 +154,7 @@ public class LianLianServiceImpl implements LianLianService {
// 调用联联平台接口
String url = "http://testdataexchange.evchargeonline.com:82/shevcs/v1/" + "notification_stationInfo";
String jsonStr = JSONUtil.toJsonStr(info);
String jsonStr = JSONObject.toJSONString(info);
JSONObject data = new JSONObject();
data.put("StationInfo", jsonStr);
@@ -653,14 +653,26 @@ public class LianLianServiceImpl implements LianLianService {
String pileSn = pileBasicInfo.getSn();
equipmentInfo.setEquipmentID(pileSn);
equipmentInfo.setManufacturerID("987654321");
equipmentInfo.setManufacturerID(Constants.OPERATORID_LIANLIAN);
equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileBasicInfo.getCreateTime()));
PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn);
equipmentInfo.setEquipmentType(Integer.valueOf(modelInfo.getSpeedType()));
// Map<String, String> pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn()));
equipmentInfo.setEquipmentStatus(50);
Map<String, String> pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileSn));
String pileStatus = pileStatusMap.get(pileSn);
if (StringUtils.equals(PileStatusEnum.ON_LINE.getValue(), pileStatus)) {
// 1-在线
pileStatus = LianLianPileStatusEnum.NORMAL.getCode();
} else if (StringUtils.equals(PileStatusEnum.OFF_LINE.getValue(), pileStatus)) {
// 2-离线
pileStatus = LianLianPileStatusEnum.CLOSE_OFFLINE.getCode();
} else if (StringUtils.equals(PileStatusEnum.FAULT.getValue(), pileStatus)) {
// 3-故障
pileStatus = LianLianPileStatusEnum.UNDER_MAINTENANCE.getCode();
}
equipmentInfo.setEquipmentStatus(Integer.valueOf(pileStatus));
equipmentInfo.setEquipmentPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP));
equipmentInfo.setNewNationalStandard(1);
equipmentInfo.setVinFlag(1);