This commit is contained in:
2024-04-07 14:31:11 +08:00
parent ae07f5d743
commit 120cb43957
6 changed files with 148 additions and 27 deletions

View File

@@ -0,0 +1,44 @@
package com.jsowell.common.enums.parkplatform;
/**
* 车位锁状态
*/
public enum ParkingLockAlarmEnum {
ALARM_CLEAR("00", "正常无报警"),
ARM_MALFUNCTION("55", "摇臂升降异常(未到位)"),
ARM_DAMAGED("FF", "待机状态摇臂破坏"),
;
private String value;
private String label;
ParkingLockAlarmEnum(String value, String label) {
this.value = value;
this.label = label;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public static String getLabelByValue(String value) {
for (ParkingLockAlarmEnum entity : ParkingLockAlarmEnum.values()) {
if (entity.getValue().equals(value)) {
return entity.getLabel();
}
}
return "";
}
}

View File

@@ -0,0 +1,44 @@
package com.jsowell.common.enums.parkplatform;
/**
* 车位锁状态
*/
public enum ParkingLockStatusEnum {
NOT_DEPLOYED("00", "未到位状态"),
LOCKED_RAISED("55", "升锁到位状态"),
LOCKED_LOWERED("FF", "降锁到位状态"),
;
private String value;
private String label;
ParkingLockStatusEnum(String value, String label) {
this.value = value;
this.label = label;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public static String getLabelByValue(String value) {
for (ParkingLockStatusEnum entity : ParkingLockStatusEnum.values()) {
if (entity.getValue().equals(value)) {
return entity.getLabel();
}
}
return "";
}
}

View File

@@ -6,7 +6,7 @@ package com.jsowell.common.enums.parkplatform;
* @author Lemon
* @Date 2023/9/22 15:26
*/
public enum ParkingEnum {
public enum ParkingPlatformEnum {
LU_TONG_YUN_TING_PLATFORM("1", "路通云停停车平台"),
RUAN_JIE_PLATFORM("2", "软杰停车平台"),
;
@@ -14,7 +14,7 @@ public enum ParkingEnum {
private String code;
private String label;
ParkingEnum(String code, String label) {
ParkingPlatformEnum(String code, String label) {
this.code = code;
this.label = label;
}

View File

@@ -0,0 +1,43 @@
package com.jsowell.common.enums.parkplatform;
/**
* 车位状态
*/
public enum ParkingStatusEnum {
NO_VEHICLES("00", "无车辆"),
PARKED_VEHICLES("FF", "停放车辆"),
;
private String value;
private String label;
ParkingStatusEnum(String value, String label) {
this.value = value;
this.label = label;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public static String getLabelByValue(String value) {
for (ParkingStatusEnum entity : ParkingStatusEnum.values()) {
if (entity.getValue().equals(value)) {
return entity.getLabel();
}
}
return "";
}
}

View File

@@ -6,6 +6,9 @@ import com.jsowell.common.core.domain.ykc.GroundLockData;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.parkplatform.ParkingLockAlarmEnum;
import com.jsowell.common.enums.parkplatform.ParkingLockStatusEnum;
import com.jsowell.common.enums.parkplatform.ParkingStatusEnum;
import com.jsowell.common.enums.uniapp.OccupyOrderPayStatusEnum;
import com.jsowell.common.enums.uniapp.OccupyOrderStatusEnum;
import com.jsowell.common.util.BytesUtil;
@@ -70,11 +73,13 @@ public class GroundLockDataUploadHandler extends AbstractHandler{
byte[] parkingLockStatusByteArr = BytesUtil.copyBytes(msgBody, 8, 1);
// String parkingLockStatus = BytesUtil.bcd2Str(parkingLockStatusByteArr);
String parkingLockStatus = BytesUtil.bin2HexStr(parkingLockStatusByteArr).toUpperCase(Locale.ROOT);
String parkingLockStatusDesc = ParkingLockStatusEnum.getLabelByValue(parkingLockStatus);
// 车位状态 0x00无车辆 0xFF停放车辆
byte[] parkingStatusByteArr = BytesUtil.copyBytes(msgBody, 9, 1);
// String parkingStatus = BytesUtil.bcd2Str(parkingStatusByteArr);
String parkingStatus = BytesUtil.bin2HexStr(parkingStatusByteArr).toUpperCase(Locale.ROOT);
String parkingStatusDesc = ParkingStatusEnum.getLabelByValue(parkingStatus);
// 地锁电量状态 百分比值0~100
byte[] groundLockElectricByteArr = BytesUtil.copyBytes(msgBody, 10, 1);
@@ -84,37 +89,28 @@ public class GroundLockDataUploadHandler extends AbstractHandler{
byte[] alarmStatusByteArr = BytesUtil.copyBytes(msgBody, 11, 1);
// String alarmStatus = BytesUtil.bcd2Str(alarmStatusByteArr);
String alarmStatus = BytesUtil.bin2HexStr(alarmStatusByteArr).toUpperCase(Locale.ROOT);
String alarmStatusDesc = ParkingLockAlarmEnum.getLabelByValue(alarmStatus);
// 预留位 全部置0
byte[] waitingUseByteArr = BytesUtil.copyBytes(msgBody, 12, 4);
String waitingUse = BytesUtil.bcd2Str(waitingUseByteArr);
if (StringUtils.equals(parkingLockStatus, "55")) {
log.info("0x61地锁数据车位锁状态:升锁到位状态");
if (StringUtils.equals(parkingStatus, "00")) {
log.info("0x61地锁数据车位锁状态: 升锁到位状态, 车位状态: 无车辆");
if (StringUtils.equals(parkingLockStatus, ParkingLockStatusEnum.LOCKED_RAISED.getValue())) {
if (StringUtils.equals(parkingStatus, ParkingStatusEnum.NO_VEHICLES.getValue())) {
try {
raiseTheGroundLock(pileSn, connectorCode);
}catch (Exception e) {
log.error("升锁逻辑error,", e);
}
} else {
log.info("0x61地锁数据车位锁状态: 升锁到位状态, 车位状态: 停放车辆");
}
} else if (StringUtils.equals(parkingLockStatus, "FF")) {
log.info("0x61地锁数据车位锁状态:降锁到位状态");
if (StringUtils.equals(parkingStatus, "00")) {
log.info("0x61地锁数据车位锁状态: 降锁到位状态, 车位状态: 无车辆");
} else {
log.info("0x61地锁数据车位锁状态: 降锁到位状态, 车位状态: 停放车辆");
} else if (StringUtils.equals(parkingLockStatus, ParkingLockStatusEnum.LOCKED_LOWERED.getValue())) {
if (StringUtils.equals(parkingStatus, ParkingStatusEnum.PARKED_VEHICLES.getValue())) {
try {
lowerTheGroundLock(pileSn, connectorCode);
}catch (Exception e) {
log.error("降锁逻辑error,", e);
}
}
} else {
log.info("0x61地锁数据车位锁状态:未到位状态");
}
// 封装到对象中
@@ -132,8 +128,8 @@ public class GroundLockDataUploadHandler extends AbstractHandler{
String redisKey = CacheConstants.GROUND_LOCK_DATA + pileSn + connectorCode;
redisCache.setCacheObject(redisKey, data, CacheConstants.cache_expire_time_10m);
log.info("[===地锁数据上送===] result: 桩编码:{}, 枪号:{}, 车位锁状态:{}, 车位状态:{}, 地锁电量状态:{}, 报警状态:{}",
pileSn, connectorCode, parkingLockStatus, parkingStatus, groundLockElectric, alarmStatus);
log.info("[===地锁数据上送===] result: 桩编码:{}, 枪号:{}, 车位锁状态:{}, 车位锁状态描述:{}, 车位状态:{}, 车位状态描述:{}, 地锁电量状态:{}, 报警状态:{}, 报警状态描述:{}",
pileSn, connectorCode, parkingLockStatus, parkingLockStatusDesc, parkingStatus, parkingStatusDesc, groundLockElectric, alarmStatus, alarmStatusDesc);
return null;
}

View File

@@ -7,16 +7,14 @@ import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.parkplatform.ParkingEnum;
import com.jsowell.common.enums.parkplatform.ParkingPlatformEnum;
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.enums.ykc.StartModeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.Threads;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.PileBasicInfo;
import com.jsowell.pile.domain.ThirdPartyStationRelation;
@@ -24,13 +22,10 @@ import com.jsowell.pile.domain.ThirdpartyParkingConfig;
import com.jsowell.pile.dto.PushStationInfoDTO;
import com.jsowell.pile.dto.ThirdPartyCommonStartChargeDTO;
import com.jsowell.pile.dto.ThirdPartyCommonStopChargeDTO;
import com.jsowell.pile.dto.huawei.HWQueryStartChargeDTO;
import com.jsowell.pile.dto.lutongyunting.BindCouponDTO;
import com.jsowell.pile.dto.ruanjie.UseCouponDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.pile.vo.huawei.QueryChargeStatusVO;
import com.jsowell.pile.vo.huawei.QueryEquipAuthVO;
import com.jsowell.pile.vo.huawei.QueryStartChargeVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.thirdparty.huawei.HuaweiServiceV2;
@@ -51,7 +46,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
@@ -472,7 +466,7 @@ public class CommonService {
if (StringUtils.isBlank(stationInfo.getParkingId())) {
return orderBasicInfo.getOrderCode() + " 该订单无需绑定优惠券";
}
if (StringUtils.equals(ParkingEnum.LU_TONG_YUN_TING_PLATFORM.getCode(), stationInfo.getParkingId())) {
if (StringUtils.equals(ParkingPlatformEnum.LU_TONG_YUN_TING_PLATFORM.getCode(), stationInfo.getParkingId())) {
// 路通云停
// 查询密钥等配置
ThirdpartyParkingConfig parkingInfo = thirdPartyParkingConfigService.selectByPrimaryKey(Integer.parseInt(stationInfo.getParkingId()));
@@ -489,7 +483,7 @@ public class CommonService {
.build();
// 绑定优惠券
return ltytService.bindCoupon(dto);
} else if (StringUtils.equals(ParkingEnum.RUAN_JIE_PLATFORM.getCode(), stationInfo.getParkingId())) {
} else if (StringUtils.equals(ParkingPlatformEnum.RUAN_JIE_PLATFORM.getCode(), stationInfo.getParkingId())) {
// 软杰
UseCouponDTO dto = UseCouponDTO.builder()
.fCouponCode(orderBasicInfo.getOrderCode()) // 优惠券编号(使用订单编号)