update 电单车

This commit is contained in:
Guoqs
2024-09-30 16:04:47 +08:00
parent a8d7e76d25
commit 061512145b
3 changed files with 19 additions and 10 deletions

View File

@@ -13,13 +13,6 @@ import java.util.Arrays;
@Slf4j
public class YouDianUtils {
public static void main(String[] args) {
String s = "1921ed07";
String s1 = resolvePhysicalId(s);
System.out.println(s1);
}
/**
* 解析物理id
* 电单车二维码地址:https://api.jsowellcloud.com/app-xcx-h5/pile/pileDetail/1921ed07/ff
@@ -122,6 +115,14 @@ public class YouDianUtils {
return BytesUtil.reverse(concat);
}
public static String getPhysicalIdHEXStr(int deviceNumber) {
byte[] physicalIdBytes = BytesUtil.intToBytes(deviceNumber, 3);
// 拼接识别码, 12路插座
byte[] concat = Bytes.concat(EBikeTypeEnum.socket_12way.getBytes(), physicalIdBytes);
byte[] reverse = BytesUtil.reverse(concat);
return BytesUtil.printHexBinary(reverse);
}
// public static String convertPortNumberToHex(int portNumber) {
// if (portNumber < 1 || portNumber > 16) {
// throw new IllegalArgumentException("Port number must be between 1 and 16.");

View File

@@ -2,6 +2,7 @@ package com.jsowell.pile.service.impl;
import com.alibaba.fastjson2.JSON;
import com.google.common.collect.Lists;
import com.jsowell.common.YouDianUtils;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
@@ -426,7 +427,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
// 获取桩状态
Map<String, String> pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileInfoVO.getPileSn()));
pileInfoVO.setStatus(pileStatusMap.get(pileInfoVO.getPileSn()));
String pileQrCodeUrl = getPileQrCodeUrl(pileInfoVO.getPileSn());
String pileQrCodeUrl = getPileQrCodeUrl(pileInfoVO.getPileSn(), pileInfoVO.getChargePortType());
pileInfoVO.setQrCodeURL(pileQrCodeUrl);
// 设备型号
PileModelInfo pileModelInfo = pileModelInfoService.selectPileModelInfoById(Long.parseLong(pileInfoVO.getModelId()));
@@ -445,7 +446,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
// 获取桩状态
Map<String, String> pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileInfoVO.getPileSn()));
pileInfoVO.setStatus(pileStatusMap.get(pileInfoVO.getPileSn()));
String pileQrCodeUrl = getPileQrCodeUrl(pileInfoVO.getPileSn());
String pileQrCodeUrl = getPileQrCodeUrl(pileInfoVO.getPileSn(), pileInfoVO.getChargePortType());
pileInfoVO.setQrCodeURL(pileQrCodeUrl);
// 设备型号
PileModelInfo pileModelInfo = pileModelInfoService.selectPileModelInfoById(Long.parseLong(pileInfoVO.getModelId()));
@@ -667,6 +668,10 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
*/
@Override
public String getPileQrCodeUrl(String pileSn) {
return getPileQrCodeUrl(pileSn, "");
}
public String getPileQrCodeUrl(String pileSn, String chargePortType) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(BASE_URL_PREFIX);
stringBuilder.append("/app-xcx-h5/pile/pileDetail/");
@@ -674,6 +679,9 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
if (!stringBuilder.toString().endsWith("/")) {
stringBuilder.append("/");
}
if (StringUtils.equals(chargePortType, "3")) {
pileSn = YouDianUtils.getPhysicalIdHEXStr(Integer.parseInt(pileSn));
}
stringBuilder.append(pileSn);
}
return stringBuilder.toString();

View File

@@ -262,7 +262,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.sim_id AS simId,
t5.iccid AS iccid ,
t5.sim_supplier as simSupplier,
IF(t4.charger_pile_type = '2','3',(IF(t4.speed_type = '1','1','2'))) AS pileType,
IF(t4.charger_pile_type = '2','3',(IF(t4.speed_type = '1','1','2'))) AS chargePortType,
t5.operator
FROM
pile_basic_info t1