From 81f15e3dc0e1415d62fe493559ea931e19f1674c Mon Sep 17 00:00:00 2001 From: Lemon Date: Sun, 7 Apr 2024 09:08:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5=E7=AC=AC=E4=B8=89=E6=96=B9=E5=B9=B3=E5=8F=B0=E5=B9=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9E=AA=E5=8F=A3=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsowell/api/uniapp/JumpController.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/JumpController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/JumpController.java index fa934d3e9..3f973584a 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/JumpController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/JumpController.java @@ -10,12 +10,18 @@ import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.file.AliyunOssUploadUtils; import com.jsowell.common.util.file.FileUtils; +import com.jsowell.pile.domain.PileBasicInfo; +import com.jsowell.pile.dto.QueryConnectorListDTO; +import com.jsowell.pile.service.IThirdpartySnRelationService; import com.jsowell.pile.service.MemberGroupService; import com.jsowell.pile.service.PileBasicInfoService; import com.jsowell.pile.vo.base.PileInfoVO; import com.jsowell.pile.vo.uniapp.GroundLockInfoVO; import com.jsowell.pile.vo.uniapp.PileConnectorVO; +import com.jsowell.pile.vo.web.ThirdPartySnRelationVO; import com.jsowell.service.PileService; +import com.jsowell.thirdparty.common.CommonService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -38,6 +44,12 @@ public class JumpController extends BaseController { @Autowired private MemberGroupService memberGroupService; + @Autowired + private IThirdpartySnRelationService snRelationService; + + @Autowired + private CommonService commonService; + /** * 查询充电桩详情 * http://localhost:8080/app-xcx-h5/pile/pileDetail/{pileSn} @@ -47,6 +59,13 @@ public class JumpController extends BaseController { // logger.info("app-xcx-h5查询充电桩详情 param:{}", pileSn); logger.info("User-Agent:{}", request.getHeader("user-agent")); RestApiResponse response = null; + try { + // 如果对接了类似华为平台的第三方平台,先修改一下枪口状态 + updateThirdPartyConnectorStatus(pileSn); + }catch (Exception e) { + logger.error("修改第三方平台枪口状态 error", e); + } + try { // 进入充电桩详情做一下鉴权 String memberId = getMemberIdByAuthorization(request); @@ -92,6 +111,8 @@ public class JumpController extends BaseController { // logger.info("app-xcx-h5查询充电枪口详情 param:{}", pileConnectorCode); logger.info("User-Agent:{}", request.getHeader("user-agent")); RestApiResponse response = null; + // 截取桩号 + String pileSn = StringUtils.substring(pileConnectorCode, 0, 14); String memberId = null; try { @@ -100,6 +121,13 @@ public class JumpController extends BaseController { logger.error("进入充电桩详情做一下鉴权", e); } + try { + // 如果对接了类似华为平台的第三方平台,先修改一下枪口状态 + updateThirdPartyConnectorStatus(pileSn); + }catch (Exception e) { + logger.error("修改第三方平台枪口状态 error", e); + } + try { // 进入充电桩详情做一下鉴权 // String memberId = getMemberIdByAuthorization(request); @@ -170,4 +198,26 @@ public class JumpController extends BaseController { logger.info("获取地锁列表信息 result:{}", response); return response; } + + + private void updateThirdPartyConnectorStatus(String pileSn) { + // 根据桩号查询站点id + PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn); + if (pileBasicInfo == null) { + return; + } + Long stationId = pileBasicInfo.getStationId(); + String stationIdStr = String.valueOf(stationId); + List list = snRelationService.selectSnRelationListByParams(stationIdStr, null, null); + if (CollectionUtils.isEmpty(list)) { + return; + } + + for (ThirdPartySnRelationVO vo : list) { + String thirdPartyType = vo.getThirdPartyType(); + // 调用通用查询实时数据接口(需在接口中修改枪口状态) + commonService.commonQueryStationStatus(String.valueOf(stationId), thirdPartyType); + } + + } }