diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/JumpController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/JumpController.java index 1b72825c7..aab943325 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/JumpController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/JumpController.java @@ -2,6 +2,7 @@ package com.jsowell.api.uniapp.customer; import com.alibaba.fastjson2.JSON; import com.jsowell.common.UserAgentUtils; +import com.jsowell.common.YouDianUtils; import com.jsowell.common.annotation.Anonymous; import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.domain.AjaxResult; @@ -100,6 +101,11 @@ public class JumpController extends BaseController { logger.error("修改第三方平台枪口状态 error", e); } + // 如果pileSN长度为8位需要解析一下 + if (pileSn.length() == 8) { + pileSn = YouDianUtils.resolvePhysicalId(pileSn); + } + try { // 进入充电桩详情做一下鉴权 String memberId = getMemberIdByAuthorization(request); @@ -113,7 +119,7 @@ public class JumpController extends BaseController { logger.error("app-xcx-h5查询充电桩详情 error", e); response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_PILE_DETAIL_ERROR); } - logger.info("app-xcx-h5查询充电桩详情 param:{}, result:{}", pileSn, JSON.toJSONString(response)); + logger.info("app-xcx-h5查询充电桩详情withConnectorCode param:{}, result:{}", pileSn, JSON.toJSONString(response)); return response; } diff --git a/jsowell-admin/src/main/java/com/jsowell/service/PileService.java b/jsowell-admin/src/main/java/com/jsowell/service/PileService.java index 62927ebe5..bcc7a3081 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/PileService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/PileService.java @@ -232,10 +232,13 @@ public class PileService { // 判断桩是否在线 boolean onLineStatus = pileConnectorInfoService.checkPileOffLine(pileInfoVO.getPileSn()); - log.info("查询充电枪口详情-判断桩是否在线:{}, onLineStatus:{}", pileInfoVO.getPileSn(), onLineStatus); - if (onLineStatus) { - // true为离线 - throw new BusinessException(ReturnCodeEnum.CODE_PILE_CONNECTOR_STATUS_OFF_LINE); + String activeProfile = SpringUtils.getActiveProfile(); + log.info("查询充电枪口详情-判断桩是否在线:{}, onLineStatus:{}, activeProfile:{}", pileInfoVO.getPileSn(), onLineStatus, activeProfile); + if ("prd".equals(activeProfile)) { + if (onLineStatus) { + // true为离线 + throw new BusinessException(ReturnCodeEnum.CODE_PILE_CONNECTOR_STATUS_OFF_LINE); + } } // 查询站点信息 diff --git a/jsowell-common/src/main/java/com/jsowell/common/YouDianUtils.java b/jsowell-common/src/main/java/com/jsowell/common/YouDianUtils.java index cfdb7e3f5..81b3d081c 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/YouDianUtils.java +++ b/jsowell-common/src/main/java/com/jsowell/common/YouDianUtils.java @@ -13,6 +13,26 @@ 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 + * 1921ed07是前端解析出来的pileSn, 但不是实际的物理ID,需要通过识别码和编号计算出物理ID, 解析后为15540505 + * @param pileSN + * @return + */ + public static String resolvePhysicalId(String pileSN) { + byte[] bytes = BytesUtil.str2Bcd(pileSN); + int i = convertToPhysicalId(bytes); + return i + ""; + } + /** * 将byte数组转换为物理ID