diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/PileController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/PileController.java index 17be21e5a..e61fa356b 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/PileController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/PileController.java @@ -21,6 +21,7 @@ import com.jsowell.web.controller.pile.PileConnectorInfoController; import com.jsowell.thirdparty.common.CommonService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StopWatch; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -259,7 +260,36 @@ public class PileController extends BaseController { return response; } - /** - * 预约充电接口 - */ + @PostMapping("/selectConnectorInfoListNo") + public RestApiResponse selectConnectorInfoListNo(@RequestBody QueryConnectorListDTO dto) { + RestApiResponse response = null; + try { + Map map = Maps.newHashMap(); + StopWatch stopWatch = new StopWatch("selectConnectorInfoListNo"); + stopWatch.start("查询枪口列表"); + List connectorInfoVOS = pileConnectorInfoService.selectConnectorInfoList(dto.getPileSn()); + stopWatch.stop(); + + stopWatch.start("查询计费模板"); + List billingPriceVOS = pileBillingTemplateService.queryBillingPrice(dto.getStationId()); + stopWatch.stop(); + + stopWatch.start("查询运营商信息"); + MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(dto.getMerchantId()); + stopWatch.stop(); + + map.put("connectorInfoList", connectorInfoVOS); + map.put("billingPriceList", billingPriceVOS); + map.put("merchantInfoVO", merchantInfoVO); + + response = new RestApiResponse<>(map); + + logger.info("查询充电枪口详情耗时:{}", stopWatch); + }catch (Exception e) { + logger.error("查询充电枪口详情 error", e); + response = new RestApiResponse<>(e); + } + logger.info("查询充电枪口详情 response:{}", 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 08dfd299c..70a8e0b37 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/PileService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/PileService.java @@ -186,6 +186,50 @@ public class PileService { throw new BusinessException(ReturnCodeEnum.CODE_STATION_IS_NOT_OPEN); } + List connectorInfoList = pileConnectorInfoService.selectConnectorInfoList(pileSn); + List billingPriceVOS = pileBillingTemplateService.queryBillingPrice(pileInfoVO.getStationId()); + MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(pileInfoVO.getMerchantId()); + + vo = AppletPileDetailVO.builder() + .pileInfo(pileInfoVO) + .connectorInfoList(connectorInfoList) + .merchantInfo(merchantInfoVO) + .stationInfo(stationInfo) + .billingPriceList(billingPriceVOS) + .build(); + return vo; + } + + public AppletPileDetailVO getPileDetailByPileSnOld(String param) throws Exception { + AppletPileDetailVO vo = null; + log.info("查询充电枪口详情-getPileDetailByPileSn, param:{}", param); + if (StringUtils.isBlank(param)) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } + String pileSn = YKCUtils.getPileSn(param); + log.info("查询充电枪口详情-getPileDetailByPileSn, pileSn:{}", pileSn); + // 查询充电桩信息 + PileInfoVO pileInfoVO = pileBasicInfoService.selectPileInfoBySn(pileSn); + log.info("查询充电枪口详情-pileInfoVO:{}", JSON.toJSONString(pileInfoVO)); + if (pileInfoVO == null) { + return null; + } + + // 判断桩是否在线 + 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); + } + + // 查询站点信息 + PileStationVO stationInfo = pileStationInfoService.getStationInfo(pileInfoVO.getStationId()); + log.info("查询充电枪口详情-getStationInfo:{}, onLineStatus:{}", pileInfoVO.getStationId(), JSON.toJSONString(stationInfo)); + if (stationInfo == null || StringUtils.equals(stationInfo.getOpenFlag(), Constants.ZERO)) { + throw new BusinessException(ReturnCodeEnum.CODE_STATION_IS_NOT_OPEN); + } + // 查询充电桩下枪口信息 CompletableFuture> connectorInfoListFuture = CompletableFuture.supplyAsync(() -> pileConnectorInfoService.selectConnectorInfoList(pileSn)); log.info("查询充电枪口详情-supplyAsync-selectConnectorInfoList:{}", connectorInfoListFuture);