mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
打印日志
This commit is contained in:
@@ -156,77 +156,71 @@ public class PileService {
|
||||
/**
|
||||
* 前端扫码跳转接口
|
||||
*/
|
||||
public AppletPileDetailVO getPileDetailByPileSn(String param) throws Exception{
|
||||
public AppletPileDetailVO getPileDetailByPileSn(String param) throws Exception {
|
||||
AppletPileDetailVO vo = null;
|
||||
try {
|
||||
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<List<ConnectorInfoVO>> connectorInfoListFuture = CompletableFuture.supplyAsync(() -> pileConnectorInfoService.selectConnectorInfoList(pileSn));
|
||||
log.info("查询充电枪口详情-supplyAsync-selectConnectorInfoList:{}", connectorInfoListFuture);
|
||||
|
||||
// 查计费模板信息
|
||||
CompletableFuture<List<BillingPriceVO>> billingPriceFuture = CompletableFuture.supplyAsync(() -> pileBillingTemplateService.queryBillingPrice(pileInfoVO.getStationId()));
|
||||
log.info("查询充电枪口详情-supplyAsync-queryBillingPrice:{}", billingPriceFuture);
|
||||
|
||||
// 查询运营商信息
|
||||
CompletableFuture<MerchantInfoVO> merchantInfoVOFuture = CompletableFuture.supplyAsync(() -> pileMerchantInfoService.getMerchantInfoVO(pileInfoVO.getMerchantId()));
|
||||
log.info("查询充电枪口详情-supplyAsync-getMerchantInfoVO:{}", merchantInfoVOFuture);
|
||||
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(connectorInfoListFuture, merchantInfoVOFuture, billingPriceFuture);
|
||||
// .join()和.get()都会阻塞并获取线程的执行情况
|
||||
// .join()会抛出未经检查的异常,不会强制开发者处理异常 .get()会抛出检查异常,需要开发者处理
|
||||
all.join();
|
||||
all.get();
|
||||
List<ConnectorInfoVO> connectorInfoList = connectorInfoListFuture.get();
|
||||
// List<ConnectorInfoVO> connectorInfoList = pileConnectorInfoService.selectConnectorInfoList(pileSn);
|
||||
log.info("查询充电枪口详情-connectorInfoList:{}", JSON.toJSONString(connectorInfoList));
|
||||
// PileStationVO pileStationVO = pileStationVOFuture.get();
|
||||
MerchantInfoVO merchantInfoVO = merchantInfoVOFuture.get();
|
||||
// List<BillingPriceVO> billingPriceVOS= pileBillingTemplateService.queryBillingPrice(pileInfoVO.getStationId());
|
||||
log.info("查询充电枪口详情-merchantInfoVO:{}", JSON.toJSONString(merchantInfoVO));
|
||||
List<BillingPriceVO> billingPriceVOS = billingPriceFuture.get();
|
||||
// MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(pileInfoVO.getMerchantId());
|
||||
log.info("查询充电枪口详情-billingPriceVOS:{}", JSON.toJSONString(billingPriceVOS));
|
||||
|
||||
|
||||
vo = AppletPileDetailVO.builder()
|
||||
.pileInfo(pileInfoVO)
|
||||
.connectorInfoList(connectorInfoList)
|
||||
.merchantInfo(merchantInfoVO)
|
||||
.stationInfo(stationInfo)
|
||||
.billingPriceList(billingPriceVOS)
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
log.error("查询充电枪详情error", e);
|
||||
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<List<ConnectorInfoVO>> connectorInfoListFuture = CompletableFuture.supplyAsync(() -> pileConnectorInfoService.selectConnectorInfoList(pileSn));
|
||||
log.info("查询充电枪口详情-supplyAsync-selectConnectorInfoList:{}", connectorInfoListFuture);
|
||||
|
||||
// 查计费模板信息
|
||||
CompletableFuture<List<BillingPriceVO>> billingPriceFuture = CompletableFuture.supplyAsync(() -> pileBillingTemplateService.queryBillingPrice(pileInfoVO.getStationId()));
|
||||
log.info("查询充电枪口详情-supplyAsync-queryBillingPrice:{}", billingPriceFuture);
|
||||
|
||||
// 查询运营商信息
|
||||
CompletableFuture<MerchantInfoVO> merchantInfoVOFuture = CompletableFuture.supplyAsync(() -> pileMerchantInfoService.getMerchantInfoVO(pileInfoVO.getMerchantId()));
|
||||
log.info("查询充电枪口详情-supplyAsync-getMerchantInfoVO:{}", merchantInfoVOFuture);
|
||||
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(connectorInfoListFuture, merchantInfoVOFuture, billingPriceFuture);
|
||||
// .join()和.get()都会阻塞并获取线程的执行情况
|
||||
// .join()会抛出未经检查的异常,不会强制开发者处理异常 .get()会抛出检查异常,需要开发者处理
|
||||
all.join();
|
||||
all.get();
|
||||
List<ConnectorInfoVO> connectorInfoList = connectorInfoListFuture.get();
|
||||
// List<ConnectorInfoVO> connectorInfoList = pileConnectorInfoService.selectConnectorInfoList(pileSn);
|
||||
log.info("查询充电枪口详情-connectorInfoList:{}", JSON.toJSONString(connectorInfoList));
|
||||
// PileStationVO pileStationVO = pileStationVOFuture.get();
|
||||
MerchantInfoVO merchantInfoVO = merchantInfoVOFuture.get();
|
||||
// List<BillingPriceVO> billingPriceVOS= pileBillingTemplateService.queryBillingPrice(pileInfoVO.getStationId());
|
||||
log.info("查询充电枪口详情-merchantInfoVO:{}", JSON.toJSONString(merchantInfoVO));
|
||||
List<BillingPriceVO> billingPriceVOS = billingPriceFuture.get();
|
||||
// MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(pileInfoVO.getMerchantId());
|
||||
log.info("查询充电枪口详情-billingPriceVOS:{}", JSON.toJSONString(billingPriceVOS));
|
||||
|
||||
vo = AppletPileDetailVO.builder()
|
||||
.pileInfo(pileInfoVO)
|
||||
.connectorInfoList(connectorInfoList)
|
||||
.merchantInfo(merchantInfoVO)
|
||||
.stationInfo(stationInfo)
|
||||
.billingPriceList(billingPriceVOS)
|
||||
.build();
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user