From 2df857b39cd3cbbdea50509b840b9b34a5662790 Mon Sep 17 00:00:00 2001 From: Lemon Date: Thu, 1 Aug 2024 14:52:52 +0800 Subject: [PATCH] =?UTF-8?q?bugfix=20=20=E5=90=8E=E7=AE=A1=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E8=BF=90=E8=90=A5=E5=95=86id=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=AB=99=E7=82=B9=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/PileStationInfoController.java | 2 +- .../yunkuaichong/NettyServerHandler.java | 2 +- .../pile/service/PileStationInfoService.java | 8 +++++++ .../impl/PileStationInfoServiceImpl.java | 24 +++++++++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java index 3f242b0c8..24ae59647 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java @@ -224,7 +224,7 @@ public class PileStationInfoController extends BaseController { @PreAuthorize("@ss.hasPermi('pile:station:query')") @PostMapping(value = "/selectStationListByMerchantId") public AjaxResult selectStationListByMerchantId(@RequestBody QueryStationDTO dto) { - return AjaxResult.success(pileStationInfoService.selectStationListByMerchantId(Long.valueOf(dto.getMerchantId()))); + return AjaxResult.success(pileStationInfoService.selectStationListByMerchantIdWithAuth(Long.valueOf(dto.getMerchantId()))); } /** diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/server/yunkuaichong/NettyServerHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/server/yunkuaichong/NettyServerHandler.java index 35c668f62..99f5b7ccf 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/server/yunkuaichong/NettyServerHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/server/yunkuaichong/NettyServerHandler.java @@ -66,7 +66,7 @@ public class NettyServerHandler extends SimpleChannelInboundHandler { */ @Override public void channelRead(ChannelHandlerContext ctx, Object message) throws Exception { - log.info("加载客户端报文channelRead=== channelId:" + ctx.channel().id() + ", msg:" + message); + // log.info("加载客户端报文channelRead=== channelId:" + ctx.channel().id() + ", msg:" + message); // 下面可以解析数据,保存数据,生成返回报文,将需要返回报文写入write函数 byte[] msg = (byte[]) message; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java index 1e2d1d05b..214495812 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java @@ -45,6 +45,14 @@ public interface PileStationInfoService { */ public List selectStationListByMerchantId(Long merchantId); + /** + * 通过运营商id查询站点信息(带权限校验) + * + * @param merchantId 运营商id + * @return 站点信息列表 + */ + public List selectStationListByMerchantIdWithAuth(Long merchantId); + /** * 新增充电站信息 * 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 c562be474..e149ef420 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 @@ -270,6 +270,30 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { return pileStationInfoMapper.selectStationListByMerchantId(merchantId); } + /** + * 通过运营商id查询站点信息(带权限校验) + * + * @param merchantId 运营商id + * @return 站点信息列表 + */ + @Override + public List selectStationListByMerchantIdWithAuth(Long merchantId) { + AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap(); + if (authorizedMap == null) { + return null; + } + List pileStationInfos = pileStationInfoMapper.selectStationListByMerchantId(merchantId); + // 站点管理员 + if (CollectionUtils.isNotEmpty(authorizedMap.getStationDeptIds())) { + List stationDeptIds = authorizedMap.getStationDeptIds(); + // 筛选出来符合deptIds的数据 + pileStationInfos = pileStationInfos.stream() + .filter(pileStationInfo -> stationDeptIds.contains(pileStationInfo.getDeptId())) + .collect(Collectors.toList()); + } + return pileStationInfos; + } + /** * 新增充电站信息 *