From 64a8ea3379fc60b804f6891fa404c14441f37d06 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Thu, 6 Apr 2023 15:30:55 +0800 Subject: [PATCH] update --- .../jsowell/service/PileRemoteService.java | 2 ++ .../java/com/jsowell/service/PileService.java | 16 +++++++----- .../pile/service/IPileStationInfoService.java | 3 ++- .../impl/PileBasicInfoServiceImpl.java | 1 + .../impl/PileStationInfoServiceImpl.java | 26 ++++++++++++++++--- 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/service/PileRemoteService.java b/jsowell-admin/src/main/java/com/jsowell/service/PileRemoteService.java index b4a09af20..00474111e 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/PileRemoteService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/PileRemoteService.java @@ -107,6 +107,8 @@ public class PileRemoteService { */ public void issueQRCode(String pileSn) { IssueQRCodeCommand command = IssueQRCodeCommand.builder().pileSn(pileSn).build(); + // 查询充电站info + ykcPushCommandService.pushIssueQRCodeCommand(command); } 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 7235918b4..495599d77 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/PileService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/PileService.java @@ -15,7 +15,6 @@ import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.SecurityUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.id.SnUtils; -import com.jsowell.netty.command.ykc.IssueQRCodeCommand; import com.jsowell.netty.service.yunkuaichong.YKCPushCommandService; import com.jsowell.pile.domain.MemberBasicInfo; import com.jsowell.pile.domain.OrderBasicInfo; @@ -106,6 +105,9 @@ public class PileService { @Autowired private YKCPushCommandService ykcPushCommandService; + @Autowired + private PileRemoteService pileRemoteService; + /** * 查询设备信息 * @@ -519,13 +521,15 @@ public class PileService { List pileSnList = pileDetailVOS.stream() .map(PileDetailVO::getPileSn) .collect(Collectors.toList()); - IssueQRCodeCommand command; + // IssueQRCodeCommand command; for (String pileSn : pileSnList) { // 给桩下发二维码 - command = new IssueQRCodeCommand(); - command.setPileSn(pileSn); - command.setQrcodePrefix(dto.getQrcodePrefix()); - ykcPushCommandService.pushIssueQRCodeCommand(command); + // command = new IssueQRCodeCommand(); + // command.setPileSn(pileSn); + // command.setQrcodePrefix(dto.getQrcodePrefix()); + // ykcPushCommandService.pushIssueQRCodeCommand(command); + + pileRemoteService.issueQRCode(pileSn); } return 1; } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileStationInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileStationInfoService.java index 8242dc454..14b65600f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileStationInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileStationInfoService.java @@ -4,7 +4,6 @@ import com.jsowell.common.core.page.PageResponse; import com.jsowell.pile.domain.PileStationInfo; import com.jsowell.pile.dto.FastCreateStationDTO; import com.jsowell.pile.dto.QueryStationDTO; -import com.jsowell.pile.vo.base.StationInfoVO; import com.jsowell.pile.vo.web.PileStationVO; import java.util.List; @@ -89,4 +88,6 @@ public interface IPileStationInfoService { PageResponse uniAppQueryStationInfoList(QueryStationDTO queryStationDTO); PileStationVO getStationInfo(String stationId); + + PileStationVO getStationInfoByPileSn(String pileSn); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java index c26ecfa50..8eab7ebd3 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java @@ -95,6 +95,7 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService { @Override public PileBasicInfo selectPileBasicInfoBySN(String pileSn) { + // 加缓存 return pileBasicInfoMapper.selectPileBasicInfoBySn(pileSn); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java index a56b5f5ad..04dfe8bda 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java @@ -1,31 +1,33 @@ package com.jsowell.pile.service.impl; import cn.hutool.core.util.PageUtil; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; import com.google.common.collect.Lists; import com.jsowell.common.constant.Constants; import com.jsowell.common.core.domain.entity.SysDept; import com.jsowell.common.core.domain.vo.AuthorizedDeptVO; import com.jsowell.common.core.page.PageResponse; -import com.jsowell.common.util.*; +import com.jsowell.common.util.DateUtils; +import com.jsowell.common.util.DistanceUtils; +import com.jsowell.common.util.SecurityUtils; +import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.ip.AddressUtils; import com.jsowell.pile.domain.PileStationInfo; import com.jsowell.pile.dto.FastCreateStationDTO; import com.jsowell.pile.dto.QueryStationDTO; import com.jsowell.pile.mapper.PileStationInfoMapper; +import com.jsowell.pile.service.IPileBasicInfoService; import com.jsowell.pile.service.IPileBillingTemplateService; import com.jsowell.pile.service.IPileConnectorInfoService; import com.jsowell.pile.service.IPileMerchantInfoService; import com.jsowell.pile.service.IPileStationInfoService; import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.base.MerchantInfoVO; +import com.jsowell.pile.vo.base.PileInfoVO; import com.jsowell.pile.vo.base.StationInfoVO; import com.jsowell.pile.vo.uniapp.CurrentTimePriceDetails; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.system.service.SysDeptService; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -58,6 +60,9 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService { @Autowired private SysDeptService sysDeptService; + @Autowired + private IPileBasicInfoService pileBasicInfoService; + /** * 查询充电站信息 * @@ -71,6 +76,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService { /** * 查询站点基本资料 + * 加缓存 * @param stationId * @return */ @@ -116,6 +122,18 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService { return vo; } + @Override + public PileStationVO getStationInfoByPileSn(String pileSn) { + // 通过pileSn查询充电桩(缓存方法) + PileInfoVO pileInfoVO = pileBasicInfoService.selectPileInfoBySn(pileSn); + if (pileInfoVO == null) { + return null; + } + // 通过stationId查询充电站信息(缓存方法) + PileStationVO stationInfo = getStationInfo(pileInfoVO.getStationId()); + return stationInfo; + } + /** * 查询充电站信息列表 *