update 电单车协议

This commit is contained in:
Guoqs
2024-08-16 14:16:50 +08:00
parent 7f8ffec164
commit 04b2b5a44f
6 changed files with 1109 additions and 1002 deletions

View File

@@ -1,7 +1,9 @@
package com.jsowell.netty.domain.ebike; package com.jsowell.netty.domain.ebike;
import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.BytesUtil;
import com.jsowell.netty.domain.ebike.deviceupload.DeviceRegister;
import com.jsowell.netty.domain.ebike.deviceupload.EBikeMessageCmd03; import com.jsowell.netty.domain.ebike.deviceupload.EBikeMessageCmd03;
import com.jsowell.netty.domain.ebike.deviceupload.EBikeMessageCmd20;
import com.jsowell.netty.domain.ebike.deviceupload.SettlementInfo; import com.jsowell.netty.domain.ebike.deviceupload.SettlementInfo;
import com.jsowell.netty.domain.ebike.serversend.EBikeMessageCmd82; import com.jsowell.netty.domain.ebike.serversend.EBikeMessageCmd82;
import com.jsowell.netty.domain.ebike.serversend.SpecificDataCmd82; import com.jsowell.netty.domain.ebike.serversend.SpecificDataCmd82;
@@ -40,6 +42,8 @@ public abstract class AbsEBikeMessage {
return new EBikeMessageCmd82(header, length, physicalId, messageId, command, null, checksum, new SpecificDataCmd82(dataBytes)); return new EBikeMessageCmd82(header, length, physicalId, messageId, command, null, checksum, new SpecificDataCmd82(dataBytes));
case "03": case "03":
return new EBikeMessageCmd03(header, length, physicalId, messageId, command, null, checksum, new SettlementInfo(dataBytes)); return new EBikeMessageCmd03(header, length, physicalId, messageId, command, null, checksum, new SettlementInfo(dataBytes));
case "20":
return new EBikeMessageCmd20(header, length, physicalId, messageId, command, null, checksum, new DeviceRegister(dataBytes));
default: default:
throw new IllegalArgumentException("Unsupported command: " + command); throw new IllegalArgumentException("Unsupported command: " + command);
} }

View File

@@ -0,0 +1,49 @@
package com.jsowell.netty.domain.ebike.deviceupload;
import com.jsowell.common.util.BytesUtil;
import lombok.Data;
import java.util.Arrays;
@Data
public class DeviceRegister {
/**
* 固件版本如100则表示V1.00版本
*/
private String firmwareVersion;
/**
* 端口数量 表示设备总共有多少个端口
*/
private String portNumber;
/**
* 虚拟ID需要内部组网的设备的本地地址如485、LORA系列如不需组网的设备默认为00
*/
private String virtualId;
/**
* 设备类型: 见01指令中的设备类型表
*/
private String deviceType;
/**
* 工作模式第0位0=联网1=刷卡。第1位0=RN82091=BL0939。第2位0=无短路预检1=有短路预检。第3位0=光耦检测模式1=带灯模式。
*/
private String workMode;
/**
* 电源板版本号电源板的固件版本号如没有电源板的机型则为0
*/
private String powerBoardVersion;
public DeviceRegister(byte[] dataBytes) {
this.firmwareVersion = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 0, 2)) + "";
this.portNumber = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 2, 3)) + "";
this.virtualId = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 3, 4)) + "";
this.deviceType = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 4, 5));
this.workMode = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 5, 6));
this.powerBoardVersion = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 6, 8));
}
}

View File

@@ -0,0 +1,27 @@
package com.jsowell.netty.domain.ebike.deviceupload;
import com.jsowell.netty.domain.ebike.AbsEBikeMessage;
import lombok.Data;
/**
* 设备注册包20指令
*/
@Data
public class EBikeMessageCmd20 extends AbsEBikeMessage {
private DeviceRegister deviceRegister;
public EBikeMessageCmd20(String header, int length, int physicalId, int messageId, String command, Object payload, int checksum, DeviceRegister deviceRegister) {
super(header, length, physicalId, messageId, command, payload, checksum);
this.deviceRegister = deviceRegister;
}
@Override
public void parsePayload(byte[] dataBytes) {
this.deviceRegister = new DeviceRegister(dataBytes);
}
public DeviceRegister getDeviceRegister() {
return deviceRegister;
}
}

View File

@@ -1220,7 +1220,6 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
dto.setMerchantId(pileConnectorDetailVO.getMerchantId()); dto.setMerchantId(pileConnectorDetailVO.getMerchantId());
dto.setStationId(pileConnectorDetailVO.getStationId()); dto.setStationId(pileConnectorDetailVO.getStationId());
// 获取处理逻辑 // 获取处理逻辑
// String mode = pileMerchantInfoService.getDelayModeByAppIdAndRequestSource(dto.getAppId(), dto.getRequestSource());
String mode = pileMerchantInfoService.getDelayModeByMerchantId(pileConnectorDetailVO.getMerchantId()); String mode = pileMerchantInfoService.getDelayModeByMerchantId(pileConnectorDetailVO.getMerchantId());
AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode); AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode);
return orderLogic.startPersonalPileCharging(dto); return orderLogic.startPersonalPileCharging(dto);

View File

@@ -1,5 +1,6 @@
package com.jsowell.pile.service.impl; package com.jsowell.pile.service.impl;
import cn.hutool.core.util.CoordinateUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@@ -13,7 +14,10 @@ import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException; import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.*; import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.DistanceUtils;
import com.jsowell.common.util.SecurityUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.ip.AddressUtils; import com.jsowell.common.util.ip.AddressUtils;
import com.jsowell.pile.domain.PileBasicInfo; import com.jsowell.pile.domain.PileBasicInfo;
import com.jsowell.pile.domain.PileStationInfo; import com.jsowell.pile.domain.PileStationInfo;
@@ -26,18 +30,16 @@ import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
import com.jsowell.pile.mapper.PileStationInfoMapper; import com.jsowell.pile.mapper.PileStationInfoMapper;
import com.jsowell.pile.service.*; import com.jsowell.pile.service.*;
import com.jsowell.pile.util.UserUtils; import com.jsowell.pile.util.UserUtils;
import com.jsowell.pile.vo.uniapp.business.BusinessOrderDetailInfoVO;
import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO;
import com.jsowell.pile.vo.base.*; import com.jsowell.pile.vo.base.*;
import com.jsowell.pile.vo.ningxiajiaotou.NXJTStationInfoVO; import com.jsowell.pile.vo.ningxiajiaotou.NXJTStationInfoVO;
import com.jsowell.pile.vo.uniapp.business.BusinessOrderDetailInfoVO;
import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO;
import com.jsowell.pile.vo.uniapp.business.StationOrderQuantityInfoVO; import com.jsowell.pile.vo.uniapp.business.StationOrderQuantityInfoVO;
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO; import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails; import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails;
import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.system.service.SysDeptService; import com.jsowell.system.service.SysDeptService;
import com.jsowell.system.service.SysUserService; import com.jsowell.system.service.SysUserService;
import com.yi.business.geo.GeoCodeInfo;
import com.yi.business.geo.TermRelationTreeCoordinate;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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;
@@ -119,6 +121,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 查询站点基本资料 * 查询站点基本资料
* 加缓存 * 加缓存
*
* @param stationId * @param stationId
* @return * @return
*/ */
@@ -205,6 +208,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 通过充电桩枪口编号查询充电站信息 * 通过充电桩枪口编号查询充电站信息
*
* @param pileConnectorCode 充电桩枪口编号 * @param pileConnectorCode 充电桩枪口编号
* @return 充电站信息 * @return 充电站信息
*/ */
@@ -219,6 +223,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 通过充电桩sn查询充电站信息 * 通过充电桩sn查询充电站信息
*
* @param pileSn 充电桩sn * @param pileSn 充电桩sn
* @return 充电站信息 * @return 充电站信息
*/ */
@@ -317,6 +322,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 快速建站 * 快速建站
*
* @param dto * @param dto
* @return * @return
*/ */
@@ -391,6 +397,17 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
} }
} }
// 2024年8月16日14点15分 天地图坐标转高德坐标
if (StringUtils.isNotBlank(pileStationInfo.getStationLng()) && StringUtils.isNotBlank(pileStationInfo.getStationLat())) {
// 获取经纬度
CoordinateUtil.Coordinate coordinate = CoordinateUtil.wgs84ToGcj02(Double.parseDouble(pileStationInfo.getStationLng()), Double.parseDouble(pileStationInfo.getStationLat()));
if (coordinate != null) {
pileStationInfo.setStationLng(String.valueOf(coordinate.getLng()));
pileStationInfo.setStationLat(String.valueOf(coordinate.getLat()));
}
}
pileStationInfo.setUpdateBy(SecurityUtils.getUsername()); pileStationInfo.setUpdateBy(SecurityUtils.getUsername());
pileStationInfo.setUpdateTime(DateUtils.getNowDate()); pileStationInfo.setUpdateTime(DateUtils.getNowDate());
int i = pileStationInfoMapper.updatePileStationInfo(pileStationInfo); int i = pileStationInfoMapper.updatePileStationInfo(pileStationInfo);
@@ -462,6 +479,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 充电站列表信息 * 充电站列表信息
*
* @param dto 前台参数 * @param dto 前台参数
* @return 充电站对象集合 * @return 充电站对象集合
*/ */
@@ -581,6 +599,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 根据站点id查询运营商配置的汇付会员id * 根据站点id查询运营商配置的汇付会员id
*
* @param stationId * @param stationId
* @return * @return
*/ */
@@ -596,6 +615,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 通过站点部门id查询站点id * 通过站点部门id查询站点id
*
* @param deptId * @param deptId
* @return * @return
*/ */
@@ -606,6 +626,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 绑定停车系统平台 * 绑定停车系统平台
*
* @param dto * @param dto
*/ */
@Override @Override
@@ -626,6 +647,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 查询充电站下拉列表 * 查询充电站下拉列表
*
* @param dto * @param dto
* @return * @return
*/ */
@@ -644,6 +666,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 宁夏交投查询充电站信息 * 宁夏交投查询充电站信息
*
* @param dto * @param dto
* @return * @return
*/ */
@@ -667,6 +690,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 获取站点统计信息 * 获取站点统计信息
*
* @param dto * @param dto
*/ */
@Override @Override
@@ -776,6 +800,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 获取站点运营分析信息7天、30天 * 获取站点运营分析信息7天、30天
*
* @param dto * @param dto
*/ */
@Override @Override
@@ -960,6 +985,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 获取站点运营分析信息12个月 * 获取站点运营分析信息12个月
*
* @param dto * @param dto
*/ */
@Override @Override
@@ -1048,6 +1074,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 查询订单数量趋势信息 * 查询订单数量趋势信息
*
* @param dto * @param dto
* @return * @return
*/ */
@@ -1143,6 +1170,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
/** /**
* 查询站点枪利用率趋势信息 * 查询站点枪利用率趋势信息
*
* @param dto * @param dto
* @return * @return
*/ */

View File

@@ -307,7 +307,7 @@
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>5.7.3</version> <version>5.8.30</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.huifu.adapay.core/adapay-core-sdk --> <!-- https://mvnrepository.com/artifact/com.huifu.adapay.core/adapay-core-sdk -->